aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptbase.c88
1 files changed, 50 insertions, 38 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 266414ca2814..bb7ad4d0678a 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1387,39 +1387,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1387 /* Set lookup ptr. */ 1387 /* Set lookup ptr. */
1388 list_add_tail(&ioc->list, &ioc_list); 1388 list_add_tail(&ioc->list, &ioc_list);
1389 1389
1390 ioc->pci_irq = -1;
1391 if (pdev->irq) {
1392 if (mpt_msi_enable && !pci_enable_msi(pdev))
1393 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name);
1394
1395 r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc);
1396
1397 if (r < 0) {
1398#ifndef __sparc__
1399 printk(MYIOC_s_ERR_FMT "Unable to allocate interrupt %d!\n",
1400 ioc->name, pdev->irq);
1401#else
1402 printk(MYIOC_s_ERR_FMT "Unable to allocate interrupt %s!\n",
1403 ioc->name, __irq_itoa(pdev->irq));
1404#endif
1405 list_del(&ioc->list);
1406 iounmap(mem);
1407 kfree(ioc);
1408 return -EBUSY;
1409 }
1410
1411 ioc->pci_irq = pdev->irq;
1412
1413 pci_set_master(pdev); /* ?? */
1414 pci_set_drvdata(pdev, ioc);
1415
1416#ifndef __sparc__
1417 dprintk((KERN_INFO MYNAM ": %s installed at interrupt %d\n", ioc->name, pdev->irq));
1418#else
1419 dprintk((KERN_INFO MYNAM ": %s installed at interrupt %s\n", ioc->name, __irq_itoa(pdev->irq)));
1420#endif
1421 }
1422
1423 /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets. 1390 /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
1424 */ 1391 */
1425 mpt_detect_bound_ports(ioc, pdev); 1392 mpt_detect_bound_ports(ioc, pdev);
@@ -1429,11 +1396,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1429 printk(KERN_WARNING MYNAM 1396 printk(KERN_WARNING MYNAM
1430 ": WARNING - %s did not initialize properly! (%d)\n", 1397 ": WARNING - %s did not initialize properly! (%d)\n",
1431 ioc->name, r); 1398 ioc->name, r);
1432
1433 list_del(&ioc->list); 1399 list_del(&ioc->list);
1434 free_irq(ioc->pci_irq, ioc);
1435 if (mpt_msi_enable)
1436 pci_disable_msi(pdev);
1437 if (ioc->alt_ioc) 1400 if (ioc->alt_ioc)
1438 ioc->alt_ioc->alt_ioc = NULL; 1401 ioc->alt_ioc->alt_ioc = NULL;
1439 iounmap(mem); 1402 iounmap(mem);
@@ -1637,6 +1600,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1637 int handlers; 1600 int handlers;
1638 int ret = 0; 1601 int ret = 0;
1639 int reset_alt_ioc_active = 0; 1602 int reset_alt_ioc_active = 0;
1603 int irq_allocated = 0;
1640 1604
1641 printk(KERN_INFO MYNAM ": Initiating %s %s\n", 1605 printk(KERN_INFO MYNAM ": Initiating %s %s\n",
1642 ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery"); 1606 ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery");
@@ -1720,6 +1684,48 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1720 } 1684 }
1721 } 1685 }
1722 1686
1687 /*
1688 * Device is reset now. It must have de-asserted the interrupt line
1689 * (if it was asserted) and it should be safe to register for the
1690 * interrupt now.
1691 */
1692 if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
1693 ioc->pci_irq = -1;
1694 if (ioc->pcidev->irq) {
1695 if (mpt_msi_enable && !pci_enable_msi(ioc->pcidev))
1696 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n",
1697 ioc->name);
1698 rc = request_irq(ioc->pcidev->irq, mpt_interrupt,
1699 SA_SHIRQ, ioc->name, ioc);
1700 if (rc < 0) {
1701#ifndef __sparc__
1702 printk(MYIOC_s_ERR_FMT "Unable to allocate "
1703 "interrupt %d!\n", ioc->name,
1704 ioc->pcidev->irq);
1705#else
1706 printk(MYIOC_s_ERR_FMT "Unable to allocate "
1707 "interrupt %s!\n", ioc->name,
1708 __irq_itoa(ioc->pcidev->irq));
1709#endif
1710 if (mpt_msi_enable)
1711 pci_disable_msi(ioc->pcidev);
1712 return -EBUSY;
1713 }
1714 irq_allocated = 1;
1715 ioc->pci_irq = ioc->pcidev->irq;
1716 pci_set_master(ioc->pcidev); /* ?? */
1717 pci_set_drvdata(ioc->pcidev, ioc);
1718#ifndef __sparc__
1719 dprintk((KERN_INFO MYNAM ": %s installed at interrupt "
1720 "%d\n", ioc->name, ioc->pcidev->irq));
1721#else
1722 dprintk((KERN_INFO MYNAM ": %s installed at interrupt "
1723 "%s\n", ioc->name,
1724 __irq_itoa(ioc->pcidev->irq)));
1725#endif
1726 }
1727 }
1728
1723 /* Prime reply & request queues! 1729 /* Prime reply & request queues!
1724 * (mucho alloc's) Must be done prior to 1730 * (mucho alloc's) Must be done prior to
1725 * init as upper addresses are needed for init. 1731 * init as upper addresses are needed for init.
@@ -1819,7 +1825,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1819 ret = mptbase_sas_persist_operation(ioc, 1825 ret = mptbase_sas_persist_operation(ioc,
1820 MPI_SAS_OP_CLEAR_NOT_PRESENT); 1826 MPI_SAS_OP_CLEAR_NOT_PRESENT);
1821 if(ret != 0) 1827 if(ret != 0)
1822 return -1; 1828 goto out;
1823 } 1829 }
1824 1830
1825 /* Find IM volumes 1831 /* Find IM volumes
@@ -1900,6 +1906,12 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1900 /* FIXME? Examine results here? */ 1906 /* FIXME? Examine results here? */
1901 } 1907 }
1902 1908
1909out:
1910 if ((ret != 0) && irq_allocated) {
1911 free_irq(ioc->pci_irq, ioc);
1912 if (mpt_msi_enable)
1913 pci_disable_msi(ioc->pcidev);
1914 }
1903 return ret; 1915 return ret;
1904} 1916}
1905 1917