aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c124
1 files changed, 2 insertions, 122 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 02488b48fa7..f4a0264bea6 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
3191MODULE_ALIAS("ide:*m-cdrom*"); 3070MODULE_ALIAS("ide:*m-cdrom*");
3071MODULE_ALIAS("ide-cd");
3192module_init(ide_cdrom_init); 3072module_init(ide_cdrom_init);
3193module_exit(ide_cdrom_exit); 3073module_exit(ide_cdrom_exit);
3194MODULE_LICENSE("GPL"); 3074MODULE_LICENSE("GPL");