| Start/ | End/ | |||
| True | False | - | Line | Source |
| 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 | * Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 07 3 May 2002) | |||
| 6 | * by D. Gilbert and aeb (20020609) | |||
| 7 | * Additions for SPC-3 T10/1416-D Rev 21 22 Sept 2004, D. Gilbert 20041025 | |||
| 8 | */ | |||
| 9 | ||||
| 10 | #include <linux/config.h> | |||
| 11 | #include <linux/blkdev.h> | |||
| 12 | #include <linux/module.h> | |||
| 13 | #include <linux/kernel.h> | |||
| 14 | ||||
| 15 | #include <scsi/scsi.h> | |||
| 16 | #include <scsi/scsi_device.h> | |||
| 17 | #include <scsi/scsi_host.h> | |||
| 18 | #include <scsi/scsi_request.h> | |||
| 19 | #include <scsi/scsi_eh.h> | |||
| 20 | #include <scsi/scsi_dbg.h> | |||
| 21 | ||||
| 22 | ||||
| 23 | ||||
| 24 | /* Commands with service actions that change the command name */ | |||
| 25 | #define MAINTENANCE_IN 0xa3 | |||
| 26 | #define MAINTENANCE_OUT 0xa4 | |||
| 27 | #define SERVICE_ACTION_IN_12 0xab | |||
| 28 | #define SERVICE_ACTION_OUT_12 0xa9 | |||
| 29 | #define SERVICE_ACTION_IN_16 0x9e | |||
| 30 | #define SERVICE_ACTION_OUT_16 0x9f | |||
| 31 | #define VARIABLE_LENGTH_CMD 0x7f | |||
| 32 | ||||
| 33 | ||||
| 34 | ||||
| 35 | #ifdef CONFIG_SCSI_CONSTANTS | |||
| 36 | static const char * cdb_byte0_names[] = { | |||
| 37 | /* 00-03 */ "Test Unit Ready", "Rezero Unit/Rewind", NULL, "Request Sense", | |||
| 38 | /* 04-07 */ "Format Unit/Medium", "Read Block Limits", NULL, | |||
| 39 | "Reasssign Blocks", | |||
| 40 | /* 08-0d */ "Read (6)", NULL, "Write (6)", "Seek (6)", NULL, NULL, | |||
| 41 | /* 0e-12 */ NULL, "Read Reverse", "Write Filemarks", "Space", "Inquiry", | |||
| 42 | /* 13-16 */ "Verify (6)", "Recover Buffered Data", "Mode Select (6)", | |||
| 43 | "Reserve (6)", | |||
| 44 | /* 17-1a */ "Release (6)", "Copy", "Erase", "Mode Sense (6)", | |||
| 45 | /* 1b-1d */ "Start/Stop Unit", "Receive Diagnostic", "Send Diagnostic", | |||
| 46 | /* 1e-1f */ "Prevent/Allow Medium Removal", NULL, | |||
| 47 | /* 20-22 */ NULL, NULL, NULL, | |||
| 48 | /* 23-28 */ "Read Format Capacities", "Set Window", | |||
| 49 | "Read Capacity (10)", NULL, NULL, "Read (10)", | |||
| 50 | /* 29-2d */ "Read Generation", "Write (10)", "Seek (10)", "Erase (10)", | |||
| 51 | "Read updated block", | |||
| 52 | /* 2e-31 */ "Write Verify (10)", "Verify (10)", "Search High", "Search Equal", | |||
| 53 | /* 32-34 */ "Search Low", "Set Limits", "Prefetch/Read Position", | |||
| 54 | /* 35-37 */ "Synchronize Cache (10)", "Lock/Unlock Cache (10)", | |||
| 55 | "Read Defect Data(10)", | |||
| 56 | /* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer", | |||
| 57 | "Read Buffer", | |||
| 58 | /* 3d-3f */ "Update Block", "Read Long (10)", "Write Long (10)", | |||
| 59 | /* 40-41 */ "Change Definition", "Write Same (10)", | |||
| 60 | /* 42-48 */ "Read sub-channel", "Read TOC/PMA/ATIP", "Read density support", | |||
| 61 | "Play audio (10)", "Get configuration", "Play audio msf", | |||
| 62 | "Play audio track/index", | |||
| 63 | /* 49-4f */ "Play track relative (10)", "Get event status notification", | |||
| 64 | "Pause/resume", "Log Select", "Log Sense", "Stop play/scan", | |||
| 65 | NULL, | |||
| 66 | /* 50-55 */ "Xdwrite", "Xpwrite, Read disk info", "Xdread, Read track info", | |||
| 67 | "Reserve track", "Send OPC info", "Mode Select (10)", | |||
| 68 | /* 56-5b */ "Reserve (10)", "Release (10)", "Repair track", "Read master cue", | |||
| 69 | "Mode Sense (10)", "Close track/session", | |||
| 70 | /* 5c-5f */ "Read buffer capacity", "Send cue sheet", "Persistent reserve in", | |||
| 71 | "Persistent reserve out", | |||
| 72 | /* 60-67 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |||
| 73 | /* 68-6f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |||
| 74 | /* 70-77 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |||
| 75 | /* 78-7f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Variable length", | |||
| 76 | /* 80-84 */ "Xdwrite (16)", "Rebuild (16)", "Regenerate (16)", "Extended copy", | |||
| 77 | "Receive copy results", | |||
| 78 | /* 85-89 */ "Memory Export In (16)", "Access control in", "Access control out", | |||
| 79 | "Read (16)", "Memory Export Out (16)", | |||
| 80 | /* 8a-8f */ "Write (16)", NULL, "Read attributes", "Write attributes", | |||
| 81 | "Write and verify (16)", "Verify (16)", | |||
| 82 | /* 90-94 */ "Pre-fetch (16)", "Synchronize cache (16)", | |||
| 83 | "Lock/unlock cache (16)", "Write same (16)", NULL, | |||
| 84 | /* 95-99 */ NULL, NULL, NULL, NULL, NULL, | |||
| 85 | /* 9a-9f */ NULL, NULL, NULL, NULL, "Service action in (16)", | |||
| 86 | "Service action out (16)", | |||
| 87 | /* a0-a5 */ "Report luns", "Blank", "Send event", "Maintenance in", | |||
| 88 | "Maintenance out", "Move medium/play audio(12)", | |||
| 89 | /* a6-a9 */ "Exchange medium", "Move medium attached", "Read(12)", | |||
| 90 | "Play track relative(12)", | |||
| 91 | /* aa-ae */ "Write(12)", NULL, "Erase(12), Get Performance", | |||
| 92 | "Read DVD structure", "Write and verify(12)", | |||
| 93 | /* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)", | |||
| 94 | /* b2-b4 */ "Search data low(12)", "Set limits(12)", | |||
| 95 | "Read element status attached", | |||
| 96 | /* b5-b6 */ "Request volume element address", "Send volume tag, set streaming", | |||
| 97 | /* b7-b9 */ "Read defect data(12)", "Read element status", "Read CD msf", | |||
| 98 | /* ba-bc */ "Redundancy group (in), Scan", | |||
| 99 | "Redundancy group (out), Set cd-rom speed", "Spare in, Play cd", | |||
| 100 | /* bd-bf */ "Spare out, Mechanism status", "Volume set in, Read cd", | |||
| 101 | "Volume set out, Send DVD structure", | |||
| 102 | }; | |||
| 103 | ||||
| 104 | struct value_name_pair { | |||
| 105 | int value; | |||
| 106 | const char * name; | |||
| 107 | }; | |||
| 108 | ||||
| 109 | static const struct value_name_pair maint_in_arr[] = { | |||
| 110 | {0x5, "Report device identifier"}, | |||
| 111 | {0xa, "Report target port groups"}, | |||
| 112 | {0xb, "Report aliases"}, | |||
| 113 | {0xc, "Report supported operation codes"}, | |||
| 114 | {0xd, "Report supported task management functions"}, | |||
| 115 | {0xe, "Report priority"}, | |||
| 116 | }; | |||
| 117 | #define MAINT_IN_SZ \ | |||
| 118 | (int)(sizeof(maint_in_arr) / sizeof(maint_in_arr[0])) | |||
| 119 | ||||
| 120 | static const struct value_name_pair maint_out_arr[] = { | |||
| 121 | {0x6, "Set device identifier"}, | |||
| 122 | {0xa, "Set target port groups"}, | |||
| 123 | {0xb, "Change aliases"}, | |||
| 124 | {0xe, "Set priority"}, | |||
| 125 | }; | |||
| 126 | #define MAINT_OUT_SZ \ | |||
| 127 | (int)(sizeof(maint_out_arr) / sizeof(maint_out_arr[0])) | |||
| 128 | ||||
| 129 | static const struct value_name_pair serv_in12_arr[] = { | |||
| 130 | {0x1, "Read media serial number"}, | |||
| 131 | }; | |||
| 132 | #define SERV_IN12_SZ \ | |||
| 133 | (int)(sizeof(serv_in12_arr) / sizeof(serv_in12_arr[0])) | |||
| 134 | ||||
| 135 | static const struct value_name_pair serv_out12_arr[] = { | |||
| 136 | {-1, "dummy entry"}, | |||
| 137 | }; | |||
| 138 | #define SERV_OUT12_SZ \ | |||
| 139 | (int)(sizeof(serv_out12_arr) / sizeof(serv_in12_arr[0])) | |||
| 140 | ||||
| 141 | static const struct value_name_pair serv_in16_arr[] = { | |||
| 142 | {0x10, "Read capacity(16)"}, | |||
| 143 | {0x11, "Read long(16)"}, | |||
| 144 | }; | |||
| 145 | #define SERV_IN16_SZ \ | |||
| 146 | (int)(sizeof(serv_in16_arr) / sizeof(serv_in16_arr[0])) | |||
| 147 | ||||
| 148 | static const struct value_name_pair serv_out16_arr[] = { | |||
| 149 | {0x11, "Write long(16)"}, | |||
| 150 | {0x1f, "Notify data transfer device(16)"}, | |||
| 151 | }; | |||
| 152 | #define SERV_OUT16_SZ \ | |||
| 153 | (int)(sizeof(serv_out16_arr) / sizeof(serv_in16_arr[0])) | |||
| 154 | ||||
| 155 | static const struct value_name_pair variable_length_arr[] = { | |||
| 156 | {0x1, "Rebuild(32)"}, | |||
| 157 | {0x2, "Regenerate(32)"}, | |||
| 158 | {0x3, "Xdread(32)"}, | |||
| 159 | {0x4, "Xdwrite(32)"}, | |||
| 160 | {0x5, "Xdwrite extended(32)"}, | |||
| 161 | {0x6, "Xpwrite(32)"}, | |||
| 162 | {0x7, "Xdwriteread(32)"}, | |||
| 163 | {0x8, "Xdwrite extended(64)"}, | |||
| 164 | {0x9, "Read(32)"}, | |||
| 165 | {0xa, "Verify(32)"}, | |||
| 166 | {0xb, "Write(32)"}, | |||
| 167 | {0xc, "Write an verify(32)"}, | |||
| 168 | {0xd, "Write same(32)"}, | |||
| 169 | {0x8801, "Format OSD"}, | |||
| 170 | {0x8802, "Create (osd)"}, | |||
| 171 | {0x8803, "List (osd)"}, | |||
| 172 | {0x8805, "Read (osd)"}, | |||
| 173 | {0x8806, "Write (osd)"}, | |||
| 174 | {0x8807, "Append (osd)"}, | |||
| 175 | {0x8808, "Flush (osd)"}, | |||
| 176 | {0x880a, "Remove (osd)"}, | |||
| 177 | {0x880b, "Create partition (osd)"}, | |||
| 178 | {0x880c, "Remove partition (osd)"}, | |||
| 179 | {0x880e, "Get attributes (osd)"}, | |||
| 180 | {0x880f, "Set attributes (osd)"}, | |||
| 181 | {0x8812, "Create and write (osd)"}, | |||
| 182 | {0x8815, "Create collection (osd)"}, | |||
| 183 | {0x8816, "Remove collection (osd)"}, | |||
| 184 | {0x8817, "List collection (osd)"}, | |||
| 185 | {0x8818, "Set key (osd)"}, | |||
| 186 | {0x8819, "Set master key (osd)"}, | |||
| 187 | {0x881a, "Flush collection (osd)"}, | |||
| 188 | {0x881b, "Flush partition (osd)"}, | |||
| 189 | {0x881c, "Flush OSD"}, | |||
| 190 | {0x8f7e, "Perform SCSI command (osd)"}, | |||
| 191 | {0x8f7f, "Perform task management function (osd)"}, | |||
| 192 | }; | |||
| 193 | #define VARIABLE_LENGTH_SZ \ | |||
| 194 | (int)(sizeof(variable_length_arr) / sizeof(variable_length_arr[0])) | |||
| 195 | ||||
| 0 | 0 | - | 196 | static const char * get_sa_name(const struct value_name_pair * arr, |
| 197 | int arr_sz, int service_action) | |||
| 198 | { | |||
| 199 | int k; | |||
| 200 | ||||
| 0 | 0 | - | 201 | for (k = 0; k < arr_sz; ++k, ++arr) { |
| 0 | 0 | - | 202 | if (service_action == arr->value) |
| 0 | - | 203 | break; | |
| 204 | } | |||
| 205 | return (k < arr_sz) ? arr->name : NULL; | |||
| 0 | 0 | - | 205 | ternary-?: ( k < arr_sz ) |
| 0 | - | 205 | return ( k < arr_sz ) ? arr -> name : ( ( void.. | |
| 206 | } | |||
| 207 | ||||
| 208 | /* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */ | |||
| 0 | 0 | - | 209 | static void print_opcode_name(unsigned char * cdbp, int cdb_len, |
| 210 | int start_of_line) | |||
| 211 | { | |||
| 212 | int sa, len, cdb0; | |||
| 213 | const char * name; | |||
| 214 | const char * leadin = start_of_line ? KERN_INFO : ""; | |||
| 0 | 0 | - | 214 | ternary-?: start_of_line |
| 215 | ||||
| 216 | cdb0 = cdbp[0]; | |||
| 217 | switch(cdb0) { | |||
| 0 | - | 218 | case VARIABLE_LENGTH_CMD: | |
| 219 | len = cdbp[7] + 8; | |||
| 0 | 0 | - | 220 | if (len < 10) { |
| 221 | printk("%sshort variable length command, " | |||
| 222 | "len=%d ext_len=%d", leadin, len, cdb_len); | |||
| 0 | - | 223 | break; | |
| 224 | } | |||
| 225 | sa = (cdbp[8] << 8) + cdbp[9]; | |||
| 226 | name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); | |||
| 0 | 0 | - | 227 | if (name) { |
| 228 | printk("%s%s", leadin, name); | |||
| 0 | 0 | - | 229 | if ((cdb_len > 0) && (len != cdb_len)) |
| 0 | - | 229 | (T) && (T) | |
| 0 | - | 229 | (T) && (F) | |
| 0 | - | 229 | (F) && (_) | |
| 230 | printk(", in_cdb_len=%d, ext_len=%d", | |||
| 231 | len, cdb_len); | |||
| 232 | } else { | |||
| 233 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | 0 | - | 234 | if ((cdb_len > 0) && (len != cdb_len)) |
| 0 | - | 234 | (T) && (T) | |
| 0 | - | 234 | (T) && (F) | |
| 0 | - | 234 | (F) && (_) | |
| 235 | printk(", in_cdb_len=%d, ext_len=%d", | |||
| 236 | len, cdb_len); | |||
| 237 | } | |||
| 0 | - | 238 | break; | |
| 0 | - | 239 | case MAINTENANCE_IN: | |
| 240 | sa = cdbp[1] & 0x1f; | |||
| 241 | name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); | |||
| 0 | 0 | - | 242 | if (name) |
| 243 | printk("%s%s", leadin, name); | |||
| 244 | else | |||
| 245 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | - | 246 | break; | |
| 0 | - | 247 | case MAINTENANCE_OUT: | |
| 248 | sa = cdbp[1] & 0x1f; | |||
| 249 | name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa); | |||
| 0 | 0 | - | 250 | if (name) |
| 251 | printk("%s%s", leadin, name); | |||
| 252 | else | |||
| 253 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | - | 254 | break; | |
| 0 | - | 255 | case SERVICE_ACTION_IN_12: | |
| 256 | sa = cdbp[1] & 0x1f; | |||
| 257 | name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa); | |||
| 0 | 0 | - | 258 | if (name) |
| 259 | printk("%s%s", leadin, name); | |||
| 260 | else | |||
| 261 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | - | 262 | break; | |
| 0 | - | 263 | case SERVICE_ACTION_OUT_12: | |
| 264 | sa = cdbp[1] & 0x1f; | |||
| 265 | name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa); | |||
| 0 | 0 | - | 266 | if (name) |
| 267 | printk("%s%s", leadin, name); | |||
| 268 | else | |||
| 269 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | - | 270 | break; | |
| 0 | - | 271 | case SERVICE_ACTION_IN_16: | |
| 272 | sa = cdbp[1] & 0x1f; | |||
| 273 | name = get_sa_name(serv_in16_arr, SERV_IN16_SZ, sa); | |||
| 0 | 0 | - | 274 | if (name) |
| 275 | printk("%s%s", leadin, name); | |||
| 276 | else | |||
| 277 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | - | 278 | break; | |
| 0 | - | 279 | case SERVICE_ACTION_OUT_16: | |
| 280 | sa = cdbp[1] & 0x1f; | |||
| 281 | name = get_sa_name(serv_out16_arr, SERV_OUT16_SZ, sa); | |||
| 0 | 0 | - | 282 | if (name) |
| 283 | printk("%s%s", leadin, name); | |||
| 284 | else | |||
| 285 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 0 | - | 286 | break; | |
| 0 | - | 287 | default: | |
| 0 | 0 | - | 288 | if (cdb0 < 0xc0) { |
| 289 | name = cdb_byte0_names[cdb0]; | |||
| 0 | 0 | - | 290 | if (name) |
| 291 | printk("%s%s", leadin, name); | |||
| 292 | else | |||
| 293 | printk("%scdb[0]=0x%x (reserved)", | |||
| 294 | leadin, cdb0); | |||
| 295 | } else | |||
| 296 | printk("%scdb[0]=0x%x (vendor)", leadin, cdb0); | |||
| 0 | - | 297 | break; | |
| 298 | } | |||
| 299 | } | |||
| 300 | ||||
| 301 | #else /* ifndef CONFIG_SCSI_CONSTANTS */ | |||
| 302 | ||||
| 303 | static void print_opcode_name(unsigned char * cdbp, int cdb_len, | |||
| 304 | int start_of_line) | |||
| 305 | { | |||
| 306 | int sa, len, cdb0; | |||
| 307 | const char * leadin = start_of_line ? KERN_INFO : ""; | |||
| 308 | ||||
| 309 | cdb0 = cdbp[0]; | |||
| 310 | switch(cdb0) { | |||
| 311 | case VARIABLE_LENGTH_CMD: | |||
| 312 | len = cdbp[7] + 8; | |||
| 313 | if (len < 10) { | |||
| 314 | printk("%sshort opcode=0x%x command, len=%d " | |||
| 315 | "ext_len=%d", leadin, cdb0, len, cdb_len); | |||
| 316 | break; | |||
| 317 | } | |||
| 318 | sa = (cdbp[8] << 8) + cdbp[9]; | |||
| 319 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 320 | if (len != cdb_len) | |||
| 321 | printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len); | |||
| 322 | break; | |||
| 323 | case MAINTENANCE_IN: | |||
| 324 | case MAINTENANCE_OUT: | |||
| 325 | case SERVICE_ACTION_IN_12: | |||
| 326 | case SERVICE_ACTION_OUT_12: | |||
| 327 | case SERVICE_ACTION_IN_16: | |||
| 328 | case SERVICE_ACTION_OUT_16: | |||
| 329 | sa = cdbp[1] & 0x1f; | |||
| 330 | printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); | |||
| 331 | break; | |||
| 332 | default: | |||
| 333 | if (cdb0 < 0xc0) | |||
| 334 | printk("%scdb[0]=0x%x", leadin, cdb0); | |||
| 335 | else | |||
| 336 | printk("%scdb[0]=0x%x (vendor)", leadin, cdb0); | |||
| 337 | break; | |||
| 338 | } | |||
| 339 | } | |||
| 340 | #endif | |||
| 341 | ||||
| 0 | 0 | - | 342 | void __scsi_print_command(unsigned char *command) |
| 343 | { | |||
| 344 | int k, len; | |||
| 345 | ||||
| 346 | print_opcode_name(command, 0, 1); | |||
| 0 | 0 | - | 347 | if (VARIABLE_LENGTH_CMD == command[0]) |
| 348 | len = command[7] + 8; | |||
| 349 | else | |||
| 350 | len = COMMAND_SIZE(command[0]); | |||
| 351 | /* print out all bytes in cdb */ | |||
| 0 | 0 | - | 352 | for (k = 0; k < len; ++k) |
| 353 | printk(" %02x", command[k]); | |||
| 354 | printk("\n"); | |||
| 355 | } | |||
| 356 | EXPORT_SYMBOL(__scsi_print_command); | |||
| 357 | ||||
| 358 | /* This function (perhaps with the addition of peripheral device type) | |||
| 359 | * is more approriate than __scsi_print_command(). Perhaps that static | |||
| 360 | * can be dropped later if it replaces the __scsi_print_command version. | |||
| 361 | */ | |||
| 0 | 0 | - | 362 | static void scsi_print_cdb(unsigned char *cdb, int cdb_len, int start_of_line) |
| 363 | { | |||
| 364 | int k; | |||
| 365 | ||||
| 366 | print_opcode_name(cdb, cdb_len, start_of_line); | |||
| 367 | /* print out all bytes in cdb */ | |||
| 368 | printk(":"); | |||
| 0 | 0 | - | 369 | for (k = 0; k < cdb_len; ++k) |
| 370 | printk(" %02x", cdb[k]); | |||
| 371 | printk("\n"); | |||
| 372 | } | |||
| 373 | ||||
| 374 | /** | |||
| 375 | * | |||
| 376 | * scsi_print_status - print scsi status description | |||
| 377 | * @scsi_status: scsi status value | |||
| 378 | * | |||
| 379 | * If the status is recognized, the description is printed. | |||
| 380 | * Otherwise "Unknown status" is output. No trailing space. | |||
| 381 | * If CONFIG_SCSI_CONSTANTS is not set, then print status in hex | |||
| 382 | * (e.g. "0x2" for Check Condition). | |||
| 383 | **/ | |||
| 384 | void | |||
| 0 | 0 | - | 385 | scsi_print_status(unsigned char scsi_status) { |
| 386 | #ifdef CONFIG_SCSI_CONSTANTS | |||
| 387 | const char * ccp; | |||
| 388 | ||||
| 389 | switch (scsi_status) { | |||
| 0 | - | 390 | case 0: ccp = "Good"; break; | |
| 0 | - | 390 | break | |
| 0 | - | 391 | case 0x2: ccp = "Check Condition"; break; | |
| 0 | - | 391 | break | |
| 0 | - | 392 | case 0x4: ccp = "Condition Met"; break; | |
| 0 | - | 392 | break | |
| 0 | - | 393 | case 0x8: ccp = "Busy"; break; | |
| 0 | - | 393 | break | |
| 0 | - | 394 | case 0x10: ccp = "Intermediate"; break; | |
| 0 | - | 394 | break | |
| 0 | - | 395 | case 0x14: ccp = "Intermediate-Condition Met"; break; | |
| 0 | - | 395 | break | |
| 0 | - | 396 | case 0x18: ccp = "Reservation Conflict"; break; | |
| 0 | - | 396 | break | |
| 0 | - | 397 | case 0x22: ccp = "Command Terminated"; break; /* obsolete */ | |
| 0 | - | 397 | break | |
| 0 | - | 398 | case 0x28: ccp = "Task set Full"; break; /* was: Queue Full */ | |
| 0 | - | 398 | break | |
| 0 | - | 399 | case 0x30: ccp = "ACA Active"; break; | |
| 0 | - | 399 | break | |
| 0 | - | 400 | case 0x40: ccp = "Task Aborted"; break; | |
| 0 | - | 400 | break | |
| 0 | - | 401 | default: ccp = "Unknown status"; | |
| 402 | } | |||
| 403 | printk(KERN_INFO "%s", ccp); | |||
| 404 | #else | |||
| 405 | printk(KERN_INFO "0x%0x", scsi_status); | |||
| 406 | #endif | |||
| 407 | } | |||
| 408 | EXPORT_SYMBOL(scsi_print_status); | |||
| 409 | ||||
| 410 | #ifdef CONFIG_SCSI_CONSTANTS | |||
| 411 | ||||
| 412 | struct error_info { | |||
| 413 | unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */ | |||
| 414 | const char * text; | |||
| 415 | }; | |||
| 416 | ||||
| 417 | static struct error_info additional[] = | |||
| 418 | { | |||
| 419 | {0x0000, "No additional sense information"}, | |||
| 420 | {0x0001, "Filemark detected"}, | |||
| 421 | {0x0002, "End-of-partition/medium detected"}, | |||
| 422 | {0x0003, "Setmark detected"}, | |||
| 423 | {0x0004, "Beginning-of-partition/medium detected"}, | |||
| 424 | {0x0005, "End-of-data detected"}, | |||
| 425 | {0x0006, "I/O process terminated"}, | |||
| 426 | {0x0011, "Audio play operation in progress"}, | |||
| 427 | {0x0012, "Audio play operation paused"}, | |||
| 428 | {0x0013, "Audio play operation successfully completed"}, | |||
| 429 | {0x0014, "Audio play operation stopped due to error"}, | |||
| 430 | {0x0015, "No current audio status to return"}, | |||
| 431 | {0x0016, "Operation in progress"}, | |||
| 432 | {0x0017, "Cleaning requested"}, | |||
| 433 | {0x0018, "Erase operation in progress"}, | |||
| 434 | {0x0019, "Locate operation in progress"}, | |||
| 435 | {0x001A, "Rewind operation in progress"}, | |||
| 436 | {0x001B, "Set capacity operation in progress"}, | |||
| 437 | {0x001C, "Verify operation in progress"}, | |||
| 438 | ||||
| 439 | {0x0100, "No index/sector signal"}, | |||
| 440 | ||||
| 441 | {0x0200, "No seek complete"}, | |||
| 442 | ||||
| 443 | {0x0300, "Peripheral device write fault"}, | |||
| 444 | {0x0301, "No write current"}, | |||
| 445 | {0x0302, "Excessive write errors"}, | |||
| 446 | ||||
| 447 | {0x0400, "Logical unit not ready, cause not reportable"}, | |||
| 448 | {0x0401, "Logical unit is in process of becoming ready"}, | |||
| 449 | {0x0402, "Logical unit not ready, initializing cmd. required"}, | |||
| 450 | {0x0403, "Logical unit not ready, manual intervention required"}, | |||
| 451 | {0x0404, "Logical unit not ready, format in progress"}, | |||
| 452 | {0x0405, "Logical unit not ready, rebuild in progress"}, | |||
| 453 | {0x0406, "Logical unit not ready, recalculation in progress"}, | |||
| 454 | {0x0407, "Logical unit not ready, operation in progress"}, | |||
| 455 | {0x0408, "Logical unit not ready, long write in progress"}, | |||
| 456 | {0x0409, "Logical unit not ready, self-test in progress"}, | |||
| 457 | {0x040A, "Logical unit not accessible, asymmetric access state " | |||
| 458 | "transition"}, | |||
| 459 | {0x040B, "Logical unit not accessible, target port in standby state"}, | |||
| 460 | {0x040C, "Logical unit not accessible, target port in unavailable " | |||
| 461 | "state"}, | |||
| 462 | {0x0410, "Logical unit not ready, auxiliary memory not accessible"}, | |||
| 463 | {0x0411, "Logical unit not ready, notify (enable spinup) required"}, | |||
| 464 | {0x0412, "Logical unit not ready, offline"}, | |||
| 465 | ||||
| 466 | {0x0500, "Logical unit does not respond to selection"}, | |||
| 467 | ||||
| 468 | {0x0600, "No reference position found"}, | |||
| 469 | ||||
| 470 | {0x0700, "Multiple peripheral devices selected"}, | |||
| 471 | ||||
| 472 | {0x0800, "Logical unit communication failure"}, | |||
| 473 | {0x0801, "Logical unit communication time-out"}, | |||
| 474 | {0x0802, "Logical unit communication parity error"}, | |||
| 475 | {0x0803, "Logical unit communication CRC error (Ultra-DMA/32)"}, | |||
| 476 | {0x0804, "Unreachable copy target"}, | |||
| 477 | ||||
| 478 | {0x0900, "Track following error"}, | |||
| 479 | {0x0901, "Tracking servo failure"}, | |||
| 480 | {0x0902, "Focus servo failure"}, | |||
| 481 | {0x0903, "Spindle servo failure"}, | |||
| 482 | {0x0904, "Head select fault"}, | |||
| 483 | ||||
| 484 | {0x0A00, "Error log overflow"}, | |||
| 485 | ||||
| 486 | {0x0B00, "Warning"}, | |||
| 487 | {0x0B01, "Warning - specified temperature exceeded"}, | |||
| 488 | {0x0B02, "Warning - enclosure degraded"}, | |||
| 489 | ||||
| 490 | {0x0C00, "Write error"}, | |||
| 491 | {0x0C01, "Write error - recovered with auto reallocation"}, | |||
| 492 | {0x0C02, "Write error - auto reallocation failed"}, | |||
| 493 | {0x0C03, "Write error - recommend reassignment"}, | |||
| 494 | {0x0C04, "Compression check miscompare error"}, | |||
| 495 | {0x0C05, "Data expansion occurred during compression"}, | |||
| 496 | {0x0C06, "Block not compressible"}, | |||
| 497 | {0x0C07, "Write error - recovery needed"}, | |||
| 498 | {0x0C08, "Write error - recovery failed"}, | |||
| 499 | {0x0C09, "Write error - loss of streaming"}, | |||
| 500 | {0x0C0A, "Write error - padding blocks added"}, | |||
| 501 | {0x0C0B, "Auxiliary memory write error"}, | |||
| 502 | {0x0C0C, "Write error - unexpected unsolicited data"}, | |||
| 503 | {0x0C0D, "Write error - not enough unsolicited data"}, | |||
| 504 | ||||
| 505 | {0x0D00, "Error detected by third party temporary initiator"}, | |||
| 506 | {0x0D01, "Third party device failure"}, | |||
| 507 | {0x0D02, "Copy target device not reachable"}, | |||
| 508 | {0x0D03, "Incorrect copy target device type"}, | |||
| 509 | {0x0D04, "Copy target device data underrun"}, | |||
| 510 | {0x0D05, "Copy target device data overrun"}, | |||
| 511 | ||||
| 512 | {0x0E00, "Invalid information unit"}, | |||
| 513 | {0x0E01, "Information unit too short"}, | |||
| 514 | {0x0E02, "Information unit too long"}, | |||
| 515 | ||||
| 516 | {0x1000, "Id CRC or ECC error"}, | |||
| 517 | {0x1001, "Data block guard check failed"}, | |||
| 518 | {0x1002, "Data block application tag check failed"}, | |||
| 519 | {0x1003, "Data block reference tag check failed"}, | |||
| 520 | ||||
| 521 | {0x1100, "Unrecovered read error"}, | |||
| 522 | ||||