aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/scsi/Kconfig13
-rw-r--r--drivers/scsi/arm/Kconfig1
-rw-r--r--drivers/scsi/constants.c108
-rw-r--r--drivers/scsi/scsi_transport_spi.c109
4 files changed, 123 insertions, 108 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 20dd85a77813..4c42065dea88 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -336,6 +336,7 @@ config SCSI_ACARD
336config SCSI_AHA152X 336config SCSI_AHA152X
337 tristate "Adaptec AHA152X/2825 support" 337 tristate "Adaptec AHA152X/2825 support"
338 depends on ISA && SCSI && !64BIT 338 depends on ISA && SCSI && !64BIT
339 select SCSI_SPI_ATTRS
339 ---help--- 340 ---help---
340 This is a driver for the AHA-1510, AHA-1520, AHA-1522, and AHA-2825 341 This is a driver for the AHA-1510, AHA-1520, AHA-1522, and AHA-2825
341 SCSI host adapters. It also works for the AVA-1505, but the IRQ etc. 342 SCSI host adapters. It also works for the AVA-1505, but the IRQ etc.
@@ -623,6 +624,7 @@ config SCSI_OMIT_FLASHPOINT
623config SCSI_DMX3191D 624config SCSI_DMX3191D
624 tristate "DMX3191D SCSI support" 625 tristate "DMX3191D SCSI support"
625 depends on PCI && SCSI 626 depends on PCI && SCSI
627 select SCSI_SPI_ATTRS
626 help 628 help
627 This is support for Domex DMX3191D SCSI Host Adapters. 629 This is support for Domex DMX3191D SCSI Host Adapters.
628 630
@@ -632,6 +634,7 @@ config SCSI_DMX3191D
632config SCSI_DTC3280 634config SCSI_DTC3280
633 tristate "DTC3180/3280 SCSI support" 635 tristate "DTC3180/3280 SCSI support"
634 depends on ISA && SCSI 636 depends on ISA && SCSI
637 select SCSI_SPI_ATTRS
635 help 638 help
636 This is support for DTC 3180/3280 SCSI Host Adapters. Please read 639 This is support for DTC 3180/3280 SCSI Host Adapters. Please read
637 the SCSI-HOWTO, available from 640 the SCSI-HOWTO, available from
@@ -752,6 +755,7 @@ config SCSI_GDTH
752config SCSI_GENERIC_NCR5380 755config SCSI_GENERIC_NCR5380
753 tristate "Generic NCR5380/53c400 SCSI PIO support" 756 tristate "Generic NCR5380/53c400 SCSI PIO support"
754 depends on ISA && SCSI 757 depends on ISA && SCSI
758 select SCSI_SPI_ATTRS
755 ---help--- 759 ---help---
756 This is a driver for the old NCR 53c80 series of SCSI controllers 760 This is a driver for the old NCR 53c80 series of SCSI controllers
757 on boards using PIO. Most boards such as the Trantor T130 fit this 761 on boards using PIO. Most boards such as the Trantor T130 fit this
@@ -771,6 +775,7 @@ config SCSI_GENERIC_NCR5380
771config SCSI_GENERIC_NCR5380_MMIO 775config SCSI_GENERIC_NCR5380_MMIO
772 tristate "Generic NCR5380/53c400 SCSI MMIO support" 776 tristate "Generic NCR5380/53c400 SCSI MMIO support"
773 depends on ISA && SCSI 777 depends on ISA && SCSI
778 select SCSI_SPI_ATTRS
774 ---help--- 779 ---help---
775 This is a driver for the old NCR 53c80 series of SCSI controllers 780 This is a driver for the old NCR 53c80 series of SCSI controllers
776 on boards using memory mapped I/O. 781 on boards using memory mapped I/O.
@@ -1254,6 +1259,7 @@ config SCSI_MCA_53C9X
1254config SCSI_PAS16 1259config SCSI_PAS16
1255 tristate "PAS16 SCSI support" 1260 tristate "PAS16 SCSI support"
1256 depends on ISA && SCSI 1261 depends on ISA && SCSI
1262 select SCSI_SPI_ATTRS
1257 ---help--- 1263 ---help---
1258 This is support for a SCSI host adapter. It is explained in section 1264 This is support for a SCSI host adapter. It is explained in section
1259 3.10 of the SCSI-HOWTO, available from 1265 3.10 of the SCSI-HOWTO, available from
@@ -1423,6 +1429,7 @@ config SCSI_DC390T
1423config SCSI_T128 1429config SCSI_T128
1424 tristate "Trantor T128/T128F/T228 SCSI support" 1430 tristate "Trantor T128/T128F/T228 SCSI support"
1425 depends on ISA && SCSI 1431 depends on ISA && SCSI
1432 select SCSI_SPI_ATTRS
1426 ---help--- 1433 ---help---
1427 This is support for a SCSI host adapter. It is explained in section 1434 This is support for a SCSI host adapter. It is explained in section
1428 3.11 of the SCSI-HOWTO, available from 1435 3.11 of the SCSI-HOWTO, available from
@@ -1681,6 +1688,7 @@ config OKTAGON_SCSI
1681config ATARI_SCSI 1688config ATARI_SCSI
1682 tristate "Atari native SCSI support" 1689 tristate "Atari native SCSI support"
1683 depends on ATARI && SCSI && BROKEN 1690 depends on ATARI && SCSI && BROKEN
1691 select SCSI_SPI_ATTRS
1684 ---help--- 1692 ---help---
1685 If you have an Atari with built-in NCR5380 SCSI controller (TT, 1693 If you have an Atari with built-in NCR5380 SCSI controller (TT,
1686 Falcon, ...) say Y to get it supported. Of course also, if you have 1694 Falcon, ...) say Y to get it supported. Of course also, if you have
@@ -1722,6 +1730,7 @@ config TT_DMA_EMUL
1722config MAC_SCSI 1730config MAC_SCSI
1723 bool "Macintosh NCR5380 SCSI" 1731 bool "Macintosh NCR5380 SCSI"
1724 depends on MAC && SCSI=y 1732 depends on MAC && SCSI=y
1733 select SCSI_SPI_ATTRS
1725 help 1734 help
1726 This is the NCR 5380 SCSI controller included on most of the 68030 1735 This is the NCR 5380 SCSI controller included on most of the 68030
1727 based Macintoshes. If you have one of these say Y and read the 1736 based Macintoshes. If you have one of these say Y and read the
@@ -1743,6 +1752,7 @@ config SCSI_MAC_ESP
1743config MVME147_SCSI 1752config MVME147_SCSI
1744 bool "WD33C93 SCSI driver for MVME147" 1753 bool "WD33C93 SCSI driver for MVME147"
1745 depends on MVME147 && SCSI=y 1754 depends on MVME147 && SCSI=y
1755 select SCSI_SPI_ATTRS
1746 help 1756 help
1747 Support for the on-board SCSI controller on the Motorola MVME147 1757 Support for the on-board SCSI controller on the Motorola MVME147
1748 single-board computer. 1758 single-board computer.
@@ -1750,6 +1760,7 @@ config MVME147_SCSI
1750config MVME16x_SCSI 1760config MVME16x_SCSI
1751 bool "NCR53C710 SCSI driver for MVME16x" 1761 bool "NCR53C710 SCSI driver for MVME16x"
1752 depends on MVME16x && SCSI && BROKEN 1762 depends on MVME16x && SCSI && BROKEN
1763 select SCSI_SPI_ATTRS
1753 help 1764 help
1754 The Motorola MVME162, 166, 167, 172 and 177 boards use the NCR53C710 1765 The Motorola MVME162, 166, 167, 172 and 177 boards use the NCR53C710
1755 SCSI controller chip. Almost everyone using one of these boards 1766 SCSI controller chip. Almost everyone using one of these boards
@@ -1758,6 +1769,7 @@ config MVME16x_SCSI
1758config BVME6000_SCSI 1769config BVME6000_SCSI
1759 bool "NCR53C710 SCSI driver for BVME6000" 1770 bool "NCR53C710 SCSI driver for BVME6000"
1760 depends on BVME6000 && SCSI && BROKEN 1771 depends on BVME6000 && SCSI && BROKEN
1772 select SCSI_SPI_ATTRS
1761 help 1773 help
1762 The BVME4000 and BVME6000 boards from BVM Ltd use the NCR53C710 1774 The BVME4000 and BVME6000 boards from BVM Ltd use the NCR53C710
1763 SCSI controller chip. Almost everyone using one of these boards 1775 SCSI controller chip. Almost everyone using one of these boards
@@ -1774,6 +1786,7 @@ config SCSI_NCR53C7xx_FAST
1774config SUN3_SCSI 1786config SUN3_SCSI
1775 tristate "Sun3 NCR5380 SCSI" 1787 tristate "Sun3 NCR5380 SCSI"
1776 depends on SUN3 && SCSI && BROKEN 1788 depends on SUN3 && SCSI && BROKEN
1789 select SCSI_SPI_ATTRS
1777 help 1790 help
1778 This option will enable support for the OBIO (onboard io) NCR5380 1791 This option will enable support for the OBIO (onboard io) NCR5380
1779 SCSI controller found in the Sun 3/50 and 3/60, as well as for 1792 SCSI controller found in the Sun 3/50 and 3/60, as well as for
diff --git a/drivers/scsi/arm/Kconfig b/drivers/scsi/arm/Kconfig
index 13f23043c8a3..06d7601cdf56 100644
--- a/drivers/scsi/arm/Kconfig
+++ b/drivers/scsi/arm/Kconfig
@@ -4,6 +4,7 @@
4config SCSI_ACORNSCSI_3 4config SCSI_ACORNSCSI_3
5 tristate "Acorn SCSI card (aka30) support" 5 tristate "Acorn SCSI card (aka30) support"
6 depends on ARCH_ACORN && SCSI && BROKEN 6 depends on ARCH_ACORN && SCSI && BROKEN
7 select SCSI_SPI_ATTRS
7 help 8 help
8 This enables support for the Acorn SCSI card (aka30). If you have an 9 This enables support for the Acorn SCSI card (aka30). If you have an
9 Acorn system with one of these, say Y. If unsure, say N. 10 Acorn system with one of these, say Y. If unsure, say N.
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) */
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 4002a98ab16f..00a73fc23fcc 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -18,6 +18,7 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#include <linux/config.h>
21#include <linux/ctype.h> 22#include <linux/ctype.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -1047,6 +1048,114 @@ void spi_display_xfer_agreement(struct scsi_target *starget)
1047} 1048}
1048EXPORT_SYMBOL(spi_display_xfer_agreement); 1049EXPORT_SYMBOL(spi_display_xfer_agreement);
1049 1050
1051#ifdef CONFIG_SCSI_CONSTANTS
1052static const char * const one_byte_msgs[] = {
1053/* 0x00 */ "Command Complete", NULL, "Save Pointers",
1054/* 0x03 */ "Restore Pointers", "Disconnect", "Initiator Error",
1055/* 0x06 */ "Abort", "Message Reject", "Nop", "Message Parity Error",
1056/* 0x0a */ "Linked Command Complete", "Linked Command Complete w/flag",
1057/* 0x0c */ "Bus device reset", "Abort Tag", "Clear Queue",
1058/* 0x0f */ "Initiate Recovery", "Release Recovery"
1059};
1060#define NO_ONE_BYTE_MSGS (sizeof(one_byte_msgs) / sizeof (const char *))
1061
1062static const char * const two_byte_msgs[] = {
1063/* 0x20 */ "Simple Queue Tag", "Head of Queue Tag", "Ordered Queue Tag"
1064/* 0x23 */ "Ignore Wide Residue"
1065};
1066#define NO_TWO_BYTE_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
1067
1068static const char * const extended_msgs[] = {
1069/* 0x00 */ "Modify Data Pointer", "Synchronous Data Transfer Request",
1070/* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request"
1071};
1072#define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
1073
1074
1075int scsi_print_msg (const unsigned char *msg)
1076{
1077 int len = 0, i;
1078 if (msg[0] == EXTENDED_MESSAGE) {
1079 len = 3 + msg[1];
1080 if (msg[2] < NO_EXTENDED_MSGS)
1081 printk ("%s ", extended_msgs[msg[2]]);
1082 else
1083 printk ("Extended Message, reserved code (0x%02x) ",
1084 (int) msg[2]);
1085 switch (msg[2]) {
1086 case EXTENDED_MODIFY_DATA_POINTER:
1087 printk("pointer = %d", (int) (msg[3] << 24) |
1088 (msg[4] << 16) | (msg[5] << 8) | msg[6]);
1089 break;
1090 case EXTENDED_SDTR:
1091 printk("period = %d ns, offset = %d",
1092 (int) msg[3] * 4, (int) msg[4]);
1093 break;
1094 case EXTENDED_WDTR:
1095 printk("width = 2^%d bytes", msg[3]);
1096 break;
1097 default:
1098 for (i = 2; i < len; ++i)
1099 printk("%02x ", msg[i]);
1100 }
1101 /* Identify */
1102 } else if (msg[0] & 0x80) {
1103 printk("Identify disconnect %sallowed %s %d ",
1104 (msg[0] & 0x40) ? "" : "not ",
1105 (msg[0] & 0x20) ? "target routine" : "lun",
1106 msg[0] & 0x7);
1107 len = 1;
1108 /* Normal One byte */
1109 } else if (msg[0] < 0x1f) {
1110 if (msg[0] < NO_ONE_BYTE_MSGS)
1111 printk(one_byte_msgs[msg[0]]);
1112 else
1113 printk("reserved (%02x) ", msg[0]);
1114 len = 1;
1115 /* Two byte */
1116 } else if (msg[0] <= 0x2f) {
1117 if ((msg[0] - 0x20) < NO_TWO_BYTE_MSGS)
1118 printk("%s %02x ", two_byte_msgs[msg[0] - 0x20],
1119 msg[1]);
1120 else
1121 printk("reserved two byte (%02x %02x) ",
1122 msg[0], msg[1]);
1123 len = 2;
1124 } else
1125 printk("reserved");
1126 return len;
1127}
1128EXPORT_SYMBOL(scsi_print_msg);
1129
1130#else /* ifndef CONFIG_SCSI_CONSTANTS */
1131
1132int scsi_print_msg (const unsigned char *msg)
1133{
1134 int len = 0, i;
1135
1136 if (msg[0] == EXTENDED_MESSAGE) {
1137 len = 3 + msg[1];
1138 for (i = 0; i < len; ++i)
1139 printk("%02x ", msg[i]);
1140 /* Identify */
1141 } else if (msg[0] & 0x80) {
1142 printk("%02x ", msg[0]);
1143 len = 1;
1144 /* Normal One byte */
1145 } else if (msg[0] < 0x1f) {
1146 printk("%02x ", msg[0]);
1147 len = 1;
1148 /* Two byte */
1149 } else if (msg[0] <= 0x2f) {
1150 printk("%02x %02x", msg[0], msg[1]);
1151 len = 2;
1152 } else
1153 printk("%02x ", msg[0]);
1154 return len;
1155}
1156EXPORT_SYMBOL(scsi_print_msg);
1157#endif /* ! CONFIG_SCSI_CONSTANTS */
1158
1050#define SETUP_ATTRIBUTE(field) \ 1159#define SETUP_ATTRIBUTE(field) \
1051 i->private_attrs[count] = class_device_attr_##field; \ 1160 i->private_attrs[count] = class_device_attr_##field; \
1052 if (!i->f->set_##field) { \ 1161 if (!i->f->set_##field) { \