aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c192
1 files changed, 181 insertions, 11 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 036030c95339..79c752eef991 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1219,7 +1219,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
1219 } 1219 }
1220 } 1220 }
1221 1221
1222 if (ha->flags.enable_lip_full_login && !IS_QLA8XXX_TYPE(ha)) { 1222 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) {
1223 ret = qla2x00_full_login_lip(vha); 1223 ret = qla2x00_full_login_lip(vha);
1224 if (ret != QLA_SUCCESS) { 1224 if (ret != QLA_SUCCESS) {
1225 ql_dbg(ql_dbg_taskm, vha, 0x802d, 1225 ql_dbg(ql_dbg_taskm, vha, 0x802d,
@@ -1488,9 +1488,6 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
1488 uint16_t msix; 1488 uint16_t msix;
1489 int cpus; 1489 int cpus;
1490 1490
1491 if (IS_QLA82XX(ha))
1492 return qla82xx_iospace_config(ha);
1493
1494 if (pci_request_selected_regions(ha->pdev, ha->bars, 1491 if (pci_request_selected_regions(ha->pdev, ha->bars,
1495 QLA2XXX_DRIVER_NAME)) { 1492 QLA2XXX_DRIVER_NAME)) {
1496 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, 1493 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011,
@@ -1593,6 +1590,96 @@ iospace_error_exit:
1593} 1590}
1594 1591
1595 1592
1593static int
1594qla83xx_iospace_config(struct qla_hw_data *ha)
1595{
1596 uint16_t msix;
1597 int cpus;
1598
1599 if (pci_request_selected_regions(ha->pdev, ha->bars,
1600 QLA2XXX_DRIVER_NAME)) {
1601 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117,
1602 "Failed to reserve PIO/MMIO regions (%s), aborting.\n",
1603 pci_name(ha->pdev));
1604
1605 goto iospace_error_exit;
1606 }
1607
1608 /* Use MMIO operations for all accesses. */
1609 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) {
1610 ql_log_pci(ql_log_warn, ha->pdev, 0x0118,
1611 "Invalid pci I/O region size (%s).\n",
1612 pci_name(ha->pdev));
1613 goto iospace_error_exit;
1614 }
1615 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) {
1616 ql_log_pci(ql_log_warn, ha->pdev, 0x0119,
1617 "Invalid PCI mem region size (%s), aborting\n",
1618 pci_name(ha->pdev));
1619 goto iospace_error_exit;
1620 }
1621
1622 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN);
1623 if (!ha->iobase) {
1624 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a,
1625 "Cannot remap MMIO (%s), aborting.\n",
1626 pci_name(ha->pdev));
1627 goto iospace_error_exit;
1628 }
1629
1630 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */
1631 /* 83XX 26XX always use MQ type access for queues
1632 * - mbar 2, a.k.a region 4 */
1633 ha->max_req_queues = ha->max_rsp_queues = 1;
1634 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4),
1635 pci_resource_len(ha->pdev, 4));
1636
1637 if (!ha->mqiobase) {
1638 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d,
1639 "BAR2/region4 not enabled\n");
1640 goto mqiobase_exit;
1641 }
1642
1643 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2),
1644 pci_resource_len(ha->pdev, 2));
1645 if (ha->msixbase) {
1646 /* Read MSIX vector size of the board */
1647 pci_read_config_word(ha->pdev,
1648 QLA_83XX_PCI_MSIX_CONTROL, &msix);
1649 ha->msix_count = msix;
1650 /* Max queues are bounded by available msix vectors */
1651 /* queue 0 uses two msix vectors */
1652 if (ql2xmultique_tag) {
1653 cpus = num_online_cpus();
1654 ha->max_rsp_queues = (ha->msix_count - 1 > cpus) ?
1655 (cpus + 1) : (ha->msix_count - 1);
1656 ha->max_req_queues = 2;
1657 } else if (ql2xmaxqueues > 1) {
1658 ha->max_req_queues = ql2xmaxqueues > QLA_MQ_SIZE ?
1659 QLA_MQ_SIZE : ql2xmaxqueues;
1660 ql_dbg_pci(ql_dbg_multiq, ha->pdev, 0xc00c,
1661 "QoS mode set, max no of request queues:%d.\n",
1662 ha->max_req_queues);
1663 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b,
1664 "QoS mode set, max no of request queues:%d.\n",
1665 ha->max_req_queues);
1666 }
1667 ql_log_pci(ql_log_info, ha->pdev, 0x011c,
1668 "MSI-X vector count: %d.\n", msix);
1669 } else
1670 ql_log_pci(ql_log_info, ha->pdev, 0x011e,
1671 "BAR 1 not enabled.\n");
1672
1673mqiobase_exit:
1674 ha->msix_count = ha->max_rsp_queues + 1;
1675 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f,
1676 "MSIX Count:%d.\n", ha->msix_count);
1677 return 0;
1678
1679iospace_error_exit:
1680 return -ENOMEM;
1681}
1682
1596static struct isp_operations qla2100_isp_ops = { 1683static struct isp_operations qla2100_isp_ops = {
1597 .pci_config = qla2100_pci_config, 1684 .pci_config = qla2100_pci_config,
1598 .reset_chip = qla2x00_reset_chip, 1685 .reset_chip = qla2x00_reset_chip,
@@ -1769,7 +1856,7 @@ static struct isp_operations qla81xx_isp_ops = {
1769 .fw_dump = qla81xx_fw_dump, 1856 .fw_dump = qla81xx_fw_dump,
1770 .beacon_on = qla24xx_beacon_on, 1857 .beacon_on = qla24xx_beacon_on,
1771 .beacon_off = qla24xx_beacon_off, 1858 .beacon_off = qla24xx_beacon_off,
1772 .beacon_blink = qla24xx_beacon_blink, 1859 .beacon_blink = qla83xx_beacon_blink,
1773 .read_optrom = qla25xx_read_optrom_data, 1860 .read_optrom = qla25xx_read_optrom_data,
1774 .write_optrom = qla24xx_write_optrom_data, 1861 .write_optrom = qla24xx_write_optrom_data,
1775 .get_flash_version = qla24xx_get_flash_version, 1862 .get_flash_version = qla24xx_get_flash_version,
@@ -1815,6 +1902,43 @@ static struct isp_operations qla82xx_isp_ops = {
1815 .iospace_config = qla82xx_iospace_config, 1902 .iospace_config = qla82xx_iospace_config,
1816}; 1903};
1817 1904
1905static struct isp_operations qla83xx_isp_ops = {
1906 .pci_config = qla25xx_pci_config,
1907 .reset_chip = qla24xx_reset_chip,
1908 .chip_diag = qla24xx_chip_diag,
1909 .config_rings = qla24xx_config_rings,
1910 .reset_adapter = qla24xx_reset_adapter,
1911 .nvram_config = qla81xx_nvram_config,
1912 .update_fw_options = qla81xx_update_fw_options,
1913 .load_risc = qla81xx_load_risc,
1914 .pci_info_str = qla24xx_pci_info_str,
1915 .fw_version_str = qla24xx_fw_version_str,
1916 .intr_handler = qla24xx_intr_handler,
1917 .enable_intrs = qla24xx_enable_intrs,
1918 .disable_intrs = qla24xx_disable_intrs,
1919 .abort_command = qla24xx_abort_command,
1920 .target_reset = qla24xx_abort_target,
1921 .lun_reset = qla24xx_lun_reset,
1922 .fabric_login = qla24xx_login_fabric,
1923 .fabric_logout = qla24xx_fabric_logout,
1924 .calc_req_entries = NULL,
1925 .build_iocbs = NULL,
1926 .prep_ms_iocb = qla24xx_prep_ms_iocb,
1927 .prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb,
1928 .read_nvram = NULL,
1929 .write_nvram = NULL,
1930 .fw_dump = qla83xx_fw_dump,
1931 .beacon_on = qla24xx_beacon_on,
1932 .beacon_off = qla24xx_beacon_off,
1933 .beacon_blink = qla83xx_beacon_blink,
1934 .read_optrom = qla25xx_read_optrom_data,
1935 .write_optrom = qla24xx_write_optrom_data,
1936 .get_flash_version = qla24xx_get_flash_version,
1937 .start_scsi = qla24xx_dif_start_scsi,
1938 .abort_isp = qla2x00_abort_isp,
1939 .iospace_config = qla83xx_iospace_config,
1940};
1941
1818static inline void 1942static inline void
1819qla2x00_set_isp_flags(struct qla_hw_data *ha) 1943qla2x00_set_isp_flags(struct qla_hw_data *ha)
1820{ 1944{
@@ -1909,6 +2033,22 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
1909 /* Initialize 82XX ISP flags */ 2033 /* Initialize 82XX ISP flags */
1910 qla82xx_init_flags(ha); 2034 qla82xx_init_flags(ha);
1911 break; 2035 break;
2036 case PCI_DEVICE_ID_QLOGIC_ISP2031:
2037 ha->device_type |= DT_ISP2031;
2038 ha->device_type |= DT_ZIO_SUPPORTED;
2039 ha->device_type |= DT_FWI2;
2040 ha->device_type |= DT_IIDMA;
2041 ha->device_type |= DT_T10_PI;
2042 ha->fw_srisc_address = RISC_START_ADDRESS_2400;
2043 break;
2044 case PCI_DEVICE_ID_QLOGIC_ISP8031:
2045 ha->device_type |= DT_ISP8031;
2046 ha->device_type |= DT_ZIO_SUPPORTED;
2047 ha->device_type |= DT_FWI2;
2048 ha->device_type |= DT_IIDMA;
2049 ha->device_type |= DT_T10_PI;
2050 ha->fw_srisc_address = RISC_START_ADDRESS_2400;
2051 break;
1912 } 2052 }
1913 2053
1914 if (IS_QLA82XX(ha)) 2054 if (IS_QLA82XX(ha))
@@ -1980,7 +2120,9 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1980 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || 2120 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 ||
1981 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || 2121 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 ||
1982 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || 2122 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 ||
1983 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021) { 2123 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 ||
2124 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 ||
2125 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031) {
1984 bars = pci_select_bars(pdev, IORESOURCE_MEM); 2126 bars = pci_select_bars(pdev, IORESOURCE_MEM);
1985 mem_only = 1; 2127 mem_only = 1;
1986 ql_dbg_pci(ql_dbg_init, pdev, 0x0007, 2128 ql_dbg_pci(ql_dbg_init, pdev, 0x0007,
@@ -2020,9 +2162,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2020 qla2x00_set_isp_flags(ha); 2162 qla2x00_set_isp_flags(ha);
2021 2163
2022 /* Set EEH reset type to fundamental if required by hba */ 2164 /* Set EEH reset type to fundamental if required by hba */
2023 if ( IS_QLA24XX(ha) || IS_QLA25XX(ha) || IS_QLA81XX(ha)) { 2165 if (IS_QLA24XX(ha) || IS_QLA25XX(ha) || IS_QLA81XX(ha))
2024 pdev->needs_freset = 1; 2166 pdev->needs_freset = 1;
2025 }
2026 2167
2027 ha->prev_topology = 0; 2168 ha->prev_topology = 0;
2028 ha->init_cb_size = sizeof(init_cb_t); 2169 ha->init_cb_size = sizeof(init_cb_t);
@@ -2123,7 +2264,22 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2123 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; 2264 ha->flash_data_off = FARX_ACCESS_FLASH_DATA;
2124 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; 2265 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF;
2125 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; 2266 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA;
2267 } else if (IS_QLA83XX(ha)) {
2268 ha->mbx_count = MAILBOX_REGISTER_COUNT;
2269 req_length = REQUEST_ENTRY_CNT_24XX;
2270 rsp_length = RESPONSE_ENTRY_CNT_2300;
2271 ha->max_loop_id = SNS_LAST_LOOP_ID_2300;
2272 ha->init_cb_size = sizeof(struct mid_init_cb_81xx);
2273 ha->gid_list_info_size = 8;
2274 ha->optrom_size = OPTROM_SIZE_83XX;
2275 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX;
2276 ha->isp_ops = &qla83xx_isp_ops;
2277 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX;
2278 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX;
2279 ha->nvram_conf_off = ~0;
2280 ha->nvram_data_off = ~0;
2126 } 2281 }
2282
2127 ql_dbg_pci(ql_dbg_init, pdev, 0x001e, 2283 ql_dbg_pci(ql_dbg_init, pdev, 0x001e,
2128 "mbx_count=%d, req_length=%d, " 2284 "mbx_count=%d, req_length=%d, "
2129 "rsp_length=%d, max_loop_id=%d, init_cb_size=%d, " 2285 "rsp_length=%d, max_loop_id=%d, init_cb_size=%d, "
@@ -2251,7 +2407,7 @@ que_init:
2251 req->req_q_out = &ha->iobase->isp24.req_q_out; 2407 req->req_q_out = &ha->iobase->isp24.req_q_out;
2252 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; 2408 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in;
2253 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; 2409 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out;
2254 if (ha->mqenable) { 2410 if (ha->mqenable || IS_QLA83XX(ha)) {
2255 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; 2411 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in;
2256 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; 2412 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out;
2257 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; 2413 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in;
@@ -2552,6 +2708,9 @@ qla2x00_remove_one(struct pci_dev *pdev)
2552 2708
2553 if (ha->mqiobase) 2709 if (ha->mqiobase)
2554 iounmap(ha->mqiobase); 2710 iounmap(ha->mqiobase);
2711
2712 if (IS_QLA83XX(ha) && ha->msixbase)
2713 iounmap(ha->msixbase);
2555 } 2714 }
2556 2715
2557 pci_release_selected_regions(ha->pdev, ha->bars); 2716 pci_release_selected_regions(ha->pdev, ha->bars);
@@ -2893,7 +3052,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
2893 ha->npiv_info = NULL; 3052 ha->npiv_info = NULL;
2894 3053
2895 /* Get consistent memory allocated for EX-INIT-CB. */ 3054 /* Get consistent memory allocated for EX-INIT-CB. */
2896 if (IS_QLA8XXX_TYPE(ha)) { 3055 if (IS_CNA_CAPABLE(ha) || IS_QLA2031(ha)) {
2897 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, 3056 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
2898 &ha->ex_init_cb_dma); 3057 &ha->ex_init_cb_dma);
2899 if (!ha->ex_init_cb) 3058 if (!ha->ex_init_cb)
@@ -3889,7 +4048,7 @@ qla2x00_timer(scsi_qla_host_t *vha)
3889 4048
3890/* Firmware interface routines. */ 4049/* Firmware interface routines. */
3891 4050
3892#define FW_BLOBS 8 4051#define FW_BLOBS 10
3893#define FW_ISP21XX 0 4052#define FW_ISP21XX 0
3894#define FW_ISP22XX 1 4053#define FW_ISP22XX 1
3895#define FW_ISP2300 2 4054#define FW_ISP2300 2
@@ -3898,6 +4057,8 @@ qla2x00_timer(scsi_qla_host_t *vha)
3898#define FW_ISP25XX 5 4057#define FW_ISP25XX 5
3899#define FW_ISP81XX 6 4058#define FW_ISP81XX 6
3900#define FW_ISP82XX 7 4059#define FW_ISP82XX 7
4060#define FW_ISP2031 8
4061#define FW_ISP8031 9
3901 4062
3902#define FW_FILE_ISP21XX "ql2100_fw.bin" 4063#define FW_FILE_ISP21XX "ql2100_fw.bin"
3903#define FW_FILE_ISP22XX "ql2200_fw.bin" 4064#define FW_FILE_ISP22XX "ql2200_fw.bin"
@@ -3907,6 +4068,8 @@ qla2x00_timer(scsi_qla_host_t *vha)
3907#define FW_FILE_ISP25XX "ql2500_fw.bin" 4068#define FW_FILE_ISP25XX "ql2500_fw.bin"
3908#define FW_FILE_ISP81XX "ql8100_fw.bin" 4069#define FW_FILE_ISP81XX "ql8100_fw.bin"
3909#define FW_FILE_ISP82XX "ql8200_fw.bin" 4070#define FW_FILE_ISP82XX "ql8200_fw.bin"
4071#define FW_FILE_ISP2031 "ql2600_fw.bin"
4072#define FW_FILE_ISP8031 "ql8300_fw.bin"
3910 4073
3911static DEFINE_MUTEX(qla_fw_lock); 4074static DEFINE_MUTEX(qla_fw_lock);
3912 4075
@@ -3919,6 +4082,8 @@ static struct fw_blob qla_fw_blobs[FW_BLOBS] = {
3919 { .name = FW_FILE_ISP25XX, }, 4082 { .name = FW_FILE_ISP25XX, },
3920 { .name = FW_FILE_ISP81XX, }, 4083 { .name = FW_FILE_ISP81XX, },
3921 { .name = FW_FILE_ISP82XX, }, 4084 { .name = FW_FILE_ISP82XX, },
4085 { .name = FW_FILE_ISP2031, },
4086 { .name = FW_FILE_ISP8031, },
3922}; 4087};
3923 4088
3924struct fw_blob * 4089struct fw_blob *
@@ -3944,6 +4109,10 @@ qla2x00_request_firmware(scsi_qla_host_t *vha)
3944 blob = &qla_fw_blobs[FW_ISP81XX]; 4109 blob = &qla_fw_blobs[FW_ISP81XX];
3945 } else if (IS_QLA82XX(ha)) { 4110 } else if (IS_QLA82XX(ha)) {
3946 blob = &qla_fw_blobs[FW_ISP82XX]; 4111 blob = &qla_fw_blobs[FW_ISP82XX];
4112 } else if (IS_QLA2031(ha)) {
4113 blob = &qla_fw_blobs[FW_ISP2031];
4114 } else if (IS_QLA8031(ha)) {
4115 blob = &qla_fw_blobs[FW_ISP8031];
3947 } 4116 }
3948 4117
3949 mutex_lock(&qla_fw_lock); 4118 mutex_lock(&qla_fw_lock);
@@ -4265,6 +4434,7 @@ static struct pci_device_id qla2xxx_pci_tbl[] = {
4265 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5422) }, 4434 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5422) },
4266 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5432) }, 4435 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5432) },
4267 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2532) }, 4436 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2532) },
4437 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2031) },
4268 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP8001) }, 4438 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP8001) },
4269 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP8021) }, 4439 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP8021) },
4270 { 0 }, 4440 { 0 },