File: /usr/src/linux/drivers/scsi/constants.c
1 /*
2 * ASCII values for a number of symbolic constants, printing functions,
3 * etc.
4 * Additions for SCSI 2 and Linux 2.2.x by D. Gilbert (990422)
5 *
6 */
7
8 #define __NO_VERSION__
9 #include <linux/module.h>
10
11 #include <linux/config.h>
12 #include <linux/blk.h>
13 #include <linux/kernel.h>
14 #include "scsi.h"
15 #include "hosts.h"
16
17 #define CONST_COMMAND 0x01
18 #define CONST_STATUS 0x02
19 #define CONST_SENSE 0x04
20 #define CONST_XSENSE 0x08
21 #define CONST_CMND 0x10
22 #define CONST_MSG 0x20
23 #define CONST_HOST 0x40
24 #define CONST_DRIVER 0x80
25
26 static const char unknown[] = "UNKNOWN";
27
28 #ifdef CONFIG_SCSI_CONSTANTS
29 #ifdef CONSTANTS
30 #undef CONSTANTS
31 #endif
32 #define CONSTANTS (CONST_COMMAND | CONST_STATUS | CONST_SENSE | CONST_XSENSE \
33 | CONST_CMND | CONST_MSG | CONST_HOST | CONST_DRIVER)
34 #endif
35
36 #if (CONSTANTS & CONST_COMMAND)
37 static const char * group_0_commands[] = {
38 /* 00-03 */ "Test Unit Ready", "Rezero Unit", unknown, "Request Sense",
39 /* 04-07 */ "Format Unit", "Read Block Limits", unknown, "Reasssign Blocks",
40 /* 08-0d */ "Read (6)", unknown, "Write (6)", "Seek (6)", unknown, unknown,
41 /* 0e-12 */ unknown, "Read Reverse", "Write Filemarks", "Space", "Inquiry",
42 /* 13-16 */ "Verify", "Recover Buffered Data", "Mode Select", "Reserve",
43 /* 17-1b */ "Release", "Copy", "Erase", "Mode Sense", "Start/Stop Unit",
44 /* 1c-1d */ "Receive Diagnostic", "Send Diagnostic",
45 /* 1e-1f */ "Prevent/Allow Medium Removal", unknown,
46 };
47
48
49 static const char *group_1_commands[] = {
50 /* 20-22 */ unknown, unknown, unknown,
51 /* 23-28 */ unknown, "Define window parameters", "Read Capacity",
52 unknown, unknown, "Read (10)",
53 /* 29-2d */ "Read Generation", "Write (10)", "Seek (10)", "Erase",
54 "Read updated block",
55 /* 2e-31 */ "Write Verify","Verify", "Search High", "Search Equal",
56 /* 32-34 */ "Search Low", "Set Limits", "Prefetch or Read Position",
57 /* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Defect Data",
58 /* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer",
59 "Read Buffer",
60 /* 3d-3f */ "Update Block", "Read Long", "Write Long",
61 };
62
63
64 static const char *group_2_commands[] = {
65 /* 40-41 */ "Change Definition", "Write Same",
66 /* 42-48 */ "Read sub-channel", "Read TOC", "Read header",
67 "Play audio (10)", unknown, "Play audio msf",
68 "Play audio track/index",
69 /* 49-4f */ "Play track relative (10)", unknown, "Pause/resume",
70 "Log Select", "Log Sense", unknown, unknown,
71 /* 50-55 */ unknown, unknown, unknown, unknown, unknown, "Mode Select (10)",
72 /* 56-5b */ unknown, unknown, unknown, unknown, "Mode Sense (10)", unknown,
73 /* 5c-5f */ unknown, unknown, unknown,
74 };
75
76
77 /* The following are 12 byte commands in group 5 */
78 static const char *group_5_commands[] = {
79 /* a0-a5 */ unknown, unknown, unknown, unknown, unknown,
80 "Move medium/play audio(12)",
81 /* a6-a9 */ "Exchange medium", unknown, "Read(12)", "Play track relative(12)",
82 /* aa-ae */ "Write(12)", unknown, "Erase(12)", unknown,
83 "Write and verify(12)",
84 /* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)",
85 /* b2-b4 */ "Search data low(12)", "Set limits(12)", unknown,
86 /* b5-b6 */ "Request volume element address", "Send volume tag",
87 /* b7-b9 */ "Read defect data(12)", "Read element status", unknown,
88 /* ba-bf */ unknown, unknown, unknown, unknown, unknown, unknown,
89 };
90
91
92
93 #define group(opcode) (((opcode) >> 5) & 7)
94
95 #define RESERVED_GROUP 0
96 #define VENDOR_GROUP 1
97
98 static const char **commands[] = {
99 group_0_commands, group_1_commands, group_2_commands,
100 (const char **) RESERVED_GROUP, (const char **) RESERVED_GROUP,
101 group_5_commands, (const char **) VENDOR_GROUP,
102 (const char **) VENDOR_GROUP
103 };
104
105 static const char reserved[] = "RESERVED";
106 static const char vendor[] = "VENDOR SPECIFIC";
107
108 static void print_opcode(int opcode) {
109 const char **table = commands[ group(opcode) ];
110 switch ((unsigned long) table) {
111 case RESERVED_GROUP:
112 printk("%s(0x%02x) ", reserved, opcode);
113 break;
114 case VENDOR_GROUP:
115 printk("%s(0x%02x) ", vendor, opcode);
116 break;
117 default:
118 if (table[opcode & 0x1f] != unknown)
119 printk("%s ",table[opcode & 0x1f]);
120 else
121 printk("%s(0x%02x) ", unknown, opcode);
122 break;
123 }
124 }
125 #else /* CONST & CONST_COMMAND */
126 static void print_opcode(int opcode) {
127 printk("0x%02x ", opcode);
128 }
129 #endif
130
131 void print_command (unsigned char *command) {
132 int i,s;
133 print_opcode(command[0]);
134 for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
135 printk("%02x ", command[i]);
136 printk("\n");
137 }
138
139 #if (CONSTANTS & CONST_STATUS)
140 static const char * statuses[] = {
141 /* 0-4 */ "Good", "Check Condition", "Condition Met", unknown, "Busy",
142 /* 5-9 */ unknown, unknown, unknown, "Intermediate", unknown,
143 /* a-c */ "Intermediate-Condition Met", unknown, "Reservation Conflict",
144 /* d-10 */ unknown, unknown, unknown, unknown,
145 /* 11-14 */ "Command Terminated", unknown, unknown, "Queue Full",
146 /* 15-1a */ unknown, unknown, unknown, unknown, unknown, unknown,
147 /* 1b-1f */ unknown, unknown, unknown, unknown, unknown,
148 };
149 #endif
150
151 void print_status (int status) {
152 status = (status >> 1) & 0x1f;
153 #if (CONSTANTS & CONST_STATUS)
154 printk("%s ",statuses[status]);
155 #else
156 printk("0x%0x ", status);
157 #endif
158 }
159
160 #if (CONSTANTS & CONST_XSENSE)
161 #define D 0x0001 /* DIRECT ACCESS DEVICE (disk) */
162 #define T 0x0002 /* SEQUENTIAL ACCESS DEVICE (tape) */
163 #define L 0x0004 /* PRINTER DEVICE */
164 #define P 0x0008 /* PROCESSOR DEVICE */
165 #define W 0x0010 /* WRITE ONCE READ MULTIPLE DEVICE */
166 #define R 0x0020 /* READ ONLY (CD-ROM) DEVICE */
167 #define S 0x0040 /* SCANNER DEVICE */
168 #define O 0x0080 /* OPTICAL MEMORY DEVICE */
169 #define M 0x0100 /* MEDIA CHANGER DEVICE */
170 #define C 0x0200 /* COMMUNICATION DEVICE */
171 #define A 0x0400 /* ARRAY STORAGE */
172 #define E 0x0800 /* ENCLOSURE SERVICES DEVICE */
173 #define B 0x1000 /* SIMPLIFIED DIRECT ACCESS DEVICE */
174 #define K 0x2000 /* OPTICAL CARD READER/WRITER DEVICE */
175
176 struct error_info{
177 unsigned char code1, code2;
178 unsigned short int devices;
179 const char * text;
180 };
181
182 struct error_info2{
183 unsigned char code1, code2_min, code2_max;
184 unsigned short int devices;
185 const char * text;
186 };
187
188 static struct error_info2 additional2[] =
189 {
190 {0x40,0x00,0x7f,D,"Ram failure (%x)"},
191 {0x40,0x80,0xff,D|T|L|P|W|R|S|O|M|C,"Diagnostic failure on component (%x)"},
192 {0x41,0x00,0xff,D,"Data path failure (%x)"},
193 {0x42,0x00,0xff,D,"Power-on or self-test failure (%x)"},
194 {0, 0, 0, 0, NULL}
195 };
196
197 static struct error_info additional[] =
198 {
199 {0x00,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"No additional sense information"},
200 {0x00,0x01,T,"Filemark detected"},
201 {0x00,0x02,T|S,"End-of-partition/medium detected"},
202 {0x00,0x03,T,"Setmark detected"},
203 {0x00,0x04,T|S,"Beginning-of-partition/medium detected"},
204 {0x00,0x05,T|L|S,"End-of-data detected"},
205 {0x00,0x06,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"I/O process terminated"},
206 {0x00,0x11,R,"Audio play operation in progress"},
207 {0x00,0x12,R,"Audio play operation paused"},
208 {0x00,0x13,R,"Audio play operation successfully completed"},
209 {0x00,0x14,R,"Audio play operation stopped due to error"},
210 {0x00,0x15,R,"No current audio status to return"},
211 {0x00,0x16,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Operation in progress"},
212 {0x00,0x17,D|T|L|W|R|S|O|M|A|E|B|K,"Cleaning requested"},
213 {0x01,0x00,D|W|O|B|K,"No index/sector signal"},
214 {0x02,0x00,D|W|R|O|M|B|K,"No seek complete"},
215 {0x03,0x00,D|T|L|W|S|O|B|K,"Peripheral device write fault"},
216 {0x03,0x01,T,"No write current"},
217 {0x03,0x02,T,"Excessive write errors"},
218 {0x04,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit not ready,cause not reportable"},
219 {0x04,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit is in process of becoming ready"},
220 {0x04,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit not ready,initializing cmd. required"},
221 {0x04,0x03,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit not ready,manual intervention required"},
222 {0x04,0x04,D|T|L|R|O|B,"Logical unit not ready,format in progress"},
223 {0x04,0x05,D|T|W|O|M|C|A|B|K,"Logical unit not ready,rebuild in progress"},
224 {0x04,0x06,D|T|W|O|M|C|A|B|K,"Logical unit not ready,recalculation in progress"},
225 {0x04,0x07,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit not ready,operation in progress"},
226 {0x04,0x08,R,"Logical unit not ready,long write in progress"},
227 {0x04,0x09,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit not ready,self-test in progress"},
228 {0x05,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Logical unit does not respond to selection"},
229 {0x06,0x00,D|W|R|O|M|B|K,"No reference position found"},
230 {0x07,0x00,D|T|L|W|R|S|O|M|B|K,"Multiple peripheral devices selected"},
231 {0x08,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Logical unit communication failure"},
232 {0x08,0x01,D|T|L|W|R|S|O|M|C|A|E|B|K,"Logical unit communication time-out"},
233 {0x08,0x02,D|T|L|W|R|S|O|M|C|A|E|B|K,"Logical unit communication parity error"},
234 {0x08,0x03,D|T|R|O|M|B|K,"Logical unit communication CRC error (Ultra-DMA/32)"},
235 {0x08,0x04,D|T|L|P|W|R|S|O|C|K,"Unreachable copy target"},
236 {0x09,0x00,D|T|W|R|O|B,"Track following error"},
237 {0x09,0x01,W|R|O|K,"Tracking servo failure"},
238 {0x09,0x02,W|R|O|K,"Focus servo failure"},
239 {0x09,0x03,W|R|O,"Spindle servo failure"},
240 {0x09,0x04,D|T|W|R|O|B,"Head select fault"},
241 {0x0A,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Error log overflow"},
242 {0x0B,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Warning"},
243 {0x0B,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Warning - specified temperature exceeded"},
244 {0x0B,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Warning - enclosure degraded"},
245 {0x0C,0x00,T|R|S,"Write error"},
246 {0x0C,0x01,K,"Write error - recovered with auto reallocation"},
247 {0x0C,0x02,D|W|O|B|K,"Write error - auto reallocation failed"},
248 {0x0C,0x03,D|W|O|B|K,"Write error - recommend reassignment"},
249 {0x0C,0x04,D|T|W|O|B,"Compression check miscompare error"},
250 {0x0C,0x05,D|T|W|O|B,"Data expansion occurred during compression"},
251 {0x0C,0x06,D|T|W|O|B,"Block not compressible"},
252 {0x0C,0x07,R,"Write error - recovery needed"},
253 {0x0C,0x08,R,"Write error - recovery failed"},
254 {0x0C,0x09,R,"Write error - loss of streaming"},
255 {0x0C,0x0A,R,"Write error - padding blocks added"},
256 {0x10,0x00,D|W|O|B|K,"Id CRC or ECC error"},
257 {0x11,0x00,D|T|W|R|S|O|B|K,"Unrecovered read error"},
258 {0x11,0x01,D|T|W|R|S|O|B|K,"Read retries exhausted"},
259 {0x11,0x02,D|T|W|R|S|O|B|K,"Error too long to correct"},
260 {0x11,0x03,D|T|W|S|O|B|K,"Multiple read errors"},
261 {0x11,0x04,D|W|O|B|K,"Unrecovered read error - auto reallocate failed"},
262 {0x11,0x05,W|R|O|B,"L-EC uncorrectable error"},
263 {0x11,0x06,W|R|O|B,"CIRC unrecovered error"},
264 {0x11,0x07,W|O|B,"Data re-synchronization error"},
265 {0x11,0x08,T,"Incomplete block read"},
266 {0x11,0x09,T,"No gap found"},
267 {0x11,0x0A,D|T|O|B|K,"Miscorrected error"},
268 {0x11,0x0B,D|W|O|B|K,"Unrecovered read error - recommend reassignment"},
269 {0x11,0x0C,D|W|O|B|K,"Unrecovered read error - recommend rewrite the data"},
270 {0x11,0x0D,D|T|W|R|O|B,"De-compression CRC error"},
271 {0x11,0x0E,D|T|W|R|O|B,"Cannot decompress using declared algorithm"},
272 {0x11,0x0F,R,"Error reading UPC/EAN number"},
273 {0x11,0x10,R,"Error reading ISRC number"},
274 {0x11,0x11,R,"Read error - loss of streaming"},
275 {0x12,0x00,D|W|O|B|K,"Address mark not found for id field"},
276 {0x13,0x00,D|W|O|B|K,"Address mark not found for data field"},
277 {0x14,0x00,D|T|L|W|R|S|O|B|K,"Recorded entity not found"},
278 {0x14,0x01,D|T|W|R|O|B|K,"Record not found"},
279 {0x14,0x02,T,"Filemark or setmark not found"},
280 {0x14,0x03,T,"End-of-data not found"},
281 {0x14,0x04,T,"Block sequence error"},
282 {0x14,0x05,D|T|W|O|B|K,"Record not found - recommend reassignment"},
283 {0x14,0x06,D|T|W|O|B|K,"Record not found - data auto-reallocated"},
284 {0x15,0x00,D|T|L|W|R|S|O|M|B|K,"Random positioning error"},
285 {0x15,0x01,D|T|L|W|R|S|O|M|B|K,"Mechanical positioning error"},
286 {0x15,0x02,D|T|W|R|O|B|K,"Positioning error detected by read of medium"},
287 {0x16,0x00,D|W|O|B|K,"Data synchronization mark error"},
288 {0x16,0x01,D|W|O|B|K,"Data sync error - data rewritten"},
289 {0x16,0x02,D|W|O|B|K,"Data sync error - recommend rewrite"},
290 {0x16,0x03,D|W|O|B|K,"Data sync error - data auto-reallocated"},
291 {0x16,0x04,D|W|O|B|K,"Data sync error - recommend reassignment"},
292 {0x17,0x00,D|T|W|R|S|O|B|K,"Recovered data with no error correction applied"},
293 {0x17,0x01,D|T|W|R|S|O|B|K,"Recovered data with retries"},
294 {0x17,0x02,D|T|W|R|O|B|K,"Recovered data with positive head offset"},
295 {0x17,0x03,D|T|W|R|O|B|K,"Recovered data with negative head offset"},
296 {0x17,0x04,W|R|O|B,"Recovered data with retries and/or circ applied"},
297 {0x17,0x05,D|W|R|O|B|K,"Recovered data using previous sector id"},
298 {0x17,0x06,D|W|O|B|K,"Recovered data without ecc - data auto-reallocated"},
299 {0x17,0x07,D|W|R|O|B|K,"Recovered data without ecc - recommend reassignment"},
300 {0x17,0x08,D|W|R|O|B|K,"Recovered data without ecc - recommend rewrite"},
301 {0x17,0x09,D|W|R|O|B|K,"Recovered data without ecc - data rewritten"},
302 {0x18,0x00,D|T|W|R|O|B|K,"Recovered data with error correction applied"},
303 {0x18,0x01,D|W|R|O|B|K,"Recovered data with error corr. & retries applied"},
304 {0x18,0x02,D|W|R|O|B|K,"Recovered data - data auto-reallocated"},
305 {0x18,0x03,R,"Recovered data with CIRC"},
306 {0x18,0x04,R,"Recovered data with L-EC"},
307 {0x18,0x05,D|W|R|O|B|K,"Recovered data - recommend reassignment"},
308 {0x18,0x06,D|W|R|O|B|K,"Recovered data - recommend rewrite"},
309 {0x18,0x07,D|W|O|B|K,"Recovered data with ecc - data rewritten"},
310 {0x19,0x00,D|O|K,"Defect list error"},
311 {0x19,0x01,D|O|K,"Defect list not available"},
312 {0x19,0x02,D|O|K,"Defect list error in primary list"},
313 {0x19,0x03,D|O|K,"Defect list error in grown list"},
314 {0x1A,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Parameter list length error"},
315 {0x1B,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Synchronous data transfer error"},
316 {0x1C,0x00,D|O|B|K,"Defect list not found"},
317 {0x1C,0x01,D|O|B|K,"Primary defect list not found"},
318 {0x1C,0x02,D|O|B|K,"Grown defect list not found"},
319 {0x1D,0x00,D|T|W|R|O|B|K,"Miscompare during verify operation"},
320 {0x1E,0x00,D|W|O|B|K,"Recovered id with ecc correction"},
321 {0x1F,0x00,D|O|K,"Partial defect list transfer"},
322 {0x20,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Invalid command operation code"},
323 {0x21,0x00,D|T|W|R|O|M|B|K,"Logical block address out of range"},
324 {0x21,0x01,D|T|W|R|O|M|B|K,"Invalid element address"},
325 {0x22,0x00,D,"Illegal function (use 20 00,24 00,or 26 00)"},
326 {0x24,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Invalid field in cdb"},
327 {0x24,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"CDB decryption error"},
328 {0x25,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit not supported"},
329 {0x26,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Invalid field in parameter list"},
330 {0x26,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Parameter not supported"},
331 {0x26,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Parameter value invalid"},
332 {0x26,0x03,D|T|L|P|W|R|S|O|M|C|A|E|K,"Threshold parameters not supported"},
333 {0x26,0x04,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Invalid release of persistent reservation"},
334 {0x26,0x05,D|T|L|P|W|R|S|O|M|C|A|B|K,"Data decryption error"},
335 {0x26,0x06,D|T|L|P|W|R|S|O|C|K,"Too many target descriptors"},
336 {0x26,0x07,D|T|L|P|W|R|S|O|C|K,"Unsupported target descriptor type code"},
337 {0x26,0x08,D|T|L|P|W|R|S|O|C|K,"Too many segment descriptors"},
338 {0x26,0x09,D|T|L|P|W|R|S|O|C|K,"Unsupported segment descriptor type code"},
339 {0x26,0x0A,D|T|L|P|W|R|S|O|C|K,"Unexpected inexact segment"},
340 {0x26,0x0B,D|T|L|P|W|R|S|O|C|K,"Inline data length exceeded"},
341 {0x26,0x0C,D|T|L|P|W|R|S|O|C|K,"Invalid operation for copy source or destination"},
342 {0x26,0x0D,D|T|L|P|W|R|S|O|C|K,"Copy segment granularity violation"},
343 {0x27,0x00,D|T|W|R|O|B|K,"Write protected"},
344 {0x27,0x01,D|T|W|R|O|B|K,"Hardware write protected"},
345 {0x27,0x02,D|T|W|R|O|B|K,"Logical unit software write protected"},
346 {0x27,0x03,T|R,"Associated write protect"},
347 {0x27,0x04,T|R,"Persistent write protect"},
348 {0x27,0x05,T|R,"Permanent write protect"},
349 {0x28,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Not ready to ready change,medium may have changed"},
350 {0x28,0x01,D|T|W|R|O|M|B,"Import or export element accessed"},
351 {0x29,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Power on,reset,or bus device reset occurred"},
352 {0x29,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Power on occurred"},
353 {0x29,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Scsi bus reset occurred"},
354 {0x29,0x03,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Bus device reset function occurred"},
355 {0x29,0x04,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Device internal reset"},
356 {0x29,0x05,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Transceiver mode changed to single-ended"},
357 {0x29,0x06,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Transceiver mode changed to lvd"},
358 {0x2A,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Parameters changed"},
359 {0x2A,0x01,D|T|L|W|R|S|O|M|C|A|E|B|K,"Mode parameters changed"},
360 {0x2A,0x02,D|T|L|W|R|S|O|M|C|A|E|K,"Log parameters changed"},
361 {0x2A,0x03,D|T|L|P|W|R|S|O|M|C|A|E|K,"Reservations preempted"},
362 {0x2A,0x04,D|T|L|P|W|R|S|O|M|C|A|E,"Reservations released"},
363 {0x2A,0x05,D|T|L|P|W|R|S|O|M|C|A|E,"Registrations preempted"},
364 {0x2B,0x00,D|T|L|P|W|R|S|O|C|K,"Copy cannot execute since host cannot disconnect"},
365 {0x2C,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Command sequence error"},
366 {0x2C,0x01,S,"Too many windows specified"},
367 {0x2C,0x02,S,"Invalid combination of windows specified"},
368 {0x2C,0x03,R,"Current program area is not empty"},
369 {0x2C,0x04,R,"Current program area is empty"},
370 {0x2C,0x05,B,"Illegal power condition request"},
371 {0x2D,0x00,T,"Overwrite error on update in place"},
372 {0x2F,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Commands cleared by another initiator"},
373 {0x30,0x00,D|T|W|R|O|M|B|K,"Incompatible medium installed"},
374 {0x30,0x01,D|T|W|R|O|B|K,"Cannot read medium - unknown format"},
375 {0x30,0x02,D|T|W|R|O|B|K,"Cannot read medium - incompatible format"},
376 {0x30,0x03,D|T|R|K,"Cleaning cartridge installed"},
377 {0x30,0x04,D|T|W|R|O|B|K,"Cannot write medium - unknown format"},
378 {0x30,0x05,D|T|W|R|O|B|K,"Cannot write medium - incompatible format"},
379 {0x30,0x06,D|T|W|R|O|B,"Cannot format medium - incompatible medium"},
380 {0x30,0x07,D|T|L|W|R|S|O|M|A|E|B|K,"Cleaning failure"},
381 {0x30,0x08,R,"Cannot write - application code mismatch"},
382 {0x30,0x09,R,"Current session not fixated for append"},
383 {0x31,0x00,D|T|W|R|O|B|K,"Medium format corrupted"},
384 {0x31,0x01,D|L|R|O|B,"Format command failed"},
385 {0x32,0x00,D|W|O|B|K,"No defect spare location available"},
386 {0x32,0x01,D|W|O|B|K,"Defect list update failure"},
387 {0x33,0x00,T,"Tape length error"},
388 {0x34,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Enclosure failure"},
389 {0x35,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Enclosure services failure"},
390 {0x35,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Unsupported enclosure function"},
391 {0x35,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Enclosure services unavailable"},
392 {0x35,0x03,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Enclosure services transfer failure"},
393 {0x35,0x04,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Enclosure services transfer refused"},
394 {0x36,0x00,L,"Ribbon,ink,or toner failure"},
395 {0x37,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Rounded parameter"},
396 {0x38,0x00,B,"Event status notification"},
397 {0x38,0x02,B,"Esn - power management class event"},
398 {0x38,0x04,B,"Esn - media class event"},
399 {0x38,0x06,B,"Esn - device busy class event"},
400 {0x39,0x00,D|T|L|W|R|S|O|M|C|A|E|K,"Saving parameters not supported"},
401 {0x3A,0x00,D|T|L|W|R|S|O|M|B|K,"Medium not present"},
402 {0x3A,0x01,D|T|W|R|O|M|B|K,"Medium not present - tray closed"},
403 {0x3A,0x02,D|T|W|R|O|M|B|K,"Medium not present - tray open"},
404 {0x3A,0x03,D|T|W|R|O|M|B,"Medium not present - loadable"},
405 {0x3A,0x04,D|T|W|R|O|M|B,"Medium not present - medium auxiliary memory accessible"},
406 {0x3B,0x00,T|L,"Sequential positioning error"},
407 {0x3B,0x01,T,"Tape position error at beginning-of-medium"},
408 {0x3B,0x02,T,"Tape position error at end-of-medium"},
409 {0x3B,0x03,L,"Tape or electronic vertical forms unit not ready"},
410 {0x3B,0x04,L,"Slew failure"},
411 {0x3B,0x05,L,"Paper jam"},
412 {0x3B,0x06,L,"Failed to sense top-of-form"},
413 {0x3B,0x07,L,"Failed to sense bottom-of-form"},
414 {0x3B,0x08,T,"Reposition error"},
415 {0x3B,0x09,S,"Read past end of medium"},
416 {0x3B,0x0A,S,"Read past beginning of medium"},
417 {0x3B,0x0B,S,"Position past end of medium"},
418 {0x3B,0x0C,T|S,"Position past beginning of medium"},
419 {0x3B,0x0D,D|T|W|R|O|M|B|K,"Medium destination element full"},
420 {0x3B,0x0E,D|T|W|R|O|M|B|K,"Medium source element empty"},
421 {0x3B,0x0F,R,"End of medium reached"},
422 {0x3B,0x11,D|T|W|R|O|M|B|K,"Medium magazine not accessible"},
423 {0x3B,0x12,D|T|W|R|O|M|B|K,"Medium magazine removed"},
424 {0x3B,0x13,D|T|W|R|O|M|B|K,"Medium magazine inserted"},
425 {0x3B,0x14,D|T|W|R|O|M|B|K,"Medium magazine locked"},
426 {0x3B,0x15,D|T|W|R|O|M|B|K,"Medium magazine unlocked"},
427 {0x3B,0x16,R,"Mechanical positioning or changer error"},
428 {0x3D,0x00,D|T|L|P|W|R|S|O|M|C|A|E|K,"Invalid bits in identify message"},
429 {0x3E,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit has not self-configured yet"},
430 {0x3E,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit failure"},
431 {0x3E,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Timeout on logical unit"},
432 {0x3E,0x03,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit failed self-test"},
433 {0x3E,0x04,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit unable to update self-test log"},
434 {0x3F,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Target operating conditions have changed"},
435 {0x3F,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Microcode has been changed"},
436 {0x3F,0x02,D|T|L|P|W|R|S|O|M|C|B|K,"Changed operating definition"},
437 {0x3F,0x03,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Inquiry data has changed"},
438 {0x3F,0x04,D|T|W|R|O|M|C|A|E|B|K,"Component device attached"},
439 {0x3F,0x05,D|T|W|R|O|M|C|A|E|B|K,"Device identifier changed"},
440 {0x3F,0x06,D|T|W|R|O|M|C|A|E|B,"Redundancy group created or modified"},
441 {0x3F,0x07,D|T|W|R|O|M|C|A|E|B,"Redundancy group deleted"},
442 {0x3F,0x08,D|T|W|R|O|M|C|A|E|B,"Spare created or modified"},
443 {0x3F,0x09,D|T|W|R|O|M|C|A|E|B,"Spare deleted"},
444 {0x3F,0x0A,D|T|W|R|O|M|C|A|E|B|K,"Volume set created or modified"},
445 {0x3F,0x0B,D|T|W|R|O|M|C|A|E|B|K,"Volume set deleted"},
446 {0x3F,0x0C,D|T|W|R|O|M|C|A|E|B|K,"Volume set deassigned"},
447 {0x3F,0x0D,D|T|W|R|O|M|C|A|E|B|K,"Volume set reassigned"},
448 {0x3F,0x0E,D|T|L|P|W|R|S|O|M|C|A|E,"Reported luns data has changed"},
449 {0x3F,0x10,D|T|W|R|O|M|B,"Medium loadable"},
450 {0x3F,0x11,D|T|W|R|O|M|B,"Medium auxiliary memory accessible"},
451 {0x40,0x00,D,"Ram failure (should use 40 nn)"},
452 /*
453 * FIXME(eric) - need a way to represent wildcards here.
454 */
455 {0x40,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Diagnostic failure on component nn (80h-ffh)"},
456 {0x41,0x00,D,"Data path failure (should use 40 nn)"},
457 {0x42,0x00,D,"Power-on or self-test failure (should use 40 nn)"},
458 {0x43,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Message error"},
459 {0x44,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Internal target failure"},
460 {0x45,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Select or reselect failure"},
461 {0x46,0x00,D|T|L|P|W|R|S|O|M|C|B|K,"Unsuccessful soft reset"},
462 {0x47,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Scsi parity error"},
463 {0x47,0x01,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Data phase CRC error detected"},
464 {0x47,0x02,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Scsi parity error detected during st data phase"},
465 {0x47,0x03,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Information unit CRC error detected"},
466 {0x47,0x04,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Asynchronous information protection error detected"},
467 {0x48,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Initiator detected error message received"},
468 {0x49,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Invalid message error"},
469 {0x4A,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Command phase error"},
470 {0x4B,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Data phase error"},
471 {0x4C,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Logical unit failed self-configuration"},
472 /*
473 * FIXME(eric) - need a way to represent wildcards here.
474 */
475 {0x4D,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Tagged overlapped commands (nn = queue tag)"},
476 {0x4E,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Overlapped commands attempted"},
477 {0x50,0x00,T,"Write append error"},
478 {0x50,0x01,T,"Write append position error"},
479 {0x50,0x02,T,"Position error related to timing"},
480 {0x51,0x00,T|R|O,"Erase failure"},
481 {0x52,0x00,T,"Cartridge fault"},
482 {0x53,0x00,D|T|L|W|R|S|O|M|B|K,"Media load or eject failed"},
483 {0x53,0x01,T,"Unload tape failure"},
484 {0x53,0x02,D|T|W|R|O|M|B|K,"Medium removal prevented"},
485 {0x54,0x00,P,"Scsi to host system interface failure"},
486 {0x55,0x00,P,"System resource failure"},
487 {0x55,0x01,D|O|B|K,"System buffer full"},
488 {0x55,0x02,D|T|L|P|W|R|S|O|M|A|E|K,"Insufficient reservation resources"},
489 {0x55,0x03,D|T|L|P|W|R|S|O|M|C|A|E,"Insufficient resources"},
490 {0x55,0x04,D|T|L|P|W|R|S|O|M|A|E,"Insufficient registration resources"},
491 {0x57,0x00,R,"Unable to recover table-of-contents"},
492 {0x58,0x00,O,"Generation does not exist"},
493 {0x59,0x00,O,"Updated block read"},
494 {0x5A,0x00,D|T|L|P|W|R|S|O|M|B|K,"Operator request or state change input"},
495 {0x5A,0x01,D|T|W|R|O|M|B|K,"Operator medium removal request"},
496 {0x5A,0x02,D|T|W|R|O|A|B|K,"Operator selected write protect"},
497 {0x5A,0x03,D|T|W|R|O|A|B|K,"Operator selected write permit"},
498 {0x5B,0x00,D|T|L|P|W|R|S|O|M|K,"Log exception"},
499 {0x5B,0x01,D|T|L|P|W|R|S|O|M|K,"Threshold condition met"},
500 {0x5B,0x02,D|T|L|P|W|R|S|O|M|K,"Log counter at maximum"},
501 {0x5B,0x03,D|T|L|P|W|R|S|O|M|K,"Log list codes exhausted"},
502 {0x5C,0x00,D|O,"Rpl status change"},
503 {0x5C,0x01,D|O,"Spindles synchronized"},
504 {0x5C,0x02,D|O,"Spindles not synchronized"},
505 {0x5D,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Failure prediction threshold exceeded"},
506 {0x5D,0x01,R|B,"Media failure prediction threshold exceeded"},
507 {0x5D,0x02,R,"Logical unit failure prediction threshold exceeded"},
508 {0x5D,0x10,D|B,"Hardware impending failure general hard drive failure"},
509 {0x5D,0x11,D|B,"Hardware impending failure drive error rate too high"},
510 {0x5D,0x12,D|B,"Hardware impending failure data error rate too high"},
511 {0x5D,0x13,D|B,"Hardware impending failure seek error rate too high"},
512 {0x5D,0x14,D|B,"Hardware impending failure too many block reassigns"},
513 {0x5D,0x15,D|B,"Hardware impending failure access times too high"},
514 {0x5D,0x16,D|B,"Hardware impending failure start unit times too high"},
515 {0x5D,0x17,D|B,"Hardware impending failure channel parametrics"},
516 {0x5D,0x18,D|B,"Hardware impending failure controller detected"},
517 {0x5D,0x19,D|B,"Hardware impending failure throughput performance"},
518 {0x5D,0x1A,D|B,"Hardware impending failure seek time performance"},
519 {0x5D,0x1B,D|B,"Hardware impending failure spin-up retry count"},
520 {0x5D,0x1C,D|B,"Hardware impending failure drive calibration retry count"},
521 {0x5D,0x20,D|B,"Controller impending failure general hard drive failure"},
522 {0x5D,0x21,D|B,"Controller impending failure drive error rate too high"},
523 {0x5D,0x22,D|B,"Controller impending failure data error rate too high"},
524 {0x5D,0x23,D|B,"Controller impending failure seek error rate too high"},
525 {0x5D,0x24,D|B,"Controller impending failure too many block reassigns"},
526 {0x5D,0x25,D|B,"Controller impending failure access times too high"},
527 {0x5D,0x26,D|B,"Controller impending failure start unit times too high"},
528 {0x5D,0x27,D|B,"Controller impending failure channel parametrics"},
529 {0x5D,0x28,D|B,"Controller impending failure controller detected"},
530 {0x5D,0x29,D|B,"Controller impending failure throughput performance"},
531 {0x5D,0x2A,D|B,"Controller impending failure seek time performance"},
532 {0x5D,0x2B,D|B,"Controller impending failure spin-up retry count"},
533 {0x5D,0x2C,D|B,"Controller impending failure drive calibration retry count"},
534 {0x5D,0x30,D|B,"Data channel impending failure general hard drive failure"},
535 {0x5D,0x31,D|B,"Data channel impending failure drive error rate too high"},
536 {0x5D,0x32,D|B,"Data channel impending failure data error rate too high"},
537 {0x5D,0x33,D|B,"Data channel impending failure seek error rate too high"},
538 {0x5D,0x34,D|B,"Data channel impending failure too many block reassigns"},
539 {0x5D,0x35,D|B,"Data channel impending failure access times too high"},
540 {0x5D,0x36,D|B,"Data channel impending failure start unit times too high"},
541 {0x5D,0x37,D|B,"Data channel impending failure channel parametrics"},
542 {0x5D,0x38,D|B,"Data channel impending failure controller detected"},
543 {0x5D,0x39,D|B,"Data channel impending failure throughput performance"},
544 {0x5D,0x3A,D|B,"Data channel impending failure seek time performance"},
545 {0x5D,0x3B,D|B,"Data channel impending failure spin-up retry count"},
546 {0x5D,0x3C,D|B,"Data channel impending failure drive calibration retry count"},
547 {0x5D,0x40,D|B,"Servo impending failure general hard drive failure"},
548 {0x5D,0x41,D|B,"Servo impending failure drive error rate too high"},
549 {0x5D,0x42,D|B,"Servo impending failure data error rate too high"},
550 {0x5D,0x43,D|B,"Servo impending failure seek error rate too high"},
551 {0x5D,0x44,D|B,"Servo impending failure too many block reassigns"},
552 {0x5D,0x45,D|B,"Servo impending failure access times too high"},
553 {0x5D,0x46,D|B,"Servo impending failure start unit times too high"},
554 {0x5D,0x47,D|B,"Servo impending failure channel parametrics"},
555 {0x5D,0x48,D|B,"Servo impending failure controller detected"},
556 {0x5D,0x49,D|B,"Servo impending failure throughput performance"},
557 {0x5D,0x4A,D|B,"Servo impending failure seek time performance"},
558 {0x5D,0x4B,D|B,"Servo impending failure spin-up retry count"},
559 {0x5D,0x4C,D|B,"Servo impending failure drive calibration retry count"},
560 {0x5D,0x50,D|B,"Spindle impending failure general hard drive failure"},
561 {0x5D,0x51,D|B,"Spindle impending failure drive error rate too high"},
562 {0x5D,0x52,D|B,"Spindle impending failure data error rate too high"},
563 {0x5D,0x53,D|B,"Spindle impending failure seek error rate too high"},
564 {0x5D,0x54,D|B,"Spindle impending failure too many block reassigns"},
565 {0x5D,0x55,D|B,"Spindle impending failure access times too high"},
566 {0x5D,0x56,D|B,"Spindle impending failure start unit times too high"},
567 {0x5D,0x57,D|B,"Spindle impending failure channel parametrics"},
568 {0x5D,0x58,D|B,"Spindle impending failure controller detected"},
569 {0x5D,0x59,D|B,"Spindle impending failure throughput performance"},
570 {0x5D,0x5A,D|B,"Spindle impending failure seek time performance"},
571 {0x5D,0x5B,D|B,"Spindle impending failure spin-up retry count"},
572 {0x5D,0x5C,D|B,"Spindle impending failure drive calibration retry count"},
573 {0x5D,0x60,D|B,"Firmware impending failure general hard drive failure"},
574 {0x5D,0x61,D|B,"Firmware impending failure drive error rate too high"},
575 {0x5D,0x62,D|B,"Firmware impending failure data error rate too high"},
576 {0x5D,0x63,D|B,"Firmware impending failure seek error rate too high"},
577 {0x5D,0x64,D|B,"Firmware impending failure too many block reassigns"},
578 {0x5D,0x65,D|B,"Firmware impending failure access times too high"},
579 {0x5D,0x66,D|B,"Firmware impending failure start unit times too high"},
580 {0x5D,0x67,D|B,"Firmware impending failure channel parametrics"},
581 {0x5D,0x68,D|B,"Firmware impending failure controller detected"},
582 {0x5D,0x69,D|B,"Firmware impending failure throughput performance"},
583 {0x5D,0x6A,D|B,"Firmware impending failure seek time performance"},
584 {0x5D,0x6B,D|B,"Firmware impending failure spin-up retry count"},
585 {0x5D,0x6C,D|B,"Firmware impending failure drive calibration retry count"},
586 {0x5D,0xFF,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Failure prediction threshold exceeded (false)"},
587 {0x5E,0x00,D|T|L|P|W|R|S|O|C|A|K,"Low power condition on"},
588 {0x5E,0x01,D|T|L|P|W|R|S|O|C|A|K,"Idle condition activated by timer"},
589 {0x5E,0x02,D|T|L|P|W|R|S|O|C|A|K,"Standby condition activated by timer"},
590 {0x5E,0x03,D|T|L|P|W|R|S|O|C|A|K,"Idle condition activated by command"},
591 {0x5E,0x04,D|T|L|P|W|R|S|O|C|A|K,"Standby condition activated by command"},
592 {0x5E,0x41,B,"Power state change to active"},
593 {0x5E,0x42,B,"Power state change to idle"},
594 {0x5E,0x43,B,"Power state change to standby"},
595 {0x5E,0x45,B,"Power state change to sleep"},
596 {0x5E,0x47,B|K,"Power state change to device control"},
597 {0x60,0x00,S,"Lamp failure"},
598 {0x61,0x00,S,"Video acquisition error"},
599 {0x61,0x01,S,"Unable to acquire video"},
600 {0x61,0x02,S,"Out of focus"},
601 {0x62,0x00,S,"Scan head positioning error"},
602 {0x63,0x00,R,"End of user area encountered on this track"},
603 {0x63,0x01,R,"Packet does not fit in available space"},
604 {0x64,0x00,R,"Illegal mode for this track"},
605 {0x64,0x01,R,"Invalid packet size"},
606 {0x65,0x00,D|T|L|P|W|R|S|O|M|C|A|E|B|K,"Voltage fault"},
607 {0x66,0x00,S,"Automatic document feeder cover up"},
608 {0x66,0x01,S,"Automatic document feeder lift up"},
609 {0x66,0x02,S,"Document jam in automatic document feeder"},
610 {0x66,0x03,S,"Document miss feed automatic in document feeder"},
611 {0x67,0x00,A,"Configuration failure"},
612 {0x67,0x01,A,"Configuration of incapable logical units failed"},
613 {0x67,0x02,A,"Add logical unit failed"},
614 {0x67,0x03,A,"Modification of logical unit failed"},
615 {0x67,0x04,A,"Exchange of logical unit failed"},
616 {0x67,0x05,A,"Remove of logical unit failed"},
617 {0x67,0x06,A,"Attachment of logical unit failed"},
618 {0x67,0x07,A,"Creation of logical unit failed"},
619 {0x67,0x08,A,"Assign failure occurred"},
620 {0x67,0x09,A,"Multiply assigned logical unit"},
621 {0x68,0x00,A,"Logical unit not configured"},
622 {0x69,0x00,A,"Data loss on logical unit"},
623 {0x69,0x01,A,"Multiple logical unit failures"},
624 {0x69,0x02,A,"Parity/data mismatch"},
625 {0x6A,0x00,A,"Informational,refer to log"},
626 {0x6B,0x00,A,"State change has occurred"},
627 {0x6B,0x01,A,"Redundancy level got better"},
628 {0x6B,0x02,A,"Redundancy level got worse"},
629 {0x6C,0x00,A,"Rebuild failure occurred"},
630 {0x6D,0x00,A,"Recalculate failure occurred"},
631 {0x6E,0x00,A,"Command to logical unit failed"},
632 {0x6F,0x00,R,"Copy protection key exchange failure - authentication failure"},
633 {0x6F,0x01,R,"Copy protection key exchange failure - key not present"},
634 {0x6F,0x02,R,"Copy protection key exchange failure - key not established"},
635 {0x6F,0x03,R,"Read of scrambled sector without authentication"},
636 {0x6F,0x04,R,"Media region code is mismatched to logical unit region"},
637 {0x6F,0x05,R,"Drive region must be permanent/region reset count error"},
638 /*
639 * FIXME(eric) - need a way to represent wildcards here.
640 */
641 {0x70,0x00,T,"Decompression exception short algorithm id of nn"},
642 {0x71,0x00,T,"Decompression exception long algorithm id"},
643 {0x72,0x00,R,"Session fixation error"},
644 {0x72,0x01,R,"Session fixation error writing lead-in"},
645 {0x72,0x02,R,"Session fixation error writing lead-out"},
646 {0x72,0x03,R,"Session fixation error - incomplete track in session"},
647 {0x72,0x04,R,"Empty or partially written reserved track"},
648 {0x72,0x05,R,"No more track reservations allowed"},
649 {0x73,0x00,R,"Cd control error"},
650 {0x73,0x01,R,"Power calibration area almost full"},
651 {0x73,0x02,R,"Power calibration area is full"},
652 {0x73,0x03,R,"Power calibration area error"},
653 {0x73,0x04,R,"Program memory area update failure"},
654 {0x73,0x05,R,"Program memory area is full"},
655 {0x73,0x06,R,"RMA/PMA is full"},
656 {0, 0, 0, NULL}
657 };
658 #endif
659
660 #if (CONSTANTS & CONST_SENSE)
661 static const char *snstext[] = {
662 "None", /* There is no sense information */
663 "Recovered Error", /* The last command completed successfully
664 but used error correction */
665 "Not Ready", /* The addressed target is not ready */
666 "Medium Error", /* Data error detected on the medium */
667 "Hardware Error", /* Controller or device failure */
668 "Illegal Request",
669 "Unit Attention", /* Removable medium was changed, or
670 the target has been reset */
671 "Data Protect", /* Access to the data is blocked */
672 "Blank Check", /* Reached unexpected written or unwritten
673 region of the medium */
674 "Key=9", /* Vendor specific */
675 "Copy Aborted", /* COPY or COMPARE was aborted */
676 "Aborted Command", /* The target aborted the command */
677 "Equal", /* A SEARCH DATA command found data equal */
678 "Volume Overflow", /* Medium full with still data to be written */
679 "Miscompare", /* Source data and data on the medium
680 do not agree */
681 "Key=15" /* Reserved */
682 };
683 #endif
684
685 /* Print sense information */
686 static
687 void print_sense_internal(const char * devclass,
688 const unsigned char * sense_buffer,
689 kdev_t dev)
690 {
691 int i, s;
692 int sense_class, valid, code, info;
693 const char * error = NULL;
694
695 sense_class = (sense_buffer[0] >> 4) & 0x07;
696 code = sense_buffer[0] & 0xf;
697 valid = sense_buffer[0] & 0x80;
698
699 if (sense_class == 7) { /* extended sense data */
700 s = sense_buffer[7] + 8;
701 if(s > SCSI_SENSE_BUFFERSIZE)
702 s = SCSI_SENSE_BUFFERSIZE;
703
704 info = ((sense_buffer[3] << 24) | (sense_buffer[4] << 16) |
705 (sense_buffer[5] << 8) | sense_buffer[6]);
706 if (info || valid) {
707 printk("Info fld=0x%x", info);
708 if (!valid) /* info data not according to standard */
709 printk(" (nonstd)");
710 printk(", ");
711 }
712 if (sense_buffer[2] & 0x80)
713 printk( "FMK "); /* current command has read a filemark */
714 if (sense_buffer[2] & 0x40)
715 printk( "EOM "); /* end-of-medium condition exists */
716 if (sense_buffer[2] & 0x20)
717 printk( "ILI "); /* incorrect block length requested */
718
719 switch (code) {
720 case 0x0:
721 error = "Current"; /* error concerns current command */
722 break;
723 case 0x1:
724 error = "Deferred"; /* error concerns some earlier command */
725 /* e.g., an earlier write to disk cache succeeded, but
726 now the disk discovers that it cannot write the data */
727 break;
728 default:
729 error = "Invalid";
730 }
731
732 printk("%s ", error);
733
734 #if (CONSTANTS & CONST_SENSE)
735 printk( "%s%s: sense key %s\n", devclass,
736 kdevname(dev), snstext[sense_buffer[2] & 0x0f]);
737 #else
738 printk("%s%s: sns = %2x %2x\n", devclass,
739 kdevname(dev), sense_buffer[0], sense_buffer[2]);
740 #endif
741
742 /* Check to see if additional sense information is available */
743 if(sense_buffer[7] + 7 < 13 ||
744 (sense_buffer[12] == 0 && sense_buffer[13] == 0)) goto done;
745
746 #if (CONSTANTS & CONST_XSENSE)
747 for(i=0; additional[i].text; i++)
748 if(additional[i].code1 == sense_buffer[12] &&
749 additional[i].code2 == sense_buffer[13])
750 printk("Additional sense indicates %s\n", additional[i].text);
751
752 for(i=0; additional2[i].text; i++)
753 if(additional2[i].code1 == sense_buffer[12] &&
754 additional2[i].code2_min >= sense_buffer[13] &&
755 additional2[i].code2_max <= sense_buffer[13]) {
756 printk("Additional sense indicates ");
757 printk(additional2[i].text, sense_buffer[13]);
758 printk("\n");
759 };
760 #else
761 printk("ASC=%2x ASCQ=%2x\n", sense_buffer[12], sense_buffer[13]);
762 #endif
763 } else { /* non-extended sense data */
764
765 /*
766 * Standard says:
767 * sense_buffer[0] & 0200 : address valid
768 * sense_buffer[0] & 0177 : vendor-specific error code
769 * sense_buffer[1] & 0340 : vendor-specific
770 * sense_buffer[1..3] : 21-bit logical block address
771 */
772
773 #if (CONSTANTS & CONST_SENSE)
774 if (sense_buffer[0] < 15)
775 printk("%s%s: old sense key %s\n", devclass,
776 kdevname(dev), snstext[sense_buffer[0] & 0x0f]);
777 else
778 #endif
779 printk("%s%s: sns = %2x %2x\n", devclass,
780 kdevname(dev), sense_buffer[0], sense_buffer[2]);
781
782 printk("Non-extended sense class %d code 0x%0x\n", sense_class, code);
783 s = 4;
784 }
785
786 done:
787 #if !(CONSTANTS & CONST_SENSE)
788 printk("Raw sense data:");
789 for (i = 0; i < s; ++i)
790 printk("0x%02x ", sense_buffer[i]);
791 printk("\n");
792 #endif
793 return;
794 }
795
796 void print_sense(const char * devclass, Scsi_Cmnd * SCpnt)
797 {
798 print_sense_internal(devclass, SCpnt->sense_buffer,
799 SCpnt->request.rq_dev);
800 }
801
802 void print_req_sense(const char * devclass, Scsi_Request * SRpnt)
803 {
804 print_sense_internal(devclass, SRpnt->sr_sense_buffer,
805 SRpnt->sr_request.rq_dev);
806 }
807
808 #if (CONSTANTS & CONST_MSG)
809 static const char *one_byte_msgs[] = {
810 /* 0x00 */ "Command Complete", NULL, "Save Pointers",
811 /* 0x03 */ "Restore Pointers", "Disconnect", "Initiator Error",
812 /* 0x06 */ "Abort", "Message Reject", "Nop", "Message Parity Error",
813 /* 0x0a */ "Linked Command Complete", "Linked Command Complete w/flag",
814 /* 0x0c */ "Bus device reset", "Abort Tag", "Clear Queue",
815 /* 0x0f */ "Initiate Recovery", "Release Recovery"
816 };
817
818 #define NO_ONE_BYTE_MSGS (sizeof(one_byte_msgs) / sizeof (const char *))
819
820 static const char *two_byte_msgs[] = {
821 /* 0x20 */ "Simple Queue Tag", "Head of Queue Tag", "Ordered Queue Tag"
822 /* 0x23 */ "Ignore Wide Residue"
823 };
824
825 #define NO_TWO_BYTE_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
826
827 static const char *extended_msgs[] = {
828 /* 0x00 */ "Modify Data Pointer", "Synchronous Data Transfer Request",
829 /* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request"
830 };
831
832 #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
833 #endif /* (CONSTANTS & CONST_MSG) */
834
835 int print_msg (const unsigned char *msg) {
836 int len = 0, i;
837 if (msg[0] == EXTENDED_MESSAGE) {
838 len = 3 + msg[1];
839 #if (CONSTANTS & CONST_MSG)
840 if (msg[2] < NO_EXTENDED_MSGS)
841 printk ("%s ", extended_msgs[msg[2]]);
842 else
843 printk ("Extended Message, reserved code (0x%02x) ", (int) msg[2]);
844 switch (msg[2]) {
845 case EXTENDED_MODIFY_DATA_POINTER:
846 printk("pointer = %d", (int) (msg[3] << 24) | (msg[4] << 16) |
847 (msg[5] << 8) | msg[6]);
848 break;
849 case EXTENDED_SDTR:
850 printk("period = %d ns, offset = %d", (int) msg[3] * 4, (int)
851 msg[4]);
852 break;
853 case EXTENDED_WDTR:
854 printk("width = 2^%d bytes", msg[3]);
855 break;
856 default:
857 for (i = 2; i < len; ++i)
858 printk("%02x ", msg[i]);
859 }
860 #else
861 for (i = 0; i < len; ++i)
862 printk("%02x ", msg[i]);
863 #endif
864 /* Identify */
865 } else if (msg[0] & 0x80) {
866 #if (CONSTANTS & CONST_MSG)
867 printk("Identify disconnect %sallowed %s %d ",
868 (msg[0] & 0x40) ? "" : "not ",
869 (msg[0] & 0x20) ? "target routine" : "lun",
870 msg[0] & 0x7);
871 #else
872 printk("%02x ", msg[0]);
873 #endif
874 len = 1;
875 /* Normal One byte */
876 } else if (msg[0] < 0x1f) {
877 #if (CONSTANTS & CONST_MSG)
878 if (msg[0] < NO_ONE_BYTE_MSGS)
879 printk(one_byte_msgs[msg[0]]);
880 else
881 printk("reserved (%02x) ", msg[0]);
882 #else
883 printk("%02x ", msg[0]);
884 #endif
885 len = 1;
886 /* Two byte */
887 } else if (msg[0] <= 0x2f) {
888 #if (CONSTANTS & CONST_MSG)
889 if ((msg[0] - 0x20) < NO_TWO_BYTE_MSGS)
890 printk("%s %02x ", two_byte_msgs[msg[0] - 0x20],
891 msg[1]);
892 else
893 printk("reserved two byte (%02x %02x) ",
894 msg[0], msg[1]);
895 #else
896 printk("%02x %02x", msg[0], msg[1]);
897 #endif
898 len = 2;
899 } else
900 #if (CONSTANTS & CONST_MSG)
901 printk(reserved);
902 #else
903 printk("%02x ", msg[0]);
904 #endif
905 return len;
906 }
907
908 void print_Scsi_Cmnd (Scsi_Cmnd *cmd) {
909 printk("scsi%d : destination target %d, lun %d\n",
910 cmd->host->host_no,
911 cmd->target,
912 cmd->lun);
913 printk(" command = ");
914 print_command (cmd->cmnd);
915 }
916
917 #if (CONSTANTS & CONST_HOST)
918 static const char * hostbyte_table[]={
919 "DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET",
920 "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR",
921 "DID_PASSTHROUGH", "DID_SOFT_ERROR", NULL};
922
923 void print_hostbyte(int scsiresult)
924 { static int maxcode=0;
925 int i;
926
927 if(!maxcode) {
928 for(i=0;hostbyte_table[i];i++) ;
929 maxcode=i-1;
930 }
931 printk("Hostbyte=0x%02x",host_byte(scsiresult));
932 if(host_byte(scsiresult)>maxcode) {
933 printk("is invalid ");
934 return;
935 }
936 printk("(%s) ",hostbyte_table[host_byte(scsiresult)]);
937 }
938 #else
939 void print_hostbyte(int scsiresult)
940 { printk("Hostbyte=0x%02x ",host_byte(scsiresult));
941 }
942 #endif
943
944 #if (CONSTANTS & CONST_DRIVER)
945 static const char * driverbyte_table[]={
946 "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR",
947 "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD",NULL };
948
949 static const char * driversuggest_table[]={"SUGGEST_OK",
950 "SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE",
951 unknown,unknown,unknown, "SUGGEST_SENSE",NULL};
952
953
954 void print_driverbyte(int scsiresult)
955 { static int driver_max=0,suggest_max=0;
956 int i,dr=driver_byte(scsiresult)&DRIVER_MASK,
957 su=(driver_byte(scsiresult)&SUGGEST_MASK)>>4;
958
959 if(!driver_max) {
960 for(i=0;driverbyte_table[i];i++) ;
961 driver_max=i;
962 for(i=0;driversuggest_table[i];i++) ;
963 suggest_max=i;
964 }
965 printk("Driverbyte=0x%02x",driver_byte(scsiresult));
966 printk("(%s,%s) ",
967 dr<driver_max ? driverbyte_table[dr]:"invalid",
968 su<suggest_max ? driversuggest_table[su]:"invalid");
969 }
970 #else
971 void print_driverbyte(int scsiresult)
972 { printk("Driverbyte=0x%02x ",driver_byte(scsiresult));
973 }
974 #endif
975
976 /*
977 * Overrides for Emacs so that we almost follow Linus's tabbing style.
978 * Emacs will notice this stuff at the end of the file and automatically
979 * adjust the settings for this buffer only. This must remain at the end
980 * of the file.
981 * ---------------------------------------------------------------------------
982 * Local variables:
983 * c-indent-level: 4
984 * c-brace-imaginary-offset: 0
985 * c-brace-offset: -4
986 * c-argdecl-indent: 4
987 * c-label-offset: -4
988 * c-continued-statement-offset: 4
989 * c-continued-brace-offset: 0
990 * indent-tabs-mode: nil
991 * tab-width: 8
992 * End:
993 */
994