diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 0351d380c2d7..a5bcf1f390b3 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1482,6 +1482,17 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1482 | unsigned long pio, pio_len, pio_flags; | 1482 | unsigned long pio, pio_len, pio_flags; |
1483 | unsigned long mmio, mmio_len, mmio_flags; | 1483 | unsigned long mmio, mmio_len, mmio_flags; |
1484 | 1484 | ||
1485 | if (pci_request_selected_regions(ha->pdev, ha->bars, | ||
1486 | QLA2XXX_DRIVER_NAME)) { | ||
1487 | qla_printk(KERN_WARNING, ha, | ||
1488 | "Failed to reserve PIO/MMIO regions (%s)\n", | ||
1489 | pci_name(ha->pdev)); | ||
1490 | |||
1491 | goto iospace_error_exit; | ||
1492 | } | ||
1493 | if (!(ha->bars & 1)) | ||
1494 | goto skip_pio; | ||
1495 | |||
1485 | /* We only need PIO for Flash operations on ISP2312 v2 chips. */ | 1496 | /* We only need PIO for Flash operations on ISP2312 v2 chips. */ |
1486 | pio = pci_resource_start(ha->pdev, 0); | 1497 | pio = pci_resource_start(ha->pdev, 0); |
1487 | pio_len = pci_resource_len(ha->pdev, 0); | 1498 | pio_len = pci_resource_len(ha->pdev, 0); |
@@ -1499,7 +1510,10 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1499 | pci_name(ha->pdev)); | 1510 | pci_name(ha->pdev)); |
1500 | pio = 0; | 1511 | pio = 0; |
1501 | } | 1512 | } |
1513 | ha->pio_address = pio; | ||
1514 | ha->pio_length = pio_len; | ||
1502 | 1515 | ||
1516 | skip_pio: | ||
1503 | /* Use MMIO operations for all accesses. */ | 1517 | /* Use MMIO operations for all accesses. */ |
1504 | mmio = pci_resource_start(ha->pdev, 1); | 1518 | mmio = pci_resource_start(ha->pdev, 1); |
1505 | mmio_len = pci_resource_len(ha->pdev, 1); | 1519 | mmio_len = pci_resource_len(ha->pdev, 1); |
@@ -1518,16 +1532,6 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1518 | goto iospace_error_exit; | 1532 | goto iospace_error_exit; |
1519 | } | 1533 | } |
1520 | 1534 | ||
1521 | if (pci_request_regions(ha->pdev, QLA2XXX_DRIVER_NAME)) { | ||
1522 | qla_printk(KERN_WARNING, ha, | ||
1523 | "Failed to reserve PIO/MMIO regions (%s)\n", | ||
1524 | pci_name(ha->pdev)); | ||
1525 | |||
1526 | goto iospace_error_exit; | ||
1527 | } | ||
1528 | |||
1529 | ha->pio_address = pio; | ||
1530 | ha->pio_length = pio_len; | ||
1531 | ha->iobase = ioremap(mmio, MIN_IOBASE_LEN); | 1535 | ha->iobase = ioremap(mmio, MIN_IOBASE_LEN); |
1532 | if (!ha->iobase) { | 1536 | if (!ha->iobase) { |
1533 | qla_printk(KERN_ERR, ha, | 1537 | qla_printk(KERN_ERR, ha, |
@@ -1579,21 +1583,26 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1579 | char pci_info[30]; | 1583 | char pci_info[30]; |
1580 | char fw_str[30]; | 1584 | char fw_str[30]; |
1581 | struct scsi_host_template *sht; | 1585 | struct scsi_host_template *sht; |
1586 | int bars; | ||
1582 | 1587 | ||
1583 | if (pci_enable_device(pdev)) | 1588 | bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); |
1584 | goto probe_out; | ||
1585 | |||
1586 | if (pci_find_aer_capability(pdev)) | ||
1587 | if (pci_enable_pcie_error_reporting(pdev)) | ||
1588 | goto probe_out; | ||
1589 | |||
1590 | sht = &qla2x00_driver_template; | 1589 | sht = &qla2x00_driver_template; |
1591 | if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || | 1590 | if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || |
1592 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || | 1591 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || |
1593 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || | 1592 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || |
1594 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || | 1593 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || |
1595 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) | 1594 | pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) { |
1595 | bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1596 | sht = &qla24xx_driver_template; | 1596 | sht = &qla24xx_driver_template; |
1597 | } | ||
1598 | |||
1599 | if (pci_enable_device_bars(pdev, bars)) | ||
1600 | goto probe_out; | ||
1601 | |||
1602 | if (pci_find_aer_capability(pdev)) | ||
1603 | if (pci_enable_pcie_error_reporting(pdev)) | ||
1604 | goto probe_out; | ||
1605 | |||
1597 | host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t)); | 1606 | host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t)); |
1598 | if (host == NULL) { | 1607 | if (host == NULL) { |
1599 | printk(KERN_WARNING | 1608 | printk(KERN_WARNING |
@@ -1610,6 +1619,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1610 | ha->host_no = host->host_no; | 1619 | ha->host_no = host->host_no; |
1611 | sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no); | 1620 | sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no); |
1612 | ha->parent = NULL; | 1621 | ha->parent = NULL; |
1622 | ha->bars = bars; | ||
1613 | 1623 | ||
1614 | /* Set ISP-type information. */ | 1624 | /* Set ISP-type information. */ |
1615 | qla2x00_set_isp_flags(ha); | 1625 | qla2x00_set_isp_flags(ha); |
@@ -1880,7 +1890,7 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1880 | /* release io space registers */ | 1890 | /* release io space registers */ |
1881 | if (ha->iobase) | 1891 | if (ha->iobase) |
1882 | iounmap(ha->iobase); | 1892 | iounmap(ha->iobase); |
1883 | pci_release_regions(ha->pdev); | 1893 | pci_release_selected_regions(ha->pdev, ha->bars); |
1884 | } | 1894 | } |
1885 | 1895 | ||
1886 | static inline void | 1896 | static inline void |
@@ -2890,7 +2900,7 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev) | |||
2890 | pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; | 2900 | pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; |
2891 | scsi_qla_host_t *ha = pci_get_drvdata(pdev); | 2901 | scsi_qla_host_t *ha = pci_get_drvdata(pdev); |
2892 | 2902 | ||
2893 | if (pci_enable_device(pdev)) { | 2903 | if (pci_enable_device_bars(pdev, ha->bars)) { |
2894 | qla_printk(KERN_WARNING, ha, | 2904 | qla_printk(KERN_WARNING, ha, |
2895 | "Can't re-enable PCI device after reset.\n"); | 2905 | "Can't re-enable PCI device after reset.\n"); |
2896 | 2906 | ||