diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:23 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:23 -0500 |
commit | 972560fb9d9ea7bc7082c0c79c99c24e3f56606c (patch) | |
tree | c7ca8212cc0dc85e22e04d9faf8744972fc62a93 | |
parent | 89d13ec7c8b85f3c62a4a12034e65d3d2d3273a8 (diff) |
ide-cd: move VERBOSE_IDE_CD_ERRORS code to ide-cd_verbose.c
* Rename ide-cd kernel module to ide-cd_mod in preparation to moving code out
from ide-cd.[c,h]. Add MODULE_ALIAS("ide-cd") to preserve compatibility.
* Move VERBOSE_IDE_CD_ERRORS code from ide-cd.[c,h] to ide-cd_verbose.c.
ide-cd_verbose.c is IDE subsystem independent and may be easily converted
into generic library usable by other drivers (i.e. libata) if needed.
* Add CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS config option to drivers/ide/Kconfig
replacing VERBOSE_IDE_CD_ERRORS define. Make this config option enabled by
default and visible only if CONFIG_EMBEDDED is defined.
before the patch:
text data bss dec hex filename
22841 360 1056 24257 5ec1 drivers/ide/ide-cd.o
after the patch w/ CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y:
text data bss dec hex filename
22857 360 1056 24273 5ed1 drivers/ide/ide-cd_mod.o
after the patch w/ CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=n:
text data bss dec hex filename
15091 360 1056 16507 407b drivers/ide/ide-cd_mod.o
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/Kconfig | 9 | ||||
-rw-r--r-- | drivers/ide/Makefile | 4 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 124 | ||||
-rw-r--r-- | drivers/ide/ide-cd.h | 237 | ||||
-rw-r--r-- | drivers/ide/ide-cd_verbose.c | 359 |
5 files changed, 375 insertions, 358 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 92b01170d8f3..e42a465f5717 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -206,6 +206,15 @@ config BLK_DEV_IDECD | |||
206 | To compile this driver as a module, choose M here: the | 206 | To compile this driver as a module, choose M here: the |
207 | module will be called ide-cd. | 207 | module will be called ide-cd. |
208 | 208 | ||
209 | config BLK_DEV_IDECD_VERBOSE_ERRORS | ||
210 | bool "Verbose error logging for IDE/ATAPI CDROM driver" if EMBEDDED | ||
211 | depends on BLK_DEV_IDECD | ||
212 | default y | ||
213 | help | ||
214 | Turn this on to have the driver print out the meanings of the | ||
215 | ATAPI error codes. This will use up additional 8kB of kernel-space | ||
216 | memory, though. | ||
217 | |||
209 | config BLK_DEV_IDETAPE | 218 | config BLK_DEV_IDETAPE |
210 | tristate "Include IDE/ATAPI TAPE support (EXPERIMENTAL)" | 219 | tristate "Include IDE/ATAPI TAPE support (EXPERIMENTAL)" |
211 | depends on EXPERIMENTAL | 220 | depends on EXPERIMENTAL |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 0d2da89d15cf..5ce1d8f17c06 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -40,8 +40,10 @@ obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o | |||
40 | obj-$(CONFIG_IDE_H8300) += h8300/ | 40 | obj-$(CONFIG_IDE_H8300) += h8300/ |
41 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o | 41 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o |
42 | 42 | ||
43 | ide-cd_mod-y += ide-cd.o ide-cd_verbose.o | ||
44 | |||
43 | obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o | 45 | obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o |
44 | obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o | 46 | obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd_mod.o |
45 | obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o | 47 | obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o |
46 | obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o | 48 | obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o |
47 | 49 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 02488b48fa7a..f4a0264bea6d 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -199,129 +199,8 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
202 | #if VERBOSE_IDE_CD_ERRORS | ||
203 | { | ||
204 | int i; | ||
205 | const char *s = "bad sense key!"; | ||
206 | char buf[80]; | ||
207 | |||
208 | printk(KERN_ERR "ATAPI device %s:\n", drive->name); | ||
209 | if (sense->error_code == 0x70) | ||
210 | printk(KERN_CONT " Error: "); | ||
211 | else if (sense->error_code == 0x71) | ||
212 | printk(" Deferred Error: "); | ||
213 | else if (sense->error_code == 0x7f) | ||
214 | printk(KERN_CONT " Vendor-specific Error: "); | ||
215 | else | ||
216 | printk(KERN_CONT " Unknown Error Type: "); | ||
217 | |||
218 | if (sense->sense_key < ARRAY_SIZE(sense_key_texts)) | ||
219 | s = sense_key_texts[sense->sense_key]; | ||
220 | |||
221 | printk(KERN_CONT "%s -- (Sense key=0x%02x)\n", | ||
222 | s, sense->sense_key); | ||
223 | |||
224 | if (sense->asc == 0x40) { | ||
225 | sprintf(buf, "Diagnostic failure on component 0x%02x", | ||
226 | sense->ascq); | ||
227 | s = buf; | ||
228 | } else { | ||
229 | int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts); | ||
230 | unsigned long key = (sense->sense_key << 16); | ||
231 | |||
232 | key |= (sense->asc << 8); | ||
233 | if (!(sense->ascq >= 0x80 && sense->ascq <= 0xdd)) | ||
234 | key |= sense->ascq; | ||
235 | s = NULL; | ||
236 | |||
237 | while (hi > lo) { | ||
238 | mid = (lo + hi) / 2; | ||
239 | if (sense_data_texts[mid].asc_ascq == key || | ||
240 | sense_data_texts[mid].asc_ascq == (0xff0000|key)) { | ||
241 | s = sense_data_texts[mid].text; | ||
242 | break; | ||
243 | } else if (sense_data_texts[mid].asc_ascq > key) | ||
244 | hi = mid; | ||
245 | else | ||
246 | lo = mid + 1; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | if (s == NULL) { | ||
251 | if (sense->asc > 0x80) | ||
252 | s = "(vendor-specific error)"; | ||
253 | else | ||
254 | s = "(reserved error code)"; | ||
255 | } | ||
256 | |||
257 | printk(KERN_ERR " %s -- (asc=0x%02x, ascq=0x%02x)\n", | ||
258 | s, sense->asc, sense->ascq); | ||
259 | |||
260 | if (failed_command != NULL) { | ||
261 | int lo = 0, mid, hi = ARRAY_SIZE(packet_command_texts); | ||
262 | s = NULL; | ||
263 | |||
264 | while (hi > lo) { | ||
265 | mid = (lo + hi) / 2; | ||
266 | if (packet_command_texts[mid].packet_command == | ||
267 | failed_command->cmd[0]) { | ||
268 | s = packet_command_texts[mid].text; | ||
269 | break; | ||
270 | } | ||
271 | if (packet_command_texts[mid].packet_command > | ||
272 | failed_command->cmd[0]) | ||
273 | hi = mid; | ||
274 | else | ||
275 | lo = mid + 1; | ||
276 | } | ||
277 | |||
278 | printk(KERN_ERR " The failed \"%s\" packet command " | ||
279 | "was: \n \"", s); | ||
280 | for (i = 0; i < sizeof(failed_command->cmd); i++) | ||
281 | printk(KERN_CONT "%02x ", | ||
282 | failed_command->cmd[i]); | ||
283 | printk(KERN_CONT "\"\n"); | ||
284 | } | ||
285 | |||
286 | /* The SKSV bit specifies validity of the sense_key_specific | ||
287 | * in the next two commands. It is bit 7 of the first byte. | ||
288 | * In the case of NOT_READY, if SKSV is set the drive can | ||
289 | * give us nice ETA readings. | ||
290 | */ | ||
291 | if (sense->sense_key == NOT_READY && (sense->sks[0] & 0x80)) { | ||
292 | int progress = (sense->sks[1] << 8 | sense->sks[2]) * 100; | ||
293 | |||
294 | printk(KERN_ERR " Command is %02d%% complete\n", | ||
295 | progress / 0xffff); | ||
296 | } | ||
297 | |||
298 | if (sense->sense_key == ILLEGAL_REQUEST && | ||
299 | (sense->sks[0] & 0x80) != 0) { | ||
300 | printk(KERN_ERR " Error in %s byte %d", | ||
301 | (sense->sks[0] & 0x40) != 0 ? | ||
302 | "command packet" : "command data", | ||
303 | (sense->sks[1] << 8) + sense->sks[2]); | ||
304 | |||
305 | if ((sense->sks[0] & 0x40) != 0) | ||
306 | printk(KERN_CONT " bit %d", | ||
307 | sense->sks[0] & 0x07); | ||
308 | |||
309 | printk(KERN_CONT "\n"); | ||
310 | } | ||
311 | } | ||
312 | #else /* not VERBOSE_IDE_CD_ERRORS */ | ||
313 | /* Suppress printing unit attention and `in progress of becoming ready' | ||
314 | errors when we're not being verbose. */ | ||
315 | if (sense->sense_key == UNIT_ATTENTION || | ||
316 | (sense->sense_key == NOT_READY && (sense->asc == 4 || | ||
317 | sense->asc == 0x3a))) | ||
318 | return; | ||
319 | 202 | ||
320 | printk(KERN_ERR "%s: error code: 0x%02x sense_key: 0x%02x " | 203 | ide_cd_log_error(drive->name, failed_command, sense); |
321 | "asc: 0x%02x ascq: 0x%02x\n", | ||
322 | drive->name, sense->error_code, sense->sense_key, | ||
323 | sense->asc, sense->ascq); | ||
324 | #endif /* not VERBOSE_IDE_CD_ERRORS */ | ||
325 | } | 204 | } |
326 | 205 | ||
327 | /* | 206 | /* |
@@ -3189,6 +3068,7 @@ static int __init ide_cdrom_init(void) | |||
3189 | } | 3068 | } |
3190 | 3069 | ||
3191 | MODULE_ALIAS("ide:*m-cdrom*"); | 3070 | MODULE_ALIAS("ide:*m-cdrom*"); |
3071 | MODULE_ALIAS("ide-cd"); | ||
3192 | module_init(ide_cdrom_init); | 3072 | module_init(ide_cdrom_init); |
3193 | module_exit(ide_cdrom_exit); | 3073 | module_exit(ide_cdrom_exit); |
3194 | MODULE_LICENSE("GPL"); | 3074 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 3a43178ab121..e1b401494a99 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -10,14 +10,6 @@ | |||
10 | #include <linux/cdrom.h> | 10 | #include <linux/cdrom.h> |
11 | #include <asm/byteorder.h> | 11 | #include <asm/byteorder.h> |
12 | 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 | /* | 13 | /* |
22 | * typical timeout for packet command | 14 | * typical timeout for packet command |
23 | */ | 15 | */ |
@@ -153,232 +145,7 @@ struct cdrom_info { | |||
153 | unsigned long write_timeout; | 145 | unsigned long write_timeout; |
154 | }; | 146 | }; |
155 | 147 | ||
156 | /**************************************************************************** | 148 | /* ide-cd_verbose.c */ |
157 | * Descriptions of ATAPI error codes. | 149 | void ide_cd_log_error(const char *, struct request *, struct request_sense *); |
158 | */ | ||
159 | |||
160 | /* This stuff should be in cdrom.h, since it is now generic... */ | ||
161 | #if VERBOSE_IDE_CD_ERRORS | ||
162 | /* The generic packet command opcodes for CD/DVD Logical Units, | ||
163 | * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | ||
164 | static const struct { | ||
165 | unsigned short packet_command; | ||
166 | const char * const text; | ||
167 | } packet_command_texts[] = { | ||
168 | { GPCMD_TEST_UNIT_READY, "Test Unit Ready" }, | ||
169 | { GPCMD_REQUEST_SENSE, "Request Sense" }, | ||
170 | { GPCMD_FORMAT_UNIT, "Format Unit" }, | ||
171 | { GPCMD_INQUIRY, "Inquiry" }, | ||
172 | { GPCMD_START_STOP_UNIT, "Start/Stop Unit" }, | ||
173 | { GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, "Prevent/Allow Medium Removal" }, | ||
174 | { GPCMD_READ_FORMAT_CAPACITIES, "Read Format Capacities" }, | ||
175 | { GPCMD_READ_CDVD_CAPACITY, "Read Cd/Dvd Capacity" }, | ||
176 | { GPCMD_READ_10, "Read 10" }, | ||
177 | { GPCMD_WRITE_10, "Write 10" }, | ||
178 | { GPCMD_SEEK, "Seek" }, | ||
179 | { GPCMD_WRITE_AND_VERIFY_10, "Write and Verify 10" }, | ||
180 | { GPCMD_VERIFY_10, "Verify 10" }, | ||
181 | { GPCMD_FLUSH_CACHE, "Flush Cache" }, | ||
182 | { GPCMD_READ_SUBCHANNEL, "Read Subchannel" }, | ||
183 | { GPCMD_READ_TOC_PMA_ATIP, "Read Table of Contents" }, | ||
184 | { GPCMD_READ_HEADER, "Read Header" }, | ||
185 | { GPCMD_PLAY_AUDIO_10, "Play Audio 10" }, | ||
186 | { GPCMD_GET_CONFIGURATION, "Get Configuration" }, | ||
187 | { GPCMD_PLAY_AUDIO_MSF, "Play Audio MSF" }, | ||
188 | { GPCMD_PLAYAUDIO_TI, "Play Audio TrackIndex" }, | ||
189 | { GPCMD_GET_EVENT_STATUS_NOTIFICATION, | ||
190 | "Get Event Status Notification" }, | ||
191 | { GPCMD_PAUSE_RESUME, "Pause/Resume" }, | ||
192 | { GPCMD_STOP_PLAY_SCAN, "Stop Play/Scan" }, | ||
193 | { GPCMD_READ_DISC_INFO, "Read Disc Info" }, | ||
194 | { GPCMD_READ_TRACK_RZONE_INFO, "Read Track Rzone Info" }, | ||
195 | { GPCMD_RESERVE_RZONE_TRACK, "Reserve Rzone Track" }, | ||
196 | { GPCMD_SEND_OPC, "Send OPC" }, | ||
197 | { GPCMD_MODE_SELECT_10, "Mode Select 10" }, | ||
198 | { GPCMD_REPAIR_RZONE_TRACK, "Repair Rzone Track" }, | ||
199 | { GPCMD_MODE_SENSE_10, "Mode Sense 10" }, | ||
200 | { GPCMD_CLOSE_TRACK, "Close Track" }, | ||
201 | { GPCMD_BLANK, "Blank" }, | ||
202 | { GPCMD_SEND_EVENT, "Send Event" }, | ||
203 | { GPCMD_SEND_KEY, "Send Key" }, | ||
204 | { GPCMD_REPORT_KEY, "Report Key" }, | ||
205 | { GPCMD_LOAD_UNLOAD, "Load/Unload" }, | ||
206 | { GPCMD_SET_READ_AHEAD, "Set Read-ahead" }, | ||
207 | { GPCMD_READ_12, "Read 12" }, | ||
208 | { GPCMD_GET_PERFORMANCE, "Get Performance" }, | ||
209 | { GPCMD_SEND_DVD_STRUCTURE, "Send DVD Structure" }, | ||
210 | { GPCMD_READ_DVD_STRUCTURE, "Read DVD Structure" }, | ||
211 | { GPCMD_SET_STREAMING, "Set Streaming" }, | ||
212 | { GPCMD_READ_CD_MSF, "Read CD MSF" }, | ||
213 | { GPCMD_SCAN, "Scan" }, | ||
214 | { GPCMD_SET_SPEED, "Set Speed" }, | ||
215 | { GPCMD_PLAY_CD, "Play CD" }, | ||
216 | { GPCMD_MECHANISM_STATUS, "Mechanism Status" }, | ||
217 | { GPCMD_READ_CD, "Read CD" }, | ||
218 | }; | ||
219 | |||
220 | /* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | ||
221 | static const char * const sense_key_texts[16] = { | ||
222 | "No sense data", | ||
223 | "Recovered error", | ||
224 | "Not ready", | ||
225 | "Medium error", | ||
226 | "Hardware error", | ||
227 | "Illegal request", | ||
228 | "Unit attention", | ||
229 | "Data protect", | ||
230 | "Blank check", | ||
231 | "(reserved)", | ||
232 | "(reserved)", | ||
233 | "Aborted command", | ||
234 | "(reserved)", | ||
235 | "(reserved)", | ||
236 | "Miscompare", | ||
237 | "(reserved)", | ||
238 | }; | ||
239 | |||
240 | /* From Table 304 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | ||
241 | static const struct { | ||
242 | unsigned long asc_ascq; | ||
243 | const char * const text; | ||
244 | } sense_data_texts[] = { | ||
245 | { 0x000000, "No additional sense information" }, | ||
246 | { 0x000011, "Play operation in progress" }, | ||
247 | { 0x000012, "Play operation paused" }, | ||
248 | { 0x000013, "Play operation successfully completed" }, | ||
249 | { 0x000014, "Play operation stopped due to error" }, | ||
250 | { 0x000015, "No current audio status to return" }, | ||
251 | { 0x010c0a, "Write error - padding blocks added" }, | ||
252 | { 0x011700, "Recovered data with no error correction applied" }, | ||
253 | { 0x011701, "Recovered data with retries" }, | ||
254 | { 0x011702, "Recovered data with positive head offset" }, | ||
255 | { 0x011703, "Recovered data with negative head offset" }, | ||
256 | { 0x011704, "Recovered data with retries and/or CIRC applied" }, | ||
257 | { 0x011705, "Recovered data using previous sector ID" }, | ||
258 | { 0x011800, "Recovered data with error correction applied" }, | ||
259 | { 0x011801, "Recovered data with error correction and retries applied"}, | ||
260 | { 0x011802, "Recovered data - the data was auto-reallocated" }, | ||
261 | { 0x011803, "Recovered data with CIRC" }, | ||
262 | { 0x011804, "Recovered data with L-EC" }, | ||
263 | { 0x015d00, "Failure prediction threshold exceeded" | ||
264 | " - Predicted logical unit failure" }, | ||
265 | { 0x015d01, "Failure prediction threshold exceeded" | ||
266 | " - Predicted media failure" }, | ||
267 | { 0x015dff, "Failure prediction threshold exceeded - False" }, | ||
268 | { 0x017301, "Power calibration area almost full" }, | ||
269 | { 0x020400, "Logical unit not ready - cause not reportable" }, | ||
270 | /* Following is misspelled in ATAPI 2.6, _and_ in Mt. Fuji */ | ||
271 | { 0x020401, "Logical unit not ready" | ||
272 | " - in progress [sic] of becoming ready" }, | ||
273 | { 0x020402, "Logical unit not ready - initializing command required" }, | ||
274 | { 0x020403, "Logical unit not ready - manual intervention required" }, | ||
275 | { 0x020404, "Logical unit not ready - format in progress" }, | ||
276 | { 0x020407, "Logical unit not ready - operation in progress" }, | ||
277 | { 0x020408, "Logical unit not ready - long write in progress" }, | ||
278 | { 0x020600, "No reference position found (media may be upside down)" }, | ||
279 | { 0x023000, "Incompatible medium installed" }, | ||
280 | { 0x023a00, "Medium not present" }, | ||
281 | { 0x025300, "Media load or eject failed" }, | ||
282 | { 0x025700, "Unable to recover table of contents" }, | ||
283 | { 0x030300, "Peripheral device write fault" }, | ||
284 | { 0x030301, "No write current" }, | ||
285 | { 0x030302, "Excessive write errors" }, | ||
286 | { 0x030c00, "Write error" }, | ||
287 | { 0x030c01, "Write error - Recovered with auto reallocation" }, | ||
288 | { 0x030c02, "Write error - auto reallocation failed" }, | ||
289 | { 0x030c03, "Write error - recommend reassignment" }, | ||
290 | { 0x030c04, "Compression check miscompare error" }, | ||
291 | { 0x030c05, "Data expansion occurred during compress" }, | ||
292 | { 0x030c06, "Block not compressible" }, | ||
293 | { 0x030c07, "Write error - recovery needed" }, | ||
294 | { 0x030c08, "Write error - recovery failed" }, | ||
295 | { 0x030c09, "Write error - loss of streaming" }, | ||
296 | { 0x031100, "Unrecovered read error" }, | ||
297 | { 0x031106, "CIRC unrecovered error" }, | ||
298 | { 0x033101, "Format command failed" }, | ||
299 | { 0x033200, "No defect spare location available" }, | ||
300 | { 0x033201, "Defect list update failure" }, | ||
301 | { 0x035100, "Erase failure" }, | ||
302 | { 0x037200, "Session fixation error" }, | ||
303 | { 0x037201, "Session fixation error writin lead-in" }, | ||
304 | { 0x037202, "Session fixation error writin lead-out" }, | ||
305 | { 0x037300, "CD control error" }, | ||
306 | { 0x037302, "Power calibration area is full" }, | ||
307 | { 0x037303, "Power calibration area error" }, | ||
308 | { 0x037304, "Program memory area / RMA update failure" }, | ||
309 | { 0x037305, "Program memory area / RMA is full" }, | ||
310 | { 0x037306, "Program memory area / RMA is (almost) full" }, | ||
311 | { 0x040200, "No seek complete" }, | ||
312 | { 0x040300, "Write fault" }, | ||
313 | { 0x040900, "Track following error" }, | ||
314 | { 0x040901, "Tracking servo failure" }, | ||
315 | { 0x040902, "Focus servo failure" }, | ||
316 | { 0x040903, "Spindle servo failure" }, | ||
317 | { 0x041500, "Random positioning error" }, | ||
318 | { 0x041501, "Mechanical positioning or changer error" }, | ||
319 | { 0x041502, "Positioning error detected by read of medium" }, | ||
320 | { 0x043c00, "Mechanical positioning or changer error" }, | ||
321 | { 0x044000, "Diagnostic failure on component (ASCQ)" }, | ||
322 | { 0x044400, "Internal CD/DVD logical unit failure" }, | ||
323 | { 0x04b600, "Media load mechanism failed" }, | ||
324 | { 0x051a00, "Parameter list length error" }, | ||
325 | { 0x052000, "Invalid command operation code" }, | ||
326 | { 0x052100, "Logical block address out of range" }, | ||
327 | { 0x052102, "Invalid address for write" }, | ||
328 | { 0x052400, "Invalid field in command packet" }, | ||
329 | { 0x052600, "Invalid field in parameter list" }, | ||
330 | { 0x052601, "Parameter not supported" }, | ||
331 | { 0x052602, "Parameter value invalid" }, | ||
332 | { 0x052700, "Write protected media" }, | ||
333 | { 0x052c00, "Command sequence error" }, | ||
334 | { 0x052c03, "Current program area is not empty" }, | ||
335 | { 0x052c04, "Current program area is empty" }, | ||
336 | { 0x053001, "Cannot read medium - unknown format" }, | ||
337 | { 0x053002, "Cannot read medium - incompatible format" }, | ||
338 | { 0x053900, "Saving parameters not supported" }, | ||
339 | { 0x054e00, "Overlapped commands attempted" }, | ||
340 | { 0x055302, "Medium removal prevented" }, | ||
341 | { 0x055500, "System resource failure" }, | ||
342 | { 0x056300, "End of user area encountered on this track" }, | ||
343 | { 0x056400, "Illegal mode for this track or incompatible medium" }, | ||
344 | { 0x056f00, "Copy protection key exchange failure" | ||
345 | " - Authentication failure" }, | ||
346 | { 0x056f01, "Copy protection key exchange failure - Key not present" }, | ||
347 | { 0x056f02, "Copy protection key exchange failure" | ||
348 | " - Key not established" }, | ||
349 | { 0x056f03, "Read of scrambled sector without authentication" }, | ||
350 | { 0x056f04, "Media region code is mismatched to logical unit" }, | ||
351 | { 0x056f05, "Drive region must be permanent" | ||
352 | " / region reset count error" }, | ||
353 | { 0x057203, "Session fixation error - incomplete track in session" }, | ||
354 | { 0x057204, "Empty or partially written reserved track" }, | ||
355 | { 0x057205, "No more RZONE reservations are allowed" }, | ||
356 | { 0x05bf00, "Loss of streaming" }, | ||
357 | { 0x062800, "Not ready to ready transition, medium may have changed" }, | ||
358 | { 0x062900, "Power on, reset or hardware reset occurred" }, | ||
359 | { 0x062a00, "Parameters changed" }, | ||
360 | { 0x062a01, "Mode parameters changed" }, | ||
361 | { 0x062e00, "Insufficient time for operation" }, | ||
362 | { 0x063f00, "Logical unit operating conditions have changed" }, | ||
363 | { 0x063f01, "Microcode has been changed" }, | ||
364 | { 0x065a00, "Operator request or state change input (unspecified)" }, | ||
365 | { 0x065a01, "Operator medium removal request" }, | ||
366 | { 0x0bb900, "Play operation aborted" }, | ||
367 | /* Here we use 0xff for the key (not a valid key) to signify | ||
368 | * that these can have _any_ key value associated with them... */ | ||
369 | { 0xff0401, "Logical unit is in process of becoming ready" }, | ||
370 | { 0xff0400, "Logical unit not ready, cause not reportable" }, | ||
371 | { 0xff0402, "Logical unit not ready, initializing command required" }, | ||
372 | { 0xff0403, "Logical unit not ready, manual intervention required" }, | ||
373 | { 0xff0500, "Logical unit does not respond to selection" }, | ||
374 | { 0xff0800, "Logical unit communication failure" }, | ||
375 | { 0xff0802, "Logical unit communication parity error" }, | ||
376 | { 0xff0801, "Logical unit communication time-out" }, | ||
377 | { 0xff2500, "Logical unit not supported" }, | ||
378 | { 0xff4c00, "Logical unit failed self-configuration" }, | ||
379 | { 0xff3e00, "Logical unit has not self-configured yet" }, | ||
380 | }; | ||
381 | #endif | ||
382 | |||
383 | 150 | ||
384 | #endif /* _IDE_CD_H */ | 151 | #endif /* _IDE_CD_H */ |
diff --git a/drivers/ide/ide-cd_verbose.c b/drivers/ide/ide-cd_verbose.c new file mode 100644 index 000000000000..6ed7ca071331 --- /dev/null +++ b/drivers/ide/ide-cd_verbose.c | |||
@@ -0,0 +1,359 @@ | |||
1 | /* | ||
2 | * Verbose error logging for ATAPI CD/DVD devices. | ||
3 | * | ||
4 | * Copyright (C) 1994-1996 Scott Snyder <snyder@fnald0.fnal.gov> | ||
5 | * Copyright (C) 1996-1998 Erik Andersen <andersee@debian.org> | ||
6 | * Copyright (C) 1998-2000 Jens Axboe <axboe@suse.de> | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/blkdev.h> | ||
11 | #include <linux/cdrom.h> | ||
12 | #include <scsi/scsi.h> | ||
13 | |||
14 | #ifndef CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS | ||
15 | void ide_cd_log_error(const char *name, struct request *failed_command, | ||
16 | struct request_sense *sense) | ||
17 | { | ||
18 | /* Suppress printing unit attention and `in progress of becoming ready' | ||
19 | errors when we're not being verbose. */ | ||
20 | if (sense->sense_key == UNIT_ATTENTION || | ||
21 | (sense->sense_key == NOT_READY && (sense->asc == 4 || | ||
22 | sense->asc == 0x3a))) | ||
23 | return; | ||
24 | |||
25 | printk(KERN_ERR "%s: error code: 0x%02x sense_key: 0x%02x " | ||
26 | "asc: 0x%02x ascq: 0x%02x\n", | ||
27 | name, sense->error_code, sense->sense_key, | ||
28 | sense->asc, sense->ascq); | ||
29 | } | ||
30 | #else | ||
31 | /* The generic packet command opcodes for CD/DVD Logical Units, | ||
32 | * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | ||
33 | static const struct { | ||
34 | unsigned short packet_command; | ||
35 | const char * const text; | ||
36 | } packet_command_texts[] = { | ||
37 | { GPCMD_TEST_UNIT_READY, "Test Unit Ready" }, | ||
38 | { GPCMD_REQUEST_SENSE, "Request Sense" }, | ||
39 | { GPCMD_FORMAT_UNIT, "Format Unit" }, | ||
40 | { GPCMD_INQUIRY, "Inquiry" }, | ||
41 | { GPCMD_START_STOP_UNIT, "Start/Stop Unit" }, | ||
42 | { GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, "Prevent/Allow Medium Removal" }, | ||
43 | { GPCMD_READ_FORMAT_CAPACITIES, "Read Format Capacities" }, | ||
44 | { GPCMD_READ_CDVD_CAPACITY, "Read Cd/Dvd Capacity" }, | ||
45 | { GPCMD_READ_10, "Read 10" }, | ||
46 | { GPCMD_WRITE_10, "Write 10" }, | ||
47 | { GPCMD_SEEK, "Seek" }, | ||
48 | { GPCMD_WRITE_AND_VERIFY_10, "Write and Verify 10" }, | ||
49 | { GPCMD_VERIFY_10, "Verify 10" }, | ||
50 | { GPCMD_FLUSH_CACHE, "Flush Cache" }, | ||
51 | { GPCMD_READ_SUBCHANNEL, "Read Subchannel" }, | ||
52 | { GPCMD_READ_TOC_PMA_ATIP, "Read Table of Contents" }, | ||
53 | { GPCMD_READ_HEADER, "Read Header" }, | ||
54 | { GPCMD_PLAY_AUDIO_10, "Play Audio 10" }, | ||
55 | { GPCMD_GET_CONFIGURATION, "Get Configuration" }, | ||
56 | { GPCMD_PLAY_AUDIO_MSF, "Play Audio MSF" }, | ||
57 | { GPCMD_PLAYAUDIO_TI, "Play Audio TrackIndex" }, | ||
58 | { GPCMD_GET_EVENT_STATUS_NOTIFICATION, | ||
59 | "Get Event Status Notification" }, | ||
60 | { GPCMD_PAUSE_RESUME, "Pause/Resume" }, | ||
61 | { GPCMD_STOP_PLAY_SCAN, "Stop Play/Scan" }, | ||
62 | { GPCMD_READ_DISC_INFO, "Read Disc Info" }, | ||
63 | { GPCMD_READ_TRACK_RZONE_INFO, "Read Track Rzone Info" }, | ||
64 | { GPCMD_RESERVE_RZONE_TRACK, "Reserve Rzone Track" }, | ||
65 | { GPCMD_SEND_OPC, "Send OPC" }, | ||
66 | { GPCMD_MODE_SELECT_10, "Mode Select 10" }, | ||
67 | { GPCMD_REPAIR_RZONE_TRACK, "Repair Rzone Track" }, | ||
68 | { GPCMD_MODE_SENSE_10, "Mode Sense 10" }, | ||
69 | { GPCMD_CLOSE_TRACK, "Close Track" }, | ||
70 | { GPCMD_BLANK, "Blank" }, | ||
71 | { GPCMD_SEND_EVENT, "Send Event" }, | ||
72 | { GPCMD_SEND_KEY, "Send Key" }, | ||
73 | { GPCMD_REPORT_KEY, "Report Key" }, | ||
74 | { GPCMD_LOAD_UNLOAD, "Load/Unload" }, | ||
75 | { GPCMD_SET_READ_AHEAD, "Set Read-ahead" }, | ||
76 | { GPCMD_READ_12, "Read 12" }, | ||
77 | { GPCMD_GET_PERFORMANCE, "Get Performance" }, | ||
78 | { GPCMD_SEND_DVD_STRUCTURE, "Send DVD Structure" }, | ||
79 | { GPCMD_READ_DVD_STRUCTURE, "Read DVD Structure" }, | ||
80 | { GPCMD_SET_STREAMING, "Set Streaming" }, | ||
81 | { GPCMD_READ_CD_MSF, "Read CD MSF" }, | ||
82 | { GPCMD_SCAN, "Scan" }, | ||
83 | { GPCMD_SET_SPEED, "Set Speed" }, | ||
84 | { GPCMD_PLAY_CD, "Play CD" }, | ||
85 | { GPCMD_MECHANISM_STATUS, "Mechanism Status" }, | ||
86 | { GPCMD_READ_CD, "Read CD" }, | ||
87 | }; | ||
88 | |||
89 | /* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | ||
90 | static const char * const sense_key_texts[16] = { | ||
91 | "No sense data", | ||
92 | "Recovered error", | ||
93 | "Not ready", | ||
94 | "Medium error", | ||
95 | "Hardware error", | ||
96 | "Illegal request", | ||
97 | "Unit attention", | ||
98 | "Data protect", | ||
99 | "Blank check", | ||
100 | "(reserved)", | ||
101 | "(reserved)", | ||
102 | "Aborted command", | ||
103 | "(reserved)", | ||
104 | "(reserved)", | ||
105 | "Miscompare", | ||
106 | "(reserved)", | ||
107 | }; | ||
108 | |||
109 | /* From Table 304 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | ||
110 | static const struct { | ||
111 | unsigned long asc_ascq; | ||
112 | const char * const text; | ||
113 | } sense_data_texts[] = { | ||
114 | { 0x000000, "No additional sense information" }, | ||
115 | { 0x000011, "Play operation in progress" }, | ||
116 | { 0x000012, "Play operation paused" }, | ||
117 | { 0x000013, "Play operation successfully completed" }, | ||
118 | { 0x000014, "Play operation stopped due to error" }, | ||
119 | { 0x000015, "No current audio status to return" }, | ||
120 | { 0x010c0a, "Write error - padding blocks added" }, | ||
121 | { 0x011700, "Recovered data with no error correction applied" }, | ||
122 | { 0x011701, "Recovered data with retries" }, | ||
123 | { 0x011702, "Recovered data with positive head offset" }, | ||
124 | { 0x011703, "Recovered data with negative head offset" }, | ||
125 | { 0x011704, "Recovered data with retries and/or CIRC applied" }, | ||
126 | { 0x011705, "Recovered data using previous sector ID" }, | ||
127 | { 0x011800, "Recovered data with error correction applied" }, | ||
128 | { 0x011801, "Recovered data with error correction and retries applied"}, | ||
129 | { 0x011802, "Recovered data - the data was auto-reallocated" }, | ||
130 | { 0x011803, "Recovered data with CIRC" }, | ||
131 | { 0x011804, "Recovered data with L-EC" }, | ||
132 | { 0x015d00, "Failure prediction threshold exceeded" | ||
133 | " - Predicted logical unit failure" }, | ||
134 | { 0x015d01, "Failure prediction threshold exceeded" | ||
135 | " - Predicted media failure" }, | ||
136 | { 0x015dff, "Failure prediction threshold exceeded - False" }, | ||
137 | { 0x017301, "Power calibration area almost full" }, | ||
138 | { 0x020400, "Logical unit not ready - cause not reportable" }, | ||
139 | /* Following is misspelled in ATAPI 2.6, _and_ in Mt. Fuji */ | ||
140 | { 0x020401, "Logical unit not ready" | ||
141 | " - in progress [sic] of becoming ready" }, | ||
142 | { 0x020402, "Logical unit not ready - initializing command required" }, | ||
143 | { 0x020403, "Logical unit not ready - manual intervention required" }, | ||
144 | { 0x020404, "Logical unit not ready - format in progress" }, | ||
145 | { 0x020407, "Logical unit not ready - operation in progress" }, | ||
146 | { 0x020408, "Logical unit not ready - long write in progress" }, | ||
147 | { 0x020600, "No reference position found (media may be upside down)" }, | ||
148 | { 0x023000, "Incompatible medium installed" }, | ||
149 | { 0x023a00, "Medium not present" }, | ||
150 | { 0x025300, "Media load or eject failed" }, | ||
151 | { 0x025700, "Unable to recover table of contents" }, | ||
152 | { 0x030300, "Peripheral device write fault" }, | ||
153 | { 0x030301, "No write current" }, | ||
154 | { 0x030302, "Excessive write errors" }, | ||
155 | { 0x030c00, "Write error" }, | ||
156 | { 0x030c01, "Write error - Recovered with auto reallocation" }, | ||
157 | { 0x030c02, "Write error - auto reallocation failed" }, | ||
158 | { 0x030c03, "Write error - recommend reassignment" }, | ||
159 | { 0x030c04, "Compression check miscompare error" }, | ||
160 | { 0x030c05, "Data expansion occurred during compress" }, | ||
161 | { 0x030c06, "Block not compressible" }, | ||
162 | { 0x030c07, "Write error - recovery needed" }, | ||
163 | { 0x030c08, "Write error - recovery failed" }, | ||
164 | { 0x030c09, "Write error - loss of streaming" }, | ||
165 | { 0x031100, "Unrecovered read error" }, | ||
166 | { 0x031106, "CIRC unrecovered error" }, | ||
167 | { 0x033101, "Format command failed" }, | ||
168 | { 0x033200, "No defect spare location available" }, | ||
169 | { 0x033201, "Defect list update failure" }, | ||
170 | { 0x035100, "Erase failure" }, | ||
171 | { 0x037200, "Session fixation error" }, | ||
172 | { 0x037201, "Session fixation error writin lead-in" }, | ||
173 | { 0x037202, "Session fixation error writin lead-out" }, | ||
174 | { 0x037300, "CD control error" }, | ||
175 | { 0x037302, "Power calibration area is full" }, | ||
176 | { 0x037303, "Power calibration area error" }, | ||
177 | { 0x037304, "Program memory area / RMA update failure" }, | ||
178 | { 0x037305, "Program memory area / RMA is full" }, | ||
179 | { 0x037306, "Program memory area / RMA is (almost) full" }, | ||
180 | { 0x040200, "No seek complete" }, | ||
181 | { 0x040300, "Write fault" }, | ||
182 | { 0x040900, "Track following error" }, | ||
183 | { 0x040901, "Tracking servo failure" }, | ||
184 | { 0x040902, "Focus servo failure" }, | ||
185 | { 0x040903, "Spindle servo failure" }, | ||
186 | { 0x041500, "Random positioning error" }, | ||
187 | { 0x041501, "Mechanical positioning or changer error" }, | ||
188 | { 0x041502, "Positioning error detected by read of medium" }, | ||
189 | { 0x043c00, "Mechanical positioning or changer error" }, | ||
190 | { 0x044000, "Diagnostic failure on component (ASCQ)" }, | ||
191 | { 0x044400, "Internal CD/DVD logical unit failure" }, | ||
192 | { 0x04b600, "Media load mechanism failed" }, | ||
193 | { 0x051a00, "Parameter list length error" }, | ||
194 | { 0x052000, "Invalid command operation code" }, | ||
195 | { 0x052100, "Logical block address out of range" }, | ||
196 | { 0x052102, "Invalid address for write" }, | ||
197 | { 0x052400, "Invalid field in command packet" }, | ||
198 | { 0x052600, "Invalid field in parameter list" }, | ||
199 | { 0x052601, "Parameter not supported" }, | ||
200 | { 0x052602, "Parameter value invalid" }, | ||
201 | { 0x052700, "Write protected media" }, | ||
202 | { 0x052c00, "Command sequence error" }, | ||
203 | { 0x052c03, "Current program area is not empty" }, | ||
204 | { 0x052c04, "Current program area is empty" }, | ||
205 | { 0x053001, "Cannot read medium - unknown format" }, | ||
206 | { 0x053002, "Cannot read medium - incompatible format" }, | ||
207 | { 0x053900, "Saving parameters not supported" }, | ||
208 | { 0x054e00, "Overlapped commands attempted" }, | ||
209 | { 0x055302, "Medium removal prevented" }, | ||
210 | { 0x055500, "System resource failure" }, | ||
211 | { 0x056300, "End of user area encountered on this track" }, | ||
212 | { 0x056400, "Illegal mode for this track or incompatible medium" }, | ||
213 | { 0x056f00, "Copy protection key exchange failure" | ||
214 | " - Authentication failure" }, | ||
215 | { 0x056f01, "Copy protection key exchange failure - Key not present" }, | ||
216 | { 0x056f02, "Copy protection key exchange failure" | ||
217 | " - Key not established" }, | ||
218 | { 0x056f03, "Read of scrambled sector without authentication" }, | ||
219 | { 0x056f04, "Media region code is mismatched to logical unit" }, | ||
220 | { 0x056f05, "Drive region must be permanent" | ||
221 | " / region reset count error" }, | ||
222 | { 0x057203, "Session fixation error - incomplete track in session" }, | ||
223 | { 0x057204, "Empty or partially written reserved track" }, | ||
224 | { 0x057205, "No more RZONE reservations are allowed" }, | ||
225 | { 0x05bf00, "Loss of streaming" }, | ||
226 | { 0x062800, "Not ready to ready transition, medium may have changed" }, | ||
227 | { 0x062900, "Power on, reset or hardware reset occurred" }, | ||
228 | { 0x062a00, "Parameters changed" }, | ||
229 | { 0x062a01, "Mode parameters changed" }, | ||
230 | { 0x062e00, "Insufficient time for operation" }, | ||
231 | { 0x063f00, "Logical unit operating conditions have changed" }, | ||
232 | { 0x063f01, "Microcode has been changed" }, | ||
233 | { 0x065a00, "Operator request or state change input (unspecified)" }, | ||
234 | { 0x065a01, "Operator medium removal request" }, | ||
235 | { 0x0bb900, "Play operation aborted" }, | ||
236 | /* Here we use 0xff for the key (not a valid key) to signify | ||
237 | * that these can have _any_ key value associated with them... */ | ||
238 | { 0xff0401, "Logical unit is in process of becoming ready" }, | ||
239 | { 0xff0400, "Logical unit not ready, cause not reportable" }, | ||
240 | { 0xff0402, "Logical unit not ready, initializing command required" }, | ||
241 | { 0xff0403, "Logical unit not ready, manual intervention required" }, | ||
242 | { 0xff0500, "Logical unit does not respond to selection" }, | ||
243 | { 0xff0800, "Logical unit communication failure" }, | ||
244 | { 0xff0802, "Logical unit communication parity error" }, | ||
245 | { 0xff0801, "Logical unit communication time-out" }, | ||
246 | { 0xff2500, "Logical unit not supported" }, | ||
247 | { 0xff4c00, "Logical unit failed self-configuration" }, | ||
248 | { 0xff3e00, "Logical unit has not self-configured yet" }, | ||
249 | }; | ||
250 | |||
251 | void ide_cd_log_error(const char *name, struct request *failed_command, | ||
252 | struct request_sense *sense) | ||
253 | { | ||
254 | int i; | ||
255 | const char *s = "bad sense key!"; | ||
256 | char buf[80]; | ||
257 | |||
258 | printk(KERN_ERR "ATAPI device %s:\n", name); | ||
259 | if (sense->error_code == 0x70) | ||
260 | printk(KERN_CONT " Error: "); | ||
261 | else if (sense->error_code == 0x71) | ||
262 | printk(" Deferred Error: "); | ||
263 | else if (sense->error_code == 0x7f) | ||
264 | printk(KERN_CONT " Vendor-specific Error: "); | ||
265 | else | ||
266 | printk(KERN_CONT " Unknown Error Type: "); | ||
267 | |||
268 | if (sense->sense_key < ARRAY_SIZE(sense_key_texts)) | ||
269 | s = sense_key_texts[sense->sense_key]; | ||
270 | |||
271 | printk(KERN_CONT "%s -- (Sense key=0x%02x)\n", s, sense->sense_key); | ||
272 | |||
273 | if (sense->asc == 0x40) { | ||
274 | sprintf(buf, "Diagnostic failure on component 0x%02x", | ||
275 | sense->ascq); | ||
276 | s = buf; | ||
277 | } else { | ||
278 | int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts); | ||
279 | unsigned long key = (sense->sense_key << 16); | ||
280 | |||
281 | key |= (sense->asc << 8); | ||
282 | if (!(sense->ascq >= 0x80 && sense->ascq <= 0xdd)) | ||
283 | key |= sense->ascq; | ||
284 | s = NULL; | ||
285 | |||
286 | while (hi > lo) { | ||
287 | mid = (lo + hi) / 2; | ||
288 | if (sense_data_texts[mid].asc_ascq == key || | ||
289 | sense_data_texts[mid].asc_ascq == (0xff0000|key)) { | ||
290 | s = sense_data_texts[mid].text; | ||
291 | break; | ||
292 | } else if (sense_data_texts[mid].asc_ascq > key) | ||
293 | hi = mid; | ||
294 | else | ||
295 | lo = mid + 1; | ||
296 | } | ||
297 | } | ||
298 | |||
299 | if (s == NULL) { | ||
300 | if (sense->asc > 0x80) | ||
301 | s = "(vendor-specific error)"; | ||
302 | else | ||
303 | s = "(reserved error code)"; | ||
304 | } | ||
305 | |||
306 | printk(KERN_ERR " %s -- (asc=0x%02x, ascq=0x%02x)\n", | ||
307 | s, sense->asc, sense->ascq); | ||
308 | |||
309 | if (failed_command != NULL) { | ||
310 | int lo = 0, mid, hi = ARRAY_SIZE(packet_command_texts); | ||
311 | s = NULL; | ||
312 | |||
313 | while (hi > lo) { | ||
314 | mid = (lo + hi) / 2; | ||
315 | if (packet_command_texts[mid].packet_command == | ||
316 | failed_command->cmd[0]) { | ||
317 | s = packet_command_texts[mid].text; | ||
318 | break; | ||
319 | } | ||
320 | if (packet_command_texts[mid].packet_command > | ||
321 | failed_command->cmd[0]) | ||
322 | hi = mid; | ||
323 | else | ||
324 | lo = mid + 1; | ||
325 | } | ||
326 | |||
327 | printk(KERN_ERR " The failed \"%s\" packet command " | ||
328 | "was: \n \"", s); | ||
329 | for (i = 0; i < sizeof(failed_command->cmd); i++) | ||
330 | printk(KERN_CONT "%02x ", failed_command->cmd[i]); | ||
331 | printk(KERN_CONT "\"\n"); | ||
332 | } | ||
333 | |||
334 | /* The SKSV bit specifies validity of the sense_key_specific | ||
335 | * in the next two commands. It is bit 7 of the first byte. | ||
336 | * In the case of NOT_READY, if SKSV is set the drive can | ||
337 | * give us nice ETA readings. | ||
338 | */ | ||
339 | if (sense->sense_key == NOT_READY && (sense->sks[0] & 0x80)) { | ||
340 | int progress = (sense->sks[1] << 8 | sense->sks[2]) * 100; | ||
341 | |||
342 | printk(KERN_ERR " Command is %02d%% complete\n", | ||
343 | progress / 0xffff); | ||
344 | } | ||
345 | |||
346 | if (sense->sense_key == ILLEGAL_REQUEST && | ||
347 | (sense->sks[0] & 0x80) != 0) { | ||
348 | printk(KERN_ERR " Error in %s byte %d", | ||
349 | (sense->sks[0] & 0x40) != 0 ? | ||
350 | "command packet" : "command data", | ||
351 | (sense->sks[1] << 8) + sense->sks[2]); | ||
352 | |||
353 | if ((sense->sks[0] & 0x40) != 0) | ||
354 | printk(KERN_CONT " bit %d", sense->sks[0] & 0x07); | ||
355 | |||
356 | printk(KERN_CONT "\n"); | ||
357 | } | ||
358 | } | ||
359 | #endif | ||