aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c133
1 files changed, 73 insertions, 60 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index bbbc5a632a1d..601a6b29750c 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -334,6 +334,8 @@ static int
334qla2x00_isp_firmware(scsi_qla_host_t *ha) 334qla2x00_isp_firmware(scsi_qla_host_t *ha)
335{ 335{
336 int rval; 336 int rval;
337 uint16_t loop_id, topo, sw_cap;
338 uint8_t domain, area, al_pa;
337 339
338 /* Assume loading risc code */ 340 /* Assume loading risc code */
339 rval = QLA_FUNCTION_FAILED; 341 rval = QLA_FUNCTION_FAILED;
@@ -345,6 +347,11 @@ qla2x00_isp_firmware(scsi_qla_host_t *ha)
345 347
346 /* Verify checksum of loaded RISC code. */ 348 /* Verify checksum of loaded RISC code. */
347 rval = qla2x00_verify_checksum(ha, ha->fw_srisc_address); 349 rval = qla2x00_verify_checksum(ha, ha->fw_srisc_address);
350 if (rval == QLA_SUCCESS) {
351 /* And, verify we are not in ROM code. */
352 rval = qla2x00_get_adapter_id(ha, &loop_id, &al_pa,
353 &area, &domain, &topo, &sw_cap);
354 }
348 } 355 }
349 356
350 if (rval) { 357 if (rval) {
@@ -722,7 +729,7 @@ qla24xx_chip_diag(scsi_qla_host_t *ha)
722 /* Perform RISC reset. */ 729 /* Perform RISC reset. */
723 qla24xx_reset_risc(ha); 730 qla24xx_reset_risc(ha);
724 731
725 ha->fw_transfer_size = REQUEST_ENTRY_SIZE * 1024; 732 ha->fw_transfer_size = REQUEST_ENTRY_SIZE * ha->request_q_length;
726 733
727 rval = qla2x00_mbx_reg_test(ha); 734 rval = qla2x00_mbx_reg_test(ha);
728 if (rval) { 735 if (rval) {
@@ -768,42 +775,16 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
768 mem_size = (ha->fw_memory_size - 0x100000 + 1) * 775 mem_size = (ha->fw_memory_size - 0x100000 + 1) *
769 sizeof(uint32_t); 776 sizeof(uint32_t);
770 777
771 /* Allocate memory for Extended Trace Buffer. */
772 tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma,
773 GFP_KERNEL);
774 if (!tc) {
775 qla_printk(KERN_WARNING, ha, "Unable to allocate "
776 "(%d KB) for EFT.\n", EFT_SIZE / 1024);
777 goto cont_alloc;
778 }
779
780 memset(tc, 0, EFT_SIZE);
781 rval = qla2x00_enable_eft_trace(ha, tc_dma, EFT_NUM_BUFFERS);
782 if (rval) {
783 qla_printk(KERN_WARNING, ha, "Unable to initialize "
784 "EFT (%d).\n", rval);
785 dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc,
786 tc_dma);
787 goto cont_alloc;
788 }
789
790 qla_printk(KERN_INFO, ha, "Allocated (%d KB) for EFT...\n",
791 EFT_SIZE / 1024);
792
793 eft_size = EFT_SIZE;
794 ha->eft_dma = tc_dma;
795 ha->eft = tc;
796
797 /* Allocate memory for Fibre Channel Event Buffer. */ 778 /* Allocate memory for Fibre Channel Event Buffer. */
798 if (!IS_QLA25XX(ha)) 779 if (!IS_QLA25XX(ha))
799 goto cont_alloc; 780 goto try_eft;
800 781
801 tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, 782 tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma,
802 GFP_KERNEL); 783 GFP_KERNEL);
803 if (!tc) { 784 if (!tc) {
804 qla_printk(KERN_WARNING, ha, "Unable to allocate " 785 qla_printk(KERN_WARNING, ha, "Unable to allocate "
805 "(%d KB) for FCE.\n", FCE_SIZE / 1024); 786 "(%d KB) for FCE.\n", FCE_SIZE / 1024);
806 goto cont_alloc; 787 goto try_eft;
807 } 788 }
808 789
809 memset(tc, 0, FCE_SIZE); 790 memset(tc, 0, FCE_SIZE);
@@ -815,7 +796,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
815 dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, 796 dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc,
816 tc_dma); 797 tc_dma);
817 ha->flags.fce_enabled = 0; 798 ha->flags.fce_enabled = 0;
818 goto cont_alloc; 799 goto try_eft;
819 } 800 }
820 801
821 qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n", 802 qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n",
@@ -825,6 +806,32 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
825 ha->flags.fce_enabled = 1; 806 ha->flags.fce_enabled = 1;
826 ha->fce_dma = tc_dma; 807 ha->fce_dma = tc_dma;
827 ha->fce = tc; 808 ha->fce = tc;
809try_eft:
810 /* Allocate memory for Extended Trace Buffer. */
811 tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma,
812 GFP_KERNEL);
813 if (!tc) {
814 qla_printk(KERN_WARNING, ha, "Unable to allocate "
815 "(%d KB) for EFT.\n", EFT_SIZE / 1024);
816 goto cont_alloc;
817 }
818
819 memset(tc, 0, EFT_SIZE);
820 rval = qla2x00_enable_eft_trace(ha, tc_dma, EFT_NUM_BUFFERS);
821 if (rval) {
822 qla_printk(KERN_WARNING, ha, "Unable to initialize "
823 "EFT (%d).\n", rval);
824 dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc,
825 tc_dma);
826 goto cont_alloc;
827 }
828
829 qla_printk(KERN_INFO, ha, "Allocated (%d KB) for EFT...\n",
830 EFT_SIZE / 1024);
831
832 eft_size = EFT_SIZE;
833 ha->eft_dma = tc_dma;
834 ha->eft = tc;
828 } 835 }
829cont_alloc: 836cont_alloc:
830 req_q_size = ha->request_q_length * sizeof(request_t); 837 req_q_size = ha->request_q_length * sizeof(request_t);
@@ -1501,18 +1508,25 @@ qla2x00_set_model_info(scsi_qla_host_t *ha, uint8_t *model, size_t len, char *de
1501 index = (ha->pdev->subsystem_device & 0xff); 1508 index = (ha->pdev->subsystem_device & 0xff);
1502 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && 1509 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
1503 index < QLA_MODEL_NAMES) 1510 index < QLA_MODEL_NAMES)
1504 ha->model_desc = qla2x00_model_name[index * 2 + 1]; 1511 strncpy(ha->model_desc,
1512 qla2x00_model_name[index * 2 + 1],
1513 sizeof(ha->model_desc) - 1);
1505 } else { 1514 } else {
1506 index = (ha->pdev->subsystem_device & 0xff); 1515 index = (ha->pdev->subsystem_device & 0xff);
1507 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && 1516 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
1508 index < QLA_MODEL_NAMES) { 1517 index < QLA_MODEL_NAMES) {
1509 strcpy(ha->model_number, 1518 strcpy(ha->model_number,
1510 qla2x00_model_name[index * 2]); 1519 qla2x00_model_name[index * 2]);
1511 ha->model_desc = qla2x00_model_name[index * 2 + 1]; 1520 strncpy(ha->model_desc,
1521 qla2x00_model_name[index * 2 + 1],
1522 sizeof(ha->model_desc) - 1);
1512 } else { 1523 } else {
1513 strcpy(ha->model_number, def); 1524 strcpy(ha->model_number, def);
1514 } 1525 }
1515 } 1526 }
1527 if (IS_FWI2_CAPABLE(ha))
1528 qla2xxx_get_vpd_field(ha, "\x82", ha->model_desc,
1529 sizeof(ha->model_desc));
1516} 1530}
1517 1531
1518/* On sparc systems, obtain port and node WWN from firmware 1532/* On sparc systems, obtain port and node WWN from firmware
@@ -1864,12 +1878,11 @@ qla2x00_rport_del(void *data)
1864{ 1878{
1865 fc_port_t *fcport = data; 1879 fc_port_t *fcport = data;
1866 struct fc_rport *rport; 1880 struct fc_rport *rport;
1867 unsigned long flags;
1868 1881
1869 spin_lock_irqsave(&fcport->rport_lock, flags); 1882 spin_lock_irq(fcport->ha->host->host_lock);
1870 rport = fcport->drport; 1883 rport = fcport->drport;
1871 fcport->drport = NULL; 1884 fcport->drport = NULL;
1872 spin_unlock_irqrestore(&fcport->rport_lock, flags); 1885 spin_unlock_irq(fcport->ha->host->host_lock);
1873 if (rport) 1886 if (rport)
1874 fc_remote_port_delete(rport); 1887 fc_remote_port_delete(rport);
1875} 1888}
@@ -1898,7 +1911,6 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
1898 atomic_set(&fcport->state, FCS_UNCONFIGURED); 1911 atomic_set(&fcport->state, FCS_UNCONFIGURED);
1899 fcport->flags = FCF_RLC_SUPPORT; 1912 fcport->flags = FCF_RLC_SUPPORT;
1900 fcport->supported_classes = FC_COS_UNSPECIFIED; 1913 fcport->supported_classes = FC_COS_UNSPECIFIED;
1901 spin_lock_init(&fcport->rport_lock);
1902 1914
1903 return fcport; 1915 return fcport;
1904} 1916}
@@ -2007,8 +2019,10 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
2007 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) { 2019 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
2008 if (test_bit(LOCAL_LOOP_UPDATE, &save_flags)) 2020 if (test_bit(LOCAL_LOOP_UPDATE, &save_flags))
2009 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); 2021 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
2010 if (test_bit(RSCN_UPDATE, &save_flags)) 2022 if (test_bit(RSCN_UPDATE, &save_flags)) {
2023 ha->flags.rscn_queue_overflow = 1;
2011 set_bit(RSCN_UPDATE, &ha->dpc_flags); 2024 set_bit(RSCN_UPDATE, &ha->dpc_flags);
2025 }
2012 } 2026 }
2013 2027
2014 return (rval); 2028 return (rval);
@@ -2243,28 +2257,24 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
2243{ 2257{
2244 struct fc_rport_identifiers rport_ids; 2258 struct fc_rport_identifiers rport_ids;
2245 struct fc_rport *rport; 2259 struct fc_rport *rport;
2246 unsigned long flags;
2247 2260
2248 if (fcport->drport) 2261 if (fcport->drport)
2249 qla2x00_rport_del(fcport); 2262 qla2x00_rport_del(fcport);
2250 if (fcport->rport)
2251 return;
2252 2263
2253 rport_ids.node_name = wwn_to_u64(fcport->node_name); 2264 rport_ids.node_name = wwn_to_u64(fcport->node_name);
2254 rport_ids.port_name = wwn_to_u64(fcport->port_name); 2265 rport_ids.port_name = wwn_to_u64(fcport->port_name);
2255 rport_ids.port_id = fcport->d_id.b.domain << 16 | 2266 rport_ids.port_id = fcport->d_id.b.domain << 16 |
2256 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; 2267 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa;
2257 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 2268 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
2258 rport = fc_remote_port_add(ha->host, 0, &rport_ids); 2269 fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids);
2259 if (!rport) { 2270 if (!rport) {
2260 qla_printk(KERN_WARNING, ha, 2271 qla_printk(KERN_WARNING, ha,
2261 "Unable to allocate fc remote port!\n"); 2272 "Unable to allocate fc remote port!\n");
2262 return; 2273 return;
2263 } 2274 }
2264 spin_lock_irqsave(&fcport->rport_lock, flags); 2275 spin_lock_irq(fcport->ha->host->host_lock);
2265 fcport->rport = rport;
2266 *((fc_port_t **)rport->dd_data) = fcport; 2276 *((fc_port_t **)rport->dd_data) = fcport;
2267 spin_unlock_irqrestore(&fcport->rport_lock, flags); 2277 spin_unlock_irq(fcport->ha->host->host_lock);
2268 2278
2269 rport->supported_classes = fcport->supported_classes; 2279 rport->supported_classes = fcport->supported_classes;
2270 2280
@@ -2565,7 +2575,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2565 } else if (qla2x00_gnn_id(ha, swl) != QLA_SUCCESS) { 2575 } else if (qla2x00_gnn_id(ha, swl) != QLA_SUCCESS) {
2566 kfree(swl); 2576 kfree(swl);
2567 swl = NULL; 2577 swl = NULL;
2568 } else if (qla2x00_gfpn_id(ha, swl) == QLA_SUCCESS) { 2578 } else if (ql2xiidmaenable &&
2579 qla2x00_gfpn_id(ha, swl) == QLA_SUCCESS) {
2569 qla2x00_gpsc(ha, swl); 2580 qla2x00_gpsc(ha, swl);
2570 } 2581 }
2571 } 2582 }
@@ -3220,7 +3231,8 @@ qla2x00_update_fcports(scsi_qla_host_t *ha)
3220 3231
3221 /* Go with deferred removal of rport references. */ 3232 /* Go with deferred removal of rport references. */
3222 list_for_each_entry(fcport, &ha->fcports, list) 3233 list_for_each_entry(fcport, &ha->fcports, list)
3223 if (fcport->drport) 3234 if (fcport->drport &&
3235 atomic_read(&fcport->state) != FCS_UNCONFIGURED)
3224 qla2x00_rport_del(fcport); 3236 qla2x00_rport_del(fcport);
3225} 3237}
3226 3238
@@ -3243,6 +3255,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3243 if (ha->flags.online) { 3255 if (ha->flags.online) {
3244 ha->flags.online = 0; 3256 ha->flags.online = 0;
3245 clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); 3257 clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
3258 ha->qla_stats.total_isp_aborts++;
3246 3259
3247 qla_printk(KERN_INFO, ha, 3260 qla_printk(KERN_INFO, ha,
3248 "Performing ISP error recovery - ha= %p.\n", ha); 3261 "Performing ISP error recovery - ha= %p.\n", ha);
@@ -3283,17 +3296,6 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3283 ha->isp_abort_cnt = 0; 3296 ha->isp_abort_cnt = 0;
3284 clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); 3297 clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags);
3285 3298
3286 if (ha->eft) {
3287 memset(ha->eft, 0, EFT_SIZE);
3288 rval = qla2x00_enable_eft_trace(ha,
3289 ha->eft_dma, EFT_NUM_BUFFERS);
3290 if (rval) {
3291 qla_printk(KERN_WARNING, ha,
3292 "Unable to reinitialize EFT "
3293 "(%d).\n", rval);
3294 }
3295 }
3296
3297 if (ha->fce) { 3299 if (ha->fce) {
3298 ha->flags.fce_enabled = 1; 3300 ha->flags.fce_enabled = 1;
3299 memset(ha->fce, 0, 3301 memset(ha->fce, 0,
@@ -3308,6 +3310,17 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3308 ha->flags.fce_enabled = 0; 3310 ha->flags.fce_enabled = 0;
3309 } 3311 }
3310 } 3312 }
3313
3314 if (ha->eft) {
3315 memset(ha->eft, 0, EFT_SIZE);
3316 rval = qla2x00_enable_eft_trace(ha,
3317 ha->eft_dma, EFT_NUM_BUFFERS);
3318 if (rval) {
3319 qla_printk(KERN_WARNING, ha,
3320 "Unable to reinitialize EFT "
3321 "(%d).\n", rval);
3322 }
3323 }
3311 } else { /* failed the ISP abort */ 3324 } else { /* failed the ISP abort */
3312 ha->flags.online = 1; 3325 ha->flags.online = 1;
3313 if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { 3326 if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) {
@@ -4026,8 +4039,8 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *ha)
4026 ret = qla2x00_stop_firmware(ha); 4039 ret = qla2x00_stop_firmware(ha);
4027 for (retries = 5; ret != QLA_SUCCESS && ret != QLA_FUNCTION_TIMEOUT && 4040 for (retries = 5; ret != QLA_SUCCESS && ret != QLA_FUNCTION_TIMEOUT &&
4028 retries ; retries--) { 4041 retries ; retries--) {
4029 qla2x00_reset_chip(ha); 4042 ha->isp_ops->reset_chip(ha);
4030 if (qla2x00_chip_diag(ha) != QLA_SUCCESS) 4043 if (ha->isp_ops->chip_diag(ha) != QLA_SUCCESS)
4031 continue; 4044 continue;
4032 if (qla2x00_setup_chip(ha) != QLA_SUCCESS) 4045 if (qla2x00_setup_chip(ha) != QLA_SUCCESS)
4033 continue; 4046 continue;
@@ -4049,7 +4062,7 @@ qla24xx_configure_vhba(scsi_qla_host_t *ha)
4049 rval = qla2x00_fw_ready(ha->parent); 4062 rval = qla2x00_fw_ready(ha->parent);
4050 if (rval == QLA_SUCCESS) { 4063 if (rval == QLA_SUCCESS) {
4051 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 4064 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
4052 qla2x00_marker(ha->parent, 0, 0, MK_SYNC_ALL); 4065 qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);
4053 } 4066 }
4054 4067
4055 ha->flags.management_server_logged_in = 0; 4068 ha->flags.management_server_logged_in = 0;