/* * linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen * Copyright (C) 1998-2000 Jens Axboe */#ifndef _IDE_CD_H#define _IDE_CD_H #include <linux/cdrom.h>#include <asm/byteorder.h> /* Turn this on to have the driver print out the meanings of the ATAPI error codes. This will use up additional kernel-space memory, though. */ #ifndef VERBOSE_IDE_CD_ERRORS#define VERBOSE_IDE_CD_ERRORS 1#endif /* Turning this on will remove code to work around various nonstandard ATAPI implementations. If you know your drive follows the standard, this will give you a slightly smaller kernel. */ #ifndef STANDARD_ATAPI#define STANDARD_ATAPI 0#endif /* Turning this on will disable the door-locking functionality. This is apparently needed for supermount. */ #ifndef NO_DOOR_LOCKING#define NO_DOOR_LOCKING 0#endif /* * typical timeout for packet command */#define ATAPI_WAIT_PC (60 * HZ)#define ATAPI_WAIT_WRITE_BUSY (10 * HZ) /************************************************************************/ #define SECTOR_BITS 9#ifndef SECTOR_SIZE#define SECTOR_SIZE (1 << SECTOR_BITS)#endif#define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS)#define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)#define SECTORS_BUFFER (SECTOR_BUFFER_SIZE >> SECTOR_BITS)#define SECTORS_MAX (131072 >> SECTOR_BITS) #define BLOCKS_PER_FRAME (CD_FRAMESIZE / BLOCK_SIZE) /* special command codes for strategy routine. */#define PACKET_COMMAND 4315#define REQUEST_SENSE_COMMAND 4316#define RESET_DRIVE_COMMAND 4317 /* Configuration flags. These describe the capabilities of the drive. They generally do not change after initialization, unless we learn more about the drive from stuff failing. */struct ide_cd_config_flags { __u8 drq_interrupt : 1; /* Device sends an interrupt when ready for a packet command. */ __u8 no_doorlock : 1; /* Drive cannot lock the door. */ __u8 no_eject : 1; /* Drive cannot eject the disc. */ __u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */ __u8 playmsf_as_bcd : 1; /* PLAYMSF command takes BCD args. */ __u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */ __u8 toctracks_as_bcd : 1; /* TOC track numbers are in BCD. */ __u8 subchan_as_bcd : 1; /* Subchannel info is in BCD. */ __u8 is_changer : 1; /* Drive is a changer. */ __u8 cd_r : 1; /* Drive can write to CD-R media . */ __u8 cd_rw : 1; /* Drive can write to CD-R/W media . */ __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contents of slots. */ __u8 limit_nframes : 1; /* Drive does not provide data in multiples of SECTOR_SIZE when more than one interrupt is needed. */ __u8 seeking : 1; /* Seeking in progress */ __u8 audio_play : 1; /* can do audio related commands */ __u8 close_tray : 1; /* can close the tray */ __u8 writing : 1; /* pseudo write in progress */ __u8 mo_drive : 1; /* drive is an MO device */ __u8 reserved : 2; byte max_speed; /* Max speed of the drive */};#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) /* State flags. These give information about the current state of the drive, and will change during normal operation. */struct ide_cd_state_flags { __u8 media_changed : 1; /* Driver has noticed a media change. */ __u8 toc_valid : 1; /* Saved TOC information is current. */ __u8 door_locked : 1; /* We think that the drive door is locked. */ __u8 writing : 1; /* the drive is currently writing */ __u8 reserved : 4; byte current_speed; /* Current speed of the drive */}; #define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags)) /* Structure of a MSF cdrom address. */struct atapi_msf { byte reserved; byte minute; byte second; byte frame;}; /* Space to hold the disk TOC. */#define MAX_TRACKS 99struct atapi_toc_header { unsigned short toc_length; byte first_track; byte last_track;}; struct atapi_toc_entry { byte reserved1;#if defined(__BIG_ENDIAN_BITFIELD) __u8 adr : 4; __u8 control : 4;#elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 control : 4; __u8 adr : 4;#else#error "Please fix <asm/byteorder.h>"#endif byte track; byte reserved2; union { unsigned lba; struct atapi_msf msf; } addr;}; struct atapi_toc { int last_session_lba; int xa_flag; unsigned long capacity; struct atapi_toc_header hdr; struct atapi_toc_entry ent[MAX_TRACKS+1]; /* One extra for the leadout. */}; /* This structure is annoyingly close to, but not identical with, the cdrom_subchnl structure from cdrom.h. */struct atapi_cdrom_subchnl { u_char acdsc_reserved; u_char acdsc_audiostatus; u_short acdsc_length; u_char acdsc_format; #if defined(__BIG_ENDIAN_BITFIELD) u_char acdsc_ctrl: 4; u_char acdsc_adr: 4;#elif defined(__LITTLE_ENDIAN_BITFIELD) u_char acdsc_adr: 4; u_char acdsc_ctrl: 4;#else#error "Please fix <asm/byteorder.h>"#endif u_char acdsc_trk; u_char acdsc_ind; union { struct atapi_msf msf; int lba; } acdsc_absaddr; union { struct atapi_msf msf; int lba; } acdsc_reladdr;}; /* This should probably go into cdrom.h along with the other * generic stuff now in the Mt. Fuji spec. */struct atapi_capabilities_page { struct mode_page_header header;#if defined(__BIG_ENDIAN_BITFIELD) __u8 parameters_saveable : 1; __u8 reserved1 : 1; __u8 page_code : 6;#elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 page_code : 6; __u8 reserved1 : 1; __u8 parameters_saveable : 1;#else#error "Please fix <asm/byteorder.h>"#endif byte page_length; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 2; /* Drive supports reading of DVD-RAM discs */ __u8 dvd_ram_read : 1; /* Drive supports reading of DVD-R discs */ __u8 dvd_r_read : 1; /* Drive supports reading of DVD-ROM discs */ __u8 dvd_rom : 1; /* Drive supports reading CD-R discs with addressing method 2 */ __u8 method2 : 1; /* reserved in 1.2 */ /* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_read : 1; /* reserved in 1.2 */ /* Drive supports read from CD-R discs (orange book, part II) */ __u8 cd_r_read : 1; /* reserved in 1.2 */#elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive supports read from CD-R discs (orange book, part II) */ __u8 cd_r_read : 1; /* reserved in 1.2 */ /* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_read : 1; /* reserved in 1.2 */ /* Drive supports reading CD-R discs with addressing method 2 */ __u8 method2 : 1; /* Drive supports reading of DVD-ROM discs */ __u8 dvd_rom : 1; /* Drive supports reading of DVD-R discs */ __u8 dvd_r_read : 1; /* Drive supports reading of DVD-RAM discs */ __u8 dvd_ram_read : 1; __u8 reserved2 : 2;#else#error "Please fix <asm/byteorder.h>"#endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved3 : 2; /* Drive can write DVD-RAM discs */ __u8 dvd_ram_write : 1; /* Drive can write DVD-R discs */ __u8 dvd_r_write : 1; __u8 reserved3a : 1; /* Drive can fake writes */ __u8 test_write : 1; /* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_write : 1; /* reserved in 1.2 */ /* Drive supports write to CD-R discs (orange book, part II) */ __u8 cd_r_write : 1; /* reserved in 1.2 */#elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive can write to CD-R discs (orange book, part II) */ __u8 cd_r_write : 1; /* reserved in 1.2 */ /* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_write : 1; /* reserved in 1.2 */ /* Drive can fake writes */ __u8 test_write : 1; __u8 reserved3a : 1; /* Drive can write DVD-R discs */ __u8 dvd_r_write : 1; /* Drive can write DVD-RAM discs */ __u8 dvd_ram_write : 1; __u8 reserved3 : 2;#else#error "Please fix <asm/byteorder.h>"#endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved4 : 1; /* Drive can read multisession discs. */ __u8 multisession : 1; /* Drive can read mode 2, form 2 data. */ __u8 mode2_form2 : 1; /* Drive can read mode 2, form 1 (XA) data. */ __u8 mode2_form1 : 1; /* Drive supports digital output on port 2. */ __u8 digport2 : 1; /* Drive supports digital output on port 1. */ __u8 digport1 : 1; /* Drive can deliver a composite audio/video data stream. */ __u8 composite : 1; /* Drive supports audio play operations. */ __u8 audio_play : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive supports audio play operations. */ __u8 audio_play : 1; /* Drive can deliver a composite audio/video data stream. */ __u8 composite : 1; /* Drive supports digital output on port 1. */ __u8 digport1 : 1; /* Drive supports digital output on port 2. */ __u8 digport2 : 1; /* Drive can read mode 2, form 1 (XA) data. */ __u8 mode2_form1 : 1; /* Drive can read mode 2, form 2 data. */ __u8 mode2_form2 : 1; /* Drive can read multisession discs. */ __u8 multisession : 1; __u8 reserved4 : 1;#else#error "Please fix <asm/byteorder.h>"#endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved5 : 1; /* Drive can return Media Catalog Number (UPC) info. */ __u8 upc : 1; /* Drive can return International Standard Recording Code info. */ __u8 isrc : 1; /* Drive supports C2 error pointers. */ __u8 c2_pointers : 1; /* R-W data will be returned deinterleaved and error corrected. */ __u8 rw_corr : 1; /* Subchannel reads can return combined R-W information. */ __u8 rw_supported : 1; /* Drive can continue a read cdda operation from a loss of streaming.*/ __u8 cdda_accurate : 1; /* Drive can read Red Book audio data. */ __u8 cdda : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive can read Red Book audio data. */ __u8 cdda : 1; /* Drive can continue a read cdda operation from a loss of streaming.*/ __u8 cdda_accurate : 1; /* Subchannel reads can return combined R-W information. */ __u8 rw_supported : 1; /* R-W data will be returned deinterleaved and error corrected. */ __u8 rw_corr : 1; /* Drive supports C2 error pointers. */ __u8 c2_pointers : 1; /* Drive can return International Standard Recording Code info. */ __u8 isrc : 1; /* Drive can return Media Catalog Number (UPC) info. */ __u8 upc : 1; __u8 reserved5 : 1;#else#error "Please fix <asm/byteorder.h>"#endif #if defined(__BIG_ENDIAN_BITFIELD) /* Drive mechanism types. */ mechtype_t mechtype : 3; __u8 reserved6 : 1; /* Drive can eject a disc or changer cartridge. */ __u8 eject : 1; /* State of prevent/allow jumper. */ __u8 prevent_jumper : 1; /* Present state of door lock. */ __u8 lock_state : 1; /* Drive can lock the door. */ __u8 lock : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive can lock the door. */ __u8 lock : 1; /* Present state of door lock. */ __u8 lock_state : 1; /* State of prevent/allow jumper. */ __u8 prevent_jumper : 1; /* Drive can eject a disc or changer cartridge. */ __u8 eject : 1; __u8 reserved6 : 1; /* Drive mechanism types. */ mechtype_t mechtype : 3;#else#error "Please fix <asm/byteorder.h>"#endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved7 : 4; /* Drive supports software slot selection. */ __u8 sss : 1; /* reserved in 1.2 */ /* Changer can report exact contents of slots. */ __u8 disc_present : 1; /* reserved in 1.2 */ /* Audio for each channel can be muted independently. */ __u8 separate_mute : 1; /* Audio level for each channel can be controlled independently. */ __u8 separate_volume : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD) /* Audio level for each channel can be controlled independently. */ __u8 separate_volume : 1; /* Audio for each channel can be muted independently. */ __u8 separate_mute : 1; /* Changer can report exact contents of slots. */ __u8 disc_present : 1; /* reserved in 1.2 */ /* Drive supports software slot selection. */ __u8 sss : 1; /* reserved in 1.2 */ __u8 reserved7 : 4;#else#error "Please fix <asm/byteorder.h>"#endif /* Note: the following four fields are returned in big-endian form. */ /* Maximum speed (in kB/s). */ unsigned short maxspeed; /* Number of discrete volume levels. */ unsigned short n_vol_levels; /* Size of cache in drive, in kB. */ unsigned short buffer_size; /* Current speed (in kB/s). */ unsigned short curspeed; char pad[4];}; struct atapi_mechstat_header {#if defined(__BIG_ENDIAN_BITFIELD) __u8 fault : 1; __u8 changer_state : 2; __u8 curslot : 5;#elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curslot : 5; __u8 changer_state : 2; __u8 fault : 1;#else#error "Please fix <asm/byteorder.h>"#endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 mech_state : 3; __u8 door_open : 1; __u8 reserved1 : 4;#elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved1 : 4; __u8 door_open : 1; __u8 mech_state : 3;#else#error "Please fix <asm/byteorder.h>"#endif byte curlba[3]; byte nslots; __u16 slot_tablelen;}; struct atapi_slot {#if defined(__BIG_ENDIAN_BITFIELD) __u8 disc_present : 1; __u8 reserved1 : 6; __u8 change : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 change : 1; __u8 reserved1 : 6; __u8 disc_present : 1;#else#error "Please fix <asm/byteorder.h>"#endif byte reserved2[3];}; struct atapi_changer_info { struct atapi_mechstat_header hdr; struct atapi_slot slots[0];}; /* Extra per-device info for cdrom drives. */struct cdrom_info { ide_drive_t *drive; ide_driver_t *driver; struct gendisk *disk; struct kref kref; /* Buffer for table of contents. NULL if we haven't allocated a TOC buffer for this device yet. */ struct atapi_toc *toc; unsigned long sector_buffered; unsigned long nsectors_buffered; unsigned char *buffer; /* The result of the last successful request sense command on this device. */ struct request_sense sense_data; struct request request_sense_request; int dma; unsigned long last_block; unsigned long start_seek; /* Buffer to hold mechanism status and changer slot table. */ struct atapi_changer_info *changer_info; struct ide_cd_config_flags config_flags; struct ide_cd_state_flags state_flags; /* Per-device info needed by cdrom.c generic driver. */ struct cdrom_device_info devinfo; unsigned long write_timeout;}; /**************************************************************************** * Descriptions of ATAPI error codes. */ Lines 1–500 of 745. Load more
/* * linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen * Copyright (C) 1998-2000 Jens Axboe */ #ifndef _IDE_CD_H #define _IDE_CD_H #include <linux/cdrom.h> #include <asm/byteorder.h> /* Turn this on to have the driver print out the meanings of the ATAPI error codes. This will use up additional kernel-space memory, though. */ #ifndef VERBOSE_IDE_CD_ERRORS #define VERBOSE_IDE_CD_ERRORS 1 #endif /* Turning this on will remove code to work around various nonstandard ATAPI implementations. If you know your drive follows the standard, this will give you a slightly smaller kernel. */ #ifndef STANDARD_ATAPI #define STANDARD_ATAPI 0 #endif /* Turning this on will disable the door-locking functionality. This is apparently needed for supermount. */ #ifndef NO_DOOR_LOCKING #define NO_DOOR_LOCKING 0 #endif /* * typical timeout for packet command */ #define ATAPI_WAIT_PC (60 * HZ) #define ATAPI_WAIT_WRITE_BUSY (10 * HZ) /************************************************************************/ #define SECTOR_BITS 9 #ifndef SECTOR_SIZE #define SECTOR_SIZE (1 << SECTOR_BITS) #endif #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS) #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32) #define SECTORS_BUFFER (SECTOR_BUFFER_SIZE >> SECTOR_BITS) #define SECTORS_MAX (131072 >> SECTOR_BITS) #define BLOCKS_PER_FRAME (CD_FRAMESIZE / BLOCK_SIZE) /* special command codes for strategy routine. */ #define PACKET_COMMAND 4315 #define REQUEST_SENSE_COMMAND 4316 #define RESET_DRIVE_COMMAND 4317 /* Configuration flags. These describe the capabilities of the drive. They generally do not change after initialization, unless we learn more about the drive from stuff failing. */ struct ide_cd_config_flags { __u8 drq_interrupt : 1; /* Device sends an interrupt when ready for a packet command. */ __u8 no_doorlock : 1; /* Drive cannot lock the door. */ __u8 no_eject : 1; /* Drive cannot eject the disc. */ __u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */ __u8 playmsf_as_bcd : 1; /* PLAYMSF command takes BCD args. */ __u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */ __u8 toctracks_as_bcd : 1; /* TOC track numbers are in BCD. */ __u8 subchan_as_bcd : 1; /* Subchannel info is in BCD. */ __u8 is_changer : 1; /* Drive is a changer. */ __u8 cd_r : 1; /* Drive can write to CD-R media . */ __u8 cd_rw : 1; /* Drive can write to CD-R/W media . */ __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contents of slots. */ __u8 limit_nframes : 1; /* Drive does not provide data in multiples of SECTOR_SIZE when more than one interrupt is needed. */ __u8 seeking : 1; /* Seeking in progress */ __u8 audio_play : 1; /* can do audio related commands */ __u8 close_tray : 1; /* can close the tray */ __u8 writing : 1; /* pseudo write in progress */ __u8 mo_drive : 1; /* drive is an MO device */ __u8 reserved : 2; byte max_speed; /* Max speed of the drive */ }; #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) /* State flags. These give information about the current state of the drive, and will change during normal operation. */ struct ide_cd_state_flags { __u8 media_changed : 1; /* Driver has noticed a media change. */ __u8 toc_valid : 1; /* Saved TOC information is current. */ __u8 door_locked : 1; /* We think that the drive door is locked. */ __u8 writing : 1; /* the drive is currently writing */ __u8 reserved : 4; byte current_speed; /* Current speed of the drive */ }; #define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags)) /* Structure of a MSF cdrom address. */ struct atapi_msf { byte reserved; byte minute; byte second; byte frame; }; /* Space to hold the disk TOC. */ #define MAX_TRACKS 99 struct atapi_toc_header { unsigned short toc_length; byte first_track; byte last_track; }; struct atapi_toc_entry { byte reserved1; #if defined(__BIG_ENDIAN_BITFIELD) __u8 adr : 4; __u8 control : 4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 control : 4; __u8 adr : 4; #else #error "Please fix <asm/byteorder.h>" #endif byte track; byte reserved2; union { unsigned lba; struct atapi_msf msf; } addr; }; struct atapi_toc { int last_session_lba; int xa_flag; unsigned long capacity; struct atapi_toc_header hdr; struct atapi_toc_entry ent[MAX_TRACKS+1]; /* One extra for the leadout. */ }; /* This structure is annoyingly close to, but not identical with, the cdrom_subchnl structure from cdrom.h. */ struct atapi_cdrom_subchnl { u_char acdsc_reserved; u_char acdsc_audiostatus; u_short acdsc_length; u_char acdsc_format; #if defined(__BIG_ENDIAN_BITFIELD) u_char acdsc_ctrl: 4; u_char acdsc_adr: 4; #elif defined(__LITTLE_ENDIAN_BITFIELD) u_char acdsc_adr: 4; u_char acdsc_ctrl: 4; #else #error "Please fix <asm/byteorder.h>" #endif u_char acdsc_trk; u_char acdsc_ind; union { struct atapi_msf msf; int lba; } acdsc_absaddr; union { struct atapi_msf msf; int lba; } acdsc_reladdr; }; /* This should probably go into cdrom.h along with the other * generic stuff now in the Mt. Fuji spec. */ struct atapi_capabilities_page { struct mode_page_header header; #if defined(__BIG_ENDIAN_BITFIELD) __u8 parameters_saveable : 1; __u8 reserved1 : 1; __u8 page_code : 6; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 page_code : 6; __u8 reserved1 : 1; __u8 parameters_saveable : 1; #else #error "Please fix <asm/byteorder.h>" #endif byte page_length; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 2; /* Drive supports reading of DVD-RAM discs */ __u8 dvd_ram_read : 1; /* Drive supports reading of DVD-R discs */ __u8 dvd_r_read : 1; /* Drive supports reading of DVD-ROM discs */ __u8 dvd_rom : 1; /* Drive supports reading CD-R discs with addressing method 2 */ __u8 method2 : 1; /* reserved in 1.2 */ /* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_read : 1; /* reserved in 1.2 */ /* Drive supports read from CD-R discs (orange book, part II) */ __u8 cd_r_read : 1; /* reserved in 1.2 */ #elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive supports read from CD-R discs (orange book, part II) */ __u8 cd_r_read : 1; /* reserved in 1.2 */ /* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_read : 1; /* reserved in 1.2 */ /* Drive supports reading CD-R discs with addressing method 2 */ __u8 method2 : 1; /* Drive supports reading of DVD-ROM discs */ __u8 dvd_rom : 1; /* Drive supports reading of DVD-R discs */ __u8 dvd_r_read : 1; /* Drive supports reading of DVD-RAM discs */ __u8 dvd_ram_read : 1; __u8 reserved2 : 2; #else #error "Please fix <asm/byteorder.h>" #endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved3 : 2; /* Drive can write DVD-RAM discs */ __u8 dvd_ram_write : 1; /* Drive can write DVD-R discs */ __u8 dvd_r_write : 1; __u8 reserved3a : 1; /* Drive can fake writes */ __u8 test_write : 1; /* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_write : 1; /* reserved in 1.2 */ /* Drive supports write to CD-R discs (orange book, part II) */ __u8 cd_r_write : 1; /* reserved in 1.2 */ #elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive can write to CD-R discs (orange book, part II) */ __u8 cd_r_write : 1; /* reserved in 1.2 */ /* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */ __u8 cd_rw_write : 1; /* reserved in 1.2 */ /* Drive can fake writes */ __u8 test_write : 1; __u8 reserved3a : 1; /* Drive can write DVD-R discs */ __u8 dvd_r_write : 1; /* Drive can write DVD-RAM discs */ __u8 dvd_ram_write : 1; __u8 reserved3 : 2; #else #error "Please fix <asm/byteorder.h>" #endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved4 : 1; /* Drive can read multisession discs. */ __u8 multisession : 1; /* Drive can read mode 2, form 2 data. */ __u8 mode2_form2 : 1; /* Drive can read mode 2, form 1 (XA) data. */ __u8 mode2_form1 : 1; /* Drive supports digital output on port 2. */ __u8 digport2 : 1; /* Drive supports digital output on port 1. */ __u8 digport1 : 1; /* Drive can deliver a composite audio/video data stream. */ __u8 composite : 1; /* Drive supports audio play operations. */ __u8 audio_play : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive supports audio play operations. */ __u8 audio_play : 1; /* Drive can deliver a composite audio/video data stream. */ __u8 composite : 1; /* Drive supports digital output on port 1. */ __u8 digport1 : 1; /* Drive supports digital output on port 2. */ __u8 digport2 : 1; /* Drive can read mode 2, form 1 (XA) data. */ __u8 mode2_form1 : 1; /* Drive can read mode 2, form 2 data. */ __u8 mode2_form2 : 1; /* Drive can read multisession discs. */ __u8 multisession : 1; __u8 reserved4 : 1; #else #error "Please fix <asm/byteorder.h>" #endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved5 : 1; /* Drive can return Media Catalog Number (UPC) info. */ __u8 upc : 1; /* Drive can return International Standard Recording Code info. */ __u8 isrc : 1; /* Drive supports C2 error pointers. */ __u8 c2_pointers : 1; /* R-W data will be returned deinterleaved and error corrected. */ __u8 rw_corr : 1; /* Subchannel reads can return combined R-W information. */ __u8 rw_supported : 1; /* Drive can continue a read cdda operation from a loss of streaming.*/ __u8 cdda_accurate : 1; /* Drive can read Red Book audio data. */ __u8 cdda : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive can read Red Book audio data. */ __u8 cdda : 1; /* Drive can continue a read cdda operation from a loss of streaming.*/ __u8 cdda_accurate : 1; /* Subchannel reads can return combined R-W information. */ __u8 rw_supported : 1; /* R-W data will be returned deinterleaved and error corrected. */ __u8 rw_corr : 1; /* Drive supports C2 error pointers. */ __u8 c2_pointers : 1; /* Drive can return International Standard Recording Code info. */ __u8 isrc : 1; /* Drive can return Media Catalog Number (UPC) info. */ __u8 upc : 1; __u8 reserved5 : 1; #else #error "Please fix <asm/byteorder.h>" #endif #if defined(__BIG_ENDIAN_BITFIELD) /* Drive mechanism types. */ mechtype_t mechtype : 3; __u8 reserved6 : 1; /* Drive can eject a disc or changer cartridge. */ __u8 eject : 1; /* State of prevent/allow jumper. */ __u8 prevent_jumper : 1; /* Present state of door lock. */ __u8 lock_state : 1; /* Drive can lock the door. */ __u8 lock : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) /* Drive can lock the door. */ __u8 lock : 1; /* Present state of door lock. */ __u8 lock_state : 1; /* State of prevent/allow jumper. */ __u8 prevent_jumper : 1; /* Drive can eject a disc or changer cartridge. */ __u8 eject : 1; __u8 reserved6 : 1; /* Drive mechanism types. */ mechtype_t mechtype : 3; #else #error "Please fix <asm/byteorder.h>" #endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved7 : 4; /* Drive supports software slot selection. */ __u8 sss : 1; /* reserved in 1.2 */ /* Changer can report exact contents of slots. */ __u8 disc_present : 1; /* reserved in 1.2 */ /* Audio for each channel can be muted independently. */ __u8 separate_mute : 1; /* Audio level for each channel can be controlled independently. */ __u8 separate_volume : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) /* Audio level for each channel can be controlled independently. */ __u8 separate_volume : 1; /* Audio for each channel can be muted independently. */ __u8 separate_mute : 1; /* Changer can report exact contents of slots. */ __u8 disc_present : 1; /* reserved in 1.2 */ /* Drive supports software slot selection. */ __u8 sss : 1; /* reserved in 1.2 */ __u8 reserved7 : 4; #else #error "Please fix <asm/byteorder.h>" #endif /* Note: the following four fields are returned in big-endian form. */ /* Maximum speed (in kB/s). */ unsigned short maxspeed; /* Number of discrete volume levels. */ unsigned short n_vol_levels; /* Size of cache in drive, in kB. */ unsigned short buffer_size; /* Current speed (in kB/s). */ unsigned short curspeed; char pad[4]; }; struct atapi_mechstat_header { #if defined(__BIG_ENDIAN_BITFIELD) __u8 fault : 1; __u8 changer_state : 2; __u8 curslot : 5; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curslot : 5; __u8 changer_state : 2; __u8 fault : 1; #else #error "Please fix <asm/byteorder.h>" #endif #if defined(__BIG_ENDIAN_BITFIELD) __u8 mech_state : 3; __u8 door_open : 1; __u8 reserved1 : 4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved1 : 4; __u8 door_open : 1; __u8 mech_state : 3; #else #error "Please fix <asm/byteorder.h>" #endif byte curlba[3]; byte nslots; __u16 slot_tablelen; }; struct atapi_slot { #if defined(__BIG_ENDIAN_BITFIELD) __u8 disc_present : 1; __u8 reserved1 : 6; __u8 change : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 change : 1; __u8 reserved1 : 6; __u8 disc_present : 1; #else #error "Please fix <asm/byteorder.h>" #endif byte reserved2[3]; }; struct atapi_changer_info { struct atapi_mechstat_header hdr; struct atapi_slot slots[0]; }; /* Extra per-device info for cdrom drives. */ struct cdrom_info { ide_drive_t *drive; ide_driver_t *driver; struct gendisk *disk; struct kref kref; /* Buffer for table of contents. NULL if we haven't allocated a TOC buffer for this device yet. */ struct atapi_toc *toc; unsigned long sector_buffered; unsigned long nsectors_buffered; unsigned char *buffer; /* The result of the last successful request sense command on this device. */ struct request_sense sense_data; struct request request_sense_request; int dma; unsigned long last_block; unsigned long start_seek; /* Buffer to hold mechanism status and changer slot table. */ struct atapi_changer_info *changer_info; struct ide_cd_config_flags config_flags; struct ide_cd_state_flags state_flags; /* Per-device info needed by cdrom.c generic driver. */ struct cdrom_device_info devinfo; unsigned long write_timeout; }; /**************************************************************************** * Descriptions of ATAPI error codes. */