Lines Matching +full:mctp +full:- +full:handling
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
65 "Enable/disable security. 0(Default) - Security disabled. 1 - Security enabled.");
71 "beginning. Default is 0 - class 2 not supported.");
83 "a PORT-DOWN status.");
90 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
102 "vary by ISP type. Default is 1 - allocate memory.");
109 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
110 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
111 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
112 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
113 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
114 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
115 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
116 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
117 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
118 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
119 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
120 "\t\t0x1e400000 - Preferred value for capturing essential "
141 "0 - no FDMI registrations. "
142 "1 - provide FDMI registrations (default).");
154 " Enable T10-CRC-DIF:\n"
156 " 0 -- No DIF Support\n"
157 " 1 -- Enable DIF for all types\n"
158 " 2 -- Enable DIF for all types, except Type 0.\n");
168 "0 - no NVMe. Default is Y");
173 " Enable T10-CRC-DIF Error isolation by HBA:\n"
175 " 0 -- Error isolation disabled\n"
176 " 1 -- Error isolation enabled only for DIX Type 0\n"
177 " 2 -- Error isolation enabled for all Types\n");
183 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
197 " 2 -- load firmware via the request_firmware() (hotplug).\n"
199 " 1 -- load firmware from flash.\n"
200 " 0 -- use default semantics.\n");
206 "Default is 0 - skip ETS enablement.");
212 " 0 -- Regular doorbell.\n"
213 " 1 -- CAMRAM doorbell (faster).\n");
219 "Default is 0 - Do not use GFF_ID information.");
225 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
231 " 0 (Default) -- Reset on failure.\n"
232 " 1 -- Do not reset on failure.\n");
244 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
250 "0 - MiniDump disabled. "
251 "1 (Default) - MiniDump enabled.");
257 "0 (Default)- Disabled.");
274 "1 - Set fw option to hold ABTS.");
281 "1 - Move IOCBs.");
292 "Set to enable MSI or MSI-X interrupt mechanism.\n"
293 " Default is 1, enable MSI-X interrupt mechanism.\n"
294 " 0 -- enable traditional pin-based mechanism.\n"
295 " 1 -- enable MSI-X interrupt mechanism.\n"
296 " 2 -- enable MSI interrupt mechanism.\n");
314 " 0 -- Let HBA firmware decide\n"
315 " 1 -- Force T10 CRC\n"
316 " 2 -- Force IP checksum\n");
330 " Default is 0 - No SmartSAN registration,"
331 " 1 - Register SmartSAN Management Attributes.");
338 "0 - no RDP responses (default). "
339 "1 - provide RDP responses.");
349 "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n");
361 "1 - Minimum number of queues supported\n"
362 "8 - Default value");
368 "0 - FC2 Target support is disabled. "
369 "1 - FC2 Target support is enabled (default).");
382 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
383 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
384 add_timer(&vha->timer); in qla2x00_start_timer()
385 vha->timer_active = 1; in qla2x00_start_timer()
392 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
398 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
404 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
405 vha->timer_active = 0; in qla2x00_stop_timer()
419 /* -------------------------------------------------------------------------- */
423 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
425 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
426 rsp->req = req; in qla_init_base_qpair()
427 ha->base_qpair->hw = ha; in qla_init_base_qpair()
428 ha->base_qpair->req = req; in qla_init_base_qpair()
429 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
430 ha->base_qpair->vha = vha; in qla_init_base_qpair()
431 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
432 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
433 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
434 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
435 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
436 INIT_LIST_HEAD(&ha->base_qpair->dsd_list); in qla_init_base_qpair()
437 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
439 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
440 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
443 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
449 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
451 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
453 if (!ha->req_q_map) { in qla2x00_alloc_queues()
459 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
461 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
467 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
468 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
476 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
477 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
479 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
485 kfree(ha->queue_pair_map); in qla2x00_alloc_queues()
486 ha->queue_pair_map = NULL; in qla2x00_alloc_queues()
495 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
496 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
497 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
498 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
502 kfree(ha->base_qpair); in qla2x00_alloc_queues()
503 ha->base_qpair = NULL; in qla2x00_alloc_queues()
505 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
506 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
508 kfree(ha->req_q_map); in qla2x00_alloc_queues()
509 ha->req_q_map = NULL; in qla2x00_alloc_queues()
511 return -ENOMEM; in qla2x00_alloc_queues()
517 if (req && req->ring_fx00) in qla2x00_free_req_que()
518 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
519 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
520 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
521 } else if (req && req->ring) in qla2x00_free_req_que()
522 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
523 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
524 req->ring, req->dma); in qla2x00_free_req_que()
527 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
535 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
536 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
537 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
538 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
539 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
540 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
541 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
542 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
554 if (ha->queue_pair_map) { in qla2x00_free_queues()
555 kfree(ha->queue_pair_map); in qla2x00_free_queues()
556 ha->queue_pair_map = NULL; in qla2x00_free_queues()
558 if (ha->base_qpair) { in qla2x00_free_queues()
559 kfree(ha->base_qpair); in qla2x00_free_queues()
560 ha->base_qpair = NULL; in qla2x00_free_queues()
564 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
565 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
566 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
569 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
570 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
571 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
573 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
575 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
577 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
579 kfree(ha->req_q_map); in qla2x00_free_queues()
580 ha->req_q_map = NULL; in qla2x00_free_queues()
583 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
584 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
585 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
588 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
589 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
590 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
591 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
593 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
595 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
597 kfree(ha->rsp_q_map); in qla2x00_free_queues()
598 ha->rsp_q_map = NULL; in qla2x00_free_queues()
604 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
610 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
612 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
615 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
628 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
631 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
635 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
661 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
666 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
677 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
679 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
680 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
682 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
687 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
701 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
705 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
714 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
716 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
717 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
723 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
726 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
728 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
731 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
732 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
733 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
734 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
737 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
739 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
740 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
743 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
744 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
746 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
747 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
750 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
751 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
753 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
754 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
755 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2x00_sp_free_dma()
756 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
757 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
760 if (sp->flags & SRB_GOT_BUF) in qla2x00_sp_free_dma()
761 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2x00_sp_free_dma()
767 struct completion *comp = sp->comp; in qla2x00_sp_compl()
770 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_compl()
771 cmd->result = res; in qla2x00_sp_compl()
772 sp->type = 0; in qla2x00_sp_compl()
781 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
783 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
785 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
788 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
789 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
790 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
791 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
794 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
796 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
797 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
800 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
801 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
805 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
806 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
807 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
808 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
810 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
814 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
815 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
816 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
817 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
819 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
822 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
823 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
824 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
825 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
828 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
829 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
830 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
831 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
833 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
836 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
837 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
839 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
840 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
841 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2xxx_qpair_sp_free_dma()
842 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
843 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
844 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
847 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
848 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
850 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
851 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
854 if (sp->flags & SRB_GOT_BUF) in qla2xxx_qpair_sp_free_dma()
855 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2xxx_qpair_sp_free_dma()
861 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
864 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_qpair_sp_compl()
865 cmd->result = res; in qla2xxx_qpair_sp_compl()
866 sp->type = 0; in qla2xxx_qpair_sp_compl()
876 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
877 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
878 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
879 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
883 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
885 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
889 if (ha->mqenable) { in qla2xxx_queuecommand()
896 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
902 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
903 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
907 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
911 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
918 cmd->result = rval; in qla2xxx_queuecommand()
925 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
930 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
934 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
935 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
939 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
940 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
941 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
944 atomic_read(&fcport->state), in qla2xxx_queuecommand()
945 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
946 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
953 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
956 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
958 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
959 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
965 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
967 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
968 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
969 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
970 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
972 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
983 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_queuecommand()
1000 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
1001 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
1002 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
1003 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
1009 cmd->result = rval; in qla2xxx_mqueuecommand()
1016 if (!qpair->online) { in qla2xxx_mqueuecommand()
1018 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
1019 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1023 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
1024 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
1028 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
1029 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
1030 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
1033 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
1034 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
1035 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1042 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
1045 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
1047 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
1048 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1056 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1057 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1058 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1059 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1061 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1072 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_mqueuecommand()
1090 * ha - pointer to host adapter structure
1093 * Does context switching-Release SPIN_LOCK
1105 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1106 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1109 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1110 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1111 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1112 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1116 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1126 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1131 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1134 vha, vha->fcport_count); in test_fcport_count()
1135 res = (vha->fcport_count == 0); in test_fcport_count()
1139 list_for_each_entry(fcport, &vha->vp_fcports, list) { in test_fcport_count()
1140 if (fcport->deleted != QLA_SESS_DELETED) { in test_fcport_count()
1151 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1168 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1173 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1181 * ha - pointer to host adapter structure
1184 * Does context switching-Release SPIN_LOCK
1191 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1192 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1194 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1195 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1196 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1197 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1198 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1209 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1210 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1213 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1214 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1215 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1216 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1220 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1221 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1224 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1250 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1257 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1276 qpair = sp->qpair; in qla2xxx_eh_abort()
1278 vha->cmd_timeout_cnt++; in qla2xxx_eh_abort()
1280 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1283 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1284 sp->comp = ∁ in qla2xxx_eh_abort()
1285 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1288 id = cmd->device->id; in qla2xxx_eh_abort()
1289 lun = cmd->device->lun; in qla2xxx_eh_abort()
1293 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1300 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1306 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1313 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1324 sp->comp = NULL; in qla2xxx_eh_abort()
1327 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1328 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1345 scsi_qla_host_t *vha = qpair->vha; in __qla2x00_eh_wait_for_pending_commands()
1346 struct req_que *req = qpair->req; in __qla2x00_eh_wait_for_pending_commands()
1351 struct qla_hw_data *ha = vha->hw; in __qla2x00_eh_wait_for_pending_commands()
1355 while (wait_iter--) { in __qla2x00_eh_wait_for_pending_commands()
1358 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1359 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_eh_wait_for_pending_commands()
1360 sp = req->outstanding_cmds[cnt]; in __qla2x00_eh_wait_for_pending_commands()
1363 if (sp->type != SRB_SCSI_CMD) in __qla2x00_eh_wait_for_pending_commands()
1365 if (vha->vp_idx != sp->vha->vp_idx) in __qla2x00_eh_wait_for_pending_commands()
1374 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1375 match = sp->fcport->d_id.b24 == t; in __qla2x00_eh_wait_for_pending_commands()
1380 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1381 match = (sp->fcport->d_id.b24 == t && in __qla2x00_eh_wait_for_pending_commands()
1382 cmd->device->lun == l); in __qla2x00_eh_wait_for_pending_commands()
1390 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1392 if (unlikely(pci_channel_offline(ha->pdev)) || in __qla2x00_eh_wait_for_pending_commands()
1393 ha->flags.eeh_busy) { in __qla2x00_eh_wait_for_pending_commands()
1405 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1408 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1414 if (wait_iter == -1) in __qla2x00_eh_wait_for_pending_commands()
1425 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1428 status = __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, in qla2x00_eh_wait_for_pending_commands()
1430 for (i = 0; status == QLA_SUCCESS && i < ha->max_qpairs; i++) { in qla2x00_eh_wait_for_pending_commands()
1431 qpair = ha->queue_pair_map[i]; in qla2x00_eh_wait_for_pending_commands()
1450 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_device_reset()
1451 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_eh_device_reset()
1453 fc_port_t *fcport = (struct fc_port *) sdev->hostdata; in qla2xxx_eh_device_reset()
1454 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1472 if (fcport->deleted) in qla2xxx_eh_device_reset()
1476 "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, in qla2xxx_eh_device_reset()
1477 sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1486 if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) in qla2xxx_eh_device_reset()
1493 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, in qla2xxx_eh_device_reset()
1494 cmd->device->lun, in qla2xxx_eh_device_reset()
1503 vha->host_no, sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1510 reset_errors[err], vha->host_no, sdev->id, sdev->lun, in qla2xxx_eh_device_reset()
1512 vha->reset_cmd_err_cnt++; in qla2xxx_eh_device_reset()
1519 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_target_reset()
1522 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1523 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_eh_target_reset()
1541 if (fcport->deleted) in qla2xxx_eh_target_reset()
1545 "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no, in qla2xxx_eh_target_reset()
1546 sdev->id, cmd); in qla2xxx_eh_target_reset()
1555 if (ha->isp_ops->target_reset(fcport, 0, 0) != QLA_SUCCESS) { in qla2xxx_eh_target_reset()
1561 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, 0, in qla2xxx_eh_target_reset()
1570 vha->host_no, sdev->id, cmd); in qla2xxx_eh_target_reset()
1577 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in qla2xxx_eh_target_reset()
1579 vha->reset_cmd_err_cnt++; in qla2xxx_eh_target_reset()
1601 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1605 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1614 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1615 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1621 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1646 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1669 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1670 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1674 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1683 id = cmd->device->id; in qla2xxx_eh_host_reset()
1684 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1687 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1693 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1700 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1708 if (ha->wq) in qla2xxx_eh_host_reset()
1709 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1711 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1712 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1713 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1715 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1723 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1734 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1753 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1758 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1759 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1760 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1769 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1777 vha->marker_needed = 1; in qla2x00_loop_reset()
1788 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1789 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1792 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1793 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1799 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1802 sp->done(sp, res); in qla2x00_abort_srb()
1806 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1807 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1808 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1810 if (sp->comp) { in qla2x00_abort_srb()
1811 sp->done(sp, res); in qla2x00_abort_srb()
1815 sp->comp = ∁ in qla2x00_abort_srb()
1816 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1818 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1821 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1828 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1838 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1839 switch (sp->type) { in qla2x00_abort_srb()
1842 sp->done(sp, res); in qla2x00_abort_srb()
1846 sp->done(sp, res); in qla2x00_abort_srb()
1850 sp->done(sp, res); in qla2x00_abort_srb()
1864 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1865 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1867 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1870 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1872 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1873 req = qp->req; in __qla2x00_abort_all_cmds()
1874 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1875 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1878 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1879 sp->done(sp, res); in __qla2x00_abort_all_cmds()
1883 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1888 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1891 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1892 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1896 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1904 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1907 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1918 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1921 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1923 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1925 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1927 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1928 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1931 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1941 return -ENXIO; in qla2xxx_sdev_init()
1943 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_sdev_init()
1951 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_sdev_configure()
1952 struct req_que *req = vha->req; in qla2xxx_sdev_configure()
1954 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_sdev_configure()
1961 sdev->hostdata = NULL; in qla2xxx_sdev_destroy()
1965 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1975 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1977 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1978 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1979 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1980 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1982 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1983 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1984 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1989 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1990 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1997 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
1999 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2000 ha->interrupts_on = 1; in qla2x00_enable_intrs()
2002 wrt_reg_word(®->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
2003 rd_reg_word(®->ictrl); in qla2x00_enable_intrs()
2004 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2012 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
2014 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2015 ha->interrupts_on = 0; in qla2x00_disable_intrs()
2017 wrt_reg_word(®->ictrl, 0); in qla2x00_disable_intrs()
2018 rd_reg_word(®->ictrl); in qla2x00_disable_intrs()
2019 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2026 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
2028 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2029 ha->interrupts_on = 1; in qla24xx_enable_intrs()
2030 wrt_reg_dword(®->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
2031 rd_reg_dword(®->ictrl); in qla24xx_enable_intrs()
2032 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2039 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
2043 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2044 ha->interrupts_on = 0; in qla24xx_disable_intrs()
2045 wrt_reg_dword(®->ictrl, 0); in qla24xx_disable_intrs()
2046 rd_reg_dword(®->ictrl); in qla24xx_disable_intrs()
2047 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2056 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
2058 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
2060 pci_name(ha->pdev)); in qla2x00_iospace_config()
2063 if (!(ha->bars & 1)) in qla2x00_iospace_config()
2067 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
2068 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
2069 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2070 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
2072 pci_name(ha->pdev)); in qla2x00_iospace_config()
2076 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
2078 pci_name(ha->pdev)); in qla2x00_iospace_config()
2081 ha->pio_address = pio; in qla2x00_iospace_config()
2082 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
2084 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2088 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2089 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2091 pci_name(ha->pdev)); in qla2x00_iospace_config()
2094 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2095 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2097 pci_name(ha->pdev)); in qla2x00_iospace_config()
2101 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2102 if (!ha->iobase) { in qla2x00_iospace_config()
2103 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2105 pci_name(ha->pdev)); in qla2x00_iospace_config()
2110 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2111 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2114 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2121 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2122 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2123 if (ha->mqiobase) { in qla2x00_iospace_config()
2124 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2125 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2127 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2128 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2131 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2132 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2134 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2135 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2136 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2138 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2139 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2141 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2145 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2146 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2150 return (-ENOMEM); in qla2x00_iospace_config()
2159 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2161 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2163 pci_name(ha->pdev)); in qla83xx_iospace_config()
2169 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2170 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2172 pci_name(ha->pdev)); in qla83xx_iospace_config()
2175 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2176 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2178 pci_name(ha->pdev)); in qla83xx_iospace_config()
2182 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2183 if (!ha->iobase) { in qla83xx_iospace_config()
2184 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2186 pci_name(ha->pdev)); in qla83xx_iospace_config()
2190 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2192 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2193 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2194 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2195 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2196 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2198 if (!ha->mqiobase) { in qla83xx_iospace_config()
2199 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2204 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2205 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2206 if (ha->msixbase) { in qla83xx_iospace_config()
2208 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2210 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2217 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2221 ha->max_req_queues--; in qla83xx_iospace_config()
2223 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2227 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2228 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2229 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2231 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2232 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2234 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2238 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2239 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2243 return -ENOMEM; in qla83xx_iospace_config()
2640 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2641 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2643 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2644 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2645 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2648 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2649 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2650 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2653 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2654 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2655 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2658 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2659 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2660 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2663 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2664 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2665 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2666 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2667 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2668 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2671 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2672 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2675 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2676 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2679 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2680 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2681 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2682 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2683 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2686 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2687 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2688 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2689 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2690 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2693 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2694 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2695 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2696 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2697 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2700 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2701 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2702 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2705 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2706 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2707 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2710 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2711 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2712 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2713 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2714 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2717 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2718 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2719 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2720 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2721 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2724 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2725 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2726 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2727 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2732 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2733 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2734 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2735 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2740 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2741 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2742 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2743 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2744 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2745 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2748 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2749 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2750 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2751 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2752 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2753 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2756 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2759 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2760 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2761 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2762 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2763 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2764 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2767 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2768 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2769 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2770 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2771 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2772 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2775 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2776 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2777 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2778 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2779 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2780 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2784 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2785 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2786 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2787 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2788 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2789 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2793 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2794 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2795 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2796 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2797 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2798 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2803 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2806 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2809 ha->port_no--; in qla2x00_set_isp_flags()
2811 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2814 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2816 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2824 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2827 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2828 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2829 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2830 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2838 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2840 if (!vha->host) in qla2xxx_scan_finished()
2842 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2845 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2852 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_heartbeat_work_fn()
2854 if (!ha->flags.mbox_busy && base_vha->flags.init_done) in qla_heartbeat_work_fn()
2862 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2863 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2867 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2870 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2872 i--; in qla2x00_iocb_work_fn()
2875 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2876 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2877 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2907 int ret = -ENODEV; in qla2x00_probe_one()
2922 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2923 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2924 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2925 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2926 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2927 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2928 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2929 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2930 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2931 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2932 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2933 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2934 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2935 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2936 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2937 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2938 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2939 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2940 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2970 ha->pdev = pdev; in qla2x00_probe_one()
2971 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2972 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2973 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2974 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2976 spin_lock_init(&ha->sadb_lock); in qla2x00_probe_one()
2977 INIT_LIST_HEAD(&ha->sadb_tx_index_list); in qla2x00_probe_one()
2978 INIT_LIST_HEAD(&ha->sadb_rx_index_list); in qla2x00_probe_one()
2980 spin_lock_init(&ha->sadb_fp_lock); in qla2x00_probe_one()
2987 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2990 ha->bars = bars; in qla2x00_probe_one()
2991 ha->mem_only = mem_only; in qla2x00_probe_one()
2992 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
2993 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
2994 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
2995 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
2997 /* Set ISP-type information. */ in qla2x00_probe_one()
3003 pdev->needs_freset = 1; in qla2x00_probe_one()
3005 ha->prev_topology = 0; in qla2x00_probe_one()
3006 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
3007 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
3008 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
3009 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
3010 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
3011 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
3012 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
3013 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
3014 INIT_LIST_HEAD(&ha->tmf_pending); in qla2x00_probe_one()
3015 INIT_LIST_HEAD(&ha->tmf_active); in qla2x00_probe_one()
3019 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3020 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
3023 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3024 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3025 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3026 ha->flash_data_off = ~0; in qla2x00_probe_one()
3027 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3028 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3029 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3031 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3032 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
3035 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3036 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3037 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3038 ha->flash_data_off = ~0; in qla2x00_probe_one()
3039 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3040 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3041 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3043 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3044 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3047 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3048 ha->gid_list_info_size = 6; in qla2x00_probe_one()
3050 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
3051 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3052 ha->flash_data_off = ~0; in qla2x00_probe_one()
3053 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3054 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3055 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
3057 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3058 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3061 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3062 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3063 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3064 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3065 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
3066 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
3067 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
3068 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3069 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3070 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3071 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3073 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3074 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3077 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3078 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3079 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3080 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3081 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
3082 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3083 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
3084 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3085 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3086 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3087 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3089 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3090 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3093 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3094 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3095 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3096 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3097 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
3098 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3099 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
3100 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3101 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3102 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3103 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3105 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3106 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3109 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3110 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3111 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3112 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
3113 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3114 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
3115 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3116 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3117 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3118 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3120 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3121 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3124 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3125 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3126 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3127 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3128 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3129 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
3130 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3131 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3132 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3133 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3135 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3136 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3137 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3140 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3141 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3142 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3143 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3144 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3145 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3146 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3147 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3148 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3149 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3150 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3152 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3153 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3154 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3157 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3158 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3159 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3160 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3161 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3162 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3163 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3164 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3166 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3167 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3168 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3171 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3172 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3173 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3174 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3175 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3176 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3177 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3178 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3179 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3180 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3181 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3183 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3184 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3185 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3188 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3189 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3190 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3191 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3192 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3193 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3194 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3195 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3196 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3197 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3198 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3206 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3207 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3208 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3212 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3213 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3216 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3222 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3223 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3224 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3225 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3226 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3227 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3228 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3229 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3231 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3236 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3246 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3248 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3253 ret = -ENOMEM; in qla2x00_probe_one()
3258 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3260 host = base_vha->host; in qla2x00_probe_one()
3261 base_vha->req = req; in qla2x00_probe_one()
3263 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3266 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3267 base_vha->vp_idx; in qla2x00_probe_one()
3270 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3271 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3272 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3273 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3274 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3275 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3284 host->sg_tablesize = 32; in qla2x00_probe_one()
3287 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3289 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3290 host->cmd_per_lun = 3; in qla2x00_probe_one()
3291 host->unique_id = host->host_no; in qla2x00_probe_one()
3300 host->max_cmd_len = 32; in qla2x00_probe_one()
3302 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3303 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3304 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3307 host->max_lun = 0xffff; in qla2x00_probe_one()
3309 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3310 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3311 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3316 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3317 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3318 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3319 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3321 INIT_WORK(&ha->heartbeat_work, qla_heartbeat_work_fn); in qla2x00_probe_one()
3334 ret = -ENODEV; in qla2x00_probe_one()
3338 if (ha->mqenable) { in qla2x00_probe_one()
3339 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3340 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3343 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3346 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3348 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3349 host->nr_hw_queues); in qla2x00_probe_one()
3352 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3361 rsp->req = req; in qla2x00_probe_one()
3362 req->rsp = rsp; in qla2x00_probe_one()
3365 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3366 ha->req_q_map[0] = req; in qla2x00_probe_one()
3367 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3368 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3371 /* FWI2-capable only. */ in qla2x00_probe_one()
3372 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3373 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3374 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3375 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3376 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3378 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3379 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3380 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3381 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3385 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3386 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3387 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3388 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3392 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3393 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3394 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3398 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3399 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3401 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3402 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3403 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3404 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3406 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3407 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3409 "req->req_q_in=%p req->req_q_out=%p rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3410 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3412 ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); in qla2x00_probe_one()
3413 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3414 ret = -ENOMEM; in qla2x00_probe_one()
3418 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3420 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3421 base_vha->device_flags); in qla2x00_probe_one()
3440 ret = -ENODEV; in qla2x00_probe_one()
3445 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3447 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3451 host->can_queue, base_vha->req, in qla2x00_probe_one()
3452 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3455 if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6)) in qla2x00_probe_one()
3456 ha->mqenable = 0; in qla2x00_probe_one()
3458 if (ha->mqenable) { in qla2x00_probe_one()
3468 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3473 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3479 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3480 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3481 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3484 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3485 ha->dpc_thread = NULL; in qla2x00_probe_one()
3499 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3502 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3503 ha->dpc_lp_wq = in qla2x00_probe_one()
3505 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3507 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3508 ha->dpc_hp_wq = in qla2x00_probe_one()
3510 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3511 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3513 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3518 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3519 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3531 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3534 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3559 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3562 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3566 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3567 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3571 if (IS_T10_PI_CAPABLE(base_vha->hw)) in qla2x00_probe_one()
3572 host->dma_alignment = 0x7; in qla2x00_probe_one()
3574 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3578 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3579 base_vha->flags.online = 1; in qla2x00_probe_one()
3580 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3590 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3596 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3600 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3608 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3611 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3613 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3614 base_vha->host_no, in qla2x00_probe_one()
3615 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3619 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3621 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3622 return -ENODEV; in qla2x00_probe_one()
3629 vfree(base_vha->scan.l); in qla2x00_probe_one()
3630 if (base_vha->gnl.l) { in qla2x00_probe_one()
3631 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3632 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3633 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3636 if (base_vha->timer_active) in qla2x00_probe_one()
3638 base_vha->flags.online = 0; in qla2x00_probe_one()
3639 if (ha->dpc_thread) { in qla2x00_probe_one()
3640 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3642 ha->dpc_thread = NULL; in qla2x00_probe_one()
3647 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3665 if (!ha->nx_pcibase) in qla2x00_probe_one()
3666 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3668 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3670 if (ha->iobase) in qla2x00_probe_one()
3671 iounmap(ha->iobase); in qla2x00_probe_one()
3672 if (ha->cregbase) in qla2x00_probe_one()
3673 iounmap(ha->cregbase); in qla2x00_probe_one()
3675 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3692 ha = base_vha->hw; in __qla_set_remove_flag()
3694 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3695 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3696 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3702 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3703 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3713 ha = vha->hw; in qla2x00_shutdown()
3723 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3725 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3732 /* Turn-off FCE trace */ in qla2x00_shutdown()
3733 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3735 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3738 /* Turn-off EFT trace */ in qla2x00_shutdown()
3739 if (ha->eft) in qla2x00_shutdown()
3744 if (ha->flags.fw_started) in qla2x00_shutdown()
3752 if (vha->timer_active) in qla2x00_shutdown()
3756 vha->flags.online = 0; in qla2x00_shutdown()
3758 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3759 if (ha->interrupts_on) { in qla2x00_shutdown()
3760 vha->flags.init_done = 0; in qla2x00_shutdown()
3761 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3780 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3781 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3782 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3784 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3785 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3786 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3787 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3789 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3790 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3794 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3795 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3797 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3799 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3807 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3808 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3809 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3810 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3813 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3814 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3815 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3816 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3817 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3818 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3822 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3823 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3826 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3829 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3839 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3841 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3843 if (ha->iobase) in qla2x00_unmap_iobases()
3844 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3846 if (ha->cregbase) in qla2x00_unmap_iobases()
3847 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3849 if (ha->mqiobase) in qla2x00_unmap_iobases()
3850 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3852 if (ha->msixbase) in qla2x00_unmap_iobases()
3853 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3878 ha = base_vha->hw; in qla2x00_remove_one()
3882 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3885 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3889 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3890 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3891 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3892 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3893 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3904 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3909 if (ha->flags.fw_started) in qla2x00_remove_one()
3917 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3927 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3928 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3930 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3934 vfree(base_vha->scan.l); in qla2x00_remove_one()
3946 if (base_vha->timer_active) in qla2x00_remove_one()
3949 base_vha->flags.online = 0; in qla2x00_remove_one()
3952 if (ha->exlogin_buf) in qla2x00_remove_one()
3956 if (ha->exchoffld_buf) in qla2x00_remove_one()
3965 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3967 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3973 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3977 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3989 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3990 list_for_each_entry_safe(item, next, &list->head, list) { in qla24xx_free_purex_list()
3991 list_del(&item->list); in qla24xx_free_purex_list()
3992 if (item == &item->vha->default_item) in qla24xx_free_purex_list()
3996 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
4002 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
4007 if (vha->timer_active) in qla2x00_free_device()
4011 vha->flags.online = 0; in qla2x00_free_device()
4013 /* turn-off interrupts on the card */ in qla2x00_free_device()
4014 if (ha->interrupts_on) { in qla2x00_free_device()
4015 vha->flags.init_done = 0; in qla2x00_free_device()
4016 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
4024 if (ha->wq) { in qla2x00_free_device()
4025 destroy_workqueue(ha->wq); in qla2x00_free_device()
4026 ha->wq = NULL; in qla2x00_free_device()
4030 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
4046 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
4055 if (!fcport->rport) in qla2x00_schedule_rport_del()
4058 if (fcport->rport) { in qla2x00_schedule_rport_del()
4059 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
4061 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
4062 fcport->rport->roles); in qla2x00_schedule_rport_del()
4063 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
4080 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
4086 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
4087 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
4096 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
4102 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
4113 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
4115 fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
4116 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
4117 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
4121 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
4122 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
4125 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
4138 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4139 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4140 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4159 ha->vp_map = kcalloc(MAX_MULTI_ID_FABRIC, sizeof(struct qla_vp_map), GFP_KERNEL); in qla2x00_mem_alloc()
4160 if (!ha->vp_map) in qla2x00_mem_alloc()
4164 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
4165 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4166 if (!ha->init_cb) in qla2x00_mem_alloc()
4169 rc = btree_init32(&ha->host_map); in qla2x00_mem_alloc()
4176 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4177 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4178 if (!ha->gid_list) in qla2x00_mem_alloc()
4181 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4182 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4194 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4196 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4198 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4200 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4204 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4205 if (!ha->nvram) in qla2x00_mem_alloc()
4209 ha->pdev->device); in qla2x00_mem_alloc()
4210 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4212 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4215 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4217 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4220 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4222 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4223 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4228 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4230 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4231 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4241 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4242 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4243 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4244 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4250 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4251 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4252 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4253 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4257 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4260 return -ENOMEM; in qla2x00_mem_alloc()
4262 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4264 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4265 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4266 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4267 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4268 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4270 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4273 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4276 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4282 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4283 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4284 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4285 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4286 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4288 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4289 &ha->pool.good.head); in qla2x00_mem_alloc()
4290 ha->pool.good.count++; in qla2x00_mem_alloc()
4296 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4297 list_del(&dsd->list); in qla2x00_mem_alloc()
4298 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4299 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4300 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4302 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4305 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4307 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4308 ha->pool.unusable.count); in qla2x00_mem_alloc()
4311 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4313 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4314 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4320 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4321 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4322 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4324 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4325 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4328 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4329 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4330 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4333 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4334 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4335 if (!ha->ct_sns) in qla2x00_mem_alloc()
4337 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4339 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4345 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4349 (*req)->length = req_len; in qla2x00_mem_alloc()
4350 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4351 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4352 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4353 if (!(*req)->ring) { in qla2x00_mem_alloc()
4354 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4361 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4365 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4366 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4367 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4368 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4369 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4370 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4371 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4375 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4376 (*rsp)->req = *req; in qla2x00_mem_alloc()
4377 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4378 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4379 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4380 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4381 (*rsp)->ring); in qla2x00_mem_alloc()
4383 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4384 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4387 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4388 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4393 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4395 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4398 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4399 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4400 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4402 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4403 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4406 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4408 ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4409 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4410 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4412 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4413 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4417 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4419 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4420 &ha->async_pd_dma); in qla2x00_mem_alloc()
4421 if (!ha->async_pd) in qla2x00_mem_alloc()
4423 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4424 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4427 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4430 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4433 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4437 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4438 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4441 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4442 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4443 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4444 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4445 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4449 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4450 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4452 if (!ha->flt) { in qla2x00_mem_alloc()
4453 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4459 ha->purex_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4462 if (!ha->purex_dma_pool) { in qla2x00_mem_alloc()
4463 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4468 ha->elsrej.size = sizeof(struct fc_els_ls_rjt) + 16; in qla2x00_mem_alloc()
4469 ha->elsrej.c = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4470 ha->elsrej.size, in qla2x00_mem_alloc()
4471 &ha->elsrej.cdma, in qla2x00_mem_alloc()
4473 if (!ha->elsrej.c) { in qla2x00_mem_alloc()
4474 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4478 ha->elsrej.c->er_cmd = ELS_LS_RJT; in qla2x00_mem_alloc()
4479 ha->elsrej.c->er_reason = ELS_RJT_LOGIC; in qla2x00_mem_alloc()
4480 ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; in qla2x00_mem_alloc()
4482 ha->lsrjt.size = sizeof(struct fcnvme_ls_rjt); in qla2x00_mem_alloc()
4483 ha->lsrjt.c = dma_alloc_coherent(&ha->pdev->dev, ha->lsrjt.size, in qla2x00_mem_alloc()
4484 &ha->lsrjt.cdma, GFP_KERNEL); in qla2x00_mem_alloc()
4485 if (!ha->lsrjt.c) { in qla2x00_mem_alloc()
4486 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4494 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_alloc()
4495 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_alloc()
4497 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_alloc()
4499 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4500 ha->flt, ha->flt_dma); in qla2x00_mem_alloc()
4503 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4504 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4506 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4508 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4510 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4512 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4514 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4516 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4517 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4518 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4519 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4524 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4525 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4526 (*req)->ring = NULL; in qla2x00_mem_alloc()
4527 (*req)->dma = 0; in qla2x00_mem_alloc()
4532 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4533 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4534 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4535 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4537 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4538 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4539 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4541 if (ha->sns_cmd) in qla2x00_mem_alloc()
4542 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4543 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4548 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4550 list_del(&dsd->list); in qla2x00_mem_alloc()
4551 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4552 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4553 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4555 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4556 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4558 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4559 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4564 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4565 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4569 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4570 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4573 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4574 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4576 kfree(ha->nvram); in qla2x00_mem_alloc()
4577 ha->nvram = NULL; in qla2x00_mem_alloc()
4579 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4580 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4582 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4583 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4585 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4586 ha->gid_list, in qla2x00_mem_alloc()
4587 ha->gid_list_dma); in qla2x00_mem_alloc()
4588 ha->gid_list = NULL; in qla2x00_mem_alloc()
4589 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4593 btree_destroy32(&ha->host_map); in qla2x00_mem_alloc()
4595 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4596 ha->init_cb_dma); in qla2x00_mem_alloc()
4597 ha->init_cb = NULL; in qla2x00_mem_alloc()
4598 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4600 kfree(ha->vp_map); in qla2x00_mem_alloc()
4601 ha->vp_map = NULL; in qla2x00_mem_alloc()
4605 return -ENOMEM; in qla2x00_mem_alloc()
4614 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4627 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4635 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4637 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4644 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4647 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4648 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4649 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4650 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4652 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4657 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4676 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4677 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4678 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4679 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4680 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4688 struct init_cb_81xx *icb = (struct init_cb_81xx *)vha->hw->init_cb; in qla2x00_number_of_exch()
4691 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4692 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4695 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4696 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4698 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4699 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4702 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4703 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4704 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4707 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4708 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4710 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4712 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4713 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4715 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4729 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4731 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4740 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4751 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4754 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4755 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4759 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4767 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4770 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4771 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4772 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4773 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4776 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4778 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4779 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4781 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4783 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4784 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4787 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4789 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4791 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4794 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4795 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4798 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4809 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4810 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4813 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4815 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4830 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4831 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4832 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4833 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4834 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4848 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4851 if (ha->fce) in qla2x00_free_fw_dump()
4852 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4853 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4855 if (ha->eft) in qla2x00_free_fw_dump()
4856 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4857 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4859 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4861 ha->fce = NULL; in qla2x00_free_fw_dump()
4862 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4863 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4864 ha->eft = NULL; in qla2x00_free_fw_dump()
4865 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4866 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4867 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4868 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4869 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4870 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4873 vfree(fwdt->template); in qla2x00_free_fw_dump()
4874 fwdt->template = NULL; in qla2x00_free_fw_dump()
4875 fwdt->length = 0; in qla2x00_free_fw_dump()
4891 if (ha->mctp_dump) in qla2x00_mem_free()
4892 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4893 ha->mctp_dump_dma); in qla2x00_mem_free()
4894 ha->mctp_dump = NULL; in qla2x00_mem_free()
4896 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4897 ha->srb_mempool = NULL; in qla2x00_mem_free()
4899 if (ha->dcbx_tlv) in qla2x00_mem_free()
4900 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4901 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4902 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4904 if (ha->xgmac_data) in qla2x00_mem_free()
4905 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4906 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4907 ha->xgmac_data = NULL; in qla2x00_mem_free()
4909 if (ha->sns_cmd) in qla2x00_mem_free()
4910 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4911 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4912 ha->sns_cmd = NULL; in qla2x00_mem_free()
4913 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4915 if (ha->ct_sns) in qla2x00_mem_free()
4916 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4917 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4918 ha->ct_sns = NULL; in qla2x00_mem_free()
4919 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4921 if (ha->sfp_data) in qla2x00_mem_free()
4922 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4923 ha->sfp_data_dma); in qla2x00_mem_free()
4924 ha->sfp_data = NULL; in qla2x00_mem_free()
4926 if (ha->flt) in qla2x00_mem_free()
4927 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4929 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4930 ha->flt = NULL; in qla2x00_mem_free()
4931 ha->flt_dma = 0; in qla2x00_mem_free()
4933 if (ha->ms_iocb) in qla2x00_mem_free()
4934 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4935 ha->ms_iocb = NULL; in qla2x00_mem_free()
4936 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4938 if (ha->sf_init_cb) in qla2x00_mem_free()
4939 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4940 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4942 if (ha->ex_init_cb) in qla2x00_mem_free()
4943 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4944 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4945 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4946 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4948 if (ha->async_pd) in qla2x00_mem_free()
4949 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4950 ha->async_pd = NULL; in qla2x00_mem_free()
4951 ha->async_pd_dma = 0; in qla2x00_mem_free()
4953 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4954 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4956 if (ha->gid_list) in qla2x00_mem_free()
4957 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4958 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4959 ha->gid_list = NULL; in qla2x00_mem_free()
4960 ha->gid_list_dma = 0; in qla2x00_mem_free()
4962 if (ha->base_qpair && !list_empty(&ha->base_qpair->dsd_list)) { in qla2x00_mem_free()
4967 &ha->base_qpair->dsd_list, list) { in qla2x00_mem_free()
4968 dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, in qla2x00_mem_free()
4969 dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4970 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4975 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4976 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4978 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4979 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4981 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4982 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4984 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4987 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4989 list_del(&dsd->list); in qla2x00_mem_free()
4990 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4991 dsd->dsd_list_dma); in qla2x00_mem_free()
4992 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4994 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4995 ha->pool.unusable.count--; in qla2x00_mem_free()
4997 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
4998 list_del(&dsd->list); in qla2x00_mem_free()
4999 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
5000 dsd->dsd_list_dma); in qla2x00_mem_free()
5001 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
5003 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
5007 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
5008 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
5013 if (ha->init_cb) in qla2x00_mem_free()
5014 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
5015 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
5017 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_free()
5018 ha->purex_dma_pool = NULL; in qla2x00_mem_free()
5020 if (ha->elsrej.c) { in qla2x00_mem_free()
5021 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_free()
5022 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_free()
5023 ha->elsrej.c = NULL; in qla2x00_mem_free()
5026 if (ha->lsrjt.c) { in qla2x00_mem_free()
5027 dma_free_coherent(&ha->pdev->dev, ha->lsrjt.size, ha->lsrjt.c, in qla2x00_mem_free()
5028 ha->lsrjt.cdma); in qla2x00_mem_free()
5029 ha->lsrjt.c = NULL; in qla2x00_mem_free()
5032 ha->init_cb = NULL; in qla2x00_mem_free()
5033 ha->init_cb_dma = 0; in qla2x00_mem_free()
5035 vfree(ha->optrom_buffer); in qla2x00_mem_free()
5036 ha->optrom_buffer = NULL; in qla2x00_mem_free()
5037 kfree(ha->nvram); in qla2x00_mem_free()
5038 ha->nvram = NULL; in qla2x00_mem_free()
5039 kfree(ha->npiv_info); in qla2x00_mem_free()
5040 ha->npiv_info = NULL; in qla2x00_mem_free()
5041 kfree(ha->swl); in qla2x00_mem_free()
5042 ha->swl = NULL; in qla2x00_mem_free()
5043 kfree(ha->loop_id_map); in qla2x00_mem_free()
5044 ha->sf_init_cb = NULL; in qla2x00_mem_free()
5045 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
5046 ha->loop_id_map = NULL; in qla2x00_mem_free()
5048 kfree(ha->vp_map); in qla2x00_mem_free()
5049 ha->vp_map = NULL; in qla2x00_mem_free()
5060 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
5069 vha->host = host; in qla2x00_create_host()
5070 vha->host_no = host->host_no; in qla2x00_create_host()
5071 vha->hw = ha; in qla2x00_create_host()
5073 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
5074 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
5075 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
5077 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
5078 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
5079 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
5080 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
5081 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
5082 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
5083 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
5084 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
5085 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
5087 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
5088 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
5090 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
5091 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
5092 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
5093 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
5098 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
5099 (ha->max_loop_id + 1); in qla2x00_create_host()
5100 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
5101 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
5102 if (!vha->gnl.l) { in qla2x00_create_host()
5105 scsi_host_put(vha->host); in qla2x00_create_host()
5110 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
5111 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
5112 if (!vha->scan.l) { in qla2x00_create_host()
5115 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
5116 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
5117 vha->gnl.l = NULL; in qla2x00_create_host()
5118 scsi_host_put(vha->host); in qla2x00_create_host()
5121 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
5123 snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", in qla2x00_create_host()
5124 QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
5127 vha->host, vha->hw, vha, in qla2x00_create_host()
5128 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
5138 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
5150 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
5151 e->type = type; in qla2x00_alloc_work()
5152 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
5162 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
5163 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
5165 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
5168 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
5171 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
5186 e->u.aen.code = code; in qla2x00_post_aen_work()
5187 e->u.aen.data = data; in qla2x00_post_aen_work()
5200 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
5215 e->u.logio.fcport = fcport; \
5217 e->u.logio.data[0] = data[0]; \
5218 e->u.logio.data[1] = data[1]; \
5220 fcport->flags |= FCF_ASYNC_ACTIVE; \
5239 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5252 vha->host_no); in qla2x00_uevent_emit()
5258 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5271 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5272 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5273 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5281 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5284 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5285 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5286 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5289 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5290 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5291 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5293 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5295 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5304 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5309 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5311 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5312 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5314 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5316 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5317 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5318 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5324 pla->ref_count--; in qla24xx_create_new_sess()
5327 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5330 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5331 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5332 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5333 fcport->tgt_short_link_down_cnt = 0; in qla24xx_create_new_sess()
5335 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5338 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5339 if (NVME_PRIORITY(vha->hw, fcport)) in qla24xx_create_new_sess()
5340 fcport->do_prli_nvme = 1; in qla24xx_create_new_sess()
5342 fcport->do_prli_nvme = 0; in qla24xx_create_new_sess()
5344 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5345 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5347 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5348 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5349 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5350 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5356 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5359 list_del(&pla->list); in qla24xx_create_new_sess()
5365 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5368 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5373 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5374 tfcp->fw_login_state); in qla24xx_create_new_sess()
5378 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5384 pla->ref_count--; in qla24xx_create_new_sess()
5387 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5390 fcport->id_changed = 1; in qla24xx_create_new_sess()
5391 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5392 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5393 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5396 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5399 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5400 fcport->local = 0; in qla24xx_create_new_sess()
5401 fcport->loop_id = in qla24xx_create_new_sess()
5403 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5404 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5407 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5410 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5413 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5415 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5421 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5423 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5430 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5431 tfcp->fw_login_state); in qla24xx_create_new_sess()
5433 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5437 fcport->login_pause = 1; in qla24xx_create_new_sess()
5438 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5441 fcport->login_pause = 1; in qla24xx_create_new_sess()
5442 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5447 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5451 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5452 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5453 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5454 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5455 fcport->fc4_type = in qla24xx_create_new_sess()
5457 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5459 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5461 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5471 list_del(&pla->list); in qla24xx_create_new_sess()
5479 struct srb *sp = e->u.iosb.sp; in qla_sp_retry()
5485 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5486 __func__, sp->name, rval); in qla_sp_retry()
5499 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5500 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5501 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5505 switch (e->type) { in qla2x00_do_work()
5507 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5508 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5511 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5514 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5515 e->u.logio.data); in qla2x00_do_work()
5518 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5521 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5522 e->u.logio.data); in qla2x00_do_work()
5525 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5531 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5540 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5541 e->u.fcport.opt); in qla2x00_do_work()
5544 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5547 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5550 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5556 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5559 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5560 e->u.logio.data); in qla2x00_do_work()
5563 qla_fab_async_scan(vha, e->u.iosb.sp); in qla2x00_do_work()
5566 qla_fab_scan_finish(vha, e->u.iosb.sp); in qla2x00_do_work()
5569 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5575 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5579 e->u.fcport.fcport); in qla2x00_do_work()
5587 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5588 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5589 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5590 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5593 list_del_init(&e->list); in qla2x00_do_work()
5594 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5609 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5625 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5630 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5631 fcport->login_retry) { in qla2x00_relogin()
5632 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5633 fcport->disc_state == DSC_LOGIN_AUTH_PEND || in qla2x00_relogin()
5634 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5637 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5638 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5641 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5645 } else if (vha->hw->current_topology == in qla2x00_relogin()
5647 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5650 } else if (vha->hw->current_topology == in qla2x00_relogin()
5652 fcport->login_retry--; in qla2x00_relogin()
5657 fcport->old_loop_id = in qla2x00_relogin()
5658 fcport->loop_id; in qla2x00_relogin()
5661 fcport->loop_id); in qla2x00_relogin()
5666 &vha->dpc_flags); in qla2x00_relogin()
5670 fcport->login_retry, in qla2x00_relogin()
5671 fcport->loop_id); in qla2x00_relogin()
5673 fcport->login_retry = 0; in qla2x00_relogin()
5676 if (fcport->login_retry == 0 && in qla2x00_relogin()
5682 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5687 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5693 /* Schedule work on any of the dpc-workqueues */
5697 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5701 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5702 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5706 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5707 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5708 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5715 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5716 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5719 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5720 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5724 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5730 /* Work: Perform NIC Core Unrecoverable state handling */
5736 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5742 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5743 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5758 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5798 /* Work: Perform NIC Core Reset handling */
5804 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5810 "Failed to dump mctp\n"); in qla83xx_nic_core_reset_work()
5814 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5827 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5833 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5843 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5879 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5891 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5904 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5917 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5922 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5977 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5981 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5986 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5988 ha->portnum); in qla83xx_idc_lock()
5996 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
6016 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
6019 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
6031 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
6034 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
6035 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
6045 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
6070 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
6072 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
6089 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
6101 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6109 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6117 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6120 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6124 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
6125 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
6126 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
6127 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
6128 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
6129 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
6130 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
6131 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
6132 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
6133 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
6134 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
6135 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
6137 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
6138 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
6139 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
6141 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
6142 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
6143 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
6145 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
6146 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
6148 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
6149 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
6152 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
6153 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
6154 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
6157 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6158 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
6159 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
6160 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
6161 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6164 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6165 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
6166 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
6167 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
6168 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6171 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
6172 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6173 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
6180 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
6198 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
6205 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
6206 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
6207 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
6208 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
6209 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
6214 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
6215 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
6216 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
6217 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
6219 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
6223 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
6224 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
6225 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
6230 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
6231 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
6232 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
6233 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
6234 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6235 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6236 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6237 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6238 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6239 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6240 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6241 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6242 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6247 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6248 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6249 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6250 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6251 vha->node_name, in qla24xx_process_purex_rdp()
6252 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6253 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6254 vha->port_name, in qla24xx_process_purex_rdp()
6255 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6257 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6258 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6259 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6260 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6261 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6262 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6263 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6264 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6265 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6266 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6269 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6270 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6271 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6272 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6273 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6274 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6276 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6278 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6279 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6286 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6287 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6288 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6290 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6291 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6292 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6294 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6295 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6296 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6298 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6299 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6300 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6302 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6303 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6304 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6313 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6314 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6315 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6316 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6317 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6321 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6322 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6323 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6324 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6325 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6329 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6330 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6331 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6332 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6333 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6337 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6338 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6339 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6340 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6341 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6345 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6346 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6347 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6348 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6349 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6357 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6365 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6373 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6381 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6389 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6399 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6400 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6401 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6407 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6409 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6410 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6412 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6413 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6415 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6416 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6418 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6424 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6426 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6434 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6438 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6446 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6447 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6449 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6450 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6451 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6458 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6461 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6464 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6467 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6474 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6475 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6486 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6487 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6488 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6491 list_del(&item->list); in qla24xx_process_purex_list()
6492 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6508 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6512 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6519 if (data == ha->portnum) { in qla83xx_idc_unlock()
6521 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6526 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6534 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6538 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6545 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6550 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6567 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6572 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6596 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6601 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6624 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6628 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6629 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6657 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6669 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6697 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6702 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6703 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6722 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6725 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6728 ha->portnum); in qla83xx_idc_state_handler()
6731 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6734 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6741 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6747 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6750 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6757 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6767 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6774 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6777 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6780 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6812 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6813 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6818 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6821 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6829 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6842 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6845 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6855 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6857 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6859 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6869 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6884 * is kick-off by the driver's detect code and starts up
6899 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6913 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6916 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6919 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6921 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6925 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6929 ha->dpc_active = 1; in qla2x00_do_dpc()
6933 base_vha->dpc_flags); in qla2x00_do_dpc()
6938 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6952 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6965 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6970 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6972 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6973 * Escalate to chip-reset in qla2x00_do_dpc()
6976 &base_vha->dpc_flags); in qla2x00_do_dpc()
6979 &base_vha->dpc_flags); in qla2x00_do_dpc()
6987 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6993 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6995 &base_vha->dpc_flags); in qla2x00_do_dpc()
7004 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7009 &base_vha->dpc_flags)) in qla2x00_do_dpc()
7011 &base_vha->dpc_flags); in qla2x00_do_dpc()
7019 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7023 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
7029 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7031 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
7033 * when a forced chip-reset occurs. in qla2x00_do_dpc()
7034 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
7036 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
7040 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7041 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7044 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
7049 !ha->flags.fw_started) in qla2x00_do_dpc()
7054 !ha->flags.fw_started) in qla2x00_do_dpc()
7062 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7063 base_vha->flags.online = 1; in qla2x00_do_dpc()
7066 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
7069 &base_vha->dpc_flags); in qla2x00_do_dpc()
7072 &base_vha->dpc_flags); in qla2x00_do_dpc()
7078 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7079 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7081 (&base_vha->purex_list); in qla2x00_do_dpc()
7083 &base_vha->dpc_flags); in qla2x00_do_dpc()
7090 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7099 &base_vha->dpc_flags); in qla2x00_do_dpc()
7100 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
7116 &base_vha->dpc_flags); in qla2x00_do_dpc()
7124 &base_vha->dpc_flags) && in qla2x00_do_dpc()
7125 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
7130 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
7136 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7137 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7138 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
7140 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
7141 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
7142 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
7143 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7153 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7161 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7166 &base_vha->dpc_flags); in qla2x00_do_dpc()
7176 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7177 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7178 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7183 if (!ha->interrupts_on) in qla2x00_do_dpc()
7184 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
7187 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7188 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
7189 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
7194 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7195 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
7196 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
7201 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
7202 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
7204 qpair->online = online; in qla2x00_do_dpc()
7205 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
7209 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7210 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
7212 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
7213 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
7229 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7233 ha->dpc_active = 0; in qla2x00_do_dpc()
7245 ha->dpc_active = 0; in qla2x00_do_dpc()
7253 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7254 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7256 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7270 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7271 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7272 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7274 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7280 vha->marker_needed = 1; in qla2x00_rst_aen()
7281 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7282 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7288 struct qla_hw_data *ha = vha->hw; in qla_do_heartbeat()
7297 cmpl_cnt = ha->base_qpair->cmd_completion_cnt; in qla_do_heartbeat()
7298 if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && in qla_do_heartbeat()
7299 cmpl_cnt != ha->base_qpair->cmd_cnt) { in qla_do_heartbeat()
7303 ha->base_qpair->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7305 for (i = 0; i < ha->max_qpairs; i++) { in qla_do_heartbeat()
7306 if (ha->queue_pair_map[i]) { in qla_do_heartbeat()
7307 cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; in qla_do_heartbeat()
7308 if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && in qla_do_heartbeat()
7309 cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { in qla_do_heartbeat()
7313 ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7323 struct qla_hw_data *ha = vha->hw; in qla_heart_beat()
7325 if (vha->vp_idx) in qla_heart_beat()
7328 if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) in qla_heart_beat()
7337 time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) in qla_heart_beat()
7341 ha->last_heartbeat_run_jiffies = jiffies; in qla_heart_beat()
7342 queue_work(ha->wq, &ha->heartbeat_work); in qla_heart_beat()
7348 struct qla_hw_data *ha = vha->hw; in qla_wind_down_chip()
7350 if (!ha->flags.eeh_busy) in qla_wind_down_chip()
7352 if (ha->pci_error_state) in qla_wind_down_chip()
7357 * Current system is not handling PCIE error. At this point, this is in qla_wind_down_chip()
7360 if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handling * HZ) && in qla_wind_down_chip()
7361 !ha->flags.eeh_flush) { in qla_wind_down_chip()
7365 ha->isp_ops->reset_chip(vha); in qla_wind_down_chip()
7366 ha->isp_ops->disable_intrs(ha); in qla_wind_down_chip()
7368 ha->flags.eeh_flush = EEH_FLUSH_RDY; in qla_wind_down_chip()
7369 ha->eeh_jif = jiffies; in qla_wind_down_chip()
7371 } else if (ha->flags.eeh_flush == EEH_FLUSH_RDY && in qla_wind_down_chip()
7372 time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { in qla_wind_down_chip()
7373 pci_clear_master(ha->pdev); in qla_wind_down_chip()
7377 ha->flags.eeh_flush = EEH_FLUSH_DONE; in qla_wind_down_chip()
7380 "PCI Error handling complete, all IOs aborted.\n"); in qla_wind_down_chip()
7401 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7406 if (ha->flags.eeh_busy) { in qla2x00_timer()
7411 ha->flags.eeh_busy); in qla2x00_timer()
7418 * the read returns -1 then disable the board. in qla2x00_timer()
7420 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7421 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7426 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7427 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7435 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7438 if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7439 vha->link_down_time++; in qla2x00_timer()
7441 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7442 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_timer()
7443 if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7444 fcport->tgt_link_down_time++; in qla2x00_timer()
7446 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7449 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7450 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7451 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7452 && vha->flags.online) { in qla2x00_timer()
7454 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7455 vha->loop_down_abort_time) { in qla2x00_timer()
7458 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7460 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7461 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7464 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7467 /* NPIV - scan physical port only */ in qla2x00_timer()
7468 if (!vha->vp_idx) { in qla2x00_timer()
7469 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7471 req = ha->req_q_map[0]; in qla2x00_timer()
7473 index < req->num_outstanding_cmds; in qla2x00_timer()
7477 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7480 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7482 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7484 sfcp = sp->fcport; in qla2x00_timer()
7485 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7490 &vha->dpc_flags); in qla2x00_timer()
7493 &vha->dpc_flags); in qla2x00_timer()
7496 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7503 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7504 if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { in qla2x00_timer()
7506 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7510 &vha->dpc_flags); in qla2x00_timer()
7513 &vha->dpc_flags); in qla2x00_timer()
7517 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7518 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7521 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7524 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7530 if (vha->hw->flags.edif_enabled) in qla2x00_timer()
7534 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7538 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7539 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7541 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7543 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7547 * FC-NVME in qla2x00_timer()
7550 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7551 if (!vha->vp_idx && in qla2x00_timer()
7552 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7553 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7554 !ha->flags.host_shutting_down) { in qla2x00_timer()
7555 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7558 ha->nvme_last_rptd_aen); in qla2x00_timer()
7559 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7563 if (!vha->vp_idx && in qla2x00_timer()
7564 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7568 ha->last_zio_threshold); in qla2x00_timer()
7569 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7570 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7578 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7579 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7581 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7582 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7583 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7584 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7585 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7586 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7587 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7591 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7592 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7593 start_dpc, test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7598 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7599 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7600 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7601 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7602 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7603 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7663 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7694 if (!blob->name) in qla2x00_request_firmware()
7698 if (blob->fw) in qla2x00_request_firmware()
7701 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7703 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7704 blob->fw = NULL; in qla2x00_request_firmware()
7719 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7720 release_firmware(blob->fw); in qla2x00_release_firmware()
7726 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7727 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7736 ha->chip_reset++; in qla_pci_error_cleanup()
7738 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7739 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7740 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7741 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7742 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7750 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7751 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7752 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7753 qpair->online = 0; in qla_pci_error_cleanup()
7755 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7759 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7760 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7761 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7762 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7764 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7765 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7767 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7770 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7771 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7773 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7774 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7775 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7776 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7777 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7778 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7779 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7780 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7782 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7790 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7795 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7797 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7808 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7818 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7821 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7839 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7840 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7841 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7846 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7857 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7859 stat = rd_reg_word(®->hccr); in qla2xxx_pci_mmio_enabled()
7863 stat = rd_reg_dword(®->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7867 stat = rd_reg_dword(®24->host_status); in qla2xxx_pci_mmio_enabled()
7871 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7875 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7890 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7897 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7902 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7911 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7918 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7923 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7926 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7927 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7928 qpair->online = 1; in qla2xxx_pci_slot_reset()
7929 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7931 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7932 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7933 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7934 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7935 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7938 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7957 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7969 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7976 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7977 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7981 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7984 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7985 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7986 ha->eeh_jif = jiffies; in qla_pci_set_eeh_busy()
7987 ha->flags.eeh_flush = 0; in qla_pci_set_eeh_busy()
7989 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7992 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
8004 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
8005 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
8007 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
8010 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
8018 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
8030 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
8031 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
8032 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
8033 qpair->online = 0; in qla_pci_reset_prepare()
8034 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
8036 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
8045 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
8054 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
8055 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
8056 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
8057 qpair->online = 1; in qla_pci_reset_done()
8058 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
8060 base_vha->flags.online = 1; in qla_pci_reset_done()
8061 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
8062 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
8067 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
8068 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
8070 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
8073 blk_mq_map_hw_queues(qmap, &vha->hw->pdev->dev, in qla2xxx_map_queues()
8074 vha->irq_offset); in qla2xxx_map_queues()
8098 .this_id = -1,
8166 * qla2x00_module_init - Module initialization.
8266 return -ENOMEM; in qla2x00_module_init()
8286 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
8295 ret = -ENODEV; in qla2x00_module_init()
8310 ret = -ENODEV; in qla2x00_module_init()
8344 * qla2x00_module_exit - Module cleanup.