aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorMoore, Eric Dean <Eric.Moore@lsil.com>2005-04-22 18:01:16 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-05-20 13:53:17 -0400
commit7fadc87e5c3dd96a36cd9b9500d2ccff39048dd4 (patch)
tree2bf83afab0cf54a5262c9e621bb2d505d4692614 /drivers/message/fusion
parent5f5affddad836978f057d316ba8083a5d553773c (diff)
[SCSI] mptfusion: mptbase cleanup, split driver support, DMA 32_BIT_MASK
(1) mptbase.c: Move registering pci ids to scsi lld drivers (2) mptbase.c: Use the DMA_32BIT_MASK constant (3) mptbase.c: Fix for multiple pci domains (4) mptbase.c: Remove le32 conversion from BlockSize, which was u8 size (5) mptbase.c: Remove credits, -sralston references , update copyright (6) mptbase.c: split driver support Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptbase.c260
-rw-r--r--drivers/message/fusion/mptbase.h45
2 files changed, 90 insertions, 215 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 8b22630f1aef..42ed5e272dca 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1,55 +1,13 @@
1/* 1/*
2 * linux/drivers/message/fusion/mptbase.c 2 * linux/drivers/message/fusion/mptbase.c
3 * High performance SCSI + LAN / Fibre Channel device drivers.
4 * This is the Fusion MPT base driver which supports multiple 3 * This is the Fusion MPT base driver which supports multiple
5 * (SCSI + LAN) specialized protocol drivers. 4 * (SCSI + LAN) specialized protocol drivers.
6 * For use with PCI chip/adapter(s): 5 * For use with LSI Logic PCI chip/adapter(s)
7 * LSIFC9xx/LSI409xx Fibre Channel
8 * running LSI Logic Fusion MPT (Message Passing Technology) firmware. 6 * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
9 * 7 *
10 * Credits: 8 * Copyright (c) 1999-2005 LSI Logic Corporation
11 * There are lots of people not mentioned below that deserve credit
12 * and thanks but won't get it here - sorry in advance that you
13 * got overlooked.
14 *
15 * This driver would not exist if not for Alan Cox's development
16 * of the linux i2o driver.
17 *
18 * A special thanks to Noah Romer (LSI Logic) for tons of work
19 * and tough debugging on the LAN driver, especially early on;-)
20 * And to Roger Hickerson (LSI Logic) for tirelessly supporting
21 * this driver project.
22 *
23 * A special thanks to Pamela Delaney (LSI Logic) for tons of work
24 * and countless enhancements while adding support for the 1030
25 * chip family. Pam has been instrumental in the development of
26 * of the 2.xx.xx series fusion drivers, and her contributions are
27 * far too numerous to hope to list in one place.
28 *
29 * All manner of help from Stephen Shirron (LSI Logic):
30 * low-level FC analysis, debug + various fixes in FCxx firmware,
31 * initial port to alpha platform, various driver code optimizations,
32 * being a faithful sounding board on all sorts of issues & ideas,
33 * etc.
34 *
35 * A huge debt of gratitude is owed to David S. Miller (DaveM)
36 * for fixing much of the stupid and broken stuff in the early
37 * driver while porting to sparc64 platform. THANK YOU!
38 *
39 * Special thanks goes to the I2O LAN driver people at the
40 * University of Helsinki, who, unbeknownst to them, provided
41 * the inspiration and initial structure for this driver.
42 *
43 * A really huge debt of gratitude is owed to Eddie C. Dost
44 * for gobs of hard work fixing and optimizing LAN code.
45 * THANK YOU!
46 *
47 * Copyright (c) 1999-2004 LSI Logic Corporation
48 * Originally By: Steven J. Ralston
49 * (mailto:sjralston1@netscape.net)
50 * (mailto:mpt_linux_developer@lsil.com) 9 * (mailto:mpt_linux_developer@lsil.com)
51 * 10 *
52 * $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $
53 */ 11 */
54/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 12/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
55/* 13/*
@@ -101,6 +59,7 @@
101#include <linux/blkdev.h> 59#include <linux/blkdev.h>
102#include <linux/delay.h> 60#include <linux/delay.h>
103#include <linux/interrupt.h> /* needed for in_interrupt() proto */ 61#include <linux/interrupt.h> /* needed for in_interrupt() proto */
62#include <linux/dma-mapping.h>
104#include <asm/io.h> 63#include <asm/io.h>
105#ifdef CONFIG_MTRR 64#ifdef CONFIG_MTRR
106#include <asm/mtrr.h> 65#include <asm/mtrr.h>
@@ -218,35 +177,9 @@ static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
218static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info); 177static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info);
219 178
220/* module entry point */ 179/* module entry point */
221static int __devinit mptbase_probe (struct pci_dev *, const struct pci_device_id *);
222static void __devexit mptbase_remove(struct pci_dev *);
223static void mptbase_shutdown(struct device * );
224static int __init fusion_init (void); 180static int __init fusion_init (void);
225static void __exit fusion_exit (void); 181static void __exit fusion_exit (void);
226 182
227/****************************************************************************
228 * Supported hardware
229 */
230
231static struct pci_device_id mptbase_pci_table[] = {
232 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC909,
233 PCI_ANY_ID, PCI_ANY_ID },
234 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929,
235 PCI_ANY_ID, PCI_ANY_ID },
236 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919,
237 PCI_ANY_ID, PCI_ANY_ID },
238 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929X,
239 PCI_ANY_ID, PCI_ANY_ID },
240 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919X,
241 PCI_ANY_ID, PCI_ANY_ID },
242 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030,
243 PCI_ANY_ID, PCI_ANY_ID },
244 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_1030_53C1035,
245 PCI_ANY_ID, PCI_ANY_ID },
246 {0} /* Terminating entry */
247};
248MODULE_DEVICE_TABLE(pci, mptbase_pci_table);
249
250#define CHIPREG_READ32(addr) readl_relaxed(addr) 183#define CHIPREG_READ32(addr) readl_relaxed(addr)
251#define CHIPREG_READ32_dmasync(addr) readl(addr) 184#define CHIPREG_READ32_dmasync(addr) readl(addr)
252#define CHIPREG_WRITE32(addr,val) writel(val, addr) 185#define CHIPREG_WRITE32(addr,val) writel(val, addr)
@@ -330,8 +263,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
330 ioc->name, mr, req_idx)); 263 ioc->name, mr, req_idx));
331 DBG_DUMP_REPLY_FRAME(mr) 264 DBG_DUMP_REPLY_FRAME(mr)
332 265
333 /* NEW! 20010301 -sralston 266 /* Check/log IOC log info
334 * Check/log IOC log info
335 */ 267 */
336 ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); 268 ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus);
337 if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { 269 if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) {
@@ -357,9 +289,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
357 mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa); 289 mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa);
358 } else if (type == MPI_CONTEXT_REPLY_TYPE_LAN) { 290 } else if (type == MPI_CONTEXT_REPLY_TYPE_LAN) {
359 cb_idx = mpt_lan_index; 291 cb_idx = mpt_lan_index;
360 /* 292 /* Blind set of mf to NULL here was fatal
361 * BUG FIX! 20001218 -sralston
362 * Blind set of mf to NULL here was fatal
363 * after lan_reply says "freeme" 293 * after lan_reply says "freeme"
364 * Fix sort of combined with an optimization here; 294 * Fix sort of combined with an optimization here;
365 * added explicit check for case where lan_reply 295 * added explicit check for case where lan_reply
@@ -725,11 +655,9 @@ int
725mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) 655mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
726{ 656{
727 MPT_ADAPTER *ioc; 657 MPT_ADAPTER *ioc;
728 int error=0;
729 658
730 if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) { 659 if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) {
731 error= -EINVAL; 660 return -EINVAL;
732 return error;
733 } 661 }
734 662
735 MptDeviceDriverHandlers[cb_idx] = dd_cbfunc; 663 MptDeviceDriverHandlers[cb_idx] = dd_cbfunc;
@@ -737,14 +665,12 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
737 /* call per pci device probe entry point */ 665 /* call per pci device probe entry point */
738 list_for_each_entry(ioc, &ioc_list, list) { 666 list_for_each_entry(ioc, &ioc_list, list) {
739 if(dd_cbfunc->probe) { 667 if(dd_cbfunc->probe) {
740 error = dd_cbfunc->probe(ioc->pcidev, 668 dd_cbfunc->probe(ioc->pcidev,
741 ioc->pcidev->driver->id_table); 669 ioc->pcidev->driver->id_table);
742 if(error != 0)
743 return error;
744 } 670 }
745 } 671 }
746 672
747 return error; 673 return 0;
748} 674}
749 675
750/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 676/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1058,7 +984,7 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
1058 984
1059/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 985/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1060/* 986/*
1061 * mptbase_probe - Install a PCI intelligent MPT adapter. 987 * mpt_attach - Install a PCI intelligent MPT adapter.
1062 * @pdev: Pointer to pci_dev structure 988 * @pdev: Pointer to pci_dev structure
1063 * 989 *
1064 * This routine performs all the steps necessary to bring the IOC of 990 * This routine performs all the steps necessary to bring the IOC of
@@ -1073,8 +999,8 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
1073 * 999 *
1074 * TODO: Add support for polled controllers 1000 * TODO: Add support for polled controllers
1075 */ 1001 */
1076static int __devinit 1002int
1077mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) 1003mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1078{ 1004{
1079 MPT_ADAPTER *ioc; 1005 MPT_ADAPTER *ioc;
1080 u8 __iomem *mem; 1006 u8 __iomem *mem;
@@ -1084,7 +1010,6 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1084 u32 psize; 1010 u32 psize;
1085 int ii; 1011 int ii;
1086 int r = -ENODEV; 1012 int r = -ENODEV;
1087 u64 mask = 0xffffffffffffffffULL;
1088 u8 revision; 1013 u8 revision;
1089 u8 pcixcmd; 1014 u8 pcixcmd;
1090 static int mpt_ids = 0; 1015 static int mpt_ids = 0;
@@ -1097,15 +1022,15 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1097 1022
1098 dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); 1023 dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n"));
1099 1024
1100 if (!pci_set_dma_mask(pdev, mask)) { 1025 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
1101 dprintk((KERN_INFO MYNAM 1026 dprintk((KERN_INFO MYNAM
1102 ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); 1027 ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n"));
1103 } else if (pci_set_dma_mask(pdev, (u64) 0xffffffff)) { 1028 } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
1104 printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n"); 1029 printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n");
1105 return r; 1030 return r;
1106 } 1031 }
1107 1032
1108 if (!pci_set_consistent_dma_mask(pdev, mask)) 1033 if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))
1109 dprintk((KERN_INFO MYNAM 1034 dprintk((KERN_INFO MYNAM
1110 ": Using 64 bit consistent mask\n")); 1035 ": Using 64 bit consistent mask\n"));
1111 else 1036 else
@@ -1303,8 +1228,7 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1303#endif 1228#endif
1304 } 1229 }
1305 1230
1306 /* NEW! 20010220 -sralston 1231 /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
1307 * Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
1308 */ 1232 */
1309 mpt_detect_bound_ports(ioc, pdev); 1233 mpt_detect_bound_ports(ioc, pdev);
1310 1234
@@ -1354,13 +1278,13 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1354 1278
1355/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1279/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1356/* 1280/*
1357 * mptbase_remove - Remove a PCI intelligent MPT adapter. 1281 * mpt_detach - Remove a PCI intelligent MPT adapter.
1358 * @pdev: Pointer to pci_dev structure 1282 * @pdev: Pointer to pci_dev structure
1359 * 1283 *
1360 */ 1284 */
1361 1285
1362static void __devexit 1286void
1363mptbase_remove(struct pci_dev *pdev) 1287mpt_detach(struct pci_dev *pdev)
1364{ 1288{
1365 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1289 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1366 char pname[32]; 1290 char pname[32];
@@ -1397,43 +1321,21 @@ mptbase_remove(struct pci_dev *pdev)
1397 pci_set_drvdata(pdev, NULL); 1321 pci_set_drvdata(pdev, NULL);
1398} 1322}
1399 1323
1400/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1401/*
1402 * mptbase_shutdown -
1403 *
1404 */
1405static void
1406mptbase_shutdown(struct device * dev)
1407{
1408 int ii;
1409
1410 /* call per device driver shutdown entry point */
1411 for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
1412 if(MptDeviceDriverHandlers[ii] &&
1413 MptDeviceDriverHandlers[ii]->shutdown) {
1414 MptDeviceDriverHandlers[ii]->shutdown(dev);
1415 }
1416 }
1417
1418}
1419
1420
1421/************************************************************************** 1324/**************************************************************************
1422 * Power Management 1325 * Power Management
1423 */ 1326 */
1424#ifdef CONFIG_PM 1327#ifdef CONFIG_PM
1425/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1328/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1426/* 1329/*
1427 * mptbase_suspend - Fusion MPT base driver suspend routine. 1330 * mpt_suspend - Fusion MPT base driver suspend routine.
1428 * 1331 *
1429 * 1332 *
1430 */ 1333 */
1431static int 1334int
1432mptbase_suspend(struct pci_dev *pdev, pm_message_t state) 1335mpt_suspend(struct pci_dev *pdev, pm_message_t state)
1433{ 1336{
1434 u32 device_state; 1337 u32 device_state;
1435 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1338 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1436 int ii;
1437 1339
1438 switch(state) 1340 switch(state)
1439 { 1341 {
@@ -1453,14 +1355,6 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state)
1453 "pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n", 1355 "pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n",
1454 ioc->name, pdev, pci_name(pdev), device_state); 1356 ioc->name, pdev, pci_name(pdev), device_state);
1455 1357
1456 /* call per device driver suspend entry point */
1457 for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
1458 if(MptDeviceDriverHandlers[ii] &&
1459 MptDeviceDriverHandlers[ii]->suspend) {
1460 MptDeviceDriverHandlers[ii]->suspend(pdev, state);
1461 }
1462 }
1463
1464 pci_save_state(pdev); 1358 pci_save_state(pdev);
1465 1359
1466 /* put ioc into READY_STATE */ 1360 /* put ioc into READY_STATE */
@@ -1484,18 +1378,18 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state)
1484 1378
1485/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1379/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1486/* 1380/*
1487 * mptbase_resume - Fusion MPT base driver resume routine. 1381 * mpt_resume - Fusion MPT base driver resume routine.
1488 * 1382 *
1489 * 1383 *
1490 */ 1384 */
1491static int 1385int
1492mptbase_resume(struct pci_dev *pdev) 1386mpt_resume(struct pci_dev *pdev)
1493{ 1387{
1494 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1388 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1495 u32 device_state = pdev->current_state; 1389 u32 device_state = pdev->current_state;
1496 int recovery_state; 1390 int recovery_state;
1497 int ii; 1391 int ii;
1498 1392
1499 printk(MYIOC_s_INFO_FMT 1393 printk(MYIOC_s_INFO_FMT
1500 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", 1394 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n",
1501 ioc->name, pdev, pci_name(pdev), device_state); 1395 ioc->name, pdev, pci_name(pdev), device_state);
@@ -1533,14 +1427,6 @@ mptbase_resume(struct pci_dev *pdev)
1533 "pci-resume: success\n", ioc->name); 1427 "pci-resume: success\n", ioc->name);
1534 } 1428 }
1535 1429
1536 /* call per device driver resume entry point */
1537 for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
1538 if(MptDeviceDriverHandlers[ii] &&
1539 MptDeviceDriverHandlers[ii]->resume) {
1540 MptDeviceDriverHandlers[ii]->resume(pdev);
1541 }
1542 }
1543
1544 return 0; 1430 return 0;
1545} 1431}
1546#endif 1432#endif
@@ -1719,8 +1605,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1719 ioc->alt_ioc->active = 1; 1605 ioc->alt_ioc->active = 1;
1720 } 1606 }
1721 1607
1722 /* NEW! 20010120 -sralston 1608 /* Enable MPT base driver management of EventNotification
1723 * Enable MPT base driver management of EventNotification
1724 * and EventAck handling. 1609 * and EventAck handling.
1725 */ 1610 */
1726 if ((ret == 0) && (!ioc->facts.EventState)) 1611 if ((ret == 0) && (!ioc->facts.EventState))
@@ -1729,9 +1614,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1729 if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState) 1614 if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState)
1730 (void) SendEventNotification(ioc->alt_ioc, 1); /* 1=Enable EventNotification */ 1615 (void) SendEventNotification(ioc->alt_ioc, 1); /* 1=Enable EventNotification */
1731 1616
1732 /* (Bugzilla:fibrebugs, #513) 1617 /* Add additional "reason" check before call to GetLanConfigPages
1733 * Bug fix (part 2)! 20010905 -sralston
1734 * Add additional "reason" check before call to GetLanConfigPages
1735 * (combined with GetIoUnitPage2 call). This prevents a somewhat 1618 * (combined with GetIoUnitPage2 call). This prevents a somewhat
1736 * recursive scenario; GetLanConfigPages times out, timer expired 1619 * recursive scenario; GetLanConfigPages times out, timer expired
1737 * routine calls HardResetHandler, which calls into here again, 1620 * routine calls HardResetHandler, which calls into here again,
@@ -1829,37 +1712,43 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1829static void 1712static void
1830mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) 1713mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
1831{ 1714{
1832 unsigned int match_lo, match_hi; 1715 struct pci_dev *peer=NULL;
1716 unsigned int slot = PCI_SLOT(pdev->devfn);
1717 unsigned int func = PCI_FUNC(pdev->devfn);
1833 MPT_ADAPTER *ioc_srch; 1718 MPT_ADAPTER *ioc_srch;
1834 1719
1835 match_lo = pdev->devfn-1; 1720 dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x,"
1836 match_hi = pdev->devfn+1; 1721 " searching for devfn match on %x or %x\n",
1837 dprintk((MYIOC_s_INFO_FMT "PCI bus/devfn=%x/%x, searching for devfn match on %x or %x\n", 1722 ioc->name, pci_name(pdev), pdev->devfn,
1838 ioc->name, pdev->bus->number, pdev->devfn, match_lo, match_hi)); 1723 func-1, func+1));
1724
1725 peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func-1));
1726 if (!peer) {
1727 peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func+1));
1728 if (!peer)
1729 return;
1730 }
1839 1731
1840 list_for_each_entry(ioc_srch, &ioc_list, list) { 1732 list_for_each_entry(ioc_srch, &ioc_list, list) {
1841 struct pci_dev *_pcidev = ioc_srch->pcidev; 1733 struct pci_dev *_pcidev = ioc_srch->pcidev;
1842 1734 if (_pcidev == peer) {
1843 if ((_pcidev->device == pdev->device) &&
1844 (_pcidev->bus->number == pdev->bus->number) &&
1845 (_pcidev->devfn == match_lo || _pcidev->devfn == match_hi) ) {
1846 /* Paranoia checks */ 1735 /* Paranoia checks */
1847 if (ioc->alt_ioc != NULL) { 1736 if (ioc->alt_ioc != NULL) {
1848 printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", 1737 printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n",
1849 ioc->name, ioc->alt_ioc->name); 1738 ioc->name, ioc->alt_ioc->name);
1850 break; 1739 break;
1851 } else if (ioc_srch->alt_ioc != NULL) { 1740 } else if (ioc_srch->alt_ioc != NULL) {
1852 printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", 1741 printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n",
1853 ioc_srch->name, ioc_srch->alt_ioc->name); 1742 ioc_srch->name, ioc_srch->alt_ioc->name);
1854 break; 1743 break;
1855 } 1744 }
1856 dprintk((KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n", 1745 dprintk((KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n",
1857 ioc->name, ioc_srch->name)); 1746 ioc->name, ioc_srch->name));
1858 ioc_srch->alt_ioc = ioc; 1747 ioc_srch->alt_ioc = ioc;
1859 ioc->alt_ioc = ioc_srch; 1748 ioc->alt_ioc = ioc_srch;
1860 break;
1861 } 1749 }
1862 } 1750 }
1751 pci_dev_put(peer);
1863} 1752}
1864 1753
1865/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1754/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -2333,7 +2222,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
2333 return -55; 2222 return -55;
2334 } 2223 }
2335 2224
2336 r = sz = le32_to_cpu(facts->BlockSize); 2225 r = sz = facts->BlockSize;
2337 vv = ((63 / (sz * 4)) + 1) & 0x03; 2226 vv = ((63 / (sz * 4)) + 1) & 0x03;
2338 ioc->NB_for_64_byte_frame = vv; 2227 ioc->NB_for_64_byte_frame = vv;
2339 while ( sz ) 2228 while ( sz )
@@ -4250,7 +4139,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4250 if ((ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD) || 4139 if ((ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD) ||
4251 (ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE)) { 4140 (ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE)) {
4252 4141
4253 if (ioc->spi_data.minSyncFactor < MPT_ULTRA) 4142 if (ioc->spi_data.minSyncFactor < MPT_ULTRA)
4254 ioc->spi_data.minSyncFactor = MPT_ULTRA; 4143 ioc->spi_data.minSyncFactor = MPT_ULTRA;
4255 } 4144 }
4256 } 4145 }
@@ -4753,9 +4642,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
4753 u32 flagsLength; 4642 u32 flagsLength;
4754 int in_isr; 4643 int in_isr;
4755 4644
4756 /* (Bugzilla:fibrebugs, #513) 4645 /* Prevent calling wait_event() (below), if caller happens
4757 * Bug fix (part 1)! 20010905 -sralston
4758 * Prevent calling wait_event() (below), if caller happens
4759 * to be in ISR context, because that is fatal! 4646 * to be in ISR context, because that is fatal!
4760 */ 4647 */
4761 in_isr = in_interrupt(); 4648 in_isr = in_interrupt();
@@ -4861,9 +4748,7 @@ mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
4861 u32 flagsLength; 4748 u32 flagsLength;
4862 int in_isr; 4749 int in_isr;
4863 4750
4864 /* (Bugzilla:fibrebugs, #513) 4751 /* Prevent calling wait_event() (below), if caller happens
4865 * Bug fix (part 1)! 20010905 -sralston
4866 * Prevent calling wait_event() (below), if caller happens
4867 * to be in ISR context, because that is fatal! 4752 * to be in ISR context, because that is fatal!
4868 */ 4753 */
4869 in_isr = in_interrupt(); 4754 in_isr = in_interrupt();
@@ -5130,20 +5015,26 @@ static int
5130procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) 5015procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
5131{ 5016{
5132 int ii; 5017 int ii;
5133 int scsi, lan, ctl, targ, dmp; 5018 int scsi, fc, sas, lan, ctl, targ, dmp;
5134 char *drvname; 5019 char *drvname;
5135 int len; 5020 int len;
5136 5021
5137 len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); 5022 len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON);
5138 len += sprintf(buf+len, " Fusion MPT base driver\n"); 5023 len += sprintf(buf+len, " Fusion MPT base driver\n");
5139 5024
5140 scsi = lan = ctl = targ = dmp = 0; 5025 scsi = fc = sas = lan = ctl = targ = dmp = 0;
5141 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { 5026 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
5142 drvname = NULL; 5027 drvname = NULL;
5143 if (MptCallbacks[ii]) { 5028 if (MptCallbacks[ii]) {
5144 switch (MptDriverClass[ii]) { 5029 switch (MptDriverClass[ii]) {
5145 case MPTSCSIH_DRIVER: 5030 case MPTSPI_DRIVER:
5146 if (!scsi++) drvname = "SCSI host"; 5031 if (!scsi++) drvname = "SPI host";
5032 break;
5033 case MPTFC_DRIVER:
5034 if (!fc++) drvname = "FC host";
5035 break;
5036 case MPTSAS_DRIVER:
5037 if (!sas++) drvname = "SAS host";
5147 break; 5038 break;
5148 case MPTLAN_DRIVER: 5039 case MPTLAN_DRIVER:
5149 if (!lan++) drvname = "LAN"; 5040 if (!lan++) drvname = "LAN";
@@ -5832,6 +5723,12 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
5832} 5723}
5833 5724
5834/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5725/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5726EXPORT_SYMBOL(mpt_attach);
5727EXPORT_SYMBOL(mpt_detach);
5728#ifdef CONFIG_PM
5729EXPORT_SYMBOL(mpt_resume);
5730EXPORT_SYMBOL(mpt_suspend);
5731#endif
5835EXPORT_SYMBOL(ioc_list); 5732EXPORT_SYMBOL(ioc_list);
5836EXPORT_SYMBOL(mpt_proc_root_dir); 5733EXPORT_SYMBOL(mpt_proc_root_dir);
5837EXPORT_SYMBOL(mpt_register); 5734EXPORT_SYMBOL(mpt_register);
@@ -5860,19 +5757,6 @@ EXPORT_SYMBOL(mpt_read_ioc_pg_3);
5860EXPORT_SYMBOL(mpt_alloc_fw_memory); 5757EXPORT_SYMBOL(mpt_alloc_fw_memory);
5861EXPORT_SYMBOL(mpt_free_fw_memory); 5758EXPORT_SYMBOL(mpt_free_fw_memory);
5862 5759
5863static struct pci_driver mptbase_driver = {
5864 .name = "mptbase",
5865 .id_table = mptbase_pci_table,
5866 .probe = mptbase_probe,
5867 .remove = __devexit_p(mptbase_remove),
5868 .driver = {
5869 .shutdown = mptbase_shutdown,
5870 },
5871#ifdef CONFIG_PM
5872 .suspend = mptbase_suspend,
5873 .resume = mptbase_resume,
5874#endif
5875};
5876 5760
5877/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5761/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5878/* 5762/*
@@ -5884,7 +5768,6 @@ static int __init
5884fusion_init(void) 5768fusion_init(void)
5885{ 5769{
5886 int i; 5770 int i;
5887 int r;
5888 5771
5889 show_mptmod_ver(my_NAME, my_VERSION); 5772 show_mptmod_ver(my_NAME, my_VERSION);
5890 printk(KERN_INFO COPYRIGHT "\n"); 5773 printk(KERN_INFO COPYRIGHT "\n");
@@ -5896,8 +5779,7 @@ fusion_init(void)
5896 MptResetHandlers[i] = NULL; 5779 MptResetHandlers[i] = NULL;
5897 } 5780 }
5898 5781
5899 /* NEW! 20010120 -sralston 5782 /* Register ourselves (mptbase) in order to facilitate
5900 * Register ourselves (mptbase) in order to facilitate
5901 * EventNotification handling. 5783 * EventNotification handling.
5902 */ 5784 */
5903 mpt_base_index = mpt_register(mpt_base_reply, MPTBASE_DRIVER); 5785 mpt_base_index = mpt_register(mpt_base_reply, MPTBASE_DRIVER);
@@ -5913,11 +5795,7 @@ fusion_init(void)
5913#ifdef CONFIG_PROC_FS 5795#ifdef CONFIG_PROC_FS
5914 (void) procmpt_create(); 5796 (void) procmpt_create();
5915#endif 5797#endif
5916 r = pci_register_driver(&mptbase_driver); 5798 return 0;
5917 if(r)
5918 return(r);
5919
5920 return r;
5921} 5799}
5922 5800
5923/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5801/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -5933,7 +5811,6 @@ fusion_exit(void)
5933 5811
5934 dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n")); 5812 dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n"));
5935 5813
5936 pci_unregister_driver(&mptbase_driver);
5937 mpt_reset_deregister(mpt_base_index); 5814 mpt_reset_deregister(mpt_base_index);
5938 5815
5939#ifdef CONFIG_PROC_FS 5816#ifdef CONFIG_PROC_FS
@@ -5941,6 +5818,5 @@ fusion_exit(void)
5941#endif 5818#endif
5942} 5819}
5943 5820
5944
5945module_init(fusion_init); 5821module_init(fusion_init);
5946module_exit(fusion_exit); 5822module_exit(fusion_exit);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 6d16acc7a179..b338a154f78f 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -5,15 +5,9 @@
5 * LSIFC9xx/LSI409xx Fibre Channel 5 * LSIFC9xx/LSI409xx Fibre Channel
6 * running LSI Logic Fusion MPT (Message Passing Technology) firmware. 6 * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
7 * 7 *
8 * Credits: 8 * Copyright (c) 1999-2005 LSI Logic Corporation
9 * (see mptbase.c)
10 *
11 * Copyright (c) 1999-2004 LSI Logic Corporation
12 * Originally By: Steven J. Ralston
13 * (mailto:sjralston1@netscape.net)
14 * (mailto:mpt_linux_developer@lsil.com) 9 * (mailto:mpt_linux_developer@lsil.com)
15 * 10 *
16 * $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $
17 */ 11 */
18/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 12/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
19/* 13/*
@@ -71,7 +65,6 @@
71#include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */ 65#include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */
72#include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */ 66#include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */
73#include "lsi/mpi_tool.h" /* Tools support */ 67#include "lsi/mpi_tool.h" /* Tools support */
74#include "lsi/fc_log.h"
75 68
76/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 69/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
77 70
@@ -80,11 +73,11 @@
80#endif 73#endif
81 74
82#ifndef COPYRIGHT 75#ifndef COPYRIGHT
83#define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR 76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
84#endif 77#endif
85 78
86#define MPT_LINUX_VERSION_COMMON "3.01.20" 79#define MPT_LINUX_VERSION_COMMON "3.03.00"
87#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.20" 80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.00"
88#define WHAT_MAGIC_STRING "@" "(" "#" ")" 81#define WHAT_MAGIC_STRING "@" "(" "#" ")"
89 82
90#define show_mptmod_ver(s,ver) \ 83#define show_mptmod_ver(s,ver) \
@@ -203,7 +196,9 @@
203typedef enum { 196typedef enum {
204 MPTBASE_DRIVER, /* MPT base class */ 197 MPTBASE_DRIVER, /* MPT base class */
205 MPTCTL_DRIVER, /* MPT ioctl class */ 198 MPTCTL_DRIVER, /* MPT ioctl class */
206 MPTSCSIH_DRIVER, /* MPT SCSI host (initiator) class */ 199 MPTSPI_DRIVER, /* MPT SPI host class */
200 MPTFC_DRIVER, /* MPT FC host class */
201 MPTSAS_DRIVER, /* MPT SAS host class */
207 MPTLAN_DRIVER, /* MPT LAN class */ 202 MPTLAN_DRIVER, /* MPT LAN class */
208 MPTSTM_DRIVER, /* MPT SCSI target mode class */ 203 MPTSTM_DRIVER, /* MPT SCSI target mode class */
209 MPTUNKNOWN_DRIVER 204 MPTUNKNOWN_DRIVER
@@ -212,11 +207,6 @@ typedef enum {
212struct mpt_pci_driver{ 207struct mpt_pci_driver{
213 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); 208 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id);
214 void (*remove) (struct pci_dev *dev); 209 void (*remove) (struct pci_dev *dev);
215 void (*shutdown) (struct device * dev);
216#ifdef CONFIG_PM
217 int (*resume) (struct pci_dev *dev);
218 int (*suspend) (struct pci_dev *dev, pm_message_t state);
219#endif
220}; 210};
221 211
222/* 212/*
@@ -483,6 +473,7 @@ typedef struct _ScsiCfgData {
483 u8 forceDv; /* 1 to force DV scheduling */ 473 u8 forceDv; /* 1 to force DV scheduling */
484 u8 noQas; /* Disable QAS for this adapter */ 474 u8 noQas; /* Disable QAS for this adapter */
485 u8 Saf_Te; /* 1 to force all Processors as SAF-TE if Inquiry data length is too short to check for SAF-TE */ 475 u8 Saf_Te; /* 1 to force all Processors as SAF-TE if Inquiry data length is too short to check for SAF-TE */
476 u8 mpt_dv; /* command line option: enhanced=1, basic=0 */
486 u8 rsvd[1]; 477 u8 rsvd[1];
487} ScsiCfgData; 478} ScsiCfgData;
488 479
@@ -576,6 +567,9 @@ typedef struct _MPT_ADAPTER
576 u8 reload_fw; /* Force a FW Reload on next reset */ 567 u8 reload_fw; /* Force a FW Reload on next reset */
577 u8 NBShiftFactor; /* NB Shift Factor based on Block Size (Facts) */ 568 u8 NBShiftFactor; /* NB Shift Factor based on Block Size (Facts) */
578 u8 pad1[4]; 569 u8 pad1[4];
570 int DoneCtx;
571 int TaskCtx;
572 int InternalCtx;
579 struct list_head list; 573 struct list_head list;
580 struct net_device *netdev; 574 struct net_device *netdev;
581} MPT_ADAPTER; 575} MPT_ADAPTER;
@@ -773,12 +767,6 @@ typedef struct _mpt_sge {
773#define DBG_DUMP_TM_REPLY_FRAME(mfp) 767#define DBG_DUMP_TM_REPLY_FRAME(mfp)
774#endif 768#endif
775 769
776#ifdef MPT_DEBUG_NEH
777#define nehprintk(x) printk x
778#else
779#define nehprintk(x)
780#endif
781
782#if defined(MPT_DEBUG_CONFIG) || defined(MPT_DEBUG) 770#if defined(MPT_DEBUG_CONFIG) || defined(MPT_DEBUG)
783#define dcprintk(x) printk x 771#define dcprintk(x) printk x
784#else 772#else
@@ -898,6 +886,11 @@ typedef struct _MPT_SCSI_HOST {
898 unsigned long soft_resets; /* fw/external bus resets count */ 886 unsigned long soft_resets; /* fw/external bus resets count */
899 unsigned long timeouts; /* cmd timeouts */ 887 unsigned long timeouts; /* cmd timeouts */
900 ushort sel_timeout[MPT_MAX_FC_DEVICES]; 888 ushort sel_timeout[MPT_MAX_FC_DEVICES];
889 char *info_kbuf;
890 wait_queue_head_t scandv_waitq;
891 int scandv_wait_done;
892 long last_queue_full;
893 u8 mpt_pq_filter;
901} MPT_SCSI_HOST; 894} MPT_SCSI_HOST;
902 895
903/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 896/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -931,6 +924,12 @@ typedef struct _x_config_parms {
931/* 924/*
932 * Public entry points... 925 * Public entry points...
933 */ 926 */
927extern int mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id);
928extern void mpt_detach(struct pci_dev *pdev);
929#ifdef CONFIG_PM
930extern int mpt_suspend(struct pci_dev *pdev, pm_message_t state);
931extern int mpt_resume(struct pci_dev *pdev);
932#endif
934extern int mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass); 933extern int mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass);
935extern void mpt_deregister(int cb_idx); 934extern void mpt_deregister(int cb_idx);
936extern int mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc); 935extern int mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc);