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>
64 "Enable/disable security. 0(Default) - Security disabled. 1 - Security enabled.");
70 "beginning. Default is 0 - class 2 not supported.");
82 "a PORT-DOWN status.");
89 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
101 "vary by ISP type. Default is 1 - allocate memory.");
108 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
109 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
110 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
111 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
112 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
113 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
114 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
115 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
116 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
117 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
118 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
119 "\t\t0x1e400000 - Preferred value for capturing essential "
140 "0 - no FDMI registrations. "
141 "1 - provide FDMI registrations (default).");
153 " Enable T10-CRC-DIF:\n"
155 " 0 -- No DIF Support\n"
156 " 1 -- Enable DIF for all types\n"
157 " 2 -- Enable DIF for all types, except Type 0.\n");
167 "0 - no NVMe. Default is Y");
172 " Enable T10-CRC-DIF Error isolation by HBA:\n"
174 " 0 -- Error isolation disabled\n"
175 " 1 -- Error isolation enabled only for DIX Type 0\n"
176 " 2 -- Error isolation enabled for all Types\n");
182 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
196 " 2 -- load firmware via the request_firmware() (hotplug).\n"
198 " 1 -- load firmware from flash.\n"
199 " 0 -- use default semantics.\n");
205 "Default is 0 - skip ETS enablement.");
211 " 0 -- Regular doorbell.\n"
212 " 1 -- CAMRAM doorbell (faster).\n");
218 "Default is 0 - Do not use GFF_ID information.");
224 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
230 " 0 (Default) -- Reset on failure.\n"
231 " 1 -- Do not reset on failure.\n");
243 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
249 "0 - MiniDump disabled. "
250 "1 (Default) - MiniDump enabled.");
256 "0 (Default)- Disabled.");
273 "1 - Set fw option to hold ABTS.");
280 "1 - Move IOCBs.");
291 "Set to enable MSI or MSI-X interrupt mechanism.\n"
292 " Default is 1, enable MSI-X interrupt mechanism.\n"
293 " 0 -- enable traditional pin-based mechanism.\n"
294 " 1 -- enable MSI-X interrupt mechanism.\n"
295 " 2 -- enable MSI interrupt mechanism.\n");
313 " 0 -- Let HBA firmware decide\n"
314 " 1 -- Force T10 CRC\n"
315 " 2 -- Force IP checksum\n");
329 " Default is 0 - No SmartSAN registration,"
330 " 1 - Register SmartSAN Management Attributes.");
337 "0 - no RDP responses (default). "
338 "1 - provide RDP responses.");
348 "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n");
360 "1 - Minimum number of queues supported\n"
361 "8 - Default value");
374 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
375 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
376 add_timer(&vha->timer); in qla2x00_start_timer()
377 vha->timer_active = 1; in qla2x00_start_timer()
384 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
390 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
396 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
397 vha->timer_active = 0; in qla2x00_stop_timer()
411 /* -------------------------------------------------------------------------- */
415 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
417 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
418 rsp->req = req; in qla_init_base_qpair()
419 ha->base_qpair->hw = ha; in qla_init_base_qpair()
420 ha->base_qpair->req = req; in qla_init_base_qpair()
421 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
422 ha->base_qpair->vha = vha; in qla_init_base_qpair()
423 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
424 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
425 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
426 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
427 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
428 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
430 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
431 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
434 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
440 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
442 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
444 if (!ha->req_q_map) { in qla2x00_alloc_queues()
450 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
452 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
458 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
459 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
467 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
468 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
470 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
481 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
482 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
483 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
484 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
488 kfree(ha->base_qpair); in qla2x00_alloc_queues()
489 ha->base_qpair = NULL; in qla2x00_alloc_queues()
491 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
492 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
494 kfree(ha->req_q_map); in qla2x00_alloc_queues()
495 ha->req_q_map = NULL; in qla2x00_alloc_queues()
497 return -ENOMEM; in qla2x00_alloc_queues()
503 if (req && req->ring_fx00) in qla2x00_free_req_que()
504 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
505 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
506 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
507 } else if (req && req->ring) in qla2x00_free_req_que()
508 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
509 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
510 req->ring, req->dma); in qla2x00_free_req_que()
513 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
521 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
522 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
523 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
524 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
525 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
526 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
527 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
528 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
540 if (ha->queue_pair_map) { in qla2x00_free_queues()
541 kfree(ha->queue_pair_map); in qla2x00_free_queues()
542 ha->queue_pair_map = NULL; in qla2x00_free_queues()
544 if (ha->base_qpair) { in qla2x00_free_queues()
545 kfree(ha->base_qpair); in qla2x00_free_queues()
546 ha->base_qpair = NULL; in qla2x00_free_queues()
549 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
550 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
551 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
554 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
555 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
556 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
558 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
560 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
562 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
564 kfree(ha->req_q_map); in qla2x00_free_queues()
565 ha->req_q_map = NULL; in qla2x00_free_queues()
568 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
569 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
570 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
573 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
574 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
575 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
576 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
578 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
580 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
582 kfree(ha->rsp_q_map); in qla2x00_free_queues()
583 ha->rsp_q_map = NULL; in qla2x00_free_queues()
589 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
595 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
597 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
600 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
613 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
616 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
620 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
646 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
651 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
662 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
664 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
665 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
667 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
672 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
686 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
690 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
699 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
701 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
702 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
708 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
711 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
713 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
716 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
717 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
718 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
719 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
722 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
724 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
725 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
728 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
729 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
731 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
732 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
735 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
736 struct ct6_dsd *ctx1 = sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
738 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
739 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
740 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); in qla2x00_sp_free_dma()
741 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
742 ha->gbl_dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
743 mempool_free(ctx1, ha->ctx_mempool); in qla2x00_sp_free_dma()
750 struct completion *comp = sp->comp; in qla2x00_sp_compl()
753 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_compl()
754 cmd->result = res; in qla2x00_sp_compl()
755 sp->type = 0; in qla2x00_sp_compl()
764 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
766 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
768 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
771 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
772 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
773 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
774 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
777 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
779 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
780 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
783 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
784 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
788 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
789 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
790 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
791 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
793 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
797 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
798 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
799 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
800 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
802 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
805 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
806 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
807 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
808 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
811 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
812 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
813 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
814 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
816 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
819 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
820 struct ct6_dsd *ctx1 = sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
822 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
823 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
824 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); in qla2xxx_qpair_sp_free_dma()
825 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
826 ha->gbl_dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
827 mempool_free(ctx1, ha->ctx_mempool); in qla2xxx_qpair_sp_free_dma()
828 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
831 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
832 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
834 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
835 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
842 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
845 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_qpair_sp_compl()
846 cmd->result = res; in qla2xxx_qpair_sp_compl()
847 sp->type = 0; in qla2xxx_qpair_sp_compl()
857 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
858 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
859 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
860 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
864 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
866 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
870 if (ha->mqenable) { in qla2xxx_queuecommand()
877 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
883 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
884 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
888 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
892 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
899 cmd->result = rval; in qla2xxx_queuecommand()
906 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
911 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
915 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
916 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
920 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
921 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
922 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
925 atomic_read(&fcport->state), in qla2xxx_queuecommand()
926 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
927 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
934 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
937 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
939 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
940 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
946 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
948 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
949 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
950 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
951 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
953 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
964 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_queuecommand()
981 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
982 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
983 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
984 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
990 cmd->result = rval; in qla2xxx_mqueuecommand()
997 if (!qpair->online) { in qla2xxx_mqueuecommand()
999 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
1000 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1004 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
1005 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
1009 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
1010 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
1011 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
1014 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
1015 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
1016 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1023 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
1026 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
1028 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
1029 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1037 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1038 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1039 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1040 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1042 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1053 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_mqueuecommand()
1082 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2x00_eh_wait_on_command()
1083 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_on_command()
1087 if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) { in qla2x00_eh_wait_on_command()
1093 while (sp->type && wait_iter--) in qla2x00_eh_wait_on_command()
1095 if (sp->type) in qla2x00_eh_wait_on_command()
1108 * ha - pointer to host adapter structure
1111 * Does context switching-Release SPIN_LOCK
1123 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1124 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1127 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1128 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1129 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1130 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1134 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1144 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1149 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1152 vha, vha->fcport_count); in test_fcport_count()
1153 res = (vha->fcport_count == 0); in test_fcport_count()
1157 list_for_each_entry(fcport, &vha->vp_fcports, list) { in test_fcport_count()
1158 if (fcport->deleted != QLA_SESS_DELETED) { in test_fcport_count()
1169 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1186 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1191 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1199 * ha - pointer to host adapter structure
1202 * Does context switching-Release SPIN_LOCK
1209 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1210 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1212 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1213 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1214 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1215 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1216 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1227 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1228 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1231 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1232 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1233 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1234 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1238 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1239 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1242 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1268 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1275 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1294 qpair = sp->qpair; in qla2xxx_eh_abort()
1296 vha->cmd_timeout_cnt++; in qla2xxx_eh_abort()
1298 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1301 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1302 sp->comp = ∁ in qla2xxx_eh_abort()
1303 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1306 id = cmd->device->id; in qla2xxx_eh_abort()
1307 lun = cmd->device->lun; in qla2xxx_eh_abort()
1311 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1318 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1324 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1331 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1342 sp->comp = NULL; in qla2xxx_eh_abort()
1345 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1346 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1360 scsi_qla_host_t *vha = qpair->vha; in __qla2x00_eh_wait_for_pending_commands()
1361 struct req_que *req = qpair->req; in __qla2x00_eh_wait_for_pending_commands()
1367 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1369 cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_eh_wait_for_pending_commands()
1370 sp = req->outstanding_cmds[cnt]; in __qla2x00_eh_wait_for_pending_commands()
1373 if (sp->type != SRB_SCSI_CMD) in __qla2x00_eh_wait_for_pending_commands()
1375 if (vha->vp_idx != sp->vha->vp_idx) in __qla2x00_eh_wait_for_pending_commands()
1384 match = cmd->device->id == t; in __qla2x00_eh_wait_for_pending_commands()
1387 match = (cmd->device->id == t && in __qla2x00_eh_wait_for_pending_commands()
1388 cmd->device->lun == l); in __qla2x00_eh_wait_for_pending_commands()
1394 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1396 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1398 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1408 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1411 status = __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, in qla2x00_eh_wait_for_pending_commands()
1413 for (i = 0; status == QLA_SUCCESS && i < ha->max_qpairs; i++) { in qla2x00_eh_wait_for_pending_commands()
1414 qpair = ha->queue_pair_map[i]; in qla2x00_eh_wait_for_pending_commands()
1433 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_device_reset()
1434 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_eh_device_reset()
1436 fc_port_t *fcport = (struct fc_port *) sdev->hostdata; in qla2xxx_eh_device_reset()
1437 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1455 if (fcport->deleted) in qla2xxx_eh_device_reset()
1459 "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, in qla2xxx_eh_device_reset()
1460 sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1469 if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) in qla2xxx_eh_device_reset()
1476 if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id, in qla2xxx_eh_device_reset()
1477 sdev->lun, WAIT_LUN) != QLA_SUCCESS) { in qla2xxx_eh_device_reset()
1485 vha->host_no, sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1492 reset_errors[err], vha->host_no, sdev->id, sdev->lun, in qla2xxx_eh_device_reset()
1494 vha->reset_cmd_err_cnt++; in qla2xxx_eh_device_reset()
1501 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_target_reset()
1504 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1505 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_eh_target_reset()
1523 if (fcport->deleted) in qla2xxx_eh_target_reset()
1527 "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no, in qla2xxx_eh_target_reset()
1528 sdev->id, cmd); in qla2xxx_eh_target_reset()
1537 if (ha->isp_ops->target_reset(fcport, 0, 0) != QLA_SUCCESS) { in qla2xxx_eh_target_reset()
1543 if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id, in qla2xxx_eh_target_reset()
1552 vha->host_no, sdev->id, cmd); in qla2xxx_eh_target_reset()
1559 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in qla2xxx_eh_target_reset()
1561 vha->reset_cmd_err_cnt++; in qla2xxx_eh_target_reset()
1583 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1587 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1596 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1597 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1603 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1628 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1651 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1652 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1656 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1665 id = cmd->device->id; in qla2xxx_eh_host_reset()
1666 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1669 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1675 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1682 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1690 if (ha->wq) in qla2xxx_eh_host_reset()
1691 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1693 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1694 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1695 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1697 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1705 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1716 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1735 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1740 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1741 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1742 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1751 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1759 vha->marker_needed = 1; in qla2x00_loop_reset()
1770 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1771 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1774 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1775 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1781 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1784 sp->done(sp, res); in qla2x00_abort_srb()
1788 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1789 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1790 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1792 if (sp->comp) { in qla2x00_abort_srb()
1793 sp->done(sp, res); in qla2x00_abort_srb()
1797 sp->comp = ∁ in qla2x00_abort_srb()
1798 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1800 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1803 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1810 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1820 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1822 sp->done(sp, res); in qla2x00_abort_srb()
1824 sp->done(sp, res); in qla2x00_abort_srb()
1838 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1839 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1841 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1844 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1846 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1847 req = qp->req; in __qla2x00_abort_all_cmds()
1848 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1849 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1851 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1856 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1859 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1860 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1864 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1872 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1875 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1886 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1889 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1891 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1893 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1895 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1896 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1899 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1909 return -ENXIO; in qla2xxx_slave_alloc()
1911 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_slave_alloc()
1919 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_slave_configure()
1920 struct req_que *req = vha->req; in qla2xxx_slave_configure()
1922 if (IS_T10_PI_CAPABLE(vha->hw)) in qla2xxx_slave_configure()
1923 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); in qla2xxx_slave_configure()
1925 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_slave_configure()
1932 sdev->hostdata = NULL; in qla2xxx_slave_destroy()
1936 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1946 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1948 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1949 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1950 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1951 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1953 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1954 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1955 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1960 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1961 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1968 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
1970 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1971 ha->interrupts_on = 1; in qla2x00_enable_intrs()
1973 wrt_reg_word(®->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
1974 rd_reg_word(®->ictrl); in qla2x00_enable_intrs()
1975 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1983 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
1985 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
1986 ha->interrupts_on = 0; in qla2x00_disable_intrs()
1988 wrt_reg_word(®->ictrl, 0); in qla2x00_disable_intrs()
1989 rd_reg_word(®->ictrl); in qla2x00_disable_intrs()
1990 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
1997 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
1999 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2000 ha->interrupts_on = 1; in qla24xx_enable_intrs()
2001 wrt_reg_dword(®->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
2002 rd_reg_dword(®->ictrl); in qla24xx_enable_intrs()
2003 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2010 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
2014 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2015 ha->interrupts_on = 0; in qla24xx_disable_intrs()
2016 wrt_reg_dword(®->ictrl, 0); in qla24xx_disable_intrs()
2017 rd_reg_dword(®->ictrl); in qla24xx_disable_intrs()
2018 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2027 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
2029 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
2031 pci_name(ha->pdev)); in qla2x00_iospace_config()
2034 if (!(ha->bars & 1)) in qla2x00_iospace_config()
2038 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
2039 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
2040 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2041 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
2043 pci_name(ha->pdev)); in qla2x00_iospace_config()
2047 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
2049 pci_name(ha->pdev)); in qla2x00_iospace_config()
2052 ha->pio_address = pio; in qla2x00_iospace_config()
2053 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
2055 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2059 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2060 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2062 pci_name(ha->pdev)); in qla2x00_iospace_config()
2065 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2066 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2068 pci_name(ha->pdev)); in qla2x00_iospace_config()
2072 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2073 if (!ha->iobase) { in qla2x00_iospace_config()
2074 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2076 pci_name(ha->pdev)); in qla2x00_iospace_config()
2081 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2082 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2085 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2092 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2093 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2094 if (ha->mqiobase) { in qla2x00_iospace_config()
2095 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2096 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2098 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2099 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2102 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2103 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2105 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2106 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2107 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2109 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2110 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2112 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2116 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2117 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2121 return (-ENOMEM); in qla2x00_iospace_config()
2130 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2132 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2134 pci_name(ha->pdev)); in qla83xx_iospace_config()
2140 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2141 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2143 pci_name(ha->pdev)); in qla83xx_iospace_config()
2146 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2147 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2149 pci_name(ha->pdev)); in qla83xx_iospace_config()
2153 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2154 if (!ha->iobase) { in qla83xx_iospace_config()
2155 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2157 pci_name(ha->pdev)); in qla83xx_iospace_config()
2161 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2163 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2164 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2165 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2166 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2167 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2169 if (!ha->mqiobase) { in qla83xx_iospace_config()
2170 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2175 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2176 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2177 if (ha->msixbase) { in qla83xx_iospace_config()
2179 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2181 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2188 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2192 ha->max_req_queues--; in qla83xx_iospace_config()
2194 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2198 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2199 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2200 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2202 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2203 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2205 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2209 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2210 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2214 return -ENOMEM; in qla83xx_iospace_config()
2611 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2612 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2614 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2615 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2616 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2619 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2620 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2621 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2624 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2625 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2626 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2629 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2630 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2631 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2634 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2635 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2636 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2637 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2638 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2639 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2642 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2643 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2646 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2647 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2650 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2651 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2652 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2653 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2654 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2657 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2658 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2659 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2660 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2661 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2664 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2665 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2666 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2667 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2668 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2671 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2672 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2673 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2676 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2677 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2678 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2681 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2682 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2683 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2684 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2685 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2688 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2689 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2690 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2691 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2692 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2695 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2696 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2697 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2698 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2703 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2704 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2705 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2706 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2711 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2712 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2713 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2714 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2715 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2716 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2719 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2720 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2721 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2722 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2723 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2724 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2727 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2730 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2731 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2732 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2733 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2734 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2735 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2738 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2739 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2740 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2741 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2742 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2743 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2746 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2747 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2748 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2749 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2750 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2751 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2755 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2756 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2757 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2758 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2759 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2760 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2764 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2765 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2766 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2767 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2768 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2769 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2774 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2777 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2780 ha->port_no--; in qla2x00_set_isp_flags()
2782 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2785 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2787 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2795 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2798 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2799 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2800 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2801 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2809 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2811 if (!vha->host) in qla2xxx_scan_finished()
2813 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2816 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2823 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_heartbeat_work_fn()
2825 if (!ha->flags.mbox_busy && base_vha->flags.init_done) in qla_heartbeat_work_fn()
2833 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2834 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2838 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2841 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2843 i--; in qla2x00_iocb_work_fn()
2846 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2847 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2848 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2878 int ret = -ENODEV; in qla2x00_probe_one()
2893 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2894 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2895 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2896 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2897 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2898 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2899 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2900 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2901 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2902 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2903 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2904 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2905 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2906 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2907 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2908 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2909 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2910 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2911 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2944 ha->pdev = pdev; in qla2x00_probe_one()
2945 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2946 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2947 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2948 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2950 spin_lock_init(&ha->sadb_lock); in qla2x00_probe_one()
2951 INIT_LIST_HEAD(&ha->sadb_tx_index_list); in qla2x00_probe_one()
2952 INIT_LIST_HEAD(&ha->sadb_rx_index_list); in qla2x00_probe_one()
2954 spin_lock_init(&ha->sadb_fp_lock); in qla2x00_probe_one()
2961 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2964 ha->bars = bars; in qla2x00_probe_one()
2965 ha->mem_only = mem_only; in qla2x00_probe_one()
2966 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
2967 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
2968 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
2969 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
2971 /* Set ISP-type information. */ in qla2x00_probe_one()
2977 pdev->needs_freset = 1; in qla2x00_probe_one()
2979 ha->prev_topology = 0; in qla2x00_probe_one()
2980 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
2981 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
2982 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
2983 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
2984 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
2985 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
2986 atomic_set(&ha->num_pend_mbx_stage3, 0); in qla2x00_probe_one()
2987 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
2988 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
2992 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2993 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
2996 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
2997 ha->gid_list_info_size = 4; in qla2x00_probe_one()
2998 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2999 ha->flash_data_off = ~0; in qla2x00_probe_one()
3000 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3001 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3002 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3004 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3005 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
3008 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3009 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3010 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3011 ha->flash_data_off = ~0; in qla2x00_probe_one()
3012 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3013 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3014 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3016 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3017 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3020 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3021 ha->gid_list_info_size = 6; in qla2x00_probe_one()
3023 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
3024 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3025 ha->flash_data_off = ~0; in qla2x00_probe_one()
3026 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3027 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3028 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
3030 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3031 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3034 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3035 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3036 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3037 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3038 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
3039 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
3040 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
3041 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3042 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3043 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3044 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3046 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3047 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3050 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3051 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3052 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3053 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3054 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
3055 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3056 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
3057 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3058 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3059 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3060 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3062 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3063 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3066 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3067 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3068 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3069 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3070 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
3071 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3072 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
3073 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3074 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3075 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3076 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3078 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3079 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3082 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3083 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3084 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3085 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
3086 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3087 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
3088 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3089 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3090 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3091 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3093 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3094 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3097 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3098 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3099 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3100 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3101 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3102 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
3103 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3104 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3105 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3106 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3108 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3109 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3110 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3113 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3114 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3115 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3116 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3117 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3118 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3119 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3120 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3121 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3122 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3123 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3125 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3126 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3127 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3130 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3131 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3132 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3133 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3134 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3135 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3136 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3137 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3139 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3140 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3141 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3144 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3145 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3146 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3147 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3148 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3149 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3150 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3151 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3152 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3153 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3154 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3156 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3157 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3158 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3161 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3162 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3163 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3164 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3165 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3166 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3167 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3168 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3169 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3170 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3171 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3179 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3180 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3181 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3185 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3186 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3189 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3195 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3196 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3197 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3198 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3199 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3200 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3201 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3202 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3204 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3209 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3219 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3221 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3226 ret = -ENOMEM; in qla2x00_probe_one()
3231 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3233 host = base_vha->host; in qla2x00_probe_one()
3234 base_vha->req = req; in qla2x00_probe_one()
3236 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3239 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3240 base_vha->vp_idx; in qla2x00_probe_one()
3243 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3244 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3245 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3246 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3247 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3248 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3257 host->sg_tablesize = 32; in qla2x00_probe_one()
3260 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3262 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3263 host->cmd_per_lun = 3; in qla2x00_probe_one()
3264 host->unique_id = host->host_no; in qla2x00_probe_one()
3266 host->max_cmd_len = 32; in qla2x00_probe_one()
3268 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3269 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3270 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3273 host->max_lun = 0xffff; in qla2x00_probe_one()
3275 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3276 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3277 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3282 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3283 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3284 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3285 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3287 INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_probe_one()
3288 INIT_WORK(&ha->heartbeat_work, qla_heartbeat_work_fn); in qla2x00_probe_one()
3301 ret = -ENODEV; in qla2x00_probe_one()
3305 if (ha->mqenable) { in qla2x00_probe_one()
3306 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3307 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3310 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3313 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3315 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3316 host->nr_hw_queues); in qla2x00_probe_one()
3319 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3328 rsp->req = req; in qla2x00_probe_one()
3329 req->rsp = rsp; in qla2x00_probe_one()
3332 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3333 ha->req_q_map[0] = req; in qla2x00_probe_one()
3334 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3335 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3338 /* FWI2-capable only. */ in qla2x00_probe_one()
3339 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3340 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3341 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3342 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3343 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3345 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3346 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3347 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3348 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3352 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3353 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3354 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3355 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3359 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3360 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3361 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3365 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3366 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3368 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3369 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3370 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3371 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3373 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3374 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3376 "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()
3377 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3379 ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); in qla2x00_probe_one()
3380 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3381 ret = -ENOMEM; in qla2x00_probe_one()
3385 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3387 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3388 base_vha->device_flags); in qla2x00_probe_one()
3407 ret = -ENODEV; in qla2x00_probe_one()
3412 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3414 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3418 host->can_queue, base_vha->req, in qla2x00_probe_one()
3419 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3422 if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6)) in qla2x00_probe_one()
3423 ha->mqenable = 0; in qla2x00_probe_one()
3425 if (ha->mqenable) { in qla2x00_probe_one()
3435 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3440 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3446 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3447 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3448 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3451 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3452 ha->dpc_thread = NULL; in qla2x00_probe_one()
3466 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3469 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3470 ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3471 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3473 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3474 ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3475 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3476 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3478 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3483 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3484 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3496 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3499 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3526 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3529 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3533 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3534 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3538 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3542 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3543 base_vha->flags.online = 1; in qla2x00_probe_one()
3544 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3554 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3560 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3564 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3572 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3575 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3577 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3578 base_vha->host_no, in qla2x00_probe_one()
3579 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3583 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3585 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3586 return -ENODEV; in qla2x00_probe_one()
3593 if (base_vha->gnl.l) { in qla2x00_probe_one()
3594 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3595 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3596 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3599 if (base_vha->timer_active) in qla2x00_probe_one()
3601 base_vha->flags.online = 0; in qla2x00_probe_one()
3602 if (ha->dpc_thread) { in qla2x00_probe_one()
3603 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3605 ha->dpc_thread = NULL; in qla2x00_probe_one()
3610 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3628 if (!ha->nx_pcibase) in qla2x00_probe_one()
3629 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3631 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3633 if (ha->iobase) in qla2x00_probe_one()
3634 iounmap(ha->iobase); in qla2x00_probe_one()
3635 if (ha->cregbase) in qla2x00_probe_one()
3636 iounmap(ha->cregbase); in qla2x00_probe_one()
3638 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3655 ha = base_vha->hw; in __qla_set_remove_flag()
3657 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3658 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3659 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3665 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3666 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3676 ha = vha->hw; in qla2x00_shutdown()
3686 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3688 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3695 /* Turn-off FCE trace */ in qla2x00_shutdown()
3696 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3698 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3701 /* Turn-off EFT trace */ in qla2x00_shutdown()
3702 if (ha->eft) in qla2x00_shutdown()
3707 if (ha->flags.fw_started) in qla2x00_shutdown()
3715 if (vha->timer_active) in qla2x00_shutdown()
3719 vha->flags.online = 0; in qla2x00_shutdown()
3721 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3722 if (ha->interrupts_on) { in qla2x00_shutdown()
3723 vha->flags.init_done = 0; in qla2x00_shutdown()
3724 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3743 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3744 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3745 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3747 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3748 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3749 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3750 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3752 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3753 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3757 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3758 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3760 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3762 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3770 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3771 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3772 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3773 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3776 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3777 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3778 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3779 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3780 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3781 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3785 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3786 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3789 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3792 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3802 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3804 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3806 if (ha->iobase) in qla2x00_unmap_iobases()
3807 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3809 if (ha->cregbase) in qla2x00_unmap_iobases()
3810 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3812 if (ha->mqiobase) in qla2x00_unmap_iobases()
3813 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3815 if (ha->msixbase) in qla2x00_unmap_iobases()
3816 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3841 ha = base_vha->hw; in qla2x00_remove_one()
3845 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3848 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3852 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3853 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3854 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3855 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3856 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3867 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3872 if (ha->flags.fw_started) in qla2x00_remove_one()
3880 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3890 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3891 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3893 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3897 vfree(base_vha->scan.l); in qla2x00_remove_one()
3909 if (base_vha->timer_active) in qla2x00_remove_one()
3912 base_vha->flags.online = 0; in qla2x00_remove_one()
3915 if (ha->exlogin_buf) in qla2x00_remove_one()
3919 if (ha->exchoffld_buf) in qla2x00_remove_one()
3928 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3930 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3936 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3940 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3954 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3955 list_for_each_entry_safe(item, next, &list->head, list) { in qla24xx_free_purex_list()
3956 list_del(&item->list); in qla24xx_free_purex_list()
3957 if (item == &item->vha->default_item) in qla24xx_free_purex_list()
3961 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
3967 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
3972 if (vha->timer_active) in qla2x00_free_device()
3976 vha->flags.online = 0; in qla2x00_free_device()
3978 /* turn-off interrupts on the card */ in qla2x00_free_device()
3979 if (ha->interrupts_on) { in qla2x00_free_device()
3980 vha->flags.init_done = 0; in qla2x00_free_device()
3981 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
3989 if (ha->wq) { in qla2x00_free_device()
3990 destroy_workqueue(ha->wq); in qla2x00_free_device()
3991 ha->wq = NULL; in qla2x00_free_device()
3995 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
4011 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
4020 if (!fcport->rport) in qla2x00_schedule_rport_del()
4023 if (fcport->rport) { in qla2x00_schedule_rport_del()
4024 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
4026 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
4027 fcport->rport->roles); in qla2x00_schedule_rport_del()
4028 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
4045 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
4051 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
4052 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
4061 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
4067 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
4078 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
4079 if (fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
4080 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
4081 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
4085 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
4086 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
4089 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
4102 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4103 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4104 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4122 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
4123 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4124 if (!ha->init_cb) in qla2x00_mem_alloc()
4127 rc = btree_init32(&ha->host_map); in qla2x00_mem_alloc()
4134 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4135 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4136 if (!ha->gid_list) in qla2x00_mem_alloc()
4139 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4140 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4152 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4154 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4156 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4158 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4162 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4163 if (!ha->nvram) in qla2x00_mem_alloc()
4167 ha->pdev->device); in qla2x00_mem_alloc()
4168 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4170 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4173 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4175 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4178 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4180 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4181 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4186 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4188 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4189 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4199 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4200 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4201 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4202 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4208 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4209 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4210 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4211 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4215 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4218 return -ENOMEM; in qla2x00_mem_alloc()
4220 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4222 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4223 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4224 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4225 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4226 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4228 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4231 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4234 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4240 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4241 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4242 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4243 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4244 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4246 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4247 &ha->pool.good.head); in qla2x00_mem_alloc()
4248 ha->pool.good.count++; in qla2x00_mem_alloc()
4254 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4255 list_del(&dsd->list); in qla2x00_mem_alloc()
4256 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4257 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4258 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4260 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4263 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4265 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4266 ha->pool.unusable.count); in qla2x00_mem_alloc()
4269 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4271 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4272 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4278 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4279 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4280 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4282 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4283 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4286 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4287 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4288 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4291 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4292 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4293 if (!ha->ct_sns) in qla2x00_mem_alloc()
4295 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4297 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4303 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4307 (*req)->length = req_len; in qla2x00_mem_alloc()
4308 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4309 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4310 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4311 if (!(*req)->ring) { in qla2x00_mem_alloc()
4312 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4319 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4323 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4324 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4325 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4326 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4327 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4328 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4329 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4333 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4334 (*rsp)->req = *req; in qla2x00_mem_alloc()
4335 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4336 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4337 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4338 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4339 (*rsp)->ring); in qla2x00_mem_alloc()
4341 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4342 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4345 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4346 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4351 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4353 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4356 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4357 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4358 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4360 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4361 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4364 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4366 ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4367 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4368 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4370 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4371 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4374 INIT_LIST_HEAD(&ha->gbl_dsd_list); in qla2x00_mem_alloc()
4376 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4378 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4379 &ha->async_pd_dma); in qla2x00_mem_alloc()
4380 if (!ha->async_pd) in qla2x00_mem_alloc()
4382 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4383 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4386 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4389 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4392 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4396 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4397 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4400 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4401 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4402 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4403 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4404 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4408 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4409 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4411 if (!ha->flt) { in qla2x00_mem_alloc()
4412 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4418 ha->purex_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4421 if (!ha->purex_dma_pool) { in qla2x00_mem_alloc()
4422 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4427 ha->elsrej.size = sizeof(struct fc_els_ls_rjt) + 16; in qla2x00_mem_alloc()
4428 ha->elsrej.c = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4429 ha->elsrej.size, &ha->elsrej.cdma, GFP_KERNEL); in qla2x00_mem_alloc()
4431 if (!ha->elsrej.c) { in qla2x00_mem_alloc()
4432 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4436 ha->elsrej.c->er_cmd = ELS_LS_RJT; in qla2x00_mem_alloc()
4437 ha->elsrej.c->er_reason = ELS_RJT_LOGIC; in qla2x00_mem_alloc()
4438 ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; in qla2x00_mem_alloc()
4442 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_alloc()
4444 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4445 ha->flt, ha->flt_dma); in qla2x00_mem_alloc()
4448 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4449 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4451 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4453 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4455 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4457 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4459 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4461 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4462 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4463 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4464 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4469 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4470 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4471 (*req)->ring = NULL; in qla2x00_mem_alloc()
4472 (*req)->dma = 0; in qla2x00_mem_alloc()
4477 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4478 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4479 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4480 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4482 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4483 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4484 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4486 if (ha->sns_cmd) in qla2x00_mem_alloc()
4487 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4488 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4493 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4495 list_del(&dsd->list); in qla2x00_mem_alloc()
4496 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4497 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4498 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4500 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4501 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4503 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4504 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4509 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4510 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4514 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4515 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4518 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4519 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4521 kfree(ha->nvram); in qla2x00_mem_alloc()
4522 ha->nvram = NULL; in qla2x00_mem_alloc()
4524 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4525 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4527 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4528 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4530 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4531 ha->gid_list, in qla2x00_mem_alloc()
4532 ha->gid_list_dma); in qla2x00_mem_alloc()
4533 ha->gid_list = NULL; in qla2x00_mem_alloc()
4534 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4538 btree_destroy32(&ha->host_map); in qla2x00_mem_alloc()
4540 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4541 ha->init_cb_dma); in qla2x00_mem_alloc()
4542 ha->init_cb = NULL; in qla2x00_mem_alloc()
4543 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4547 return -ENOMEM; in qla2x00_mem_alloc()
4556 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4569 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4577 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4579 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4586 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4589 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4590 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4591 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4592 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4594 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4599 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4618 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4619 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4620 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4621 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4622 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4630 struct init_cb_81xx *icb = (struct init_cb_81xx *)&vha->hw->init_cb; in qla2x00_number_of_exch()
4633 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4634 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4637 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4638 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4640 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4641 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4644 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4645 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4646 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4649 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4650 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4652 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4654 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4655 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4657 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4671 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4673 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4682 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4693 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4696 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4697 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4701 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4709 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4712 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4713 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4714 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4715 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4718 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4720 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4721 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4723 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4725 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4726 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4729 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4731 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4733 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4736 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4737 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4740 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4751 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4752 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4755 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4757 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4772 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4773 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4774 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4775 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4776 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4790 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4793 if (ha->fce) in qla2x00_free_fw_dump()
4794 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4795 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4797 if (ha->eft) in qla2x00_free_fw_dump()
4798 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4799 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4801 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4803 ha->fce = NULL; in qla2x00_free_fw_dump()
4804 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4805 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4806 ha->eft = NULL; in qla2x00_free_fw_dump()
4807 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4808 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4809 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4810 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4811 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4812 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4815 vfree(fwdt->template); in qla2x00_free_fw_dump()
4816 fwdt->template = NULL; in qla2x00_free_fw_dump()
4817 fwdt->length = 0; in qla2x00_free_fw_dump()
4833 if (ha->mctp_dump) in qla2x00_mem_free()
4834 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4835 ha->mctp_dump_dma); in qla2x00_mem_free()
4836 ha->mctp_dump = NULL; in qla2x00_mem_free()
4838 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4839 ha->srb_mempool = NULL; in qla2x00_mem_free()
4841 if (ha->dcbx_tlv) in qla2x00_mem_free()
4842 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4843 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4844 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4846 if (ha->xgmac_data) in qla2x00_mem_free()
4847 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4848 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4849 ha->xgmac_data = NULL; in qla2x00_mem_free()
4851 if (ha->sns_cmd) in qla2x00_mem_free()
4852 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4853 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4854 ha->sns_cmd = NULL; in qla2x00_mem_free()
4855 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4857 if (ha->ct_sns) in qla2x00_mem_free()
4858 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4859 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4860 ha->ct_sns = NULL; in qla2x00_mem_free()
4861 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4863 if (ha->sfp_data) in qla2x00_mem_free()
4864 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4865 ha->sfp_data_dma); in qla2x00_mem_free()
4866 ha->sfp_data = NULL; in qla2x00_mem_free()
4868 if (ha->flt) in qla2x00_mem_free()
4869 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4871 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4872 ha->flt = NULL; in qla2x00_mem_free()
4873 ha->flt_dma = 0; in qla2x00_mem_free()
4875 if (ha->ms_iocb) in qla2x00_mem_free()
4876 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4877 ha->ms_iocb = NULL; in qla2x00_mem_free()
4878 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4880 if (ha->sf_init_cb) in qla2x00_mem_free()
4881 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4882 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4884 if (ha->ex_init_cb) in qla2x00_mem_free()
4885 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4886 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4887 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4888 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4890 if (ha->async_pd) in qla2x00_mem_free()
4891 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4892 ha->async_pd = NULL; in qla2x00_mem_free()
4893 ha->async_pd_dma = 0; in qla2x00_mem_free()
4895 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4896 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4898 if (ha->gid_list) in qla2x00_mem_free()
4899 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4900 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4901 ha->gid_list = NULL; in qla2x00_mem_free()
4902 ha->gid_list_dma = 0; in qla2x00_mem_free()
4905 if (!list_empty(&ha->gbl_dsd_list)) { in qla2x00_mem_free()
4910 tdsd_ptr, &ha->gbl_dsd_list, list) { in qla2x00_mem_free()
4911 dma_pool_free(ha->dl_dma_pool, in qla2x00_mem_free()
4912 dsd_ptr->dsd_addr, dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4913 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4919 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4920 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4922 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4923 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4925 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4926 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4928 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4931 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4933 list_del(&dsd->list); in qla2x00_mem_free()
4934 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4935 dsd->dsd_list_dma); in qla2x00_mem_free()
4936 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4938 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4939 ha->pool.unusable.count--; in qla2x00_mem_free()
4941 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
4942 list_del(&dsd->list); in qla2x00_mem_free()
4943 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4944 dsd->dsd_list_dma); in qla2x00_mem_free()
4945 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4947 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4951 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
4952 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
4957 if (ha->init_cb) in qla2x00_mem_free()
4958 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
4959 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
4961 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_free()
4962 ha->purex_dma_pool = NULL; in qla2x00_mem_free()
4964 if (ha->elsrej.c) { in qla2x00_mem_free()
4965 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_free()
4966 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_free()
4967 ha->elsrej.c = NULL; in qla2x00_mem_free()
4970 ha->init_cb = NULL; in qla2x00_mem_free()
4971 ha->init_cb_dma = 0; in qla2x00_mem_free()
4973 vfree(ha->optrom_buffer); in qla2x00_mem_free()
4974 ha->optrom_buffer = NULL; in qla2x00_mem_free()
4975 kfree(ha->nvram); in qla2x00_mem_free()
4976 ha->nvram = NULL; in qla2x00_mem_free()
4977 kfree(ha->npiv_info); in qla2x00_mem_free()
4978 ha->npiv_info = NULL; in qla2x00_mem_free()
4979 kfree(ha->swl); in qla2x00_mem_free()
4980 ha->swl = NULL; in qla2x00_mem_free()
4981 kfree(ha->loop_id_map); in qla2x00_mem_free()
4982 ha->sf_init_cb = NULL; in qla2x00_mem_free()
4983 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
4984 ha->loop_id_map = NULL; in qla2x00_mem_free()
4995 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
5004 vha->host = host; in qla2x00_create_host()
5005 vha->host_no = host->host_no; in qla2x00_create_host()
5006 vha->hw = ha; in qla2x00_create_host()
5008 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
5009 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
5010 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
5012 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
5013 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
5014 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
5015 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
5016 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
5017 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
5018 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
5019 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
5020 INIT_LIST_HEAD(&vha->gpnid_list); in qla2x00_create_host()
5021 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
5023 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
5024 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
5026 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
5027 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
5028 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
5029 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
5034 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
5035 (ha->max_loop_id + 1); in qla2x00_create_host()
5036 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
5037 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
5038 if (!vha->gnl.l) { in qla2x00_create_host()
5041 scsi_host_put(vha->host); in qla2x00_create_host()
5046 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
5047 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
5048 if (!vha->scan.l) { in qla2x00_create_host()
5051 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
5052 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
5053 vha->gnl.l = NULL; in qla2x00_create_host()
5054 scsi_host_put(vha->host); in qla2x00_create_host()
5057 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
5059 sprintf(vha->host_str, "%s_%lu", QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
5062 vha->host, vha->hw, vha, in qla2x00_create_host()
5063 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
5074 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
5087 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
5088 e->type = type; in qla2x00_alloc_work()
5089 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
5099 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
5100 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
5102 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
5105 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
5108 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
5123 e->u.aen.code = code; in qla2x00_post_aen_work()
5124 e->u.aen.data = data; in qla2x00_post_aen_work()
5137 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
5152 e->u.logio.fcport = fcport; \
5154 e->u.logio.data[0] = data[0]; \
5155 e->u.logio.data[1] = data[1]; \
5157 fcport->flags |= FCF_ASYNC_ACTIVE; \
5176 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5189 vha->host_no); in qla2x00_uevent_emit()
5195 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5208 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5209 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5210 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5218 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5221 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5222 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5223 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5226 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5227 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5228 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5230 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5232 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5241 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5246 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5248 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5249 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5251 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5253 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5254 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5255 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5261 pla->ref_count--; in qla24xx_create_new_sess()
5264 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5267 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5268 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5269 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5270 fcport->tgt_short_link_down_cnt = 0; in qla24xx_create_new_sess()
5272 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5275 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5276 if (NVME_PRIORITY(vha->hw, fcport)) in qla24xx_create_new_sess()
5277 fcport->do_prli_nvme = 1; in qla24xx_create_new_sess()
5279 fcport->do_prli_nvme = 0; in qla24xx_create_new_sess()
5281 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5282 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5284 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5285 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5286 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5287 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5293 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5296 list_del(&pla->list); in qla24xx_create_new_sess()
5302 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5305 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5310 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5311 tfcp->fw_login_state); in qla24xx_create_new_sess()
5315 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5321 pla->ref_count--; in qla24xx_create_new_sess()
5324 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5327 fcport->id_changed = 1; in qla24xx_create_new_sess()
5328 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5329 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5330 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5333 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5336 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5337 fcport->local = 0; in qla24xx_create_new_sess()
5338 fcport->loop_id = in qla24xx_create_new_sess()
5340 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5341 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5344 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5347 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5350 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5352 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5358 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5360 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5367 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5368 tfcp->fw_login_state); in qla24xx_create_new_sess()
5370 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5374 fcport->login_pause = 1; in qla24xx_create_new_sess()
5375 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5378 fcport->login_pause = 1; in qla24xx_create_new_sess()
5379 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5384 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5388 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5389 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5390 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5391 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5392 fcport->fc4_type = in qla24xx_create_new_sess()
5394 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5396 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5398 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5408 list_del(&pla->list); in qla24xx_create_new_sess()
5416 struct srb *sp = e->u.iosb.sp; in qla_sp_retry()
5422 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5423 __func__, sp->name, rval); in qla_sp_retry()
5436 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5437 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5438 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5442 switch (e->type) { in qla2x00_do_work()
5444 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5445 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5448 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5451 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5452 e->u.logio.data); in qla2x00_do_work()
5455 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5458 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5459 e->u.logio.data); in qla2x00_do_work()
5462 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5468 qla24xx_async_gpnid(vha, &e->u.gpnid.id); in qla2x00_do_work()
5471 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5480 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5481 e->u.fcport.opt); in qla2x00_do_work()
5484 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5487 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5490 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5496 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5499 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5500 e->u.logio.data); in qla2x00_do_work()
5503 qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, in qla2x00_do_work()
5504 e->u.gpnft.sp); in qla2x00_do_work()
5507 qla24xx_async_gpnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5510 qla24xx_async_gnnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5513 qla24xx_async_gnnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5516 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5522 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5526 e->u.fcport.fcport, false); in qla2x00_do_work()
5534 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5535 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5536 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5537 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5540 list_del_init(&e->list); in qla2x00_do_work()
5541 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5556 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5572 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5577 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5578 fcport->login_retry) { in qla2x00_relogin()
5579 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5580 fcport->disc_state == DSC_LOGIN_AUTH_PEND || in qla2x00_relogin()
5581 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5584 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5585 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5588 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5592 } else if (vha->hw->current_topology == in qla2x00_relogin()
5594 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5597 } else if (vha->hw->current_topology == in qla2x00_relogin()
5599 fcport->login_retry--; in qla2x00_relogin()
5604 fcport->old_loop_id = in qla2x00_relogin()
5605 fcport->loop_id; in qla2x00_relogin()
5608 fcport->loop_id); in qla2x00_relogin()
5613 &vha->dpc_flags); in qla2x00_relogin()
5617 fcport->login_retry, in qla2x00_relogin()
5618 fcport->loop_id); in qla2x00_relogin()
5620 fcport->login_retry = 0; in qla2x00_relogin()
5623 if (fcport->login_retry == 0 && in qla2x00_relogin()
5629 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5634 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5640 /* Schedule work on any of the dpc-workqueues */
5644 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5648 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5649 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5653 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5654 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5655 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5662 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5663 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5666 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5667 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5671 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5683 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5689 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5690 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5705 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5751 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5757 "Failed to dump mctp\n"); in qla83xx_nic_core_reset_work()
5761 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5774 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5780 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5790 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5826 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5838 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5851 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5864 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5869 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5924 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5928 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5933 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5935 ha->portnum); in qla83xx_idc_lock()
5943 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
5963 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
5966 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
5967 /* if RDP request is not from Domain Controller: */ in qla25xx_rdp_rsp_reduce_size()
5978 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
5981 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
5982 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
5992 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
6017 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
6019 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
6036 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
6048 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6056 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6064 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6067 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6071 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
6072 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
6073 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
6074 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
6075 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
6076 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
6077 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
6078 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
6079 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
6080 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
6081 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
6082 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
6084 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
6085 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
6086 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
6088 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
6089 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
6090 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
6092 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
6093 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
6095 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
6096 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
6099 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
6100 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
6101 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
6104 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6105 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
6106 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
6107 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
6108 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6111 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6112 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
6113 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
6114 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
6115 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6118 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
6119 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6120 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
6127 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
6145 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
6152 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
6153 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
6154 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
6155 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
6156 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
6161 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
6162 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
6163 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
6164 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
6166 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
6170 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
6171 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
6172 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
6177 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
6178 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
6179 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
6180 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
6181 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6182 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6183 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6184 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6185 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6186 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6187 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6188 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6189 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6194 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6195 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6196 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6197 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6198 vha->node_name, in qla24xx_process_purex_rdp()
6199 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6200 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6201 vha->port_name, in qla24xx_process_purex_rdp()
6202 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6204 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6205 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6206 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6207 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6208 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6209 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6210 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6211 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6212 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6213 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6216 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6217 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6218 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6219 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6220 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6221 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6223 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6225 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6226 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6233 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6234 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6235 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6237 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6238 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6239 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6241 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6242 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6243 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6245 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6246 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6247 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6249 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6250 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6251 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6260 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6261 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6262 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6263 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6264 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6268 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6269 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6270 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6271 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6272 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6276 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6277 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6278 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6279 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6280 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6284 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6285 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6286 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6287 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6288 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6292 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6293 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6294 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6295 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6296 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6304 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6312 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6320 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6328 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6336 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6346 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6347 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6348 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6354 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6356 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6357 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6359 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6360 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6362 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6363 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6365 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6371 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6373 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6381 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6385 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6393 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6394 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6396 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6397 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6398 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6405 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6408 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6411 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6414 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6421 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6422 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6433 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6434 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6435 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6438 list_del(&item->list); in qla24xx_process_purex_list()
6439 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6455 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6459 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6466 if (data == ha->portnum) { in qla83xx_idc_unlock()
6468 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6473 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6481 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6485 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6492 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6497 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6514 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6519 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6543 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6548 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6571 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6575 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6576 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6604 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6616 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6644 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6649 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6650 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6669 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6672 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6675 ha->portnum); in qla83xx_idc_state_handler()
6678 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6681 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6688 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6694 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6697 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6704 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6714 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6721 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6724 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6727 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6759 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6760 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6765 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6768 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6776 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6789 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6792 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6802 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6804 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6806 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6816 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6832 * is kick-off by the driver's detect code and starts up
6847 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6858 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6861 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6864 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6866 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6870 ha->dpc_active = 1; in qla2x00_do_dpc()
6874 base_vha->dpc_flags); in qla2x00_do_dpc()
6876 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6882 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6896 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6909 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6914 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6916 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6917 * Escalate to chip-reset in qla2x00_do_dpc()
6920 &base_vha->dpc_flags); in qla2x00_do_dpc()
6923 &base_vha->dpc_flags); in qla2x00_do_dpc()
6931 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6937 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6939 &base_vha->dpc_flags); in qla2x00_do_dpc()
6948 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6953 &base_vha->dpc_flags)) in qla2x00_do_dpc()
6955 &base_vha->dpc_flags); in qla2x00_do_dpc()
6963 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6967 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
6973 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6975 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
6977 * when a forced chip-reset occurs. in qla2x00_do_dpc()
6978 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
6980 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
6984 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6985 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6988 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
6993 !ha->flags.fw_started) in qla2x00_do_dpc()
6998 !ha->flags.fw_started) in qla2x00_do_dpc()
7006 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7007 base_vha->flags.online = 1; in qla2x00_do_dpc()
7010 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
7013 &base_vha->dpc_flags); in qla2x00_do_dpc()
7016 &base_vha->dpc_flags); in qla2x00_do_dpc()
7022 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7023 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7025 (&base_vha->purex_list); in qla2x00_do_dpc()
7027 &base_vha->dpc_flags); in qla2x00_do_dpc()
7032 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7039 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7048 &base_vha->dpc_flags); in qla2x00_do_dpc()
7049 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
7065 &base_vha->dpc_flags); in qla2x00_do_dpc()
7073 &base_vha->dpc_flags) && in qla2x00_do_dpc()
7074 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
7079 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
7085 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7086 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7087 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
7089 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
7090 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
7091 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
7092 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7101 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7107 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7112 &base_vha->dpc_flags); in qla2x00_do_dpc()
7122 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7123 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7124 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7129 if (!ha->interrupts_on) in qla2x00_do_dpc()
7130 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
7133 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7134 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
7135 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
7140 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7141 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
7142 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
7147 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
7148 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
7150 qpair->online = online; in qla2x00_do_dpc()
7151 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
7155 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7156 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
7158 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
7159 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
7175 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7179 ha->dpc_active = 0; in qla2x00_do_dpc()
7191 ha->dpc_active = 0; in qla2x00_do_dpc()
7202 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7203 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7205 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7219 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7220 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7221 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7223 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7229 vha->marker_needed = 1; in qla2x00_rst_aen()
7230 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7231 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7237 struct qla_hw_data *ha = vha->hw; in qla_do_heartbeat()
7246 cmpl_cnt = ha->base_qpair->cmd_completion_cnt; in qla_do_heartbeat()
7247 if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && in qla_do_heartbeat()
7248 cmpl_cnt != ha->base_qpair->cmd_cnt) { in qla_do_heartbeat()
7252 ha->base_qpair->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7254 for (i = 0; i < ha->max_qpairs; i++) { in qla_do_heartbeat()
7255 if (ha->queue_pair_map[i]) { in qla_do_heartbeat()
7256 cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; in qla_do_heartbeat()
7257 if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && in qla_do_heartbeat()
7258 cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { in qla_do_heartbeat()
7262 ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7272 struct qla_hw_data *ha = vha->hw; in qla_heart_beat()
7274 if (vha->vp_idx) in qla_heart_beat()
7277 if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) in qla_heart_beat()
7286 time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) in qla_heart_beat()
7290 ha->last_heartbeat_run_jiffies = jiffies; in qla_heart_beat()
7291 queue_work(ha->wq, &ha->heartbeat_work); in qla_heart_beat()
7297 struct qla_hw_data *ha = vha->hw; in qla_wind_down_chip()
7299 if (!ha->flags.eeh_busy) in qla_wind_down_chip()
7301 if (ha->pci_error_state) in qla_wind_down_chip()
7309 if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handling * HZ) && in qla_wind_down_chip()
7310 !ha->flags.eeh_flush) { in qla_wind_down_chip()
7314 ha->isp_ops->reset_chip(vha); in qla_wind_down_chip()
7315 ha->isp_ops->disable_intrs(ha); in qla_wind_down_chip()
7317 ha->flags.eeh_flush = EEH_FLUSH_RDY; in qla_wind_down_chip()
7318 ha->eeh_jif = jiffies; in qla_wind_down_chip()
7320 } else if (ha->flags.eeh_flush == EEH_FLUSH_RDY && in qla_wind_down_chip()
7321 time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { in qla_wind_down_chip()
7322 pci_clear_master(ha->pdev); in qla_wind_down_chip()
7326 ha->flags.eeh_flush = EEH_FLUSH_DONE; in qla_wind_down_chip()
7350 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7355 if (ha->flags.eeh_busy) { in qla2x00_timer()
7360 ha->flags.eeh_busy); in qla2x00_timer()
7367 * the read returns -1 then disable the board. in qla2x00_timer()
7369 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7370 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7375 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7376 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7384 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7387 if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7388 vha->link_down_time++; in qla2x00_timer()
7390 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7391 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_timer()
7392 if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7393 fcport->tgt_link_down_time++; in qla2x00_timer()
7395 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7398 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7399 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7400 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7401 && vha->flags.online) { in qla2x00_timer()
7403 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7404 vha->loop_down_abort_time) { in qla2x00_timer()
7407 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7409 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7410 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7413 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7416 /* NPIV - scan physical port only */ in qla2x00_timer()
7417 if (!vha->vp_idx) { in qla2x00_timer()
7418 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7420 req = ha->req_q_map[0]; in qla2x00_timer()
7422 index < req->num_outstanding_cmds; in qla2x00_timer()
7426 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7429 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7431 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7433 sfcp = sp->fcport; in qla2x00_timer()
7434 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7439 &vha->dpc_flags); in qla2x00_timer()
7442 &vha->dpc_flags); in qla2x00_timer()
7445 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7452 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7453 if (!(vha->device_flags & DFLG_NO_CABLE)) { in qla2x00_timer()
7455 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7459 &vha->dpc_flags); in qla2x00_timer()
7462 &vha->dpc_flags); in qla2x00_timer()
7466 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7467 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7470 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7473 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7479 if (vha->hw->flags.edif_enabled) in qla2x00_timer()
7483 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7487 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7488 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7490 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7492 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7496 * FC-NVME in qla2x00_timer()
7499 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7500 if (!vha->vp_idx && in qla2x00_timer()
7501 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7502 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7503 !ha->flags.host_shutting_down) { in qla2x00_timer()
7504 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7507 ha->nvme_last_rptd_aen); in qla2x00_timer()
7508 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7512 if (!vha->vp_idx && in qla2x00_timer()
7513 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7517 ha->last_zio_threshold); in qla2x00_timer()
7518 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7519 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7526 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7527 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7528 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7530 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7531 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7532 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7533 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7534 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7535 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7536 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7541 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7542 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7543 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7545 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7550 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7551 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7552 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7553 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7554 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7555 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7615 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7646 if (!blob->name) in qla2x00_request_firmware()
7650 if (blob->fw) in qla2x00_request_firmware()
7653 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7655 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7656 blob->fw = NULL; in qla2x00_request_firmware()
7671 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7672 release_firmware(blob->fw); in qla2x00_release_firmware()
7678 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7679 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7688 ha->chip_reset++; in qla_pci_error_cleanup()
7690 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7691 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7692 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7693 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7694 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7702 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7703 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7704 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7705 qpair->online = 0; in qla_pci_error_cleanup()
7707 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7711 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7712 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7713 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7714 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7716 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7717 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7719 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7722 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7723 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7725 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7726 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7727 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7728 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7729 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7730 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7731 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7732 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7734 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7742 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7747 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7749 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7760 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7770 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7773 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7791 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7792 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7793 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7798 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7809 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7811 stat = rd_reg_word(®->hccr); in qla2xxx_pci_mmio_enabled()
7815 stat = rd_reg_dword(®->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7819 stat = rd_reg_dword(®24->host_status); in qla2xxx_pci_mmio_enabled()
7823 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7827 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7842 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7849 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7854 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7863 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7870 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7875 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7878 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7879 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7880 qpair->online = 1; in qla2xxx_pci_slot_reset()
7881 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7883 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7884 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7885 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7886 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7887 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7890 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7909 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7921 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7928 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7929 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7933 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7936 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7937 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7938 ha->eeh_jif = jiffies; in qla_pci_set_eeh_busy()
7939 ha->flags.eeh_flush = 0; in qla_pci_set_eeh_busy()
7941 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7944 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7956 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
7957 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
7959 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
7962 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
7970 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
7982 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
7983 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
7984 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
7985 qpair->online = 0; in qla_pci_reset_prepare()
7986 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
7988 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
7997 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
8006 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
8007 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
8008 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
8009 qpair->online = 1; in qla_pci_reset_done()
8010 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
8012 base_vha->flags.online = 1; in qla_pci_reset_done()
8013 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
8014 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
8019 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
8020 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
8022 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
8025 blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); in qla2xxx_map_queues()
8049 .this_id = -1,
8120 * qla2x00_module_init - Module initialization.
8220 return -ENOMEM; in qla2x00_module_init()
8240 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
8249 ret = -ENODEV; in qla2x00_module_init()
8264 ret = -ENODEV; in qla2x00_module_init()
8298 * qla2x00_module_exit - Module cleanup.