1*607ca46eSDavid Howells /* 2*607ca46eSDavid Howells * -- <linux/cdrom.h> 3*607ca46eSDavid Howells * General header file for linux CD-ROM drivers 4*607ca46eSDavid Howells * Copyright (C) 1992 David Giller, rafetmad@oxy.edu 5*607ca46eSDavid Howells * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de 6*607ca46eSDavid Howells * 1996 David van Leeuwen, david@tm.tno.nl 7*607ca46eSDavid Howells * 1997, 1998 Erik Andersen, andersee@debian.org 8*607ca46eSDavid Howells * 1998-2002 Jens Axboe, axboe@suse.de 9*607ca46eSDavid Howells */ 10*607ca46eSDavid Howells 11*607ca46eSDavid Howells #ifndef _UAPI_LINUX_CDROM_H 12*607ca46eSDavid Howells #define _UAPI_LINUX_CDROM_H 13*607ca46eSDavid Howells 14*607ca46eSDavid Howells #include <linux/types.h> 15*607ca46eSDavid Howells #include <asm/byteorder.h> 16*607ca46eSDavid Howells 17*607ca46eSDavid Howells /******************************************************* 18*607ca46eSDavid Howells * As of Linux 2.1.x, all Linux CD-ROM application programs will use this 19*607ca46eSDavid Howells * (and only this) include file. It is my hope to provide Linux with 20*607ca46eSDavid Howells * a uniform interface between software accessing CD-ROMs and the various 21*607ca46eSDavid Howells * device drivers that actually talk to the drives. There may still be 22*607ca46eSDavid Howells * 23 different kinds of strange CD-ROM drives, but at least there will 23*607ca46eSDavid Howells * now be one, and only one, Linux CD-ROM interface. 24*607ca46eSDavid Howells * 25*607ca46eSDavid Howells * Additionally, as of Linux 2.1.x, all Linux application programs 26*607ca46eSDavid Howells * should use the O_NONBLOCK option when opening a CD-ROM device 27*607ca46eSDavid Howells * for subsequent ioctl commands. This allows for neat system errors 28*607ca46eSDavid Howells * like "No medium found" or "Wrong medium type" upon attempting to 29*607ca46eSDavid Howells * mount or play an empty slot, mount an audio disc, or play a data disc. 30*607ca46eSDavid Howells * Generally, changing an application program to support O_NONBLOCK 31*607ca46eSDavid Howells * is as easy as the following: 32*607ca46eSDavid Howells * - drive = open("/dev/cdrom", O_RDONLY); 33*607ca46eSDavid Howells * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); 34*607ca46eSDavid Howells * It is worth the small change. 35*607ca46eSDavid Howells * 36*607ca46eSDavid Howells * Patches for many common CD programs (provided by David A. van Leeuwen) 37*607ca46eSDavid Howells * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ 38*607ca46eSDavid Howells * 39*607ca46eSDavid Howells *******************************************************/ 40*607ca46eSDavid Howells 41*607ca46eSDavid Howells /* When a driver supports a certain function, but the cdrom drive we are 42*607ca46eSDavid Howells * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will 43*607ca46eSDavid Howells * borrow the "Operation not supported" error from the network folks to 44*607ca46eSDavid Howells * accomplish this. Maybe someday we will get a more targeted error code, 45*607ca46eSDavid Howells * but this will do for now... */ 46*607ca46eSDavid Howells #define EDRIVE_CANT_DO_THIS EOPNOTSUPP 47*607ca46eSDavid Howells 48*607ca46eSDavid Howells /******************************************************* 49*607ca46eSDavid Howells * The CD-ROM IOCTL commands -- these should be supported by 50*607ca46eSDavid Howells * all the various cdrom drivers. For the CD-ROM ioctls, we 51*607ca46eSDavid Howells * will commandeer byte 0x53, or 'S'. 52*607ca46eSDavid Howells *******************************************************/ 53*607ca46eSDavid Howells #define CDROMPAUSE 0x5301 /* Pause Audio Operation */ 54*607ca46eSDavid Howells #define CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 55*607ca46eSDavid Howells #define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 56*607ca46eSDavid Howells #define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 57*607ca46eSDavid Howells (struct cdrom_ti) */ 58*607ca46eSDavid Howells #define CDROMREADTOCHDR 0x5305 /* Read TOC header 59*607ca46eSDavid Howells (struct cdrom_tochdr) */ 60*607ca46eSDavid Howells #define CDROMREADTOCENTRY 0x5306 /* Read TOC entry 61*607ca46eSDavid Howells (struct cdrom_tocentry) */ 62*607ca46eSDavid Howells #define CDROMSTOP 0x5307 /* Stop the cdrom drive */ 63*607ca46eSDavid Howells #define CDROMSTART 0x5308 /* Start the cdrom drive */ 64*607ca46eSDavid Howells #define CDROMEJECT 0x5309 /* Ejects the cdrom media */ 65*607ca46eSDavid Howells #define CDROMVOLCTRL 0x530a /* Control output volume 66*607ca46eSDavid Howells (struct cdrom_volctrl) */ 67*607ca46eSDavid Howells #define CDROMSUBCHNL 0x530b /* Read subchannel data 68*607ca46eSDavid Howells (struct cdrom_subchnl) */ 69*607ca46eSDavid Howells #define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) 70*607ca46eSDavid Howells (struct cdrom_read) */ 71*607ca46eSDavid Howells #define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) 72*607ca46eSDavid Howells (struct cdrom_read) */ 73*607ca46eSDavid Howells #define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 74*607ca46eSDavid Howells #define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 75*607ca46eSDavid Howells #define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 76*607ca46eSDavid Howells address of multi session disks 77*607ca46eSDavid Howells (struct cdrom_multisession) */ 78*607ca46eSDavid Howells #define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 79*607ca46eSDavid Howells if available (struct cdrom_mcn) */ 80*607ca46eSDavid Howells #define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated, 81*607ca46eSDavid Howells but here anyway for compatibility */ 82*607ca46eSDavid Howells #define CDROMRESET 0x5312 /* hard-reset the drive */ 83*607ca46eSDavid Howells #define CDROMVOLREAD 0x5313 /* Get the drive's volume setting 84*607ca46eSDavid Howells (struct cdrom_volctrl) */ 85*607ca46eSDavid Howells #define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 86*607ca46eSDavid Howells (struct cdrom_read) */ 87*607ca46eSDavid Howells /* 88*607ca46eSDavid Howells * These ioctls are used only used in aztcd.c and optcd.c 89*607ca46eSDavid Howells */ 90*607ca46eSDavid Howells #define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 91*607ca46eSDavid Howells #define CDROMSEEK 0x5316 /* seek msf address */ 92*607ca46eSDavid Howells 93*607ca46eSDavid Howells /* 94*607ca46eSDavid Howells * This ioctl is only used by the scsi-cd driver. 95*607ca46eSDavid Howells It is for playing audio in logical block addressing mode. 96*607ca46eSDavid Howells */ 97*607ca46eSDavid Howells #define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 98*607ca46eSDavid Howells 99*607ca46eSDavid Howells /* 100*607ca46eSDavid Howells * These ioctls are only used in optcd.c 101*607ca46eSDavid Howells */ 102*607ca46eSDavid Howells #define CDROMREADALL 0x5318 /* read all 2646 bytes */ 103*607ca46eSDavid Howells 104*607ca46eSDavid Howells /* 105*607ca46eSDavid Howells * These ioctls are (now) only in ide-cd.c for controlling 106*607ca46eSDavid Howells * drive spindown time. They should be implemented in the 107*607ca46eSDavid Howells * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 108*607ca46eSDavid Howells * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 109*607ca46eSDavid Howells * -Erik 110*607ca46eSDavid Howells */ 111*607ca46eSDavid Howells #define CDROMGETSPINDOWN 0x531d 112*607ca46eSDavid Howells #define CDROMSETSPINDOWN 0x531e 113*607ca46eSDavid Howells 114*607ca46eSDavid Howells /* 115*607ca46eSDavid Howells * These ioctls are implemented through the uniform CD-ROM driver 116*607ca46eSDavid Howells * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 117*607ca46eSDavid Howells * drivers are eventually ported to the uniform CD-ROM driver interface. 118*607ca46eSDavid Howells */ 119*607ca46eSDavid Howells #define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 120*607ca46eSDavid Howells #define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 121*607ca46eSDavid Howells #define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 122*607ca46eSDavid Howells #define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 123*607ca46eSDavid Howells #define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 124*607ca46eSDavid Howells #define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 125*607ca46eSDavid Howells #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 126*607ca46eSDavid Howells #define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 127*607ca46eSDavid Howells #define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 128*607ca46eSDavid Howells #define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 129*607ca46eSDavid Howells #define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 130*607ca46eSDavid Howells #define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 131*607ca46eSDavid Howells 132*607ca46eSDavid Howells /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 133*607ca46eSDavid Howells * Future CDROM ioctls should be kept below 0x537F 134*607ca46eSDavid Howells */ 135*607ca46eSDavid Howells 136*607ca46eSDavid Howells /* This ioctl is only used by sbpcd at the moment */ 137*607ca46eSDavid Howells #define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 138*607ca46eSDavid Howells /* conflict with SCSI_IOCTL_GET_IDLUN */ 139*607ca46eSDavid Howells 140*607ca46eSDavid Howells /* DVD-ROM Specific ioctls */ 141*607ca46eSDavid Howells #define DVD_READ_STRUCT 0x5390 /* Read structure */ 142*607ca46eSDavid Howells #define DVD_WRITE_STRUCT 0x5391 /* Write structure */ 143*607ca46eSDavid Howells #define DVD_AUTH 0x5392 /* Authentication */ 144*607ca46eSDavid Howells 145*607ca46eSDavid Howells #define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 146*607ca46eSDavid Howells #define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 147*607ca46eSDavid Howells #define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 148*607ca46eSDavid Howells 149*607ca46eSDavid Howells /******************************************************* 150*607ca46eSDavid Howells * CDROM IOCTL structures 151*607ca46eSDavid Howells *******************************************************/ 152*607ca46eSDavid Howells 153*607ca46eSDavid Howells /* Address in MSF format */ 154*607ca46eSDavid Howells struct cdrom_msf0 155*607ca46eSDavid Howells { 156*607ca46eSDavid Howells __u8 minute; 157*607ca46eSDavid Howells __u8 second; 158*607ca46eSDavid Howells __u8 frame; 159*607ca46eSDavid Howells }; 160*607ca46eSDavid Howells 161*607ca46eSDavid Howells /* Address in either MSF or logical format */ 162*607ca46eSDavid Howells union cdrom_addr 163*607ca46eSDavid Howells { 164*607ca46eSDavid Howells struct cdrom_msf0 msf; 165*607ca46eSDavid Howells int lba; 166*607ca46eSDavid Howells }; 167*607ca46eSDavid Howells 168*607ca46eSDavid Howells /* This struct is used by the CDROMPLAYMSF ioctl */ 169*607ca46eSDavid Howells struct cdrom_msf 170*607ca46eSDavid Howells { 171*607ca46eSDavid Howells __u8 cdmsf_min0; /* start minute */ 172*607ca46eSDavid Howells __u8 cdmsf_sec0; /* start second */ 173*607ca46eSDavid Howells __u8 cdmsf_frame0; /* start frame */ 174*607ca46eSDavid Howells __u8 cdmsf_min1; /* end minute */ 175*607ca46eSDavid Howells __u8 cdmsf_sec1; /* end second */ 176*607ca46eSDavid Howells __u8 cdmsf_frame1; /* end frame */ 177*607ca46eSDavid Howells }; 178*607ca46eSDavid Howells 179*607ca46eSDavid Howells /* This struct is used by the CDROMPLAYTRKIND ioctl */ 180*607ca46eSDavid Howells struct cdrom_ti 181*607ca46eSDavid Howells { 182*607ca46eSDavid Howells __u8 cdti_trk0; /* start track */ 183*607ca46eSDavid Howells __u8 cdti_ind0; /* start index */ 184*607ca46eSDavid Howells __u8 cdti_trk1; /* end track */ 185*607ca46eSDavid Howells __u8 cdti_ind1; /* end index */ 186*607ca46eSDavid Howells }; 187*607ca46eSDavid Howells 188*607ca46eSDavid Howells /* This struct is used by the CDROMREADTOCHDR ioctl */ 189*607ca46eSDavid Howells struct cdrom_tochdr 190*607ca46eSDavid Howells { 191*607ca46eSDavid Howells __u8 cdth_trk0; /* start track */ 192*607ca46eSDavid Howells __u8 cdth_trk1; /* end track */ 193*607ca46eSDavid Howells }; 194*607ca46eSDavid Howells 195*607ca46eSDavid Howells /* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ 196*607ca46eSDavid Howells struct cdrom_volctrl 197*607ca46eSDavid Howells { 198*607ca46eSDavid Howells __u8 channel0; 199*607ca46eSDavid Howells __u8 channel1; 200*607ca46eSDavid Howells __u8 channel2; 201*607ca46eSDavid Howells __u8 channel3; 202*607ca46eSDavid Howells }; 203*607ca46eSDavid Howells 204*607ca46eSDavid Howells /* This struct is used by the CDROMSUBCHNL ioctl */ 205*607ca46eSDavid Howells struct cdrom_subchnl 206*607ca46eSDavid Howells { 207*607ca46eSDavid Howells __u8 cdsc_format; 208*607ca46eSDavid Howells __u8 cdsc_audiostatus; 209*607ca46eSDavid Howells __u8 cdsc_adr: 4; 210*607ca46eSDavid Howells __u8 cdsc_ctrl: 4; 211*607ca46eSDavid Howells __u8 cdsc_trk; 212*607ca46eSDavid Howells __u8 cdsc_ind; 213*607ca46eSDavid Howells union cdrom_addr cdsc_absaddr; 214*607ca46eSDavid Howells union cdrom_addr cdsc_reladdr; 215*607ca46eSDavid Howells }; 216*607ca46eSDavid Howells 217*607ca46eSDavid Howells 218*607ca46eSDavid Howells /* This struct is used by the CDROMREADTOCENTRY ioctl */ 219*607ca46eSDavid Howells struct cdrom_tocentry 220*607ca46eSDavid Howells { 221*607ca46eSDavid Howells __u8 cdte_track; 222*607ca46eSDavid Howells __u8 cdte_adr :4; 223*607ca46eSDavid Howells __u8 cdte_ctrl :4; 224*607ca46eSDavid Howells __u8 cdte_format; 225*607ca46eSDavid Howells union cdrom_addr cdte_addr; 226*607ca46eSDavid Howells __u8 cdte_datamode; 227*607ca46eSDavid Howells }; 228*607ca46eSDavid Howells 229*607ca46eSDavid Howells /* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ 230*607ca46eSDavid Howells struct cdrom_read 231*607ca46eSDavid Howells { 232*607ca46eSDavid Howells int cdread_lba; 233*607ca46eSDavid Howells char *cdread_bufaddr; 234*607ca46eSDavid Howells int cdread_buflen; 235*607ca46eSDavid Howells }; 236*607ca46eSDavid Howells 237*607ca46eSDavid Howells /* This struct is used by the CDROMREADAUDIO ioctl */ 238*607ca46eSDavid Howells struct cdrom_read_audio 239*607ca46eSDavid Howells { 240*607ca46eSDavid Howells union cdrom_addr addr; /* frame address */ 241*607ca46eSDavid Howells __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ 242*607ca46eSDavid Howells int nframes; /* number of 2352-byte-frames to read at once */ 243*607ca46eSDavid Howells __u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */ 244*607ca46eSDavid Howells }; 245*607ca46eSDavid Howells 246*607ca46eSDavid Howells /* This struct is used with the CDROMMULTISESSION ioctl */ 247*607ca46eSDavid Howells struct cdrom_multisession 248*607ca46eSDavid Howells { 249*607ca46eSDavid Howells union cdrom_addr addr; /* frame address: start-of-last-session 250*607ca46eSDavid Howells (not the new "frame 16"!). Only valid 251*607ca46eSDavid Howells if the "xa_flag" is true. */ 252*607ca46eSDavid Howells __u8 xa_flag; /* 1: "is XA disk" */ 253*607ca46eSDavid Howells __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ 254*607ca46eSDavid Howells }; 255*607ca46eSDavid Howells 256*607ca46eSDavid Howells /* This struct is used with the CDROM_GET_MCN ioctl. 257*607ca46eSDavid Howells * Very few audio discs actually have Universal Product Code information, 258*607ca46eSDavid Howells * which should just be the Medium Catalog Number on the box. Also note 259*607ca46eSDavid Howells * that the way the codeis written on CD is _not_ uniform across all discs! 260*607ca46eSDavid Howells */ 261*607ca46eSDavid Howells struct cdrom_mcn 262*607ca46eSDavid Howells { 263*607ca46eSDavid Howells __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ 264*607ca46eSDavid Howells }; 265*607ca46eSDavid Howells 266*607ca46eSDavid Howells /* This is used by the CDROMPLAYBLK ioctl */ 267*607ca46eSDavid Howells struct cdrom_blk 268*607ca46eSDavid Howells { 269*607ca46eSDavid Howells unsigned from; 270*607ca46eSDavid Howells unsigned short len; 271*607ca46eSDavid Howells }; 272*607ca46eSDavid Howells 273*607ca46eSDavid Howells #define CDROM_PACKET_SIZE 12 274*607ca46eSDavid Howells 275*607ca46eSDavid Howells #define CGC_DATA_UNKNOWN 0 276*607ca46eSDavid Howells #define CGC_DATA_WRITE 1 277*607ca46eSDavid Howells #define CGC_DATA_READ 2 278*607ca46eSDavid Howells #define CGC_DATA_NONE 3 279*607ca46eSDavid Howells 280*607ca46eSDavid Howells /* for CDROM_PACKET_COMMAND ioctl */ 281*607ca46eSDavid Howells struct cdrom_generic_command 282*607ca46eSDavid Howells { 283*607ca46eSDavid Howells unsigned char cmd[CDROM_PACKET_SIZE]; 284*607ca46eSDavid Howells unsigned char __user *buffer; 285*607ca46eSDavid Howells unsigned int buflen; 286*607ca46eSDavid Howells int stat; 287*607ca46eSDavid Howells struct request_sense __user *sense; 288*607ca46eSDavid Howells unsigned char data_direction; 289*607ca46eSDavid Howells int quiet; 290*607ca46eSDavid Howells int timeout; 291*607ca46eSDavid Howells void __user *reserved[1]; /* unused, actually */ 292*607ca46eSDavid Howells }; 293*607ca46eSDavid Howells 294*607ca46eSDavid Howells /* 295*607ca46eSDavid Howells * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, 296*607ca46eSDavid Howells * 2340, or 2352 bytes long. 297*607ca46eSDavid Howells 298*607ca46eSDavid Howells * Sector types of the standard CD-ROM data formats: 299*607ca46eSDavid Howells * 300*607ca46eSDavid Howells * format sector type user data size (bytes) 301*607ca46eSDavid Howells * ----------------------------------------------------------------------------- 302*607ca46eSDavid Howells * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) 303*607ca46eSDavid Howells * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) 304*607ca46eSDavid Howells * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) 305*607ca46eSDavid Howells * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) 306*607ca46eSDavid Howells * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) 307*607ca46eSDavid Howells * 308*607ca46eSDavid Howells * 309*607ca46eSDavid Howells * The layout of the standard CD-ROM data formats: 310*607ca46eSDavid Howells * ----------------------------------------------------------------------------- 311*607ca46eSDavid Howells * - audio (red): | audio_sample_bytes | 312*607ca46eSDavid Howells * | 2352 | 313*607ca46eSDavid Howells * 314*607ca46eSDavid Howells * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | 315*607ca46eSDavid Howells * | 12 - 4 - 2048 - 4 - 8 - 276 | 316*607ca46eSDavid Howells * 317*607ca46eSDavid Howells * - data (yellow, mode2): | sync - head - data | 318*607ca46eSDavid Howells * | 12 - 4 - 2336 | 319*607ca46eSDavid Howells * 320*607ca46eSDavid Howells * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | 321*607ca46eSDavid Howells * | 12 - 4 - 8 - 2048 - 4 - 276 | 322*607ca46eSDavid Howells * 323*607ca46eSDavid Howells * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | 324*607ca46eSDavid Howells * | 12 - 4 - 8 - 2324 - 4 | 325*607ca46eSDavid Howells * 326*607ca46eSDavid Howells */ 327*607ca46eSDavid Howells 328*607ca46eSDavid Howells /* Some generally useful CD-ROM information -- mostly based on the above */ 329*607ca46eSDavid Howells #define CD_MINS 74 /* max. minutes per CD, not really a limit */ 330*607ca46eSDavid Howells #define CD_SECS 60 /* seconds per minute */ 331*607ca46eSDavid Howells #define CD_FRAMES 75 /* frames per second */ 332*607ca46eSDavid Howells #define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ 333*607ca46eSDavid Howells #define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ 334*607ca46eSDavid Howells #define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ 335*607ca46eSDavid Howells #define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ 336*607ca46eSDavid Howells #define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ 337*607ca46eSDavid Howells #define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ 338*607ca46eSDavid Howells #define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ 339*607ca46eSDavid Howells #define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ 340*607ca46eSDavid Howells #define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ 341*607ca46eSDavid Howells #define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ 342*607ca46eSDavid Howells #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ 343*607ca46eSDavid Howells #define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ 344*607ca46eSDavid Howells #define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ 345*607ca46eSDavid Howells /* most drives don't deliver everything: */ 346*607ca46eSDavid Howells #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ 347*607ca46eSDavid Howells #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ 348*607ca46eSDavid Howells 349*607ca46eSDavid Howells #define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ 350*607ca46eSDavid Howells #define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ 351*607ca46eSDavid Howells #define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ 352*607ca46eSDavid Howells 353*607ca46eSDavid Howells /* CD-ROM address types (cdrom_tocentry.cdte_format) */ 354*607ca46eSDavid Howells #define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ 355*607ca46eSDavid Howells #define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ 356*607ca46eSDavid Howells 357*607ca46eSDavid Howells /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ 358*607ca46eSDavid Howells #define CDROM_DATA_TRACK 0x04 359*607ca46eSDavid Howells 360*607ca46eSDavid Howells /* The leadout track is always 0xAA, regardless of # of tracks on disc */ 361*607ca46eSDavid Howells #define CDROM_LEADOUT 0xAA 362*607ca46eSDavid Howells 363*607ca46eSDavid Howells /* audio states (from SCSI-2, but seen with other drives, too) */ 364*607ca46eSDavid Howells #define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ 365*607ca46eSDavid Howells #define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ 366*607ca46eSDavid Howells #define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ 367*607ca46eSDavid Howells #define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ 368*607ca46eSDavid Howells #define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ 369*607ca46eSDavid Howells #define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ 370*607ca46eSDavid Howells 371*607ca46eSDavid Howells /* capability flags used with the uniform CD-ROM driver */ 372*607ca46eSDavid Howells #define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ 373*607ca46eSDavid Howells #define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ 374*607ca46eSDavid Howells #define CDC_LOCK 0x4 /* disable manual eject */ 375*607ca46eSDavid Howells #define CDC_SELECT_SPEED 0x8 /* programmable speed */ 376*607ca46eSDavid Howells #define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ 377*607ca46eSDavid Howells #define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ 378*607ca46eSDavid Howells #define CDC_MCN 0x40 /* Medium Catalog Number */ 379*607ca46eSDavid Howells #define CDC_MEDIA_CHANGED 0x80 /* media changed */ 380*607ca46eSDavid Howells #define CDC_PLAY_AUDIO 0x100 /* audio functions */ 381*607ca46eSDavid Howells #define CDC_RESET 0x200 /* hard reset device */ 382*607ca46eSDavid Howells #define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ 383*607ca46eSDavid Howells #define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ 384*607ca46eSDavid Howells #define CDC_CD_R 0x2000 /* drive is a CD-R */ 385*607ca46eSDavid Howells #define CDC_CD_RW 0x4000 /* drive is a CD-RW */ 386*607ca46eSDavid Howells #define CDC_DVD 0x8000 /* drive is a DVD */ 387*607ca46eSDavid Howells #define CDC_DVD_R 0x10000 /* drive can write DVD-R */ 388*607ca46eSDavid Howells #define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ 389*607ca46eSDavid Howells #define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ 390*607ca46eSDavid Howells #define CDC_MRW 0x80000 /* drive can read MRW */ 391*607ca46eSDavid Howells #define CDC_MRW_W 0x100000 /* drive can write MRW */ 392*607ca46eSDavid Howells #define CDC_RAM 0x200000 /* ok to open for WRITE */ 393*607ca46eSDavid Howells 394*607ca46eSDavid Howells /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ 395*607ca46eSDavid Howells #define CDS_NO_INFO 0 /* if not implemented */ 396*607ca46eSDavid Howells #define CDS_NO_DISC 1 397*607ca46eSDavid Howells #define CDS_TRAY_OPEN 2 398*607ca46eSDavid Howells #define CDS_DRIVE_NOT_READY 3 399*607ca46eSDavid Howells #define CDS_DISC_OK 4 400*607ca46eSDavid Howells 401*607ca46eSDavid Howells /* return values for the CDROM_DISC_STATUS ioctl */ 402*607ca46eSDavid Howells /* can also return CDS_NO_[INFO|DISC], from above */ 403*607ca46eSDavid Howells #define CDS_AUDIO 100 404*607ca46eSDavid Howells #define CDS_DATA_1 101 405*607ca46eSDavid Howells #define CDS_DATA_2 102 406*607ca46eSDavid Howells #define CDS_XA_2_1 103 407*607ca46eSDavid Howells #define CDS_XA_2_2 104 408*607ca46eSDavid Howells #define CDS_MIXED 105 409*607ca46eSDavid Howells 410*607ca46eSDavid Howells /* User-configurable behavior options for the uniform CD-ROM driver */ 411*607ca46eSDavid Howells #define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ 412*607ca46eSDavid Howells #define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ 413*607ca46eSDavid Howells #define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ 414*607ca46eSDavid Howells #define CDO_LOCK 0x8 /* lock tray on open files */ 415*607ca46eSDavid Howells #define CDO_CHECK_TYPE 0x10 /* check type on open for data */ 416*607ca46eSDavid Howells 417*607ca46eSDavid Howells /* Special codes used when specifying changer slots. */ 418*607ca46eSDavid Howells #define CDSL_NONE (INT_MAX-1) 419*607ca46eSDavid Howells #define CDSL_CURRENT INT_MAX 420*607ca46eSDavid Howells 421*607ca46eSDavid Howells /* For partition based multisession access. IDE can handle 64 partitions 422*607ca46eSDavid Howells * per drive - SCSI CD-ROM's use minors to differentiate between the 423*607ca46eSDavid Howells * various drives, so we can't do multisessions the same way there. 424*607ca46eSDavid Howells * Use the -o session=x option to mount on them. 425*607ca46eSDavid Howells */ 426*607ca46eSDavid Howells #define CD_PART_MAX 64 427*607ca46eSDavid Howells #define CD_PART_MASK (CD_PART_MAX - 1) 428*607ca46eSDavid Howells 429*607ca46eSDavid Howells /********************************************************************* 430*607ca46eSDavid Howells * Generic Packet commands, MMC commands, and such 431*607ca46eSDavid Howells *********************************************************************/ 432*607ca46eSDavid Howells 433*607ca46eSDavid Howells /* The generic packet command opcodes for CD/DVD Logical Units, 434*607ca46eSDavid Howells * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ 435*607ca46eSDavid Howells #define GPCMD_BLANK 0xa1 436*607ca46eSDavid Howells #define GPCMD_CLOSE_TRACK 0x5b 437*607ca46eSDavid Howells #define GPCMD_FLUSH_CACHE 0x35 438*607ca46eSDavid Howells #define GPCMD_FORMAT_UNIT 0x04 439*607ca46eSDavid Howells #define GPCMD_GET_CONFIGURATION 0x46 440*607ca46eSDavid Howells #define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a 441*607ca46eSDavid Howells #define GPCMD_GET_PERFORMANCE 0xac 442*607ca46eSDavid Howells #define GPCMD_INQUIRY 0x12 443*607ca46eSDavid Howells #define GPCMD_LOAD_UNLOAD 0xa6 444*607ca46eSDavid Howells #define GPCMD_MECHANISM_STATUS 0xbd 445*607ca46eSDavid Howells #define GPCMD_MODE_SELECT_10 0x55 446*607ca46eSDavid Howells #define GPCMD_MODE_SENSE_10 0x5a 447*607ca46eSDavid Howells #define GPCMD_PAUSE_RESUME 0x4b 448*607ca46eSDavid Howells #define GPCMD_PLAY_AUDIO_10 0x45 449*607ca46eSDavid Howells #define GPCMD_PLAY_AUDIO_MSF 0x47 450*607ca46eSDavid Howells #define GPCMD_PLAY_AUDIO_TI 0x48 451*607ca46eSDavid Howells #define GPCMD_PLAY_CD 0xbc 452*607ca46eSDavid Howells #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e 453*607ca46eSDavid Howells #define GPCMD_READ_10 0x28 454*607ca46eSDavid Howells #define GPCMD_READ_12 0xa8 455*607ca46eSDavid Howells #define GPCMD_READ_BUFFER 0x3c 456*607ca46eSDavid Howells #define GPCMD_READ_BUFFER_CAPACITY 0x5c 457*607ca46eSDavid Howells #define GPCMD_READ_CDVD_CAPACITY 0x25 458*607ca46eSDavid Howells #define GPCMD_READ_CD 0xbe 459*607ca46eSDavid Howells #define GPCMD_READ_CD_MSF 0xb9 460*607ca46eSDavid Howells #define GPCMD_READ_DISC_INFO 0x51 461*607ca46eSDavid Howells #define GPCMD_READ_DVD_STRUCTURE 0xad 462*607ca46eSDavid Howells #define GPCMD_READ_FORMAT_CAPACITIES 0x23 463*607ca46eSDavid Howells #define GPCMD_READ_HEADER 0x44 464*607ca46eSDavid Howells #define GPCMD_READ_TRACK_RZONE_INFO 0x52 465*607ca46eSDavid Howells #define GPCMD_READ_SUBCHANNEL 0x42 466*607ca46eSDavid Howells #define GPCMD_READ_TOC_PMA_ATIP 0x43 467*607ca46eSDavid Howells #define GPCMD_REPAIR_RZONE_TRACK 0x58 468*607ca46eSDavid Howells #define GPCMD_REPORT_KEY 0xa4 469*607ca46eSDavid Howells #define GPCMD_REQUEST_SENSE 0x03 470*607ca46eSDavid Howells #define GPCMD_RESERVE_RZONE_TRACK 0x53 471*607ca46eSDavid Howells #define GPCMD_SEND_CUE_SHEET 0x5d 472*607ca46eSDavid Howells #define GPCMD_SCAN 0xba 473*607ca46eSDavid Howells #define GPCMD_SEEK 0x2b 474*607ca46eSDavid Howells #define GPCMD_SEND_DVD_STRUCTURE 0xbf 475*607ca46eSDavid Howells #define GPCMD_SEND_EVENT 0xa2 476*607ca46eSDavid Howells #define GPCMD_SEND_KEY 0xa3 477*607ca46eSDavid Howells #define GPCMD_SEND_OPC 0x54 478*607ca46eSDavid Howells #define GPCMD_SET_READ_AHEAD 0xa7 479*607ca46eSDavid Howells #define GPCMD_SET_STREAMING 0xb6 480*607ca46eSDavid Howells #define GPCMD_START_STOP_UNIT 0x1b 481*607ca46eSDavid Howells #define GPCMD_STOP_PLAY_SCAN 0x4e 482*607ca46eSDavid Howells #define GPCMD_TEST_UNIT_READY 0x00 483*607ca46eSDavid Howells #define GPCMD_VERIFY_10 0x2f 484*607ca46eSDavid Howells #define GPCMD_WRITE_10 0x2a 485*607ca46eSDavid Howells #define GPCMD_WRITE_12 0xaa 486*607ca46eSDavid Howells #define GPCMD_WRITE_AND_VERIFY_10 0x2e 487*607ca46eSDavid Howells #define GPCMD_WRITE_BUFFER 0x3b 488*607ca46eSDavid Howells /* This is listed as optional in ATAPI 2.6, but is (curiously) 489*607ca46eSDavid Howells * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji 490*607ca46eSDavid Howells * Table 377 as an MMC command for SCSi devices though... Most ATAPI 491*607ca46eSDavid Howells * drives support it. */ 492*607ca46eSDavid Howells #define GPCMD_SET_SPEED 0xbb 493*607ca46eSDavid Howells /* This seems to be a SCSI specific CD-ROM opcode 494*607ca46eSDavid Howells * to play data at track/index */ 495*607ca46eSDavid Howells #define GPCMD_PLAYAUDIO_TI 0x48 496*607ca46eSDavid Howells /* 497*607ca46eSDavid Howells * From MS Media Status Notification Support Specification. For 498*607ca46eSDavid Howells * older drives only. 499*607ca46eSDavid Howells */ 500*607ca46eSDavid Howells #define GPCMD_GET_MEDIA_STATUS 0xda 501*607ca46eSDavid Howells 502*607ca46eSDavid Howells /* Mode page codes for mode sense/set */ 503*607ca46eSDavid Howells #define GPMODE_VENDOR_PAGE 0x00 504*607ca46eSDavid Howells #define GPMODE_R_W_ERROR_PAGE 0x01 505*607ca46eSDavid Howells #define GPMODE_WRITE_PARMS_PAGE 0x05 506*607ca46eSDavid Howells #define GPMODE_WCACHING_PAGE 0x08 507*607ca46eSDavid Howells #define GPMODE_AUDIO_CTL_PAGE 0x0e 508*607ca46eSDavid Howells #define GPMODE_POWER_PAGE 0x1a 509*607ca46eSDavid Howells #define GPMODE_FAULT_FAIL_PAGE 0x1c 510*607ca46eSDavid Howells #define GPMODE_TO_PROTECT_PAGE 0x1d 511*607ca46eSDavid Howells #define GPMODE_CAPABILITIES_PAGE 0x2a 512*607ca46eSDavid Howells #define GPMODE_ALL_PAGES 0x3f 513*607ca46eSDavid Howells /* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor 514*607ca46eSDavid Howells * of MODE_SENSE_POWER_PAGE */ 515*607ca46eSDavid Howells #define GPMODE_CDROM_PAGE 0x0d 516*607ca46eSDavid Howells 517*607ca46eSDavid Howells 518*607ca46eSDavid Howells 519*607ca46eSDavid Howells /* DVD struct types */ 520*607ca46eSDavid Howells #define DVD_STRUCT_PHYSICAL 0x00 521*607ca46eSDavid Howells #define DVD_STRUCT_COPYRIGHT 0x01 522*607ca46eSDavid Howells #define DVD_STRUCT_DISCKEY 0x02 523*607ca46eSDavid Howells #define DVD_STRUCT_BCA 0x03 524*607ca46eSDavid Howells #define DVD_STRUCT_MANUFACT 0x04 525*607ca46eSDavid Howells 526*607ca46eSDavid Howells struct dvd_layer { 527*607ca46eSDavid Howells __u8 book_version : 4; 528*607ca46eSDavid Howells __u8 book_type : 4; 529*607ca46eSDavid Howells __u8 min_rate : 4; 530*607ca46eSDavid Howells __u8 disc_size : 4; 531*607ca46eSDavid Howells __u8 layer_type : 4; 532*607ca46eSDavid Howells __u8 track_path : 1; 533*607ca46eSDavid Howells __u8 nlayers : 2; 534*607ca46eSDavid Howells __u8 track_density : 4; 535*607ca46eSDavid Howells __u8 linear_density : 4; 536*607ca46eSDavid Howells __u8 bca : 1; 537*607ca46eSDavid Howells __u32 start_sector; 538*607ca46eSDavid Howells __u32 end_sector; 539*607ca46eSDavid Howells __u32 end_sector_l0; 540*607ca46eSDavid Howells }; 541*607ca46eSDavid Howells 542*607ca46eSDavid Howells #define DVD_LAYERS 4 543*607ca46eSDavid Howells 544*607ca46eSDavid Howells struct dvd_physical { 545*607ca46eSDavid Howells __u8 type; 546*607ca46eSDavid Howells __u8 layer_num; 547*607ca46eSDavid Howells struct dvd_layer layer[DVD_LAYERS]; 548*607ca46eSDavid Howells }; 549*607ca46eSDavid Howells 550*607ca46eSDavid Howells struct dvd_copyright { 551*607ca46eSDavid Howells __u8 type; 552*607ca46eSDavid Howells 553*607ca46eSDavid Howells __u8 layer_num; 554*607ca46eSDavid Howells __u8 cpst; 555*607ca46eSDavid Howells __u8 rmi; 556*607ca46eSDavid Howells }; 557*607ca46eSDavid Howells 558*607ca46eSDavid Howells struct dvd_disckey { 559*607ca46eSDavid Howells __u8 type; 560*607ca46eSDavid Howells 561*607ca46eSDavid Howells unsigned agid : 2; 562*607ca46eSDavid Howells __u8 value[2048]; 563*607ca46eSDavid Howells }; 564*607ca46eSDavid Howells 565*607ca46eSDavid Howells struct dvd_bca { 566*607ca46eSDavid Howells __u8 type; 567*607ca46eSDavid Howells 568*607ca46eSDavid Howells int len; 569*607ca46eSDavid Howells __u8 value[188]; 570*607ca46eSDavid Howells }; 571*607ca46eSDavid Howells 572*607ca46eSDavid Howells struct dvd_manufact { 573*607ca46eSDavid Howells __u8 type; 574*607ca46eSDavid Howells 575*607ca46eSDavid Howells __u8 layer_num; 576*607ca46eSDavid Howells int len; 577*607ca46eSDavid Howells __u8 value[2048]; 578*607ca46eSDavid Howells }; 579*607ca46eSDavid Howells 580*607ca46eSDavid Howells typedef union { 581*607ca46eSDavid Howells __u8 type; 582*607ca46eSDavid Howells 583*607ca46eSDavid Howells struct dvd_physical physical; 584*607ca46eSDavid Howells struct dvd_copyright copyright; 585*607ca46eSDavid Howells struct dvd_disckey disckey; 586*607ca46eSDavid Howells struct dvd_bca bca; 587*607ca46eSDavid Howells struct dvd_manufact manufact; 588*607ca46eSDavid Howells } dvd_struct; 589*607ca46eSDavid Howells 590*607ca46eSDavid Howells /* 591*607ca46eSDavid Howells * DVD authentication ioctl 592*607ca46eSDavid Howells */ 593*607ca46eSDavid Howells 594*607ca46eSDavid Howells /* Authentication states */ 595*607ca46eSDavid Howells #define DVD_LU_SEND_AGID 0 596*607ca46eSDavid Howells #define DVD_HOST_SEND_CHALLENGE 1 597*607ca46eSDavid Howells #define DVD_LU_SEND_KEY1 2 598*607ca46eSDavid Howells #define DVD_LU_SEND_CHALLENGE 3 599*607ca46eSDavid Howells #define DVD_HOST_SEND_KEY2 4 600*607ca46eSDavid Howells 601*607ca46eSDavid Howells /* Termination states */ 602*607ca46eSDavid Howells #define DVD_AUTH_ESTABLISHED 5 603*607ca46eSDavid Howells #define DVD_AUTH_FAILURE 6 604*607ca46eSDavid Howells 605*607ca46eSDavid Howells /* Other functions */ 606*607ca46eSDavid Howells #define DVD_LU_SEND_TITLE_KEY 7 607*607ca46eSDavid Howells #define DVD_LU_SEND_ASF 8 608*607ca46eSDavid Howells #define DVD_INVALIDATE_AGID 9 609*607ca46eSDavid Howells #define DVD_LU_SEND_RPC_STATE 10 610*607ca46eSDavid Howells #define DVD_HOST_SEND_RPC_STATE 11 611*607ca46eSDavid Howells 612*607ca46eSDavid Howells /* State data */ 613*607ca46eSDavid Howells typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ 614*607ca46eSDavid Howells typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ 615*607ca46eSDavid Howells 616*607ca46eSDavid Howells struct dvd_lu_send_agid { 617*607ca46eSDavid Howells __u8 type; 618*607ca46eSDavid Howells unsigned agid : 2; 619*607ca46eSDavid Howells }; 620*607ca46eSDavid Howells 621*607ca46eSDavid Howells struct dvd_host_send_challenge { 622*607ca46eSDavid Howells __u8 type; 623*607ca46eSDavid Howells unsigned agid : 2; 624*607ca46eSDavid Howells 625*607ca46eSDavid Howells dvd_challenge chal; 626*607ca46eSDavid Howells }; 627*607ca46eSDavid Howells 628*607ca46eSDavid Howells struct dvd_send_key { 629*607ca46eSDavid Howells __u8 type; 630*607ca46eSDavid Howells unsigned agid : 2; 631*607ca46eSDavid Howells 632*607ca46eSDavid Howells dvd_key key; 633*607ca46eSDavid Howells }; 634*607ca46eSDavid Howells 635*607ca46eSDavid Howells struct dvd_lu_send_challenge { 636*607ca46eSDavid Howells __u8 type; 637*607ca46eSDavid Howells unsigned agid : 2; 638*607ca46eSDavid Howells 639*607ca46eSDavid Howells dvd_challenge chal; 640*607ca46eSDavid Howells }; 641*607ca46eSDavid Howells 642*607ca46eSDavid Howells #define DVD_CPM_NO_COPYRIGHT 0 643*607ca46eSDavid Howells #define DVD_CPM_COPYRIGHTED 1 644*607ca46eSDavid Howells 645*607ca46eSDavid Howells #define DVD_CP_SEC_NONE 0 646*607ca46eSDavid Howells #define DVD_CP_SEC_EXIST 1 647*607ca46eSDavid Howells 648*607ca46eSDavid Howells #define DVD_CGMS_UNRESTRICTED 0 649*607ca46eSDavid Howells #define DVD_CGMS_SINGLE 2 650*607ca46eSDavid Howells #define DVD_CGMS_RESTRICTED 3 651*607ca46eSDavid Howells 652*607ca46eSDavid Howells struct dvd_lu_send_title_key { 653*607ca46eSDavid Howells __u8 type; 654*607ca46eSDavid Howells unsigned agid : 2; 655*607ca46eSDavid Howells 656*607ca46eSDavid Howells dvd_key title_key; 657*607ca46eSDavid Howells int lba; 658*607ca46eSDavid Howells unsigned cpm : 1; 659*607ca46eSDavid Howells unsigned cp_sec : 1; 660*607ca46eSDavid Howells unsigned cgms : 2; 661*607ca46eSDavid Howells }; 662*607ca46eSDavid Howells 663*607ca46eSDavid Howells struct dvd_lu_send_asf { 664*607ca46eSDavid Howells __u8 type; 665*607ca46eSDavid Howells unsigned agid : 2; 666*607ca46eSDavid Howells 667*607ca46eSDavid Howells unsigned asf : 1; 668*607ca46eSDavid Howells }; 669*607ca46eSDavid Howells 670*607ca46eSDavid Howells struct dvd_host_send_rpcstate { 671*607ca46eSDavid Howells __u8 type; 672*607ca46eSDavid Howells __u8 pdrc; 673*607ca46eSDavid Howells }; 674*607ca46eSDavid Howells 675*607ca46eSDavid Howells struct dvd_lu_send_rpcstate { 676*607ca46eSDavid Howells __u8 type : 2; 677*607ca46eSDavid Howells __u8 vra : 3; 678*607ca46eSDavid Howells __u8 ucca : 3; 679*607ca46eSDavid Howells __u8 region_mask; 680*607ca46eSDavid Howells __u8 rpc_scheme; 681*607ca46eSDavid Howells }; 682*607ca46eSDavid Howells 683*607ca46eSDavid Howells typedef union { 684*607ca46eSDavid Howells __u8 type; 685*607ca46eSDavid Howells 686*607ca46eSDavid Howells struct dvd_lu_send_agid lsa; 687*607ca46eSDavid Howells struct dvd_host_send_challenge hsc; 688*607ca46eSDavid Howells struct dvd_send_key lsk; 689*607ca46eSDavid Howells struct dvd_lu_send_challenge lsc; 690*607ca46eSDavid Howells struct dvd_send_key hsk; 691*607ca46eSDavid Howells struct dvd_lu_send_title_key lstk; 692*607ca46eSDavid Howells struct dvd_lu_send_asf lsasf; 693*607ca46eSDavid Howells struct dvd_host_send_rpcstate hrpcs; 694*607ca46eSDavid Howells struct dvd_lu_send_rpcstate lrpcs; 695*607ca46eSDavid Howells } dvd_authinfo; 696*607ca46eSDavid Howells 697*607ca46eSDavid Howells struct request_sense { 698*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 699*607ca46eSDavid Howells __u8 valid : 1; 700*607ca46eSDavid Howells __u8 error_code : 7; 701*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 702*607ca46eSDavid Howells __u8 error_code : 7; 703*607ca46eSDavid Howells __u8 valid : 1; 704*607ca46eSDavid Howells #endif 705*607ca46eSDavid Howells __u8 segment_number; 706*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 707*607ca46eSDavid Howells __u8 reserved1 : 2; 708*607ca46eSDavid Howells __u8 ili : 1; 709*607ca46eSDavid Howells __u8 reserved2 : 1; 710*607ca46eSDavid Howells __u8 sense_key : 4; 711*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 712*607ca46eSDavid Howells __u8 sense_key : 4; 713*607ca46eSDavid Howells __u8 reserved2 : 1; 714*607ca46eSDavid Howells __u8 ili : 1; 715*607ca46eSDavid Howells __u8 reserved1 : 2; 716*607ca46eSDavid Howells #endif 717*607ca46eSDavid Howells __u8 information[4]; 718*607ca46eSDavid Howells __u8 add_sense_len; 719*607ca46eSDavid Howells __u8 command_info[4]; 720*607ca46eSDavid Howells __u8 asc; 721*607ca46eSDavid Howells __u8 ascq; 722*607ca46eSDavid Howells __u8 fruc; 723*607ca46eSDavid Howells __u8 sks[3]; 724*607ca46eSDavid Howells __u8 asb[46]; 725*607ca46eSDavid Howells }; 726*607ca46eSDavid Howells 727*607ca46eSDavid Howells /* 728*607ca46eSDavid Howells * feature profile 729*607ca46eSDavid Howells */ 730*607ca46eSDavid Howells #define CDF_RWRT 0x0020 /* "Random Writable" */ 731*607ca46eSDavid Howells #define CDF_HWDM 0x0024 /* "Hardware Defect Management" */ 732*607ca46eSDavid Howells #define CDF_MRW 0x0028 733*607ca46eSDavid Howells 734*607ca46eSDavid Howells /* 735*607ca46eSDavid Howells * media status bits 736*607ca46eSDavid Howells */ 737*607ca46eSDavid Howells #define CDM_MRW_NOTMRW 0 738*607ca46eSDavid Howells #define CDM_MRW_BGFORMAT_INACTIVE 1 739*607ca46eSDavid Howells #define CDM_MRW_BGFORMAT_ACTIVE 2 740*607ca46eSDavid Howells #define CDM_MRW_BGFORMAT_COMPLETE 3 741*607ca46eSDavid Howells 742*607ca46eSDavid Howells /* 743*607ca46eSDavid Howells * mrw address spaces 744*607ca46eSDavid Howells */ 745*607ca46eSDavid Howells #define MRW_LBA_DMA 0 746*607ca46eSDavid Howells #define MRW_LBA_GAA 1 747*607ca46eSDavid Howells 748*607ca46eSDavid Howells /* 749*607ca46eSDavid Howells * mrw mode pages (first is deprecated) -- probed at init time and 750*607ca46eSDavid Howells * cdi->mrw_mode_page is set 751*607ca46eSDavid Howells */ 752*607ca46eSDavid Howells #define MRW_MODE_PC_PRE1 0x2c 753*607ca46eSDavid Howells #define MRW_MODE_PC 0x03 754*607ca46eSDavid Howells 755*607ca46eSDavid Howells struct mrw_feature_desc { 756*607ca46eSDavid Howells __be16 feature_code; 757*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 758*607ca46eSDavid Howells __u8 reserved1 : 2; 759*607ca46eSDavid Howells __u8 feature_version : 4; 760*607ca46eSDavid Howells __u8 persistent : 1; 761*607ca46eSDavid Howells __u8 curr : 1; 762*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 763*607ca46eSDavid Howells __u8 curr : 1; 764*607ca46eSDavid Howells __u8 persistent : 1; 765*607ca46eSDavid Howells __u8 feature_version : 4; 766*607ca46eSDavid Howells __u8 reserved1 : 2; 767*607ca46eSDavid Howells #endif 768*607ca46eSDavid Howells __u8 add_len; 769*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 770*607ca46eSDavid Howells __u8 reserved2 : 7; 771*607ca46eSDavid Howells __u8 write : 1; 772*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 773*607ca46eSDavid Howells __u8 write : 1; 774*607ca46eSDavid Howells __u8 reserved2 : 7; 775*607ca46eSDavid Howells #endif 776*607ca46eSDavid Howells __u8 reserved3; 777*607ca46eSDavid Howells __u8 reserved4; 778*607ca46eSDavid Howells __u8 reserved5; 779*607ca46eSDavid Howells }; 780*607ca46eSDavid Howells 781*607ca46eSDavid Howells /* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ 782*607ca46eSDavid Howells struct rwrt_feature_desc { 783*607ca46eSDavid Howells __be16 feature_code; 784*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 785*607ca46eSDavid Howells __u8 reserved1 : 2; 786*607ca46eSDavid Howells __u8 feature_version : 4; 787*607ca46eSDavid Howells __u8 persistent : 1; 788*607ca46eSDavid Howells __u8 curr : 1; 789*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 790*607ca46eSDavid Howells __u8 curr : 1; 791*607ca46eSDavid Howells __u8 persistent : 1; 792*607ca46eSDavid Howells __u8 feature_version : 4; 793*607ca46eSDavid Howells __u8 reserved1 : 2; 794*607ca46eSDavid Howells #endif 795*607ca46eSDavid Howells __u8 add_len; 796*607ca46eSDavid Howells __u32 last_lba; 797*607ca46eSDavid Howells __u32 block_size; 798*607ca46eSDavid Howells __u16 blocking; 799*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 800*607ca46eSDavid Howells __u8 reserved2 : 7; 801*607ca46eSDavid Howells __u8 page_present : 1; 802*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 803*607ca46eSDavid Howells __u8 page_present : 1; 804*607ca46eSDavid Howells __u8 reserved2 : 7; 805*607ca46eSDavid Howells #endif 806*607ca46eSDavid Howells __u8 reserved3; 807*607ca46eSDavid Howells }; 808*607ca46eSDavid Howells 809*607ca46eSDavid Howells typedef struct { 810*607ca46eSDavid Howells __be16 disc_information_length; 811*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 812*607ca46eSDavid Howells __u8 reserved1 : 3; 813*607ca46eSDavid Howells __u8 erasable : 1; 814*607ca46eSDavid Howells __u8 border_status : 2; 815*607ca46eSDavid Howells __u8 disc_status : 2; 816*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 817*607ca46eSDavid Howells __u8 disc_status : 2; 818*607ca46eSDavid Howells __u8 border_status : 2; 819*607ca46eSDavid Howells __u8 erasable : 1; 820*607ca46eSDavid Howells __u8 reserved1 : 3; 821*607ca46eSDavid Howells #else 822*607ca46eSDavid Howells #error "Please fix <asm/byteorder.h>" 823*607ca46eSDavid Howells #endif 824*607ca46eSDavid Howells __u8 n_first_track; 825*607ca46eSDavid Howells __u8 n_sessions_lsb; 826*607ca46eSDavid Howells __u8 first_track_lsb; 827*607ca46eSDavid Howells __u8 last_track_lsb; 828*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 829*607ca46eSDavid Howells __u8 did_v : 1; 830*607ca46eSDavid Howells __u8 dbc_v : 1; 831*607ca46eSDavid Howells __u8 uru : 1; 832*607ca46eSDavid Howells __u8 reserved2 : 2; 833*607ca46eSDavid Howells __u8 dbit : 1; 834*607ca46eSDavid Howells __u8 mrw_status : 2; 835*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 836*607ca46eSDavid Howells __u8 mrw_status : 2; 837*607ca46eSDavid Howells __u8 dbit : 1; 838*607ca46eSDavid Howells __u8 reserved2 : 2; 839*607ca46eSDavid Howells __u8 uru : 1; 840*607ca46eSDavid Howells __u8 dbc_v : 1; 841*607ca46eSDavid Howells __u8 did_v : 1; 842*607ca46eSDavid Howells #endif 843*607ca46eSDavid Howells __u8 disc_type; 844*607ca46eSDavid Howells __u8 n_sessions_msb; 845*607ca46eSDavid Howells __u8 first_track_msb; 846*607ca46eSDavid Howells __u8 last_track_msb; 847*607ca46eSDavid Howells __u32 disc_id; 848*607ca46eSDavid Howells __u32 lead_in; 849*607ca46eSDavid Howells __u32 lead_out; 850*607ca46eSDavid Howells __u8 disc_bar_code[8]; 851*607ca46eSDavid Howells __u8 reserved3; 852*607ca46eSDavid Howells __u8 n_opc; 853*607ca46eSDavid Howells } disc_information; 854*607ca46eSDavid Howells 855*607ca46eSDavid Howells typedef struct { 856*607ca46eSDavid Howells __be16 track_information_length; 857*607ca46eSDavid Howells __u8 track_lsb; 858*607ca46eSDavid Howells __u8 session_lsb; 859*607ca46eSDavid Howells __u8 reserved1; 860*607ca46eSDavid Howells #if defined(__BIG_ENDIAN_BITFIELD) 861*607ca46eSDavid Howells __u8 reserved2 : 2; 862*607ca46eSDavid Howells __u8 damage : 1; 863*607ca46eSDavid Howells __u8 copy : 1; 864*607ca46eSDavid Howells __u8 track_mode : 4; 865*607ca46eSDavid Howells __u8 rt : 1; 866*607ca46eSDavid Howells __u8 blank : 1; 867*607ca46eSDavid Howells __u8 packet : 1; 868*607ca46eSDavid Howells __u8 fp : 1; 869*607ca46eSDavid Howells __u8 data_mode : 4; 870*607ca46eSDavid Howells __u8 reserved3 : 6; 871*607ca46eSDavid Howells __u8 lra_v : 1; 872*607ca46eSDavid Howells __u8 nwa_v : 1; 873*607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 874*607ca46eSDavid Howells __u8 track_mode : 4; 875*607ca46eSDavid Howells __u8 copy : 1; 876*607ca46eSDavid Howells __u8 damage : 1; 877*607ca46eSDavid Howells __u8 reserved2 : 2; 878*607ca46eSDavid Howells __u8 data_mode : 4; 879*607ca46eSDavid Howells __u8 fp : 1; 880*607ca46eSDavid Howells __u8 packet : 1; 881*607ca46eSDavid Howells __u8 blank : 1; 882*607ca46eSDavid Howells __u8 rt : 1; 883*607ca46eSDavid Howells __u8 nwa_v : 1; 884*607ca46eSDavid Howells __u8 lra_v : 1; 885*607ca46eSDavid Howells __u8 reserved3 : 6; 886*607ca46eSDavid Howells #endif 887*607ca46eSDavid Howells __be32 track_start; 888*607ca46eSDavid Howells __be32 next_writable; 889*607ca46eSDavid Howells __be32 free_blocks; 890*607ca46eSDavid Howells __be32 fixed_packet_size; 891*607ca46eSDavid Howells __be32 track_size; 892*607ca46eSDavid Howells __be32 last_rec_address; 893*607ca46eSDavid Howells } track_information; 894*607ca46eSDavid Howells 895*607ca46eSDavid Howells struct feature_header { 896*607ca46eSDavid Howells __u32 data_len; 897*607ca46eSDavid Howells __u8 reserved1; 898*607ca46eSDavid Howells __u8 reserved2; 899*607ca46eSDavid Howells __u16 curr_profile; 900*607ca46eSDavid Howells }; 901*607ca46eSDavid Howells 902*607ca46eSDavid Howells struct mode_page_header { 903*607ca46eSDavid Howells __be16 mode_data_length; 904*607ca46eSDavid Howells __u8 medium_type; 905*607ca46eSDavid Howells __u8 reserved1; 906*607ca46eSDavid Howells __u8 reserved2; 907*607ca46eSDavid Howells __u8 reserved3; 908*607ca46eSDavid Howells __be16 desc_length; 909*607ca46eSDavid Howells }; 910*607ca46eSDavid Howells 911*607ca46eSDavid Howells 912*607ca46eSDavid Howells #endif /* _UAPI_LINUX_CDROM_H */ 913