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