diff options
Diffstat (limited to 'drivers/scsi/constants.c')
-rw-r--r-- | drivers/scsi/constants.c | 118 |
1 files changed, 5 insertions, 113 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 09bc81557b6e..30a335349cee 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c | |||
@@ -1065,7 +1065,7 @@ struct error_info2 { | |||
1065 | const char * fmt; | 1065 | const char * fmt; |
1066 | }; | 1066 | }; |
1067 | 1067 | ||
1068 | static struct error_info2 additional2[] = | 1068 | static const struct error_info2 additional2[] = |
1069 | { | 1069 | { |
1070 | {0x40,0x00,0x7f,"Ram failure (%x)"}, | 1070 | {0x40,0x00,0x7f,"Ram failure (%x)"}, |
1071 | {0x40,0x80,0xff,"Diagnostic failure on component (%x)"}, | 1071 | {0x40,0x80,0xff,"Diagnostic failure on component (%x)"}, |
@@ -1077,7 +1077,7 @@ static struct error_info2 additional2[] = | |||
1077 | }; | 1077 | }; |
1078 | 1078 | ||
1079 | /* description of the sense key values */ | 1079 | /* description of the sense key values */ |
1080 | static const char *snstext[] = { | 1080 | static const char * const snstext[] = { |
1081 | "No Sense", /* 0: There is no sense information */ | 1081 | "No Sense", /* 0: There is no sense information */ |
1082 | "Recovered Error", /* 1: The last command completed successfully | 1082 | "Recovered Error", /* 1: The last command completed successfully |
1083 | but used error correction */ | 1083 | but used error correction */ |
@@ -1278,114 +1278,6 @@ void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) | |||
1278 | } | 1278 | } |
1279 | EXPORT_SYMBOL(scsi_print_req_sense); | 1279 | EXPORT_SYMBOL(scsi_print_req_sense); |
1280 | 1280 | ||
1281 | #ifdef CONFIG_SCSI_CONSTANTS | ||
1282 | static const char *one_byte_msgs[] = { | ||
1283 | /* 0x00 */ "Command Complete", NULL, "Save Pointers", | ||
1284 | /* 0x03 */ "Restore Pointers", "Disconnect", "Initiator Error", | ||
1285 | /* 0x06 */ "Abort", "Message Reject", "Nop", "Message Parity Error", | ||
1286 | /* 0x0a */ "Linked Command Complete", "Linked Command Complete w/flag", | ||
1287 | /* 0x0c */ "Bus device reset", "Abort Tag", "Clear Queue", | ||
1288 | /* 0x0f */ "Initiate Recovery", "Release Recovery" | ||
1289 | }; | ||
1290 | #define NO_ONE_BYTE_MSGS (sizeof(one_byte_msgs) / sizeof (const char *)) | ||
1291 | |||
1292 | static const char *two_byte_msgs[] = { | ||
1293 | /* 0x20 */ "Simple Queue Tag", "Head of Queue Tag", "Ordered Queue Tag" | ||
1294 | /* 0x23 */ "Ignore Wide Residue" | ||
1295 | }; | ||
1296 | #define NO_TWO_BYTE_MSGS (sizeof(two_byte_msgs) / sizeof (const char *)) | ||
1297 | |||
1298 | static const char *extended_msgs[] = { | ||
1299 | /* 0x00 */ "Modify Data Pointer", "Synchronous Data Transfer Request", | ||
1300 | /* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request" | ||
1301 | }; | ||
1302 | #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *)) | ||
1303 | |||
1304 | |||
1305 | int scsi_print_msg (const unsigned char *msg) | ||
1306 | { | ||
1307 | int len = 0, i; | ||
1308 | if (msg[0] == EXTENDED_MESSAGE) { | ||
1309 | len = 3 + msg[1]; | ||
1310 | if (msg[2] < NO_EXTENDED_MSGS) | ||
1311 | printk ("%s ", extended_msgs[msg[2]]); | ||
1312 | else | ||
1313 | printk ("Extended Message, reserved code (0x%02x) ", | ||
1314 | (int) msg[2]); | ||
1315 | switch (msg[2]) { | ||
1316 | case EXTENDED_MODIFY_DATA_POINTER: | ||
1317 | printk("pointer = %d", (int) (msg[3] << 24) | | ||
1318 | (msg[4] << 16) | (msg[5] << 8) | msg[6]); | ||
1319 | break; | ||
1320 | case EXTENDED_SDTR: | ||
1321 | printk("period = %d ns, offset = %d", | ||
1322 | (int) msg[3] * 4, (int) msg[4]); | ||
1323 | break; | ||
1324 | case EXTENDED_WDTR: | ||
1325 | printk("width = 2^%d bytes", msg[3]); | ||
1326 | break; | ||
1327 | default: | ||
1328 | for (i = 2; i < len; ++i) | ||
1329 | printk("%02x ", msg[i]); | ||
1330 | } | ||
1331 | /* Identify */ | ||
1332 | } else if (msg[0] & 0x80) { | ||
1333 | printk("Identify disconnect %sallowed %s %d ", | ||
1334 | (msg[0] & 0x40) ? "" : "not ", | ||
1335 | (msg[0] & 0x20) ? "target routine" : "lun", | ||
1336 | msg[0] & 0x7); | ||
1337 | len = 1; | ||
1338 | /* Normal One byte */ | ||
1339 | } else if (msg[0] < 0x1f) { | ||
1340 | if (msg[0] < NO_ONE_BYTE_MSGS) | ||
1341 | printk(one_byte_msgs[msg[0]]); | ||
1342 | else | ||
1343 | printk("reserved (%02x) ", msg[0]); | ||
1344 | len = 1; | ||
1345 | /* Two byte */ | ||
1346 | } else if (msg[0] <= 0x2f) { | ||
1347 | if ((msg[0] - 0x20) < NO_TWO_BYTE_MSGS) | ||
1348 | printk("%s %02x ", two_byte_msgs[msg[0] - 0x20], | ||
1349 | msg[1]); | ||
1350 | else | ||
1351 | printk("reserved two byte (%02x %02x) ", | ||
1352 | msg[0], msg[1]); | ||
1353 | len = 2; | ||
1354 | } else | ||
1355 | printk("reserved"); | ||
1356 | return len; | ||
1357 | } | ||
1358 | EXPORT_SYMBOL(scsi_print_msg); | ||
1359 | |||
1360 | #else /* ifndef CONFIG_SCSI_CONSTANTS */ | ||
1361 | |||
1362 | int scsi_print_msg (const unsigned char *msg) | ||
1363 | { | ||
1364 | int len = 0, i; | ||
1365 | |||
1366 | if (msg[0] == EXTENDED_MESSAGE) { | ||
1367 | len = 3 + msg[1]; | ||
1368 | for (i = 0; i < len; ++i) | ||
1369 | printk("%02x ", msg[i]); | ||
1370 | /* Identify */ | ||
1371 | } else if (msg[0] & 0x80) { | ||
1372 | printk("%02x ", msg[0]); | ||
1373 | len = 1; | ||
1374 | /* Normal One byte */ | ||
1375 | } else if (msg[0] < 0x1f) { | ||
1376 | printk("%02x ", msg[0]); | ||
1377 | len = 1; | ||
1378 | /* Two byte */ | ||
1379 | } else if (msg[0] <= 0x2f) { | ||
1380 | printk("%02x %02x", msg[0], msg[1]); | ||
1381 | len = 2; | ||
1382 | } else | ||
1383 | printk("%02x ", msg[0]); | ||
1384 | return len; | ||
1385 | } | ||
1386 | EXPORT_SYMBOL(scsi_print_msg); | ||
1387 | #endif /* ! CONFIG_SCSI_CONSTANTS */ | ||
1388 | |||
1389 | void scsi_print_command(struct scsi_cmnd *cmd) | 1281 | void scsi_print_command(struct scsi_cmnd *cmd) |
1390 | { | 1282 | { |
1391 | /* Assume appended output (i.e. not at start of line) */ | 1283 | /* Assume appended output (i.e. not at start of line) */ |
@@ -1397,7 +1289,7 @@ EXPORT_SYMBOL(scsi_print_command); | |||
1397 | 1289 | ||
1398 | #ifdef CONFIG_SCSI_CONSTANTS | 1290 | #ifdef CONFIG_SCSI_CONSTANTS |
1399 | 1291 | ||
1400 | static const char * hostbyte_table[]={ | 1292 | static const char * const hostbyte_table[]={ |
1401 | "DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", | 1293 | "DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", |
1402 | "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", | 1294 | "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", |
1403 | "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"}; | 1295 | "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"}; |
@@ -1422,12 +1314,12 @@ void scsi_print_hostbyte(int scsiresult) | |||
1422 | 1314 | ||
1423 | #ifdef CONFIG_SCSI_CONSTANTS | 1315 | #ifdef CONFIG_SCSI_CONSTANTS |
1424 | 1316 | ||
1425 | static const char * driverbyte_table[]={ | 1317 | static const char * const driverbyte_table[]={ |
1426 | "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", | 1318 | "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", |
1427 | "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; | 1319 | "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; |
1428 | #define NUM_DRIVERBYTE_STRS (sizeof(driverbyte_table) / sizeof(const char *)) | 1320 | #define NUM_DRIVERBYTE_STRS (sizeof(driverbyte_table) / sizeof(const char *)) |
1429 | 1321 | ||
1430 | static const char * driversuggest_table[]={"SUGGEST_OK", | 1322 | static const char * const driversuggest_table[]={"SUGGEST_OK", |
1431 | "SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", | 1323 | "SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", |
1432 | "SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"}; | 1324 | "SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"}; |
1433 | #define NUM_SUGGEST_STRS (sizeof(driversuggest_table) / sizeof(const char *)) | 1325 | #define NUM_SUGGEST_STRS (sizeof(driversuggest_table) / sizeof(const char *)) |