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