Lines Matching +full:mctp +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
15 #include <linux/blk-mq-pci.h>
61 "beginning. Default is 0 - class 2 not supported.");
73 "a PORT-DOWN status.");
80 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
92 "vary by ISP type. Default is 1 - allocate memory.");
99 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
100 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
101 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
102 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
103 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
104 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
105 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
106 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
107 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
108 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
109 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
110 "\t\t0x1e400000 - Preferred value for capturing essential "
126 "0 - no FDMI registrations. "
127 "1 - provide FDMI registrations (default).");
139 " Enable T10-CRC-DIF:\n"
141 " 0 -- No DIF Support\n"
142 " 1 -- Enable DIF for all types\n"
143 " 2 -- Enable DIF for all types, except Type 0.\n");
153 "0 - no NVMe. Default is Y");
158 " Enable T10-CRC-DIF Error isolation by HBA:\n"
160 " 0 -- Error isolation disabled\n"
161 " 1 -- Error isolation enabled only for DIX Type 0\n"
162 " 2 -- Error isolation enabled for all Types\n");
168 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
182 " 2 -- load firmware via the request_firmware() (hotplug).\n"
184 " 1 -- load firmware from flash.\n"
185 " 0 -- use default semantics.\n");
191 "Default is 0 - skip ETS enablement.");
197 " 0 -- Regular doorbell.\n"
198 " 1 -- CAMRAM doorbell (faster).\n");
204 "Default is 0 - Do not use GFF_ID information.");
210 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
216 " 0 (Default) -- Reset on failure.\n"
217 " 1 -- Do not reset on failure.\n");
229 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
235 "0 - MiniDump disabled. "
236 "1 (Default) - MiniDump enabled.");
242 "0 (Default)- Disabled.");
259 "1 - Set fw option to hold ABTS.");
266 "1 - Move IOCBs.");
277 "Set to enable MSI or MSI-X interrupt mechanism.\n"
278 " Default is 1, enable MSI-X interrupt mechanism.\n"
279 " 0 -- enable traditional pin-based mechanism.\n"
280 " 1 -- enable MSI-X interrupt mechanism.\n"
281 " 2 -- enable MSI interrupt mechanism.\n");
299 " 0 -- Let HBA firmware decide\n"
300 " 1 -- Force T10 CRC\n"
301 " 2 -- Force IP checksum\n");
315 " Default is 0 - No SmartSAN registration,"
316 " 1 - Register SmartSAN Management Attributes.");
323 "0 - no RDP responses (default). "
324 "1 - provide RDP responses.");
343 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
344 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
345 add_timer(&vha->timer); in qla2x00_start_timer()
346 vha->timer_active = 1; in qla2x00_start_timer()
353 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
359 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
365 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
366 vha->timer_active = 0; in qla2x00_stop_timer()
380 /* -------------------------------------------------------------------------- */
384 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
386 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
387 rsp->req = req; in qla_init_base_qpair()
388 ha->base_qpair->hw = ha; in qla_init_base_qpair()
389 ha->base_qpair->req = req; in qla_init_base_qpair()
390 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
391 ha->base_qpair->vha = vha; in qla_init_base_qpair()
392 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
393 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
394 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
395 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
396 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
397 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
399 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
400 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
403 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
409 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
411 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
413 if (!ha->req_q_map) { in qla2x00_alloc_queues()
419 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
421 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
427 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
428 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
436 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
437 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
439 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
450 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
451 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
452 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
453 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
457 kfree(ha->base_qpair); in qla2x00_alloc_queues()
458 ha->base_qpair = NULL; in qla2x00_alloc_queues()
460 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
461 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
463 kfree(ha->req_q_map); in qla2x00_alloc_queues()
464 ha->req_q_map = NULL; in qla2x00_alloc_queues()
466 return -ENOMEM; in qla2x00_alloc_queues()
472 if (req && req->ring_fx00) in qla2x00_free_req_que()
473 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
474 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
475 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
476 } else if (req && req->ring) in qla2x00_free_req_que()
477 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
478 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
479 req->ring, req->dma); in qla2x00_free_req_que()
482 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
490 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
491 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
492 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
493 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
494 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
495 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
496 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
497 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
509 if (ha->queue_pair_map) { in qla2x00_free_queues()
510 kfree(ha->queue_pair_map); in qla2x00_free_queues()
511 ha->queue_pair_map = NULL; in qla2x00_free_queues()
513 if (ha->base_qpair) { in qla2x00_free_queues()
514 kfree(ha->base_qpair); in qla2x00_free_queues()
515 ha->base_qpair = NULL; in qla2x00_free_queues()
518 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
519 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
520 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
523 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
524 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
525 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
527 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
529 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
531 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
533 kfree(ha->req_q_map); in qla2x00_free_queues()
534 ha->req_q_map = NULL; in qla2x00_free_queues()
537 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
538 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
539 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
542 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
543 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
544 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
545 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
547 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
549 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
551 kfree(ha->rsp_q_map); in qla2x00_free_queues()
552 ha->rsp_q_map = NULL; in qla2x00_free_queues()
558 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
564 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
566 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
569 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
582 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
585 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
589 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
615 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
620 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
631 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
633 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
634 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
636 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
641 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
655 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
659 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
668 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
670 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
671 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
677 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
680 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
682 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
685 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
686 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
687 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
688 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
691 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
693 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
694 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
697 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
698 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
700 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
701 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
704 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
705 struct ct6_dsd *ctx1 = sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
707 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
708 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
709 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); in qla2x00_sp_free_dma()
710 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
711 ha->gbl_dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
712 mempool_free(ctx1, ha->ctx_mempool); in qla2x00_sp_free_dma()
719 struct completion *comp = sp->comp; in qla2x00_sp_compl()
721 sp->free(sp); in qla2x00_sp_compl()
722 cmd->result = res; in qla2x00_sp_compl()
724 cmd->scsi_done(cmd); in qla2x00_sp_compl()
732 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
734 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
736 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
739 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
740 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
741 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
742 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
745 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
747 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
748 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
751 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
752 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
756 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
757 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
758 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
759 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
761 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
765 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
766 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
767 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
768 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
770 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
773 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
774 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
775 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
776 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
779 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
780 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
781 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
782 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
784 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
787 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
788 struct ct6_dsd *ctx1 = sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
790 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
791 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
792 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); in qla2xxx_qpair_sp_free_dma()
793 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
794 ha->gbl_dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
795 mempool_free(ctx1, ha->ctx_mempool); in qla2xxx_qpair_sp_free_dma()
796 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
799 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
800 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
802 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
803 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
810 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
812 sp->free(sp); in qla2xxx_qpair_sp_compl()
813 cmd->result = res; in qla2xxx_qpair_sp_compl()
815 cmd->scsi_done(cmd); in qla2xxx_qpair_sp_compl()
824 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
825 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
826 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
827 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
831 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
833 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
837 if (ha->mqenable) { in qla2xxx_queuecommand()
844 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
850 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
851 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
855 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
859 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
866 cmd->result = rval; in qla2xxx_queuecommand()
873 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
878 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
882 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
883 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
887 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
888 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
889 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
892 atomic_read(&fcport->state), in qla2xxx_queuecommand()
893 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
894 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
901 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
904 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
906 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
907 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
912 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
914 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
915 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
918 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
919 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
921 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
931 sp->free(sp); in qla2xxx_queuecommand()
937 cmd->scsi_done(cmd); in qla2xxx_queuecommand()
948 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
949 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
950 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
951 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
957 cmd->result = rval; in qla2xxx_mqueuecommand()
964 if (!qpair->online) { in qla2xxx_mqueuecommand()
966 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
967 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
971 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
972 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
976 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
977 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
978 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
981 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
982 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
983 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
990 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
993 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
995 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
996 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1003 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1004 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1006 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1007 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1009 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1019 sp->free(sp); in qla2xxx_mqueuecommand()
1025 cmd->scsi_done(cmd); in qla2xxx_mqueuecommand()
1048 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2x00_eh_wait_on_command()
1049 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_on_command()
1052 if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) { in qla2x00_eh_wait_on_command()
1058 while (CMD_SP(cmd) && wait_iter--) { in qla2x00_eh_wait_on_command()
1074 * ha - pointer to host adapter structure
1077 * Does context switching-Release SPIN_LOCK
1089 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1090 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1093 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1094 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1095 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1096 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1100 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1110 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1114 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1117 vha, vha->fcport_count); in test_fcport_count()
1118 res = (vha->fcport_count == 0); in test_fcport_count()
1119 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1136 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1141 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1149 * ha - pointer to host adapter structure
1152 * Does context switching-Release SPIN_LOCK
1159 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1160 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1162 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1163 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1164 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1165 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1166 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1177 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1178 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1181 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1182 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1183 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1184 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1188 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1189 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1192 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1218 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1225 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1244 qpair = sp->qpair; in qla2xxx_eh_abort()
1246 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1249 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1250 sp->comp = ∁ in qla2xxx_eh_abort()
1251 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1254 id = cmd->device->id; in qla2xxx_eh_abort()
1255 lun = cmd->device->lun; in qla2xxx_eh_abort()
1259 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1266 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1272 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1279 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1290 sp->comp = NULL; in qla2xxx_eh_abort()
1293 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1294 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1308 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1315 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1316 req = vha->req; in qla2x00_eh_wait_for_pending_commands()
1318 cnt < req->num_outstanding_cmds; cnt++) { in qla2x00_eh_wait_for_pending_commands()
1319 sp = req->outstanding_cmds[cnt]; in qla2x00_eh_wait_for_pending_commands()
1322 if (sp->type != SRB_SCSI_CMD) in qla2x00_eh_wait_for_pending_commands()
1324 if (vha->vp_idx != sp->vha->vp_idx) in qla2x00_eh_wait_for_pending_commands()
1333 match = cmd->device->id == t; in qla2x00_eh_wait_for_pending_commands()
1336 match = (cmd->device->id == t && in qla2x00_eh_wait_for_pending_commands()
1337 cmd->device->lun == l); in qla2x00_eh_wait_for_pending_commands()
1343 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1345 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1347 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1363 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in __qla2xxx_eh_generic_reset()
1364 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in __qla2xxx_eh_generic_reset()
1375 if (fcport->deleted) in __qla2xxx_eh_generic_reset()
1379 "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no, in __qla2xxx_eh_generic_reset()
1380 cmd->device->id, cmd->device->lun, cmd); in __qla2xxx_eh_generic_reset()
1389 if (do_reset(fcport, cmd->device->lun, 1) in __qla2xxx_eh_generic_reset()
1396 if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, in __qla2xxx_eh_generic_reset()
1397 cmd->device->lun, type) != QLA_SUCCESS) { in __qla2xxx_eh_generic_reset()
1405 vha->host_no, cmd->device->id, cmd->device->lun, cmd); in __qla2xxx_eh_generic_reset()
1412 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in __qla2xxx_eh_generic_reset()
1420 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_device_reset()
1421 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1431 ha->isp_ops->lun_reset); in qla2xxx_eh_device_reset()
1437 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_target_reset()
1438 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1448 ha->isp_ops->target_reset); in qla2xxx_eh_target_reset()
1469 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1470 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_eh_bus_reset()
1474 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1483 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1484 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1499 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1524 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1547 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1548 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1552 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1561 id = cmd->device->id; in qla2xxx_eh_host_reset()
1562 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1565 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1571 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1578 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1586 if (ha->wq) in qla2xxx_eh_host_reset()
1587 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1589 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1590 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1591 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1593 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1601 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1612 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1631 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1636 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1637 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1638 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1647 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1655 vha->marker_needed = 1; in qla2x00_loop_reset()
1666 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1667 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1670 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1671 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1677 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1680 sp->done(sp, res); in qla2x00_abort_srb()
1684 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1685 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1686 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1688 if (sp->comp) { in qla2x00_abort_srb()
1689 sp->done(sp, res); in qla2x00_abort_srb()
1693 sp->comp = ∁ in qla2x00_abort_srb()
1694 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1696 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1699 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1706 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1716 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1717 switch (sp->type) { in qla2x00_abort_srb()
1720 sp->done(sp, res); in qla2x00_abort_srb()
1724 sp->done(sp, res); in qla2x00_abort_srb()
1728 sp->done(sp, res); in qla2x00_abort_srb()
1742 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1743 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1745 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1748 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1750 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1751 req = qp->req; in __qla2x00_abort_all_cmds()
1752 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1753 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1759 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1760 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1761 sp->done(sp, res); in __qla2x00_abort_all_cmds()
1762 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1766 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1771 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1774 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1775 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1779 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1787 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1790 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1801 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1804 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1806 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1808 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1810 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1811 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1814 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1824 return -ENXIO; in qla2xxx_slave_alloc()
1826 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_slave_alloc()
1834 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_slave_configure()
1835 struct req_que *req = vha->req; in qla2xxx_slave_configure()
1837 if (IS_T10_PI_CAPABLE(vha->hw)) in qla2xxx_slave_configure()
1838 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); in qla2xxx_slave_configure()
1840 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_slave_configure()
1847 sdev->hostdata = NULL; in qla2xxx_slave_destroy()
1851 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1861 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1863 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1864 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1865 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1866 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1868 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1869 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1870 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1875 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1876 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1883 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
1885 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1886 ha->interrupts_on = 1; in qla2x00_enable_intrs()
1888 wrt_reg_word(®->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
1889 rd_reg_word(®->ictrl); in qla2x00_enable_intrs()
1890 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1898 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
1900 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
1901 ha->interrupts_on = 0; in qla2x00_disable_intrs()
1903 wrt_reg_word(®->ictrl, 0); in qla2x00_disable_intrs()
1904 rd_reg_word(®->ictrl); in qla2x00_disable_intrs()
1905 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
1912 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
1914 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
1915 ha->interrupts_on = 1; in qla24xx_enable_intrs()
1916 wrt_reg_dword(®->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
1917 rd_reg_dword(®->ictrl); in qla24xx_enable_intrs()
1918 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
1925 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
1929 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
1930 ha->interrupts_on = 0; in qla24xx_disable_intrs()
1931 wrt_reg_dword(®->ictrl, 0); in qla24xx_disable_intrs()
1932 rd_reg_dword(®->ictrl); in qla24xx_disable_intrs()
1933 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
1942 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
1944 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
1946 pci_name(ha->pdev)); in qla2x00_iospace_config()
1949 if (!(ha->bars & 1)) in qla2x00_iospace_config()
1953 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
1954 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
1955 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
1956 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
1958 pci_name(ha->pdev)); in qla2x00_iospace_config()
1962 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
1964 pci_name(ha->pdev)); in qla2x00_iospace_config()
1967 ha->pio_address = pio; in qla2x00_iospace_config()
1968 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
1970 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
1974 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
1975 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
1977 pci_name(ha->pdev)); in qla2x00_iospace_config()
1980 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
1981 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
1983 pci_name(ha->pdev)); in qla2x00_iospace_config()
1987 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
1988 if (!ha->iobase) { in qla2x00_iospace_config()
1989 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
1991 pci_name(ha->pdev)); in qla2x00_iospace_config()
1996 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
1997 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2000 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2007 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2008 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2009 if (ha->mqiobase) { in qla2x00_iospace_config()
2010 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2011 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2013 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2014 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2017 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2018 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2020 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2021 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2022 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2024 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2025 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2027 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2031 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2032 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2036 return (-ENOMEM); in qla2x00_iospace_config()
2045 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2047 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2049 pci_name(ha->pdev)); in qla83xx_iospace_config()
2055 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2056 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2058 pci_name(ha->pdev)); in qla83xx_iospace_config()
2061 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2062 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2064 pci_name(ha->pdev)); in qla83xx_iospace_config()
2068 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2069 if (!ha->iobase) { in qla83xx_iospace_config()
2070 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2072 pci_name(ha->pdev)); in qla83xx_iospace_config()
2076 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2078 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2079 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2080 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2081 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2082 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2084 if (!ha->mqiobase) { in qla83xx_iospace_config()
2085 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2090 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2091 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2092 if (ha->msixbase) { in qla83xx_iospace_config()
2094 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2096 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2103 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2107 ha->max_req_queues--; in qla83xx_iospace_config()
2109 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2113 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2114 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2115 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2117 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2118 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2120 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2124 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2125 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2129 return -ENOMEM; in qla83xx_iospace_config()
2526 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2527 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2529 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2530 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2531 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2534 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2535 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2536 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2539 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2540 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2541 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2544 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2545 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2546 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2549 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2550 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2551 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2552 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2553 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2554 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2557 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2558 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2561 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2562 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2565 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2566 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2567 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2568 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2569 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2572 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2573 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2574 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2575 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2576 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2579 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2580 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2581 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2582 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2583 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2586 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2587 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2588 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2591 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2592 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2593 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2596 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2597 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2598 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2599 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2600 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2603 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2604 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2605 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2606 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2607 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2610 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2611 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2612 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2613 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2618 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2619 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2620 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2621 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2626 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2627 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2628 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2629 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2630 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2631 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2634 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2635 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2636 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2637 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2638 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2639 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2642 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2645 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2646 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2647 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2648 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2649 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2650 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2653 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2654 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2655 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2656 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2657 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2658 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2661 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2662 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2663 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2664 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2665 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2666 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2670 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2671 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2672 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2673 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2674 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2675 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2679 ha->isp_type |= DT_ISP2281; 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->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2684 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2689 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2692 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2695 ha->port_no--; in qla2x00_set_isp_flags()
2697 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2700 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2702 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2710 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2713 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2714 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2715 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2716 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2724 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2726 if (!vha->host) in qla2xxx_scan_finished()
2728 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2731 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2738 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2739 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2743 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2746 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2748 i--; in qla2x00_iocb_work_fn()
2751 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2752 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2753 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2762 int ret = -ENODEV; in qla2x00_probe_one()
2777 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2778 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2779 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2780 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2781 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2782 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2783 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2784 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2785 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2786 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2787 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2788 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2789 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2790 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2791 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2792 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2793 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2794 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2795 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2828 ha->pdev = pdev; in qla2x00_probe_one()
2829 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2830 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2831 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2832 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2834 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2837 ha->bars = bars; in qla2x00_probe_one()
2838 ha->mem_only = mem_only; in qla2x00_probe_one()
2839 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
2840 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
2841 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
2842 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
2844 /* Set ISP-type information. */ in qla2x00_probe_one()
2850 pdev->needs_freset = 1; in qla2x00_probe_one()
2852 ha->prev_topology = 0; in qla2x00_probe_one()
2853 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
2854 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
2855 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
2856 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
2857 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
2858 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
2859 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
2860 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
2864 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2865 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
2868 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
2869 ha->gid_list_info_size = 4; in qla2x00_probe_one()
2870 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2871 ha->flash_data_off = ~0; in qla2x00_probe_one()
2872 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2873 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2874 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
2876 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2877 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
2880 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
2881 ha->gid_list_info_size = 4; in qla2x00_probe_one()
2882 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2883 ha->flash_data_off = ~0; in qla2x00_probe_one()
2884 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2885 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2886 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
2888 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2889 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2892 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2893 ha->gid_list_info_size = 6; in qla2x00_probe_one()
2895 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
2896 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2897 ha->flash_data_off = ~0; in qla2x00_probe_one()
2898 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2899 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2900 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
2902 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2903 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2906 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2907 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2908 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
2909 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2910 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
2911 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
2912 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
2913 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2914 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2915 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2916 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2918 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2919 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2922 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2923 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2924 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
2925 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2926 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
2927 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2928 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
2929 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2930 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2931 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2932 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2934 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2935 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2938 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2939 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2940 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2941 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2942 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
2943 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2944 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
2945 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
2946 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
2947 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2948 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2950 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2951 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2954 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2955 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2956 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2957 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
2958 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2959 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
2960 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2961 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2962 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2963 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2965 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2966 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2969 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2970 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2971 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2972 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
2973 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2974 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
2975 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2976 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2977 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2978 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2980 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
2981 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2982 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2985 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2986 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2987 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2988 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2989 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
2990 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2991 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
2992 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
2993 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
2994 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2995 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2997 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
2998 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
2999 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3002 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3003 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3004 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3005 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3006 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3007 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3008 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3009 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3011 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3012 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3013 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3016 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3017 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3018 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3019 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3020 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3021 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3022 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3023 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3024 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3025 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3026 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3028 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3029 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3030 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3033 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3034 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3035 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3036 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3037 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3038 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3039 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3040 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3041 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3042 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3043 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3051 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3052 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3053 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3057 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3058 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3061 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3067 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3068 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3069 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3070 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3071 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3072 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3073 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3074 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3076 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3081 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3091 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3093 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3098 ret = -ENOMEM; in qla2x00_probe_one()
3103 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3105 host = base_vha->host; in qla2x00_probe_one()
3106 base_vha->req = req; in qla2x00_probe_one()
3108 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3111 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3112 base_vha->vp_idx; in qla2x00_probe_one()
3115 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3116 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3117 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3118 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3119 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3120 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3125 host->sg_tablesize = 32; in qla2x00_probe_one()
3128 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3130 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3131 host->cmd_per_lun = 3; in qla2x00_probe_one()
3132 host->unique_id = host->host_no; in qla2x00_probe_one()
3141 host->max_cmd_len = 32; in qla2x00_probe_one()
3143 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3144 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3145 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3148 host->max_lun = 0xffff; in qla2x00_probe_one()
3150 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3151 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3152 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3157 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3158 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3159 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3160 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3162 INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_probe_one()
3175 ret = -ENODEV; in qla2x00_probe_one()
3179 if (ha->mqenable) { in qla2x00_probe_one()
3180 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3181 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3184 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3187 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3189 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3190 host->nr_hw_queues); in qla2x00_probe_one()
3193 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3202 rsp->req = req; in qla2x00_probe_one()
3203 req->rsp = rsp; in qla2x00_probe_one()
3206 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3207 ha->req_q_map[0] = req; in qla2x00_probe_one()
3208 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3209 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3212 /* FWI2-capable only. */ in qla2x00_probe_one()
3213 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3214 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3215 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3216 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3217 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3219 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3220 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3221 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3222 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3226 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3227 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3228 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3229 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3233 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3234 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3235 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3239 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3240 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3242 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3243 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3244 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3245 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3247 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3248 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3250 "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()
3251 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3253 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0); in qla2x00_probe_one()
3254 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3255 ret = -ENOMEM; in qla2x00_probe_one()
3259 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3261 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3262 base_vha->device_flags); in qla2x00_probe_one()
3281 ret = -ENODEV; in qla2x00_probe_one()
3286 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3288 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3292 host->can_queue, base_vha->req, in qla2x00_probe_one()
3293 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3295 if (ha->mqenable) { in qla2x00_probe_one()
3305 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3310 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3316 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3317 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3318 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3321 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3322 ha->dpc_thread = NULL; in qla2x00_probe_one()
3336 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3339 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3340 ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3341 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3343 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3344 ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3345 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3346 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3348 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3353 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3354 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3366 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3369 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3394 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3397 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3401 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3402 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3406 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3410 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3411 base_vha->flags.online = 1; in qla2x00_probe_one()
3412 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3422 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3428 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3432 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3440 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3443 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3445 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3446 base_vha->host_no, in qla2x00_probe_one()
3447 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3451 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3453 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3454 return -ENODEV; in qla2x00_probe_one()
3459 if (base_vha->gnl.l) { in qla2x00_probe_one()
3460 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3461 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3462 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3465 if (base_vha->timer_active) in qla2x00_probe_one()
3467 base_vha->flags.online = 0; in qla2x00_probe_one()
3468 if (ha->dpc_thread) { in qla2x00_probe_one()
3469 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3471 ha->dpc_thread = NULL; in qla2x00_probe_one()
3476 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3494 if (!ha->nx_pcibase) in qla2x00_probe_one()
3495 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3497 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3499 if (ha->iobase) in qla2x00_probe_one()
3500 iounmap(ha->iobase); in qla2x00_probe_one()
3501 if (ha->cregbase) in qla2x00_probe_one()
3502 iounmap(ha->cregbase); in qla2x00_probe_one()
3504 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3521 ha = base_vha->hw; in __qla_set_remove_flag()
3523 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3524 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3525 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3531 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3532 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3542 ha = vha->hw; in qla2x00_shutdown()
3552 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3554 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3561 /* Turn-off FCE trace */ in qla2x00_shutdown()
3562 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3564 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3567 /* Turn-off EFT trace */ in qla2x00_shutdown()
3568 if (ha->eft) in qla2x00_shutdown()
3573 if (ha->flags.fw_started) in qla2x00_shutdown()
3581 if (vha->timer_active) in qla2x00_shutdown()
3585 vha->flags.online = 0; in qla2x00_shutdown()
3587 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3588 if (ha->interrupts_on) { in qla2x00_shutdown()
3589 vha->flags.init_done = 0; in qla2x00_shutdown()
3590 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3609 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3610 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3611 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3613 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3614 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3615 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3616 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3618 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3619 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3623 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3624 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3626 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3628 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3636 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3637 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3638 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3639 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3642 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3643 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3644 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3645 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3646 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3647 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3651 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3652 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3655 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3658 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3668 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3670 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3672 if (ha->iobase) in qla2x00_unmap_iobases()
3673 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3675 if (ha->cregbase) in qla2x00_unmap_iobases()
3676 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3678 if (ha->mqiobase) in qla2x00_unmap_iobases()
3679 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3681 if (ha->msixbase) in qla2x00_unmap_iobases()
3682 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3707 ha = base_vha->hw; in qla2x00_remove_one()
3711 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3714 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3718 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3719 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3720 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3721 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3722 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3733 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3738 if (ha->flags.fw_started) in qla2x00_remove_one()
3746 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3756 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3757 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3759 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3761 vfree(base_vha->scan.l); in qla2x00_remove_one()
3773 if (base_vha->timer_active) in qla2x00_remove_one()
3776 base_vha->flags.online = 0; in qla2x00_remove_one()
3779 if (ha->exlogin_buf) in qla2x00_remove_one()
3783 if (ha->exchoffld_buf) in qla2x00_remove_one()
3792 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3795 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3801 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3805 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3819 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3820 list_for_each_safe(item, next, &list->head) { in qla24xx_free_purex_list()
3824 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
3830 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
3835 if (vha->timer_active) in qla2x00_free_device()
3839 vha->flags.online = 0; in qla2x00_free_device()
3841 /* turn-off interrupts on the card */ in qla2x00_free_device()
3842 if (ha->interrupts_on) { in qla2x00_free_device()
3843 vha->flags.init_done = 0; in qla2x00_free_device()
3844 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
3852 if (ha->wq) { in qla2x00_free_device()
3853 flush_workqueue(ha->wq); in qla2x00_free_device()
3854 destroy_workqueue(ha->wq); in qla2x00_free_device()
3855 ha->wq = NULL; in qla2x00_free_device()
3859 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
3872 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
3881 if (!fcport->rport) in qla2x00_schedule_rport_del()
3884 if (fcport->rport) { in qla2x00_schedule_rport_del()
3885 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
3887 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
3888 fcport->rport->roles); in qla2x00_schedule_rport_del()
3889 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
3906 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
3912 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
3913 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
3921 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
3927 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
3938 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
3939 if (fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
3940 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
3941 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
3945 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
3946 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
3949 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
3962 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
3963 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
3964 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
3981 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
3982 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
3983 if (!ha->init_cb) in qla2x00_mem_alloc()
3989 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
3990 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
3991 if (!ha->gid_list) in qla2x00_mem_alloc()
3994 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
3995 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4007 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4009 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4011 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4013 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4017 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4018 if (!ha->nvram) in qla2x00_mem_alloc()
4022 ha->pdev->device); in qla2x00_mem_alloc()
4023 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4025 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4028 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4030 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4033 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4035 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4036 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4041 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4043 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4044 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4054 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4055 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4056 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4057 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4063 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4064 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4065 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4066 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4070 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4073 return -ENOMEM; in qla2x00_mem_alloc()
4075 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4077 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4078 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4079 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4080 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4081 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4083 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4086 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4089 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4095 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4096 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4097 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4098 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4099 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4101 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4102 &ha->pool.good.head); in qla2x00_mem_alloc()
4103 ha->pool.good.count++; in qla2x00_mem_alloc()
4109 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4110 list_del(&dsd->list); in qla2x00_mem_alloc()
4111 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4112 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4113 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4115 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4118 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4120 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4121 ha->pool.unusable.count); in qla2x00_mem_alloc()
4124 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4126 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4127 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4133 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4134 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4135 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4137 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4138 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4141 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4142 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4143 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4146 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4147 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4148 if (!ha->ct_sns) in qla2x00_mem_alloc()
4150 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4152 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4158 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4162 (*req)->length = req_len; in qla2x00_mem_alloc()
4163 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4164 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4165 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4166 if (!(*req)->ring) { in qla2x00_mem_alloc()
4167 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4174 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4178 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4179 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4180 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4181 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4182 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4183 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4184 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4188 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4189 (*rsp)->req = *req; in qla2x00_mem_alloc()
4190 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4191 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4192 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4193 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4194 (*rsp)->ring); in qla2x00_mem_alloc()
4196 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4197 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4200 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4201 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4206 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4208 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4211 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4212 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4213 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4215 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4216 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4219 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4221 ha->sf_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4222 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4223 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4225 memset(ha->sf_init_cb, 0, sizeof(struct init_sf_cb)); in qla2x00_mem_alloc()
4226 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4227 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4230 INIT_LIST_HEAD(&ha->gbl_dsd_list); in qla2x00_mem_alloc()
4232 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4234 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4235 &ha->async_pd_dma); in qla2x00_mem_alloc()
4236 if (!ha->async_pd) in qla2x00_mem_alloc()
4238 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4239 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4242 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4245 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4248 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4252 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4253 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4256 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4257 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4258 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4259 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4260 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4264 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4265 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4267 if (!ha->flt) { in qla2x00_mem_alloc()
4268 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4276 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4277 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4279 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4281 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4283 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4285 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4287 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4289 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4290 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4291 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4292 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4297 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4298 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4299 (*req)->ring = NULL; in qla2x00_mem_alloc()
4300 (*req)->dma = 0; in qla2x00_mem_alloc()
4305 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4306 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4307 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4308 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4310 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4311 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4312 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4314 if (ha->sns_cmd) in qla2x00_mem_alloc()
4315 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4316 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4321 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4323 list_del(&dsd->list); in qla2x00_mem_alloc()
4324 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4325 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4326 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4328 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4329 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4331 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4332 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4337 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4338 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4342 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4343 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4346 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4347 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4349 kfree(ha->nvram); in qla2x00_mem_alloc()
4350 ha->nvram = NULL; in qla2x00_mem_alloc()
4352 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4353 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4355 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4356 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4358 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4359 ha->gid_list, in qla2x00_mem_alloc()
4360 ha->gid_list_dma); in qla2x00_mem_alloc()
4361 ha->gid_list = NULL; in qla2x00_mem_alloc()
4362 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4366 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4367 ha->init_cb_dma); in qla2x00_mem_alloc()
4368 ha->init_cb = NULL; in qla2x00_mem_alloc()
4369 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4373 return -ENOMEM; in qla2x00_mem_alloc()
4382 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4395 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4403 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4405 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4412 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4415 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4416 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4417 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4418 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4420 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4425 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4444 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4445 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4446 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4447 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4448 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4456 struct init_cb_81xx *icb = (struct init_cb_81xx *)&vha->hw->init_cb; in qla2x00_number_of_exch()
4459 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4460 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4463 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4464 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4466 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4467 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4470 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4471 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4472 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4475 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4476 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4478 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4480 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4481 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4483 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4497 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4499 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4508 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4519 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4522 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4523 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4527 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4535 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4538 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4539 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4540 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4541 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4544 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4546 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4547 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4549 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4551 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4552 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4555 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4557 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4559 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4562 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4563 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4566 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4577 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4578 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4581 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4583 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4598 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4599 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4600 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4601 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4602 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4616 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4619 if (ha->fce) in qla2x00_free_fw_dump()
4620 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4621 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4623 if (ha->eft) in qla2x00_free_fw_dump()
4624 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4625 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4627 if (ha->fw_dump) in qla2x00_free_fw_dump()
4628 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4630 ha->fce = NULL; in qla2x00_free_fw_dump()
4631 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4632 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4633 ha->eft = NULL; in qla2x00_free_fw_dump()
4634 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4635 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4636 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4637 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4638 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4639 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4642 if (fwdt->template) in qla2x00_free_fw_dump()
4643 vfree(fwdt->template); in qla2x00_free_fw_dump()
4644 fwdt->template = NULL; in qla2x00_free_fw_dump()
4645 fwdt->length = 0; in qla2x00_free_fw_dump()
4661 if (ha->mctp_dump) in qla2x00_mem_free()
4662 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4663 ha->mctp_dump_dma); in qla2x00_mem_free()
4664 ha->mctp_dump = NULL; in qla2x00_mem_free()
4666 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4667 ha->srb_mempool = NULL; in qla2x00_mem_free()
4669 if (ha->dcbx_tlv) in qla2x00_mem_free()
4670 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4671 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4672 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4674 if (ha->xgmac_data) in qla2x00_mem_free()
4675 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4676 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4677 ha->xgmac_data = NULL; in qla2x00_mem_free()
4679 if (ha->sns_cmd) in qla2x00_mem_free()
4680 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4681 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4682 ha->sns_cmd = NULL; in qla2x00_mem_free()
4683 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4685 if (ha->ct_sns) in qla2x00_mem_free()
4686 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4687 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4688 ha->ct_sns = NULL; in qla2x00_mem_free()
4689 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4691 if (ha->sfp_data) in qla2x00_mem_free()
4692 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4693 ha->sfp_data_dma); in qla2x00_mem_free()
4694 ha->sfp_data = NULL; in qla2x00_mem_free()
4696 if (ha->flt) in qla2x00_mem_free()
4697 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4699 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4700 ha->flt = NULL; in qla2x00_mem_free()
4701 ha->flt_dma = 0; in qla2x00_mem_free()
4703 if (ha->ms_iocb) in qla2x00_mem_free()
4704 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4705 ha->ms_iocb = NULL; in qla2x00_mem_free()
4706 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4708 if (ha->sf_init_cb) in qla2x00_mem_free()
4709 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4710 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4712 if (ha->ex_init_cb) in qla2x00_mem_free()
4713 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4714 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4715 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4716 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4718 if (ha->async_pd) in qla2x00_mem_free()
4719 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4720 ha->async_pd = NULL; in qla2x00_mem_free()
4721 ha->async_pd_dma = 0; in qla2x00_mem_free()
4723 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4724 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4726 if (ha->gid_list) in qla2x00_mem_free()
4727 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4728 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4729 ha->gid_list = NULL; in qla2x00_mem_free()
4730 ha->gid_list_dma = 0; in qla2x00_mem_free()
4733 if (!list_empty(&ha->gbl_dsd_list)) { in qla2x00_mem_free()
4738 tdsd_ptr, &ha->gbl_dsd_list, list) { in qla2x00_mem_free()
4739 dma_pool_free(ha->dl_dma_pool, in qla2x00_mem_free()
4740 dsd_ptr->dsd_addr, dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4741 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4747 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4748 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4750 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4751 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4753 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4754 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4756 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4759 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4761 list_del(&dsd->list); in qla2x00_mem_free()
4762 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4763 dsd->dsd_list_dma); in qla2x00_mem_free()
4764 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4766 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4767 ha->pool.unusable.count--; in qla2x00_mem_free()
4769 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
4770 list_del(&dsd->list); in qla2x00_mem_free()
4771 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4772 dsd->dsd_list_dma); in qla2x00_mem_free()
4773 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4775 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4779 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
4780 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
4784 if (ha->init_cb) in qla2x00_mem_free()
4785 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
4786 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
4787 ha->init_cb = NULL; in qla2x00_mem_free()
4788 ha->init_cb_dma = 0; in qla2x00_mem_free()
4790 vfree(ha->optrom_buffer); in qla2x00_mem_free()
4791 ha->optrom_buffer = NULL; in qla2x00_mem_free()
4792 kfree(ha->nvram); in qla2x00_mem_free()
4793 ha->nvram = NULL; in qla2x00_mem_free()
4794 kfree(ha->npiv_info); in qla2x00_mem_free()
4795 ha->npiv_info = NULL; in qla2x00_mem_free()
4796 kfree(ha->swl); in qla2x00_mem_free()
4797 ha->swl = NULL; in qla2x00_mem_free()
4798 kfree(ha->loop_id_map); in qla2x00_mem_free()
4799 ha->sf_init_cb = NULL; in qla2x00_mem_free()
4800 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
4801 ha->loop_id_map = NULL; in qla2x00_mem_free()
4812 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
4821 vha->host = host; in qla2x00_create_host()
4822 vha->host_no = host->host_no; in qla2x00_create_host()
4823 vha->hw = ha; in qla2x00_create_host()
4825 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
4826 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
4827 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
4829 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
4830 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
4831 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
4832 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
4833 INIT_LIST_HEAD(&vha->qla_sess_op_cmd_list); in qla2x00_create_host()
4834 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
4835 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
4836 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
4837 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
4838 INIT_LIST_HEAD(&vha->gpnid_list); in qla2x00_create_host()
4839 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
4841 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
4842 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
4844 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
4845 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
4846 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
4847 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
4849 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
4850 (ha->max_loop_id + 1); in qla2x00_create_host()
4851 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
4852 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
4853 if (!vha->gnl.l) { in qla2x00_create_host()
4856 scsi_host_put(vha->host); in qla2x00_create_host()
4861 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
4862 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
4863 if (!vha->scan.l) { in qla2x00_create_host()
4866 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
4867 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
4868 vha->gnl.l = NULL; in qla2x00_create_host()
4869 scsi_host_put(vha->host); in qla2x00_create_host()
4872 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
4874 snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", in qla2x00_create_host()
4875 QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
4878 vha->host, vha->hw, vha, in qla2x00_create_host()
4879 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
4890 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
4903 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
4904 e->type = type; in qla2x00_alloc_work()
4905 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
4915 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
4916 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
4918 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
4921 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
4924 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
4939 e->u.aen.code = code; in qla2x00_post_aen_work()
4940 e->u.aen.data = data; in qla2x00_post_aen_work()
4953 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
4968 e->u.logio.fcport = fcport; \
4970 e->u.logio.data[0] = data[0]; \
4971 e->u.logio.data[1] = data[1]; \
4973 fcport->flags |= FCF_ASYNC_ACTIVE; \
4992 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5005 vha->host_no); in qla2x00_uevent_emit()
5011 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5024 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5025 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5026 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5034 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5037 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5038 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5039 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5042 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5043 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5044 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5046 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5048 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5057 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5062 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5064 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5065 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5067 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5069 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5070 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5071 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5077 pla->ref_count--; in qla24xx_create_new_sess()
5080 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5083 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5084 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5085 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5087 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5090 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5091 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5092 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5094 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5095 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5096 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5097 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5103 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5106 list_del(&pla->list); in qla24xx_create_new_sess()
5112 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5115 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5120 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5121 tfcp->fw_login_state); in qla24xx_create_new_sess()
5125 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5131 pla->ref_count--; in qla24xx_create_new_sess()
5134 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5137 fcport->id_changed = 1; in qla24xx_create_new_sess()
5138 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5139 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5140 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5143 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5146 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5147 fcport->local = 0; in qla24xx_create_new_sess()
5148 fcport->loop_id = in qla24xx_create_new_sess()
5150 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5151 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5154 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5157 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5160 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5162 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5168 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5170 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5177 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5178 tfcp->fw_login_state); in qla24xx_create_new_sess()
5180 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5184 fcport->login_pause = 1; in qla24xx_create_new_sess()
5185 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5188 fcport->login_pause = 1; in qla24xx_create_new_sess()
5189 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5194 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5198 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5199 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5200 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5201 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5202 fcport->fc4_type = in qla24xx_create_new_sess()
5204 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5206 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5208 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5218 list_del(&pla->list); in qla24xx_create_new_sess()
5226 struct srb *sp = e->u.iosb.sp; in qla_sp_retry()
5232 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5233 __func__, sp->name, rval); in qla_sp_retry()
5246 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5247 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5248 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5252 switch (e->type) { in qla2x00_do_work()
5254 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5255 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5258 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5261 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5262 e->u.logio.data); in qla2x00_do_work()
5265 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5268 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5269 e->u.logio.data); in qla2x00_do_work()
5272 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5278 qla24xx_async_gpnid(vha, &e->u.gpnid.id); in qla2x00_do_work()
5281 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5290 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5291 e->u.fcport.opt); in qla2x00_do_work()
5294 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5297 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5300 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5306 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5309 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5310 e->u.logio.data); in qla2x00_do_work()
5313 qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, in qla2x00_do_work()
5314 e->u.gpnft.sp); in qla2x00_do_work()
5317 qla24xx_async_gpnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5320 qla24xx_async_gnnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5323 qla24xx_async_gnnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5326 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5332 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5336 e->u.fcport.fcport, false); in qla2x00_do_work()
5341 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5342 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5343 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5344 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5347 list_del_init(&e->list); in qla2x00_do_work()
5348 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5363 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5379 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5384 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5385 fcport->login_retry) { in qla2x00_relogin()
5386 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5387 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5390 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5391 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5394 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5398 } else if (vha->hw->current_topology == in qla2x00_relogin()
5400 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5403 } else if (vha->hw->current_topology == in qla2x00_relogin()
5405 fcport->login_retry--; in qla2x00_relogin()
5410 fcport->old_loop_id = in qla2x00_relogin()
5411 fcport->loop_id; in qla2x00_relogin()
5414 fcport->loop_id); in qla2x00_relogin()
5419 &vha->dpc_flags); in qla2x00_relogin()
5423 fcport->login_retry, in qla2x00_relogin()
5424 fcport->loop_id); in qla2x00_relogin()
5426 fcport->login_retry = 0; in qla2x00_relogin()
5429 if (fcport->login_retry == 0 && in qla2x00_relogin()
5435 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5440 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5446 /* Schedule work on any of the dpc-workqueues */
5450 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5454 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5455 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5459 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5460 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5461 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5468 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5469 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5472 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5473 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5477 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5489 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5495 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5496 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5511 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5557 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5563 "Failed to dump mctp\n"); in qla83xx_nic_core_reset_work()
5567 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5580 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5586 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5596 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5647 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5659 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5672 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5685 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5690 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5742 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5744 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5749 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5751 ha->portnum); in qla83xx_idc_lock()
5759 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
5779 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
5782 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
5783 /* if RDP request is not from Domain Controller: */ in qla25xx_rdp_rsp_reduce_size()
5794 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
5797 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
5798 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
5808 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
5833 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
5835 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
5852 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
5864 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
5872 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
5880 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
5883 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
5887 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
5888 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
5889 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
5890 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
5891 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
5892 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
5893 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
5894 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
5895 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
5896 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
5897 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
5898 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
5900 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
5901 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
5902 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
5904 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
5905 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
5906 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
5908 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
5909 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
5911 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
5912 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
5915 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
5916 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
5917 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
5920 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
5921 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
5922 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
5923 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
5924 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
5927 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
5928 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
5929 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
5930 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
5931 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
5934 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
5935 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
5936 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
5943 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
5961 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
5968 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
5969 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
5970 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
5971 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
5972 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
5977 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
5978 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
5979 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
5980 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
5982 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
5986 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
5987 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
5988 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
5993 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
5994 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
5995 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
5996 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
5997 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
5998 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
5999 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6000 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6001 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6002 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6003 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6004 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6005 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6010 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6011 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6012 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6013 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6014 vha->node_name, in qla24xx_process_purex_rdp()
6015 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6016 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6017 vha->port_name, in qla24xx_process_purex_rdp()
6018 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6020 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6021 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6022 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6023 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6024 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6025 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6026 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6027 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6028 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6029 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6032 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6033 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6034 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6035 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6036 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6037 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6039 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6041 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6042 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6049 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6050 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6051 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6053 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6054 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6055 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6057 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6058 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6059 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6061 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6062 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6063 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6065 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6066 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6067 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6076 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6077 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6078 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6079 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6080 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6084 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6085 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6086 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6087 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6088 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6092 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6093 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6094 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6095 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6096 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6100 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6101 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6102 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6103 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6104 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6108 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6109 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6110 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6111 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6112 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6120 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6128 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6136 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6144 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6152 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6162 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6163 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6164 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6170 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6172 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6173 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6175 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6176 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6178 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6179 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6181 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6187 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6189 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6197 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6201 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6209 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6210 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6212 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6213 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6214 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6221 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6224 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6227 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6230 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6237 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6238 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6249 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6250 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6251 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6254 list_del(&item->list); in qla24xx_process_purex_list()
6255 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6268 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6270 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6277 if (data == ha->portnum) { in qla83xx_idc_unlock()
6279 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6284 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6292 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6296 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6303 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6308 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6325 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6330 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6354 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6359 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6382 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6386 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6387 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6415 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6427 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6455 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6460 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6461 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6480 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6483 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6486 ha->portnum); in qla83xx_idc_state_handler()
6489 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6492 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6499 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6505 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6508 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6515 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6525 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6532 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6535 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6538 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6570 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6571 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6576 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6579 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6587 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6600 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6603 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6613 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6615 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6617 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6627 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6643 * is kick-off by the driver's detect code and starts up
6658 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6669 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6672 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6675 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6677 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6681 ha->dpc_active = 1; in qla2x00_do_dpc()
6685 base_vha->dpc_flags); in qla2x00_do_dpc()
6687 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6693 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6707 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6720 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6725 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6727 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6728 * Escalate to chip-reset in qla2x00_do_dpc()
6731 &base_vha->dpc_flags); in qla2x00_do_dpc()
6734 &base_vha->dpc_flags); in qla2x00_do_dpc()
6742 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6748 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6750 &base_vha->dpc_flags); in qla2x00_do_dpc()
6759 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6764 &base_vha->dpc_flags)) in qla2x00_do_dpc()
6766 &base_vha->dpc_flags); in qla2x00_do_dpc()
6774 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6778 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
6784 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6786 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
6788 * when a forced chip-reset occurs. in qla2x00_do_dpc()
6789 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
6791 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
6795 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6796 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6799 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
6804 !ha->flags.fw_started) in qla2x00_do_dpc()
6809 !ha->flags.fw_started) in qla2x00_do_dpc()
6817 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6818 base_vha->flags.online = 1; in qla2x00_do_dpc()
6821 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
6824 &base_vha->dpc_flags); in qla2x00_do_dpc()
6827 &base_vha->dpc_flags); in qla2x00_do_dpc()
6833 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6834 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
6836 (&base_vha->purex_list); in qla2x00_do_dpc()
6838 &base_vha->dpc_flags); in qla2x00_do_dpc()
6843 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6850 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6859 &base_vha->dpc_flags); in qla2x00_do_dpc()
6860 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
6876 &base_vha->dpc_flags); in qla2x00_do_dpc()
6884 &base_vha->dpc_flags) && in qla2x00_do_dpc()
6885 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
6890 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
6896 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6897 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6898 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
6900 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
6901 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
6902 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
6903 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
6913 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6921 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6926 &base_vha->dpc_flags); in qla2x00_do_dpc()
6936 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6937 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
6938 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
6943 if (!ha->interrupts_on) in qla2x00_do_dpc()
6944 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
6947 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6948 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
6949 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
6954 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6955 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
6956 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
6961 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
6962 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
6964 qpair->online = online; in qla2x00_do_dpc()
6965 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
6969 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6970 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
6972 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
6973 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
6989 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6993 ha->dpc_active = 0; in qla2x00_do_dpc()
7005 ha->dpc_active = 0; in qla2x00_do_dpc()
7016 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7017 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7019 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7033 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7034 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7035 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7037 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7043 vha->marker_needed = 1; in qla2x00_rst_aen()
7044 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7045 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7066 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7069 if (ha->flags.eeh_busy) { in qla2x00_timer()
7072 ha->flags.eeh_busy); in qla2x00_timer()
7079 * the read returns -1 then disable the board. in qla2x00_timer()
7081 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7082 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7087 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7088 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7096 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7100 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7101 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7102 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7103 && vha->flags.online) { in qla2x00_timer()
7105 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7106 vha->loop_down_abort_time) { in qla2x00_timer()
7109 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7111 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7112 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7115 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7118 /* NPIV - scan physical port only */ in qla2x00_timer()
7119 if (!vha->vp_idx) { in qla2x00_timer()
7120 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7122 req = ha->req_q_map[0]; in qla2x00_timer()
7124 index < req->num_outstanding_cmds; in qla2x00_timer()
7128 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7131 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7133 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7135 sfcp = sp->fcport; in qla2x00_timer()
7136 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7141 &vha->dpc_flags); in qla2x00_timer()
7144 &vha->dpc_flags); in qla2x00_timer()
7147 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7154 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7155 if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { in qla2x00_timer()
7157 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7161 &vha->dpc_flags); in qla2x00_timer()
7164 &vha->dpc_flags); in qla2x00_timer()
7168 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7169 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7172 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7175 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7181 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7185 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7186 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7188 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7190 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7194 * FC-NVME in qla2x00_timer()
7197 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7198 if (!vha->vp_idx && in qla2x00_timer()
7199 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7200 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7201 !ha->flags.host_shutting_down) { in qla2x00_timer()
7202 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7205 ha->nvme_last_rptd_aen); in qla2x00_timer()
7206 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7210 if (!vha->vp_idx && in qla2x00_timer()
7211 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7215 ha->last_zio_threshold); in qla2x00_timer()
7216 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7217 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7222 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7223 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7224 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7226 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7227 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7228 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7229 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7230 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7231 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7232 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7237 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7238 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7239 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7241 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7246 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7247 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7248 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7249 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7250 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7251 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7308 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7339 if (!blob->name) in qla2x00_request_firmware()
7343 if (blob->fw) in qla2x00_request_firmware()
7346 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7348 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7349 blob->fw = NULL; in qla2x00_request_firmware()
7364 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7365 release_firmware(blob->fw); in qla2x00_release_firmware()
7371 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7372 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7381 ha->chip_reset++; in qla_pci_error_cleanup()
7383 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7384 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7385 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7386 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7387 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7395 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7396 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7397 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7398 qpair->online = 0; in qla_pci_error_cleanup()
7400 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7404 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7405 list_for_each_entry(vp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7406 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7407 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7409 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7410 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7412 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7415 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7416 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7418 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7419 list_for_each_entry(vp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7420 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7421 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7422 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7423 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7424 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7425 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7427 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7435 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7440 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7442 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7451 ha->flags.eeh_busy = 0; in qla2xxx_pci_error_detected()
7453 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7463 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7466 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7484 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7485 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7486 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7491 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7495 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7497 stat = rd_reg_word(®->hccr); in qla2xxx_pci_mmio_enabled()
7501 stat = rd_reg_dword(®->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7505 stat = rd_reg_dword(®24->host_status); in qla2xxx_pci_mmio_enabled()
7509 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7513 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7527 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7534 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7539 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7548 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7555 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7560 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7563 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7564 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7565 qpair->online = 1; in qla2xxx_pci_slot_reset()
7566 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7568 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7569 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7570 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7571 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7572 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7575 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7594 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7606 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7613 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7614 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7618 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7621 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7622 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7623 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7626 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7638 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
7639 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
7641 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
7644 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
7652 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
7664 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
7665 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
7666 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
7667 qpair->online = 0; in qla_pci_reset_prepare()
7668 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
7670 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
7679 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
7688 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
7689 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
7690 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
7691 qpair->online = 1; in qla_pci_reset_done()
7692 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
7694 base_vha->flags.online = 1; in qla_pci_reset_done()
7695 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
7696 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
7702 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
7703 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
7705 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
7708 rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); in qla2xxx_map_queues()
7732 .this_id = -1,
7803 * qla2x00_module_init - Module initialization.
7901 return -ENOMEM; in qla2x00_module_init()
7921 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
7933 ret = -ENODEV; in qla2x00_module_init()
7948 ret = -ENODEV; in qla2x00_module_init()
7980 * qla2x00_module_exit - Module cleanup.