VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/Debug.cpp@ 44004

Last change on this file since 44004 was 40840, checked in by vboxsync, 13 years ago

Storage/Debug: Function to log a CUE sheet

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 52.5 KB
Line 
1/* $Id: Debug.cpp 40840 2012-04-10 08:19:34Z vboxsync $ */
2/** @file
3 * VBox storage devices: debug helpers
4 */
5
6/*
7 * Copyright (C) 2008 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19#include <iprt/assert.h>
20#include <iprt/types.h>
21#include <iprt/string.h>
22#include <VBox/scsi.h>
23#include "ide.h"
24
25/**
26 * ATA command codes
27 */
28static const char * const g_apszATACmdNames[256] =
29{
30 "NOP", /* 0x00 */
31 "", /* 0x01 */
32 "", /* 0x02 */
33 "CFA REQUEST EXTENDED ERROR CODE", /* 0x03 */
34 "", /* 0x04 */
35 "", /* 0x05 */
36 "DATA SET MANAGEMENT", /* 0x06 */
37 "", /* 0x07 */
38 "DEVICE RESET", /* 0x08 */
39 "", /* 0x09 */
40 "", /* 0x0a */
41 "", /* 0x0b */
42 "", /* 0x0c */
43 "", /* 0x0d */
44 "", /* 0x0e */
45 "", /* 0x0f */
46 "RECALIBRATE", /* 0x10 */
47 "", /* 0x11 */
48 "", /* 0x12 */
49 "", /* 0x13 */
50 "", /* 0x14 */
51 "", /* 0x15 */
52 "", /* 0x16 */
53 "", /* 0x17 */
54 "", /* 0x18 */
55 "", /* 0x19 */
56 "", /* 0x1a */
57 "", /* 0x1b */
58 "", /* 0x1c */
59 "", /* 0x1d */
60 "", /* 0x1e */
61 "", /* 0x1f */
62 "READ SECTORS", /* 0x20 */
63 "READ SECTORS WITHOUT RETRIES", /* 0x21 */
64 "READ LONG", /* 0x22 */
65 "READ LONG WITHOUT RETRIES", /* 0x23 */
66 "READ SECTORS EXT", /* 0x24 */
67 "READ DMA EXT", /* 0x25 */
68 "READ DMA QUEUED EXT", /* 0x26 */
69 "READ NATIVE MAX ADDRESS EXT", /* 0x27 */
70 "", /* 0x28 */
71 "READ MULTIPLE EXT", /* 0x29 */
72 "READ STREAM DMA EXT", /* 0x2a */
73 "READ STREAM EXT", /* 0x2b */
74 "", /* 0x2c */
75 "", /* 0x2d */
76 "", /* 0x2e */
77 "READ LOG EXT", /* 0x2f */
78 "WRITE SECTORS", /* 0x30 */
79 "WRITE SECTORS WITHOUT RETRIES", /* 0x31 */
80 "WRITE LONG", /* 0x32 */
81 "WRITE LONG WITHOUT RETRIES", /* 0x33 */
82 "WRITE SECTORS EXT", /* 0x34 */
83 "WRITE DMA EXT", /* 0x35 */
84 "WRITE DMA QUEUED EXT", /* 0x36 */
85 "SET MAX ADDRESS EXT", /* 0x37 */
86 "CFA WRITE SECTORS WITHOUT ERASE", /* 0x38 */
87 "WRITE MULTIPLE EXT", /* 0x39 */
88 "WRITE STREAM DMA EXT", /* 0x3a */
89 "WRITE STREAM EXT", /* 0x3b */
90 "WRITE VERIFY", /* 0x3c */
91 "WRITE DMA FUA EXT", /* 0x3d */
92 "WRITE DMA QUEUED FUA EXT", /* 0x3e */
93 "WRITE LOG EXT", /* 0x3f */
94 "READ VERIFY SECTORS", /* 0x40 */
95 "READ VERIFY SECTORS WITHOUT RETRIES", /* 0x41 */
96 "READ VERIFY SECTORS EXT", /* 0x42 */
97 "", /* 0x43 */
98 "", /* 0x44 */
99 "WRITE UNCORRECTABLE EXT", /* 0x45 */
100 "", /* 0x46 */
101 "READ LOG DMA EXT", /* 0x47 */
102 "", /* 0x48 */
103 "", /* 0x49 */
104 "", /* 0x4a */
105 "", /* 0x4b */
106 "", /* 0x4c */
107 "", /* 0x4d */
108 "", /* 0x4e */
109 "", /* 0x4f */
110 "FORMAT TRACK", /* 0x50 */
111 "CONFIGURE STREAM", /* 0x51 */
112 "", /* 0x52 */
113 "", /* 0x53 */
114 "", /* 0x54 */
115 "", /* 0x55 */
116 "", /* 0x56 */
117 "WRITE LOG DMA EXT", /* 0x57 */
118 "", /* 0x58 */
119 "", /* 0x59 */
120 "", /* 0x5a */
121 "", /* 0x5b */
122 "TRUSTED RECEIVE", /* 0x5c */
123 "TRUSTED RECEIVE DMA", /* 0x5d */
124 "TRUSTED SEND", /* 0x5e */
125 "TRUSTED SEND DMA", /* 0x5f */
126 "READ FPDMA QUEUED", /* 0x60 */
127 "WRITE FPDMA QUEUED", /* 0x61 */
128 "", /* 0x62 */
129 "", /* 0x63 */
130 "", /* 0x64 */
131 "", /* 0x65 */
132 "", /* 0x66 */
133 "", /* 0x67 */
134 "", /* 0x68 */
135 "", /* 0x69 */
136 "", /* 0x6a */
137 "", /* 0x6b */
138 "", /* 0x6c */
139 "", /* 0x6d */
140 "", /* 0x6e */
141 "", /* 0x6f */
142 "SEEK", /* 0x70 */
143 "", /* 0x71 */
144 "", /* 0x72 */
145 "", /* 0x73 */
146 "", /* 0x74 */
147 "", /* 0x75 */
148 "", /* 0x76 */
149 "", /* 0x77 */
150 "", /* 0x78 */
151 "", /* 0x79 */
152 "", /* 0x7a */
153 "", /* 0x7b */
154 "", /* 0x7c */
155 "", /* 0x7d */
156 "", /* 0x7e */
157 "", /* 0x7f */
158 "", /* 0x80 */
159 "", /* 0x81 */
160 "", /* 0x82 */
161 "", /* 0x83 */
162 "", /* 0x84 */
163 "", /* 0x85 */
164 "", /* 0x86 */
165 "CFA TRANSLATE SECTOR", /* 0x87 */
166 "", /* 0x88 */
167 "", /* 0x89 */
168 "", /* 0x8a */
169 "", /* 0x8b */
170 "", /* 0x8c */
171 "", /* 0x8d */
172 "", /* 0x8e */
173 "", /* 0x8f */
174 "EXECUTE DEVICE DIAGNOSTIC", /* 0x90 */
175 "INITIALIZE DEVICE PARAMETERS", /* 0x91 */
176 "DOWNLOAD MICROCODE", /* 0x92 */
177 "", /* 0x93 */
178 "STANDBY IMMEDIATE ALT", /* 0x94 */
179 "IDLE IMMEDIATE ALT", /* 0x95 */
180 "STANDBY ALT", /* 0x96 */
181 "IDLE ALT", /* 0x97 */
182 "CHECK POWER MODE ALT", /* 0x98 */
183 "SLEEP ALT", /* 0x99 */
184 "", /* 0x9a */
185 "", /* 0x9b */
186 "", /* 0x9c */
187 "", /* 0x9d */
188 "", /* 0x9e */
189 "", /* 0x9f */
190 "PACKET", /* 0xa0 */
191 "IDENTIFY PACKET DEVICE", /* 0xa1 */
192 "SERVICE", /* 0xa2 */
193 "", /* 0xa3 */
194 "", /* 0xa4 */
195 "", /* 0xa5 */
196 "", /* 0xa6 */
197 "", /* 0xa7 */
198 "", /* 0xa8 */
199 "", /* 0xa9 */
200 "", /* 0xaa */
201 "", /* 0xab */
202 "", /* 0xac */
203 "", /* 0xad */
204 "", /* 0xae */
205 "", /* 0xaf */
206 "SMART", /* 0xb0 */
207 "DEVICE CONFIGURATION OVERLAY", /* 0xb1 */
208 "", /* 0xb2 */
209 "", /* 0xb3 */
210 "", /* 0xb4 */
211 "", /* 0xb5 */
212 "NV CACHE", /* 0xb6 */
213 "", /* 0xb7 */
214 "", /* 0xb8 */
215 "", /* 0xb9 */
216 "", /* 0xba */
217 "", /* 0xbb */
218 "", /* 0xbc */
219 "", /* 0xbd */
220 "", /* 0xbe */
221 "", /* 0xbf */
222 "CFA ERASE SECTORS", /* 0xc0 */
223 "", /* 0xc1 */
224 "", /* 0xc2 */
225 "", /* 0xc3 */
226 "READ MULTIPLE", /* 0xc4 */
227 "WRITE MULTIPLE", /* 0xc5 */
228 "SET MULTIPLE MODE", /* 0xc6 */
229 "READ DMA QUEUED", /* 0xc7 */
230 "READ DMA", /* 0xc8 */
231 "READ DMA WITHOUT RETRIES", /* 0xc9 */
232 "WRITE DMA", /* 0xca */
233 "WRITE DMA WITHOUT RETRIES", /* 0xcb */
234 "WRITE DMA QUEUED", /* 0xcc */
235 "CFA WRITE MULTIPLE WITHOUT ERASE", /* 0xcd */
236 "WRITE MULTIPLE FUA EXT", /* 0xce */
237 "", /* 0xcf */
238 "", /* 0xd0 */
239 "CHECK MEDIA CARD TYPE", /* 0xd1 */
240 "", /* 0xd2 */
241 "", /* 0xd3 */
242 "", /* 0xd4 */
243 "", /* 0xd5 */
244 "", /* 0xd6 */
245 "", /* 0xd7 */
246 "", /* 0xd8 */
247 "", /* 0xd9 */
248 "GET MEDIA STATUS", /* 0xda */
249 "ACKNOWLEDGE MEDIA CHANGE", /* 0xdb */
250 "BOOT POST BOOT", /* 0xdc */
251 "BOOT PRE BOOT", /* 0xdd */
252 "MEDIA LOCK", /* 0xde */
253 "MEDIA UNLOCK", /* 0xdf */
254 "STANDBY IMMEDIATE", /* 0xe0 */
255 "IDLE IMMEDIATE", /* 0xe1 */
256 "STANDBY", /* 0xe2 */
257 "IDLE", /* 0xe3 */
258 "READ BUFFER", /* 0xe4 */
259 "CHECK POWER MODE", /* 0xe5 */
260 "SLEEP", /* 0xe6 */
261 "FLUSH CACHE", /* 0xe7 */
262 "WRITE BUFFER", /* 0xe8 */
263 "WRITE SAME", /* 0xe9 */
264 "FLUSH CACHE EXT", /* 0xea */
265 "", /* 0xeb */
266 "IDENTIFY DEVICE", /* 0xec */
267 "MEDIA EJECT", /* 0xed */
268 "IDENTIFY DMA", /* 0xee */
269 "SET FEATURES", /* 0xef */
270 "", /* 0xf0 */
271 "SECURITY SET PASSWORD", /* 0xf1 */
272 "SECURITY UNLOCK", /* 0xf2 */
273 "SECURITY ERASE PREPARE", /* 0xf3 */
274 "SECURITY ERASE UNIT", /* 0xf4 */
275 "SECURITY FREEZE LOCK", /* 0xf5 */
276 "SECURITY DISABLE PASSWORD", /* 0xf6 */
277 "", /* 0xf7 */
278 "READ NATIVE MAX ADDRESS", /* 0xf8 */
279 "SET MAX", /* 0xf9 */
280 "", /* 0xfa */
281 "", /* 0xfb */
282 "", /* 0xfc */
283 "", /* 0xfd */
284 "", /* 0xfe */
285 "" /* 0xff */
286};
287
288/**
289 * SCSI command codes.
290 */
291static const char * const g_apszSCSICmdNames[256] =
292{
293 "TEST UNIT READY", /* 0x00 */
294 "REZERO UNIT", /* 0x01 */
295 "", /* 0x02 */
296 "REQUEST SENSE", /* 0x03 */
297 "FORMAT UNIT", /* 0x04 */
298 "READ BLOCK LIMITS", /* 0x05 */
299 "", /* 0x06 */
300 "REASSIGN BLOCKS", /* 0x07 */
301 "READ (6)", /* 0x08 */
302 "", /* 0x09 */
303 "WRITE (6)", /* 0x0a */
304 "SEEK (6)", /* 0x0b */
305 "", /* 0x0c */
306 "", /* 0x0d */
307 "", /* 0x0e */
308 "READ REVERSE (6)", /* 0x0f */
309 "READ FILEMARKS (6)", /* 0x10 */
310 "SPACE (6)", /* 0x11 */
311 "INQUIRY", /* 0x12 */
312 "VERIFY (6)", /* 0x13 */
313 "RECOVER BUFFERED DATA", /* 0x14 */
314 "MODE SELECT (6)", /* 0x15 */
315 "RESERVE (6)", /* 0x16 */
316 "RELEASE (6)", /* 0x17 */
317 "COPY", /* 0x18 */
318 "ERASE (6)", /* 0x19 */
319 "MODE SENSE (6)", /* 0x1a */
320 "START STOP UNIT", /* 0x1b */
321 "RECEIVE DIAGNOSTIC RESULTS", /* 0x1c */
322 "SEND DIAGNOSTIC", /* 0x1d */
323 "PREVENT ALLOW MEDIUM REMOVAL", /* 0x1e */
324 "", /* 0x1f */
325 "", /* 0x20 */
326 "", /* 0x21 */
327 "", /* 0x22 */
328 "READ FORMAT CAPACITIES", /* 0x23 */
329 "SET WINDOW", /* 0x24 */
330 "READ CAPACITY", /* 0x25 */
331 "", /* 0x26 */
332 "", /* 0x27 */
333 "READ (10)", /* 0x28 */
334 "READ GENERATION", /* 0x29 */
335 "WRITE (10)", /* 0x2a */
336 "SEEK (10)", /* 0x2b */
337 "ERASE (10)", /* 0x2c */
338 "READ UPDATED BLOCK", /* 0x2d */
339 "WRITE AND VERIFY (10)", /* 0x2e */
340 "VERIFY (10)", /* 0x2f */
341 "SEARCH DATA HIGH (10)", /* 0x30 */
342 "SEARCH DATA EQUAL (10)", /* 0x31 */
343 "SEARCH DATA LOW (10)", /* 0x32 */
344 "SET LIMITS (10)", /* 0x33 */
345 "PRE-FETCH (10)", /* 0x34 */
346 "SYNCHRONIZE CACHE (10)", /* 0x35 */
347 "LOCK UNLOCK CACHE (10)", /* 0x36 */
348 "READ DEFECT DATA (10)", /* 0x37 */
349 "MEDIUM SCAN", /* 0x38 */
350 "COMPARE", /* 0x39 */
351 "COPY AND VERIFY", /* 0x3a */
352 "WRITE BUFFER", /* 0x3b */
353 "READ BUFFER", /* 0x3c */
354 "UPDATE BLOCK", /* 0x3d */
355 "READ LONG (10)", /* 0x3e */
356 "WRITE LONG (10)", /* 0x3f */
357 "CHANGE DEFINITION", /* 0x40 */
358 "WRITE SAME (10)", /* 0x41 */
359 "READ SUBCHANNEL", /* 0x42 */
360 "READ TOC/PMA/ATIP", /* 0x43 */
361 "REPORT DENSITY SUPPORT", /* 0x44 */
362 "PLAY AUDIO (10)", /* 0x45 */
363 "GET CONFIGURATION", /* 0x46 */
364 "PLAY AUDIO MSF", /* 0x47 */
365 "", /* 0x48 */
366 "", /* 0x49 */
367 "GET EVENT STATUS NOTIFICATION", /* 0x4a */
368 "PAUSE/RESUME", /* 0x4b */
369 "LOG SELECT", /* 0x4c */
370 "LOG SENSE", /* 0x4d */
371 "STOP PLAY/SCAN", /* 0x4e */
372 "", /* 0x4f */
373 "XDWRITE (10)", /* 0x50 */
374 "READ DISC INFORMATION", /* 0x51 */
375 "READ TRACK INFORMATION", /* 0x52 */
376 "RESERVE TRACK", /* 0x53 */
377 "SEND OPC INFORMATION", /* 0x54 */
378 "MODE SELECT (10)", /* 0x55 */
379 "RESERVE (10)", /* 0x56 */
380 "RELEASE (10)", /* 0x57 */
381 "REPAIR TRACK", /* 0x58 */
382 "", /* 0x59 */
383 "MODE SENSE (10)", /* 0x5a */
384 "CLOSE TRACK/SESSION", /* 0x5b */
385 "READ BUFFER CAPACITY", /* 0x5c */
386 "SEND CUE SHEET", /* 0x5d */
387 "PERSISTENT RESERVE IN", /* 0x5e */
388 "PERSISTENT RESERVE OUT", /* 0x5f */
389 "", /* 0x60 */
390 "", /* 0x61 */
391 "", /* 0x62 */
392 "", /* 0x63 */
393 "", /* 0x64 */
394 "", /* 0x65 */
395 "", /* 0x66 */
396 "", /* 0x67 */
397 "", /* 0x68 */
398 "", /* 0x69 */
399 "", /* 0x6a */
400 "", /* 0x6b */
401 "", /* 0x6c */
402 "", /* 0x6d */
403 "", /* 0x6e */
404 "", /* 0x6f */
405 "", /* 0x70 */
406 "", /* 0x71 */
407 "", /* 0x72 */
408 "", /* 0x73 */
409 "", /* 0x74 */
410 "", /* 0x75 */
411 "", /* 0x76 */
412 "", /* 0x77 */
413 "", /* 0x78 */
414 "", /* 0x79 */
415 "", /* 0x7a */
416 "", /* 0x7b */
417 "", /* 0x7c */
418 "", /* 0x7d */
419 "", /* 0x7e */
420 "", /* 0x7f */
421 "WRITE FILEMARKS (16)", /* 0x80 */
422 "READ REVERSE (16)", /* 0x81 */
423 "REGENERATE (16)", /* 0x82 */
424 "EXTENDED COPY", /* 0x83 */
425 "RECEIVE COPY RESULTS", /* 0x84 */
426 "ATA COMMAND PASS THROUGH (16)", /* 0x85 */
427 "ACCESS CONTROL IN", /* 0x86 */
428 "ACCESS CONTROL OUT", /* 0x87 */
429 "READ (16)", /* 0x88 */
430 "", /* 0x89 */
431 "WRITE(16)", /* 0x8a */
432 "", /* 0x8b */
433 "READ ATTRIBUTE", /* 0x8c */
434 "WRITE ATTRIBUTE", /* 0x8d */
435 "WRITE AND VERIFY (16)", /* 0x8e */
436 "VERIFY (16)", /* 0x8f */
437 "PRE-FETCH (16)", /* 0x90 */
438 "SYNCHRONIZE CACHE (16)", /* 0x91 */
439 "LOCK UNLOCK CACHE (16)", /* 0x92 */
440 "WRITE SAME (16)", /* 0x93 */
441 "", /* 0x94 */
442 "", /* 0x95 */
443 "", /* 0x96 */
444 "", /* 0x97 */
445 "", /* 0x98 */
446 "", /* 0x99 */
447 "", /* 0x9a */
448 "", /* 0x9b */
449 "", /* 0x9c */
450 "", /* 0x9d */
451 "SERVICE ACTION IN (16)", /* 0x9e */
452 "SERVICE ACTION OUT (16)", /* 0x9f */
453 "REPORT LUNS", /* 0xa0 */
454 "BLANK", /* 0xa1 */
455 "SEND EVENT", /* 0xa2 */
456 "SEND KEY", /* 0xa3 */
457 "REPORT KEY", /* 0xa4 */
458 "PLAY AUDIO (12)", /* 0xa5 */
459 "LOAD/UNLOAD MEDIUM", /* 0xa6 */
460 "SET READ AHEAD", /* 0xa7 */
461 "READ (12)", /* 0xa8 */
462 "SERVICE ACTION OUT (12)", /* 0xa9 */
463 "WRITE (12)", /* 0xaa */
464 "SERVICE ACTION IN (12)", /* 0xab */
465 "GET PERFORMANCE", /* 0xac */
466 "READ DVD STRUCTURE", /* 0xad */
467 "WRITE AND VERIFY (12)", /* 0xae */
468 "VERIFY (12)", /* 0xaf */
469 "SEARCH DATA HIGH (12)", /* 0xb0 */
470 "SEARCH DATA EQUAL (12)", /* 0xb1 */
471 "SEARCH DATA LOW (12)", /* 0xb2 */
472 "SET LIMITS (12)", /* 0xb3 */
473 "READ ELEMENT STATUS ATTACHED", /* 0xb4 */
474 "REQUEST VOLUME ELEMENT ADDRESS", /* 0xb5 */
475 "SET STREAMING", /* 0xb6 */
476 "READ DEFECT DATA (12)", /* 0xb7 */
477 "READ ELEMENT STATUS", /* 0xb8 */
478 "READ CD MSF", /* 0xb9 */
479 "SCAN", /* 0xba */
480 "SET CD SPEED", /* 0xbb */
481 "SPARE (IN)", /* 0xbc */
482 "MECHANISM STATUS", /* 0xbd */
483 "READ CD", /* 0xbe */
484 "SEND DVD STRUCTURE", /* 0xbf */
485 "", /* 0xc0 */
486 "", /* 0xc1 */
487 "", /* 0xc2 */
488 "", /* 0xc3 */
489 "", /* 0xc4 */
490 "", /* 0xc5 */
491 "", /* 0xc6 */
492 "", /* 0xc7 */
493 "", /* 0xc8 */
494 "", /* 0xc9 */
495 "", /* 0xca */
496 "", /* 0xcb */
497 "", /* 0xcc */
498 "", /* 0xcd */
499 "", /* 0xce */
500 "", /* 0xcf */
501 "", /* 0xd0 */
502 "", /* 0xd1 */
503 "", /* 0xd2 */
504 "", /* 0xd3 */
505 "", /* 0xd4 */
506 "", /* 0xd5 */
507 "", /* 0xd6 */
508 "", /* 0xd7 */
509 "", /* 0xd8 */
510 "", /* 0xd9 */
511 "", /* 0xda */
512 "", /* 0xdb */
513 "", /* 0xdc */
514 "", /* 0xdd */
515 "", /* 0xde */
516 "", /* 0xdf */
517 "", /* 0xe0 */
518 "", /* 0xe1 */
519 "", /* 0xe2 */
520 "", /* 0xe3 */
521 "", /* 0xe4 */
522 "", /* 0xe5 */
523 "", /* 0xe6 */
524 "", /* 0xe7 */
525 "", /* 0xe8 */
526 "", /* 0xe9 */
527 "", /* 0xea */
528 "", /* 0xeb */
529 "", /* 0xec */
530 "", /* 0xed */
531 "", /* 0xee */
532 "", /* 0xef */
533 "", /* 0xf0 */
534 "", /* 0xf1 */
535 "", /* 0xf2 */
536 "", /* 0xf3 */
537 "", /* 0xf4 */
538 "", /* 0xf5 */
539 "", /* 0xf6 */
540 "", /* 0xf7 */
541 "", /* 0xf8 */
542 "", /* 0xf9 */
543 "", /* 0xfa */
544 "", /* 0xfb */
545 "", /* 0xfc */
546 "", /* 0xfd */
547 "", /* 0xfe */
548 "" /* 0xff */
549};
550
551static const char * const g_apszSCSISenseNames[] =
552{
553 "NO SENSE",
554 "RECOVERED ERROR",
555 "NOT READY",
556 "MEDIUM ERROR",
557 "HARDWARE ERROR",
558 "ILLEGAL REQUEST",
559 "UNIT ATTENTION",
560 "DATA PROTECT",
561 "BLANK CHECK",
562 "VENDOR-SPECIFIC",
563 "COPY ABORTED",
564 "ABORTED COMMAND",
565 "(obsolete)",
566 "VOLUME OVERFLOW",
567 "MISCOMPARE",
568 "(reserved)"
569};
570
571/**
572 * SCSI Sense text
573 */
574static struct
575{
576 uint8_t uASC;
577 uint8_t uASCQ;
578 const char * const pszSenseText;
579} g_aSCSISenseText[]
580=
581{
582 { 0x67, 0x02, "A ADD LOGICAL UNIT FAILED" },
583 { 0x13, 0x00, "ADDRESS MARK NOT FOUND FOR DATA FIELD" },
584 { 0x12, 0x00, "ADDRESS MARK NOT FOUND FOR ID FIELD" },
585 { 0x27, 0x03, "ASSOCIATED WRITE PROTECT" },
586 { 0x67, 0x06, "ATTACHMENT OF LOGICAL UNIT FAILED" },
587 { 0x00, 0x11, "AUDIO PLAY OPERATION IN PROGRESS" },
588 { 0x00, 0x12, "AUDIO PLAY OPERATION PAUSED" },
589 { 0x00, 0x14, "AUDIO PLAY OPERATION STOPPED DUE TO ERROR" },
590 { 0x00, 0x13, "AUDIO PLAY OPERATION SUCCESSFULLY COMPLETED" },
591 { 0x66, 0x00, "AUTOMATIC DOCUMENT FEEDER COVER UP" },
592 { 0x66, 0x01, "AUTOMATIC DOCUMENT FEEDER LIFT UP" },
593 { 0x00, 0x04, "BEGINNING-OF-PARTITION/MEDIUM DETECTED" },
594 { 0x0C, 0x06, "BLOCK NOT COMPRESSIBLE" },
595 { 0x14, 0x04, "BLOCK SEQUENCE ERROR" },
596 { 0x29, 0x03, "BUS DEVICE RESET FUNCTION OCCURRED" },
597 { 0x11, 0x0E, "CANNOT DECOMPRESS USING DECLARED ALGORITHM" },
598 { 0x30, 0x06, "CANNOT FORMAT MEDIUM - INCOMPATIBLE MEDIUM" },
599 { 0x30, 0x02, "CANNOT READ MEDIUM - INCOMPATIBLE FORMAT" },
600 { 0x30, 0x01, "CANNOT READ MEDIUM - UNKNOWN FORMAT" },
601 { 0x30, 0x08, "CANNOT WRITE - APPLICATION CODE MISMATCH" },
602 { 0x30, 0x05, "CANNOT WRITE MEDIUM - INCOMPATIBLE FORMAT" },
603 { 0x30, 0x04, "CANNOT WRITE MEDIUM - UNKNOWN FORMAT" },
604 { 0x52, 0x00, "CARTRIDGE FAULT" },
605 { 0x73, 0x00, "CD CONTROL ERROR" },
606 { 0x3F, 0x02, "CHANGED OPERATING DEFINITION" },
607 { 0x11, 0x06, "CIRC UNRECOVERED ERROR" },
608 { 0x30, 0x03, "CLEANING CARTRIDGE INSTALLED" },
609 { 0x30, 0x07, "CLEANING FAILURE" },
610 { 0x00, 0x17, "CLEANING REQUESTED" },
611 { 0x4A, 0x00, "COMMAND PHASE ERROR" },
612 { 0x2C, 0x00, "COMMAND SEQUENCE ERROR" },
613 { 0x6E, 0x00, "COMMAND TO LOGICAL UNIT FAILED" },
614 { 0x2F, 0x00, "COMMANDS CLEARED BY ANOTHER INITIATOR" },
615 { 0x0C, 0x04, "COMPRESSION CHECK MISCOMPARE ERROR" },
616 { 0x67, 0x00, "CONFIGURATION FAILURE" },
617 { 0x67, 0x01, "CONFIGURATION OF INCAPABLE LOGICAL UNITS FAILED" },
618 { 0x2B, 0x00, "COPY CANNOT EXECUTE SINCE HOST CANNOT DISCONNECT" },
619 { 0x67, 0x07, "CREATION OF LOGICAL UNIT FAILED" },
620 { 0x2C, 0x04, "CURRENT PROGRAM AREA IS EMPTY" },
621 { 0x2C, 0x03, "CURRENT PROGRAM AREA IS NOT EMPTY" },
622 { 0x30, 0x09, "CURRENT SESSION NOT FIXATED FOR APPEND" },
623 { 0x0C, 0x05, "DATA EXPANSION OCCURRED DURING COMPRESSION" },
624 { 0x69, 0x00, "DATA LOSS ON LOGICAL UNIT" },
625 { 0x41, 0x00, "DATA PATH FAILURE (SHOULD USE 40 NN)" },
626 { 0x4B, 0x00, "DATA PHASE ERROR" },
627 { 0x11, 0x07, "DATA RE-SYNCHRONIZATION ERROR" },
628 { 0x16, 0x03, "DATA SYNC ERROR - DATA AUTO-REALLOCATED" },
629 { 0x16, 0x01, "DATA SYNC ERROR - DATA REWRITTEN" },
630 { 0x16, 0x04, "DATA SYNC ERROR - RECOMMEND REASSIGNMENT" },
631 { 0x16, 0x02, "DATA SYNC ERROR - RECOMMEND REWRITE" },
632 { 0x16, 0x00, "DATA SYNCHRONIZATION MARK ERROR" },
633 { 0x11, 0x0D, "DE-COMPRESSION CRC ERROR" },
634 { 0x71, 0x00, "DECOMPRESSION EXCEPTION LONG ALGORITHM ID" },
635 { 0x70, 0xFF, "DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF NN" },
636 { 0x19, 0x00, "DEFECT LIST ERROR" },
637 { 0x19, 0x03, "DEFECT LIST ERROR IN GROWN LIST" },
638 { 0x19, 0x02, "DEFECT LIST ERROR IN PRIMARY LIST" },
639 { 0x19, 0x01, "DEFECT LIST NOT AVAILABLE" },
640 { 0x1C, 0x00, "DEFECT LIST NOT FOUND" },
641 { 0x32, 0x01, "DEFECT LIST UPDATE FAILURE" },
642 { 0x29, 0x04, "DEVICE INTERNAL RESET" },
643 { 0x40, 0xFF, "DIAGNOSTIC FAILURE ON COMPONENT NN (80H-FFH)" },
644 { 0x66, 0x02, "DOCUMENT JAM IN AUTOMATIC DOCUMENT FEEDER" },
645 { 0x66, 0x03, "DOCUMENT MISS FEED AUTOMATIC IN DOCUMENT FEEDER" },
646 { 0x72, 0x04, "EMPTY OR PARTIALLY WRITTEN RESERVED TRACK" },
647 { 0x34, 0x00, "ENCLOSURE FAILURE" },
648 { 0x35, 0x00, "ENCLOSURE SERVICES FAILURE" },
649 { 0x35, 0x03, "ENCLOSURE SERVICES TRANSFER FAILURE" },
650 { 0x35, 0x04, "ENCLOSURE SERVICES TRANSFER REFUSED" },
651 { 0x35, 0x02, "ENCLOSURE SERVICES UNAVAILABLE" },
652 { 0x3B, 0x0F, "END OF MEDIUM REACHED" },
653 { 0x63, 0x00, "END OF USER AREA ENCOUNTERED ON THIS TRACK" },
654 { 0x00, 0x05, "END-OF-DATA DETECTED" },
655 { 0x14, 0x03, "END-OF-DATA NOT FOUND" },
656 { 0x00, 0x02, "END-OF-PARTITION/MEDIUM DETECTED" },
657 { 0x51, 0x00, "ERASE FAILURE" },
658 { 0x0A, 0x00, "ERROR LOG OVERFLOW" },
659 { 0x11, 0x10, "ERROR READING ISRC NUMBER" },
660 { 0x11, 0x0F, "ERROR READING UPC/EAN NUMBER" },
661 { 0x11, 0x02, "ERROR TOO LONG TO CORRECT" },
662 { 0x03, 0x02, "EXCESSIVE WRITE ERRORS" },
663 { 0x67, 0x04, "EXCHANGE OF LOGICAL UNIT FAILED" },
664 { 0x3B, 0x07, "FAILED TO SENSE BOTTOM-OF-FORM" },
665 { 0x3B, 0x06, "FAILED TO SENSE TOP-OF-FORM" },
666 { 0x5D, 0x00, "FAILURE PREDICTION THRESHOLD EXCEEDED" },
667 { 0x5D, 0xFF, "FAILURE PREDICTION THRESHOLD EXCEEDED (FALSE)" },
668 { 0x00, 0x01, "FILEMARK DETECTED" },
669 { 0x14, 0x02, "FILEMARK OR SETMARK NOT FOUND" },
670 { 0x09, 0x02, "FOCUS SERVO FAILURE" },
671 { 0x31, 0x01, "FORMAT COMMAND FAILED" },
672 { 0x58, 0x00, "GENERATION DOES NOT EXIST" },
673 { 0x1C, 0x02, "GROWN DEFECT LIST NOT FOUND" },
674 { 0x27, 0x01, "HARDWARE WRITE PROTECTED" },
675 { 0x09, 0x04, "HEAD SELECT FAULT" },
676 { 0x00, 0x06, "I/O PROCESS TERMINATED" },
677 { 0x10, 0x00, "ID CRC OR ECC ERROR" },
678 { 0x5E, 0x03, "IDLE CONDITION ACTIVATED BY COMMAND" },
679 { 0x5E, 0x01, "IDLE CONDITION ACTIVATED BY TIMER" },
680 { 0x22, 0x00, "ILLEGAL FUNCTION (USE 20 00, 24 00, OR 26 00)" },
681 { 0x64, 0x00, "ILLEGAL MODE FOR THIS TRACK" },
682 { 0x28, 0x01, "IMPORT OR EXPORT ELEMENT ACCESSED" },
683 { 0x30, 0x00, "INCOMPATIBLE MEDIUM INSTALLED" },
684 { 0x11, 0x08, "INCOMPLETE BLOCK READ" },
685 { 0x6A, 0x00, "INFORMATIONAL, REFER TO LOG" },
686 { 0x48, 0x00, "INITIATOR DETECTED ERROR MESSAGE RECEIVED" },
687 { 0x3F, 0x03, "INQUIRY DATA HAS CHANGED" },
688 { 0x44, 0x00, "INTERNAL TARGET FAILURE" },
689 { 0x3D, 0x00, "INVALID BITS IN IDENTIFY MESSAGE" },
690 { 0x2C, 0x02, "INVALID COMBINATION OF WINDOWS SPECIFIED" },
691 { 0x20, 0x00, "INVALID COMMAND OPERATION CODE" },
692 { 0x21, 0x01, "INVALID ELEMENT ADDRESS" },
693 { 0x24, 0x00, "INVALID FIELD IN CDB" },
694 { 0x26, 0x00, "INVALID FIELD IN PARAMETER LIST" },
695 { 0x49, 0x00, "INVALID MESSAGE ERROR" },
696 { 0x64, 0x01, "INVALID PACKET SIZE" },
697 { 0x26, 0x04, "INVALID RELEASE OF ACTIVE PERSISTENT RESERVATION" },
698 { 0x11, 0x05, "L-EC UNCORRECTABLE ERROR" },
699 { 0x60, 0x00, "LAMP FAILURE" },
700 { 0x5B, 0x02, "LOG COUNTER AT MAXIMUM" },
701 { 0x5B, 0x00, "LOG EXCEPTION" },
702 { 0x5B, 0x03, "LOG LIST CODES EXHAUSTED" },
703 { 0x2A, 0x02, "LOG PARAMETERS CHANGED" },
704 { 0x21, 0x00, "LOGICAL BLOCK ADDRESS OUT OF RANGE" },
705 { 0x08, 0x03, "LOGICAL UNIT COMMUNICATION CRC ERROR (ULTRA-DMA/32)" },
706 { 0x08, 0x00, "LOGICAL UNIT COMMUNICATION FAILURE" },
707 { 0x08, 0x02, "LOGICAL UNIT COMMUNICATION PARITY ERROR" },
708 { 0x08, 0x01, "LOGICAL UNIT COMMUNICATION TIME-OUT" },
709 { 0x05, 0x00, "LOGICAL UNIT DOES NOT RESPOND TO SELECTION" },
710 { 0x4C, 0x00, "LOGICAL UNIT FAILED SELF-CONFIGURATION" },
711 { 0x3E, 0x01, "LOGICAL UNIT FAILURE" },
712 { 0x3E, 0x00, "LOGICAL UNIT HAS NOT SELF-CONFIGURED YET" },
713 { 0x04, 0x01, "LOGICAL UNIT IS IN PROCESS OF BECOMING READY" },
714 { 0x68, 0x00, "LOGICAL UNIT NOT CONFIGURED" },
715 { 0x04, 0x00, "LOGICAL UNIT NOT READY, CAUSE NOT REPORTABLE" },
716 { 0x04, 0x04, "LOGICAL UNIT NOT READY, FORMAT IN PROGRESS" },
717 { 0x04, 0x02, "LOGICAL UNIT NOT READY, INITIALIZING CMD. REQUIRED" },
718 { 0x04, 0x08, "LOGICAL UNIT NOT READY, LONG WRITE IN PROGRESS" },
719 { 0x04, 0x03, "LOGICAL UNIT NOT READY, MANUAL INTERVENTION REQUIRED" },
720 { 0x04, 0x07, "LOGICAL UNIT NOT READY, OPERATION IN PROGRESS" },
721 { 0x04, 0x05, "LOGICAL UNIT NOT READY, REBUILD IN PROGRESS" },
722 { 0x04, 0x06, "LOGICAL UNIT NOT READY, RECALCULATION IN PROGRESS" },
723 { 0x25, 0x00, "LOGICAL UNIT NOT SUPPORTED" },
724 { 0x27, 0x02, "LOGICAL UNIT SOFTWARE WRITE PROTECTED" },
725 { 0x5E, 0x00, "LOW POWER CONDITION ON" },
726 { 0x15, 0x01, "MECHANICAL POSITIONING ERROR" },
727 { 0x53, 0x00, "MEDIA LOAD OR EJECT FAILED" },
728 { 0x3B, 0x0D, "MEDIUM DESTINATION ELEMENT FULL" },
729 { 0x31, 0x00, "MEDIUM FORMAT CORRUPTED" },
730 { 0x3B, 0x13, "MEDIUM MAGAZINE INSERTED" },
731 { 0x3B, 0x14, "MEDIUM MAGAZINE LOCKED" },
732 { 0x3B, 0x11, "MEDIUM MAGAZINE NOT ACCESSIBLE" },
733 { 0x3B, 0x12, "MEDIUM MAGAZINE REMOVED" },
734 { 0x3B, 0x15, "MEDIUM MAGAZINE UNLOCKED" },
735 { 0x3A, 0x00, "MEDIUM NOT PRESENT" },
736 { 0x3A, 0x01, "MEDIUM NOT PRESENT - TRAY CLOSED" },
737 { 0x3A, 0x02, "MEDIUM NOT PRESENT - TRAY OPEN" },
738 { 0x53, 0x02, "MEDIUM REMOVAL PREVENTED" },
739 { 0x3B, 0x0E, "MEDIUM SOURCE ELEMENT EMPTY" },
740 { 0x43, 0x00, "MESSAGE ERROR" },
741 { 0x3F, 0x01, "MICROCODE HAS BEEN CHANGED" },
742 { 0x1D, 0x00, "MISCOMPARE DURING VERIFY OPERATION" },
743 { 0x11, 0x0A, "MISCORRECTED ERROR" },
744 { 0x2A, 0x01, "MODE PARAMETERS CHANGED" },
745 { 0x67, 0x03, "MODIFICATION OF LOGICAL UNIT FAILED" },
746 { 0x69, 0x01, "MULTIPLE LOGICAL UNIT FAILURES" },
747 { 0x07, 0x00, "MULTIPLE PERIPHERAL DEVICES SELECTED" },
748 { 0x11, 0x03, "MULTIPLE READ ERRORS" },
749 { 0x00, 0x00, "NO ADDITIONAL SENSE INFORMATION" },
750 { 0x00, 0x15, "NO CURRENT AUDIO STATUS TO RETURN" },
751 { 0x32, 0x00, "NO DEFECT SPARE LOCATION AVAILABLE" },
752 { 0x11, 0x09, "NO GAP FOUND" },
753 { 0x01, 0x00, "NO INDEX/SECTOR SIGNAL" },
754 { 0x06, 0x00, "NO REFERENCE POSITION FOUND" },
755 { 0x02, 0x00, "NO SEEK COMPLETE" },
756 { 0x03, 0x01, "NO WRITE CURRENT" },
757 { 0x28, 0x00, "NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED" },
758 { 0x00, 0x16, "OPERATION IN PROGRESS" },
759 { 0x5A, 0x01, "OPERATOR MEDIUM REMOVAL REQUEST" },
760 { 0x5A, 0x00, "OPERATOR REQUEST OR STATE CHANGE INPUT" },
761 { 0x5A, 0x03, "OPERATOR SELECTED WRITE PERMIT" },
762 { 0x5A, 0x02, "OPERATOR SELECTED WRITE PROTECT" },
763 { 0x61, 0x02, "OUT OF FOCUS" },
764 { 0x4E, 0x00, "OVERLAPPED COMMANDS ATTEMPTED" },
765 { 0x2D, 0x00, "OVERWRITE ERROR ON UPDATE IN PLACE" },
766 { 0x63, 0x01, "PACKET DOES NOT FIT IN AVAILABLE SPACE" },
767 { 0x3B, 0x05, "PAPER JAM" },
768 { 0x1A, 0x00, "PARAMETER LIST LENGTH ERROR" },
769 { 0x26, 0x01, "PARAMETER NOT SUPPORTED" },
770 { 0x26, 0x02, "PARAMETER VALUE INVALID" },
771 { 0x2A, 0x00, "PARAMETERS CHANGED" },
772 { 0x69, 0x02, "PARITY/DATA MISMATCH" },
773 { 0x1F, 0x00, "PARTIAL DEFECT LIST TRANSFER" },
774 { 0x03, 0x00, "PERIPHERAL DEVICE WRITE FAULT" },
775 { 0x27, 0x05, "PERMANENT WRITE PROTECT" },
776 { 0x27, 0x04, "PERSISTENT WRITE PROTECT" },
777 { 0x50, 0x02, "POSITION ERROR RELATED TO TIMING" },
778 { 0x3B, 0x0C, "POSITION PAST BEGINNING OF MEDIUM" },
779 { 0x3B, 0x0B, "POSITION PAST END OF MEDIUM" },
780 { 0x15, 0x02, "POSITIONING ERROR DETECTED BY READ OF MEDIUM" },
781 { 0x73, 0x01, "POWER CALIBRATION AREA ALMOST FULL" },
782 { 0x73, 0x03, "POWER CALIBRATION AREA ERROR" },
783 { 0x73, 0x02, "POWER CALIBRATION AREA IS FULL" },
784 { 0x29, 0x01, "POWER ON OCCURRED" },
785 { 0x29, 0x00, "POWER ON, RESET, OR BUS DEVICE RESET OCCURRED" },
786 { 0x42, 0x00, "POWER-ON OR SELF-TEST FAILURE (SHOULD USE 40 NN)" },
787 { 0x1C, 0x01, "PRIMARY DEFECT LIST NOT FOUND" },
788 { 0x73, 0x05, "PROGRAM MEMORY AREA IS FULL" },
789 { 0x73, 0x04, "PROGRAM MEMORY AREA UPDATE FAILURE" },
790 { 0x40, 0x00, "RAM FAILURE (SHOULD USE 40 NN)" },
791 { 0x15, 0x00, "RANDOM POSITIONING ERROR" },
792 { 0x11, 0x11, "READ ERROR - LOSS OF STREAMING" },
793 { 0x3B, 0x0A, "READ PAST BEGINNING OF MEDIUM" },
794 { 0x3B, 0x09, "READ PAST END OF MEDIUM" },
795 { 0x11, 0x01, "READ RETRIES EXHAUSTED" },
796 { 0x6C, 0x00, "REBUILD FAILURE OCCURRED" },
797 { 0x6D, 0x00, "RECALCULATE FAILURE OCCURRED" },
798 { 0x14, 0x01, "RECORD NOT FOUND" },
799 { 0x14, 0x06, "RECORD NOT FOUND - DATA AUTO-REALLOCATED" },
800 { 0x14, 0x05, "RECORD NOT FOUND - RECOMMEND REASSIGNMENT" },
801 { 0x14, 0x00, "RECORDED ENTITY NOT FOUND" },
802 { 0x18, 0x02, "RECOVERED DATA - DATA AUTO-REALLOCATED" },
803 { 0x18, 0x05, "RECOVERED DATA - RECOMMEND REASSIGNMENT" },
804 { 0x18, 0x06, "RECOVERED DATA - RECOMMEND REWRITE" },
805 { 0x17, 0x05, "RECOVERED DATA USING PREVIOUS SECTOR ID" },
806 { 0x18, 0x03, "RECOVERED DATA WITH CIRC" },
807 { 0x18, 0x07, "RECOVERED DATA WITH ECC - DATA REWRITTEN" },
808 { 0x18, 0x01, "RECOVERED DATA WITH ERROR CORR. & RETRIES APPLIED" },
809 { 0x18, 0x00, "RECOVERED DATA WITH ERROR CORRECTION APPLIED" },
810 { 0x18, 0x04, "RECOVERED DATA WITH L-EC" },
811 { 0x17, 0x03, "RECOVERED DATA WITH NEGATIVE HEAD OFFSET" },
812 { 0x17, 0x00, "RECOVERED DATA WITH NO ERROR CORRECTION APPLIED" },
813 { 0x17, 0x02, "RECOVERED DATA WITH POSITIVE HEAD OFFSET" },
814 { 0x17, 0x01, "RECOVERED DATA WITH RETRIES" },
815 { 0x17, 0x04, "RECOVERED DATA WITH RETRIES AND/OR CIRC APPLIED" },
816 { 0x17, 0x06, "RECOVERED DATA WITHOUT ECC - DATA AUTO-REALLOCATED" },
817 { 0x17, 0x09, "RECOVERED DATA WITHOUT ECC - DATA REWRITTEN" },
818 { 0x17, 0x07, "RECOVERED DATA WITHOUT ECC - RECOMMEND REASSIGNMENT" },
819 { 0x17, 0x08, "RECOVERED DATA WITHOUT ECC - RECOMMEND REWRITE" },
820 { 0x1E, 0x00, "RECOVERED ID WITH ECC CORRECTION" },
821 { 0x6B, 0x01, "REDUNDANCY LEVEL GOT BETTER" },
822 { 0x6B, 0x02, "REDUNDANCY LEVEL GOT WORSE" },
823 { 0x67, 0x05, "REMOVE OF LOGICAL UNIT FAILED" },
824 { 0x3B, 0x08, "REPOSITION ERROR" },
825 { 0x2A, 0x03, "RESERVATIONS PREEMPTED" },
826 { 0x36, 0x00, "RIBBON, INK, OR TONER FAILURE" },
827 { 0x37, 0x00, "ROUNDED PARAMETER" },
828 { 0x5C, 0x00, "RPL STATUS CHANGE" },
829 { 0x39, 0x00, "SAVING PARAMETERS NOT SUPPORTED" },
830 { 0x62, 0x00, "SCAN HEAD POSITIONING ERROR" },
831 { 0x29, 0x02, "SCSI BUS RESET OCCURRED" },
832 { 0x47, 0x00, "SCSI PARITY ERROR" },
833 { 0x54, 0x00, "SCSI TO HOST SYSTEM INTERFACE FAILURE" },
834 { 0x45, 0x00, "SELECT OR RESELECT FAILURE" },
835 { 0x3B, 0x00, "SEQUENTIAL POSITIONING ERROR" },
836 { 0x72, 0x00, "SESSION FIXATION ERROR" },
837 { 0x72, 0x03, "SESSION FIXATION ERROR - INCOMPLETE TRACK IN SESSION" },
838 { 0x72, 0x01, "SESSION FIXATION ERROR WRITING LEAD-IN" },
839 { 0x72, 0x02, "SESSION FIXATION ERROR WRITING LEAD-OUT" },
840 { 0x00, 0x03, "SETMARK DETECTED" },
841 { 0x3B, 0x04, "SLEW FAILURE" },
842 { 0x09, 0x03, "SPINDLE SERVO FAILURE" },
843 { 0x5C, 0x02, "SPINDLES NOT SYNCHRONIZED" },
844 { 0x5C, 0x01, "SPINDLES SYNCHRONIZED" },
845 { 0x5E, 0x04, "STANDBY CONDITION ACTIVATED BY COMMAND" },
846 { 0x5E, 0x02, "STANDBY CONDITION ACTIVATED BY TIMER" },
847 { 0x6B, 0x00, "STATE CHANGE HAS OCCURRED" },
848 { 0x1B, 0x00, "SYNCHRONOUS DATA TRANSFER ERROR" },
849 { 0x55, 0x01, "SYSTEM BUFFER FULL" },
850 { 0x55, 0x00, "SYSTEM RESOURCE FAILURE" },
851 { 0x4D, 0xFF, "TAGGED OVERLAPPED COMMANDS (NN = QUEUE TAG)" },
852 { 0x33, 0x00, "TAPE LENGTH ERROR" },
853 { 0x3B, 0x03, "TAPE OR ELECTRONIC VERTICAL FORMS UNIT NOT READY" },
854 { 0x3B, 0x01, "TAPE POSITION ERROR AT BEGINNING-OF-MEDIUM" },
855 { 0x3B, 0x02, "TAPE POSITION ERROR AT END-OF-MEDIUM" },
856 { 0x3F, 0x00, "TARGET OPERATING CONDITIONS HAVE CHANGED" },
857 { 0x5B, 0x01, "THRESHOLD CONDITION MET" },
858 { 0x26, 0x03, "THRESHOLD PARAMETERS NOT SUPPORTED" },
859 { 0x3E, 0x02, "TIMEOUT ON LOGICAL UNIT" },
860 { 0x2C, 0x01, "TOO MANY WINDOWS SPECIFIED" },
861 { 0x09, 0x00, "TRACK FOLLOWING ERROR" },
862 { 0x09, 0x01, "TRACKING SERVO FAILURE" },
863 { 0x61, 0x01, "UNABLE TO ACQUIRE VIDEO" },
864 { 0x57, 0x00, "UNABLE TO RECOVER TABLE-OF-CONTENTS" },
865 { 0x53, 0x01, "UNLOAD TAPE FAILURE" },
866 { 0x11, 0x00, "UNRECOVERED READ ERROR" },
867 { 0x11, 0x04, "UNRECOVERED READ ERROR - AUTO REALLOCATE FAILED" },
868 { 0x11, 0x0B, "UNRECOVERED READ ERROR - RECOMMEND REASSIGNMENT" },
869 { 0x11, 0x0C, "UNRECOVERED READ ERROR - RECOMMEND REWRITE THE DATA" },
870 { 0x46, 0x00, "UNSUCCESSFUL SOFT RESET" },
871 { 0x35, 0x01, "UNSUPPORTED ENCLOSURE FUNCTION" },
872 { 0x59, 0x00, "UPDATED BLOCK READ" },
873 { 0x61, 0x00, "VIDEO ACQUISITION ERROR" },
874 { 0x65, 0x00, "VOLTAGE FAULT" },
875 { 0x0B, 0x00, "WARNING" },
876 { 0x0B, 0x02, "WARNING - ENCLOSURE DEGRADED" },
877 { 0x0B, 0x01, "WARNING - SPECIFIED TEMPERATURE EXCEEDED" },
878 { 0x50, 0x00, "WRITE APPEND ERROR" },
879 { 0x50, 0x01, "WRITE APPEND POSITION ERROR" },
880 { 0x0C, 0x00, "WRITE ERROR" },
881 { 0x0C, 0x02, "WRITE ERROR - AUTO REALLOCATION FAILED" },
882 { 0x0C, 0x09, "WRITE ERROR - LOSS OF STREAMING" },
883 { 0x0C, 0x0A, "WRITE ERROR - PADDING BLOCKS ADDED" },
884 { 0x0C, 0x03, "WRITE ERROR - RECOMMEND REASSIGNMENT" },
885 { 0x0C, 0x01, "WRITE ERROR - RECOVERED WITH AUTO REALLOCATION" },
886 { 0x0C, 0x08, "WRITE ERROR - RECOVERY FAILED" },
887 { 0x0C, 0x07, "WRITE ERROR - RECOVERY NEEDED" },
888 { 0x27, 0x00, "WRITE PROTECTED" },
889};
890
891/**
892 * Return the plain text of an ATA command for debugging purposes.
893 * Don't allocate the string as we use this function in Log() statements.
894 */
895const char * ATACmdText(uint8_t uCmd)
896{
897 AssertCompile(RT_ELEMENTS(g_apszATACmdNames) == (1 << (8*sizeof(uCmd))));
898 return g_apszATACmdNames[uCmd];
899}
900
901/**
902 * Return the plain text of a SCSI command for debugging purposes.
903 * Don't allocate the string as we use this function in Log() statements.
904 */
905const char * SCSICmdText(uint8_t uCmd)
906{
907 AssertCompile(RT_ELEMENTS(g_apszSCSICmdNames) == (1 << (8*sizeof(uCmd))));
908 return g_apszSCSICmdNames[uCmd];
909}
910
911/**
912 * Return the plain text of a SCSI sense code.
913 * Don't allocate the string as we use this function in Log() statements.
914 */
915const char * SCSISenseText(uint8_t uSense)
916{
917 if (uSense < RT_ELEMENTS(g_apszSCSISenseNames))
918 return g_apszSCSISenseNames[uSense];
919
920 return "(SCSI sense out of range)";
921}
922
923/**
924 * Return the plain text of an extended SCSI sense key.
925 * Don't allocate the string as we use this function in Log() statements.
926 */
927const char * SCSISenseExtText(uint8_t uASC, uint8_t uASCQ)
928{
929 unsigned iIdx;
930
931 /* Linear search. Doesn't hurt as we don't call this function very frequently */
932 for (iIdx = 0; iIdx < RT_ELEMENTS(g_aSCSISenseText); iIdx++)
933 {
934 if ( g_aSCSISenseText[iIdx].uASC == uASC
935 && ( g_aSCSISenseText[iIdx].uASCQ == uASCQ
936 || g_aSCSISenseText[iIdx].uASCQ == 0xff))
937 return g_aSCSISenseText[iIdx].pszSenseText;
938 }
939 return "(Unknown extended sense code)";
940}
941
942/**
943 * Log the write parameters mode page into a given buffer.
944 */
945static int scsiLogWriteParamsModePage(char *pszBuffer, size_t cchBuffer,
946 uint8_t *pbModePage, size_t cbModePage)
947{
948 size_t cch = 0;
949 const char *pcsz = NULL;
950
951 switch (pbModePage[2] & 0x0f)
952 {
953 case 0x00: pcsz = "Packet/Incremental"; break;
954 case 0x01: pcsz = "Track At Once"; break;
955 case 0x02: pcsz = "Session At Once"; break;
956 case 0x03: pcsz = "RAW"; break;
957 case 0x04: pcsz = "Layer Jump Recording"; break;
958 default : pcsz = "Unknown/Reserved Write Type"; break;
959 }
960
961 cch = RTStrPrintf(pszBuffer, cchBuffer, "BUFE=%d LS_V=%d TestWrite=%d WriteType=%s\n",
962 pbModePage[2] & RT_BIT(6) ? 1 : 0,
963 pbModePage[2] & RT_BIT(5) ? 1 : 0,
964 pbModePage[2] & RT_BIT(4) ? 1 : 0,
965 pcsz);
966 pszBuffer += cch;
967 cchBuffer -= cch;
968 if (!cchBuffer)
969 return VERR_BUFFER_OVERFLOW;
970
971 switch ((pbModePage[3] & 0xc0) >> 6)
972 {
973 case 0x00: pcsz = "No B0 pointer, no next session"; break;
974 case 0x01: pcsz = "B0 pointer=FF:FF:FF, no next session"; break;
975 case 0x02: pcsz = "Reserved"; break;
976 case 0x03: pcsz = "Next session allowed"; break;
977 default: pcsz = "Impossible multi session field value"; break;
978 }
979
980 cch = RTStrPrintf(pszBuffer, cchBuffer, "MultiSession=%s FP=%d Copy=%d TrackMode=%d\n",
981 pcsz,
982 pbModePage[3] & RT_BIT(5) ? 1 : 0,
983 pbModePage[3] & RT_BIT(4) ? 1 : 0,
984 pbModePage[3] & 0x0f);
985 pszBuffer += cch;
986 cchBuffer -= cch;
987 if (!cchBuffer)
988 return VERR_BUFFER_OVERFLOW;
989
990 switch (pbModePage[4] & 0x0f)
991 {
992 case 0: pcsz = "Raw data (2352)"; break;
993 case 1: pcsz = "Raw data with P and Q Sub-channel (2368)"; break;
994 case 2: pcsz = "Raw data with P-W Sub-channel (2448)"; break;
995 case 3: pcsz = "Raw data with raw P-W Sub-channel (2448)"; break;
996 case 8: pcsz = "Mode 1 (ISO/IEC 10149) (2048)"; break;
997 case 9: pcsz = "Mode 2 (ISO/IEC 10149) (2336)"; break;
998 case 10: pcsz = "Mode 2 (CD-ROM XA, form 1) (2048)"; break;
999 case 11: pcsz = "Mode 2 (CD-ROM XA, form 1) (2056)"; break;
1000 case 12: pcsz = "Mode 2 (CD-ROM XA, form 2) (2324)"; break;
1001 case 13: pcsz = "Mode 2 (CD-ROM XA, form 1, form 2 or mixed form) (2332)"; break;
1002 default: pcsz = "Reserved or vendor specific Data Block Type Code"; break;
1003 }
1004
1005 cch = RTStrPrintf(pszBuffer, cchBuffer, "DataBlockType=%d (%s)\n",
1006 pbModePage[4] & 0x0f,
1007 pcsz);
1008 pszBuffer += cch;
1009 cchBuffer -= cch;
1010 if (!cchBuffer)
1011 return VERR_BUFFER_OVERFLOW;
1012
1013 cch = RTStrPrintf(pszBuffer, cchBuffer, "LinkSize=%d\n", pbModePage[5]);
1014 pszBuffer += cch;
1015 cchBuffer -= cch;
1016 if (!cchBuffer)
1017 return VERR_BUFFER_OVERFLOW;
1018
1019 cch = RTStrPrintf(pszBuffer, cchBuffer, "HostApplicationCode=%d\n",
1020 pbModePage[7] & 0x3f);
1021 pszBuffer += cch;
1022 cchBuffer -= cch;
1023 if (!cchBuffer)
1024 return VERR_BUFFER_OVERFLOW;
1025
1026 switch (pbModePage[8])
1027 {
1028 case 0x00: pcsz = "CD-DA or CD-ROM or other data discs"; break;
1029 case 0x10: pcsz = "CD-I Disc"; break;
1030 case 0x20: pcsz = "CD-ROM XA Disc"; break;
1031 default: pcsz = "Reserved"; break;
1032 }
1033
1034 cch = RTStrPrintf(pszBuffer, cchBuffer, "SessionFormat=%d (%s)\n",
1035 pbModePage[8], pcsz);
1036 pszBuffer += cch;
1037 cchBuffer -= cch;
1038 if (!cchBuffer)
1039 return VERR_BUFFER_OVERFLOW;
1040
1041 return VINF_SUCCESS;
1042}
1043
1044/**
1045 * Log a mode page in a human readable form.
1046 *
1047 * @returns VBox status code.
1048 * @retval VERR_BUFFER_OVERFLOW if the given buffer is not large enough.
1049 * The buffer might contain valid data though.
1050 * @param pszBuffer The buffer to log into.
1051 * @param cchBuffer Size of the buffer in characters.
1052 * @param pbModePage The mode page buffer.
1053 * @param cbModePage Size of the mode page buffer in bytes.
1054 */
1055int SCSILogModePage(char *pszBuffer, size_t cchBuffer, uint8_t *pbModePage,
1056 size_t cbModePage)
1057{
1058 int rc = VINF_SUCCESS;
1059 uint8_t uModePage;
1060 const char *pcszModePage = NULL;
1061 size_t cch = 0;
1062
1063 uModePage = pbModePage[0] & 0x3f;
1064 switch (uModePage)
1065 {
1066 case 0x05: pcszModePage = "Write Parameters"; break;
1067 default:
1068 pcszModePage = "Unknown mode page";
1069 }
1070
1071 cch = RTStrPrintf(pszBuffer, cchBuffer, "Byte 0: PS=%d, Page code=%d (%s)\n",
1072 pbModePage[0] & 0x80 ? 1 : 0, uModePage, pcszModePage);
1073 pszBuffer += cch;
1074 cchBuffer -= cch;
1075 if (!cchBuffer)
1076 return VERR_BUFFER_OVERFLOW;
1077
1078 cch = RTStrPrintf(pszBuffer, cchBuffer, "Byte 1: Page length=%u\n", pbModePage[1]);
1079 pszBuffer += cch;
1080 cchBuffer -= cch;
1081 if (!cchBuffer)
1082 return VERR_BUFFER_OVERFLOW;
1083
1084 switch (uModePage)
1085 {
1086 case 0x05:
1087 rc = scsiLogWriteParamsModePage(pszBuffer, cchBuffer, pbModePage, cbModePage);
1088 break;
1089 default:
1090 break;
1091 }
1092
1093 return rc;
1094}
1095
1096/**
1097 * Log a cue sheet in a human readable form.
1098 *
1099 * @returns VBox status code.
1100 * @retval VERR_BUFFER_OVERFLOW if the given buffer is not large enough.
1101 * The buffer might contain valid data though.
1102 * @param pszBuffer The buffer to log into.
1103 * @param cchBuffer Size of the buffer in characters.
1104 * @param pbCueSheet The cue sheet buffer.
1105 * @param cbCueSheet Size of the cue sheet buffer in bytes.
1106 */
1107int SCSILogCueSheet(char *pszBuffer, size_t cchBuffer, uint8_t *pbCueSheet,
1108 size_t cbCueSheet)
1109{
1110 int rc = VINF_SUCCESS;
1111 size_t cch = 0;
1112 unsigned cCueSheetEntries = cbCueSheet / 8;
1113
1114 AssertReturn(cbCueSheet % 8 == 0, VERR_INVALID_PARAMETER);
1115
1116 for (unsigned i = 0; i < cCueSheetEntries; i++)
1117 {
1118 cch = RTStrPrintf(pszBuffer, cchBuffer,
1119 "CTL/ADR=%#x TNO=%#x INDEX=%#x DATA=%#x SCMS=%#x TIME=%u:%u:%u\n",
1120 pbCueSheet[0], pbCueSheet[1], pbCueSheet[2], pbCueSheet[3],
1121 pbCueSheet[4], pbCueSheet[5], pbCueSheet[6], pbCueSheet[7]);
1122 pszBuffer += cch;
1123 cchBuffer -= cch;
1124 if (!cchBuffer)
1125 {
1126 rc = VERR_BUFFER_OVERFLOW;
1127 break;
1128 }
1129
1130 pbCueSheet += 8;
1131 cbCueSheet -= 8;
1132 }
1133
1134 return rc;
1135}
1136
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette