aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 14:36:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 14:36:49 -0400
commite6f194d8f6f50da6837af637b2fd839c34185f7a (patch)
treef3c479a2bc24d49a150ff183e2614ee0f76cb366 /drivers/message/fusion
parent7578634990fb47cc30083fbd812689aa6deacfc0 (diff)
parentb91421749a1840148d8c81637c03c0ace3f35269 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (60 commits) [SCSI] libsas: make ATA functions selectable by a config option [SCSI] bsg: unexport sg v3 helper functions [SCSI] bsg: fix bsg_unregister_queue [SCSI] bsg: make class backlinks [SCSI] 3w-9xxx: add support for 9690SA [SCSI] bsg: fix bsg_register_queue error path [SCSI] ESP: Increase ESP_BUS_TIMEOUT to 275. [SCSI] libsas: fix scr_read/write users and update the libata documentation [SCSI] mpt fusion: update Kconfig help [SCSI] scsi_transport_sas: add destructor for bsg [SCSI] iscsi_tcp: buggered kmalloc() [SCSI] qla2xxx: Update version number to 8.02.00-k2. [SCSI] qla2xxx: Add ISP25XX support. [SCSI] qla2xxx: Use pci_try_set_mwi(). [SCSI] qla2xxx: Use PCI-X/PCI-Express read control interfaces. [SCSI] qla2xxx: Re-factor isp_operations to static structures. [SCSI] qla2xxx: Validate mid-layer 'underflow' during check-condition handling. [SCSI] qla2xxx: Correct setting of 'current' and 'supported' speeds during FDMI registration. [SCSI] qla2xxx: Generalize iIDMA support. [SCSI] qla2xxx: Generalize FW-Interface-2 support. ...
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/Kconfig1
-rw-r--r--drivers/message/fusion/mptbase.c382
-rw-r--r--drivers/message/fusion/mptbase.h9
-rw-r--r--drivers/message/fusion/mptfc.c3
-rw-r--r--drivers/message/fusion/mptsas.c72
-rw-r--r--drivers/message/fusion/mptscsih.c153
-rw-r--r--drivers/message/fusion/mptscsih.h1
-rw-r--r--drivers/message/fusion/mptspi.c9
8 files changed, 565 insertions, 65 deletions
diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
index c88cc75ab49b..4494e0fd36c6 100644
--- a/drivers/message/fusion/Kconfig
+++ b/drivers/message/fusion/Kconfig
@@ -37,6 +37,7 @@ config FUSION_FC
37 LSIFC929 37 LSIFC929
38 LSIFC929X 38 LSIFC929X
39 LSIFC929XL 39 LSIFC929XL
40 Brocade FC 410/420
40 41
41config FUSION_SAS 42config FUSION_SAS
42 tristate "Fusion MPT ScsiHost drivers for SAS" 43 tristate "Fusion MPT ScsiHost drivers for SAS"
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5a10c87239c2..04f75e24dcec 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -161,6 +161,7 @@ static int mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum);
161static void mpt_read_ioc_pg_1(MPT_ADAPTER *ioc); 161static void mpt_read_ioc_pg_1(MPT_ADAPTER *ioc);
162static void mpt_read_ioc_pg_4(MPT_ADAPTER *ioc); 162static void mpt_read_ioc_pg_4(MPT_ADAPTER *ioc);
163static void mpt_timer_expired(unsigned long data); 163static void mpt_timer_expired(unsigned long data);
164static void mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc);
164static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch); 165static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch);
165static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp); 166static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp);
166static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag); 167static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag);
@@ -1131,6 +1132,248 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
1131 return -1; 1132 return -1;
1132} 1133}
1133 1134
1135/**
1136 * mpt_get_product_name - returns product string
1137 * @vendor: pci vendor id
1138 * @device: pci device id
1139 * @revision: pci revision id
1140 * @prod_name: string returned
1141 *
1142 * Returns product string displayed when driver loads,
1143 * in /proc/mpt/summary and /sysfs/class/scsi_host/host<X>/version_product
1144 *
1145 **/
1146static void
1147mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name)
1148{
1149 char *product_str = NULL;
1150
1151 if (vendor == PCI_VENDOR_ID_BROCADE) {
1152 switch (device)
1153 {
1154 case MPI_MANUFACTPAGE_DEVICEID_FC949E:
1155 switch (revision)
1156 {
1157 case 0x00:
1158 product_str = "BRE040 A0";
1159 break;
1160 case 0x01:
1161 product_str = "BRE040 A1";
1162 break;
1163 default:
1164 product_str = "BRE040";
1165 break;
1166 }
1167 break;
1168 }
1169 goto out;
1170 }
1171
1172 switch (device)
1173 {
1174 case MPI_MANUFACTPAGE_DEVICEID_FC909:
1175 product_str = "LSIFC909 B1";
1176 break;
1177 case MPI_MANUFACTPAGE_DEVICEID_FC919:
1178 product_str = "LSIFC919 B0";
1179 break;
1180 case MPI_MANUFACTPAGE_DEVICEID_FC929:
1181 product_str = "LSIFC929 B0";
1182 break;
1183 case MPI_MANUFACTPAGE_DEVICEID_FC919X:
1184 if (revision < 0x80)
1185 product_str = "LSIFC919X A0";
1186 else
1187 product_str = "LSIFC919XL A1";
1188 break;
1189 case MPI_MANUFACTPAGE_DEVICEID_FC929X:
1190 if (revision < 0x80)
1191 product_str = "LSIFC929X A0";
1192 else
1193 product_str = "LSIFC929XL A1";
1194 break;
1195 case MPI_MANUFACTPAGE_DEVICEID_FC939X:
1196 product_str = "LSIFC939X A1";
1197 break;
1198 case MPI_MANUFACTPAGE_DEVICEID_FC949X:
1199 product_str = "LSIFC949X A1";
1200 break;
1201 case MPI_MANUFACTPAGE_DEVICEID_FC949E:
1202 switch (revision)
1203 {
1204 case 0x00:
1205 product_str = "LSIFC949E A0";
1206 break;
1207 case 0x01:
1208 product_str = "LSIFC949E A1";
1209 break;
1210 default:
1211 product_str = "LSIFC949E";
1212 break;
1213 }
1214 break;
1215 case MPI_MANUFACTPAGE_DEVID_53C1030:
1216 switch (revision)
1217 {
1218 case 0x00:
1219 product_str = "LSI53C1030 A0";
1220 break;
1221 case 0x01:
1222 product_str = "LSI53C1030 B0";
1223 break;
1224 case 0x03:
1225 product_str = "LSI53C1030 B1";
1226 break;
1227 case 0x07:
1228 product_str = "LSI53C1030 B2";
1229 break;
1230 case 0x08:
1231 product_str = "LSI53C1030 C0";
1232 break;
1233 case 0x80:
1234 product_str = "LSI53C1030T A0";
1235 break;
1236 case 0x83:
1237 product_str = "LSI53C1030T A2";
1238 break;
1239 case 0x87:
1240 product_str = "LSI53C1030T A3";
1241 break;
1242 case 0xc1:
1243 product_str = "LSI53C1020A A1";
1244 break;
1245 default:
1246 product_str = "LSI53C1030";
1247 break;
1248 }
1249 break;
1250 case MPI_MANUFACTPAGE_DEVID_1030_53C1035:
1251 switch (revision)
1252 {
1253 case 0x03:
1254 product_str = "LSI53C1035 A2";
1255 break;
1256 case 0x04:
1257 product_str = "LSI53C1035 B0";
1258 break;
1259 default:
1260 product_str = "LSI53C1035";
1261 break;
1262 }
1263 break;
1264 case MPI_MANUFACTPAGE_DEVID_SAS1064:
1265 switch (revision)
1266 {
1267 case 0x00:
1268 product_str = "LSISAS1064 A1";
1269 break;
1270 case 0x01:
1271 product_str = "LSISAS1064 A2";
1272 break;
1273 case 0x02:
1274 product_str = "LSISAS1064 A3";
1275 break;
1276 case 0x03:
1277 product_str = "LSISAS1064 A4";
1278 break;
1279 default:
1280 product_str = "LSISAS1064";
1281 break;
1282 }
1283 break;
1284 case MPI_MANUFACTPAGE_DEVID_SAS1064E:
1285 switch (revision)
1286 {
1287 case 0x00:
1288 product_str = "LSISAS1064E A0";
1289 break;
1290 case 0x01:
1291 product_str = "LSISAS1064E B0";
1292 break;
1293 case 0x02:
1294 product_str = "LSISAS1064E B1";
1295 break;
1296 case 0x04:
1297 product_str = "LSISAS1064E B2";
1298 break;
1299 case 0x08:
1300 product_str = "LSISAS1064E B3";
1301 break;
1302 default:
1303 product_str = "LSISAS1064E";
1304 break;
1305 }
1306 break;
1307 case MPI_MANUFACTPAGE_DEVID_SAS1068:
1308 switch (revision)
1309 {
1310 case 0x00:
1311 product_str = "LSISAS1068 A0";
1312 break;
1313 case 0x01:
1314 product_str = "LSISAS1068 B0";
1315 break;
1316 case 0x02:
1317 product_str = "LSISAS1068 B1";
1318 break;
1319 default:
1320 product_str = "LSISAS1068";
1321 break;
1322 }
1323 break;
1324 case MPI_MANUFACTPAGE_DEVID_SAS1068E:
1325 switch (revision)
1326 {
1327 case 0x00:
1328 product_str = "LSISAS1068E A0";
1329 break;
1330 case 0x01:
1331 product_str = "LSISAS1068E B0";
1332 break;
1333 case 0x02:
1334 product_str = "LSISAS1068E B1";
1335 break;
1336 case 0x04:
1337 product_str = "LSISAS1068E B2";
1338 break;
1339 case 0x08:
1340 product_str = "LSISAS1068E B3";
1341 break;
1342 default:
1343 product_str = "LSISAS1068E";
1344 break;
1345 }
1346 break;
1347 case MPI_MANUFACTPAGE_DEVID_SAS1078:
1348 switch (revision)
1349 {
1350 case 0x00:
1351 product_str = "LSISAS1078 A0";
1352 break;
1353 case 0x01:
1354 product_str = "LSISAS1078 B0";
1355 break;
1356 case 0x02:
1357 product_str = "LSISAS1078 C0";
1358 break;
1359 case 0x03:
1360 product_str = "LSISAS1078 C1";
1361 break;
1362 case 0x04:
1363 product_str = "LSISAS1078 C2";
1364 break;
1365 default:
1366 product_str = "LSISAS1078";
1367 break;
1368 }
1369 break;
1370 }
1371
1372 out:
1373 if (product_str)
1374 sprintf(prod_name, "%s", product_str);
1375}
1376
1134/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1377/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1135/** 1378/**
1136 * mpt_attach - Install a PCI intelligent MPT adapter. 1379 * mpt_attach - Install a PCI intelligent MPT adapter.
@@ -1274,23 +1517,23 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1274 ioc->pio_chip = (SYSIF_REGS __iomem *)pmem; 1517 ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
1275 } 1518 }
1276 1519
1277 if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC909) { 1520 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1278 ioc->prod_name = "LSIFC909"; 1521 mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name);
1279 ioc->bus_type = FC; 1522
1280 } 1523 switch (pdev->device)
1281 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929) { 1524 {
1282 ioc->prod_name = "LSIFC929"; 1525 case MPI_MANUFACTPAGE_DEVICEID_FC939X:
1283 ioc->bus_type = FC; 1526 case MPI_MANUFACTPAGE_DEVICEID_FC949X:
1284 } 1527 ioc->errata_flag_1064 = 1;
1285 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919) { 1528 case MPI_MANUFACTPAGE_DEVICEID_FC909:
1286 ioc->prod_name = "LSIFC919"; 1529 case MPI_MANUFACTPAGE_DEVICEID_FC929:
1287 ioc->bus_type = FC; 1530 case MPI_MANUFACTPAGE_DEVICEID_FC919:
1288 } 1531 case MPI_MANUFACTPAGE_DEVICEID_FC949E:
1289 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929X) {
1290 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1291 ioc->bus_type = FC; 1532 ioc->bus_type = FC;
1533 break;
1534
1535 case MPI_MANUFACTPAGE_DEVICEID_FC929X:
1292 if (revision < XL_929) { 1536 if (revision < XL_929) {
1293 ioc->prod_name = "LSIFC929X";
1294 /* 929X Chip Fix. Set Split transactions level 1537 /* 929X Chip Fix. Set Split transactions level
1295 * for PCIX. Set MOST bits to zero. 1538 * for PCIX. Set MOST bits to zero.
1296 */ 1539 */
@@ -1298,75 +1541,46 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1298 pcixcmd &= 0x8F; 1541 pcixcmd &= 0x8F;
1299 pci_write_config_byte(pdev, 0x6a, pcixcmd); 1542 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1300 } else { 1543 } else {
1301 ioc->prod_name = "LSIFC929XL";
1302 /* 929XL Chip Fix. Set MMRBC to 0x08. 1544 /* 929XL Chip Fix. Set MMRBC to 0x08.
1303 */ 1545 */
1304 pci_read_config_byte(pdev, 0x6a, &pcixcmd); 1546 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1305 pcixcmd |= 0x08; 1547 pcixcmd |= 0x08;
1306 pci_write_config_byte(pdev, 0x6a, pcixcmd); 1548 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1307 } 1549 }
1308 }
1309 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919X) {
1310 ioc->prod_name = "LSIFC919X";
1311 ioc->bus_type = FC; 1550 ioc->bus_type = FC;
1551 break;
1552
1553 case MPI_MANUFACTPAGE_DEVICEID_FC919X:
1312 /* 919X Chip Fix. Set Split transactions level 1554 /* 919X Chip Fix. Set Split transactions level
1313 * for PCIX. Set MOST bits to zero. 1555 * for PCIX. Set MOST bits to zero.
1314 */ 1556 */
1315 pci_read_config_byte(pdev, 0x6a, &pcixcmd); 1557 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1316 pcixcmd &= 0x8F; 1558 pcixcmd &= 0x8F;
1317 pci_write_config_byte(pdev, 0x6a, pcixcmd); 1559 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1318 }
1319 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC939X) {
1320 ioc->prod_name = "LSIFC939X";
1321 ioc->bus_type = FC;
1322 ioc->errata_flag_1064 = 1;
1323 }
1324 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC949X) {
1325 ioc->prod_name = "LSIFC949X";
1326 ioc->bus_type = FC; 1560 ioc->bus_type = FC;
1327 ioc->errata_flag_1064 = 1; 1561 break;
1328 } 1562
1329 else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC949E) { 1563 case MPI_MANUFACTPAGE_DEVID_53C1030:
1330 ioc->prod_name = "LSIFC949E";
1331 ioc->bus_type = FC;
1332 }
1333 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) {
1334 ioc->prod_name = "LSI53C1030";
1335 ioc->bus_type = SPI;
1336 /* 1030 Chip Fix. Disable Split transactions 1564 /* 1030 Chip Fix. Disable Split transactions
1337 * for PCIX. Set MOST bits to zero if Rev < C0( = 8). 1565 * for PCIX. Set MOST bits to zero if Rev < C0( = 8).
1338 */ 1566 */
1339 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1340 if (revision < C0_1030) { 1567 if (revision < C0_1030) {
1341 pci_read_config_byte(pdev, 0x6a, &pcixcmd); 1568 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1342 pcixcmd &= 0x8F; 1569 pcixcmd &= 0x8F;
1343 pci_write_config_byte(pdev, 0x6a, pcixcmd); 1570 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1344 } 1571 }
1345 } 1572
1346 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_1030_53C1035) { 1573 case MPI_MANUFACTPAGE_DEVID_1030_53C1035:
1347 ioc->prod_name = "LSI53C1035";
1348 ioc->bus_type = SPI; 1574 ioc->bus_type = SPI;
1349 } 1575 break;
1350 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1064) { 1576
1351 ioc->prod_name = "LSISAS1064"; 1577 case MPI_MANUFACTPAGE_DEVID_SAS1064:
1352 ioc->bus_type = SAS; 1578 case MPI_MANUFACTPAGE_DEVID_SAS1068:
1353 ioc->errata_flag_1064 = 1;
1354 }
1355 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068) {
1356 ioc->prod_name = "LSISAS1068";
1357 ioc->bus_type = SAS;
1358 ioc->errata_flag_1064 = 1; 1579 ioc->errata_flag_1064 = 1;
1359 } 1580
1360 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1064E) { 1581 case MPI_MANUFACTPAGE_DEVID_SAS1064E:
1361 ioc->prod_name = "LSISAS1064E"; 1582 case MPI_MANUFACTPAGE_DEVID_SAS1068E:
1362 ioc->bus_type = SAS; 1583 case MPI_MANUFACTPAGE_DEVID_SAS1078:
1363 }
1364 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068E) {
1365 ioc->prod_name = "LSISAS1068E";
1366 ioc->bus_type = SAS;
1367 }
1368 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
1369 ioc->prod_name = "LSISAS1078";
1370 ioc->bus_type = SAS; 1584 ioc->bus_type = SAS;
1371 } 1585 }
1372 1586
@@ -1880,6 +2094,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1880 } 2094 }
1881 2095
1882 GetIoUnitPage2(ioc); 2096 GetIoUnitPage2(ioc);
2097 mpt_get_manufacturing_pg_0(ioc);
1883 } 2098 }
1884 2099
1885 /* 2100 /*
@@ -2138,8 +2353,8 @@ MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
2138 int i = 0; 2353 int i = 0;
2139 2354
2140 printk(KERN_INFO "%s: ", ioc->name); 2355 printk(KERN_INFO "%s: ", ioc->name);
2141 if (ioc->prod_name && strlen(ioc->prod_name) > 3) 2356 if (ioc->prod_name)
2142 printk("%s: ", ioc->prod_name+3); 2357 printk("%s: ", ioc->prod_name);
2143 printk("Capabilities={"); 2358 printk("Capabilities={");
2144 2359
2145 if (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_INITIATOR) { 2360 if (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_INITIATOR) {
@@ -5190,6 +5405,49 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
5190 return; 5405 return;
5191} 5406}
5192 5407
5408static void
5409mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc)
5410{
5411 CONFIGPARMS cfg;
5412 ConfigPageHeader_t hdr;
5413 dma_addr_t buf_dma;
5414 ManufacturingPage0_t *pbuf = NULL;
5415
5416 memset(&cfg, 0 , sizeof(CONFIGPARMS));
5417 memset(&hdr, 0 , sizeof(ConfigPageHeader_t));
5418
5419 hdr.PageType = MPI_CONFIG_PAGETYPE_MANUFACTURING;
5420 cfg.cfghdr.hdr = &hdr;
5421 cfg.physAddr = -1;
5422 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
5423 cfg.timeout = 10;
5424
5425 if (mpt_config(ioc, &cfg) != 0)
5426 goto out;
5427
5428 if (!cfg.cfghdr.hdr->PageLength)
5429 goto out;
5430
5431 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
5432 pbuf = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, &buf_dma);
5433 if (!pbuf)
5434 goto out;
5435
5436 cfg.physAddr = buf_dma;
5437
5438 if (mpt_config(ioc, &cfg) != 0)
5439 goto out;
5440
5441 memcpy(ioc->board_name, pbuf->BoardName, sizeof(ioc->board_name));
5442 memcpy(ioc->board_assembly, pbuf->BoardAssembly, sizeof(ioc->board_assembly));
5443 memcpy(ioc->board_tracer, pbuf->BoardTracerNumber, sizeof(ioc->board_tracer));
5444
5445 out:
5446
5447 if (pbuf)
5448 pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);
5449}
5450
5193/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5451/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5194/** 5452/**
5195 * SendEventNotification - Send EventNotification (on or off) request to adapter 5453 * SendEventNotification - Send EventNotification (on or off) request to adapter
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 05eb6e528753..98eb9c688e17 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -537,7 +537,14 @@ typedef struct _MPT_ADAPTER
537 int id; /* Unique adapter id N {0,1,2,...} */ 537 int id; /* Unique adapter id N {0,1,2,...} */
538 int pci_irq; /* This irq */ 538 int pci_irq; /* This irq */
539 char name[MPT_NAME_LENGTH]; /* "iocN" */ 539 char name[MPT_NAME_LENGTH]; /* "iocN" */
540 char *prod_name; /* "LSIFC9x9" */ 540 char prod_name[MPT_NAME_LENGTH]; /* "LSIFC9x9" */
541 char board_name[16];
542 char board_assembly[16];
543 char board_tracer[16];
544 u16 nvdata_version_persistent;
545 u16 nvdata_version_default;
546 u8 io_missing_delay;
547 u8 device_missing_delay;
541 SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ 548 SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */
542 SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */ 549 SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */
543 u8 bus_type; 550 u8 bus_type;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index b766445f19aa..f2ebaa9992fe 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -130,6 +130,7 @@ static struct scsi_host_template mptfc_driver_template = {
130 .max_sectors = 8192, 130 .max_sectors = 8192,
131 .cmd_per_lun = 7, 131 .cmd_per_lun = 7,
132 .use_clustering = ENABLE_CLUSTERING, 132 .use_clustering = ENABLE_CLUSTERING,
133 .shost_attrs = mptscsih_host_attrs,
133}; 134};
134 135
135/**************************************************************************** 136/****************************************************************************
@@ -153,6 +154,8 @@ static struct pci_device_id mptfc_pci_table[] = {
153 PCI_ANY_ID, PCI_ANY_ID }, 154 PCI_ANY_ID, PCI_ANY_ID },
154 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC949E, 155 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC949E,
155 PCI_ANY_ID, PCI_ANY_ID }, 156 PCI_ANY_ID, PCI_ANY_ID },
157 { PCI_VENDOR_ID_BROCADE, MPI_MANUFACTPAGE_DEVICEID_FC949E,
158 PCI_ANY_ID, PCI_ANY_ID },
156 {0} /* Terminating entry */ 159 {0} /* Terminating entry */
157}; 160};
158MODULE_DEVICE_TABLE(pci, mptfc_pci_table); 161MODULE_DEVICE_TABLE(pci, mptfc_pci_table);
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 9e5424e1871f..d50664640512 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1119,6 +1119,7 @@ static struct scsi_host_template mptsas_driver_template = {
1119 .max_sectors = 8192, 1119 .max_sectors = 8192,
1120 .cmd_per_lun = 7, 1120 .cmd_per_lun = 7,
1121 .use_clustering = ENABLE_CLUSTERING, 1121 .use_clustering = ENABLE_CLUSTERING,
1122 .shost_attrs = mptscsih_host_attrs,
1122}; 1123};
1123 1124
1124static int mptsas_get_linkerrors(struct sas_phy *phy) 1125static int mptsas_get_linkerrors(struct sas_phy *phy)
@@ -1390,6 +1391,11 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
1390 goto out_free_consistent; 1391 goto out_free_consistent;
1391 } 1392 }
1392 1393
1394 ioc->nvdata_version_persistent =
1395 le16_to_cpu(buffer->NvdataVersionPersistent);
1396 ioc->nvdata_version_default =
1397 le16_to_cpu(buffer->NvdataVersionDefault);
1398
1393 for (i = 0; i < port_info->num_phys; i++) { 1399 for (i = 0; i < port_info->num_phys; i++) {
1394 mptsas_print_phy_data(&buffer->PhyData[i]); 1400 mptsas_print_phy_data(&buffer->PhyData[i]);
1395 port_info->phy_info[i].phy_id = i; 1401 port_info->phy_info[i].phy_id = i;
@@ -1410,6 +1416,63 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
1410} 1416}
1411 1417
1412static int 1418static int
1419mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc)
1420{
1421 ConfigExtendedPageHeader_t hdr;
1422 CONFIGPARMS cfg;
1423 SasIOUnitPage1_t *buffer;
1424 dma_addr_t dma_handle;
1425 int error;
1426 u16 device_missing_delay;
1427
1428 memset(&hdr, 0, sizeof(ConfigExtendedPageHeader_t));
1429 memset(&cfg, 0, sizeof(CONFIGPARMS));
1430
1431 cfg.cfghdr.ehdr = &hdr;
1432 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
1433 cfg.timeout = 10;
1434 cfg.cfghdr.ehdr->PageType = MPI_CONFIG_PAGETYPE_EXTENDED;
1435 cfg.cfghdr.ehdr->ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_IO_UNIT;
1436 cfg.cfghdr.ehdr->PageVersion = MPI_SASIOUNITPAGE1_PAGEVERSION;
1437 cfg.cfghdr.ehdr->PageNumber = 1;
1438
1439 error = mpt_config(ioc, &cfg);
1440 if (error)
1441 goto out;
1442 if (!hdr.ExtPageLength) {
1443 error = -ENXIO;
1444 goto out;
1445 }
1446
1447 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1448 &dma_handle);
1449 if (!buffer) {
1450 error = -ENOMEM;
1451 goto out;
1452 }
1453
1454 cfg.physAddr = dma_handle;
1455 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
1456
1457 error = mpt_config(ioc, &cfg);
1458 if (error)
1459 goto out_free_consistent;
1460
1461 ioc->io_missing_delay =
1462 le16_to_cpu(buffer->IODeviceMissingDelay);
1463 device_missing_delay = le16_to_cpu(buffer->ReportDeviceMissingDelay);
1464 ioc->device_missing_delay = (device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_UNIT_16) ?
1465 (device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK) * 16 :
1466 device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
1467
1468 out_free_consistent:
1469 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1470 buffer, dma_handle);
1471 out:
1472 return error;
1473}
1474
1475static int
1413mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, 1476mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
1414 u32 form, u32 form_specific) 1477 u32 form, u32 form_specific)
1415{ 1478{
@@ -1990,6 +2053,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1990 if (error) 2053 if (error)
1991 goto out_free_port_info; 2054 goto out_free_port_info;
1992 2055
2056 mptsas_sas_io_unit_pg1(ioc);
1993 mutex_lock(&ioc->sas_topology_mutex); 2057 mutex_lock(&ioc->sas_topology_mutex);
1994 ioc->handle = hba->phy_info[0].handle; 2058 ioc->handle = hba->phy_info[0].handle;
1995 port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle); 2059 port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
@@ -3237,6 +3301,8 @@ static struct pci_driver mptsas_driver = {
3237static int __init 3301static int __init
3238mptsas_init(void) 3302mptsas_init(void)
3239{ 3303{
3304 int error;
3305
3240 show_mptmod_ver(my_NAME, my_VERSION); 3306 show_mptmod_ver(my_NAME, my_VERSION);
3241 3307
3242 mptsas_transport_template = 3308 mptsas_transport_template =
@@ -3260,7 +3326,11 @@ mptsas_init(void)
3260 ": Registered for IOC reset notifications\n")); 3326 ": Registered for IOC reset notifications\n"));
3261 } 3327 }
3262 3328
3263 return pci_register_driver(&mptsas_driver); 3329 error = pci_register_driver(&mptsas_driver);
3330 if (error)
3331 sas_release_transport(mptsas_transport_template);
3332
3333 return error;
3264} 3334}
3265 3335
3266static void __exit 3336static void __exit
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index d35617376f87..fd3aa2619f42 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -3187,6 +3187,159 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
3187 mptscsih_do_cmd(hd, &iocmd); 3187 mptscsih_do_cmd(hd, &iocmd);
3188} 3188}
3189 3189
3190static ssize_t
3191mptscsih_version_fw_show(struct class_device *cdev, char *buf)
3192{
3193 struct Scsi_Host *host = class_to_shost(cdev);
3194 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3195 MPT_ADAPTER *ioc = hd->ioc;
3196
3197 return snprintf(buf, PAGE_SIZE, "%02d.%02d.%02d.%02d\n",
3198 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
3199 (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,
3200 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
3201 ioc->facts.FWVersion.Word & 0x000000FF);
3202}
3203static CLASS_DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL);
3204
3205static ssize_t
3206mptscsih_version_bios_show(struct class_device *cdev, char *buf)
3207{
3208 struct Scsi_Host *host = class_to_shost(cdev);
3209 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3210 MPT_ADAPTER *ioc = hd->ioc;
3211
3212 return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n",
3213 (ioc->biosVersion & 0xFF000000) >> 24,
3214 (ioc->biosVersion & 0x00FF0000) >> 16,
3215 (ioc->biosVersion & 0x0000FF00) >> 8,
3216 ioc->biosVersion & 0x000000FF);
3217}
3218static CLASS_DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL);
3219
3220static ssize_t
3221mptscsih_version_mpi_show(struct class_device *cdev, char *buf)
3222{
3223 struct Scsi_Host *host = class_to_shost(cdev);
3224 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3225 MPT_ADAPTER *ioc = hd->ioc;
3226
3227 return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion);
3228}
3229static CLASS_DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL);
3230
3231static ssize_t
3232mptscsih_version_product_show(struct class_device *cdev, char *buf)
3233{
3234 struct Scsi_Host *host = class_to_shost(cdev);
3235 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3236 MPT_ADAPTER *ioc = hd->ioc;
3237
3238 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name);
3239}
3240static CLASS_DEVICE_ATTR(version_product, S_IRUGO,
3241 mptscsih_version_product_show, NULL);
3242
3243static ssize_t
3244mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf)
3245{
3246 struct Scsi_Host *host = class_to_shost(cdev);
3247 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3248 MPT_ADAPTER *ioc = hd->ioc;
3249
3250 return snprintf(buf, PAGE_SIZE, "%02xh\n",
3251 ioc->nvdata_version_persistent);
3252}
3253static CLASS_DEVICE_ATTR(version_nvdata_persistent, S_IRUGO,
3254 mptscsih_version_nvdata_persistent_show, NULL);
3255
3256static ssize_t
3257mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf)
3258{
3259 struct Scsi_Host *host = class_to_shost(cdev);
3260 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3261 MPT_ADAPTER *ioc = hd->ioc;
3262
3263 return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default);
3264}
3265static CLASS_DEVICE_ATTR(version_nvdata_default, S_IRUGO,
3266 mptscsih_version_nvdata_default_show, NULL);
3267
3268static ssize_t
3269mptscsih_board_name_show(struct class_device *cdev, char *buf)
3270{
3271 struct Scsi_Host *host = class_to_shost(cdev);
3272 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3273 MPT_ADAPTER *ioc = hd->ioc;
3274
3275 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name);
3276}
3277static CLASS_DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL);
3278
3279static ssize_t
3280mptscsih_board_assembly_show(struct class_device *cdev, char *buf)
3281{
3282 struct Scsi_Host *host = class_to_shost(cdev);
3283 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3284 MPT_ADAPTER *ioc = hd->ioc;
3285
3286 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly);
3287}
3288static CLASS_DEVICE_ATTR(board_assembly, S_IRUGO,
3289 mptscsih_board_assembly_show, NULL);
3290
3291static ssize_t
3292mptscsih_board_tracer_show(struct class_device *cdev, char *buf)
3293{
3294 struct Scsi_Host *host = class_to_shost(cdev);
3295 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3296 MPT_ADAPTER *ioc = hd->ioc;
3297
3298 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer);
3299}
3300static CLASS_DEVICE_ATTR(board_tracer, S_IRUGO,
3301 mptscsih_board_tracer_show, NULL);
3302
3303static ssize_t
3304mptscsih_io_delay_show(struct class_device *cdev, char *buf)
3305{
3306 struct Scsi_Host *host = class_to_shost(cdev);
3307 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3308 MPT_ADAPTER *ioc = hd->ioc;
3309
3310 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay);
3311}
3312static CLASS_DEVICE_ATTR(io_delay, S_IRUGO,
3313 mptscsih_io_delay_show, NULL);
3314
3315static ssize_t
3316mptscsih_device_delay_show(struct class_device *cdev, char *buf)
3317{
3318 struct Scsi_Host *host = class_to_shost(cdev);
3319 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3320 MPT_ADAPTER *ioc = hd->ioc;
3321
3322 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay);
3323}
3324static CLASS_DEVICE_ATTR(device_delay, S_IRUGO,
3325 mptscsih_device_delay_show, NULL);
3326
3327struct class_device_attribute *mptscsih_host_attrs[] = {
3328 &class_device_attr_version_fw,
3329 &class_device_attr_version_bios,
3330 &class_device_attr_version_mpi,
3331 &class_device_attr_version_product,
3332 &class_device_attr_version_nvdata_persistent,
3333 &class_device_attr_version_nvdata_default,
3334 &class_device_attr_board_name,
3335 &class_device_attr_board_assembly,
3336 &class_device_attr_board_tracer,
3337 &class_device_attr_io_delay,
3338 &class_device_attr_device_delay,
3339 NULL,
3340};
3341EXPORT_SYMBOL(mptscsih_host_attrs);
3342
3190EXPORT_SYMBOL(mptscsih_remove); 3343EXPORT_SYMBOL(mptscsih_remove);
3191EXPORT_SYMBOL(mptscsih_shutdown); 3344EXPORT_SYMBOL(mptscsih_shutdown);
3192#ifdef CONFIG_PM 3345#ifdef CONFIG_PM
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 8eccdfe5701a..67b088db2f10 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -129,3 +129,4 @@ extern void mptscsih_timer_expired(unsigned long data);
129extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout); 129extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout);
130extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); 130extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
131extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); 131extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
132extern struct class_device_attribute *mptscsih_host_attrs[];
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 6b3e0c00952b..947fe2901800 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -821,6 +821,7 @@ static struct scsi_host_template mptspi_driver_template = {
821 .max_sectors = 8192, 821 .max_sectors = 8192,
822 .cmd_per_lun = 7, 822 .cmd_per_lun = 7,
823 .use_clustering = ENABLE_CLUSTERING, 823 .use_clustering = ENABLE_CLUSTERING,
824 .shost_attrs = mptscsih_host_attrs,
824}; 825};
825 826
826static int mptspi_write_spi_device_pg1(struct scsi_target *starget, 827static int mptspi_write_spi_device_pg1(struct scsi_target *starget,
@@ -1523,6 +1524,8 @@ static struct pci_driver mptspi_driver = {
1523static int __init 1524static int __init
1524mptspi_init(void) 1525mptspi_init(void)
1525{ 1526{
1527 int error;
1528
1526 show_mptmod_ver(my_NAME, my_VERSION); 1529 show_mptmod_ver(my_NAME, my_VERSION);
1527 1530
1528 mptspi_transport_template = spi_attach_transport(&mptspi_transport_functions); 1531 mptspi_transport_template = spi_attach_transport(&mptspi_transport_functions);
@@ -1543,7 +1546,11 @@ mptspi_init(void)
1543 ": Registered for IOC reset notifications\n")); 1546 ": Registered for IOC reset notifications\n"));
1544 } 1547 }
1545 1548
1546 return pci_register_driver(&mptspi_driver); 1549 error = pci_register_driver(&mptspi_driver);
1550 if (error)
1551 spi_release_transport(mptspi_transport_template);
1552
1553 return error;
1547} 1554}
1548 1555
1549/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1556/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/