[SCSI] qla2xxx: Make driver (mostly) legacy I/O port free.

Recent ISPs need only the single MMIO BAR to manipulate HW
registers. Unfortunately, ISP21xx, ISP22xx, ISP23xx, and ISP63xx
type cards still require the I/O mapped region to manipulate the
FLASH via the two HW flash-registers (flash_address and
flash_data).

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by Andrew Vasquez and committed by James Bottomley 285d0321 94d6a2b3

+31 -20
+1
drivers/scsi/qla2xxx/qla_def.h
··· 2271 2272 spinlock_t hardware_lock ____cacheline_aligned; 2273 2274 device_reg_t __iomem *iobase; /* Base I/O address */ 2275 unsigned long pio_address; 2276 unsigned long pio_length;
··· 2271 2272 spinlock_t hardware_lock ____cacheline_aligned; 2273 2274 + int bars; 2275 device_reg_t __iomem *iobase; /* Base I/O address */ 2276 unsigned long pio_address; 2277 unsigned long pio_length;
+30 -20
drivers/scsi/qla2xxx/qla_os.c
··· 1482 unsigned long pio, pio_len, pio_flags; 1483 unsigned long mmio, mmio_len, mmio_flags; 1484 1485 /* We only need PIO for Flash operations on ISP2312 v2 chips. */ 1486 pio = pci_resource_start(ha->pdev, 0); 1487 pio_len = pci_resource_len(ha->pdev, 0); ··· 1510 pci_name(ha->pdev)); 1511 pio = 0; 1512 } 1513 1514 /* Use MMIO operations for all accesses. */ 1515 mmio = pci_resource_start(ha->pdev, 1); 1516 mmio_len = pci_resource_len(ha->pdev, 1); ··· 1532 goto iospace_error_exit; 1533 } 1534 1535 - if (pci_request_regions(ha->pdev, QLA2XXX_DRIVER_NAME)) { 1536 - qla_printk(KERN_WARNING, ha, 1537 - "Failed to reserve PIO/MMIO regions (%s)\n", 1538 - pci_name(ha->pdev)); 1539 - 1540 - goto iospace_error_exit; 1541 - } 1542 - 1543 - ha->pio_address = pio; 1544 - ha->pio_length = pio_len; 1545 ha->iobase = ioremap(mmio, MIN_IOBASE_LEN); 1546 if (!ha->iobase) { 1547 qla_printk(KERN_ERR, ha, ··· 1583 char pci_info[30]; 1584 char fw_str[30]; 1585 struct scsi_host_template *sht; 1586 1587 - if (pci_enable_device(pdev)) 1588 goto probe_out; 1589 1590 if (pci_find_aer_capability(pdev)) 1591 if (pci_enable_pcie_error_reporting(pdev)) 1592 goto probe_out; 1593 1594 - sht = &qla2x00_driver_template; 1595 - if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || 1596 - pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || 1597 - pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || 1598 - pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || 1599 - pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) 1600 - sht = &qla24xx_driver_template; 1601 host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t)); 1602 if (host == NULL) { 1603 printk(KERN_WARNING ··· 1619 ha->host_no = host->host_no; 1620 sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no); 1621 ha->parent = NULL; 1622 1623 /* Set ISP-type information. */ 1624 qla2x00_set_isp_flags(ha); ··· 1890 /* release io space registers */ 1891 if (ha->iobase) 1892 iounmap(ha->iobase); 1893 - pci_release_regions(ha->pdev); 1894 } 1895 1896 static inline void ··· 2900 pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; 2901 scsi_qla_host_t *ha = pci_get_drvdata(pdev); 2902 2903 - if (pci_enable_device(pdev)) { 2904 qla_printk(KERN_WARNING, ha, 2905 "Can't re-enable PCI device after reset.\n"); 2906
··· 1482 unsigned long pio, pio_len, pio_flags; 1483 unsigned long mmio, mmio_len, mmio_flags; 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 + 1496 /* We only need PIO for Flash operations on ISP2312 v2 chips. */ 1497 pio = pci_resource_start(ha->pdev, 0); 1498 pio_len = pci_resource_len(ha->pdev, 0); ··· 1499 pci_name(ha->pdev)); 1500 pio = 0; 1501 } 1502 + ha->pio_address = pio; 1503 + ha->pio_length = pio_len; 1504 1505 + skip_pio: 1506 /* Use MMIO operations for all accesses. */ 1507 mmio = pci_resource_start(ha->pdev, 1); 1508 mmio_len = pci_resource_len(ha->pdev, 1); ··· 1518 goto iospace_error_exit; 1519 } 1520 1521 ha->iobase = ioremap(mmio, MIN_IOBASE_LEN); 1522 if (!ha->iobase) { 1523 qla_printk(KERN_ERR, ha, ··· 1579 char pci_info[30]; 1580 char fw_str[30]; 1581 struct scsi_host_template *sht; 1582 + int bars; 1583 1584 + bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); 1585 + sht = &qla2x00_driver_template; 1586 + if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || 1587 + pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || 1588 + pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || 1589 + pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || 1590 + pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) { 1591 + bars = pci_select_bars(pdev, IORESOURCE_MEM); 1592 + sht = &qla24xx_driver_template; 1593 + } 1594 + 1595 + if (pci_enable_device_bars(pdev, bars)) 1596 goto probe_out; 1597 1598 if (pci_find_aer_capability(pdev)) 1599 if (pci_enable_pcie_error_reporting(pdev)) 1600 goto probe_out; 1601 1602 host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t)); 1603 if (host == NULL) { 1604 printk(KERN_WARNING ··· 1610 ha->host_no = host->host_no; 1611 sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no); 1612 ha->parent = NULL; 1613 + ha->bars = bars; 1614 1615 /* Set ISP-type information. */ 1616 qla2x00_set_isp_flags(ha); ··· 1880 /* release io space registers */ 1881 if (ha->iobase) 1882 iounmap(ha->iobase); 1883 + pci_release_selected_regions(ha->pdev, ha->bars); 1884 } 1885 1886 static inline void ··· 2890 pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; 2891 scsi_qla_host_t *ha = pci_get_drvdata(pdev); 2892 2893 + if (pci_enable_device_bars(pdev, ha->bars)) { 2894 qla_printk(KERN_WARNING, ha, 2895 "Can't re-enable PCI device after reset.\n"); 2896