Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / drivers / scsi / constants.c
blob5a74bc2df9a5a93fb02957bb20ecc9688bdbfa5b
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)
6 */
8 #define __NO_VERSION__
9 #include <linux/module.h>
11 #include <linux/config.h>
12 #include <linux/blk.h>
13 #include <linux/kernel.h>
14 #include"scsi.h"
15 #include"hosts.h"
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
26 static const char unknown[] ="UNKNOWN";
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
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,
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",
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,
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,
93 #define group(opcode) (((opcode) >> 5) & 7)
95 #define RESERVED_GROUP 0
96 #define VENDOR_GROUP 1
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
105 static const char reserved[] ="RESERVED";
106 static const char vendor[] ="VENDOR SPECIFIC";
108 static voidprint_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;
125 #else/* CONST & CONST_COMMAND */
126 static voidprint_opcode(int opcode) {
127 printk("0x%02x ", opcode);
129 #endif
131 voidprint_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");
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,
149 #endif
151 voidprint_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
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 */
176 struct error_info{
177 unsigned char code1, code2;
178 unsigned short int devices;
179 const char* text;
182 struct error_info2{
183 unsigned char code1, code2_min, code2_max;
184 unsigned short int devices;
185 const char* text;
188 static struct error_info2 additional2[] =
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}
197 static struct error_info additional[] =
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)"},
453 * FIXME(eric) - need a way to represent wildcards here.
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"},
473 * FIXME(eric) - need a way to represent wildcards here.
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"},
639 * FIXME(eric) - need a way to represent wildcards here.
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}
658 #endif
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 */
683 #endif
685 /* Print sense information */
686 static
687 voidprint_sense_internal(const char* devclass,
688 const unsigned char* sense_buffer,
689 kdev_t dev)
691 int i, s;
692 int sense_class, valid, code;
693 const char* error = NULL;
695 sense_class = (sense_buffer[0] >>4) &0x07;
696 code = sense_buffer[0] &0xf;
697 valid = sense_buffer[0] &0x80;
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;
704 if(!valid)
705 printk("[valid=0] ");
706 printk("Info fld=0x%x, ", (int)((sense_buffer[3] <<24) |
707 (sense_buffer[4] <<16) | (sense_buffer[5] <<8) |
708 sense_buffer[6]));
709 if(sense_buffer[2] &0x80)
710 printk("FMK ");/* current command has read a filemark */
711 if(sense_buffer[2] &0x40)
712 printk("EOM ");/* end-of-medium condition exists */
713 if(sense_buffer[2] &0x20)
714 printk("ILI ");/* incorrect block length requested */
716 switch(code) {
717 case0x0:
718 error ="Current";/* error concerns current command */
719 break;
720 case0x1:
721 error ="Deferred";/* error concerns some earlier command */
722 /* e.g., an earlier write to disk cache succeeded, but
723 now the disk discovers that it cannot write the data */
724 break;
725 default:
726 error ="Invalid";
729 printk("%s ", error);
731 #if (CONSTANTS & CONST_SENSE)
732 printk("%s%s: sense key %s\n", devclass,
733 kdevname(dev), snstext[sense_buffer[2] &0x0f]);
734 #else
735 printk("%s%s: sns = %2x %2x\n", devclass,
736 kdevname(dev), sense_buffer[0], sense_buffer[2]);
737 #endif
739 /* Check to see if additional sense information is available */
740 if(sense_buffer[7] +7<13||
741 (sense_buffer[12] ==0&& sense_buffer[13] ==0))goto done;
743 #if (CONSTANTS & CONST_XSENSE)
744 for(i=0; additional[i].text; i++)
745 if(additional[i].code1 == sense_buffer[12] &&
746 additional[i].code2 == sense_buffer[13])
747 printk("Additional sense indicates %s\n", additional[i].text);
749 for(i=0; additional2[i].text; i++)
750 if(additional2[i].code1 == sense_buffer[12] &&
751 additional2[i].code2_min >= sense_buffer[13] &&
752 additional2[i].code2_max <= sense_buffer[13]) {
753 printk("Additional sense indicates ");
754 printk(additional2[i].text, sense_buffer[13]);
755 printk("\n");
757 #else
758 printk("ASC=%2x ASCQ=%2x\n", sense_buffer[12], sense_buffer[13]);
759 #endif
760 }else{/* non-extended sense data */
763 * Standard says:
764 * sense_buffer[0] & 0200 : address valid
765 * sense_buffer[0] & 0177 : vendor-specific error code
766 * sense_buffer[1] & 0340 : vendor-specific
767 * sense_buffer[1..3] : 21-bit logical block address
770 #if (CONSTANTS & CONST_SENSE)
771 if(sense_buffer[0] <15)
772 printk("%s%s: old sense key %s\n", devclass,
773 kdevname(dev), snstext[sense_buffer[0] &0x0f]);
774 else
775 #endif
776 printk("%s%s: sns = %2x %2x\n", devclass,
777 kdevname(dev), sense_buffer[0], sense_buffer[2]);
779 printk("Non-extended sense class %d code 0x%0x ", sense_class, code);
780 s =4;
783 done:
784 #if !(CONSTANTS & CONST_SENSE)
785 printk("Raw sense data:");
786 for(i =0; i < s; ++i)
787 printk("0x%02x ", sense_buffer[i]);
788 printk("\n");
789 #endif
790 return;
793 voidprint_sense(const char* devclass, Scsi_Cmnd * SCpnt)
795 print_sense_internal(devclass, SCpnt->sense_buffer,
796 SCpnt->request.rq_dev);
799 voidprint_req_sense(const char* devclass, Scsi_Request * SRpnt)
801 print_sense_internal(devclass, SRpnt->sr_sense_buffer,
802 SRpnt->sr_request.rq_dev);
805 #if (CONSTANTS & CONST_MSG)
806 static const char*one_byte_msgs[] = {
807 /* 0x00 */"Command Complete", NULL,"Save Pointers",
808 /* 0x03 */"Restore Pointers","Disconnect","Initiator Error",
809 /* 0x06 */"Abort","Message Reject","Nop","Message Parity Error",
810 /* 0x0a */"Linked Command Complete","Linked Command Complete w/flag",
811 /* 0x0c */"Bus device reset","Abort Tag","Clear Queue",
812 /* 0x0f */"Initiate Recovery","Release Recovery"
815 #define NO_ONE_BYTE_MSGS (sizeof(one_byte_msgs) / sizeof (const char *))
817 static const char*two_byte_msgs[] = {
818 /* 0x20 */"Simple Queue Tag","Head of Queue Tag","Ordered Queue Tag"
819 /* 0x23 */"Ignore Wide Residue"
822 #define NO_TWO_BYTE_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
824 static const char*extended_msgs[] = {
825 /* 0x00 */"Modify Data Pointer","Synchronous Data Transfer Request",
826 /* 0x02 */"SCSI-I Extended Identify","Wide Data Transfer Request"
829 #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
830 #endif/* (CONSTANTS & CONST_MSG) */
832 intprint_msg(const unsigned char*msg) {
833 int len =0, i;
834 if(msg[0] == EXTENDED_MESSAGE) {
835 len =3+ msg[1];
836 #if (CONSTANTS & CONST_MSG)
837 if(msg[2] < NO_EXTENDED_MSGS)
838 printk("%s ", extended_msgs[msg[2]]);
839 else
840 printk("Extended Message, reserved code (0x%02x) ", (int) msg[2]);
841 switch(msg[2]) {
842 case EXTENDED_MODIFY_DATA_POINTER:
843 printk("pointer = %d", (int) (msg[3] <<24) | (msg[4] <<16) |
844 (msg[5] <<8) | msg[6]);
845 break;
846 case EXTENDED_SDTR:
847 printk("period = %d ns, offset = %d", (int) msg[3] *4, (int)
848 msg[4]);
849 break;
850 case EXTENDED_WDTR:
851 printk("width = 2^%d bytes", msg[3]);
852 break;
853 default:
854 for(i =2; i < len; ++i)
855 printk("%02x ", msg[i]);
857 #else
858 for(i =0; i < len; ++i)
859 printk("%02x ", msg[i]);
860 #endif
861 /* Identify */
862 }else if(msg[0] &0x80) {
863 #if (CONSTANTS & CONST_MSG)
864 printk("Identify disconnect %sallowed %s %d ",
865 (msg[0] &0x40) ?"":"not ",
866 (msg[0] &0x20) ?"target routine":"lun",
867 msg[0] &0x7);
868 #else
869 printk("%02x ", msg[0]);
870 #endif
871 len =1;
872 /* Normal One byte */
873 }else if(msg[0] <0x1f) {
874 #if (CONSTANTS & CONST_MSG)
875 if(msg[0] < NO_ONE_BYTE_MSGS)
876 printk(one_byte_msgs[msg[0]]);
877 else
878 printk("reserved (%02x) ", msg[0]);
879 #else
880 printk("%02x ", msg[0]);
881 #endif
882 len =1;
883 /* Two byte */
884 }else if(msg[0] <=0x2f) {
885 #if (CONSTANTS & CONST_MSG)
886 if((msg[0] -0x20) < NO_TWO_BYTE_MSGS)
887 printk("%s %02x ", two_byte_msgs[msg[0] -0x20],
888 msg[1]);
889 else
890 printk("reserved two byte (%02x %02x) ",
891 msg[0], msg[1]);
892 #else
893 printk("%02x %02x", msg[0], msg[1]);
894 #endif
895 len =2;
896 }else
897 #if (CONSTANTS & CONST_MSG)
898 printk(reserved);
899 #else
900 printk("%02x ", msg[0]);
901 #endif
902 return len;
905 voidprint_Scsi_Cmnd(Scsi_Cmnd *cmd) {
906 printk("scsi%d : destination target %d, lun %d\n",
907 cmd->host->host_no,
908 cmd->target,
909 cmd->lun);
910 printk(" command = ");
911 print_command(cmd->cmnd);
914 #if (CONSTANTS & CONST_HOST)
915 static const char* hostbyte_table[]={
916 "DID_OK","DID_NO_CONNECT","DID_BUS_BUSY","DID_TIME_OUT","DID_BAD_TARGET",
917 "DID_ABORT","DID_PARITY","DID_ERROR","DID_RESET","DID_BAD_INTR",
918 "DID_PASSTHROUGH","DID_SOFT_ERROR", NULL};
920 voidprint_hostbyte(int scsiresult)
921 {static int maxcode=0;
922 int i;
924 if(!maxcode) {
925 for(i=0;hostbyte_table[i];i++) ;
926 maxcode=i-1;
928 printk("Hostbyte=0x%02x",host_byte(scsiresult));
929 if(host_byte(scsiresult)>maxcode) {
930 printk("is invalid ");
931 return;
933 printk("(%s) ",hostbyte_table[host_byte(scsiresult)]);
935 #else
936 voidprint_hostbyte(int scsiresult)
937 {printk("Hostbyte=0x%02x ",host_byte(scsiresult));
939 #endif
941 #if (CONSTANTS & CONST_DRIVER)
942 static const char* driverbyte_table[]={
943 "DRIVER_OK","DRIVER_BUSY","DRIVER_SOFT","DRIVER_MEDIA","DRIVER_ERROR",
944 "DRIVER_INVALID","DRIVER_TIMEOUT","DRIVER_HARD",NULL };
946 static const char* driversuggest_table[]={"SUGGEST_OK",
947 "SUGGEST_RETRY","SUGGEST_ABORT","SUGGEST_REMAP","SUGGEST_DIE",
948 unknown,unknown,unknown,"SUGGEST_SENSE",NULL};
951 voidprint_driverbyte(int scsiresult)
952 {static int driver_max=0,suggest_max=0;
953 int i,dr=driver_byte(scsiresult)&DRIVER_MASK,
954 su=(driver_byte(scsiresult)&SUGGEST_MASK)>>4;
956 if(!driver_max) {
957 for(i=0;driverbyte_table[i];i++) ;
958 driver_max=i;
959 for(i=0;driversuggest_table[i];i++) ;
960 suggest_max=i;
962 printk("Driverbyte=0x%02x",driver_byte(scsiresult));
963 printk("(%s,%s) ",
964 dr<driver_max ? driverbyte_table[dr]:"invalid",
965 su<suggest_max ? driversuggest_table[su]:"invalid");
967 #else
968 voidprint_driverbyte(int scsiresult)
969 {printk("Driverbyte=0x%02x ",driver_byte(scsiresult));
971 #endif
974 * Overrides for Emacs so that we almost follow Linus's tabbing style.
975 * Emacs will notice this stuff at the end of the file and automatically
976 * adjust the settings for this buffer only. This must remain at the end
977 * of the file.
978 * ---------------------------------------------------------------------------
979 * Local variables:
980 * c-indent-level: 4
981 * c-brace-imaginary-offset: 0
982 * c-brace-offset: -4
983 * c-argdecl-indent: 4
984 * c-label-offset: -4
985 * c-continued-statement-offset: 4
986 * c-continued-brace-offset: 0
987 * indent-tabs-mode: nil
988 * tab-width: 8
989 * End:
close