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