diff options
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 343 |
1 files changed, 121 insertions, 222 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 8b22630f1aef..8b623278ccd2 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,41 +177,35 @@ static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); | |||
218 | static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info); | 177 | static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info); |
219 | 178 | ||
220 | /* module entry point */ | 179 | /* module entry point */ |
221 | static int __devinit mptbase_probe (struct pci_dev *, const struct pci_device_id *); | ||
222 | static void __devexit mptbase_remove(struct pci_dev *); | ||
223 | static void mptbase_shutdown(struct device * ); | ||
224 | static int __init fusion_init (void); | 180 | static int __init fusion_init (void); |
225 | static void __exit fusion_exit (void); | 181 | static void __exit fusion_exit (void); |
226 | 182 | ||
227 | /**************************************************************************** | ||
228 | * Supported hardware | ||
229 | */ | ||
230 | |||
231 | static 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 | }; | ||
248 | MODULE_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) |
253 | #define CHIPREG_PIO_WRITE32(addr,val) outl(val, (unsigned long)addr) | 186 | #define CHIPREG_PIO_WRITE32(addr,val) outl(val, (unsigned long)addr) |
254 | #define CHIPREG_PIO_READ32(addr) inl((unsigned long)addr) | 187 | #define CHIPREG_PIO_READ32(addr) inl((unsigned long)addr) |
255 | 188 | ||
189 | static void | ||
190 | pci_disable_io_access(struct pci_dev *pdev) | ||
191 | { | ||
192 | u16 command_reg; | ||
193 | |||
194 | pci_read_config_word(pdev, PCI_COMMAND, &command_reg); | ||
195 | command_reg &= ~1; | ||
196 | pci_write_config_word(pdev, PCI_COMMAND, command_reg); | ||
197 | } | ||
198 | |||
199 | static void | ||
200 | pci_enable_io_access(struct pci_dev *pdev) | ||
201 | { | ||
202 | u16 command_reg; | ||
203 | |||
204 | pci_read_config_word(pdev, PCI_COMMAND, &command_reg); | ||
205 | command_reg |= 1; | ||
206 | pci_write_config_word(pdev, PCI_COMMAND, command_reg); | ||
207 | } | ||
208 | |||
256 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 209 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
257 | /* | 210 | /* |
258 | * mpt_interrupt - MPT adapter (IOC) specific interrupt handler. | 211 | * mpt_interrupt - MPT adapter (IOC) specific interrupt handler. |
@@ -330,8 +283,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) | |||
330 | ioc->name, mr, req_idx)); | 283 | ioc->name, mr, req_idx)); |
331 | DBG_DUMP_REPLY_FRAME(mr) | 284 | DBG_DUMP_REPLY_FRAME(mr) |
332 | 285 | ||
333 | /* NEW! 20010301 -sralston | 286 | /* Check/log IOC log info |
334 | * Check/log IOC log info | ||
335 | */ | 287 | */ |
336 | ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); | 288 | ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); |
337 | if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { | 289 | if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { |
@@ -357,9 +309,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) | |||
357 | mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa); | 309 | mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa); |
358 | } else if (type == MPI_CONTEXT_REPLY_TYPE_LAN) { | 310 | } else if (type == MPI_CONTEXT_REPLY_TYPE_LAN) { |
359 | cb_idx = mpt_lan_index; | 311 | cb_idx = mpt_lan_index; |
360 | /* | 312 | /* 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" | 313 | * after lan_reply says "freeme" |
364 | * Fix sort of combined with an optimization here; | 314 | * Fix sort of combined with an optimization here; |
365 | * added explicit check for case where lan_reply | 315 | * added explicit check for case where lan_reply |
@@ -430,15 +380,8 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) | |||
430 | } | 380 | } |
431 | 381 | ||
432 | if (freeme) { | 382 | if (freeme) { |
433 | unsigned long flags; | ||
434 | |||
435 | /* Put Request back on FreeQ! */ | 383 | /* Put Request back on FreeQ! */ |
436 | spin_lock_irqsave(&ioc->FreeQlock, flags); | 384 | mpt_free_msg_frame(ioc, mf); |
437 | list_add_tail(&mf->u.frame.linkage.list, &ioc->FreeQ); | ||
438 | #ifdef MFCNT | ||
439 | ioc->mfcnt--; | ||
440 | #endif | ||
441 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); | ||
442 | } | 385 | } |
443 | 386 | ||
444 | mb(); | 387 | mb(); |
@@ -725,11 +668,9 @@ int | |||
725 | mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) | 668 | mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) |
726 | { | 669 | { |
727 | MPT_ADAPTER *ioc; | 670 | MPT_ADAPTER *ioc; |
728 | int error=0; | ||
729 | 671 | ||
730 | if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) { | 672 | if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) { |
731 | error= -EINVAL; | 673 | return -EINVAL; |
732 | return error; | ||
733 | } | 674 | } |
734 | 675 | ||
735 | MptDeviceDriverHandlers[cb_idx] = dd_cbfunc; | 676 | MptDeviceDriverHandlers[cb_idx] = dd_cbfunc; |
@@ -737,14 +678,12 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) | |||
737 | /* call per pci device probe entry point */ | 678 | /* call per pci device probe entry point */ |
738 | list_for_each_entry(ioc, &ioc_list, list) { | 679 | list_for_each_entry(ioc, &ioc_list, list) { |
739 | if(dd_cbfunc->probe) { | 680 | if(dd_cbfunc->probe) { |
740 | error = dd_cbfunc->probe(ioc->pcidev, | 681 | dd_cbfunc->probe(ioc->pcidev, |
741 | ioc->pcidev->driver->id_table); | 682 | ioc->pcidev->driver->id_table); |
742 | if(error != 0) | ||
743 | return error; | ||
744 | } | 683 | } |
745 | } | 684 | } |
746 | 685 | ||
747 | return error; | 686 | return 0; |
748 | } | 687 | } |
749 | 688 | ||
750 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 689 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -809,8 +748,8 @@ mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc) | |||
809 | mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle; /* byte */ | 748 | mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle; /* byte */ |
810 | req_offset = (u8 *)mf - (u8 *)ioc->req_frames; | 749 | req_offset = (u8 *)mf - (u8 *)ioc->req_frames; |
811 | /* u16! */ | 750 | /* u16! */ |
812 | req_idx = cpu_to_le16(req_offset / ioc->req_sz); | 751 | req_idx = req_offset / ioc->req_sz; |
813 | mf->u.frame.hwhdr.msgctxu.fld.req_idx = req_idx; | 752 | mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx); |
814 | mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0; | 753 | mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0; |
815 | ioc->RequestNB[req_idx] = ioc->NB_for_64_byte_frame; /* Default, will be changed if necessary in SG generation */ | 754 | ioc->RequestNB[req_idx] = ioc->NB_for_64_byte_frame; /* Default, will be changed if necessary in SG generation */ |
816 | #ifdef MFCNT | 755 | #ifdef MFCNT |
@@ -856,8 +795,8 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) | |||
856 | mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle; /* byte */ | 795 | mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle; /* byte */ |
857 | req_offset = (u8 *)mf - (u8 *)ioc->req_frames; | 796 | req_offset = (u8 *)mf - (u8 *)ioc->req_frames; |
858 | /* u16! */ | 797 | /* u16! */ |
859 | req_idx = cpu_to_le16(req_offset / ioc->req_sz); | 798 | req_idx = req_offset / ioc->req_sz; |
860 | mf->u.frame.hwhdr.msgctxu.fld.req_idx = req_idx; | 799 | mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx); |
861 | mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0; | 800 | mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0; |
862 | 801 | ||
863 | #ifdef MPT_DEBUG_MSG_FRAME | 802 | #ifdef MPT_DEBUG_MSG_FRAME |
@@ -1058,7 +997,7 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | |||
1058 | 997 | ||
1059 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 998 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1060 | /* | 999 | /* |
1061 | * mptbase_probe - Install a PCI intelligent MPT adapter. | 1000 | * mpt_attach - Install a PCI intelligent MPT adapter. |
1062 | * @pdev: Pointer to pci_dev structure | 1001 | * @pdev: Pointer to pci_dev structure |
1063 | * | 1002 | * |
1064 | * This routine performs all the steps necessary to bring the IOC of | 1003 | * This routine performs all the steps necessary to bring the IOC of |
@@ -1073,8 +1012,8 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | |||
1073 | * | 1012 | * |
1074 | * TODO: Add support for polled controllers | 1013 | * TODO: Add support for polled controllers |
1075 | */ | 1014 | */ |
1076 | static int __devinit | 1015 | int |
1077 | mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 1016 | mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) |
1078 | { | 1017 | { |
1079 | MPT_ADAPTER *ioc; | 1018 | MPT_ADAPTER *ioc; |
1080 | u8 __iomem *mem; | 1019 | u8 __iomem *mem; |
@@ -1084,7 +1023,6 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1084 | u32 psize; | 1023 | u32 psize; |
1085 | int ii; | 1024 | int ii; |
1086 | int r = -ENODEV; | 1025 | int r = -ENODEV; |
1087 | u64 mask = 0xffffffffffffffffULL; | ||
1088 | u8 revision; | 1026 | u8 revision; |
1089 | u8 pcixcmd; | 1027 | u8 pcixcmd; |
1090 | static int mpt_ids = 0; | 1028 | static int mpt_ids = 0; |
@@ -1097,15 +1035,15 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1097 | 1035 | ||
1098 | dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); | 1036 | dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); |
1099 | 1037 | ||
1100 | if (!pci_set_dma_mask(pdev, mask)) { | 1038 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { |
1101 | dprintk((KERN_INFO MYNAM | 1039 | dprintk((KERN_INFO MYNAM |
1102 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); | 1040 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); |
1103 | } else if (pci_set_dma_mask(pdev, (u64) 0xffffffff)) { | 1041 | } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { |
1104 | printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n"); | 1042 | printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n"); |
1105 | return r; | 1043 | return r; |
1106 | } | 1044 | } |
1107 | 1045 | ||
1108 | if (!pci_set_consistent_dma_mask(pdev, mask)) | 1046 | if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) |
1109 | dprintk((KERN_INFO MYNAM | 1047 | dprintk((KERN_INFO MYNAM |
1110 | ": Using 64 bit consistent mask\n")); | 1048 | ": Using 64 bit consistent mask\n")); |
1111 | else | 1049 | else |
@@ -1243,6 +1181,16 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1243 | pcixcmd &= 0x8F; | 1181 | pcixcmd &= 0x8F; |
1244 | pci_write_config_byte(pdev, 0x6a, pcixcmd); | 1182 | pci_write_config_byte(pdev, 0x6a, pcixcmd); |
1245 | } | 1183 | } |
1184 | else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC939X) { | ||
1185 | ioc->prod_name = "LSIFC939X"; | ||
1186 | ioc->bus_type = FC; | ||
1187 | ioc->errata_flag_1064 = 1; | ||
1188 | } | ||
1189 | else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC949X) { | ||
1190 | ioc->prod_name = "LSIFC949X"; | ||
1191 | ioc->bus_type = FC; | ||
1192 | ioc->errata_flag_1064 = 1; | ||
1193 | } | ||
1246 | else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) { | 1194 | else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) { |
1247 | ioc->prod_name = "LSI53C1030"; | 1195 | ioc->prod_name = "LSI53C1030"; |
1248 | ioc->bus_type = SCSI; | 1196 | ioc->bus_type = SCSI; |
@@ -1261,6 +1209,9 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1261 | ioc->bus_type = SCSI; | 1209 | ioc->bus_type = SCSI; |
1262 | } | 1210 | } |
1263 | 1211 | ||
1212 | if (ioc->errata_flag_1064) | ||
1213 | pci_disable_io_access(pdev); | ||
1214 | |||
1264 | sprintf(ioc->name, "ioc%d", ioc->id); | 1215 | sprintf(ioc->name, "ioc%d", ioc->id); |
1265 | 1216 | ||
1266 | spin_lock_init(&ioc->FreeQlock); | 1217 | spin_lock_init(&ioc->FreeQlock); |
@@ -1303,8 +1254,7 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1303 | #endif | 1254 | #endif |
1304 | } | 1255 | } |
1305 | 1256 | ||
1306 | /* NEW! 20010220 -sralston | 1257 | /* 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 | */ | 1258 | */ |
1309 | mpt_detect_bound_ports(ioc, pdev); | 1259 | mpt_detect_bound_ports(ioc, pdev); |
1310 | 1260 | ||
@@ -1354,13 +1304,13 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1354 | 1304 | ||
1355 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1305 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1356 | /* | 1306 | /* |
1357 | * mptbase_remove - Remove a PCI intelligent MPT adapter. | 1307 | * mpt_detach - Remove a PCI intelligent MPT adapter. |
1358 | * @pdev: Pointer to pci_dev structure | 1308 | * @pdev: Pointer to pci_dev structure |
1359 | * | 1309 | * |
1360 | */ | 1310 | */ |
1361 | 1311 | ||
1362 | static void __devexit | 1312 | void |
1363 | mptbase_remove(struct pci_dev *pdev) | 1313 | mpt_detach(struct pci_dev *pdev) |
1364 | { | 1314 | { |
1365 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1315 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1366 | char pname[32]; | 1316 | char pname[32]; |
@@ -1397,43 +1347,21 @@ mptbase_remove(struct pci_dev *pdev) | |||
1397 | pci_set_drvdata(pdev, NULL); | 1347 | pci_set_drvdata(pdev, NULL); |
1398 | } | 1348 | } |
1399 | 1349 | ||
1400 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
1401 | /* | ||
1402 | * mptbase_shutdown - | ||
1403 | * | ||
1404 | */ | ||
1405 | static void | ||
1406 | mptbase_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 | /************************************************************************** | 1350 | /************************************************************************** |
1422 | * Power Management | 1351 | * Power Management |
1423 | */ | 1352 | */ |
1424 | #ifdef CONFIG_PM | 1353 | #ifdef CONFIG_PM |
1425 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1354 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1426 | /* | 1355 | /* |
1427 | * mptbase_suspend - Fusion MPT base driver suspend routine. | 1356 | * mpt_suspend - Fusion MPT base driver suspend routine. |
1428 | * | 1357 | * |
1429 | * | 1358 | * |
1430 | */ | 1359 | */ |
1431 | static int | 1360 | int |
1432 | mptbase_suspend(struct pci_dev *pdev, pm_message_t state) | 1361 | mpt_suspend(struct pci_dev *pdev, pm_message_t state) |
1433 | { | 1362 | { |
1434 | u32 device_state; | 1363 | u32 device_state; |
1435 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1364 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1436 | int ii; | ||
1437 | 1365 | ||
1438 | switch(state) | 1366 | switch(state) |
1439 | { | 1367 | { |
@@ -1453,14 +1381,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", | 1381 | "pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n", |
1454 | ioc->name, pdev, pci_name(pdev), device_state); | 1382 | ioc->name, pdev, pci_name(pdev), device_state); |
1455 | 1383 | ||
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); | 1384 | pci_save_state(pdev); |
1465 | 1385 | ||
1466 | /* put ioc into READY_STATE */ | 1386 | /* put ioc into READY_STATE */ |
@@ -1484,18 +1404,18 @@ mptbase_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1484 | 1404 | ||
1485 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1405 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1486 | /* | 1406 | /* |
1487 | * mptbase_resume - Fusion MPT base driver resume routine. | 1407 | * mpt_resume - Fusion MPT base driver resume routine. |
1488 | * | 1408 | * |
1489 | * | 1409 | * |
1490 | */ | 1410 | */ |
1491 | static int | 1411 | int |
1492 | mptbase_resume(struct pci_dev *pdev) | 1412 | mpt_resume(struct pci_dev *pdev) |
1493 | { | 1413 | { |
1494 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1414 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1495 | u32 device_state = pdev->current_state; | 1415 | u32 device_state = pdev->current_state; |
1496 | int recovery_state; | 1416 | int recovery_state; |
1497 | int ii; | 1417 | int ii; |
1498 | 1418 | ||
1499 | printk(MYIOC_s_INFO_FMT | 1419 | printk(MYIOC_s_INFO_FMT |
1500 | "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", | 1420 | "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", |
1501 | ioc->name, pdev, pci_name(pdev), device_state); | 1421 | ioc->name, pdev, pci_name(pdev), device_state); |
@@ -1533,14 +1453,6 @@ mptbase_resume(struct pci_dev *pdev) | |||
1533 | "pci-resume: success\n", ioc->name); | 1453 | "pci-resume: success\n", ioc->name); |
1534 | } | 1454 | } |
1535 | 1455 | ||
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; | 1456 | return 0; |
1545 | } | 1457 | } |
1546 | #endif | 1458 | #endif |
@@ -1719,8 +1631,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1719 | ioc->alt_ioc->active = 1; | 1631 | ioc->alt_ioc->active = 1; |
1720 | } | 1632 | } |
1721 | 1633 | ||
1722 | /* NEW! 20010120 -sralston | 1634 | /* Enable MPT base driver management of EventNotification |
1723 | * Enable MPT base driver management of EventNotification | ||
1724 | * and EventAck handling. | 1635 | * and EventAck handling. |
1725 | */ | 1636 | */ |
1726 | if ((ret == 0) && (!ioc->facts.EventState)) | 1637 | if ((ret == 0) && (!ioc->facts.EventState)) |
@@ -1729,9 +1640,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) | 1640 | if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState) |
1730 | (void) SendEventNotification(ioc->alt_ioc, 1); /* 1=Enable EventNotification */ | 1641 | (void) SendEventNotification(ioc->alt_ioc, 1); /* 1=Enable EventNotification */ |
1731 | 1642 | ||
1732 | /* (Bugzilla:fibrebugs, #513) | 1643 | /* 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 | 1644 | * (combined with GetIoUnitPage2 call). This prevents a somewhat |
1736 | * recursive scenario; GetLanConfigPages times out, timer expired | 1645 | * recursive scenario; GetLanConfigPages times out, timer expired |
1737 | * routine calls HardResetHandler, which calls into here again, | 1646 | * routine calls HardResetHandler, which calls into here again, |
@@ -1829,37 +1738,43 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1829 | static void | 1738 | static void |
1830 | mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) | 1739 | mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) |
1831 | { | 1740 | { |
1832 | unsigned int match_lo, match_hi; | 1741 | struct pci_dev *peer=NULL; |
1742 | unsigned int slot = PCI_SLOT(pdev->devfn); | ||
1743 | unsigned int func = PCI_FUNC(pdev->devfn); | ||
1833 | MPT_ADAPTER *ioc_srch; | 1744 | MPT_ADAPTER *ioc_srch; |
1834 | 1745 | ||
1835 | match_lo = pdev->devfn-1; | 1746 | dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x," |
1836 | match_hi = pdev->devfn+1; | 1747 | " 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", | 1748 | ioc->name, pci_name(pdev), pdev->devfn, |
1838 | ioc->name, pdev->bus->number, pdev->devfn, match_lo, match_hi)); | 1749 | func-1, func+1)); |
1750 | |||
1751 | peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func-1)); | ||
1752 | if (!peer) { | ||
1753 | peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func+1)); | ||
1754 | if (!peer) | ||
1755 | return; | ||
1756 | } | ||
1839 | 1757 | ||
1840 | list_for_each_entry(ioc_srch, &ioc_list, list) { | 1758 | list_for_each_entry(ioc_srch, &ioc_list, list) { |
1841 | struct pci_dev *_pcidev = ioc_srch->pcidev; | 1759 | struct pci_dev *_pcidev = ioc_srch->pcidev; |
1842 | 1760 | 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 */ | 1761 | /* Paranoia checks */ |
1847 | if (ioc->alt_ioc != NULL) { | 1762 | if (ioc->alt_ioc != NULL) { |
1848 | printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", | 1763 | printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", |
1849 | ioc->name, ioc->alt_ioc->name); | 1764 | ioc->name, ioc->alt_ioc->name); |
1850 | break; | 1765 | break; |
1851 | } else if (ioc_srch->alt_ioc != NULL) { | 1766 | } else if (ioc_srch->alt_ioc != NULL) { |
1852 | printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", | 1767 | printk(KERN_WARNING MYNAM ": Oops, already bound (%s <==> %s)!\n", |
1853 | ioc_srch->name, ioc_srch->alt_ioc->name); | 1768 | ioc_srch->name, ioc_srch->alt_ioc->name); |
1854 | break; | 1769 | break; |
1855 | } | 1770 | } |
1856 | dprintk((KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n", | 1771 | dprintk((KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n", |
1857 | ioc->name, ioc_srch->name)); | 1772 | ioc->name, ioc_srch->name)); |
1858 | ioc_srch->alt_ioc = ioc; | 1773 | ioc_srch->alt_ioc = ioc; |
1859 | ioc->alt_ioc = ioc_srch; | 1774 | ioc->alt_ioc = ioc_srch; |
1860 | break; | ||
1861 | } | 1775 | } |
1862 | } | 1776 | } |
1777 | pci_dev_put(peer); | ||
1863 | } | 1778 | } |
1864 | 1779 | ||
1865 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1780 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -1922,15 +1837,10 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) | |||
1922 | ioc->alloc_total -= sz; | 1837 | ioc->alloc_total -= sz; |
1923 | } | 1838 | } |
1924 | 1839 | ||
1925 | if (ioc->spi_data.nvram != NULL) { | 1840 | kfree(ioc->spi_data.nvram); |
1926 | kfree(ioc->spi_data.nvram); | 1841 | kfree(ioc->spi_data.pIocPg3); |
1927 | ioc->spi_data.nvram = NULL; | 1842 | ioc->spi_data.nvram = NULL; |
1928 | } | 1843 | ioc->spi_data.pIocPg3 = NULL; |
1929 | |||
1930 | if (ioc->spi_data.pIocPg3 != NULL) { | ||
1931 | kfree(ioc->spi_data.pIocPg3); | ||
1932 | ioc->spi_data.pIocPg3 = NULL; | ||
1933 | } | ||
1934 | 1844 | ||
1935 | if (ioc->spi_data.pIocPg4 != NULL) { | 1845 | if (ioc->spi_data.pIocPg4 != NULL) { |
1936 | sz = ioc->spi_data.IocPg4Sz; | 1846 | sz = ioc->spi_data.IocPg4Sz; |
@@ -1947,10 +1857,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) | |||
1947 | ioc->ReqToChain = NULL; | 1857 | ioc->ReqToChain = NULL; |
1948 | } | 1858 | } |
1949 | 1859 | ||
1950 | if (ioc->ChainToChain != NULL) { | 1860 | kfree(ioc->ChainToChain); |
1951 | kfree(ioc->ChainToChain); | 1861 | ioc->ChainToChain = NULL; |
1952 | ioc->ChainToChain = NULL; | ||
1953 | } | ||
1954 | } | 1862 | } |
1955 | 1863 | ||
1956 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1864 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -2333,7 +2241,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) | |||
2333 | return -55; | 2241 | return -55; |
2334 | } | 2242 | } |
2335 | 2243 | ||
2336 | r = sz = le32_to_cpu(facts->BlockSize); | 2244 | r = sz = facts->BlockSize; |
2337 | vv = ((63 / (sz * 4)) + 1) & 0x03; | 2245 | vv = ((63 / (sz * 4)) + 1) & 0x03; |
2338 | ioc->NB_for_64_byte_frame = vv; | 2246 | ioc->NB_for_64_byte_frame = vv; |
2339 | while ( sz ) | 2247 | while ( sz ) |
@@ -2785,7 +2693,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, int sleepFlag) | |||
2785 | /* prevent a second downloadboot and memory free with alt_ioc */ | 2693 | /* prevent a second downloadboot and memory free with alt_ioc */ |
2786 | if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) | 2694 | if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) |
2787 | ioc->alt_ioc->cached_fw = NULL; | 2695 | ioc->alt_ioc->cached_fw = NULL; |
2788 | 2696 | ||
2789 | CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF); | 2697 | CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF); |
2790 | CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_1ST_KEY_VALUE); | 2698 | CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_1ST_KEY_VALUE); |
2791 | CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_2ND_KEY_VALUE); | 2699 | CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_2ND_KEY_VALUE); |
@@ -2843,6 +2751,9 @@ mpt_downloadboot(MPT_ADAPTER *ioc, int sleepFlag) | |||
2843 | /* Write the LoadStartAddress to the DiagRw Address Register | 2751 | /* Write the LoadStartAddress to the DiagRw Address Register |
2844 | * using Programmed IO | 2752 | * using Programmed IO |
2845 | */ | 2753 | */ |
2754 | if (ioc->errata_flag_1064) | ||
2755 | pci_enable_io_access(ioc->pcidev); | ||
2756 | |||
2846 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->LoadStartAddress); | 2757 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->LoadStartAddress); |
2847 | ddlprintk((MYIOC_s_INFO_FMT "LoadStart addr written 0x%x \n", | 2758 | ddlprintk((MYIOC_s_INFO_FMT "LoadStart addr written 0x%x \n", |
2848 | ioc->name, pFwHeader->LoadStartAddress)); | 2759 | ioc->name, pFwHeader->LoadStartAddress)); |
@@ -2889,6 +2800,9 @@ mpt_downloadboot(MPT_ADAPTER *ioc, int sleepFlag) | |||
2889 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, 0x3F000000); | 2800 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, 0x3F000000); |
2890 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, diagRwData); | 2801 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, diagRwData); |
2891 | 2802 | ||
2803 | if (ioc->errata_flag_1064) | ||
2804 | pci_disable_io_access(ioc->pcidev); | ||
2805 | |||
2892 | diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); | 2806 | diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); |
2893 | ddlprintk((MYIOC_s_INFO_FMT "downloadboot diag0val=%x, turning off PREVENT_IOC_BOOT, DISABLE_ARM\n", | 2807 | ddlprintk((MYIOC_s_INFO_FMT "downloadboot diag0val=%x, turning off PREVENT_IOC_BOOT, DISABLE_ARM\n", |
2894 | ioc->name, diag0val)); | 2808 | ioc->name, diag0val)); |
@@ -4250,7 +4164,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4250 | if ((ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD) || | 4164 | if ((ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD) || |
4251 | (ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE)) { | 4165 | (ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE)) { |
4252 | 4166 | ||
4253 | if (ioc->spi_data.minSyncFactor < MPT_ULTRA) | 4167 | if (ioc->spi_data.minSyncFactor < MPT_ULTRA) |
4254 | ioc->spi_data.minSyncFactor = MPT_ULTRA; | 4168 | ioc->spi_data.minSyncFactor = MPT_ULTRA; |
4255 | } | 4169 | } |
4256 | } | 4170 | } |
@@ -4482,10 +4396,8 @@ mpt_read_ioc_pg_3(MPT_ADAPTER *ioc) | |||
4482 | 4396 | ||
4483 | /* Free the old page | 4397 | /* Free the old page |
4484 | */ | 4398 | */ |
4485 | if (ioc->spi_data.pIocPg3) { | 4399 | kfree(ioc->spi_data.pIocPg3); |
4486 | kfree(ioc->spi_data.pIocPg3); | 4400 | ioc->spi_data.pIocPg3 = NULL; |
4487 | ioc->spi_data.pIocPg3 = NULL; | ||
4488 | } | ||
4489 | 4401 | ||
4490 | /* There is at least one physical disk. | 4402 | /* There is at least one physical disk. |
4491 | * Read and save IOC Page 3 | 4403 | * Read and save IOC Page 3 |
@@ -4753,9 +4665,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | |||
4753 | u32 flagsLength; | 4665 | u32 flagsLength; |
4754 | int in_isr; | 4666 | int in_isr; |
4755 | 4667 | ||
4756 | /* (Bugzilla:fibrebugs, #513) | 4668 | /* 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! | 4669 | * to be in ISR context, because that is fatal! |
4760 | */ | 4670 | */ |
4761 | in_isr = in_interrupt(); | 4671 | in_isr = in_interrupt(); |
@@ -4861,9 +4771,7 @@ mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | |||
4861 | u32 flagsLength; | 4771 | u32 flagsLength; |
4862 | int in_isr; | 4772 | int in_isr; |
4863 | 4773 | ||
4864 | /* (Bugzilla:fibrebugs, #513) | 4774 | /* 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! | 4775 | * to be in ISR context, because that is fatal! |
4868 | */ | 4776 | */ |
4869 | in_isr = in_interrupt(); | 4777 | in_isr = in_interrupt(); |
@@ -5130,20 +5038,26 @@ static int | |||
5130 | procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) | 5038 | procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) |
5131 | { | 5039 | { |
5132 | int ii; | 5040 | int ii; |
5133 | int scsi, lan, ctl, targ, dmp; | 5041 | int scsi, fc, sas, lan, ctl, targ, dmp; |
5134 | char *drvname; | 5042 | char *drvname; |
5135 | int len; | 5043 | int len; |
5136 | 5044 | ||
5137 | len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); | 5045 | len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); |
5138 | len += sprintf(buf+len, " Fusion MPT base driver\n"); | 5046 | len += sprintf(buf+len, " Fusion MPT base driver\n"); |
5139 | 5047 | ||
5140 | scsi = lan = ctl = targ = dmp = 0; | 5048 | scsi = fc = sas = lan = ctl = targ = dmp = 0; |
5141 | for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { | 5049 | for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { |
5142 | drvname = NULL; | 5050 | drvname = NULL; |
5143 | if (MptCallbacks[ii]) { | 5051 | if (MptCallbacks[ii]) { |
5144 | switch (MptDriverClass[ii]) { | 5052 | switch (MptDriverClass[ii]) { |
5145 | case MPTSCSIH_DRIVER: | 5053 | case MPTSPI_DRIVER: |
5146 | if (!scsi++) drvname = "SCSI host"; | 5054 | if (!scsi++) drvname = "SPI host"; |
5055 | break; | ||
5056 | case MPTFC_DRIVER: | ||
5057 | if (!fc++) drvname = "FC host"; | ||
5058 | break; | ||
5059 | case MPTSAS_DRIVER: | ||
5060 | if (!sas++) drvname = "SAS host"; | ||
5147 | break; | 5061 | break; |
5148 | case MPTLAN_DRIVER: | 5062 | case MPTLAN_DRIVER: |
5149 | if (!lan++) drvname = "LAN"; | 5063 | if (!lan++) drvname = "LAN"; |
@@ -5832,6 +5746,12 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf) | |||
5832 | } | 5746 | } |
5833 | 5747 | ||
5834 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5748 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5749 | EXPORT_SYMBOL(mpt_attach); | ||
5750 | EXPORT_SYMBOL(mpt_detach); | ||
5751 | #ifdef CONFIG_PM | ||
5752 | EXPORT_SYMBOL(mpt_resume); | ||
5753 | EXPORT_SYMBOL(mpt_suspend); | ||
5754 | #endif | ||
5835 | EXPORT_SYMBOL(ioc_list); | 5755 | EXPORT_SYMBOL(ioc_list); |
5836 | EXPORT_SYMBOL(mpt_proc_root_dir); | 5756 | EXPORT_SYMBOL(mpt_proc_root_dir); |
5837 | EXPORT_SYMBOL(mpt_register); | 5757 | EXPORT_SYMBOL(mpt_register); |
@@ -5860,19 +5780,6 @@ EXPORT_SYMBOL(mpt_read_ioc_pg_3); | |||
5860 | EXPORT_SYMBOL(mpt_alloc_fw_memory); | 5780 | EXPORT_SYMBOL(mpt_alloc_fw_memory); |
5861 | EXPORT_SYMBOL(mpt_free_fw_memory); | 5781 | EXPORT_SYMBOL(mpt_free_fw_memory); |
5862 | 5782 | ||
5863 | static 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 | 5783 | ||
5877 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5784 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5878 | /* | 5785 | /* |
@@ -5884,7 +5791,6 @@ static int __init | |||
5884 | fusion_init(void) | 5791 | fusion_init(void) |
5885 | { | 5792 | { |
5886 | int i; | 5793 | int i; |
5887 | int r; | ||
5888 | 5794 | ||
5889 | show_mptmod_ver(my_NAME, my_VERSION); | 5795 | show_mptmod_ver(my_NAME, my_VERSION); |
5890 | printk(KERN_INFO COPYRIGHT "\n"); | 5796 | printk(KERN_INFO COPYRIGHT "\n"); |
@@ -5896,8 +5802,7 @@ fusion_init(void) | |||
5896 | MptResetHandlers[i] = NULL; | 5802 | MptResetHandlers[i] = NULL; |
5897 | } | 5803 | } |
5898 | 5804 | ||
5899 | /* NEW! 20010120 -sralston | 5805 | /* Register ourselves (mptbase) in order to facilitate |
5900 | * Register ourselves (mptbase) in order to facilitate | ||
5901 | * EventNotification handling. | 5806 | * EventNotification handling. |
5902 | */ | 5807 | */ |
5903 | mpt_base_index = mpt_register(mpt_base_reply, MPTBASE_DRIVER); | 5808 | mpt_base_index = mpt_register(mpt_base_reply, MPTBASE_DRIVER); |
@@ -5913,11 +5818,7 @@ fusion_init(void) | |||
5913 | #ifdef CONFIG_PROC_FS | 5818 | #ifdef CONFIG_PROC_FS |
5914 | (void) procmpt_create(); | 5819 | (void) procmpt_create(); |
5915 | #endif | 5820 | #endif |
5916 | r = pci_register_driver(&mptbase_driver); | 5821 | return 0; |
5917 | if(r) | ||
5918 | return(r); | ||
5919 | |||
5920 | return r; | ||
5921 | } | 5822 | } |
5922 | 5823 | ||
5923 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5824 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -5933,7 +5834,6 @@ fusion_exit(void) | |||
5933 | 5834 | ||
5934 | dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n")); | 5835 | dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n")); |
5935 | 5836 | ||
5936 | pci_unregister_driver(&mptbase_driver); | ||
5937 | mpt_reset_deregister(mpt_base_index); | 5837 | mpt_reset_deregister(mpt_base_index); |
5938 | 5838 | ||
5939 | #ifdef CONFIG_PROC_FS | 5839 | #ifdef CONFIG_PROC_FS |
@@ -5941,6 +5841,5 @@ fusion_exit(void) | |||
5941 | #endif | 5841 | #endif |
5942 | } | 5842 | } |
5943 | 5843 | ||
5944 | |||
5945 | module_init(fusion_init); | 5844 | module_init(fusion_init); |
5946 | module_exit(fusion_exit); | 5845 | module_exit(fusion_exit); |