aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/constants.c95
1 files changed, 75 insertions, 20 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index e79e18101f87..63abb06c4edb 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -4,8 +4,7 @@
4 * Additions for SCSI 2 and Linux 2.2.x by D. Gilbert (990422) 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) 5 * Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 07 3 May 2002)
6 * by D. Gilbert and aeb (20020609) 6 * by D. Gilbert and aeb (20020609)
7 * Additions for SPC-3 T10/1416-D Rev 21 22 Sept 2004, D. Gilbert 20041025 7 * Update to SPC-4 T10/1713-D Rev 20, 22 May 2009, D. Gilbert 20090624
8 * Update to SPC-4 T10/1713-D Rev 5a, 14 June 2006, D. Gilbert 20060702
9 */ 8 */
10 9
11#include <linux/blkdev.h> 10#include <linux/blkdev.h>
@@ -56,9 +55,9 @@ static const char * cdb_byte0_names[] = {
56 "Read Buffer", 55 "Read Buffer",
57/* 3d-3f */ "Update Block", "Read Long(10)", "Write Long(10)", 56/* 3d-3f */ "Update Block", "Read Long(10)", "Write Long(10)",
58/* 40-41 */ "Change Definition", "Write Same(10)", 57/* 40-41 */ "Change Definition", "Write Same(10)",
59/* 42-48 */ "Read sub-channel", "Read TOC/PMA/ATIP", "Read density support", 58/* 42-48 */ "Unmap/Read sub-channel", "Read TOC/PMA/ATIP",
60 "Play audio(10)", "Get configuration", "Play audio msf", 59 "Read density support", "Play audio(10)", "Get configuration",
61 "Play audio track/index", 60 "Play audio msf", "Play audio track/index",
62/* 49-4f */ "Play track relative(10)", "Get event status notification", 61/* 49-4f */ "Play track relative(10)", "Get event status notification",
63 "Pause/resume", "Log Select", "Log Sense", "Stop play/scan", 62 "Pause/resume", "Log Select", "Log Sense", "Stop play/scan",
64 NULL, 63 NULL,
@@ -71,12 +70,13 @@ static const char * cdb_byte0_names[] = {
71/* 60-67 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 70/* 60-67 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
72/* 68-6f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 71/* 68-6f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
73/* 70-77 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 72/* 70-77 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
74/* 78-7f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Variable length", 73/* 78-7f */ NULL, NULL, NULL, NULL, NULL, NULL, "Extended CDB",
74 "Variable length",
75/* 80-84 */ "Xdwrite(16)", "Rebuild(16)", "Regenerate(16)", "Extended copy", 75/* 80-84 */ "Xdwrite(16)", "Rebuild(16)", "Regenerate(16)", "Extended copy",
76 "Receive copy results", 76 "Receive copy results",
77/* 85-89 */ "ATA command pass through(16)", "Access control in", 77/* 85-89 */ "ATA command pass through(16)", "Access control in",
78 "Access control out", "Read(16)", "Memory Export Out(16)", 78 "Access control out", "Read(16)", "Memory Export Out(16)",
79/* 8a-8f */ "Write(16)", NULL, "Read attributes", "Write attributes", 79/* 8a-8f */ "Write(16)", "ORWrite", "Read attributes", "Write attributes",
80 "Write and verify(16)", "Verify(16)", 80 "Write and verify(16)", "Verify(16)",
81/* 90-94 */ "Pre-fetch(16)", "Synchronize cache(16)", 81/* 90-94 */ "Pre-fetch(16)", "Synchronize cache(16)",
82 "Lock/unlock cache(16)", "Write same(16)", NULL, 82 "Lock/unlock cache(16)", "Write same(16)", NULL,
@@ -107,22 +107,24 @@ struct value_name_pair {
107}; 107};
108 108
109static const struct value_name_pair maint_in_arr[] = { 109static const struct value_name_pair maint_in_arr[] = {
110 {0x5, "Report device identifier"}, 110 {0x5, "Report identifying information"},
111 {0xa, "Report target port groups"}, 111 {0xa, "Report target port groups"},
112 {0xb, "Report aliases"}, 112 {0xb, "Report aliases"},
113 {0xc, "Report supported operation codes"}, 113 {0xc, "Report supported operation codes"},
114 {0xd, "Report supported task management functions"}, 114 {0xd, "Report supported task management functions"},
115 {0xe, "Report priority"}, 115 {0xe, "Report priority"},
116 {0xf, "Report timestamp"}, 116 {0xf, "Report timestamp"},
117 {0x10, "Management protocol in"},
117}; 118};
118#define MAINT_IN_SZ ARRAY_SIZE(maint_in_arr) 119#define MAINT_IN_SZ ARRAY_SIZE(maint_in_arr)
119 120
120static const struct value_name_pair maint_out_arr[] = { 121static const struct value_name_pair maint_out_arr[] = {
121 {0x6, "Set device identifier"}, 122 {0x6, "Set identifying information"},
122 {0xa, "Set target port groups"}, 123 {0xa, "Set target port groups"},
123 {0xb, "Change aliases"}, 124 {0xb, "Change aliases"},
124 {0xe, "Set priority"}, 125 {0xe, "Set priority"},
125 {0xe, "Set timestamp"}, 126 {0xf, "Set timestamp"},
127 {0x10, "Management protocol out"},
126}; 128};
127#define MAINT_OUT_SZ ARRAY_SIZE(maint_out_arr) 129#define MAINT_OUT_SZ ARRAY_SIZE(maint_out_arr)
128 130
@@ -412,6 +414,7 @@ static const struct error_info additional[] =
412 {0x0004, "Beginning-of-partition/medium detected"}, 414 {0x0004, "Beginning-of-partition/medium detected"},
413 {0x0005, "End-of-data detected"}, 415 {0x0005, "End-of-data detected"},
414 {0x0006, "I/O process terminated"}, 416 {0x0006, "I/O process terminated"},
417 {0x0007, "Programmable early warning detected"},
415 {0x0011, "Audio play operation in progress"}, 418 {0x0011, "Audio play operation in progress"},
416 {0x0012, "Audio play operation paused"}, 419 {0x0012, "Audio play operation paused"},
417 {0x0013, "Audio play operation successfully completed"}, 420 {0x0013, "Audio play operation successfully completed"},
@@ -425,6 +428,7 @@ static const struct error_info additional[] =
425 {0x001B, "Set capacity operation in progress"}, 428 {0x001B, "Set capacity operation in progress"},
426 {0x001C, "Verify operation in progress"}, 429 {0x001C, "Verify operation in progress"},
427 {0x001D, "ATA pass through information available"}, 430 {0x001D, "ATA pass through information available"},
431 {0x001E, "Conflicting SA creation request"},
428 432
429 {0x0100, "No index/sector signal"}, 433 {0x0100, "No index/sector signal"},
430 434
@@ -449,9 +453,12 @@ static const struct error_info additional[] =
449 {0x040B, "Logical unit not accessible, target port in standby state"}, 453 {0x040B, "Logical unit not accessible, target port in standby state"},
450 {0x040C, "Logical unit not accessible, target port in unavailable " 454 {0x040C, "Logical unit not accessible, target port in unavailable "
451 "state"}, 455 "state"},
456 {0x040D, "Logical unit not ready, structure check required"},
452 {0x0410, "Logical unit not ready, auxiliary memory not accessible"}, 457 {0x0410, "Logical unit not ready, auxiliary memory not accessible"},
453 {0x0411, "Logical unit not ready, notify (enable spinup) required"}, 458 {0x0411, "Logical unit not ready, notify (enable spinup) required"},
454 {0x0412, "Logical unit not ready, offline"}, 459 {0x0412, "Logical unit not ready, offline"},
460 {0x0413, "Logical unit not ready, SA creation in progress"},
461 {0x0414, "Logical unit not ready, space allocation in progress"},
455 462
456 {0x0500, "Logical unit does not respond to selection"}, 463 {0x0500, "Logical unit does not respond to selection"},
457 464
@@ -479,6 +486,9 @@ static const struct error_info additional[] =
479 {0x0B03, "Warning - background self-test failed"}, 486 {0x0B03, "Warning - background self-test failed"},
480 {0x0B04, "Warning - background pre-scan detected medium error"}, 487 {0x0B04, "Warning - background pre-scan detected medium error"},
481 {0x0B05, "Warning - background medium scan detected medium error"}, 488 {0x0B05, "Warning - background medium scan detected medium error"},
489 {0x0B06, "Warning - non-volatile cache now volatile"},
490 {0x0B07, "Warning - degraded power to non-volatile cache"},
491 {0x0B08, "Warning - power loss expected"},
482 492
483 {0x0C00, "Write error"}, 493 {0x0C00, "Write error"},
484 {0x0C01, "Write error - recovered with auto reallocation"}, 494 {0x0C01, "Write error - recovered with auto reallocation"},
@@ -593,6 +603,7 @@ static const struct error_info additional[] =
593 {0x1C02, "Grown defect list not found"}, 603 {0x1C02, "Grown defect list not found"},
594 604
595 {0x1D00, "Miscompare during verify operation"}, 605 {0x1D00, "Miscompare during verify operation"},
606 {0x1D01, "Miscompare verify of unmapped LBA"},
596 607
597 {0x1E00, "Recovered id with ECC correction"}, 608 {0x1E00, "Recovered id with ECC correction"},
598 609
@@ -626,6 +637,7 @@ static const struct error_info additional[] =
626 {0x2405, "Security working key frozen"}, 637 {0x2405, "Security working key frozen"},
627 {0x2406, "Nonce not unique"}, 638 {0x2406, "Nonce not unique"},
628 {0x2407, "Nonce timestamp out of range"}, 639 {0x2407, "Nonce timestamp out of range"},
640 {0x2408, "Invalid XCDB"},
629 641
630 {0x2500, "Logical unit not supported"}, 642 {0x2500, "Logical unit not supported"},
631 643
@@ -656,10 +668,12 @@ static const struct error_info additional[] =
656 {0x2704, "Persistent write protect"}, 668 {0x2704, "Persistent write protect"},
657 {0x2705, "Permanent write protect"}, 669 {0x2705, "Permanent write protect"},
658 {0x2706, "Conditional write protect"}, 670 {0x2706, "Conditional write protect"},
671 {0x2707, "Space allocation failed write protect"},
659 672
660 {0x2800, "Not ready to ready change, medium may have changed"}, 673 {0x2800, "Not ready to ready change, medium may have changed"},
661 {0x2801, "Import or export element accessed"}, 674 {0x2801, "Import or export element accessed"},
662 {0x2802, "Format-layer may have changed"}, 675 {0x2802, "Format-layer may have changed"},
676 {0x2803, "Import/export element accessed, medium changed"},
663 677
664 {0x2900, "Power on, reset, or bus device reset occurred"}, 678 {0x2900, "Power on, reset, or bus device reset occurred"},
665 {0x2901, "Power on occurred"}, 679 {0x2901, "Power on occurred"},
@@ -680,11 +694,16 @@ static const struct error_info additional[] =
680 {0x2A07, "Implicit asymmetric access state transition failed"}, 694 {0x2A07, "Implicit asymmetric access state transition failed"},
681 {0x2A08, "Priority changed"}, 695 {0x2A08, "Priority changed"},
682 {0x2A09, "Capacity data has changed"}, 696 {0x2A09, "Capacity data has changed"},
697 {0x2A0A, "Error history I_T nexus cleared"},
698 {0x2A0B, "Error history snapshot released"},
699 {0x2A0C, "Error recovery attributes have changed"},
700 {0x2A0D, "Data encryption capabilities changed"},
683 {0x2A10, "Timestamp changed"}, 701 {0x2A10, "Timestamp changed"},
684 {0x2A11, "Data encryption parameters changed by another i_t nexus"}, 702 {0x2A11, "Data encryption parameters changed by another i_t nexus"},
685 {0x2A12, "Data encryption parameters changed by vendor specific " 703 {0x2A12, "Data encryption parameters changed by vendor specific "
686 "event"}, 704 "event"},
687 {0x2A13, "Data encryption key instance counter has changed"}, 705 {0x2A13, "Data encryption key instance counter has changed"},
706 {0x2A14, "SA creation capabilities data has changed"},
688 707
689 {0x2B00, "Copy cannot execute since host cannot disconnect"}, 708 {0x2B00, "Copy cannot execute since host cannot disconnect"},
690 709
@@ -723,6 +742,8 @@ static const struct error_info additional[] =
723 {0x300C, "WORM medium - overwrite attempted"}, 742 {0x300C, "WORM medium - overwrite attempted"},
724 {0x300D, "WORM medium - integrity check"}, 743 {0x300D, "WORM medium - integrity check"},
725 {0x3010, "Medium not formatted"}, 744 {0x3010, "Medium not formatted"},
745 {0x3011, "Incompatible volume type"},
746 {0x3012, "Incompatible volume qualifier"},
726 747
727 {0x3100, "Medium format corrupted"}, 748 {0x3100, "Medium format corrupted"},
728 {0x3101, "Format command failed"}, 749 {0x3101, "Format command failed"},
@@ -782,6 +803,10 @@ static const struct error_info additional[] =
782 {0x3B15, "Medium magazine unlocked"}, 803 {0x3B15, "Medium magazine unlocked"},
783 {0x3B16, "Mechanical positioning or changer error"}, 804 {0x3B16, "Mechanical positioning or changer error"},
784 {0x3B17, "Read past end of user object"}, 805 {0x3B17, "Read past end of user object"},
806 {0x3B18, "Element disabled"},
807 {0x3B19, "Element enabled"},
808 {0x3B1A, "Data transfer device removed"},
809 {0x3B1B, "Data transfer device inserted"},
785 810
786 {0x3D00, "Invalid bits in identify message"}, 811 {0x3D00, "Invalid bits in identify message"},
787 812
@@ -882,6 +907,8 @@ static const struct error_info additional[] =
882 {0x5506, "Auxiliary memory out of space"}, 907 {0x5506, "Auxiliary memory out of space"},
883 {0x5507, "Quota error"}, 908 {0x5507, "Quota error"},
884 {0x5508, "Maximum number of supplemental decryption keys exceeded"}, 909 {0x5508, "Maximum number of supplemental decryption keys exceeded"},
910 {0x5509, "Medium auxiliary memory not accessible"},
911 {0x550A, "Data currently unavailable"},
885 912
886 {0x5700, "Unable to recover table-of-contents"}, 913 {0x5700, "Unable to recover table-of-contents"},
887 914
@@ -993,6 +1020,12 @@ static const struct error_info additional[] =
993 {0x5E02, "Standby condition activated by timer"}, 1020 {0x5E02, "Standby condition activated by timer"},
994 {0x5E03, "Idle condition activated by command"}, 1021 {0x5E03, "Idle condition activated by command"},
995 {0x5E04, "Standby condition activated by command"}, 1022 {0x5E04, "Standby condition activated by command"},
1023 {0x5E05, "Idle_b condition activated by timer"},
1024 {0x5E06, "Idle_b condition activated by command"},
1025 {0x5E07, "Idle_c condition activated by timer"},
1026 {0x5E08, "Idle_c condition activated by command"},
1027 {0x5E09, "Standby_y condition activated by timer"},
1028 {0x5E0A, "Standby_y condition activated by command"},
996 {0x5E41, "Power state change to active"}, 1029 {0x5E41, "Power state change to active"},
997 {0x5E42, "Power state change to idle"}, 1030 {0x5E42, "Power state change to idle"},
998 {0x5E43, "Power state change to standby"}, 1031 {0x5E43, "Power state change to standby"},
@@ -1091,7 +1124,28 @@ static const struct error_info additional[] =
1091 {0x7403, "Incorrect data encryption key"}, 1124 {0x7403, "Incorrect data encryption key"},
1092 {0x7404, "Cryptographic integrity validation failed"}, 1125 {0x7404, "Cryptographic integrity validation failed"},
1093 {0x7405, "Error decrypting data"}, 1126 {0x7405, "Error decrypting data"},
1127 {0x7406, "Unknown signature verification key"},
1128 {0x7407, "Encryption parameters not useable"},
1129 {0x7408, "Digital signature validation failure"},
1130 {0x7409, "Encryption mode mismatch on read"},
1131 {0x740A, "Encrypted block not raw read enabled"},
1132 {0x740B, "Incorrect Encryption parameters"},
1133 {0x740C, "Unable to decrypt parameter list"},
1134 {0x740D, "Encryption algorithm disabled"},
1135 {0x7410, "SA creation parameter value invalid"},
1136 {0x7411, "SA creation parameter value rejected"},
1137 {0x7412, "Invalid SA usage"},
1138 {0x7421, "Data Encryption configuration prevented"},
1139 {0x7430, "SA creation parameter not supported"},
1140 {0x7440, "Authentication failed"},
1141 {0x7461, "External data encryption key manager access error"},
1142 {0x7462, "External data encryption key manager error"},
1143 {0x7463, "External data encryption key not found"},
1144 {0x7464, "External data encryption request not authorized"},
1145 {0x746E, "External data encryption control timeout"},
1146 {0x746F, "External data encryption control error"},
1094 {0x7471, "Logical unit access not authorized"}, 1147 {0x7471, "Logical unit access not authorized"},
1148 {0x7479, "Security conflict in translated device"},
1095 1149
1096 {0, NULL} 1150 {0, NULL}
1097}; 1151};
@@ -1103,12 +1157,12 @@ struct error_info2 {
1103 1157
1104static const struct error_info2 additional2[] = 1158static const struct error_info2 additional2[] =
1105{ 1159{
1106 {0x40,0x00,0x7f,"Ram failure (%x)"}, 1160 {0x40, 0x00, 0x7f, "Ram failure (%x)"},
1107 {0x40,0x80,0xff,"Diagnostic failure on component (%x)"}, 1161 {0x40, 0x80, 0xff, "Diagnostic failure on component (%x)"},
1108 {0x41,0x00,0xff,"Data path failure (%x)"}, 1162 {0x41, 0x00, 0xff, "Data path failure (%x)"},
1109 {0x42,0x00,0xff,"Power-on or self-test failure (%x)"}, 1163 {0x42, 0x00, 0xff, "Power-on or self-test failure (%x)"},
1110 {0x4D,0x00,0xff,"Tagged overlapped commands (queue tag %x)"}, 1164 {0x4D, 0x00, 0xff, "Tagged overlapped commands (task tag %x)"},
1111 {0x70,0x00,0xff,"Decompression exception short algorithm id of %x"}, 1165 {0x70, 0x00, 0xff, "Decompression exception short algorithm id of %x"},
1112 {0, 0, 0, NULL} 1166 {0, 0, 0, NULL}
1113}; 1167};
1114 1168
@@ -1157,14 +1211,15 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
1157 int i; 1211 int i;
1158 unsigned short code = ((asc << 8) | ascq); 1212 unsigned short code = ((asc << 8) | ascq);
1159 1213
1160 for (i=0; additional[i].text; i++) 1214 for (i = 0; additional[i].text; i++)
1161 if (additional[i].code12 == code) 1215 if (additional[i].code12 == code)
1162 return additional[i].text; 1216 return additional[i].text;
1163 for (i=0; additional2[i].fmt; i++) 1217 for (i = 0; additional2[i].fmt; i++) {
1164 if (additional2[i].code1 == asc && 1218 if (additional2[i].code1 == asc &&
1165 additional2[i].code2_min >= ascq && 1219 ascq >= additional2[i].code2_min &&
1166 additional2[i].code2_max <= ascq) 1220 ascq <= additional2[i].code2_max)
1167 return additional2[i].fmt; 1221 return additional2[i].fmt;
1222 }
1168#endif 1223#endif
1169 return NULL; 1224 return NULL;
1170} 1225}