aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptbase.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r--drivers/message/fusion/mptbase.c382
1 files changed, 320 insertions, 62 deletions
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