ide-cd: remove unused defines from ide-cd.h
[safe/jmp/linux-2.6] / drivers / ide / ide-cd.h
1 /*
2  *  linux/drivers/ide/ide_cd.h
3  *
4  *  Copyright (C) 1996-98  Erik Andersen
5  *  Copyright (C) 1998-2000 Jens Axboe
6  */
7 #ifndef _IDE_CD_H
8 #define _IDE_CD_H
9
10 #include <linux/cdrom.h>
11 #include <asm/byteorder.h>
12
13 /* Turn this on to have the driver print out the meanings of the
14    ATAPI error codes.  This will use up additional kernel-space
15    memory, though. */
16
17 #ifndef VERBOSE_IDE_CD_ERRORS
18 #define VERBOSE_IDE_CD_ERRORS 1
19 #endif
20
21
22 /* Turning this on will remove code to work around various nonstandard
23    ATAPI implementations.  If you know your drive follows the standard,
24    this will give you a slightly smaller kernel. */
25
26 #ifndef STANDARD_ATAPI
27 #define STANDARD_ATAPI 0
28 #endif
29
30
31 /* Turning this on will disable the door-locking functionality.
32    This is apparently needed for supermount. */
33
34 #ifndef NO_DOOR_LOCKING
35 #define NO_DOOR_LOCKING 0
36 #endif
37
38 /*
39  * typical timeout for packet command
40  */
41 #define ATAPI_WAIT_PC           (60 * HZ)
42 #define ATAPI_WAIT_WRITE_BUSY   (10 * HZ)
43
44 /************************************************************************/
45
46 #define SECTOR_BITS             9
47 #ifndef SECTOR_SIZE
48 #define SECTOR_SIZE             (1 << SECTOR_BITS)
49 #endif
50 #define SECTORS_PER_FRAME       (CD_FRAMESIZE >> SECTOR_BITS)
51 #define SECTOR_BUFFER_SIZE      (CD_FRAMESIZE * 32)
52
53 /* Configuration flags.  These describe the capabilities of the drive.
54    They generally do not change after initialization, unless we learn
55    more about the drive from stuff failing. */
56 struct ide_cd_config_flags {
57         __u8 drq_interrupt      : 1; /* Device sends an interrupt when ready
58                                         for a packet command. */
59         __u8 no_doorlock        : 1; /* Drive cannot lock the door. */
60         __u8 no_eject           : 1; /* Drive cannot eject the disc. */
61         __u8 nec260             : 1; /* Drive is a pre-1.2 NEC 260 drive. */
62         __u8 playmsf_as_bcd     : 1; /* PLAYMSF command takes BCD args. */
63         __u8 tocaddr_as_bcd     : 1; /* TOC addresses are in BCD. */
64         __u8 toctracks_as_bcd   : 1; /* TOC track numbers are in BCD. */
65         __u8 subchan_as_bcd     : 1; /* Subchannel info is in BCD. */
66         __u8 is_changer         : 1; /* Drive is a changer. */
67         __u8 cd_r               : 1; /* Drive can write to CD-R media . */
68         __u8 cd_rw              : 1; /* Drive can write to CD-R/W media . */
69         __u8 dvd                : 1; /* Drive is a DVD-ROM */
70         __u8 dvd_r              : 1; /* Drive can write DVD-R */
71         __u8 dvd_ram            : 1; /* Drive can write DVD-RAM */
72         __u8 ram                : 1; /* generic WRITE (dvd-ram/mrw) */
73         __u8 test_write         : 1; /* Drive can fake writes */
74         __u8 supp_disc_present  : 1; /* Changer can report exact contents
75                                         of slots. */
76         __u8 limit_nframes      : 1; /* Drive does not provide data in
77                                         multiples of SECTOR_SIZE when more
78                                         than one interrupt is needed. */
79         __u8 seeking            : 1; /* Seeking in progress */
80         __u8 audio_play         : 1; /* can do audio related commands */
81         __u8 close_tray         : 1; /* can close the tray */
82         __u8 writing            : 1; /* pseudo write in progress */
83         __u8 mo_drive           : 1; /* drive is an MO device */
84         __u8 no_speed_select    : 1; /* SET_CD_SPEED command is unsupported. */
85         __u8 reserved           : 1;
86         byte max_speed;              /* Max speed of the drive */
87 };
88 #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))
89
90  
91 /* State flags.  These give information about the current state of the
92    drive, and will change during normal operation. */
93 struct ide_cd_state_flags {
94         __u8 media_changed : 1; /* Driver has noticed a media change. */
95         __u8 toc_valid     : 1; /* Saved TOC information is current. */
96         __u8 door_locked   : 1; /* We think that the drive door is locked. */
97         __u8 writing       : 1; /* the drive is currently writing */
98         __u8 reserved      : 4;
99         byte current_speed;     /* Current speed of the drive */
100 };
101
102 #define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags))
103
104 /* Structure of a MSF cdrom address. */
105 struct atapi_msf {
106         byte reserved;
107         byte minute;
108         byte second;
109         byte frame;
110 };
111
112 /* Space to hold the disk TOC. */
113 #define MAX_TRACKS 99
114 struct atapi_toc_header {
115         unsigned short toc_length;
116         byte first_track;
117         byte last_track;
118 };
119
120 struct atapi_toc_entry {
121         byte reserved1;
122 #if defined(__BIG_ENDIAN_BITFIELD)
123         __u8 adr     : 4;
124         __u8 control : 4;
125 #elif defined(__LITTLE_ENDIAN_BITFIELD)
126         __u8 control : 4;
127         __u8 adr     : 4;
128 #else
129 #error "Please fix <asm/byteorder.h>"
130 #endif
131         byte track;
132         byte reserved2;
133         union {
134                 unsigned lba;
135                 struct atapi_msf msf;
136         } addr;
137 };
138
139 struct atapi_toc {
140         int    last_session_lba;
141         int    xa_flag;
142         unsigned long capacity;
143         struct atapi_toc_header hdr;
144         struct atapi_toc_entry  ent[MAX_TRACKS+1];
145           /* One extra for the leadout. */
146 };
147
148
149 /* This structure is annoyingly close to, but not identical with,
150    the cdrom_subchnl structure from cdrom.h. */
151 struct atapi_cdrom_subchnl {
152         u_char  acdsc_reserved;
153         u_char  acdsc_audiostatus;
154         u_short acdsc_length;
155         u_char  acdsc_format;
156
157 #if defined(__BIG_ENDIAN_BITFIELD)
158         u_char  acdsc_ctrl:     4;
159         u_char  acdsc_adr:      4;
160 #elif defined(__LITTLE_ENDIAN_BITFIELD)
161         u_char  acdsc_adr:      4;
162         u_char  acdsc_ctrl:     4;
163 #else
164 #error "Please fix <asm/byteorder.h>"
165 #endif
166         u_char  acdsc_trk;
167         u_char  acdsc_ind;
168         union {
169                 struct atapi_msf msf;
170                 int     lba;
171         } acdsc_absaddr;
172         union {
173                 struct atapi_msf msf;
174                 int     lba;
175         } acdsc_reladdr;
176 };
177
178
179
180 /* This should probably go into cdrom.h along with the other
181  * generic stuff now in the Mt. Fuji spec.
182  */
183 struct atapi_capabilities_page {
184         struct mode_page_header header;
185 #if defined(__BIG_ENDIAN_BITFIELD)
186         __u8 parameters_saveable : 1;
187         __u8 reserved1           : 1;
188         __u8 page_code           : 6;
189 #elif defined(__LITTLE_ENDIAN_BITFIELD)
190         __u8 page_code           : 6;
191         __u8 reserved1           : 1;
192         __u8 parameters_saveable : 1;
193 #else
194 #error "Please fix <asm/byteorder.h>"
195 #endif
196
197         byte     page_length;
198
199 #if defined(__BIG_ENDIAN_BITFIELD)
200         __u8 reserved2           : 2;
201         /* Drive supports reading of DVD-RAM discs */
202         __u8 dvd_ram_read        : 1;
203         /* Drive supports reading of DVD-R discs */
204         __u8 dvd_r_read          : 1;
205         /* Drive supports reading of DVD-ROM discs */
206         __u8 dvd_rom             : 1;
207         /* Drive supports reading CD-R discs with addressing method 2 */
208         __u8 method2             : 1; /* reserved in 1.2 */
209         /* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */
210         __u8 cd_rw_read          : 1; /* reserved in 1.2 */
211         /* Drive supports read from CD-R discs (orange book, part II) */
212         __u8 cd_r_read           : 1; /* reserved in 1.2 */
213 #elif defined(__LITTLE_ENDIAN_BITFIELD)
214         /* Drive supports read from CD-R discs (orange book, part II) */
215         __u8 cd_r_read           : 1; /* reserved in 1.2 */
216         /* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */
217         __u8 cd_rw_read          : 1; /* reserved in 1.2 */
218         /* Drive supports reading CD-R discs with addressing method 2 */
219         __u8 method2             : 1;
220         /* Drive supports reading of DVD-ROM discs */
221         __u8 dvd_rom             : 1;
222         /* Drive supports reading of DVD-R discs */
223         __u8 dvd_r_read          : 1;
224         /* Drive supports reading of DVD-RAM discs */
225         __u8 dvd_ram_read        : 1;
226         __u8 reserved2           : 2;
227 #else
228 #error "Please fix <asm/byteorder.h>"
229 #endif
230
231 #if defined(__BIG_ENDIAN_BITFIELD)
232         __u8 reserved3           : 2;
233         /* Drive can write DVD-RAM discs */
234         __u8 dvd_ram_write       : 1;
235         /* Drive can write DVD-R discs */
236         __u8 dvd_r_write         : 1;
237         __u8 reserved3a          : 1;
238         /* Drive can fake writes */
239         __u8 test_write          : 1;
240         /* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */
241         __u8 cd_rw_write         : 1; /* reserved in 1.2 */
242         /* Drive supports write to CD-R discs (orange book, part II) */
243         __u8 cd_r_write          : 1; /* reserved in 1.2 */
244 #elif defined(__LITTLE_ENDIAN_BITFIELD)
245         /* Drive can write to CD-R discs (orange book, part II) */
246         __u8 cd_r_write          : 1; /* reserved in 1.2 */
247         /* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */
248         __u8 cd_rw_write         : 1; /* reserved in 1.2 */
249         /* Drive can fake writes */
250         __u8 test_write          : 1;
251         __u8 reserved3a          : 1;
252         /* Drive can write DVD-R discs */
253         __u8 dvd_r_write         : 1;
254         /* Drive can write DVD-RAM discs */
255         __u8 dvd_ram_write       : 1;
256         __u8 reserved3           : 2;
257 #else
258 #error "Please fix <asm/byteorder.h>"
259 #endif
260
261 #if defined(__BIG_ENDIAN_BITFIELD)
262         __u8 reserved4           : 1;
263         /* Drive can read multisession discs. */
264         __u8 multisession        : 1;
265         /* Drive can read mode 2, form 2 data. */
266         __u8 mode2_form2         : 1;
267         /* Drive can read mode 2, form 1 (XA) data. */
268         __u8 mode2_form1         : 1;
269         /* Drive supports digital output on port 2. */
270         __u8 digport2            : 1;
271         /* Drive supports digital output on port 1. */
272         __u8 digport1            : 1;
273         /* Drive can deliver a composite audio/video data stream. */
274         __u8 composite           : 1;
275         /* Drive supports audio play operations. */
276         __u8 audio_play          : 1;
277 #elif defined(__LITTLE_ENDIAN_BITFIELD)
278         /* Drive supports audio play operations. */
279         __u8 audio_play          : 1;
280         /* Drive can deliver a composite audio/video data stream. */
281         __u8 composite           : 1;
282         /* Drive supports digital output on port 1. */
283         __u8 digport1            : 1;
284         /* Drive supports digital output on port 2. */
285         __u8 digport2            : 1;
286         /* Drive can read mode 2, form 1 (XA) data. */
287         __u8 mode2_form1         : 1;
288         /* Drive can read mode 2, form 2 data. */
289         __u8 mode2_form2         : 1;
290         /* Drive can read multisession discs. */
291         __u8 multisession        : 1;
292         __u8 reserved4           : 1;
293 #else
294 #error "Please fix <asm/byteorder.h>"
295 #endif
296
297 #if defined(__BIG_ENDIAN_BITFIELD)
298         __u8 reserved5           : 1;
299         /* Drive can return Media Catalog Number (UPC) info. */
300         __u8 upc                 : 1;
301         /* Drive can return International Standard Recording Code info. */
302         __u8 isrc                : 1;
303         /* Drive supports C2 error pointers. */
304         __u8 c2_pointers         : 1;
305         /* R-W data will be returned deinterleaved and error corrected. */
306         __u8 rw_corr             : 1;
307         /* Subchannel reads can return combined R-W information. */
308         __u8 rw_supported        : 1;
309         /* Drive can continue a read cdda operation from a loss of streaming.*/
310         __u8 cdda_accurate       : 1;
311         /* Drive can read Red Book audio data. */
312         __u8 cdda                : 1;
313 #elif defined(__LITTLE_ENDIAN_BITFIELD)
314         /* Drive can read Red Book audio data. */
315         __u8 cdda                : 1;
316         /* Drive can continue a read cdda operation from a loss of streaming.*/
317         __u8 cdda_accurate       : 1;
318         /* Subchannel reads can return combined R-W information. */
319         __u8 rw_supported        : 1;
320         /* R-W data will be returned deinterleaved and error corrected. */
321         __u8 rw_corr             : 1;
322         /* Drive supports C2 error pointers. */
323         __u8 c2_pointers         : 1;
324         /* Drive can return International Standard Recording Code info. */
325         __u8 isrc                : 1;
326         /* Drive can return Media Catalog Number (UPC) info. */
327         __u8 upc                 : 1;
328         __u8 reserved5           : 1;
329 #else
330 #error "Please fix <asm/byteorder.h>"
331 #endif
332
333 #if defined(__BIG_ENDIAN_BITFIELD)
334         /* Drive mechanism types. */
335         mechtype_t mechtype      : 3;
336         __u8 reserved6           : 1;
337         /* Drive can eject a disc or changer cartridge. */
338         __u8 eject               : 1;
339         /* State of prevent/allow jumper. */
340         __u8 prevent_jumper      : 1;
341         /* Present state of door lock. */
342         __u8 lock_state          : 1;
343         /* Drive can lock the door. */
344         __u8 lock                : 1;
345 #elif defined(__LITTLE_ENDIAN_BITFIELD)
346
347         /* Drive can lock the door. */
348         __u8 lock                : 1;
349         /* Present state of door lock. */
350         __u8 lock_state          : 1;
351         /* State of prevent/allow jumper. */
352         __u8 prevent_jumper      : 1;
353         /* Drive can eject a disc or changer cartridge. */
354         __u8 eject               : 1;
355         __u8 reserved6           : 1;
356         /* Drive mechanism types. */
357         mechtype_t mechtype      : 3;
358 #else
359 #error "Please fix <asm/byteorder.h>"
360 #endif
361
362 #if defined(__BIG_ENDIAN_BITFIELD)
363         __u8 reserved7           : 4;
364         /* Drive supports software slot selection. */
365         __u8 sss                 : 1;  /* reserved in 1.2 */
366         /* Changer can report exact contents of slots. */
367         __u8 disc_present        : 1;  /* reserved in 1.2 */
368         /* Audio for each channel can be muted independently. */
369         __u8 separate_mute       : 1;
370         /* Audio level for each channel can be controlled independently. */
371         __u8 separate_volume     : 1;
372 #elif defined(__LITTLE_ENDIAN_BITFIELD)
373
374         /* Audio level for each channel can be controlled independently. */
375         __u8 separate_volume     : 1;
376         /* Audio for each channel can be muted independently. */
377         __u8 separate_mute       : 1;
378         /* Changer can report exact contents of slots. */
379         __u8 disc_present        : 1;  /* reserved in 1.2 */
380         /* Drive supports software slot selection. */
381         __u8 sss                 : 1;  /* reserved in 1.2 */
382         __u8 reserved7           : 4;
383 #else
384 #error "Please fix <asm/byteorder.h>"
385 #endif
386
387         /* Note: the following four fields are returned in big-endian form. */
388         /* Maximum speed (in kB/s). */
389         unsigned short maxspeed;
390         /* Number of discrete volume levels. */
391         unsigned short n_vol_levels;
392         /* Size of cache in drive, in kB. */
393         unsigned short buffer_size;
394         /* Current speed (in kB/s). */
395         unsigned short curspeed;
396         char pad[4];
397 };
398
399
400 struct atapi_mechstat_header {
401 #if defined(__BIG_ENDIAN_BITFIELD)
402         __u8 fault         : 1;
403         __u8 changer_state : 2;
404         __u8 curslot       : 5;
405 #elif defined(__LITTLE_ENDIAN_BITFIELD)
406         __u8 curslot       : 5;
407         __u8 changer_state : 2;
408         __u8 fault         : 1;
409 #else
410 #error "Please fix <asm/byteorder.h>"
411 #endif
412
413 #if defined(__BIG_ENDIAN_BITFIELD)
414         __u8 mech_state    : 3;
415         __u8 door_open     : 1;
416         __u8 reserved1     : 4;
417 #elif defined(__LITTLE_ENDIAN_BITFIELD)
418         __u8 reserved1     : 4;
419         __u8 door_open     : 1;
420         __u8 mech_state    : 3;
421 #else
422 #error "Please fix <asm/byteorder.h>"
423 #endif
424
425         byte     curlba[3];
426         byte     nslots;
427         __u16    slot_tablelen;
428 };
429
430
431 struct atapi_slot {
432 #if defined(__BIG_ENDIAN_BITFIELD)
433         __u8 disc_present : 1;
434         __u8 reserved1    : 6;
435         __u8 change       : 1;
436 #elif defined(__LITTLE_ENDIAN_BITFIELD)
437         __u8 change       : 1;
438         __u8 reserved1    : 6;
439         __u8 disc_present : 1;
440 #else
441 #error "Please fix <asm/byteorder.h>"
442 #endif
443
444         byte reserved2[3];
445 };
446
447 struct atapi_changer_info {
448         struct atapi_mechstat_header hdr;
449         struct atapi_slot slots[0];
450 };
451
452 /* Extra per-device info for cdrom drives. */
453 struct cdrom_info {
454         ide_drive_t     *drive;
455         ide_driver_t    *driver;
456         struct gendisk  *disk;
457         struct kref     kref;
458
459         /* Buffer for table of contents.  NULL if we haven't allocated
460            a TOC buffer for this device yet. */
461
462         struct atapi_toc *toc;
463
464         unsigned long   sector_buffered;
465         unsigned long   nsectors_buffered;
466         unsigned char   *buffer;
467
468         /* The result of the last successful request sense command
469            on this device. */
470         struct request_sense sense_data;
471
472         struct request request_sense_request;
473         int dma;
474         unsigned long last_block;
475         unsigned long start_seek;
476         /* Buffer to hold mechanism status and changer slot table. */
477         struct atapi_changer_info *changer_info;
478
479         struct ide_cd_config_flags      config_flags;
480         struct ide_cd_state_flags       state_flags;
481
482         /* Per-device info needed by cdrom.c generic driver. */
483         struct cdrom_device_info devinfo;
484
485         unsigned long write_timeout;
486 };
487
488 /****************************************************************************
489  * Descriptions of ATAPI error codes.
490  */
491
492 /* This stuff should be in cdrom.h, since it is now generic... */
493
494 /* ATAPI sense keys (from table 140 of ATAPI 2.6) */
495 #define NO_SENSE                0x00
496 #define RECOVERED_ERROR         0x01
497 #define NOT_READY               0x02
498 #define MEDIUM_ERROR            0x03
499 #define HARDWARE_ERROR          0x04
500 #define ILLEGAL_REQUEST         0x05
501 #define UNIT_ATTENTION          0x06
502 #define DATA_PROTECT            0x07
503 #define BLANK_CHECK             0x08
504 #define ABORTED_COMMAND         0x0b
505 #define MISCOMPARE              0x0e
506
507  
508
509 /* This stuff should be in cdrom.h, since it is now generic... */
510 #if VERBOSE_IDE_CD_ERRORS
511
512  /* The generic packet command opcodes for CD/DVD Logical Units,
513  * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ 
514 static const struct {
515         unsigned short packet_command;
516         const char * const text;
517 } packet_command_texts[] = {
518         { GPCMD_TEST_UNIT_READY, "Test Unit Ready" },
519         { GPCMD_REQUEST_SENSE, "Request Sense" },
520         { GPCMD_FORMAT_UNIT, "Format Unit" },
521         { GPCMD_INQUIRY, "Inquiry" },
522         { GPCMD_START_STOP_UNIT, "Start/Stop Unit" },
523         { GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, "Prevent/Allow Medium Removal" },
524         { GPCMD_READ_FORMAT_CAPACITIES, "Read Format Capacities" },
525         { GPCMD_READ_CDVD_CAPACITY, "Read Cd/Dvd Capacity" },
526         { GPCMD_READ_10, "Read 10" },
527         { GPCMD_WRITE_10, "Write 10" },
528         { GPCMD_SEEK, "Seek" },
529         { GPCMD_WRITE_AND_VERIFY_10, "Write and Verify 10" },
530         { GPCMD_VERIFY_10, "Verify 10" },
531         { GPCMD_FLUSH_CACHE, "Flush Cache" },
532         { GPCMD_READ_SUBCHANNEL, "Read Subchannel" },
533         { GPCMD_READ_TOC_PMA_ATIP, "Read Table of Contents" },
534         { GPCMD_READ_HEADER, "Read Header" },
535         { GPCMD_PLAY_AUDIO_10, "Play Audio 10" },
536         { GPCMD_GET_CONFIGURATION, "Get Configuration" },
537         { GPCMD_PLAY_AUDIO_MSF, "Play Audio MSF" },
538         { GPCMD_PLAYAUDIO_TI, "Play Audio TrackIndex" },
539         { GPCMD_GET_EVENT_STATUS_NOTIFICATION, "Get Event Status Notification" },
540         { GPCMD_PAUSE_RESUME, "Pause/Resume" },
541         { GPCMD_STOP_PLAY_SCAN, "Stop Play/Scan" },
542         { GPCMD_READ_DISC_INFO, "Read Disc Info" },
543         { GPCMD_READ_TRACK_RZONE_INFO, "Read Track Rzone Info" },
544         { GPCMD_RESERVE_RZONE_TRACK, "Reserve Rzone Track" },
545         { GPCMD_SEND_OPC, "Send OPC" },
546         { GPCMD_MODE_SELECT_10, "Mode Select 10" },
547         { GPCMD_REPAIR_RZONE_TRACK, "Repair Rzone Track" },
548         { GPCMD_MODE_SENSE_10, "Mode Sense 10" },
549         { GPCMD_CLOSE_TRACK, "Close Track" },
550         { GPCMD_BLANK, "Blank" },
551         { GPCMD_SEND_EVENT, "Send Event" },
552         { GPCMD_SEND_KEY, "Send Key" },
553         { GPCMD_REPORT_KEY, "Report Key" },
554         { GPCMD_LOAD_UNLOAD, "Load/Unload" },
555         { GPCMD_SET_READ_AHEAD, "Set Read-ahead" },
556         { GPCMD_READ_12, "Read 12" },
557         { GPCMD_GET_PERFORMANCE, "Get Performance" },
558         { GPCMD_SEND_DVD_STRUCTURE, "Send DVD Structure" },
559         { GPCMD_READ_DVD_STRUCTURE, "Read DVD Structure" },
560         { GPCMD_SET_STREAMING, "Set Streaming" },
561         { GPCMD_READ_CD_MSF, "Read CD MSF" },
562         { GPCMD_SCAN, "Scan" },
563         { GPCMD_SET_SPEED, "Set Speed" },
564         { GPCMD_PLAY_CD, "Play CD" },
565         { GPCMD_MECHANISM_STATUS, "Mechanism Status" },
566         { GPCMD_READ_CD, "Read CD" },
567 };
568
569
570
571 /* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
572 static const char * const sense_key_texts[16] = {
573         "No sense data",
574         "Recovered error",
575         "Not ready",
576         "Medium error",
577         "Hardware error",
578         "Illegal request",
579         "Unit attention",
580         "Data protect",
581         "Blank check",
582         "(reserved)",
583         "(reserved)",
584         "Aborted command",
585         "(reserved)",
586         "(reserved)",
587         "Miscompare",
588         "(reserved)",
589 };
590
591 /* From Table 304 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
592 static const struct {
593         unsigned long asc_ascq;
594         const char * const text;
595 } sense_data_texts[] = {
596         { 0x000000, "No additional sense information" },
597         { 0x000011, "Play operation in progress" },
598         { 0x000012, "Play operation paused" },
599         { 0x000013, "Play operation successfully completed" },
600         { 0x000014, "Play operation stopped due to error" },
601         { 0x000015, "No current audio status to return" },
602         { 0x010c0a, "Write error - padding blocks added" },
603         { 0x011700, "Recovered data with no error correction applied" },
604         { 0x011701, "Recovered data with retries" },
605         { 0x011702, "Recovered data with positive head offset" },
606         { 0x011703, "Recovered data with negative head offset" },
607         { 0x011704, "Recovered data with retries and/or CIRC applied" },
608         { 0x011705, "Recovered data using previous sector ID" },
609         { 0x011800, "Recovered data with error correction applied" },
610         { 0x011801, "Recovered data with error correction and retries applied"},
611         { 0x011802, "Recovered data - the data was auto-reallocated" },
612         { 0x011803, "Recovered data with CIRC" },
613         { 0x011804, "Recovered data with L-EC" },
614         { 0x015d00, 
615             "Failure prediction threshold exceeded - Predicted logical unit failure" },
616         { 0x015d01, 
617             "Failure prediction threshold exceeded - Predicted media failure" },
618         { 0x015dff, "Failure prediction threshold exceeded - False" },
619         { 0x017301, "Power calibration area almost full" },
620         { 0x020400, "Logical unit not ready - cause not reportable" },
621         /* Following is misspelled in ATAPI 2.6, _and_ in Mt. Fuji */
622         { 0x020401,
623           "Logical unit not ready - in progress [sic] of becoming ready" },
624         { 0x020402, "Logical unit not ready - initializing command required" },
625         { 0x020403, "Logical unit not ready - manual intervention required" },
626         { 0x020404, "Logical unit not ready - format in progress" },
627         { 0x020407, "Logical unit not ready - operation in progress" },
628         { 0x020408, "Logical unit not ready - long write in progress" },
629         { 0x020600, "No reference position found (media may be upside down)" },
630         { 0x023000, "Incompatible medium installed" },
631         { 0x023a00, "Medium not present" },
632         { 0x025300, "Media load or eject failed" },
633         { 0x025700, "Unable to recover table of contents" },
634         { 0x030300, "Peripheral device write fault" },
635         { 0x030301, "No write current" },
636         { 0x030302, "Excessive write errors" },
637         { 0x030c00, "Write error" },
638         { 0x030c01, "Write error - Recovered with auto reallocation" },
639         { 0x030c02, "Write error - auto reallocation failed" },
640         { 0x030c03, "Write error - recommend reassignment" },
641         { 0x030c04, "Compression check miscompare error" },
642         { 0x030c05, "Data expansion occurred during compress" },
643         { 0x030c06, "Block not compressible" },
644         { 0x030c07, "Write error - recovery needed" },
645         { 0x030c08, "Write error - recovery failed" },
646         { 0x030c09, "Write error - loss of streaming" },
647         { 0x031100, "Unrecovered read error" },
648         { 0x031106, "CIRC unrecovered error" },
649         { 0x033101, "Format command failed" },
650         { 0x033200, "No defect spare location available" },
651         { 0x033201, "Defect list update failure" },
652         { 0x035100, "Erase failure" },
653         { 0x037200, "Session fixation error" },
654         { 0x037201, "Session fixation error writin lead-in" },
655         { 0x037202, "Session fixation error writin lead-out" },
656         { 0x037300, "CD control error" },
657         { 0x037302, "Power calibration area is full" },
658         { 0x037303, "Power calibration area error" },
659         { 0x037304, "Program memory area / RMA update failure" },
660         { 0x037305, "Program memory area / RMA is full" },
661         { 0x037306, "Program memory area / RMA is (almost) full" },
662
663         { 0x040200, "No seek complete" },
664         { 0x040300, "Write fault" },
665         { 0x040900, "Track following error" },
666         { 0x040901, "Tracking servo failure" },
667         { 0x040902, "Focus servo failure" },
668         { 0x040903, "Spindle servo failure" },
669         { 0x041500, "Random positioning error" },
670         { 0x041501, "Mechanical positioning or changer error" },
671         { 0x041502, "Positioning error detected by read of medium" },
672         { 0x043c00, "Mechanical positioning or changer error" },
673         { 0x044000, "Diagnostic failure on component (ASCQ)" },
674         { 0x044400, "Internal CD/DVD logical unit failure" },
675         { 0x04b600, "Media load mechanism failed" },
676         { 0x051a00, "Parameter list length error" },
677         { 0x052000, "Invalid command operation code" },
678         { 0x052100, "Logical block address out of range" },
679         { 0x052102, "Invalid address for write" },
680         { 0x052400, "Invalid field in command packet" },
681         { 0x052600, "Invalid field in parameter list" },
682         { 0x052601, "Parameter not supported" },
683         { 0x052602, "Parameter value invalid" },
684         { 0x052700, "Write protected media" },
685         { 0x052c00, "Command sequence error" },
686         { 0x052c03, "Current program area is not empty" },
687         { 0x052c04, "Current program area is empty" },
688         { 0x053001, "Cannot read medium - unknown format" },
689         { 0x053002, "Cannot read medium - incompatible format" },
690         { 0x053900, "Saving parameters not supported" },
691         { 0x054e00, "Overlapped commands attempted" },
692         { 0x055302, "Medium removal prevented" },
693         { 0x055500, "System resource failure" },
694         { 0x056300, "End of user area encountered on this track" },
695         { 0x056400, "Illegal mode for this track or incompatible medium" },
696         { 0x056f00, "Copy protection key exchange failure - Authentication failure" },
697         { 0x056f01, "Copy protection key exchange failure - Key not present" },
698         { 0x056f02, "Copy protection key exchange failure - Key not established" },
699         { 0x056f03, "Read of scrambled sector without authentication" },
700         { 0x056f04, "Media region code is mismatched to logical unit" },
701         { 0x056f05,  "Drive region must be permanent / region reset count error" },
702         { 0x057203, "Session fixation error - incomplete track in session" },
703         { 0x057204, "Empty or partially written reserved track" },
704         { 0x057205, "No more RZONE reservations are allowed" },
705         { 0x05bf00, "Loss of streaming" },
706         { 0x062800, "Not ready to ready transition, medium may have changed" },
707         { 0x062900, "Power on, reset or hardware reset occurred" },
708         { 0x062a00, "Parameters changed" },
709         { 0x062a01, "Mode parameters changed" },
710         { 0x062e00, "Insufficient time for operation" },
711         { 0x063f00, "Logical unit operating conditions have changed" },
712         { 0x063f01, "Microcode has been changed" },
713         { 0x065a00, "Operator request or state change input (unspecified)" },
714         { 0x065a01, "Operator medium removal request" },
715         { 0x0bb900, "Play operation aborted" },
716
717         /* Here we use 0xff for the key (not a valid key) to signify
718          * that these can have _any_ key value associated with them... */
719         { 0xff0401, "Logical unit is in process of becoming ready" },
720         { 0xff0400, "Logical unit not ready, cause not reportable" },
721         { 0xff0402, "Logical unit not ready, initializing command required" },
722         { 0xff0403, "Logical unit not ready, manual intervention required" },
723         { 0xff0500, "Logical unit does not respond to selection" },
724         { 0xff0800, "Logical unit communication failure" },
725         { 0xff0802, "Logical unit communication parity error" },
726         { 0xff0801, "Logical unit communication time-out" },
727         { 0xff2500, "Logical unit not supported" },
728         { 0xff4c00, "Logical unit failed self-configuration" },
729         { 0xff3e00, "Logical unit has not self-configured yet" },
730 };
731 #endif
732
733
734 #endif /* _IDE_CD_H */