Lines Matching refs:ha

15 	struct scsi_qla_host *ha = to_qla_host(host);  in qla4xxx_read_flash()  local
26 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_read_flash()
29 if (ql4xxx_reset_active(ha)) { in qla4xxx_read_flash()
30 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_read_flash()
35 if (ha->flash_state != QLFLASH_WAITING) { in qla4xxx_read_flash()
36 ql4_printk(KERN_ERR, ha, "%s: another flash operation " in qla4xxx_read_flash()
42 ha->flash_state = QLFLASH_READING; in qla4xxx_read_flash()
46 flash = dma_alloc_coherent(&ha->pdev->dev, length, &flash_dma, in qla4xxx_read_flash()
49 ql4_printk(KERN_ERR, ha, "%s: dma alloc failed for flash " in qla4xxx_read_flash()
55 rval = qla4xxx_get_flash(ha, flash_dma, offset, length); in qla4xxx_read_flash()
57 ql4_printk(KERN_ERR, ha, "%s: get flash failed\n", __func__); in qla4xxx_read_flash()
70 dma_free_coherent(&ha->pdev->dev, length, flash, flash_dma); in qla4xxx_read_flash()
72 ha->flash_state = QLFLASH_WAITING; in qla4xxx_read_flash()
80 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_update_flash() local
92 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_update_flash()
95 if (ql4xxx_reset_active(ha)) { in qla4xxx_update_flash()
96 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_update_flash()
101 if (ha->flash_state != QLFLASH_WAITING) { in qla4xxx_update_flash()
102 ql4_printk(KERN_ERR, ha, "%s: another flash operation " in qla4xxx_update_flash()
108 ha->flash_state = QLFLASH_WRITING; in qla4xxx_update_flash()
113 flash = dma_alloc_coherent(&ha->pdev->dev, length, &flash_dma, in qla4xxx_update_flash()
116 ql4_printk(KERN_ERR, ha, "%s: dma alloc failed for flash " in qla4xxx_update_flash()
125 rval = qla4xxx_set_flash(ha, flash_dma, offset, length, options); in qla4xxx_update_flash()
127 ql4_printk(KERN_ERR, ha, "%s: set flash failed\n", __func__); in qla4xxx_update_flash()
135 dma_free_coherent(&ha->pdev->dev, length, flash, flash_dma); in qla4xxx_update_flash()
137 ha->flash_state = QLFLASH_WAITING; in qla4xxx_update_flash()
145 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_get_acb_state() local
155 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_get_acb_state()
159 if (is_qla4010(ha)) in qla4xxx_get_acb_state()
162 if (ql4xxx_reset_active(ha)) { in qla4xxx_get_acb_state()
163 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_get_acb_state()
169 ql4_printk(KERN_ERR, ha, "%s: invalid payload len %d\n", in qla4xxx_get_acb_state()
178 rval = qla4xxx_get_ip_state(ha, acb_idx, ip_idx, status); in qla4xxx_get_acb_state()
180 ql4_printk(KERN_ERR, ha, "%s: get ip state failed\n", in qla4xxx_get_acb_state()
202 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_read_nvram() local
214 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_read_nvram()
218 if (!(is_qla4010(ha) || is_qla4022(ha) || is_qla4032(ha))) in qla4xxx_read_nvram()
221 if (ql4xxx_reset_active(ha)) { in qla4xxx_read_nvram()
222 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_read_nvram()
232 if ((is_qla4010(ha) && total_len > QL4010_NVRAM_SIZE) || in qla4xxx_read_nvram()
233 ((is_qla4022(ha) || is_qla4032(ha)) && in qla4xxx_read_nvram()
235 ql4_printk(KERN_ERR, ha, "%s: offset+len greater than max" in qla4xxx_read_nvram()
241 nvram = dma_alloc_coherent(&ha->pdev->dev, len, &nvram_dma, in qla4xxx_read_nvram()
244 ql4_printk(KERN_ERR, ha, "%s: dma alloc failed for nvram " in qla4xxx_read_nvram()
250 rval = qla4xxx_get_nvram(ha, nvram_dma, offset, len); in qla4xxx_read_nvram()
252 ql4_printk(KERN_ERR, ha, "%s: get nvram failed\n", __func__); in qla4xxx_read_nvram()
265 dma_free_coherent(&ha->pdev->dev, len, nvram, nvram_dma); in qla4xxx_read_nvram()
274 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_update_nvram() local
286 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_update_nvram()
289 if (!(is_qla4010(ha) || is_qla4022(ha) || is_qla4032(ha))) in qla4xxx_update_nvram()
292 if (ql4xxx_reset_active(ha)) { in qla4xxx_update_nvram()
293 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_update_nvram()
303 if ((is_qla4010(ha) && total_len > QL4010_NVRAM_SIZE) || in qla4xxx_update_nvram()
304 ((is_qla4022(ha) || is_qla4032(ha)) && in qla4xxx_update_nvram()
306 ql4_printk(KERN_ERR, ha, "%s: offset+len greater than max" in qla4xxx_update_nvram()
312 nvram = dma_alloc_coherent(&ha->pdev->dev, len, &nvram_dma, in qla4xxx_update_nvram()
315 ql4_printk(KERN_ERR, ha, "%s: dma alloc failed for flash " in qla4xxx_update_nvram()
324 rval = qla4xxx_set_nvram(ha, nvram_dma, offset, len); in qla4xxx_update_nvram()
326 ql4_printk(KERN_ERR, ha, "%s: set nvram failed\n", __func__); in qla4xxx_update_nvram()
334 dma_free_coherent(&ha->pdev->dev, len, nvram, nvram_dma); in qla4xxx_update_nvram()
343 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_restore_defaults() local
353 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_restore_defaults()
356 if (is_qla4010(ha)) in qla4xxx_restore_defaults()
359 if (ql4xxx_reset_active(ha)) { in qla4xxx_restore_defaults()
360 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_restore_defaults()
369 rval = qla4xxx_restore_factory_defaults(ha, region, field0, field1); in qla4xxx_restore_defaults()
371 ql4_printk(KERN_ERR, ha, "%s: set nvram failed\n", __func__); in qla4xxx_restore_defaults()
387 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_bsg_get_acb() local
398 if (unlikely(pci_channel_offline(ha->pdev))) in qla4xxx_bsg_get_acb()
402 if (is_qla4010(ha)) in qla4xxx_bsg_get_acb()
405 if (ql4xxx_reset_active(ha)) { in qla4xxx_bsg_get_acb()
406 ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); in qla4xxx_bsg_get_acb()
414 ql4_printk(KERN_ERR, ha, "%s: invalid acb len %d\n", in qla4xxx_bsg_get_acb()
420 acb = dma_alloc_coherent(&ha->pdev->dev, len, &acb_dma, GFP_KERNEL); in qla4xxx_bsg_get_acb()
422 ql4_printk(KERN_ERR, ha, "%s: dma alloc failed for acb " in qla4xxx_bsg_get_acb()
428 rval = qla4xxx_get_acb(ha, acb_dma, acb_type, len); in qla4xxx_bsg_get_acb()
430 ql4_printk(KERN_ERR, ha, "%s: get acb failed\n", __func__); in qla4xxx_bsg_get_acb()
443 dma_free_coherent(&ha->pdev->dev, len, acb, acb_dma); in qla4xxx_bsg_get_acb()
451 struct scsi_qla_host *ha = to_qla_host(host); in ql4xxx_execute_diag_cmd() local
459 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: in\n", __func__)); in ql4xxx_execute_diag_cmd()
461 if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) { in ql4xxx_execute_diag_cmd()
462 ql4_printk(KERN_INFO, ha, "%s: Adapter reset in progress. Invalid Request\n", in ql4xxx_execute_diag_cmd()
472 DEBUG2(ql4_printk(KERN_INFO, ha, in ql4xxx_execute_diag_cmd()
478 status = qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 8, &mbox_cmd[0], in ql4xxx_execute_diag_cmd()
481 DEBUG2(ql4_printk(KERN_INFO, ha, in ql4xxx_execute_diag_cmd()
498 DEBUG2(ql4_printk(KERN_INFO, ha, in ql4xxx_execute_diag_cmd()
506 static int qla4_83xx_wait_for_loopback_config_comp(struct scsi_qla_host *ha, in qla4_83xx_wait_for_loopback_config_comp() argument
511 if (!wait_for_completion_timeout(&ha->idc_comp, (IDC_COMP_TOV * HZ))) { in qla4_83xx_wait_for_loopback_config_comp()
512 …ql4_printk(KERN_INFO, ha, "%s: IDC Complete notification not received, Waiting for another %d time… in qla4_83xx_wait_for_loopback_config_comp()
513 __func__, ha->idc_extend_tmo); in qla4_83xx_wait_for_loopback_config_comp()
514 if (ha->idc_extend_tmo) { in qla4_83xx_wait_for_loopback_config_comp()
515 if (!wait_for_completion_timeout(&ha->idc_comp, in qla4_83xx_wait_for_loopback_config_comp()
516 (ha->idc_extend_tmo * HZ))) { in qla4_83xx_wait_for_loopback_config_comp()
517 ha->notify_idc_comp = 0; in qla4_83xx_wait_for_loopback_config_comp()
518 ha->notify_link_up_comp = 0; in qla4_83xx_wait_for_loopback_config_comp()
519 ql4_printk(KERN_WARNING, ha, "%s: Aborting: IDC Complete notification not received", in qla4_83xx_wait_for_loopback_config_comp()
524 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4_83xx_wait_for_loopback_config_comp()
530 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4_83xx_wait_for_loopback_config_comp()
534 ha->notify_idc_comp = 0; in qla4_83xx_wait_for_loopback_config_comp()
537 if (!wait_for_completion_timeout(&ha->link_up_comp, in qla4_83xx_wait_for_loopback_config_comp()
539 ha->notify_link_up_comp = 0; in qla4_83xx_wait_for_loopback_config_comp()
540 ql4_printk(KERN_WARNING, ha, "%s: Aborting: LINK UP notification not received", in qla4_83xx_wait_for_loopback_config_comp()
545 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4_83xx_wait_for_loopback_config_comp()
549 ha->notify_link_up_comp = 0; in qla4_83xx_wait_for_loopback_config_comp()
556 static int qla4_83xx_pre_loopback_config(struct scsi_qla_host *ha, in qla4_83xx_pre_loopback_config() argument
562 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: in\n", __func__)); in qla4_83xx_pre_loopback_config()
564 status = qla4_83xx_get_port_config(ha, &config); in qla4_83xx_pre_loopback_config()
568 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Default port config=%08X\n", in qla4_83xx_pre_loopback_config()
573 ql4_printk(KERN_INFO, ha, "%s: Loopback diagnostics already in progress. Invalid request\n", in qla4_83xx_pre_loopback_config()
586 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: New port config=%08X\n", in qla4_83xx_pre_loopback_config()
589 ha->notify_idc_comp = 1; in qla4_83xx_pre_loopback_config()
590 ha->notify_link_up_comp = 1; in qla4_83xx_pre_loopback_config()
593 qla4xxx_get_firmware_state(ha); in qla4_83xx_pre_loopback_config()
595 status = qla4_83xx_set_port_config(ha, &config); in qla4_83xx_pre_loopback_config()
597 ha->notify_idc_comp = 0; in qla4_83xx_pre_loopback_config()
598 ha->notify_link_up_comp = 0; in qla4_83xx_pre_loopback_config()
602 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: status = %s\n", __func__, in qla4_83xx_pre_loopback_config()
607 static int qla4_83xx_post_loopback_config(struct scsi_qla_host *ha, in qla4_83xx_post_loopback_config() argument
613 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: in\n", __func__)); in qla4_83xx_post_loopback_config()
615 status = qla4_83xx_get_port_config(ha, &config); in qla4_83xx_post_loopback_config()
619 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: port config=%08X\n", __func__, in qla4_83xx_post_loopback_config()
629 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4_83xx_post_loopback_config()
633 ha->notify_idc_comp = 1; in qla4_83xx_post_loopback_config()
634 if (ha->addl_fw_state & FW_ADDSTATE_LINK_UP) in qla4_83xx_post_loopback_config()
635 ha->notify_link_up_comp = 1; in qla4_83xx_post_loopback_config()
637 status = qla4_83xx_set_port_config(ha, &config); in qla4_83xx_post_loopback_config()
639 ql4_printk(KERN_INFO, ha, "%s: Scheduling adapter reset\n", in qla4_83xx_post_loopback_config()
641 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4_83xx_post_loopback_config()
642 clear_bit(AF_LOOPBACK, &ha->flags); in qla4_83xx_post_loopback_config()
647 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: status = %s\n", __func__, in qla4_83xx_post_loopback_config()
655 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_execute_diag_loopback_cmd() local
664 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: in\n", __func__)); in qla4xxx_execute_diag_loopback_cmd()
668 if (test_bit(AF_LOOPBACK, &ha->flags)) { in qla4xxx_execute_diag_loopback_cmd()
669 ql4_printk(KERN_INFO, ha, "%s: Loopback Diagnostics already in progress. Invalid Request\n", in qla4xxx_execute_diag_loopback_cmd()
675 if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) { in qla4xxx_execute_diag_loopback_cmd()
676 ql4_printk(KERN_INFO, ha, "%s: Adapter reset in progress. Invalid Request\n", in qla4xxx_execute_diag_loopback_cmd()
685 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_execute_diag_loopback_cmd()
686 status = qla4_83xx_pre_loopback_config(ha, mbox_cmd); in qla4xxx_execute_diag_loopback_cmd()
692 status = qla4_83xx_wait_for_loopback_config_comp(ha, in qla4xxx_execute_diag_loopback_cmd()
700 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_execute_diag_loopback_cmd()
706 status = qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 8, &mbox_cmd[0], in qla4xxx_execute_diag_loopback_cmd()
714 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_execute_diag_loopback_cmd()
725 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_execute_diag_loopback_cmd()
726 status = qla4_83xx_post_loopback_config(ha, mbox_cmd); in qla4xxx_execute_diag_loopback_cmd()
734 if (!(ha->addl_fw_state & FW_ADDSTATE_LINK_UP)) in qla4xxx_execute_diag_loopback_cmd()
737 status = qla4_83xx_wait_for_loopback_config_comp(ha, in qla4xxx_execute_diag_loopback_cmd()
745 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_execute_diag_loopback_cmd()
755 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_execute_diag_test() local
760 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: in\n", __func__)); in qla4xxx_execute_diag_test()
789 ql4_printk(KERN_ERR, ha, "%s: Invalid diag test: 0x%x\n", in qla4xxx_execute_diag_test()
798 ql4_printk(KERN_ERR, ha, "%s: Invalid diag cmd: 0x%x\n", in qla4xxx_execute_diag_test()
814 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_process_vendor_specific() local
842 ql4_printk(KERN_ERR, ha, "%s: invalid BSG vendor command: " in qla4xxx_process_vendor_specific()
860 struct scsi_qla_host *ha = to_qla_host(host); in qla4xxx_bsg_request() local
867 ql4_printk(KERN_ERR, ha, "%s: invalid BSG command: 0x%x\n", in qla4xxx_bsg_request()