1 /* $NetBSD: scsipi_verbose.c,v 1.35 2021/06/05 22:21:15 pgoyette Exp $ */
2
3 /*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.35 2021/06/05 22:21:15 pgoyette Exp $");
34
35 #include <sys/param.h>
36 #include <sys/time.h>
37 #include <sys/proc.h>
38 #include <sys/device.h>
39
40 #ifdef _KERNEL
41 #include <sys/systm.h>
42 #include <sys/module.h>
43 #else
44 #include <stdio.h>
45 #endif
46 #include <dev/scsipi/scsipi_all.h>
47 #include <dev/scsipi/scsipiconf.h>
48 #include <dev/scsipi/scsiconf.h>
49
50 int scsipi_print_sense_real(struct scsipi_xfer *, int);
51 void scsipi_print_sense_data_real(struct scsi_sense_data *, int);
52 static char *scsipi_decode_sense(void *, int);
53
54 static const char *sense_keys[16] = {
55 "No Additional Sense",
56 "Recovered Error",
57 "Not Ready",
58 "Media Error",
59 "Hardware Error",
60 "Illegal Request",
61 "Unit Attention",
62 "Write Protected",
63 "Blank Check",
64 "Vendor Unique",
65 "Copy Aborted",
66 "Aborted Command",
67 "Equal Error",
68 "Volume Overflow",
69 "Miscompare Error",
70 "Reserved"
71 };
72
73 /*
74 * The current version of this list can be obtained from
75 * <ftp://ftp.t10.org/t10/drafts/spc3/asc-num.txt>
76 */
77
78 static const struct {
79 unsigned char asc;
80 unsigned char ascq;
81 const char *description;
82 } adesc[] = {
83 { 0x00, 0x00, "No Additional Sense Information" },
84 { 0x00, 0x01, "Filemark Detected" },
85 { 0x00, 0x02, "End-Of-Partition/Medium Detected" },
86 { 0x00, 0x03, "Setmark Detected" },
87 { 0x00, 0x04, "Beginning-Of-Partition/Medium Detected" },
88 { 0x00, 0x05, "End-Of-Data Detected" },
89 { 0x00, 0x06, "I/O Process Terminated" },
90 { 0x00, 0x07, "Programmable Early Warning Detected" },
91 { 0x00, 0x11, "Audio Play Operation In Progress" },
92 { 0x00, 0x12, "Audio Play Operation Paused" },
93 { 0x00, 0x13, "Audio Play Operation Successfully Completed" },
94 { 0x00, 0x14, "Audio Play Operation Stopped Due To Error" },
95 { 0x00, 0x15, "No Current Audio Status To Return" },
96 { 0x00, 0x16, "Operation In Progress" },
97 { 0x00, 0x17, "Cleaning Requested" },
98 { 0x00, 0x18, "Erase Operation In Progress" },
99 { 0x00, 0x19, "Locate Operation In Progress" },
100 { 0x00, 0x1A, "Rewind Operation In Progress" },
101 { 0x00, 0x1B, "Set Capacity Operation In Progress" },
102 { 0x00, 0x1C, "Verify Operation In Progress" },
103 { 0x00, 0x1D, "ATA Pass Through Information Available" },
104 { 0x00, 0x1E, "Conflicting SA Creation Request" },
105 { 0x00, 0x1F, "Logical Unit Transitioning To Another Power Condition" },
106 { 0x00, 0x20, "Extended Copy Information Available" },
107 { 0x00, 0x21, "Atomic Command Aborted Due To ACA" },
108 { 0x01, 0x00, "No Index/Sector Signal" },
109 { 0x02, 0x00, "No Seek Complete" },
110 { 0x03, 0x00, "Peripheral Device Write Fault" },
111 { 0x03, 0x01, "No Write Current" },
112 { 0x03, 0x02, "Excessive Write Errors" },
113 { 0x04, 0x00, "Logical Unit Not Ready, Cause Not Reportable" },
114 { 0x04, 0x01, "Logical Unit Is In Process Of Becoming Ready" },
115 { 0x04, 0x02, "Logical Unit Not Ready, Initializing Command Required" },
116 { 0x04, 0x03, "Logical Unit Not Ready, Manual Intervention Required" },
117 { 0x04, 0x04, "Logical Unit Not Ready, Format In Progress" },
118 { 0x04, 0x05, "Logical Unit Not Ready, Rebuild In Progress" },
119 { 0x04, 0x06, "Logical Unit Not Ready, Recalculation In Progress" },
120 { 0x04, 0x07, "Logical Unit Not Ready, Operation In Progress" },
121 { 0x04, 0x08, "Logical Unit Not Ready, Long Write In Progress" },
122 { 0x04, 0x09, "Logical Unit Not Ready, Self-Test In Progress" },
123 { 0x04, 0x0A, "Logical Unit Not Accessible, Asymmetric Access State "
124 "Transition" },
125 { 0x04, 0x0B, "Logical Unit Not Accessible, Target Port In Standby State" },
126 { 0x04, 0x0C, "Logical Unit Not Accessible, Target Port In Unavailable State" },
127 { 0x04, 0x0D, "Logical Unit Not Ready, Structure Check Required" },
128 { 0x04, 0x0E, "Logical Unit Not Ready, Security Session In Progress" },
129 { 0x04, 0x10, "Logical Unit Not Ready, Auxiliary Memory Not Accessible" },
130 { 0x04, 0x11, "Logical Unit Not Ready, Notify (Enable Spinup) Required" },
131 { 0x04, 0x12, "Logical Unit Not Ready, Offline" },
132 { 0x04, 0x13, "Logical Unit Not Ready, SA Creation In Progress" },
133 { 0x04, 0x14, "Logical Unit Not Ready, Space Allocation In Progress" },
134 { 0x04, 0x15, "Logical Unit Not Ready, Robotics Disabled" },
135 { 0x04, 0x16, "Logical Unit Not Ready, Configuration Required" },
136 { 0x04, 0x17, "Logical Unit Not Ready, Calibration Required" },
137 { 0x04, 0x18, "Logical Unit Not Ready, A Door Is Open" },
138 { 0x04, 0x19, "Logical Unit Not Ready, Operating In Sequential Mode" },
139 { 0x04, 0x1A, "Logical Unit Not Ready, Start Stop Unit Command In Progress" },
140 { 0x04, 0x1B, "Logical Unit Not Ready, Sanitize In Progress" },
141 { 0x04, 0x1C, "Logical Unit Not Ready, Additional Power Use Not Yet Granted" },
142 { 0x04, 0x1D, "Logical Unit Not Ready, Configuration In Progress" },
143 { 0x04, 0x1E, "Logical Unit Not Ready, Microcode Activation Required" },
144 { 0x04, 0x1F, "Logical Unit Not Ready, Microcode Download Required" },
145 { 0x04, 0x20, "Logical Unit Not Ready, Logical Unit Reset Required" },
146 { 0x04, 0x21, "Logical Unit Not Ready, Hard Reset Required" },
147 { 0x04, 0x22, "Logical Unit Not Ready, Power Cycle Required" },
148 { 0x04, 0x23, "Logical Unit Not Ready, Affiliation Required" },
149 { 0x05, 0x00, "Logical Unit Does Not Respond To Selection" },
150 { 0x06, 0x00, "No Reference Position Found" },
151 { 0x07, 0x00, "Multiple Peripheral Devices Selected" },
152 { 0x08, 0x00, "Logical Unit Communication Failure" },
153 { 0x08, 0x01, "Logical Unit Communication Timeout" },
154 { 0x08, 0x02, "Logical Unit Communication Parity Error" },
155 { 0x08, 0x03, "Logical Unit Communication CRC Error (Ultra-Dma/32)" },
156 { 0x08, 0x04, "Unreachable Copy Target" },
157 { 0x09, 0x00, "Track Following Error" },
158 { 0x09, 0x01, "Tracking Servo Failure" },
159 { 0x09, 0x02, "Focus Servo Failure" },
160 { 0x09, 0x03, "Spindle Servo Failure" },
161 { 0x09, 0x04, "Head Select Fault" },
162 { 0x09, 0x05, "Vibration Induced Tracking Error" },
163 { 0x0A, 0x00, "Error Log Overflow" },
164 { 0x0B, 0x00, "Warning" },
165 { 0x0B, 0x01, "Warning - Specified Temperature Exceeded" },
166 { 0x0B, 0x02, "Warning - Enclosure Degraded" },
167 { 0x0B, 0x03, "Warning - Background Self-Test Failed" },
168 { 0x0B, 0x04, "Warning - Background Pre-Scan Detected Medium Error" },
169 { 0x0B, 0x05, "Warning - Background Medium Scan Detected Medium Error" },
170 { 0x0B, 0x06, "Warning - Non-Volatile Cache Now Volatile" },
171 { 0x0B, 0x07, "Warning - Degraded Power To Non-Volatile Cache" },
172 { 0x0B, 0x08, "Warning - Power Loss Expected" },
173 { 0x0B, 0x09, "Warning - Device Statistics Notification Active" },
174 { 0x0B, 0x0A, "Warning - High Critical Temperature Limit Exceeded" },
175 { 0x0B, 0x0B, "Warning - Low Critical Temperature Limit Exceeded" },
176 { 0x0B, 0x0C, "Warning - High Operating Temperature Limit Exceeded" },
177 { 0x0B, 0x0D, "Warning - Low Operating Temperature Limit Exceeded" },
178 { 0x0B, 0x0E, "Warning - High Critical Humidity Limit Exceeded" },
179 { 0x0B, 0x0F, "Warning - Low Critical Humidity Limit Exceeded" },
180 { 0x0B, 0x10, "Warning - High Operating Humidity Limit Exceeded" },
181 { 0x0B, 0x11, "Warning - Low Operating Humidity Limit Exceeded" },
182 { 0x0C, 0x00, "Write Error" },
183 { 0x0C, 0x01, "Write Error - Recovered With Auto Reallocation" },
184 { 0x0C, 0x02, "Write Error - Auto Reallocation Failed" },
185 { 0x0C, 0x03, "Write Error - Recommend Reassignment" },
186 { 0x0C, 0x04, "Compression Check Miscompare Error" },
187 { 0x0C, 0x05, "Data Expansion Occurred During Compression" },
188 { 0x0C, 0x06, "Block Not Compressible" },
189 { 0x0C, 0x07, "Write Error - Recovery Needed" },
190 { 0x0C, 0x08, "Write Error - Recovery Failed" },
191 { 0x0C, 0x09, "Write Error - Loss Of Streaming" },
192 { 0x0C, 0x0A, "Write Error - Padding Blocks Added" },
193 { 0x0C, 0x0B, "Auxiliary Memory Write Error" },
194 { 0x0C, 0x0C, "Write Error - Unexpected Unsolicited Data" },
195 { 0x0C, 0x0D, "Write Error - Not Enough Unsolicited Data" },
196 { 0x0C, 0x0E, "Multiple Write Errors" },
197 { 0x0C, 0x0F, "Defects In Error Window" },
198 { 0x0C, 0x10, "Incomplete Multiple Atomic Write Operations" },
199 { 0x0C, 0x11, "Write Error - Recovery Scan Needed" },
200 { 0x0C, 0x12, "Write Error - Insufficient Zone Resources" },
201 { 0x0D, 0x00, "Error Detected By Third Party Temporary Initiator" },
202 { 0x0D, 0x01, "Third Party Device Failure" },
203 { 0x0D, 0x02, "Copy Target Device Not Reachable" },
204 { 0x0D, 0x03, "Incorrect Copy Target Device Type" },
205 { 0x0D, 0x04, "Copy Target Device Data Underrun" },
206 { 0x0D, 0x05, "Copy Target Device Data Overrun" },
207 { 0x0E, 0x00, "Invalid Information Unit" },
208 { 0x0E, 0x01, "Information Unit Too Short" },
209 { 0x0E, 0x02, "Information Unit Too Long" },
210 { 0x0E, 0x03, "Invalid Field In Command Information Unit" },
211 { 0x10, 0x00, "Id CRC Or ECC Error" },
212 { 0x10, 0x01, "Logical Block Guard Check Failed" },
213 { 0x10, 0x02, "Logical Block Application Tag Check Failed" },
214 { 0x10, 0x03, "Logical Block Reference Tag Check Failed" },
215 { 0x10, 0x04, "Logical Block Protection Error On Recover Buffered Data" },
216 { 0x10, 0x05, "Logical Block Protection Method Error" },
217 { 0x11, 0x00, "Unrecovered Read Error" },
218 { 0x11, 0x01, "Read Retries Exhausted" },
219 { 0x11, 0x02, "Error Too Long To Correct" },
220 { 0x11, 0x03, "Multiple Read Errors" },
221 { 0x11, 0x04, "Unrecovered Read Error - Auto Reallocate Failed" },
222 { 0x11, 0x05, "L-EC Uncorrectable Error" },
223 { 0x11, 0x06, "CIRC Unrecovered Error" },
224 { 0x11, 0x07, "Data Re-synchronization Error" },
225 { 0x11, 0x08, "Incomplete Block Read" },
226 { 0x11, 0x09, "No Gap Found" },
227 { 0x11, 0x0A, "Miscorrected Error" },
228 { 0x11, 0x0B, "Unrecovered Read Error - Recommend Reassignment" },
229 { 0x11, 0x0C, "Unrecovered Read Error - Recommend Rewrite The Data" },
230 { 0x11, 0x0D, "De-Compression CRC Error" },
231 { 0x11, 0x0E, "Cannot Decompress Using Declared Algorithm" },
232 { 0x11, 0x0F, "Error Reading UPC/EAN Number" },
233 { 0x11, 0x10, "Error Reading ISRC Number" },
234 { 0x11, 0x11, "Read Error - Loss Of Streaming" },
235 { 0x11, 0x12, "Auxiliary Memory Read Error" },
236 { 0x11, 0x13, "Read Error - Failed Retransmission Request" },
237 { 0x11, 0x14, "Read Error - Lba Marked Bad By Application Client" },
238 { 0x11, 0x15, "Write After Sanitize Required" },
239 { 0x12, 0x00, "Address Mark Not Found For ID Field" },
240 { 0x13, 0x00, "Address Mark Not Found For DATA Field" },
241 { 0x14, 0x00, "Recorded Entity Not Found" },
242 { 0x14, 0x01, "Record Not Found" },
243 { 0x14, 0x02, "Filemark or Setmark Not Found" },
244 { 0x14, 0x03, "End-Of-Data Not Found" },
245 { 0x14, 0x04, "Block Sequence Error" },
246 { 0x14, 0x05, "Record Not Found - Recommend Reassignment" },
247 { 0x14, 0x06, "Record Not Found - Data Auto-Reallocated" },
248 { 0x14, 0x07, "Locate Operation Failure" },
249 { 0x15, 0x00, "Random Positioning Error" },
250 { 0x15, 0x01, "Mechanical Positioning Error" },
251 { 0x15, 0x02, "Positioning Error Detected By Read of Medium" },
252 { 0x16, 0x00, "Data Synchronization Mark Error" },
253 { 0x16, 0x01, "Data Sync Error - Data Rewritten" },
254 { 0x16, 0x02, "Data Sync Error - Recommend Rewrite" },
255 { 0x16, 0x03, "Data Sync Error - Data Auto-Reallocated" },
256 { 0x16, 0x04, "Data Sync Error - Recommend Reassignment" },
257 { 0x17, 0x00, "Recovered Data With No Error Correction Applied" },
258 { 0x17, 0x01, "Recovered Data With Retries" },
259 { 0x17, 0x02, "Recovered Data With Positive Head Offset" },
260 { 0x17, 0x03, "Recovered Data With Negative Head Offset" },
261 { 0x17, 0x04, "Recovered Data With Retries and/or CIRC Applied" },
262 { 0x17, 0x05, "Recovered Data Using Previous Sector ID" },
263 { 0x17, 0x06, "Recovered Data Without ECC - Data Auto-Reallocated" },
264 { 0x17, 0x07, "Recovered Data Without ECC - Recommend Reassignment" },
265 { 0x17, 0x08, "Recovered Data Without ECC - Recommend Rewrite" },
266 { 0x17, 0x09, "Recovered Data Without ECC - Data Rewritten" },
267 { 0x18, 0x00, "Recovered Data With Error Correction Applied" },
268 { 0x18, 0x01, "Recovered Data With Error Corr. & Retries Applied" },
269 { 0x18, 0x02, "Recovered Data - Data Auto-Reallocated" },
270 { 0x18, 0x03, "Recovered Data With CIRC" },
271 { 0x18, 0x04, "Recovered Data With LEC" },
272 { 0x18, 0x05, "Recovered Data - Recommend Reassignment" },
273 { 0x18, 0x06, "Recovered Data - Recommend Rewrite" },
274 { 0x18, 0x07, "Recovered Data With ECC - Data Rewritten" },
275 { 0x18, 0x08, "Recovered Data With Linking" },
276 { 0x19, 0x00, "Defect List Error" },
277 { 0x19, 0x01, "Defect List Not Available" },
278 { 0x19, 0x02, "Defect List Error In Primary List" },
279 { 0x19, 0x03, "Defect List Error In Grown List" },
280 { 0x1A, 0x00, "Parameter List Length Error" },
281 { 0x1B, 0x00, "Synchronous Data Transfer Error" },
282 { 0x1C, 0x00, "Defect List Not Found" },
283 { 0x1C, 0x01, "Primary Defect List Not Found" },
284 { 0x1C, 0x02, "Grown Defect List Not Found" },
285 { 0x1D, 0x00, "Miscompare During Verify Operation" },
286 { 0x1D, 0x01, "Miscompare Verify Of Unmapped Lba" },
287 { 0x1E, 0x00, "Recovered ID With ECC Correction" },
288 { 0x1F, 0x00, "Partial Defect List Transfer" },
289 { 0x20, 0x00, "Invalid Command Operation Code" },
290 { 0x20, 0x01, "Access Denied - Initiator Pending-Enrolled" },
291 { 0x20, 0x02, "Access Denied - No Access Rights" },
292 { 0x20, 0x03, "Access Denied - Invalid Mgmt ID Key" },
293 { 0x20, 0x04, "Illegal Command While In Write Capable State" },
294 { 0x20, 0x05, "Obsolete" },
295 { 0x20, 0x06, "Illegal Command While In Explicit Address Mode" },
296 { 0x20, 0x07, "Illegal Command While In Implicit Address Mode" },
297 { 0x20, 0x08, "Access Denied - Enrollment Conflict" },
298 { 0x20, 0x09, "Access Denied - Invalid LU Identifer" },
299 { 0x20, 0x0A, "Access Denied - Invalid Proxy Token" },
300 { 0x20, 0x0B, "Access Denied - ACL LUN Conflict" },
301 { 0x20, 0x0C, "Illegal Command When Not In Append-Only Mode" },
302 { 0x20, 0x0D, "Not An Administrative Logical Unit" },
303 { 0x20, 0x0E, "Not A Subsidiary Logical Unit" },
304 { 0x20, 0x0F, "Not A Conglomerate Logical Unit" },
305 { 0x21, 0x00, "Logical Block Address Out Of Range" },
306 { 0x21, 0x01, "Invalid Element Address" },
307 { 0x21, 0x02, "Invalid Address For Write" },
308 { 0x21, 0x03, "Invalid Write Crossing Layer Jump" },
309 { 0x21, 0x04, "Unaligned Write Command" },
310 { 0x21, 0x05, "Write Boundary Violation" },
311 { 0x21, 0x06, "Attempt To Read Invalid Data" },
312 { 0x21, 0x07, "Read Boundary Violation" },
313 { 0x21, 0x08, "Misaligned Write Command" },
314 { 0x22, 0x00, "Illegal Function (Use 20 00, 24 00, Or 26 00)" },
315 { 0x23, 0x00, "Invalid Token Operation, Cause Not Reportable" },
316 { 0x23, 0x01, "Invalid Token Operation, Unsupported Token Type" },
317 { 0x23, 0x02, "Invalid Token Operation, Remote Token Usage Not Supported" },
318 { 0x23, 0x03, "Invalid Token Operation, Remote Rod Token Creation Not Supported" },
319 { 0x23, 0x04, "Invalid Token Operation, Token Unknown" },
320 { 0x23, 0x05, "Invalid Token Operation, Token Corrupt" },
321 { 0x23, 0x06, "Invalid Token Operation, Token Revoked" },
322 { 0x23, 0x07, "Invalid Token Operation, Token Expired" },
323 { 0x23, 0x08, "Invalid Token Operation, Token Cancelled" },
324 { 0x23, 0x09, "Invalid Token Operation, Token Deleted" },
325 { 0x23, 0x0A, "Invalid Token Operation, Invalid Token Length" },
326 { 0x24, 0x00, "Invalid Field In CDB" },
327 { 0x24, 0x01, "CDB Decryption Error" },
328 { 0x24, 0x02, "Obsolete" },
329 { 0x24, 0x03, "Obsolete" },
330 { 0x24, 0x04, "Security Audit Value Frozen" },
331 { 0x24, 0x05, "Security Working Key Frozen" },
332 { 0x24, 0x06, "Nonce Not Unique" },
333 { 0x24, 0x07, "Nonce Timestamp Out Of Range" },
334 { 0x24, 0x08, "Invalid XCDB" },
335 { 0x24, 0x09, "Invalid Fast Format" },
336 { 0x25, 0x00, "Logical Unit Not Supported" },
337 { 0x26, 0x00, "Invalid Field In Parameter List" },
338 { 0x26, 0x01, "Parameter Not Supported" },
339 { 0x26, 0x02, "Parameter Value Invalid" },
340 { 0x26, 0x03, "Threshold Parameters Not Supported" },
341 { 0x26, 0x04, "Invalid Release Of Persistent Reservation" },
342 { 0x26, 0x05, "Data Decryption Error" },
343 { 0x26, 0x06, "Too Many Target Descriptors" },
344 { 0x26, 0x07, "Unsupported Target Descriptor Type Code" },
345 { 0x26, 0x08, "Too Many Segment Descriptors" },
346 { 0x26, 0x09, "Unsupported Segment Descriptor Type Code" },
347 { 0x26, 0x0A, "Unexpected Inexact Segment" },
348 { 0x26, 0x0B, "Inline Data Length Exceeded" },
349 { 0x26, 0x0C, "Invalid Operation For Copy Source Or Destination" },
350 { 0x26, 0x0D, "Copy Segment Granularity Violation" },
351 { 0x26, 0x0E, "Invalid Parameter While Port Is Enabled" },
352 { 0x26, 0x0F, "Invalid Data-Out Buffer Integrity Check Value" },
353 { 0x26, 0x10, "Data Decryption Key Fail Limit Reached" },
354 { 0x26, 0x11, "Incomplete Key-Associated Data Set" },
355 { 0x26, 0x12, "Vendor Specific Key Reference Not Found" },
356 { 0x26, 0x13, "Application Tag Mode Page Is Invalid" },
357 { 0x26, 0x14, "Tape Stream Mirroring Prevented" },
358 { 0x26, 0x15, "Copy Source Or Copy Destination Not Authorized" },
359 { 0x27, 0x00, "Write Protected" },
360 { 0x27, 0x01, "Hardware Write Protected" },
361 { 0x27, 0x02, "Logical Unit Software Write Protected" },
362 { 0x27, 0x03, "Associated Write Protect" },
363 { 0x27, 0x04, "Persistent Write Protect" },
364 { 0x27, 0x05, "Permanent Write Protect" },
365 { 0x27, 0x06, "Conditional Write Protect" },
366 { 0x27, 0x07, "Space Allocation Failed Write Protect" },
367 { 0x27, 0x08, "Zone Is Read Only" },
368 { 0x28, 0x00, "Not Ready To Ready Change, Medium May Have Changed" },
369 { 0x28, 0x01, "Import Or Export Element Accessed" },
370 { 0x28, 0x02, "Format-Layer May Have Changed" },
371 { 0x28, 0x03, "Import/Export Element Accessed, Medium Changed" },
372 { 0x29, 0x00, "Power On, Reset, Or Bus Device Reset Occurred" },
373 { 0x29, 0x01, "Power On Occurred" },
374 { 0x29, 0x02, "SCSI Bus Reset Occurred" },
375 { 0x29, 0x03, "Bus Device Reset Function Occurred" },
376 { 0x29, 0x04, "Device Internal Reset" },
377 { 0x29, 0x05, "Transceiver Mode Changed To Single-Ended" },
378 { 0x29, 0x06, "Transceiver Mode Changed To LVD" },
379 { 0x29, 0x07, "I_T Nexus Loss Occurred" },
380 { 0x2A, 0x00, "Parameters Changed" },
381 { 0x2A, 0x01, "Mode Parameters Changed" },
382 { 0x2A, 0x02, "Log Parameters Changed" },
383 { 0x2A, 0x03, "Reservations Preempted" },
384 { 0x2A, 0x04, "Reservations Released" },
385 { 0x2A, 0x05, "Registrations Preempted" },
386 { 0x2A, 0x06, "Asymmetric Access State Changed" },
387 { 0x2A, 0x07, "Implicit Asymmetric Access State Transition Failed" },
388 { 0x2A, 0x08, "Priority Changed" },
389 { 0x2A, 0x09, "Capacity Data Has Changed" },
390 { 0x2A, 0x0A, "Error History I_t Nexus Cleared" },
391 { 0x2A, 0x0B, "Error History Snapshot Released" },
392 { 0x2A, 0x0C, "Error Recovery Attributes Have Changed" },
393 { 0x2A, 0x0D, "Data Encryption Capabilities Changed" },
394 { 0x2A, 0x10, "Timestamp Changed" },
395 { 0x2A, 0x11, "Data Encryption Parameters Changed By Another I_t Nexus" },
396 { 0x2A, 0x12, "Data Encryption Parameters Changed By Vendor Specific Event" },
397 { 0x2A, 0x13, "Data Encryption Key Instance Counter Has Changed" },
398 { 0x2A, 0x14, "SA Creation Capabilities Data Has Changed" },
399 { 0x2A, 0x15, "Medium Removal Prevention Preempted" },
400 { 0x2A, 0x16, "Zone Reset Write Pointer Recommended" },
401 { 0x2B, 0x00, "Copy Cannot Execute Since Host Cannot Disconnect" },
402 { 0x2C, 0x00, "Command Sequence Error" },
403 { 0x2C, 0x01, "Too Many Windows Specified" },
404 { 0x2C, 0x02, "Invalid Combination Of Windows Specified" },
405 { 0x2C, 0x03, "Current Program Area Is Not Empty" },
406 { 0x2C, 0x04, "Current Program Area Is Empty" },
407 { 0x2C, 0x05, "Illegal Power Condition Request" },
408 { 0x2C, 0x06, "Persistent Prevent Conflict" },
409 { 0x2C, 0x07, "Previous Busy Status" },
410 { 0x2C, 0x08, "Previous Task Set Full Status" },
411 { 0x2C, 0x09, "Previous Reservation Conflict Status" },
412 { 0x2C, 0x0A, "Partition Or Collection Contains User Objects" },
413 { 0x2C, 0x0B, "Not Reserved" },
414 { 0x2C, 0x0C, "Orwrite Generation Does Not Match" },
415 { 0x2C, 0x0D, "Reset Write Pointer Not Allowed" },
416 { 0x2C, 0x0E, "Zone Is Offline" },
417 { 0x2C, 0x0F, "Stream Not Open" },
418 { 0x2C, 0x10, "Unwritten Data In Zone" },
419 { 0x2C, 0x11, "Descriptor Format Sense Data Required" },
420 { 0x2D, 0x00, "Overwrite Error On Update In Place" },
421 { 0x2E, 0x00, "Insufficient Time For Operation" },
422 { 0x2E, 0x01, "Command Timeout Before Processing" },
423 { 0x2E, 0x02, "Command Timeout During Processing" },
424 { 0x2E, 0x03, "Command Timeout During Processing Due To Error Recovery" },
425 { 0x2F, 0x00, "Commands Cleared By Another Initiator" },
426 { 0x2F, 0x01, "Commands Cleared By Power Loss Notification" },
427 { 0x2F, 0x02, "Commands Cleared By Device Server" },
428 { 0x2F, 0x03, "Some Commands Cleared By Queuing Layer Event" },
429 { 0x30, 0x00, "Incompatible Medium Installed" },
430 { 0x30, 0x01, "Cannot Read Medium - Unknown Format" },
431 { 0x30, 0x02, "Cannot Read Medium - Incompatible Format" },
432 { 0x30, 0x03, "Cleaning Cartridge Installed" },
433 { 0x30, 0x04, "Cannot Write Medium - Unknown Format" },
434 { 0x30, 0x05, "Cannot Write Medium - Incompatible Format" },
435 { 0x30, 0x06, "Cannot Format Medium - Incompatible Medium" },
436 { 0x30, 0x07, "Cleaning Failure" },
437 { 0x30, 0x08, "Cannot Write - Application Code Mismatch" },
438 { 0x30, 0x09, "Current Session Not Fixated For Append" },
439 { 0x30, 0x0A, "Cleaning Request Rejected" },
440 { 0x30, 0x0C, "Worm Medium - Overwrite Attempted" },
441 { 0x30, 0x0D, "Worm Medium - Integrity Check" },
442 { 0x30, 0x10, "Medium Not Formatted" },
443 { 0x30, 0x11, "Incompatible Volume Type" },
444 { 0x30, 0x12, "Incompatible Volume Qualifier" },
445 { 0x30, 0x13, "Cleaning Volume Expired" },
446 { 0x31, 0x00, "Medium Format Corrupted" },
447 { 0x31, 0x01, "Format Command Failed" },
448 { 0x31, 0x02, "Zoned Formatting Failed Due To Spare Linking" },
449 { 0x31, 0x03, "Sanitize Command Failed" },
450 { 0x32, 0x00, "No Defect Spare Location Available" },
451 { 0x32, 0x01, "Defect List Update Failure" },
452 { 0x33, 0x00, "Tape Length Error" },
453 { 0x34, 0x00, "Enclosure Failure" },
454 { 0x35, 0x00, "Enclosure Services Failure" },
455 { 0x35, 0x01, "Unsupported Enclosure Function" },
456 { 0x35, 0x02, "Enclosure Services Unavailable" },
457 { 0x35, 0x03, "Enclosure Services Transfer Failure" },
458 { 0x35, 0x04, "Enclosure Services Transfer Refused" },
459 { 0x35, 0x05, "Enclosure Services Checksum Error" },
460 { 0x36, 0x00, "Ribbon, Ink, Or Toner Failure" },
461 { 0x37, 0x00, "Rounded Parameter" },
462 { 0x38, 0x00, "Event Status Notification" },
463 { 0x38, 0x02, "ESN - Power Management Class Event" },
464 { 0x38, 0x04, "ESN - Media Class Event" },
465 { 0x38, 0x06, "ESN - Device Busy Class Event" },
466 { 0x38, 0x07, "Thin Provisioning Soft Threshold Reached" },
467 { 0x39, 0x00, "Saving Parameters Not Supported" },
468 { 0x3A, 0x00, "Medium Not Present" },
469 { 0x3A, 0x01, "Medium Not Present - Tray Closed" },
470 { 0x3A, 0x02, "Medium Not Present - Tray Open" },
471 { 0x3A, 0x03, "Medium Not Present - Loadable" },
472 { 0x3A, 0x04, "Medium Not Present - Medium Auxiliary Memory Accessible" },
473 { 0x3B, 0x00, "Sequential Positioning Error" },
474 { 0x3B, 0x01, "Tape Position Error At Beginning-Of-Medium" },
475 { 0x3B, 0x02, "Tape Position Error At End-Of-Medium" },
476 { 0x3B, 0x03, "Tape Or Electronic Vertical Forms Unit Not Ready" },
477 { 0x3B, 0x04, "Slew Failure" },
478 { 0x3B, 0x05, "Paper Jam" },
479 { 0x3B, 0x06, "Failed To Sense Top-Of-Form" },
480 { 0x3B, 0x07, "Failed To Sense Bottom-Of-Form" },
481 { 0x3B, 0x08, "Reposition Error" },
482 { 0x3B, 0x09, "Read Past End Of Medium" },
483 { 0x3B, 0x0A, "Read Past Beginning Of Medium" },
484 { 0x3B, 0x0B, "Position Past End Of Medium" },
485 { 0x3B, 0x0C, "Position Past Beginning Of Medium" },
486 { 0x3B, 0x0D, "Medium Destination Element Full" },
487 { 0x3B, 0x0E, "Medium Source Element Empty" },
488 { 0x3B, 0x0F, "End Of Medium Reached" },
489 { 0x3B, 0x11, "Medium Magazine Not Accessible" },
490 { 0x3B, 0x12, "Medium Magazine Removed" },
491 { 0x3B, 0x13, "Medium Magazine Inserted" },
492 { 0x3B, 0x14, "Medium Magazine Locked" },
493 { 0x3B, 0x15, "Medium Magazine Unlocked" },
494 { 0x3B, 0x16, "Mechanical Positioning Or Changer Error" },
495 { 0x3B, 0x17, "Read Past End Of User Object" },
496 { 0x3B, 0x18, "Element Disabled" },
497 { 0x3B, 0x19, "Element Enabled" },
498 { 0x3B, 0x1A, "Data Transfer Device Removed" },
499 { 0x3B, 0x1B, "Data Transfer Device Inserted" },
500 { 0x3B, 0x1C, "Too Many Logical Objects On Partition To Support Operation" },
501 { 0x3D, 0x00, "Invalid Bits In IDENTIFY Message" },
502 { 0x3E, 0x00, "Logical Unit Has Not Self-Configured Yet" },
503 { 0x3E, 0x01, "Logical Unit Failure" },
504 { 0x3E, 0x02, "Timeout On Logical Unit" },
505 { 0x3E, 0x03, "Logical Unit Failed Self-Test" },
506 { 0x3E, 0x04, "Logical Unit Unable To Update Self-Test Log" },
507 { 0x3F, 0x00, "Target Operating Conditions Have Changed" },
508 { 0x3F, 0x01, "Microcode Has Been Changed" },
509 { 0x3F, 0x02, "Changed Operating Definition" },
510 { 0x3F, 0x03, "INQUIRY Data Has Changed" },
511 { 0x3F, 0x04, "Component Device Attached" },
512 { 0x3F, 0x05, "Device Identifier Changed" },
513 { 0x3F, 0x06, "Redundancy Group Created Or Modified" },
514 { 0x3F, 0x07, "Redundancy Group Deleted" },
515 { 0x3F, 0x08, "Spare Created Or Modified" },
516 { 0x3F, 0x09, "Spare Deleted" },
517 { 0x3F, 0x0A, "Volume Set Created Or Modified" },
518 { 0x3F, 0x0B, "Volume Set Deleted" },
519 { 0x3F, 0x0C, "Volume Set Deassigned" },
520 { 0x3F, 0x0D, "Volume Set Reassigned" },
521 { 0x3F, 0x0E, "Reported LUNs Data Has Changed" },
522 { 0x3F, 0x0F, "Echo Buffer Overwritten" },
523 { 0x3F, 0x10, "Medium Loadable" },
524 { 0x3F, 0x11, "Medium Auxiliary Memory Accessible" },
525 { 0x3F, 0x12, "Iscsi Ip Address Added" },
526 { 0x3F, 0x13, "Iscsi Ip Address Removed" },
527 { 0x3F, 0x14, "Iscsi Ip Address Changed" },
528 { 0x3F, 0x15, "Inspect Referrals Sense Descriptors" },
529 { 0x3F, 0x16, "Microcode Has Been Changed Without Reset" },
530 { 0x3F, 0x17, "Zone Transition To Full" },
531 { 0x3F, 0x18, "Bind Completed" },
532 { 0x3F, 0x19, "Bind Redirected" },
533 { 0x3F, 0x1A, "Subsidiary Binding Changed" },
534 { 0x40, 0x00, "Ram Failure (Should Use 40 NN)" },
535 { 0x40, 0x00, "Diagnostic Failure On Component NN (80h-FFh)" },
536 { 0x41, 0x00, "Data Path Failure (Should Use 40 NN)" },
537 { 0x42, 0x00, "Power-On Or Self-Test Failure (Should Use 40 NN)" },
538 { 0x43, 0x00, "Message Error" },
539 { 0x44, 0x00, "Internal Target Failure" },
540 { 0x44, 0x01, "Persistent Reservation Information Lost" },
541 { 0x44, 0x71, "Ata Device Failed Set Features" },
542 { 0x45, 0x00, "Select Or Reselect Failure" },
543 { 0x46, 0x00, "Unsuccessful Soft Reset" },
544 { 0x47, 0x00, "SCSI Parity Error" },
545 { 0x47, 0x01, "Data Phase CRC Error Detected" },
546 { 0x47, 0x02, "SCSI Parity Error Detected During ST Data Phase" },
547 { 0x47, 0x03, "Information Unit iuCRC Error Detected" },
548 { 0x47, 0x04, "Asynchronous Information Protection Error Detected" },
549 { 0x47, 0x05, "Protocol Service Crc Error" },
550 { 0x47, 0x06, "PHY Test Function In Progress" },
551 { 0x47, 0x7F, "Some Commands Cleared By Iscsi Protocol Event" },
552 { 0x48, 0x00, "Initiator Detected Error Message Received" },
553 { 0x49, 0x00, "Invalid Message Error" },
554 { 0x4A, 0x00, "Command Phase Error" },
555 { 0x4B, 0x00, "Data Phase Error" },
556 { 0x4B, 0x01, "Illegal Target Port Transfer Tag Received" },
557 { 0x4B, 0x02, "Too Much Write Data" },
558 { 0x4B, 0x03, "ACK/NAK Timeout" },
559 { 0x4B, 0x04, "NAK Reveived" },
560 { 0x4B, 0x05, "Data Offset Error" },
561 { 0x4B, 0x06, "Initiator Response Timeout" },
562 { 0x4B, 0x07, "Connection Lost" },
563 { 0x4B, 0x08, "Data-In Buffer Overflow - Data Buffer Size" },
564 { 0x4B, 0x09, "Data-In Buffer Overflow - Data Buffer Descriptor Area" },
565 { 0x4B, 0x0A, "Data-In Buffer Error" },
566 { 0x4B, 0x0B, "Data-Out Buffer Overflow - Data Buffer Size" },
567 { 0x4B, 0x0C, "Data-Out Buffer Overflow - Data Buffer Descriptor Area" },
568 { 0x4B, 0x0D, "Data-Out Buffer Error" },
569 { 0x4B, 0x0E, "PCIe Fabric Error" },
570 { 0x4B, 0x0F, "PCIe Completion Timeout" },
571 { 0x4B, 0x10, "PCIe Completer Abort" },
572 { 0x4B, 0x11, "PCIe Poisoned Tlp Received" },
573 { 0x4B, 0x12, "PCIe Ecrc Check Failed" },
574 { 0x4B, 0x13, "PCIe Unsupported Request" },
575 { 0x4B, 0x14, "PCIe ACS Violation" },
576 { 0x4B, 0x15, "PCIe TLP Prefix Blocked" },
577 { 0x4C, 0x00, "Logical Unit Failed Self-Configuration" },
578 { 0x4D, 0x00, "Tagged Overlapped Commands (NN = Task Tag)" },
579 { 0x4E, 0x00, "Overlapped Commands Attempted" },
580 { 0x50, 0x00, "Write Append Error" },
581 { 0x50, 0x01, "Write Append Position Error" },
582 { 0x50, 0x02, "Position Error Related To Timing" },
583 { 0x51, 0x00, "Erase Failure" },
584 { 0x51, 0x01, "Erase Failure - Incomplete Erase Operation Detected" },
585 { 0x52, 0x00, "Cartridge Fault" },
586 { 0x53, 0x00, "Media Load or Eject Failed" },
587 { 0x53, 0x01, "Unload Tape Failure" },
588 { 0x53, 0x02, "Medium Removal Prevented" },
589 { 0x53, 0x03, "Medium Removal Prevented By Data Transfer Element" },
590 { 0x53, 0x04, "Medium Thread Or Unthread Failure" },
591 { 0x53, 0x05, "Volume Identifier Invalid" },
592 { 0x53, 0x06, "Volume Identifier Missing" },
593 { 0x53, 0x07, "Duplicate Volume Identifier" },
594 { 0x53, 0x08, "Element Status Unknown" },
595 { 0x53, 0x09, "Data Transfer Device Error - Load Failed" },
596 { 0x53, 0x0A, "Data Transfer Device Error - Unload Failed" },
597 { 0x53, 0x0B, "Data Transfer Device Error - Unload Missing" },
598 { 0x53, 0x0C, "Data Transfer Device Error - Eject Failed" },
599 { 0x53, 0x0D, "Data Transfer Device Error - Library Communication Failed" },
600 { 0x54, 0x00, "SCSI To Host System Interface Failure" },
601 { 0x55, 0x00, "System Resource Failure" },
602 { 0x55, 0x01, "System Buffer Full" },
603 { 0x55, 0x02, "Insufficient Reservation Resources" },
604 { 0x55, 0x03, "Insufficient Resources" },
605 { 0x55, 0x04, "Insufficient Registration Resources" },
606 { 0x55, 0x05, "Insufficient Access Control Resources" },
607 { 0x55, 0x06, "Auxiliary Memory Out Of Space" },
608 { 0x55, 0x07, "Quota Error" },
609 { 0x55, 0x08, "Maximum Number Of Supplemental Decryption Keys Exceeded" },
610 { 0x55, 0x09, "Medium Auxiliary Memory Not Accessible" },
611 { 0x55, 0x0A, "Data Currently Unavailable" },
612 { 0x55, 0x0B, "Insufficient Power For Operation" },
613 { 0x55, 0x0C, "Insufficient Resources To Create Rod" },
614 { 0x55, 0x0D, "Insufficient Resources To Create Rod Token" },
615 { 0x55, 0x0E, "Insufficient Zone Resources" },
616 { 0x55, 0x0F, "Insufficient Zone Resources To Complete Write" },
617 { 0x55, 0x10, "Maximum Number Of Streams Open" },
618 { 0x55, 0x11, "Insufficient Resources To Bind" },
619 { 0x57, 0x00, "Unable To Recover Table-Of-Contents" },
620 { 0x58, 0x00, "Generation Does Not Exist" },
621 { 0x59, 0x00, "Updated Block Read" },
622 { 0x5A, 0x00, "Operator Request Or State Change Input" },
623 { 0x5A, 0x01, "Operator Medium Removal Request" },
624 { 0x5A, 0x02, "Operator Selected Write Protect" },
625 { 0x5A, 0x03, "Operator Selected Write Permit" },
626 { 0x5B, 0x00, "Log Exception" },
627 { 0x5B, 0x01, "Threshold Condition Met" },
628 { 0x5B, 0x02, "Log Counter At Maximum" },
629 { 0x5B, 0x03, "Log List Codes Exhausted" },
630 { 0x5C, 0x00, "RPL Status Change" },
631 { 0x5C, 0x01, "Spindles Synchronized" },
632 { 0x5C, 0x02, "Spindles Not Synchronized" },
633 { 0x5D, 0x00, "Failure Prediction Threshold Exceeded" },
634 { 0x5D, 0x01, "Media Failure Prediction Threshold Exceeded" },
635 { 0x5D, 0x02, "Logical Unit Failure Prediction Threshold Exceeded" },
636 { 0x5D, 0x03, "Spare Area Exhaustion Prediction Threshold Exceeded" },
637 { 0x5D, 0x10, "Hardware Impending Failure General Hard Drive Failure" },
638 { 0x5D, 0x11, "Hardware Impending Failure Drive Error Rate Too High" },
639 { 0x5D, 0x12, "Hardware Impending Failure Data Error Rate Too High" },
640 { 0x5D, 0x13, "Hardware Impending Failure Seek Error Rate Too High" },
641 { 0x5D, 0x14, "Hardware Impending Failure Too Many Block Reassigns" },
642 { 0x5D, 0x15, "Hardware Impending Failure Access Times Too High" },
643 { 0x5D, 0x16, "Hardware Impending Failure Start Unit Times Too High" },
644 { 0x5D, 0x17, "Hardware Impending Failure Channel Parametrics" },
645 { 0x5D, 0x18, "Hardware Impending Failure Controller Detected" },
646 { 0x5D, 0x19, "Hardware Impending Failure Throughput Performance" },
647 { 0x5D, 0x1A, "Hardware Impending Failure Seek Time Performance" },
648 { 0x5D, 0x1B, "Hardware Impending Failure Spin-Up Retry Count" },
649 { 0x5D, 0x1C, "Hardware Impending Failure Drive Calibration Retry Count" },
650 { 0x5D, 0x20, "Controller Impending Failure General Hard Drive Failure" },
651 { 0x5D, 0x21, "Controller Impending Failure Drive Error Rate Too High" },
652 { 0x5D, 0x22, "Controller Impending Failure Data Error Rate Too High" },
653 { 0x5D, 0x23, "Controller Impending Failure Seek Error Rate Too High" },
654 { 0x5D, 0x24, "Controller Impending Failure Too Many Block Reassigns" },
655 { 0x5D, 0x25, "Controller Impending Failure Access Times Too High" },
656 { 0x5D, 0x26, "Controller Impending Failure Start Unit Times Too High" },
657 { 0x5D, 0x27, "Controller Impending Failure Channel Parametrics" },
658 { 0x5D, 0x28, "Controller Impending Failure Controller Detected" },
659 { 0x5D, 0x29, "Controller Impending Failure Throughput Performance" },
660 { 0x5D, 0x2A, "Controller Impending Failure Seek Time Performance" },
661 { 0x5D, 0x2B, "Controller Impending Failure Spin-Up Retry Count" },
662 { 0x5D, 0x2C, "Controller Impending Failure Drive Calibration Retry Count" },
663 { 0x5D, 0x30, "Data Channel Impending Failure General Hard Drive Failure" },
664 { 0x5D, 0x31, "Data Channel Impending Failure Drive Error Rate Too High" },
665 { 0x5D, 0x32, "Data Channel Impending Failure Data Error Rate Too High" },
666 { 0x5D, 0x33, "Data Channel Impending Failure Seek Error Rate Too High" },
667 { 0x5D, 0x34, "Data Channel Impending Failure Too Many Block Reassigns" },
668 { 0x5D, 0x35, "Data Channel Impending Failure Access Times Too High" },
669 { 0x5D, 0x36, "Data Channel Impending Failure Start Unit Times Too High" },
670 { 0x5D, 0x37, "Data Channel Impending Failure Channel Parametrics" },
671 { 0x5D, 0x38, "Data Channel Impending Failure Controller Detected" },
672 { 0x5D, 0x39, "Data Channel Impending Failure Throughput Performance" },
673 { 0x5D, 0x3A, "Data Channel Impending Failure Seek Time Performance" },
674 { 0x5D, 0x3B, "Data Channel Impending Failure Spin-Up Retry Count" },
675 { 0x5D, 0x3C, "Data Channel Impending Failure Drive Calibration Retry Count" },
676 { 0x5D, 0x40, "Servo Impending Failure General Hard Drive Failure" },
677 { 0x5D, 0x41, "Servo Impending Failure Drive Error Rate Too High" },
678 { 0x5D, 0x42, "Servo Impending Failure Data Error Rate Too High" },
679 { 0x5D, 0x43, "Servo Impending Failure Seek Error Rate Too High" },
680 { 0x5D, 0x44, "Servo Impending Failure Too Many Block Reassigns" },
681 { 0x5D, 0x45, "Servo Impending Failure Access Times Too High" },
682 { 0x5D, 0x46, "Servo Impending Failure Start Unit Times Too High" },
683 { 0x5D, 0x47, "Servo Impending Failure Channel Parametrics" },
684 { 0x5D, 0x48, "Servo Impending Failure Controller Detected" },
685 { 0x5D, 0x49, "Servo Impending Failure Throughput Performance" },
686 { 0x5D, 0x4A, "Servo Impending Failure Seek Time Performance" },
687 { 0x5D, 0x4B, "Servo Impending Failure Spin-Up Retry Count" },
688 { 0x5D, 0x4C, "Servo Impending Failure Drive Calibration Retry Count" },
689 { 0x5D, 0x50, "Spindle Impending Failure General Hard Drive Failure" },
690 { 0x5D, 0x51, "Spindle Impending Failure Drive Error Rate Too High" },
691 { 0x5D, 0x52, "Spindle Impending Failure Data Error Rate Too High" },
692 { 0x5D, 0x53, "Spindle Impending Failure Seek Error Rate Too High" },
693 { 0x5D, 0x54, "Spindle Impending Failure Too Many Block Reassigns" },
694 { 0x5D, 0x55, "Spindle Impending Failure Access Times Too High" },
695 { 0x5D, 0x56, "Spindle Impending Failure Start Unit Times Too High" },
696 { 0x5D, 0x57, "Spindle Impending Failure Channel Parametrics" },
697 { 0x5D, 0x58, "Spindle Impending Failure Controller Detected" },
698 { 0x5D, 0x59, "Spindle Impending Failure Throughput Performance" },
699 { 0x5D, 0x5A, "Spindle Impending Failure Seek Time Performance" },
700 { 0x5D, 0x5B, "Spindle Impending Failure Spin-Up Retry Count" },
701 { 0x5D, 0x5C, "Spindle Impending Failure Drive Calibration Retry Count" },
702 { 0x5D, 0x60, "Firmware Impending Failure General Hard Drive Failure" },
703 { 0x5D, 0x61, "Firmware Impending Failure Drive Error Rate Too High" },
704 { 0x5D, 0x62, "Firmware Impending Failure Data Error Rate Too High" },
705 { 0x5D, 0x63, "Firmware Impending Failure Seek Error Rate Too High" },
706 { 0x5D, 0x64, "Firmware Impending Failure Too Many Block Reassigns" },
707 { 0x5D, 0x65, "Firmware Impending Failure Access Times Too High" },
708 { 0x5D, 0x66, "Firmware Impending Failure Start Unit Times Too High" },
709 { 0x5D, 0x67, "Firmware Impending Failure Channel Parametrics" },
710 { 0x5D, 0x68, "Firmware Impending Failure Controller Detected" },
711 { 0x5D, 0x69, "Firmware Impending Failure Throughput Performance" },
712 { 0x5D, 0x6A, "Firmware Impending Failure Seek Time Performance" },
713 { 0x5D, 0x6B, "Firmware Impending Failure Spin-Up Retry Count" },
714 { 0x5D, 0x6C, "Firmware Impending Failure Drive Calibration Retry Count" },
715 { 0x5D, 0xFF, "Failure Prediction Threshold Exceeded (False)" },
716 { 0x5E, 0x00, "Low Power Condition On" },
717 { 0x5E, 0x01, "Idle Condition Activated By Timer" },
718 { 0x5E, 0x02, "Standby Condition Activated By Timer" },
719 { 0x5E, 0x03, "Idle Condition Activated By Command" },
720 { 0x5E, 0x04, "Standby Condition Activated By Command" },
721 { 0x5E, 0x05, "IDLE_B Condition Activated By Timer" },
722 { 0x5E, 0x06, "IDLE_B Condition Activated By Command" },
723 { 0x5E, 0x07, "IDLE_C Condition Activated By Timer" },
724 { 0x5E, 0x08, "IDLE_C Condition Activated By Command" },
725 { 0x5E, 0x09, "STANDBY_Y Condition Activated By Timer" },
726 { 0x5E, 0x0A, "STANDBY_Y Condition Activated By Command" },
727 { 0x5E, 0x41, "Power State Change To Active" },
728 { 0x5E, 0x42, "Power State Change To Idle" },
729 { 0x5E, 0x43, "Power State Change To Standby" },
730 { 0x5E, 0x45, "Power State Change To Sleep" },
731 { 0x5E, 0x47, "Power State Change To Device Control" },
732 { 0x60, 0x00, "Lamp Failure" },
733 { 0x61, 0x00, "Video Acquisition Error" },
734 { 0x61, 0x01, "Unable To Acquire Video" },
735 { 0x61, 0x02, "Out Of Focus" },
736 { 0x62, 0x00, "Scan Head Positioning Error" },
737 { 0x63, 0x00, "End Of User Area Encountered On This Track" },
738 { 0x63, 0x01, "Packet Does Not Fit In Available Space" },
739 { 0x64, 0x00, "Illegal Mode For This Track" },
740 { 0x64, 0x01, "Invalid Packet Size" },
741 { 0x65, 0x00, "Voltage Fault" },
742 { 0x66, 0x00, "Automatic Document Feeder Cover Up" },
743 { 0x66, 0x01, "Automatic Document Feeder Lift Up" },
744 { 0x66, 0x02, "Document Jam In Automatic Document Feeder" },
745 { 0x66, 0x03, "Document Miss Feed Automatic In Document Feeder" },
746 { 0x67, 0x00, "Configuration Failure" },
747 { 0x67, 0x01, "Configuration Of Incapable Logical Units Failed" },
748 { 0x67, 0x02, "Add Logical Unit Failed" },
749 { 0x67, 0x03, "Modification Of Logical Unit Failed" },
750 { 0x67, 0x04, "Exchange Of Logical Unit Failed" },
751 { 0x67, 0x05, "Remove Of Logical Unit Failed" },
752 { 0x67, 0x06, "Attachment Of Logical Unit Failed" },
753 { 0x67, 0x07, "Creation of Logical Unit Failed" },
754 { 0x67, 0x08, "Assign Failure Occurred" },
755 { 0x67, 0x09, "Multiply Assigned Logical Unit" },
756 { 0x67, 0x0A, "Set Target Port Groups Command Failed" },
757 { 0x67, 0x0B, "ATA Device Feature Not Enabled" },
758 { 0x67, 0x0C, "Command Rejected" },
759 { 0x67, 0x0D, "Explicit Bind Not Allowed" },
760 { 0x68, 0x00, "Logical Unit Not Configured" },
761 { 0x68, 0x01, "Subsidiary Logical Unit Not Configured" },
762 { 0x69, 0x00, "Data Loss On Logical Unit" },
763 { 0x69, 0x01, "Multiple Logical Unit Failures" },
764 { 0x69, 0x02, "Parity/Data Mismatch" },
765 { 0x6A, 0x00, "Informational, Refer To Log" },
766 { 0x6B, 0x00, "State Change Has Occurred" },
767 { 0x6B, 0x01, "Redundancy Level Got Better" },
768 { 0x6B, 0x02, "Redundancy Level Got Worse" },
769 { 0x6C, 0x00, "Rebuild Failure Occurred" },
770 { 0x6D, 0x00, "Recalculate Failure Occurred" },
771 { 0x6E, 0x00, "Command To Logical Unit Failed" },
772 { 0x6F, 0x00, "Copy Protection Key Exchange Failure - Authentication Failure" },
773 { 0x6F, 0x01, "Copy Protection Key Exchange Failure - Key Not Present" },
774 { 0x6F, 0x02, "Copy Protection Key Exchange Failure - Key Not Established" },
775 { 0x6F, 0x03, "Read Of Scrambled Sector Without Authentication" },
776 { 0x6F, 0x04, "Media Region Code Is Mismatched To Logical Unit Region" },
777 { 0x6F, 0x05, "Drive Region Must Be Permanent/Region Reset Count Error" },
778 { 0x6F, 0x06, "Insufficient Block Count For Binding Nonce Recording" },
779 { 0x6F, 0x07, "Conflict In Binding Nonce Recording" },
780 { 0x6F, 0x08, "Insufficient Permission" },
781 { 0x6F, 0x09, "Invalid Drive-Host Pairing Server" },
782 { 0x6F, 0x0A, "Drive-Host Pairing Suspended" },
783 { 0x70, 0x00, "Decompression Exception Short Algorithm Id Of NN" },
784 { 0x71, 0x00, "Decompression Exception Long Algorithm Id" },
785 { 0x72, 0x00, "Session Fixation Error" },
786 { 0x72, 0x01, "Session Fixation Error Writing Lead-In" },
787 { 0x72, 0x02, "Session Fixation Error Writing Lead-Out" },
788 { 0x72, 0x03, "Session Fixation Error - Incomplete Track In Session" },
789 { 0x72, 0x04, "Empty Or Partially Written Reserved Track" },
790 { 0x72, 0x05, "No More Track Reservations Allowed" },
791 { 0x72, 0x06, "RMZ Extension Is Not Allowed" },
792 { 0x72, 0x07, "No More Test Zone Extensions Are Allowed" },
793 { 0x73, 0x00, "CD Control Error" },
794 { 0x73, 0x01, "Power Calibration Area Almost Full" },
795 { 0x73, 0x02, "Power Calibration Area Is Full" },
796 { 0x73, 0x03, "Power Calibration Area Error" },
797 { 0x73, 0x04, "Program Memory Area Update Failure" },
798 { 0x73, 0x05, "Program Memory Area Is Full" },
799 { 0x73, 0x06, "RMA/PMA Is Almost Full" },
800 { 0x73, 0x10, "Current Power Calibration Area Almost Full" },
801 { 0x73, 0x11, "Current Power Calibration Area Is Full" },
802 { 0x73, 0x17, "RDZ Is Full" },
803 { 0x74, 0x00, "Security Error" },
804 { 0x74, 0x01, "Unable To Decrypt Data" },
805 { 0x74, 0x02, "Unencrypted Data Encountered While Decrypting" },
806 { 0x74, 0x03, "Incorrect Data Encryption Key" },
807 { 0x74, 0x04, "Cryptographic Integrity Validation Failed" },
808 { 0x74, 0x05, "Error Decrypting Data" },
809 { 0x74, 0x06, "Unknown Signature Verification Key" },
810 { 0x74, 0x07, "Encryption Parameters Not Useable" },
811 { 0x74, 0x08, "Digital Signature Validation Failure" },
812 { 0x74, 0x09, "Encryption Mode Mismatch On Read" },
813 { 0x74, 0x0A, "Encrypted Block Not Raw Read Enabled" },
814 { 0x74, 0x0B, "Incorrect Encryption Parameters" },
815 { 0x74, 0x0C, "Unable To Decrypt Parameter List" },
816 { 0x74, 0x0D, "Encryption Algorithm Disabled" },
817 { 0x74, 0x10, "SA Creation Parameter Value Invalid" },
818 { 0x74, 0x11, "SA Creation Parameter Value Rejected" },
819 { 0x74, 0x12, "Invalid Sa Usage" },
820 { 0x74, 0x21, "Data Encryption Configuration Prevented" },
821 { 0x74, 0x30, "SA Creation Parameter Not Supported" },
822 { 0x74, 0x40, "Authentication Failed" },
823 { 0x74, 0x61, "External Data Encryption Key Manager Access Error" },
824 { 0x74, 0x62, "External Data Encryption Key Manager Error" },
825 { 0x74, 0x63, "External Data Encryption Key Not Found" },
826 { 0x74, 0x64, "External Data Encryption Request Not Authorized" },
827 { 0x74, 0x6E, "External Data Encryption Control Timeout" },
828 { 0x74, 0x6F, "External Data Encryption Control Error" },
829 { 0x74, 0x71, "Logical Unit Access Not Authorized" },
830 { 0x74, 0x79, "Security Conflict In Translated Device" },
831 { 0x00, 0x00, NULL }
832 };
833
834 #ifdef _KERNEL
835 MODULE(MODULE_CLASS_MISC, scsiverbose, NULL);
836
837 static int
scsiverbose_modcmd(modcmd_t cmd,void * arg)838 scsiverbose_modcmd(modcmd_t cmd, void *arg)
839 {
840 static int (*saved_print_sense)(struct scsipi_xfer *, int);
841 static void (*saved_print_sense_data)(struct scsi_sense_data *, int);
842
843 switch (cmd) {
844 case MODULE_CMD_INIT:
845 saved_print_sense = scsipi_print_sense;
846 saved_print_sense_data = scsipi_print_sense_data;
847 scsipi_print_sense = scsipi_print_sense_real;
848 scsipi_print_sense_data = scsipi_print_sense_data_real;
849 scsi_verbose_loaded = 1;
850 return 0;
851 case MODULE_CMD_FINI:
852 scsipi_print_sense = saved_print_sense;
853 scsipi_print_sense_data = saved_print_sense_data;
854 scsi_verbose_loaded = 0;
855 return 0;
856 case MODULE_CMD_AUTOUNLOAD:
857 return EBUSY;
858 default:
859 return ENOTTY;
860 }
861 }
862 #else
863 int (*scsipi_print_sense)(struct scsipi_xfer *, int) =
864 scsipi_print_sense_real;
865 void (*scsipi_print_sense_data)(struct scsi_sense_data *, int) =
866 scsipi_print_sense_data_real;
867 #endif
868
869 static void
asc2ascii(u_char asc,u_char ascq,char * result,size_t l)870 asc2ascii(u_char asc, u_char ascq, char *result, size_t l)
871 {
872 int i = 0;
873
874 while (adesc[i].description != NULL) {
875 if (adesc[i].asc == asc && adesc[i].ascq == ascq)
876 break;
877 i++;
878 }
879 if (adesc[i].description == NULL) {
880 if (asc == 0x40 && ascq != 0)
881 (void)snprintf(result, l,
882 "Diagnostic Failure on Component 0x%02x",
883 ascq & 0xff);
884 else
885 (void)snprintf(result, l, "ASC 0x%02x ASCQ 0x%02x",
886 asc & 0xff, ascq & 0xff);
887 } else
888 (void)strlcpy(result, adesc[i].description, l);
889 }
890
891 void
scsipi_print_sense_data_real(struct scsi_sense_data * sense,int verbosity)892 scsipi_print_sense_data_real(struct scsi_sense_data *sense, int verbosity)
893 {
894 int32_t info;
895 int i, j, k;
896 char *sbs, *s = (char *) sense;
897
898 /*
899 * Basics- print out SENSE KEY
900 */
901 printf(" SENSE KEY: %s", scsipi_decode_sense(s, 0));
902
903 /*
904 * Print out, unqualified but aligned, FMK, EOM and ILI status.
905 */
906 if (s[2] & 0xe0) {
907 char pad;
908 printf("\n ");
909 pad = ' ';
910 if (s[2] & SSD_FILEMARK) {
911 printf("%c Filemark Detected", pad);
912 pad = ',';
913 }
914 if (s[2] & SSD_EOM) {
915 printf("%c EOM Detected", pad);
916 pad = ',';
917 }
918 if (s[2] & SSD_ILI)
919 printf("%c Incorrect Length Indicator Set", pad);
920 }
921
922 /*
923 * Now we should figure out, based upon device type, how
924 * to format the information field. Unfortunately, that's
925 * not convenient here, so we'll print it as a signed
926 * 32 bit integer.
927 */
928 info = _4btol(&s[3]);
929 if (info)
930 printf("\n INFO FIELD: %d", info);
931
932 /*
933 * Now we check additional length to see whether there is
934 * more information to extract.
935 */
936
937 /* enough for command specific information? */
938 if (((unsigned int) s[7]) < 4) {
939 printf("\n");
940 return;
941 }
942 info = _4btol(&s[8]);
943 if (info)
944 printf("\n COMMAND INFO: %d (0x%x)", info, info);
945
946 /*
947 * Decode ASC && ASCQ info, plus FRU, plus the rest...
948 */
949
950 sbs = scsipi_decode_sense(s, 1);
951 if (sbs)
952 printf("\n ASC/ASCQ: %s", sbs);
953 if (s[14] != 0)
954 printf("\n FRU CODE: 0x%x", s[14] & 0xff);
955 sbs = scsipi_decode_sense(s, 3);
956 if (sbs)
957 printf("\n SKSV: %s", sbs);
958 printf("\n");
959 if (verbosity == 0)
960 return;
961
962 /*
963 * Now figure whether we should print any additional informtion.
964 *
965 * Where should we start from? If we had SKSV data,
966 * start from offset 18, else from offset 15.
967 *
968 * From that point until the end of the buffer, check for any
969 * nonzero data. If we have some, go back and print the lot,
970 * otherwise we're done.
971 */
972 if (sbs)
973 i = 18;
974 else
975 i = 15;
976 for (j = i; j < sizeof (*sense); j++)
977 if (s[j])
978 break;
979 if (j == sizeof (*sense))
980 return;
981
982 printf("\n Additional Sense Information (byte %d out...):\n", i);
983 if (i == 15) {
984 printf("\n\t%2d:", i);
985 k = 7;
986 } else {
987 printf("\n\t%2d:", i);
988 k = 2;
989 j -= 2;
990 }
991 while (j > 0) {
992 if (i >= sizeof (*sense))
993 break;
994 if (k == 8) {
995 k = 0;
996 printf("\n\t%2d:", i);
997 }
998 printf(" 0x%02x", s[i] & 0xff);
999 k++;
1000 j--;
1001 i++;
1002 }
1003 printf("\n\n");
1004 }
1005
1006 static char *
scsipi_decode_sense(void * sinfo,int flag)1007 scsipi_decode_sense(void *sinfo, int flag)
1008 {
1009 unsigned char *snsbuf;
1010 unsigned char skey;
1011 static char rqsbuf[132];
1012
1013 skey = 0;
1014
1015 snsbuf = (unsigned char *) sinfo;
1016 if (flag == 0 || flag == 2 || flag == 3)
1017 skey = snsbuf[2] & 0xf;
1018 if (flag == 0) { /* Sense Key Only */
1019 (void) strlcpy(rqsbuf, sense_keys[skey], sizeof(rqsbuf));
1020 return (rqsbuf);
1021 } else if (flag == 1) { /* ASC/ASCQ Only */
1022 asc2ascii(snsbuf[12], snsbuf[13], rqsbuf, sizeof(rqsbuf));
1023 return (rqsbuf);
1024 } else if (flag == 2) { /* Sense Key && ASC/ASCQ */
1025 auto char localbuf[64];
1026 asc2ascii(snsbuf[12], snsbuf[13], localbuf, sizeof(localbuf));
1027 (void) snprintf(rqsbuf, sizeof(rqsbuf), "%s, %s",
1028 sense_keys[skey], localbuf);
1029 return (rqsbuf);
1030 } else if (flag == 3 && snsbuf[7] >= 9 && (snsbuf[15] & 0x80)) {
1031 /*
1032 * SKSV Data
1033 */
1034 switch (skey) {
1035 case SKEY_ILLEGAL_REQUEST:
1036 if (snsbuf[15] & 0x8)
1037 (void)snprintf(rqsbuf, sizeof(rqsbuf),
1038 "Error in %s, Offset %d, bit %d",
1039 (snsbuf[15] & 0x40)? "CDB" : "Parameters",
1040 (snsbuf[16] & 0xff) << 8 |
1041 (snsbuf[17] & 0xff), snsbuf[15] & 0x7);
1042 else
1043 (void)snprintf(rqsbuf, sizeof(rqsbuf),
1044 "Error in %s, Offset %d",
1045 (snsbuf[15] & 0x40)? "CDB" : "Parameters",
1046 (snsbuf[16] & 0xff) << 8 |
1047 (snsbuf[17] & 0xff));
1048 return (rqsbuf);
1049 case SKEY_RECOVERED_ERROR:
1050 case SKEY_MEDIUM_ERROR:
1051 case SKEY_HARDWARE_ERROR:
1052 (void)snprintf(rqsbuf, sizeof(rqsbuf),
1053 "Actual Retry Count: %d",
1054 (snsbuf[16] & 0xff) << 8 | (snsbuf[17] & 0xff));
1055 return (rqsbuf);
1056 case SKEY_NOT_READY:
1057 (void)snprintf(rqsbuf, sizeof(rqsbuf),
1058 "Progress Indicator: %d",
1059 (snsbuf[16] & 0xff) << 8 | (snsbuf[17] & 0xff));
1060 return (rqsbuf);
1061 default:
1062 break;
1063 }
1064 }
1065 return (NULL);
1066 }
1067
1068 int
scsipi_print_sense_real(struct scsipi_xfer * xs,int verbosity)1069 scsipi_print_sense_real(struct scsipi_xfer *xs, int verbosity)
1070 {
1071 scsipi_printaddr(xs->xs_periph);
1072 printf(" Check Condition on CDB: ");
1073 scsipi_print_cdb(xs->cmd);
1074 printf("\n");
1075 scsipi_print_sense_data(&xs->sense.scsi_sense, verbosity);
1076 return 1;
1077 }
1078