diff options
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
| -rw-r--r-- | drivers/message/fusion/mptbase.c | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 537836068c49..d890b2b8a93e 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
| @@ -148,7 +148,6 @@ static int WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag); | |||
| 148 | static int WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag); | 148 | static int WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag); |
| 149 | static int WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag); | 149 | static int WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag); |
| 150 | static int GetLanConfigPages(MPT_ADAPTER *ioc); | 150 | static int GetLanConfigPages(MPT_ADAPTER *ioc); |
| 151 | static int GetFcPortPage0(MPT_ADAPTER *ioc, int portnum); | ||
| 152 | static int GetIoUnitPage2(MPT_ADAPTER *ioc); | 151 | static int GetIoUnitPage2(MPT_ADAPTER *ioc); |
| 153 | int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); | 152 | int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); |
| 154 | static int mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum); | 153 | static int mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum); |
| @@ -1232,12 +1231,11 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1232 | dprintk((KERN_INFO MYNAM | 1231 | dprintk((KERN_INFO MYNAM |
| 1233 | ": Not using 64 bit consistent mask\n")); | 1232 | ": Not using 64 bit consistent mask\n")); |
| 1234 | 1233 | ||
| 1235 | ioc = kmalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); | 1234 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); |
| 1236 | if (ioc == NULL) { | 1235 | if (ioc == NULL) { |
| 1237 | printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); | 1236 | printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); |
| 1238 | return -ENOMEM; | 1237 | return -ENOMEM; |
| 1239 | } | 1238 | } |
| 1240 | memset(ioc, 0, sizeof(MPT_ADAPTER)); | ||
| 1241 | ioc->alloc_total = sizeof(MPT_ADAPTER); | 1239 | ioc->alloc_total = sizeof(MPT_ADAPTER); |
| 1242 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ | 1240 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ |
| 1243 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; | 1241 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; |
| @@ -1245,6 +1243,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1245 | ioc->pcidev = pdev; | 1243 | ioc->pcidev = pdev; |
| 1246 | ioc->diagPending = 0; | 1244 | ioc->diagPending = 0; |
| 1247 | spin_lock_init(&ioc->diagLock); | 1245 | spin_lock_init(&ioc->diagLock); |
| 1246 | spin_lock_init(&ioc->fc_rescan_work_lock); | ||
| 1247 | spin_lock_init(&ioc->fc_rport_lock); | ||
| 1248 | spin_lock_init(&ioc->initializing_hba_lock); | 1248 | spin_lock_init(&ioc->initializing_hba_lock); |
| 1249 | 1249 | ||
| 1250 | /* Initialize the event logging. | 1250 | /* Initialize the event logging. |
| @@ -1268,6 +1268,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1268 | */ | 1268 | */ |
| 1269 | INIT_LIST_HEAD(&ioc->configQ); | 1269 | INIT_LIST_HEAD(&ioc->configQ); |
| 1270 | 1270 | ||
| 1271 | /* Initialize the fc rport list head. | ||
| 1272 | */ | ||
| 1273 | INIT_LIST_HEAD(&ioc->fc_rports); | ||
| 1274 | |||
| 1271 | /* Find lookup slot. */ | 1275 | /* Find lookup slot. */ |
| 1272 | INIT_LIST_HEAD(&ioc->list); | 1276 | INIT_LIST_HEAD(&ioc->list); |
| 1273 | ioc->id = mpt_ids++; | 1277 | ioc->id = mpt_ids++; |
| @@ -1374,6 +1378,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1374 | ioc->bus_type = FC; | 1378 | ioc->bus_type = FC; |
| 1375 | ioc->errata_flag_1064 = 1; | 1379 | ioc->errata_flag_1064 = 1; |
| 1376 | } | 1380 | } |
| 1381 | else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC949E) { | ||
| 1382 | ioc->prod_name = "LSIFC949E"; | ||
| 1383 | ioc->bus_type = FC; | ||
| 1384 | } | ||
| 1377 | else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) { | 1385 | else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) { |
| 1378 | ioc->prod_name = "LSI53C1030"; | 1386 | ioc->prod_name = "LSI53C1030"; |
| 1379 | ioc->bus_type = SPI; | 1387 | ioc->bus_type = SPI; |
| @@ -1622,7 +1630,7 @@ mpt_resume(struct pci_dev *pdev) | |||
| 1622 | pci_enable_device(pdev); | 1630 | pci_enable_device(pdev); |
| 1623 | 1631 | ||
| 1624 | /* enable interrupts */ | 1632 | /* enable interrupts */ |
| 1625 | CHIPREG_WRITE32(&ioc->chip->IntMask, ~(MPI_HIM_RIM)); | 1633 | CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); |
| 1626 | ioc->active = 1; | 1634 | ioc->active = 1; |
| 1627 | 1635 | ||
| 1628 | /* F/W not running */ | 1636 | /* F/W not running */ |
| @@ -1715,7 +1723,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
| 1715 | /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */ | 1723 | /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */ |
| 1716 | dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", | 1724 | dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", |
| 1717 | ioc->alt_ioc->name)); | 1725 | ioc->alt_ioc->name)); |
| 1718 | CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM)); | 1726 | CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM); |
| 1719 | ioc->alt_ioc->active = 1; | 1727 | ioc->alt_ioc->active = 1; |
| 1720 | } | 1728 | } |
| 1721 | 1729 | ||
| @@ -1831,7 +1839,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
| 1831 | 1839 | ||
| 1832 | if (ret == 0) { | 1840 | if (ret == 0) { |
| 1833 | /* Enable! (reply interrupt) */ | 1841 | /* Enable! (reply interrupt) */ |
| 1834 | CHIPREG_WRITE32(&ioc->chip->IntMask, ~(MPI_HIM_RIM)); | 1842 | CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); |
| 1835 | ioc->active = 1; | 1843 | ioc->active = 1; |
| 1836 | } | 1844 | } |
| 1837 | 1845 | ||
| @@ -1839,7 +1847,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
| 1839 | /* (re)Enable alt-IOC! (reply interrupt) */ | 1847 | /* (re)Enable alt-IOC! (reply interrupt) */ |
| 1840 | dinitprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", | 1848 | dinitprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", |
| 1841 | ioc->alt_ioc->name)); | 1849 | ioc->alt_ioc->name)); |
| 1842 | CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM)); | 1850 | CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM); |
| 1843 | ioc->alt_ioc->active = 1; | 1851 | ioc->alt_ioc->active = 1; |
| 1844 | } | 1852 | } |
| 1845 | 1853 | ||
| @@ -1880,7 +1888,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
| 1880 | * (FCPortPage0_t stuff) | 1888 | * (FCPortPage0_t stuff) |
| 1881 | */ | 1889 | */ |
| 1882 | for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { | 1890 | for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { |
| 1883 | (void) GetFcPortPage0(ioc, ii); | 1891 | (void) mptbase_GetFcPortPage0(ioc, ii); |
| 1884 | } | 1892 | } |
| 1885 | 1893 | ||
| 1886 | if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) && | 1894 | if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) && |
| @@ -4199,7 +4207,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc) | |||
| 4199 | 4207 | ||
| 4200 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4208 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
| 4201 | /* | 4209 | /* |
| 4202 | * GetFcPortPage0 - Fetch FCPort config Page0. | 4210 | * mptbase_GetFcPortPage0 - Fetch FCPort config Page0. |
| 4203 | * @ioc: Pointer to MPT_ADAPTER structure | 4211 | * @ioc: Pointer to MPT_ADAPTER structure |
| 4204 | * @portnum: IOC Port number | 4212 | * @portnum: IOC Port number |
| 4205 | * | 4213 | * |
| @@ -4209,8 +4217,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc) | |||
| 4209 | * -EAGAIN if no msg frames currently available | 4217 | * -EAGAIN if no msg frames currently available |
| 4210 | * -EFAULT for non-successful reply or no reply (timeout) | 4218 | * -EFAULT for non-successful reply or no reply (timeout) |
| 4211 | */ | 4219 | */ |
| 4212 | static int | 4220 | int |
| 4213 | GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) | 4221 | mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) |
| 4214 | { | 4222 | { |
| 4215 | ConfigPageHeader_t hdr; | 4223 | ConfigPageHeader_t hdr; |
| 4216 | CONFIGPARMS cfg; | 4224 | CONFIGPARMS cfg; |
| @@ -4220,6 +4228,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) | |||
| 4220 | int data_sz; | 4228 | int data_sz; |
| 4221 | int copy_sz; | 4229 | int copy_sz; |
| 4222 | int rc; | 4230 | int rc; |
| 4231 | int count = 400; | ||
| 4232 | |||
| 4223 | 4233 | ||
| 4224 | /* Get FCPort Page 0 header */ | 4234 | /* Get FCPort Page 0 header */ |
| 4225 | hdr.PageVersion = 0; | 4235 | hdr.PageVersion = 0; |
| @@ -4243,6 +4253,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) | |||
| 4243 | rc = -ENOMEM; | 4253 | rc = -ENOMEM; |
| 4244 | ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); | 4254 | ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); |
| 4245 | if (ppage0_alloc) { | 4255 | if (ppage0_alloc) { |
| 4256 | |||
| 4257 | try_again: | ||
| 4246 | memset((u8 *)ppage0_alloc, 0, data_sz); | 4258 | memset((u8 *)ppage0_alloc, 0, data_sz); |
| 4247 | cfg.physAddr = page0_dma; | 4259 | cfg.physAddr = page0_dma; |
| 4248 | cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; | 4260 | cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; |
| @@ -4274,6 +4286,19 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) | |||
| 4274 | pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount); | 4286 | pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount); |
| 4275 | pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators); | 4287 | pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators); |
| 4276 | 4288 | ||
| 4289 | /* | ||
| 4290 | * if still doing discovery, | ||
| 4291 | * hang loose a while until finished | ||
| 4292 | */ | ||
| 4293 | if (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) { | ||
| 4294 | if (count-- > 0) { | ||
| 4295 | msleep_interruptible(100); | ||
| 4296 | goto try_again; | ||
| 4297 | } | ||
| 4298 | printk(MYIOC_s_INFO_FMT "Firmware discovery not" | ||
| 4299 | " complete.\n", | ||
| 4300 | ioc->name); | ||
| 4301 | } | ||
| 4277 | } | 4302 | } |
| 4278 | 4303 | ||
| 4279 | pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); | 4304 | pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); |
| @@ -6358,6 +6383,7 @@ EXPORT_SYMBOL(mpt_alloc_fw_memory); | |||
| 6358 | EXPORT_SYMBOL(mpt_free_fw_memory); | 6383 | EXPORT_SYMBOL(mpt_free_fw_memory); |
| 6359 | EXPORT_SYMBOL(mptbase_sas_persist_operation); | 6384 | EXPORT_SYMBOL(mptbase_sas_persist_operation); |
| 6360 | EXPORT_SYMBOL(mpt_alt_ioc_wait); | 6385 | EXPORT_SYMBOL(mpt_alt_ioc_wait); |
| 6386 | EXPORT_SYMBOL(mptbase_GetFcPortPage0); | ||
| 6361 | 6387 | ||
| 6362 | 6388 | ||
| 6363 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6389 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
