diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 125 |
1 files changed, 65 insertions, 60 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 93062593ebe7..ec7ebb6037e6 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -39,14 +39,14 @@ MODULE_PARM_DESC(ql2xlogintimeout, | |||
39 | int qlport_down_retry = 30; | 39 | int qlport_down_retry = 30; |
40 | module_param(qlport_down_retry, int, S_IRUGO|S_IRUSR); | 40 | module_param(qlport_down_retry, int, S_IRUGO|S_IRUSR); |
41 | MODULE_PARM_DESC(qlport_down_retry, | 41 | MODULE_PARM_DESC(qlport_down_retry, |
42 | "Maximum number of command retries to a port that returns" | 42 | "Maximum number of command retries to a port that returns " |
43 | "a PORT-DOWN status."); | 43 | "a PORT-DOWN status."); |
44 | 44 | ||
45 | int ql2xplogiabsentdevice; | 45 | int ql2xplogiabsentdevice; |
46 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); | 46 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); |
47 | MODULE_PARM_DESC(ql2xplogiabsentdevice, | 47 | MODULE_PARM_DESC(ql2xplogiabsentdevice, |
48 | "Option to enable PLOGI to devices that are not present after " | 48 | "Option to enable PLOGI to devices that are not present after " |
49 | "a Fabric scan. This is needed for several broken switches." | 49 | "a Fabric scan. This is needed for several broken switches. " |
50 | "Default is 0 - no PLOGI. 1 - perfom PLOGI."); | 50 | "Default is 0 - no PLOGI. 1 - perfom PLOGI."); |
51 | 51 | ||
52 | int ql2xloginretrycount = 0; | 52 | int ql2xloginretrycount = 0; |
@@ -54,6 +54,19 @@ module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); | |||
54 | MODULE_PARM_DESC(ql2xloginretrycount, | 54 | MODULE_PARM_DESC(ql2xloginretrycount, |
55 | "Specify an alternate value for the NVRAM login retry count."); | 55 | "Specify an alternate value for the NVRAM login retry count."); |
56 | 56 | ||
57 | int ql2xallocfwdump = 1; | ||
58 | module_param(ql2xallocfwdump, int, S_IRUGO|S_IRUSR); | ||
59 | MODULE_PARM_DESC(ql2xallocfwdump, | ||
60 | "Option to enable allocation of memory for a firmware dump " | ||
61 | "during HBA initialization. Memory allocation requirements " | ||
62 | "vary by ISP type. Default is 1 - allocate memory."); | ||
63 | |||
64 | int extended_error_logging; | ||
65 | module_param(extended_error_logging, int, S_IRUGO|S_IRUSR); | ||
66 | MODULE_PARM_DESC(extended_error_logging, | ||
67 | "Option to enable extended error logging, " | ||
68 | "Default is 0 - no logging. 1 - log errors."); | ||
69 | |||
57 | static void qla2x00_free_device(scsi_qla_host_t *); | 70 | static void qla2x00_free_device(scsi_qla_host_t *); |
58 | 71 | ||
59 | static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); | 72 | static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); |
@@ -624,7 +637,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
624 | 637 | ||
625 | DEBUG2(printk("%s(%ld): aborting sp %p from RISC. pid=%ld.\n", | 638 | DEBUG2(printk("%s(%ld): aborting sp %p from RISC. pid=%ld.\n", |
626 | __func__, ha->host_no, sp, serial)); | 639 | __func__, ha->host_no, sp, serial)); |
627 | DEBUG3(qla2x00_print_scsi_cmd(cmd);) | 640 | DEBUG3(qla2x00_print_scsi_cmd(cmd)); |
628 | 641 | ||
629 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 642 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
630 | if (ha->isp_ops.abort_command(ha, sp)) { | 643 | if (ha->isp_ops.abort_command(ha, sp)) { |
@@ -766,7 +779,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
766 | #endif | 779 | #endif |
767 | } else { | 780 | } else { |
768 | DEBUG2(printk(KERN_INFO | 781 | DEBUG2(printk(KERN_INFO |
769 | "%s failed: loop not ready\n",__func__);) | 782 | "%s failed: loop not ready\n",__func__)); |
770 | } | 783 | } |
771 | 784 | ||
772 | if (ret == FAILED) { | 785 | if (ret == FAILED) { |
@@ -1021,12 +1034,12 @@ qla2x00_loop_reset(scsi_qla_host_t *ha) | |||
1021 | /* Empty */ | 1034 | /* Empty */ |
1022 | DEBUG2_3(printk("%s(%ld): **** FAILED ****\n", | 1035 | DEBUG2_3(printk("%s(%ld): **** FAILED ****\n", |
1023 | __func__, | 1036 | __func__, |
1024 | ha->host_no);) | 1037 | ha->host_no)); |
1025 | } else { | 1038 | } else { |
1026 | /* Empty */ | 1039 | /* Empty */ |
1027 | DEBUG3(printk("%s(%ld): exiting normally.\n", | 1040 | DEBUG3(printk("%s(%ld): exiting normally.\n", |
1028 | __func__, | 1041 | __func__, |
1029 | ha->host_no);) | 1042 | ha->host_no)); |
1030 | } | 1043 | } |
1031 | 1044 | ||
1032 | return(status); | 1045 | return(status); |
@@ -1324,7 +1337,8 @@ qla24xx_disable_intrs(scsi_qla_host_t *ha) | |||
1324 | /* | 1337 | /* |
1325 | * PCI driver interface | 1338 | * PCI driver interface |
1326 | */ | 1339 | */ |
1327 | static int qla2x00_probe_one(struct pci_dev *pdev) | 1340 | static int __devinit |
1341 | qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | ||
1328 | { | 1342 | { |
1329 | int ret = -ENODEV; | 1343 | int ret = -ENODEV; |
1330 | device_reg_t __iomem *reg; | 1344 | device_reg_t __iomem *reg; |
@@ -1405,7 +1419,6 @@ static int qla2x00_probe_one(struct pci_dev *pdev) | |||
1405 | ha->isp_ops.read_nvram = qla2x00_read_nvram_data; | 1419 | ha->isp_ops.read_nvram = qla2x00_read_nvram_data; |
1406 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; | 1420 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; |
1407 | ha->isp_ops.fw_dump = qla2100_fw_dump; | 1421 | ha->isp_ops.fw_dump = qla2100_fw_dump; |
1408 | ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump; | ||
1409 | ha->isp_ops.read_optrom = qla2x00_read_optrom_data; | 1422 | ha->isp_ops.read_optrom = qla2x00_read_optrom_data; |
1410 | ha->isp_ops.write_optrom = qla2x00_write_optrom_data; | 1423 | ha->isp_ops.write_optrom = qla2x00_write_optrom_data; |
1411 | if (IS_QLA2100(ha)) { | 1424 | if (IS_QLA2100(ha)) { |
@@ -1432,7 +1445,6 @@ static int qla2x00_probe_one(struct pci_dev *pdev) | |||
1432 | ha->isp_ops.pci_config = qla2300_pci_config; | 1445 | ha->isp_ops.pci_config = qla2300_pci_config; |
1433 | ha->isp_ops.intr_handler = qla2300_intr_handler; | 1446 | ha->isp_ops.intr_handler = qla2300_intr_handler; |
1434 | ha->isp_ops.fw_dump = qla2300_fw_dump; | 1447 | ha->isp_ops.fw_dump = qla2300_fw_dump; |
1435 | ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump; | ||
1436 | ha->isp_ops.beacon_on = qla2x00_beacon_on; | 1448 | ha->isp_ops.beacon_on = qla2x00_beacon_on; |
1437 | ha->isp_ops.beacon_off = qla2x00_beacon_off; | 1449 | ha->isp_ops.beacon_off = qla2x00_beacon_off; |
1438 | ha->isp_ops.beacon_blink = qla2x00_beacon_blink; | 1450 | ha->isp_ops.beacon_blink = qla2x00_beacon_blink; |
@@ -1469,7 +1481,6 @@ static int qla2x00_probe_one(struct pci_dev *pdev) | |||
1469 | ha->isp_ops.read_nvram = qla24xx_read_nvram_data; | 1481 | ha->isp_ops.read_nvram = qla24xx_read_nvram_data; |
1470 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; | 1482 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; |
1471 | ha->isp_ops.fw_dump = qla24xx_fw_dump; | 1483 | ha->isp_ops.fw_dump = qla24xx_fw_dump; |
1472 | ha->isp_ops.ascii_fw_dump = qla24xx_ascii_fw_dump; | ||
1473 | ha->isp_ops.read_optrom = qla24xx_read_optrom_data; | 1484 | ha->isp_ops.read_optrom = qla24xx_read_optrom_data; |
1474 | ha->isp_ops.write_optrom = qla24xx_write_optrom_data; | 1485 | ha->isp_ops.write_optrom = qla24xx_write_optrom_data; |
1475 | ha->isp_ops.beacon_on = qla24xx_beacon_on; | 1486 | ha->isp_ops.beacon_on = qla24xx_beacon_on; |
@@ -1640,7 +1651,8 @@ probe_out: | |||
1640 | return ret; | 1651 | return ret; |
1641 | } | 1652 | } |
1642 | 1653 | ||
1643 | static void qla2x00_remove_one(struct pci_dev *pdev) | 1654 | static void __devexit |
1655 | qla2x00_remove_one(struct pci_dev *pdev) | ||
1644 | { | 1656 | { |
1645 | scsi_qla_host_t *ha; | 1657 | scsi_qla_host_t *ha; |
1646 | 1658 | ||
@@ -1678,6 +1690,9 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1678 | kthread_stop(t); | 1690 | kthread_stop(t); |
1679 | } | 1691 | } |
1680 | 1692 | ||
1693 | if (ha->eft) | ||
1694 | qla2x00_trace_control(ha, TC_DISABLE, 0, 0); | ||
1695 | |||
1681 | /* Stop currently executing firmware. */ | 1696 | /* Stop currently executing firmware. */ |
1682 | qla2x00_stop_firmware(ha); | 1697 | qla2x00_stop_firmware(ha); |
1683 | 1698 | ||
@@ -1899,17 +1914,6 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) | |||
1899 | } | 1914 | } |
1900 | memset(ha->init_cb, 0, ha->init_cb_size); | 1915 | memset(ha->init_cb, 0, ha->init_cb_size); |
1901 | 1916 | ||
1902 | /* Allocate ioctl related memory. */ | ||
1903 | if (qla2x00_alloc_ioctl_mem(ha)) { | ||
1904 | qla_printk(KERN_WARNING, ha, | ||
1905 | "Memory Allocation failed - ioctl_mem\n"); | ||
1906 | |||
1907 | qla2x00_mem_free(ha); | ||
1908 | msleep(100); | ||
1909 | |||
1910 | continue; | ||
1911 | } | ||
1912 | |||
1913 | if (qla2x00_allocate_sp_pool(ha)) { | 1917 | if (qla2x00_allocate_sp_pool(ha)) { |
1914 | qla_printk(KERN_WARNING, ha, | 1918 | qla_printk(KERN_WARNING, ha, |
1915 | "Memory Allocation failed - " | 1919 | "Memory Allocation failed - " |
@@ -1972,6 +1976,26 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) | |||
1972 | continue; | 1976 | continue; |
1973 | } | 1977 | } |
1974 | memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt)); | 1978 | memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt)); |
1979 | |||
1980 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { | ||
1981 | /* | ||
1982 | * Get consistent memory allocated for SFP | ||
1983 | * block. | ||
1984 | */ | ||
1985 | ha->sfp_data = dma_pool_alloc(ha->s_dma_pool, | ||
1986 | GFP_KERNEL, &ha->sfp_data_dma); | ||
1987 | if (ha->sfp_data == NULL) { | ||
1988 | qla_printk(KERN_WARNING, ha, | ||
1989 | "Memory Allocation failed - " | ||
1990 | "sfp_data\n"); | ||
1991 | |||
1992 | qla2x00_mem_free(ha); | ||
1993 | msleep(100); | ||
1994 | |||
1995 | continue; | ||
1996 | } | ||
1997 | memset(ha->sfp_data, 0, SFP_BLOCK_SIZE); | ||
1998 | } | ||
1975 | } | 1999 | } |
1976 | 2000 | ||
1977 | /* Done all allocations without any error. */ | 2001 | /* Done all allocations without any error. */ |
@@ -2006,12 +2030,16 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2006 | return; | 2030 | return; |
2007 | } | 2031 | } |
2008 | 2032 | ||
2009 | /* free ioctl memory */ | ||
2010 | qla2x00_free_ioctl_mem(ha); | ||
2011 | |||
2012 | /* free sp pool */ | 2033 | /* free sp pool */ |
2013 | qla2x00_free_sp_pool(ha); | 2034 | qla2x00_free_sp_pool(ha); |
2014 | 2035 | ||
2036 | if (ha->fw_dump) { | ||
2037 | if (ha->eft) | ||
2038 | dma_free_coherent(&ha->pdev->dev, | ||
2039 | ntohl(ha->fw_dump->eft_size), ha->eft, ha->eft_dma); | ||
2040 | vfree(ha->fw_dump); | ||
2041 | } | ||
2042 | |||
2015 | if (ha->sns_cmd) | 2043 | if (ha->sns_cmd) |
2016 | dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), | 2044 | dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), |
2017 | ha->sns_cmd, ha->sns_cmd_dma); | 2045 | ha->sns_cmd, ha->sns_cmd_dma); |
@@ -2020,6 +2048,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2020 | dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), | 2048 | dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), |
2021 | ha->ct_sns, ha->ct_sns_dma); | 2049 | ha->ct_sns, ha->ct_sns_dma); |
2022 | 2050 | ||
2051 | if (ha->sfp_data) | ||
2052 | dma_pool_free(ha->s_dma_pool, ha->sfp_data, ha->sfp_data_dma); | ||
2053 | |||
2023 | if (ha->ms_iocb) | 2054 | if (ha->ms_iocb) |
2024 | dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); | 2055 | dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); |
2025 | 2056 | ||
@@ -2043,6 +2074,8 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2043 | (ha->request_q_length + 1) * sizeof(request_t), | 2074 | (ha->request_q_length + 1) * sizeof(request_t), |
2044 | ha->request_ring, ha->request_dma); | 2075 | ha->request_ring, ha->request_dma); |
2045 | 2076 | ||
2077 | ha->eft = NULL; | ||
2078 | ha->eft_dma = 0; | ||
2046 | ha->sns_cmd = NULL; | 2079 | ha->sns_cmd = NULL; |
2047 | ha->sns_cmd_dma = 0; | 2080 | ha->sns_cmd_dma = 0; |
2048 | ha->ct_sns = NULL; | 2081 | ha->ct_sns = NULL; |
@@ -2071,13 +2104,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2071 | } | 2104 | } |
2072 | INIT_LIST_HEAD(&ha->fcports); | 2105 | INIT_LIST_HEAD(&ha->fcports); |
2073 | 2106 | ||
2074 | vfree(ha->fw_dump); | ||
2075 | vfree(ha->fw_dump_buffer); | ||
2076 | |||
2077 | ha->fw_dump = NULL; | 2107 | ha->fw_dump = NULL; |
2078 | ha->fw_dumped = 0; | 2108 | ha->fw_dumped = 0; |
2079 | ha->fw_dump_reading = 0; | 2109 | ha->fw_dump_reading = 0; |
2080 | ha->fw_dump_buffer = NULL; | ||
2081 | 2110 | ||
2082 | vfree(ha->optrom_buffer); | 2111 | vfree(ha->optrom_buffer); |
2083 | } | 2112 | } |
@@ -2617,40 +2646,16 @@ static struct pci_device_id qla2xxx_pci_tbl[] = { | |||
2617 | }; | 2646 | }; |
2618 | MODULE_DEVICE_TABLE(pci, qla2xxx_pci_tbl); | 2647 | MODULE_DEVICE_TABLE(pci, qla2xxx_pci_tbl); |
2619 | 2648 | ||
2620 | static int __devinit | ||
2621 | qla2xxx_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | ||
2622 | { | ||
2623 | return qla2x00_probe_one(pdev); | ||
2624 | } | ||
2625 | |||
2626 | static void __devexit | ||
2627 | qla2xxx_remove_one(struct pci_dev *pdev) | ||
2628 | { | ||
2629 | qla2x00_remove_one(pdev); | ||
2630 | } | ||
2631 | |||
2632 | static struct pci_driver qla2xxx_pci_driver = { | 2649 | static struct pci_driver qla2xxx_pci_driver = { |
2633 | .name = QLA2XXX_DRIVER_NAME, | 2650 | .name = QLA2XXX_DRIVER_NAME, |
2634 | .driver = { | 2651 | .driver = { |
2635 | .owner = THIS_MODULE, | 2652 | .owner = THIS_MODULE, |
2636 | }, | 2653 | }, |
2637 | .id_table = qla2xxx_pci_tbl, | 2654 | .id_table = qla2xxx_pci_tbl, |
2638 | .probe = qla2xxx_probe_one, | 2655 | .probe = qla2x00_probe_one, |
2639 | .remove = __devexit_p(qla2xxx_remove_one), | 2656 | .remove = __devexit_p(qla2x00_remove_one), |
2640 | }; | 2657 | }; |
2641 | 2658 | ||
2642 | static inline int | ||
2643 | qla2x00_pci_module_init(void) | ||
2644 | { | ||
2645 | return pci_module_init(&qla2xxx_pci_driver); | ||
2646 | } | ||
2647 | |||
2648 | static inline void | ||
2649 | qla2x00_pci_module_exit(void) | ||
2650 | { | ||
2651 | pci_unregister_driver(&qla2xxx_pci_driver); | ||
2652 | } | ||
2653 | |||
2654 | /** | 2659 | /** |
2655 | * qla2x00_module_init - Module initialization. | 2660 | * qla2x00_module_init - Module initialization. |
2656 | **/ | 2661 | **/ |
@@ -2670,16 +2675,16 @@ qla2x00_module_init(void) | |||
2670 | 2675 | ||
2671 | /* Derive version string. */ | 2676 | /* Derive version string. */ |
2672 | strcpy(qla2x00_version_str, QLA2XXX_VERSION); | 2677 | strcpy(qla2x00_version_str, QLA2XXX_VERSION); |
2673 | #if DEBUG_QLA2100 | 2678 | if (extended_error_logging) |
2674 | strcat(qla2x00_version_str, "-debug"); | 2679 | strcat(qla2x00_version_str, "-debug"); |
2675 | #endif | 2680 | |
2676 | qla2xxx_transport_template = | 2681 | qla2xxx_transport_template = |
2677 | fc_attach_transport(&qla2xxx_transport_functions); | 2682 | fc_attach_transport(&qla2xxx_transport_functions); |
2678 | if (!qla2xxx_transport_template) | 2683 | if (!qla2xxx_transport_template) |
2679 | return -ENODEV; | 2684 | return -ENODEV; |
2680 | 2685 | ||
2681 | printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n"); | 2686 | printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n"); |
2682 | ret = qla2x00_pci_module_init(); | 2687 | ret = pci_register_driver(&qla2xxx_pci_driver); |
2683 | if (ret) { | 2688 | if (ret) { |
2684 | kmem_cache_destroy(srb_cachep); | 2689 | kmem_cache_destroy(srb_cachep); |
2685 | fc_release_transport(qla2xxx_transport_template); | 2690 | fc_release_transport(qla2xxx_transport_template); |
@@ -2693,7 +2698,7 @@ qla2x00_module_init(void) | |||
2693 | static void __exit | 2698 | static void __exit |
2694 | qla2x00_module_exit(void) | 2699 | qla2x00_module_exit(void) |
2695 | { | 2700 | { |
2696 | qla2x00_pci_module_exit(); | 2701 | pci_unregister_driver(&qla2xxx_pci_driver); |
2697 | qla2x00_release_firmware(); | 2702 | qla2x00_release_firmware(); |
2698 | kmem_cache_destroy(srb_cachep); | 2703 | kmem_cache_destroy(srb_cachep); |
2699 | fc_release_transport(qla2xxx_transport_template); | 2704 | fc_release_transport(qla2xxx_transport_template); |