提交 7fadc87e 编写于 作者: M Moore, Eric Dean 提交者: James Bottomley

[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: NEric Moore <Eric.Moore@lsil.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 5f5affdd
/* /*
* linux/drivers/message/fusion/mptbase.c * linux/drivers/message/fusion/mptbase.c
* High performance SCSI + LAN / Fibre Channel device drivers.
* This is the Fusion MPT base driver which supports multiple * This is the Fusion MPT base driver which supports multiple
* (SCSI + LAN) specialized protocol drivers. * (SCSI + LAN) specialized protocol drivers.
* For use with PCI chip/adapter(s): * For use with LSI Logic PCI chip/adapter(s)
* LSIFC9xx/LSI409xx Fibre Channel
* running LSI Logic Fusion MPT (Message Passing Technology) firmware. * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
* *
* Credits: * Copyright (c) 1999-2005 LSI Logic Corporation
* There are lots of people not mentioned below that deserve credit
* and thanks but won't get it here - sorry in advance that you
* got overlooked.
*
* This driver would not exist if not for Alan Cox's development
* of the linux i2o driver.
*
* A special thanks to Noah Romer (LSI Logic) for tons of work
* and tough debugging on the LAN driver, especially early on;-)
* And to Roger Hickerson (LSI Logic) for tirelessly supporting
* this driver project.
*
* A special thanks to Pamela Delaney (LSI Logic) for tons of work
* and countless enhancements while adding support for the 1030
* chip family. Pam has been instrumental in the development of
* of the 2.xx.xx series fusion drivers, and her contributions are
* far too numerous to hope to list in one place.
*
* All manner of help from Stephen Shirron (LSI Logic):
* low-level FC analysis, debug + various fixes in FCxx firmware,
* initial port to alpha platform, various driver code optimizations,
* being a faithful sounding board on all sorts of issues & ideas,
* etc.
*
* A huge debt of gratitude is owed to David S. Miller (DaveM)
* for fixing much of the stupid and broken stuff in the early
* driver while porting to sparc64 platform. THANK YOU!
*
* Special thanks goes to the I2O LAN driver people at the
* University of Helsinki, who, unbeknownst to them, provided
* the inspiration and initial structure for this driver.
*
* A really huge debt of gratitude is owed to Eddie C. Dost
* for gobs of hard work fixing and optimizing LAN code.
* THANK YOU!
*
* Copyright (c) 1999-2004 LSI Logic Corporation
* Originally By: Steven J. Ralston
* (mailto:sjralston1@netscape.net)
* (mailto:mpt_linux_developer@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -101,6 +59,7 @@ ...@@ -101,6 +59,7 @@
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> /* needed for in_interrupt() proto */ #include <linux/interrupt.h> /* needed for in_interrupt() proto */
#include <linux/dma-mapping.h>
#include <asm/io.h> #include <asm/io.h>
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
#include <asm/mtrr.h> #include <asm/mtrr.h>
...@@ -218,35 +177,9 @@ static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); ...@@ -218,35 +177,9 @@ static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info); static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info);
/* module entry point */ /* module entry point */
static int __devinit mptbase_probe (struct pci_dev *, const struct pci_device_id *);
static void __devexit mptbase_remove(struct pci_dev *);
static void mptbase_shutdown(struct device * );
static int __init fusion_init (void); static int __init fusion_init (void);
static void __exit fusion_exit (void); static void __exit fusion_exit (void);
/****************************************************************************
* Supported hardware
*/
static struct pci_device_id mptbase_pci_table[] = {
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC909,
PCI_ANY_ID, PCI_ANY_ID },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929,
PCI_ANY_ID, PCI_ANY_ID },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919,
PCI_ANY_ID, PCI_ANY_ID },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929X,
PCI_ANY_ID, PCI_ANY_ID },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919X,
PCI_ANY_ID, PCI_ANY_ID },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030,
PCI_ANY_ID, PCI_ANY_ID },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_1030_53C1035,
PCI_ANY_ID, PCI_ANY_ID },
{0} /* Terminating entry */
};
MODULE_DEVICE_TABLE(pci, mptbase_pci_table);
#define CHIPREG_READ32(addr) readl_relaxed(addr) #define CHIPREG_READ32(addr) readl_relaxed(addr)
#define CHIPREG_READ32_dmasync(addr) readl(addr) #define CHIPREG_READ32_dmasync(addr) readl(addr)
#define CHIPREG_WRITE32(addr,val) writel(val, addr) #define CHIPREG_WRITE32(addr,val) writel(val, addr)
...@@ -330,8 +263,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) ...@@ -330,8 +263,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
ioc->name, mr, req_idx)); ioc->name, mr, req_idx));
DBG_DUMP_REPLY_FRAME(mr) DBG_DUMP_REPLY_FRAME(mr)
/* NEW! 20010301 -sralston /* Check/log IOC log info
* Check/log IOC log info
*/ */
ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus);
if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { 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,9 +289,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa); mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa);
} else if (type == MPI_CONTEXT_REPLY_TYPE_LAN) { } else if (type == MPI_CONTEXT_REPLY_TYPE_LAN) {
cb_idx = mpt_lan_index; cb_idx = mpt_lan_index;
/* /* Blind set of mf to NULL here was fatal
* BUG FIX! 20001218 -sralston
* Blind set of mf to NULL here was fatal
* after lan_reply says "freeme" * after lan_reply says "freeme"
* Fix sort of combined with an optimization here; * Fix sort of combined with an optimization here;
* added explicit check for case where lan_reply * added explicit check for case where lan_reply
...@@ -725,11 +655,9 @@ int ...@@ -725,11 +655,9 @@ int
mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
{ {
MPT_ADAPTER *ioc; MPT_ADAPTER *ioc;
int error=0;
if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) { if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) {
error= -EINVAL; return -EINVAL;
return error;
} }
MptDeviceDriverHandlers[cb_idx] = dd_cbfunc; MptDeviceDriverHandlers[cb_idx] = dd_cbfunc;
...@@ -737,14 +665,12 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) ...@@ -737,14 +665,12 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
/* call per pci device probe entry point */ /* call per pci device probe entry point */
list_for_each_entry(ioc, &ioc_list, list) { list_for_each_entry(ioc, &ioc_list, list) {
if(dd_cbfunc->probe) { if(dd_cbfunc->probe) {
error = dd_cbfunc->probe(ioc->pcidev, dd_cbfunc->probe(ioc->pcidev,
ioc->pcidev->driver->id_table); ioc->pcidev->driver->id_table);
if(error != 0)
return error;
} }
} }
return error; return 0;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -1058,7 +984,7 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) ...@@ -1058,7 +984,7 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* mptbase_probe - Install a PCI intelligent MPT adapter. * mpt_attach - Install a PCI intelligent MPT adapter.
* @pdev: Pointer to pci_dev structure * @pdev: Pointer to pci_dev structure
* *
* This routine performs all the steps necessary to bring the IOC of * 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,8 +999,8 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
* *
* TODO: Add support for polled controllers * TODO: Add support for polled controllers
*/ */
static int __devinit int
mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
MPT_ADAPTER *ioc; MPT_ADAPTER *ioc;
u8 __iomem *mem; u8 __iomem *mem;
...@@ -1084,7 +1010,6 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1084,7 +1010,6 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
u32 psize; u32 psize;
int ii; int ii;
int r = -ENODEV; int r = -ENODEV;
u64 mask = 0xffffffffffffffffULL;
u8 revision; u8 revision;
u8 pcixcmd; u8 pcixcmd;
static int mpt_ids = 0; static int mpt_ids = 0;
...@@ -1097,15 +1022,15 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1097,15 +1022,15 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n"));
if (!pci_set_dma_mask(pdev, mask)) { if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
dprintk((KERN_INFO MYNAM dprintk((KERN_INFO MYNAM
": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n"));
} else if (pci_set_dma_mask(pdev, (u64) 0xffffffff)) { } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n"); printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n");
return r; return r;
} }
if (!pci_set_consistent_dma_mask(pdev, mask)) if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))
dprintk((KERN_INFO MYNAM dprintk((KERN_INFO MYNAM
": Using 64 bit consistent mask\n")); ": Using 64 bit consistent mask\n"));
else else
...@@ -1303,8 +1228,7 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1303,8 +1228,7 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
#endif #endif
} }
/* NEW! 20010220 -sralston /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
*/ */
mpt_detect_bound_ports(ioc, pdev); mpt_detect_bound_ports(ioc, pdev);
...@@ -1354,13 +1278,13 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1354,13 +1278,13 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* mptbase_remove - Remove a PCI intelligent MPT adapter. * mpt_detach - Remove a PCI intelligent MPT adapter.
* @pdev: Pointer to pci_dev structure * @pdev: Pointer to pci_dev structure
* *
*/ */
static void __devexit void
mptbase_remove(struct pci_dev *pdev) mpt_detach(struct pci_dev *pdev)
{ {
MPT_ADAPTER *ioc = pci_get_drvdata(pdev); MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
char pname[32]; char pname[32];
...@@ -1397,43 +1321,21 @@ mptbase_remove(struct pci_dev *pdev) ...@@ -1397,43 +1321,21 @@ mptbase_remove(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* mptbase_shutdown -
*
*/
static void
mptbase_shutdown(struct device * dev)
{
int ii;
/* call per device driver shutdown entry point */
for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
if(MptDeviceDriverHandlers[ii] &&
MptDeviceDriverHandlers[ii]->shutdown) {
MptDeviceDriverHandlers[ii]->shutdown(dev);
}
}
}
/************************************************************************** /**************************************************************************
* Power Management * Power Management
*/ */
#ifdef CONFIG_PM #ifdef CONFIG_PM
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* mptbase_suspend - Fusion MPT base driver suspend routine. * mpt_suspend - Fusion MPT base driver suspend routine.
* *
* *
*/ */
static int int
mptbase_suspend(struct pci_dev *pdev, pm_message_t state) mpt_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
u32 device_state; u32 device_state;
MPT_ADAPTER *ioc = pci_get_drvdata(pdev); MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
int ii;
switch(state) switch(state)
{ {
...@@ -1453,14 +1355,6 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1453,14 +1355,6 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state)
"pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n", "pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n",
ioc->name, pdev, pci_name(pdev), device_state); ioc->name, pdev, pci_name(pdev), device_state);
/* call per device driver suspend entry point */
for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
if(MptDeviceDriverHandlers[ii] &&
MptDeviceDriverHandlers[ii]->suspend) {
MptDeviceDriverHandlers[ii]->suspend(pdev, state);
}
}
pci_save_state(pdev); pci_save_state(pdev);
/* put ioc into READY_STATE */ /* put ioc into READY_STATE */
...@@ -1484,12 +1378,12 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1484,12 +1378,12 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* mptbase_resume - Fusion MPT base driver resume routine. * mpt_resume - Fusion MPT base driver resume routine.
* *
* *
*/ */
static int int
mptbase_resume(struct pci_dev *pdev) mpt_resume(struct pci_dev *pdev)
{ {
MPT_ADAPTER *ioc = pci_get_drvdata(pdev); MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
u32 device_state = pdev->current_state; u32 device_state = pdev->current_state;
...@@ -1533,14 +1427,6 @@ mptbase_resume(struct pci_dev *pdev) ...@@ -1533,14 +1427,6 @@ mptbase_resume(struct pci_dev *pdev)
"pci-resume: success\n", ioc->name); "pci-resume: success\n", ioc->name);
} }
/* call per device driver resume entry point */
for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
if(MptDeviceDriverHandlers[ii] &&
MptDeviceDriverHandlers[ii]->resume) {
MptDeviceDriverHandlers[ii]->resume(pdev);
}
}
return 0; return 0;
} }
#endif #endif
...@@ -1719,8 +1605,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) ...@@ -1719,8 +1605,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
ioc->alt_ioc->active = 1; ioc->alt_ioc->active = 1;
} }
/* NEW! 20010120 -sralston /* Enable MPT base driver management of EventNotification
* Enable MPT base driver management of EventNotification
* and EventAck handling. * and EventAck handling.
*/ */
if ((ret == 0) && (!ioc->facts.EventState)) if ((ret == 0) && (!ioc->facts.EventState))
...@@ -1729,9 +1614,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) ...@@ -1729,9 +1614,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState) if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState)
(void) SendEventNotification(ioc->alt_ioc, 1); /* 1=Enable EventNotification */ (void) SendEventNotification(ioc->alt_ioc, 1); /* 1=Enable EventNotification */
/* (Bugzilla:fibrebugs, #513) /* Add additional "reason" check before call to GetLanConfigPages
* Bug fix (part 2)! 20010905 -sralston
* Add additional "reason" check before call to GetLanConfigPages
* (combined with GetIoUnitPage2 call). This prevents a somewhat * (combined with GetIoUnitPage2 call). This prevents a somewhat
* recursive scenario; GetLanConfigPages times out, timer expired * recursive scenario; GetLanConfigPages times out, timer expired
* routine calls HardResetHandler, which calls into here again, * routine calls HardResetHandler, which calls into here again,
...@@ -1829,20 +1712,26 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) ...@@ -1829,20 +1712,26 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
static void static void
mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
{ {
unsigned int match_lo, match_hi; struct pci_dev *peer=NULL;
unsigned int slot = PCI_SLOT(pdev->devfn);
unsigned int func = PCI_FUNC(pdev->devfn);
MPT_ADAPTER *ioc_srch; MPT_ADAPTER *ioc_srch;
match_lo = pdev->devfn-1; dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x,"
match_hi = pdev->devfn+1; " searching for devfn match on %x or %x\n",
dprintk((MYIOC_s_INFO_FMT "PCI bus/devfn=%x/%x, searching for devfn match on %x or %x\n", ioc->name, pci_name(pdev), pdev->devfn,
ioc->name, pdev->bus->number, pdev->devfn, match_lo, match_hi)); func-1, func+1));
peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func-1));
if (!peer) {
peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func+1));
if (!peer)
return;
}
list_for_each_entry(ioc_srch, &ioc_list, list) { list_for_each_entry(ioc_srch, &ioc_list, list) {
struct pci_dev *_pcidev = ioc_srch->pcidev; struct pci_dev *_pcidev = ioc_srch->pcidev;
if (_pcidev == peer) {
if ((_pcidev->device == pdev->device) &&
(_pcidev->bus->number == pdev->bus->number) &&
(_pcidev->devfn == match_lo || _pcidev->devfn == match_hi) ) {
/* Paranoia checks */ /* Paranoia checks */
if (ioc->alt_ioc != NULL) { if (ioc->alt_ioc != NULL) {
printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n",
...@@ -1857,9 +1746,9 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -1857,9 +1746,9 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
ioc->name, ioc_srch->name)); ioc->name, ioc_srch->name));
ioc_srch->alt_ioc = ioc; ioc_srch->alt_ioc = ioc;
ioc->alt_ioc = ioc_srch; ioc->alt_ioc = ioc_srch;
break;
} }
} }
pci_dev_put(peer);
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -2333,7 +2222,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) ...@@ -2333,7 +2222,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
return -55; return -55;
} }
r = sz = le32_to_cpu(facts->BlockSize); r = sz = facts->BlockSize;
vv = ((63 / (sz * 4)) + 1) & 0x03; vv = ((63 / (sz * 4)) + 1) & 0x03;
ioc->NB_for_64_byte_frame = vv; ioc->NB_for_64_byte_frame = vv;
while ( sz ) while ( sz )
...@@ -4753,9 +4642,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) ...@@ -4753,9 +4642,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
u32 flagsLength; u32 flagsLength;
int in_isr; int in_isr;
/* (Bugzilla:fibrebugs, #513) /* Prevent calling wait_event() (below), if caller happens
* Bug fix (part 1)! 20010905 -sralston
* Prevent calling wait_event() (below), if caller happens
* to be in ISR context, because that is fatal! * to be in ISR context, because that is fatal!
*/ */
in_isr = in_interrupt(); in_isr = in_interrupt();
...@@ -4861,9 +4748,7 @@ mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) ...@@ -4861,9 +4748,7 @@ mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
u32 flagsLength; u32 flagsLength;
int in_isr; int in_isr;
/* (Bugzilla:fibrebugs, #513) /* Prevent calling wait_event() (below), if caller happens
* Bug fix (part 1)! 20010905 -sralston
* Prevent calling wait_event() (below), if caller happens
* to be in ISR context, because that is fatal! * to be in ISR context, because that is fatal!
*/ */
in_isr = in_interrupt(); in_isr = in_interrupt();
...@@ -5130,20 +5015,26 @@ static int ...@@ -5130,20 +5015,26 @@ static int
procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
{ {
int ii; int ii;
int scsi, lan, ctl, targ, dmp; int scsi, fc, sas, lan, ctl, targ, dmp;
char *drvname; char *drvname;
int len; int len;
len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON);
len += sprintf(buf+len, " Fusion MPT base driver\n"); len += sprintf(buf+len, " Fusion MPT base driver\n");
scsi = lan = ctl = targ = dmp = 0; scsi = fc = sas = lan = ctl = targ = dmp = 0;
for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
drvname = NULL; drvname = NULL;
if (MptCallbacks[ii]) { if (MptCallbacks[ii]) {
switch (MptDriverClass[ii]) { switch (MptDriverClass[ii]) {
case MPTSCSIH_DRIVER: case MPTSPI_DRIVER:
if (!scsi++) drvname = "SCSI host"; if (!scsi++) drvname = "SPI host";
break;
case MPTFC_DRIVER:
if (!fc++) drvname = "FC host";
break;
case MPTSAS_DRIVER:
if (!sas++) drvname = "SAS host";
break; break;
case MPTLAN_DRIVER: case MPTLAN_DRIVER:
if (!lan++) drvname = "LAN"; if (!lan++) drvname = "LAN";
...@@ -5832,6 +5723,12 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf) ...@@ -5832,6 +5723,12 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
EXPORT_SYMBOL(mpt_attach);
EXPORT_SYMBOL(mpt_detach);
#ifdef CONFIG_PM
EXPORT_SYMBOL(mpt_resume);
EXPORT_SYMBOL(mpt_suspend);
#endif
EXPORT_SYMBOL(ioc_list); EXPORT_SYMBOL(ioc_list);
EXPORT_SYMBOL(mpt_proc_root_dir); EXPORT_SYMBOL(mpt_proc_root_dir);
EXPORT_SYMBOL(mpt_register); EXPORT_SYMBOL(mpt_register);
...@@ -5860,19 +5757,6 @@ EXPORT_SYMBOL(mpt_read_ioc_pg_3); ...@@ -5860,19 +5757,6 @@ EXPORT_SYMBOL(mpt_read_ioc_pg_3);
EXPORT_SYMBOL(mpt_alloc_fw_memory); EXPORT_SYMBOL(mpt_alloc_fw_memory);
EXPORT_SYMBOL(mpt_free_fw_memory); EXPORT_SYMBOL(mpt_free_fw_memory);
static struct pci_driver mptbase_driver = {
.name = "mptbase",
.id_table = mptbase_pci_table,
.probe = mptbase_probe,
.remove = __devexit_p(mptbase_remove),
.driver = {
.shutdown = mptbase_shutdown,
},
#ifdef CONFIG_PM
.suspend = mptbase_suspend,
.resume = mptbase_resume,
#endif
};
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -5884,7 +5768,6 @@ static int __init ...@@ -5884,7 +5768,6 @@ static int __init
fusion_init(void) fusion_init(void)
{ {
int i; int i;
int r;
show_mptmod_ver(my_NAME, my_VERSION); show_mptmod_ver(my_NAME, my_VERSION);
printk(KERN_INFO COPYRIGHT "\n"); printk(KERN_INFO COPYRIGHT "\n");
...@@ -5896,8 +5779,7 @@ fusion_init(void) ...@@ -5896,8 +5779,7 @@ fusion_init(void)
MptResetHandlers[i] = NULL; MptResetHandlers[i] = NULL;
} }
/* NEW! 20010120 -sralston /* Register ourselves (mptbase) in order to facilitate
* Register ourselves (mptbase) in order to facilitate
* EventNotification handling. * EventNotification handling.
*/ */
mpt_base_index = mpt_register(mpt_base_reply, MPTBASE_DRIVER); mpt_base_index = mpt_register(mpt_base_reply, MPTBASE_DRIVER);
...@@ -5913,11 +5795,7 @@ fusion_init(void) ...@@ -5913,11 +5795,7 @@ fusion_init(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
(void) procmpt_create(); (void) procmpt_create();
#endif #endif
r = pci_register_driver(&mptbase_driver); return 0;
if(r)
return(r);
return r;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -5933,7 +5811,6 @@ fusion_exit(void) ...@@ -5933,7 +5811,6 @@ fusion_exit(void)
dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n")); dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n"));
pci_unregister_driver(&mptbase_driver);
mpt_reset_deregister(mpt_base_index); mpt_reset_deregister(mpt_base_index);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -5941,6 +5818,5 @@ fusion_exit(void) ...@@ -5941,6 +5818,5 @@ fusion_exit(void)
#endif #endif
} }
module_init(fusion_init); module_init(fusion_init);
module_exit(fusion_exit); module_exit(fusion_exit);
...@@ -5,15 +5,9 @@ ...@@ -5,15 +5,9 @@
* LSIFC9xx/LSI409xx Fibre Channel * LSIFC9xx/LSI409xx Fibre Channel
* running LSI Logic Fusion MPT (Message Passing Technology) firmware. * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
* *
* Credits: * Copyright (c) 1999-2005 LSI Logic Corporation
* (see mptbase.c)
*
* Copyright (c) 1999-2004 LSI Logic Corporation
* Originally By: Steven J. Ralston
* (mailto:sjralston1@netscape.net)
* (mailto:mpt_linux_developer@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -71,7 +65,6 @@ ...@@ -71,7 +65,6 @@
#include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */ #include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */
#include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */ #include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */
#include "lsi/mpi_tool.h" /* Tools support */ #include "lsi/mpi_tool.h" /* Tools support */
#include "lsi/fc_log.h"
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -80,11 +73,11 @@ ...@@ -80,11 +73,11 @@
#endif #endif
#ifndef COPYRIGHT #ifndef COPYRIGHT
#define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
#endif #endif
#define MPT_LINUX_VERSION_COMMON "3.01.20" #define MPT_LINUX_VERSION_COMMON "3.03.00"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.20" #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.00"
#define WHAT_MAGIC_STRING "@" "(" "#" ")" #define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \ #define show_mptmod_ver(s,ver) \
...@@ -203,7 +196,9 @@ ...@@ -203,7 +196,9 @@
typedef enum { typedef enum {
MPTBASE_DRIVER, /* MPT base class */ MPTBASE_DRIVER, /* MPT base class */
MPTCTL_DRIVER, /* MPT ioctl class */ MPTCTL_DRIVER, /* MPT ioctl class */
MPTSCSIH_DRIVER, /* MPT SCSI host (initiator) class */ MPTSPI_DRIVER, /* MPT SPI host class */
MPTFC_DRIVER, /* MPT FC host class */
MPTSAS_DRIVER, /* MPT SAS host class */
MPTLAN_DRIVER, /* MPT LAN class */ MPTLAN_DRIVER, /* MPT LAN class */
MPTSTM_DRIVER, /* MPT SCSI target mode class */ MPTSTM_DRIVER, /* MPT SCSI target mode class */
MPTUNKNOWN_DRIVER MPTUNKNOWN_DRIVER
...@@ -212,11 +207,6 @@ typedef enum { ...@@ -212,11 +207,6 @@ typedef enum {
struct mpt_pci_driver{ struct mpt_pci_driver{
int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); int (*probe) (struct pci_dev *dev, const struct pci_device_id *id);
void (*remove) (struct pci_dev *dev); void (*remove) (struct pci_dev *dev);
void (*shutdown) (struct device * dev);
#ifdef CONFIG_PM
int (*resume) (struct pci_dev *dev);
int (*suspend) (struct pci_dev *dev, pm_message_t state);
#endif
}; };
/* /*
...@@ -483,6 +473,7 @@ typedef struct _ScsiCfgData { ...@@ -483,6 +473,7 @@ typedef struct _ScsiCfgData {
u8 forceDv; /* 1 to force DV scheduling */ u8 forceDv; /* 1 to force DV scheduling */
u8 noQas; /* Disable QAS for this adapter */ u8 noQas; /* Disable QAS for this adapter */
u8 Saf_Te; /* 1 to force all Processors as SAF-TE if Inquiry data length is too short to check for SAF-TE */ u8 Saf_Te; /* 1 to force all Processors as SAF-TE if Inquiry data length is too short to check for SAF-TE */
u8 mpt_dv; /* command line option: enhanced=1, basic=0 */
u8 rsvd[1]; u8 rsvd[1];
} ScsiCfgData; } ScsiCfgData;
...@@ -576,6 +567,9 @@ typedef struct _MPT_ADAPTER ...@@ -576,6 +567,9 @@ typedef struct _MPT_ADAPTER
u8 reload_fw; /* Force a FW Reload on next reset */ u8 reload_fw; /* Force a FW Reload on next reset */
u8 NBShiftFactor; /* NB Shift Factor based on Block Size (Facts) */ u8 NBShiftFactor; /* NB Shift Factor based on Block Size (Facts) */
u8 pad1[4]; u8 pad1[4];
int DoneCtx;
int TaskCtx;
int InternalCtx;
struct list_head list; struct list_head list;
struct net_device *netdev; struct net_device *netdev;
} MPT_ADAPTER; } MPT_ADAPTER;
...@@ -773,12 +767,6 @@ typedef struct _mpt_sge { ...@@ -773,12 +767,6 @@ typedef struct _mpt_sge {
#define DBG_DUMP_TM_REPLY_FRAME(mfp) #define DBG_DUMP_TM_REPLY_FRAME(mfp)
#endif #endif
#ifdef MPT_DEBUG_NEH
#define nehprintk(x) printk x
#else
#define nehprintk(x)
#endif
#if defined(MPT_DEBUG_CONFIG) || defined(MPT_DEBUG) #if defined(MPT_DEBUG_CONFIG) || defined(MPT_DEBUG)
#define dcprintk(x) printk x #define dcprintk(x) printk x
#else #else
...@@ -898,6 +886,11 @@ typedef struct _MPT_SCSI_HOST { ...@@ -898,6 +886,11 @@ typedef struct _MPT_SCSI_HOST {
unsigned long soft_resets; /* fw/external bus resets count */ unsigned long soft_resets; /* fw/external bus resets count */
unsigned long timeouts; /* cmd timeouts */ unsigned long timeouts; /* cmd timeouts */
ushort sel_timeout[MPT_MAX_FC_DEVICES]; ushort sel_timeout[MPT_MAX_FC_DEVICES];
char *info_kbuf;
wait_queue_head_t scandv_waitq;
int scandv_wait_done;
long last_queue_full;
u8 mpt_pq_filter;
} MPT_SCSI_HOST; } MPT_SCSI_HOST;
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -931,6 +924,12 @@ typedef struct _x_config_parms { ...@@ -931,6 +924,12 @@ typedef struct _x_config_parms {
/* /*
* Public entry points... * Public entry points...
*/ */
extern int mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id);
extern void mpt_detach(struct pci_dev *pdev);
#ifdef CONFIG_PM
extern int mpt_suspend(struct pci_dev *pdev, pm_message_t state);
extern int mpt_resume(struct pci_dev *pdev);
#endif
extern int mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass); extern int mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass);
extern void mpt_deregister(int cb_idx); extern void mpt_deregister(int cb_idx);
extern int mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc); extern int mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册