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