Lines Matching refs:ha

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