aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/Kconfig4
-rw-r--r--drivers/scsi/Makefile4
-rw-r--r--drivers/scsi/constants.c44
-rw-r--r--drivers/xen/xen-scsiback.c1
-rw-r--r--include/scsi/scsi_dbg.h68
5 files changed, 69 insertions, 52 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 9c92f415229f..b021bcb88537 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -201,12 +201,12 @@ config SCSI_ENCLOSURE
201 certain enclosure conditions to be reported and is not required. 201 certain enclosure conditions to be reported and is not required.
202 202
203config SCSI_CONSTANTS 203config SCSI_CONSTANTS
204 bool "Verbose SCSI error reporting (kernel size +=12K)" 204 bool "Verbose SCSI error reporting (kernel size +=75K)"
205 depends on SCSI 205 depends on SCSI
206 help 206 help
207 The error messages regarding your SCSI hardware will be easier to 207 The error messages regarding your SCSI hardware will be easier to
208 understand if you say Y here; it will enlarge your kernel by about 208 understand if you say Y here; it will enlarge your kernel by about
209 12 KB. If in doubt, say Y. 209 75 KB. If in doubt, say Y.
210 210
211config SCSI_LOGGING 211config SCSI_LOGGING
212 bool "SCSI logging facility" 212 bool "SCSI logging facility"
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 447c2d24aafa..dee160a4f163 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -159,9 +159,9 @@ obj-$(CONFIG_SCSI_OSD_INITIATOR) += osd/
159 159
160# This goes last, so that "real" scsi devices probe earlier 160# This goes last, so that "real" scsi devices probe earlier
161obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o 161obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o
162 162scsi_mod-y += scsi.o hosts.o scsi_ioctl.o \
163scsi_mod-y += scsi.o hosts.o scsi_ioctl.o constants.o \
164 scsicam.o scsi_error.o scsi_lib.o 163 scsicam.o scsi_error.o scsi_lib.o
164scsi_mod-$(CONFIG_SCSI_CONSTANTS) += constants.o
165scsi_mod-$(CONFIG_SCSI_DMA) += scsi_lib_dma.o 165scsi_mod-$(CONFIG_SCSI_DMA) += scsi_lib_dma.o
166scsi_mod-y += scsi_scan.o scsi_sysfs.o scsi_devinfo.o 166scsi_mod-y += scsi_scan.o scsi_sysfs.o scsi_devinfo.o
167scsi_mod-$(CONFIG_SCSI_NETLINK) += scsi_netlink.o 167scsi_mod-$(CONFIG_SCSI_NETLINK) += scsi_netlink.o
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 956fbdd38681..fa09d4be2b53 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -18,8 +18,6 @@
18#include <scsi/scsi_eh.h> 18#include <scsi/scsi_eh.h>
19#include <scsi/scsi_dbg.h> 19#include <scsi/scsi_dbg.h>
20 20
21
22
23/* Commands with service actions that change the command name */ 21/* Commands with service actions that change the command name */
24#define THIRD_PARTY_COPY_OUT 0x83 22#define THIRD_PARTY_COPY_OUT 0x83
25#define THIRD_PARTY_COPY_IN 0x84 23#define THIRD_PARTY_COPY_IN 0x84
@@ -35,7 +33,6 @@ struct value_name_pair {
35 const char * name; 33 const char * name;
36}; 34};
37 35
38#ifdef CONFIG_SCSI_CONSTANTS
39static const char * cdb_byte0_names[] = { 36static const char * cdb_byte0_names[] = {
40/* 00-03 */ "Test Unit Ready", "Rezero Unit/Rewind", NULL, "Request Sense", 37/* 00-03 */ "Test Unit Ready", "Rezero Unit/Rewind", NULL, "Request Sense",
41/* 04-07 */ "Format Unit/Medium", "Read Block Limits", NULL, 38/* 04-07 */ "Format Unit/Medium", "Read Block Limits", NULL,
@@ -259,26 +256,6 @@ static struct sa_name_list sa_names_arr[] = {
259 {0, NULL, 0}, 256 {0, NULL, 0},
260}; 257};
261 258
262#else /* ifndef CONFIG_SCSI_CONSTANTS */
263static const char *cdb_byte0_names[0];
264
265static struct sa_name_list sa_names_arr[] = {
266 {VARIABLE_LENGTH_CMD, NULL, 0},
267 {MAINTENANCE_IN, NULL, 0},
268 {MAINTENANCE_OUT, NULL, 0},
269 {PERSISTENT_RESERVE_IN, NULL, 0},
270 {PERSISTENT_RESERVE_OUT, NULL, 0},
271 {SERVICE_ACTION_IN_12, NULL, 0},
272 {SERVICE_ACTION_OUT_12, NULL, 0},
273 {SERVICE_ACTION_BIDIRECTIONAL, NULL, 0},
274 {SERVICE_ACTION_IN_16, NULL, 0},
275 {SERVICE_ACTION_OUT_16, NULL, 0},
276 {THIRD_PARTY_COPY_IN, NULL, 0},
277 {THIRD_PARTY_COPY_OUT, NULL, 0},
278 {0, NULL, 0},
279};
280#endif /* CONFIG_SCSI_CONSTANTS */
281
282bool scsi_opcode_sa_name(int opcode, int service_action, 259bool scsi_opcode_sa_name(int opcode, int service_action,
283 const char **cdb_name, const char **sa_name) 260 const char **cdb_name, const char **sa_name)
284{ 261{
@@ -313,8 +290,6 @@ bool scsi_opcode_sa_name(int opcode, int service_action,
313 return true; 290 return true;
314} 291}
315 292
316#ifdef CONFIG_SCSI_CONSTANTS
317
318struct error_info { 293struct error_info {
319 unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */ 294 unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */
320 const char * text; 295 const char * text;
@@ -1203,15 +1178,12 @@ static const char * const snstext[] = {
1203 "Completed", /* F: command completed sense data reported, 1178 "Completed", /* F: command completed sense data reported,
1204 may occur for successful command */ 1179 may occur for successful command */
1205}; 1180};
1206#endif
1207 1181
1208/* Get sense key string or NULL if not available */ 1182/* Get sense key string or NULL if not available */
1209const char * 1183const char *
1210scsi_sense_key_string(unsigned char key) { 1184scsi_sense_key_string(unsigned char key) {
1211#ifdef CONFIG_SCSI_CONSTANTS
1212 if (key <= 0xE) 1185 if (key <= 0xE)
1213 return snstext[key]; 1186 return snstext[key];
1214#endif
1215 return NULL; 1187 return NULL;
1216} 1188}
1217EXPORT_SYMBOL(scsi_sense_key_string); 1189EXPORT_SYMBOL(scsi_sense_key_string);
@@ -1223,7 +1195,6 @@ EXPORT_SYMBOL(scsi_sense_key_string);
1223const char * 1195const char *
1224scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt) 1196scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
1225{ 1197{
1226#ifdef CONFIG_SCSI_CONSTANTS
1227 int i; 1198 int i;
1228 unsigned short code = ((asc << 8) | ascq); 1199 unsigned short code = ((asc << 8) | ascq);
1229 1200
@@ -1239,15 +1210,10 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
1239 return additional2[i].str; 1210 return additional2[i].str;
1240 } 1211 }
1241 } 1212 }
1242#else
1243 *fmt = NULL;
1244#endif
1245 return NULL; 1213 return NULL;
1246} 1214}
1247EXPORT_SYMBOL(scsi_extd_sense_format); 1215EXPORT_SYMBOL(scsi_extd_sense_format);
1248 1216
1249#ifdef CONFIG_SCSI_CONSTANTS
1250
1251static const char * const hostbyte_table[]={ 1217static const char * const hostbyte_table[]={
1252"DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", 1218"DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET",
1253"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", 1219"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR",
@@ -1259,17 +1225,13 @@ static const char * const driverbyte_table[]={
1259"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", 1225"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR",
1260"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; 1226"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"};
1261 1227
1262#endif
1263
1264const char *scsi_hostbyte_string(int result) 1228const char *scsi_hostbyte_string(int result)
1265{ 1229{
1266 const char *hb_string = NULL; 1230 const char *hb_string = NULL;
1267#ifdef CONFIG_SCSI_CONSTANTS
1268 int hb = host_byte(result); 1231 int hb = host_byte(result);
1269 1232
1270 if (hb < ARRAY_SIZE(hostbyte_table)) 1233 if (hb < ARRAY_SIZE(hostbyte_table))
1271 hb_string = hostbyte_table[hb]; 1234 hb_string = hostbyte_table[hb];
1272#endif
1273 return hb_string; 1235 return hb_string;
1274} 1236}
1275EXPORT_SYMBOL(scsi_hostbyte_string); 1237EXPORT_SYMBOL(scsi_hostbyte_string);
@@ -1277,17 +1239,14 @@ EXPORT_SYMBOL(scsi_hostbyte_string);
1277const char *scsi_driverbyte_string(int result) 1239const char *scsi_driverbyte_string(int result)
1278{ 1240{
1279 const char *db_string = NULL; 1241 const char *db_string = NULL;
1280#ifdef CONFIG_SCSI_CONSTANTS
1281 int db = driver_byte(result); 1242 int db = driver_byte(result);
1282 1243
1283 if (db < ARRAY_SIZE(driverbyte_table)) 1244 if (db < ARRAY_SIZE(driverbyte_table))
1284 db_string = driverbyte_table[db]; 1245 db_string = driverbyte_table[db];
1285#endif
1286 return db_string; 1246 return db_string;
1287} 1247}
1288EXPORT_SYMBOL(scsi_driverbyte_string); 1248EXPORT_SYMBOL(scsi_driverbyte_string);
1289 1249
1290#ifdef CONFIG_SCSI_CONSTANTS
1291#define scsi_mlreturn_name(result) { result, #result } 1250#define scsi_mlreturn_name(result) { result, #result }
1292static const struct value_name_pair scsi_mlreturn_arr[] = { 1251static const struct value_name_pair scsi_mlreturn_arr[] = {
1293 scsi_mlreturn_name(NEEDS_RETRY), 1252 scsi_mlreturn_name(NEEDS_RETRY),
@@ -1300,11 +1259,9 @@ static const struct value_name_pair scsi_mlreturn_arr[] = {
1300 scsi_mlreturn_name(SCSI_RETURN_NOT_HANDLED), 1259 scsi_mlreturn_name(SCSI_RETURN_NOT_HANDLED),
1301 scsi_mlreturn_name(FAST_IO_FAIL) 1260 scsi_mlreturn_name(FAST_IO_FAIL)
1302}; 1261};
1303#endif
1304 1262
1305const char *scsi_mlreturn_string(int result) 1263const char *scsi_mlreturn_string(int result)
1306{ 1264{
1307#ifdef CONFIG_SCSI_CONSTANTS
1308 const struct value_name_pair *arr = scsi_mlreturn_arr; 1265 const struct value_name_pair *arr = scsi_mlreturn_arr;
1309 int k; 1266 int k;
1310 1267
@@ -1312,7 +1269,6 @@ const char *scsi_mlreturn_string(int result)
1312 if (result == arr->value) 1269 if (result == arr->value)
1313 return arr->name; 1270 return arr->name;
1314 } 1271 }
1315#endif
1316 return NULL; 1272 return NULL;
1317} 1273}
1318EXPORT_SYMBOL(scsi_mlreturn_string); 1274EXPORT_SYMBOL(scsi_mlreturn_string);
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index e999496eda3e..471ab0661696 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -47,6 +47,7 @@
47 47
48#include <generated/utsrelease.h> 48#include <generated/utsrelease.h>
49 49
50#include <scsi/scsi.h>
50#include <scsi/scsi_dbg.h> 51#include <scsi/scsi_dbg.h>
51#include <scsi/scsi_eh.h> 52#include <scsi/scsi_eh.h>
52#include <scsi/scsi_tcq.h> 53#include <scsi/scsi_tcq.h>
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 365b6745dc10..f8170e90b49d 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -7,7 +7,6 @@ struct scsi_sense_hdr;
7 7
8#define SCSI_LOG_BUFSIZE 128 8#define SCSI_LOG_BUFSIZE 128
9 9
10extern bool scsi_opcode_sa_name(int, int, const char **, const char **);
11extern void scsi_print_command(struct scsi_cmnd *); 10extern void scsi_print_command(struct scsi_cmnd *);
12extern size_t __scsi_format_command(char *, size_t, 11extern size_t __scsi_format_command(char *, size_t,
13 const unsigned char *, size_t); 12 const unsigned char *, size_t);
@@ -22,11 +21,72 @@ extern void __scsi_print_sense(const struct scsi_device *, const char *name,
22 const unsigned char *sense_buffer, 21 const unsigned char *sense_buffer,
23 int sense_len); 22 int sense_len);
24extern void scsi_print_result(const struct scsi_cmnd *, const char *, int); 23extern void scsi_print_result(const struct scsi_cmnd *, const char *, int);
25extern const char *scsi_hostbyte_string(int); 24
26extern const char *scsi_driverbyte_string(int); 25#ifdef CONFIG_SCSI_CONSTANTS
27extern const char *scsi_mlreturn_string(int); 26extern bool scsi_opcode_sa_name(int, int, const char **, const char **);
28extern const char *scsi_sense_key_string(unsigned char); 27extern const char *scsi_sense_key_string(unsigned char);
29extern const char *scsi_extd_sense_format(unsigned char, unsigned char, 28extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
30 const char **); 29 const char **);
30extern const char *scsi_mlreturn_string(int);
31extern const char *scsi_hostbyte_string(int);
32extern const char *scsi_driverbyte_string(int);
33#else
34static inline bool
35scsi_opcode_sa_name(int cmd, int sa,
36 const char **cdb_name, const char **sa_name)
37{
38 *cdb_name = NULL;
39 switch (cmd) {
40 case VARIABLE_LENGTH_CMD:
41 case MAINTENANCE_IN:
42 case MAINTENANCE_OUT:
43 case PERSISTENT_RESERVE_IN:
44 case PERSISTENT_RESERVE_OUT:
45 case SERVICE_ACTION_IN_12:
46 case SERVICE_ACTION_OUT_12:
47 case SERVICE_ACTION_BIDIRECTIONAL:
48 case SERVICE_ACTION_IN_16:
49 case SERVICE_ACTION_OUT_16:
50 case EXTENDED_COPY:
51 case RECEIVE_COPY_RESULTS:
52 *sa_name = NULL;
53 return true;
54 default:
55 return false;
56 }
57}
58
59static inline const char *
60scsi_sense_key_string(unsigned char key)
61{
62 return NULL;
63}
64
65static inline const char *
66scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
67{
68 *fmt = NULL;
69 return NULL;
70}
71
72static inline const char *
73scsi_mlreturn_string(int result)
74{
75 return NULL;
76}
77
78static inline const char *
79scsi_hostbyte_string(int result)
80{
81 return NULL;
82}
83
84static inline const char *
85scsi_driverbyte_string(int result)
86{
87 return NULL;
88}
89
90#endif
31 91
32#endif /* _SCSI_SCSI_DBG_H */ 92#endif /* _SCSI_SCSI_DBG_H */