aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/constants.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2005-12-15 16:22:01 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-12-15 21:41:13 -0500
commit410ca5c7c6ed08bda165e8137bff26c3fbee5a1b (patch)
tree079d028ecb7ea645f0948e3a90a919c7c4f35eee /drivers/scsi/constants.c
parent7b16318dea8d9840dac567a2ae8c50ecdea36aea (diff)
[SCSI] Move scsi_print_msg to SPI class
scsi_print_msg() is an SPI-specific concept. This patch moves it from constants.c to scsi_transport_spi.c and updates the Kconfig to link in the SPI class for the drivers which use scsi_print_msg(). Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/constants.c')
-rw-r--r--drivers/scsi/constants.c108
1 files changed, 0 insertions, 108 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index a972c1e89e36..30a335349cee 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1278,114 +1278,6 @@ void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq)
1278} 1278}
1279EXPORT_SYMBOL(scsi_print_req_sense); 1279EXPORT_SYMBOL(scsi_print_req_sense);
1280 1280
1281#ifdef CONFIG_SCSI_CONSTANTS
1282static const char * const 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
1292static const char * const 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
1298static const char * const 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
1305int 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}
1358EXPORT_SYMBOL(scsi_print_msg);
1359
1360#else /* ifndef CONFIG_SCSI_CONSTANTS */
1361
1362int 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}
1386EXPORT_SYMBOL(scsi_print_msg);
1387#endif /* ! CONFIG_SCSI_CONSTANTS */
1388
1389void scsi_print_command(struct scsi_cmnd *cmd) 1281void 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) */