Lines Matching +full:sp +full:- +full:disabled +full:- +full:ports

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
65 "Enable/disable security. 0(Default) - Security disabled. 1 - Security enabled.");
71 "beginning. Default is 0 - class 2 not supported.");
83 "a PORT-DOWN status.");
90 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
102 "vary by ISP type. Default is 1 - allocate memory.");
109 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
110 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
111 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
112 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
113 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
114 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
115 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
116 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
117 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
118 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
119 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
120 "\t\t0x1e400000 - Preferred value for capturing essential "
141 "0 - no FDMI registrations. "
142 "1 - provide FDMI registrations (default).");
154 " Enable T10-CRC-DIF:\n"
156 " 0 -- No DIF Support\n"
157 " 1 -- Enable DIF for all types\n"
158 " 2 -- Enable DIF for all types, except Type 0.\n");
168 "0 - no NVMe. Default is Y");
173 " Enable T10-CRC-DIF Error isolation by HBA:\n"
175 " 0 -- Error isolation disabled\n"
176 " 1 -- Error isolation enabled only for DIX Type 0\n"
177 " 2 -- Error isolation enabled for all Types\n");
191 " 2 -- load firmware via the request_firmware() (hotplug).\n"
193 " 1 -- load firmware from flash.\n"
194 " 0 -- use default semantics.\n");
200 " 0 -- Regular doorbell.\n"
201 " 1 -- CAMRAM doorbell (faster).\n");
207 "Default is 0 - Do not use GFF_ID information.");
213 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
219 " 0 (Default) -- Reset on failure.\n"
220 " 1 -- Do not reset on failure.\n");
232 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
238 "0 - MiniDump disabled. "
239 "1 (Default) - MiniDump enabled.");
245 "0 (Default)- Disabled.");
262 "1 - Set fw option to hold ABTS.");
269 "1 - Move IOCBs.");
280 "Set to enable MSI or MSI-X interrupt mechanism.\n"
281 " Default is 1, enable MSI-X interrupt mechanism.\n"
282 " 0 -- enable traditional pin-based mechanism.\n"
283 " 1 -- enable MSI-X interrupt mechanism.\n"
284 " 2 -- enable MSI interrupt mechanism.\n");
290 " 0 (default): disabled");
302 " 0 -- Let HBA firmware decide\n"
303 " 1 -- Force T10 CRC\n"
304 " 2 -- Force IP checksum\n");
318 " Default is 0 - No SmartSAN registration,"
319 " 1 - Register SmartSAN Management Attributes.");
326 "0 - no RDP responses (default). "
327 "1 - provide RDP responses.");
337 "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n");
349 "1 - Minimum number of queues supported\n"
350 "8 - Default value");
356 "0 - FC2 Target support is disabled. "
357 "1 - FC2 Target support is enabled (default).");
370 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
371 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
372 add_timer(&vha->timer); in qla2x00_start_timer()
373 vha->timer_active = 1; in qla2x00_start_timer()
380 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
386 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
392 timer_delete_sync(&vha->timer); in qla2x00_stop_timer()
393 vha->timer_active = 0; in qla2x00_stop_timer()
407 /* -------------------------------------------------------------------------- */
411 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
413 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
414 rsp->req = req; in qla_init_base_qpair()
415 ha->base_qpair->hw = ha; in qla_init_base_qpair()
416 ha->base_qpair->req = req; in qla_init_base_qpair()
417 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
418 ha->base_qpair->vha = vha; in qla_init_base_qpair()
419 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
420 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
421 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
422 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
423 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
424 INIT_LIST_HEAD(&ha->base_qpair->dsd_list); in qla_init_base_qpair()
425 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
427 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
428 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
431 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
437 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
439 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
441 if (!ha->req_q_map) { in qla2x00_alloc_queues()
447 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
449 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
455 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
456 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
464 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
465 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
467 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
473 kfree(ha->queue_pair_map); in qla2x00_alloc_queues()
474 ha->queue_pair_map = NULL; in qla2x00_alloc_queues()
483 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
484 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
485 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
486 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
490 kfree(ha->base_qpair); in qla2x00_alloc_queues()
491 ha->base_qpair = NULL; in qla2x00_alloc_queues()
493 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
494 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
496 kfree(ha->req_q_map); in qla2x00_alloc_queues()
497 ha->req_q_map = NULL; in qla2x00_alloc_queues()
499 return -ENOMEM; in qla2x00_alloc_queues()
505 if (req && req->ring_fx00) in qla2x00_free_req_que()
506 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
507 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
508 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
509 } else if (req && req->ring) in qla2x00_free_req_que()
510 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
511 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
512 req->ring, req->dma); in qla2x00_free_req_que()
515 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
523 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
524 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
525 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
526 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
527 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
528 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
529 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
530 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
542 if (ha->queue_pair_map) { in qla2x00_free_queues()
543 kfree(ha->queue_pair_map); in qla2x00_free_queues()
544 ha->queue_pair_map = NULL; in qla2x00_free_queues()
546 if (ha->base_qpair) { in qla2x00_free_queues()
547 kfree(ha->base_qpair); in qla2x00_free_queues()
548 ha->base_qpair = NULL; in qla2x00_free_queues()
552 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
553 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
554 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
557 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
558 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
559 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
561 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
563 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
565 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
567 kfree(ha->req_q_map); in qla2x00_free_queues()
568 ha->req_q_map = NULL; in qla2x00_free_queues()
571 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
572 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
573 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
576 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
577 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
578 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
579 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
581 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
583 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
585 kfree(ha->rsp_q_map); in qla2x00_free_queues()
586 ha->rsp_q_map = NULL; in qla2x00_free_queues()
592 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
598 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
600 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
603 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
616 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
619 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
623 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
649 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
654 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
665 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
667 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
668 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
670 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
675 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
689 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
693 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
702 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
704 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
705 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
709 void qla2x00_sp_free_dma(srb_t *sp) in qla2x00_sp_free_dma() argument
711 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
712 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_sp_free_dma()
714 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
716 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
719 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
720 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
721 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
722 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
725 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
727 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
728 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
731 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
732 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
734 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
735 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
738 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
739 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
741 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
742 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
743 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2x00_sp_free_dma()
744 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
745 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
748 if (sp->flags & SRB_GOT_BUF) in qla2x00_sp_free_dma()
749 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2x00_sp_free_dma()
752 void qla2x00_sp_compl(srb_t *sp, int res) in qla2x00_sp_compl() argument
754 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_sp_compl()
755 struct completion *comp = sp->comp; in qla2x00_sp_compl()
758 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_compl()
759 cmd->result = res; in qla2x00_sp_compl()
760 sp->type = 0; in qla2x00_sp_compl()
766 void qla2xxx_qpair_sp_free_dma(srb_t *sp) in qla2xxx_qpair_sp_free_dma() argument
768 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2xxx_qpair_sp_free_dma()
769 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
771 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
773 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
776 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
777 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
778 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
779 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
782 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
784 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
785 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
788 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
789 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
793 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
794 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
795 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
796 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
798 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
802 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
803 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
804 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
805 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
807 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
810 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
811 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
812 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
813 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
816 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
817 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
818 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
819 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
821 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
824 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
825 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
827 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
828 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
829 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2xxx_qpair_sp_free_dma()
830 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
831 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
832 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
835 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
836 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
838 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
839 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
842 if (sp->flags & SRB_GOT_BUF) in qla2xxx_qpair_sp_free_dma()
843 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2xxx_qpair_sp_free_dma()
846 void qla2xxx_qpair_sp_compl(srb_t *sp, int res) in qla2xxx_qpair_sp_compl() argument
848 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2xxx_qpair_sp_compl()
849 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
852 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_qpair_sp_compl()
853 cmd->result = res; in qla2xxx_qpair_sp_compl()
854 sp->type = 0; in qla2xxx_qpair_sp_compl()
864 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
865 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
866 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
867 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
868 srb_t *sp; in qla2xxx_queuecommand() local
871 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
873 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
877 if (ha->mqenable) { in qla2xxx_queuecommand()
884 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
890 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
891 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
895 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
899 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
906 cmd->result = rval; in qla2xxx_queuecommand()
913 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
918 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
922 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
923 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
927 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
928 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
929 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
932 atomic_read(&fcport->state), in qla2xxx_queuecommand()
933 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
934 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
941 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
944 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
946 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
947 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
951 sp = scsi_cmd_priv(cmd); in qla2xxx_queuecommand()
953 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
955 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
956 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
957 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
958 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
960 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
971 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_queuecommand()
988 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
989 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
990 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
991 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
992 srb_t *sp; in qla2xxx_mqueuecommand() local
997 cmd->result = rval; in qla2xxx_mqueuecommand()
1004 if (!qpair->online) { in qla2xxx_mqueuecommand()
1006 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
1007 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1011 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
1012 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
1016 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
1017 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
1018 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
1021 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
1022 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
1023 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1030 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
1033 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
1035 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
1036 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1040 sp = scsi_cmd_priv(cmd); in qla2xxx_mqueuecommand()
1042 qla2xxx_init_sp(sp, vha, qpair, fcport); in qla2xxx_mqueuecommand()
1044 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1045 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1046 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1047 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1049 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1060 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_mqueuecommand()
1075 * finally HBA is disabled ie marked offline
1078 * ha - pointer to host adapter structure
1081 * Does context switching-Release SPIN_LOCK
1086 * Failed (Adapter is offline/disabled) : 1
1093 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1094 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1097 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1098 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1099 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1100 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1104 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1114 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1119 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1122 vha, vha->fcport_count); in test_fcport_count()
1123 res = (vha->fcport_count == 0); in test_fcport_count()
1127 list_for_each_entry(fcport, &vha->vp_fcports, list) { in test_fcport_count()
1128 if (fcport->deleted != QLA_SESS_DELETED) { in test_fcport_count()
1139 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1156 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1161 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1169 * ha - pointer to host adapter structure
1172 * Does context switching-Release SPIN_LOCK
1179 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1180 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1182 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1183 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1184 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1185 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1186 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1197 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1198 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1201 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1202 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1203 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1204 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1208 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1209 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1212 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1238 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1240 srb_t *sp; in qla2xxx_eh_abort() local
1245 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1263 sp = scsi_cmd_priv(cmd); in qla2xxx_eh_abort()
1264 qpair = sp->qpair; in qla2xxx_eh_abort()
1266 vha->cmd_timeout_cnt++; in qla2xxx_eh_abort()
1268 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1271 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1272 sp->comp = &comp; in qla2xxx_eh_abort()
1273 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1276 id = cmd->device->id; in qla2xxx_eh_abort()
1277 lun = cmd->device->lun; in qla2xxx_eh_abort()
1280 "Aborting from RISC nexus=%ld:%d:%llu sp=%p cmd=%p handle=%x\n", in qla2xxx_eh_abort()
1281 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1284 * Abort will release the original Command/sp from FW. Let the in qla2xxx_eh_abort()
1288 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1294 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1301 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1312 sp->comp = NULL; in qla2xxx_eh_abort()
1315 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1316 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1333 scsi_qla_host_t *vha = qpair->vha; in __qla2x00_eh_wait_for_pending_commands()
1334 struct req_que *req = qpair->req; in __qla2x00_eh_wait_for_pending_commands()
1335 srb_t *sp; in __qla2x00_eh_wait_for_pending_commands() local
1339 struct qla_hw_data *ha = vha->hw; in __qla2x00_eh_wait_for_pending_commands()
1343 while (wait_iter--) { in __qla2x00_eh_wait_for_pending_commands()
1346 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1347 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_eh_wait_for_pending_commands()
1348 sp = req->outstanding_cmds[cnt]; in __qla2x00_eh_wait_for_pending_commands()
1349 if (!sp) in __qla2x00_eh_wait_for_pending_commands()
1351 if (sp->type != SRB_SCSI_CMD) in __qla2x00_eh_wait_for_pending_commands()
1353 if (vha->vp_idx != sp->vha->vp_idx) in __qla2x00_eh_wait_for_pending_commands()
1356 cmd = GET_CMD_SP(sp); in __qla2x00_eh_wait_for_pending_commands()
1362 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1363 match = sp->fcport->d_id.b24 == t; in __qla2x00_eh_wait_for_pending_commands()
1368 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1369 match = (sp->fcport->d_id.b24 == t && in __qla2x00_eh_wait_for_pending_commands()
1370 cmd->device->lun == l); in __qla2x00_eh_wait_for_pending_commands()
1378 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1380 if (unlikely(pci_channel_offline(ha->pdev)) || in __qla2x00_eh_wait_for_pending_commands()
1381 ha->flags.eeh_busy) { in __qla2x00_eh_wait_for_pending_commands()
1393 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1396 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1402 if (wait_iter == -1) in __qla2x00_eh_wait_for_pending_commands()
1413 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1416 status = __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, in qla2x00_eh_wait_for_pending_commands()
1418 for (i = 0; status == QLA_SUCCESS && i < ha->max_qpairs; i++) { in qla2x00_eh_wait_for_pending_commands()
1419 qpair = ha->queue_pair_map[i]; in qla2x00_eh_wait_for_pending_commands()
1438 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_device_reset()
1439 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_eh_device_reset()
1441 fc_port_t *fcport = (struct fc_port *) sdev->hostdata; in qla2xxx_eh_device_reset()
1442 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1460 if (fcport->deleted) in qla2xxx_eh_device_reset()
1464 "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, in qla2xxx_eh_device_reset()
1465 sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1474 if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) in qla2xxx_eh_device_reset()
1481 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, in qla2xxx_eh_device_reset()
1482 cmd->device->lun, in qla2xxx_eh_device_reset()
1491 vha->host_no, sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1498 reset_errors[err], vha->host_no, sdev->id, sdev->lun, in qla2xxx_eh_device_reset()
1500 vha->reset_cmd_err_cnt++; in qla2xxx_eh_device_reset()
1507 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_target_reset()
1510 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1511 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_eh_target_reset()
1529 if (fcport->deleted) in qla2xxx_eh_target_reset()
1533 "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no, in qla2xxx_eh_target_reset()
1534 sdev->id, cmd); in qla2xxx_eh_target_reset()
1543 if (ha->isp_ops->target_reset(fcport, 0, 0) != QLA_SUCCESS) { in qla2xxx_eh_target_reset()
1549 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, 0, in qla2xxx_eh_target_reset()
1558 vha->host_no, sdev->id, cmd); in qla2xxx_eh_target_reset()
1565 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in qla2xxx_eh_target_reset()
1567 vha->reset_cmd_err_cnt++; in qla2xxx_eh_target_reset()
1589 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1593 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1602 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1603 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1609 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1613 "Wait for hba online failed board disabled.\n"); in qla2xxx_eh_bus_reset()
1634 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1657 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1658 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1662 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1671 id = cmd->device->id; in qla2xxx_eh_host_reset()
1672 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1675 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1681 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1688 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1696 if (ha->wq) in qla2xxx_eh_host_reset()
1697 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1699 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1700 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1701 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1703 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1711 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1722 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1741 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1746 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1747 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1748 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1757 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1765 vha->marker_needed = 1; in qla2x00_loop_reset()
1774 static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, in qla2x00_abort_srb() argument
1776 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1777 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1780 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1781 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1782 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_abort_srb()
1787 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1790 sp->done(sp, res); in qla2x00_abort_srb()
1794 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1795 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1796 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1798 if (sp->comp) { in qla2x00_abort_srb()
1799 sp->done(sp, res); in qla2x00_abort_srb()
1803 sp->comp = &comp; in qla2x00_abort_srb()
1804 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1806 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1809 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1816 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1819 /* else FW return SP to driver */ in qla2x00_abort_srb()
1826 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1827 switch (sp->type) { in qla2x00_abort_srb()
1830 sp->done(sp, res); in qla2x00_abort_srb()
1834 sp->done(sp, res); in qla2x00_abort_srb()
1838 sp->done(sp, res); in qla2x00_abort_srb()
1851 srb_t *sp; in __qla2x00_abort_all_cmds() local
1852 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1853 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1855 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1858 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1860 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1861 req = qp->req; in __qla2x00_abort_all_cmds()
1862 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1863 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1864 if (sp) { in __qla2x00_abort_all_cmds()
1866 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1867 sp->done(sp, res); in __qla2x00_abort_all_cmds()
1871 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1873 qla2x00_abort_srb(qp, sp, res, &flags); in __qla2x00_abort_all_cmds()
1876 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1879 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1880 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1883 cmd = (struct qla_tgt_cmd *)sp; in __qla2x00_abort_all_cmds()
1884 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1892 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1895 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1906 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1909 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1911 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1913 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1915 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1916 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1919 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1929 return -ENXIO; in qla2xxx_sdev_init()
1931 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_sdev_init()
1939 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_sdev_configure()
1940 struct req_que *req = vha->req; in qla2xxx_sdev_configure()
1942 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_sdev_configure()
1949 sdev->hostdata = NULL; in qla2xxx_sdev_destroy()
1953 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1963 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1965 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1966 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1967 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1968 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1970 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1971 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1972 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1977 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1978 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1985 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
1987 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1988 ha->interrupts_on = 1; in qla2x00_enable_intrs()
1990 wrt_reg_word(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
1991 rd_reg_word(&reg->ictrl); in qla2x00_enable_intrs()
1992 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2000 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
2002 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2003 ha->interrupts_on = 0; in qla2x00_disable_intrs()
2005 wrt_reg_word(&reg->ictrl, 0); in qla2x00_disable_intrs()
2006 rd_reg_word(&reg->ictrl); in qla2x00_disable_intrs()
2007 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2014 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
2016 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2017 ha->interrupts_on = 1; in qla24xx_enable_intrs()
2018 wrt_reg_dword(&reg->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
2019 rd_reg_dword(&reg->ictrl); in qla24xx_enable_intrs()
2020 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2027 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
2031 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2032 ha->interrupts_on = 0; in qla24xx_disable_intrs()
2033 wrt_reg_dword(&reg->ictrl, 0); in qla24xx_disable_intrs()
2034 rd_reg_dword(&reg->ictrl); in qla24xx_disable_intrs()
2035 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2044 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
2046 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
2048 pci_name(ha->pdev)); in qla2x00_iospace_config()
2051 if (!(ha->bars & 1)) in qla2x00_iospace_config()
2055 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
2056 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
2057 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2058 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
2060 pci_name(ha->pdev)); in qla2x00_iospace_config()
2064 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
2066 pci_name(ha->pdev)); in qla2x00_iospace_config()
2069 ha->pio_address = pio; in qla2x00_iospace_config()
2070 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
2072 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2076 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2077 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2079 pci_name(ha->pdev)); in qla2x00_iospace_config()
2082 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2083 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2085 pci_name(ha->pdev)); in qla2x00_iospace_config()
2089 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2090 if (!ha->iobase) { in qla2x00_iospace_config()
2091 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2093 pci_name(ha->pdev)); in qla2x00_iospace_config()
2098 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2099 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2102 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2109 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2110 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2111 if (ha->mqiobase) { in qla2x00_iospace_config()
2112 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2113 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2115 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2116 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2119 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2120 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2122 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2123 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2124 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2126 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2127 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2129 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2133 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2134 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2138 return (-ENOMEM); in qla2x00_iospace_config()
2147 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2149 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2151 pci_name(ha->pdev)); in qla83xx_iospace_config()
2157 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2158 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2160 pci_name(ha->pdev)); in qla83xx_iospace_config()
2163 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2164 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2166 pci_name(ha->pdev)); in qla83xx_iospace_config()
2170 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2171 if (!ha->iobase) { in qla83xx_iospace_config()
2172 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2174 pci_name(ha->pdev)); in qla83xx_iospace_config()
2178 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2180 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2181 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2182 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2183 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2184 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2186 if (!ha->mqiobase) { in qla83xx_iospace_config()
2187 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2192 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2193 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2194 if (ha->msixbase) { in qla83xx_iospace_config()
2196 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2198 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2205 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2209 ha->max_req_queues--; in qla83xx_iospace_config()
2211 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2215 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2216 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2217 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2219 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2220 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2222 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2226 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2227 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2231 return -ENOMEM; in qla83xx_iospace_config()
2628 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2629 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2631 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2632 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2633 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2636 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2637 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2638 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2641 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2642 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2643 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2646 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2647 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2648 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2651 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2652 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2653 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2654 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2655 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2656 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2659 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2660 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2663 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2664 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2667 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2668 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2669 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2670 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2671 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2674 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2675 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2676 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2677 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2678 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2681 ha->isp_type |= DT_ISP8432; 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_ISP5422; in qla2x00_set_isp_flags()
2689 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2690 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2693 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2694 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2695 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2698 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2699 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2700 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2701 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2702 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2705 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2706 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2707 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2708 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2709 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2712 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2713 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2714 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2715 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2720 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2721 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2722 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2723 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2728 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2729 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2730 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2731 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2732 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2733 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2736 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2737 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2738 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2739 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2740 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2741 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2744 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2747 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2748 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2749 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2750 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2751 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2752 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2755 ha->isp_type |= DT_ISP2271; 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()
2763 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2764 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2765 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2766 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2767 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2768 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2772 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2773 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2774 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2775 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2776 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2777 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2781 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2782 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2783 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2784 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2785 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2786 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2791 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2794 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2797 ha->port_no--; in qla2x00_set_isp_flags()
2799 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2802 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2804 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2812 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2815 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2816 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2817 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2818 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2826 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2828 if (!vha->host) in qla2xxx_scan_finished()
2830 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2833 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2840 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_heartbeat_work_fn()
2842 if (!ha->flags.mbox_busy && base_vha->flags.init_done) in qla_heartbeat_work_fn()
2850 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2851 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2855 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2858 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2860 i--; in qla2x00_iocb_work_fn()
2863 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2864 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2865 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2874 "Unable to create qla2xxx trace instance, instance logging will be disabled.\n"); in qla_trace_init()
2895 int ret = -ENODEV; in qla2x00_probe_one()
2910 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2911 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2912 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2913 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2914 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2915 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2916 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2917 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2918 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2919 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2920 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2921 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2922 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2923 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2924 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2925 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2926 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2927 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2928 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2958 ha->pdev = pdev; in qla2x00_probe_one()
2959 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2960 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2961 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2962 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2964 spin_lock_init(&ha->sadb_lock); in qla2x00_probe_one()
2965 INIT_LIST_HEAD(&ha->sadb_tx_index_list); in qla2x00_probe_one()
2966 INIT_LIST_HEAD(&ha->sadb_rx_index_list); in qla2x00_probe_one()
2968 spin_lock_init(&ha->sadb_fp_lock); in qla2x00_probe_one()
2975 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2978 ha->bars = bars; in qla2x00_probe_one()
2979 ha->mem_only = mem_only; in qla2x00_probe_one()
2980 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
2981 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
2982 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
2983 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
2985 /* Set ISP-type information. */ in qla2x00_probe_one()
2991 pdev->needs_freset = 1; in qla2x00_probe_one()
2993 ha->prev_topology = 0; in qla2x00_probe_one()
2994 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
2995 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
2996 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
2997 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
2998 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
2999 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
3000 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
3001 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
3002 INIT_LIST_HEAD(&ha->tmf_pending); in qla2x00_probe_one()
3003 INIT_LIST_HEAD(&ha->tmf_active); in qla2x00_probe_one()
3007 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3008 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
3011 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3012 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3013 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3014 ha->flash_data_off = ~0; in qla2x00_probe_one()
3015 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3016 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3017 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3019 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3020 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
3023 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3024 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3025 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3026 ha->flash_data_off = ~0; in qla2x00_probe_one()
3027 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3028 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3029 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3031 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3032 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3035 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3036 ha->gid_list_info_size = 6; in qla2x00_probe_one()
3038 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
3039 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3040 ha->flash_data_off = ~0; in qla2x00_probe_one()
3041 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3042 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3043 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
3045 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3046 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3049 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3050 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3051 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3052 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3053 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
3054 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
3055 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
3056 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3057 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3058 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3059 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3061 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3062 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3065 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3066 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3067 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3068 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3069 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
3070 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3071 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
3072 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3073 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3074 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3075 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3077 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3078 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3081 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; 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_81XX; in qla2x00_probe_one()
3086 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3087 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
3088 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3089 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3090 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3091 ha->nvram_data_off = ~0; 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_82XX; in qla2x00_probe_one()
3101 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3102 ha->isp_ops = &qla82xx_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->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3109 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3112 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3113 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3114 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3115 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3116 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3117 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
3118 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3119 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3120 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3121 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3123 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3124 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3125 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3128 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3129 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3130 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3131 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3132 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3133 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3134 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3135 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3136 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3137 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3138 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3140 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3141 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3142 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3145 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3146 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3147 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3148 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3149 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3150 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3151 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3152 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3154 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3155 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3156 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3159 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3160 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3161 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3162 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3163 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3164 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3165 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3166 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3167 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3168 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3169 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3171 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3172 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3173 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3176 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3177 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3178 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3179 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3180 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3181 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3182 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3183 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3184 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3185 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3186 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3194 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3195 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3196 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3200 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3201 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3204 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3210 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3211 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3212 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3213 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3214 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3215 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3216 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3217 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3219 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3224 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3234 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3236 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3241 ret = -ENOMEM; in qla2x00_probe_one()
3246 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3248 host = base_vha->host; in qla2x00_probe_one()
3249 base_vha->req = req; in qla2x00_probe_one()
3251 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3254 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3255 base_vha->vp_idx; in qla2x00_probe_one()
3258 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3259 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3260 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3261 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3262 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3263 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3272 host->sg_tablesize = 32; in qla2x00_probe_one()
3275 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3277 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3278 host->cmd_per_lun = 3; in qla2x00_probe_one()
3279 host->unique_id = host->host_no; in qla2x00_probe_one()
3288 host->max_cmd_len = 32; in qla2x00_probe_one()
3290 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3291 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3292 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3295 host->max_lun = 0xffff; in qla2x00_probe_one()
3297 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3298 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3299 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3304 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3305 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3306 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3307 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3309 INIT_WORK(&ha->heartbeat_work, qla_heartbeat_work_fn); in qla2x00_probe_one()
3322 ret = -ENODEV; in qla2x00_probe_one()
3326 if (ha->mqenable) { in qla2x00_probe_one()
3327 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3328 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3331 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3334 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3336 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3337 host->nr_hw_queues); in qla2x00_probe_one()
3340 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3349 rsp->req = req; in qla2x00_probe_one()
3350 req->rsp = rsp; in qla2x00_probe_one()
3353 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3354 ha->req_q_map[0] = req; in qla2x00_probe_one()
3355 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3356 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3359 /* FWI2-capable only. */ in qla2x00_probe_one()
3360 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3361 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3362 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3363 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3364 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3366 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3367 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3368 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3369 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3373 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3374 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3375 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3376 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3380 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3381 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3382 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3386 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3387 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3389 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3390 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3391 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3392 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3394 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3395 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3397 "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()
3398 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3400 ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); in qla2x00_probe_one()
3401 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3402 ret = -ENOMEM; in qla2x00_probe_one()
3406 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3408 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3409 base_vha->device_flags); in qla2x00_probe_one()
3428 ret = -ENODEV; in qla2x00_probe_one()
3433 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3435 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3439 host->can_queue, base_vha->req, in qla2x00_probe_one()
3440 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3443 if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6)) in qla2x00_probe_one()
3444 ha->mqenable = 0; in qla2x00_probe_one()
3446 if (ha->mqenable) { in qla2x00_probe_one()
3456 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3461 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3467 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3468 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3469 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3472 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3473 ha->dpc_thread = NULL; in qla2x00_probe_one()
3487 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3490 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3491 ha->dpc_lp_wq = in qla2x00_probe_one()
3493 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3495 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3496 ha->dpc_hp_wq = in qla2x00_probe_one()
3498 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3499 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3501 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3506 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3507 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3519 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3522 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3547 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3550 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3554 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3555 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3559 if (IS_T10_PI_CAPABLE(base_vha->hw)) in qla2x00_probe_one()
3560 host->dma_alignment = 0x7; in qla2x00_probe_one()
3562 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3566 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3567 base_vha->flags.online = 1; in qla2x00_probe_one()
3568 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3578 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3584 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3588 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3596 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3599 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3601 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3602 base_vha->host_no, in qla2x00_probe_one()
3603 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3607 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3609 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3610 return -ENODEV; in qla2x00_probe_one()
3617 vfree(base_vha->scan.l); in qla2x00_probe_one()
3618 if (base_vha->gnl.l) { in qla2x00_probe_one()
3619 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3620 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3621 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3624 if (base_vha->timer_active) in qla2x00_probe_one()
3626 base_vha->flags.online = 0; in qla2x00_probe_one()
3627 if (ha->dpc_thread) { in qla2x00_probe_one()
3628 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3630 ha->dpc_thread = NULL; in qla2x00_probe_one()
3635 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3653 if (!ha->nx_pcibase) in qla2x00_probe_one()
3654 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3656 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3658 if (ha->iobase) in qla2x00_probe_one()
3659 iounmap(ha->iobase); in qla2x00_probe_one()
3660 if (ha->cregbase) in qla2x00_probe_one()
3661 iounmap(ha->cregbase); in qla2x00_probe_one()
3663 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3680 ha = base_vha->hw; in __qla_set_remove_flag()
3682 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3683 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3684 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3690 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3691 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3701 ha = vha->hw; in qla2x00_shutdown()
3711 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3713 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3720 /* Turn-off FCE trace */ in qla2x00_shutdown()
3721 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3723 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3726 /* Turn-off EFT trace */ in qla2x00_shutdown()
3727 if (ha->eft) in qla2x00_shutdown()
3732 if (ha->flags.fw_started) in qla2x00_shutdown()
3740 if (vha->timer_active) in qla2x00_shutdown()
3744 vha->flags.online = 0; in qla2x00_shutdown()
3746 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3747 if (ha->interrupts_on) { in qla2x00_shutdown()
3748 vha->flags.init_done = 0; in qla2x00_shutdown()
3749 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3761 /* Deletes all the virtual ports for a given ha */
3768 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3769 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3770 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3772 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3773 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3774 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3775 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3777 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3778 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3782 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3783 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3785 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3787 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3795 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3796 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3797 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3798 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3801 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3802 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3803 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3804 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3805 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3806 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3810 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3811 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3814 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3817 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3827 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3829 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3831 if (ha->iobase) in qla2x00_unmap_iobases()
3832 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3834 if (ha->cregbase) in qla2x00_unmap_iobases()
3835 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3837 if (ha->mqiobase) in qla2x00_unmap_iobases()
3838 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3840 if (ha->msixbase) in qla2x00_unmap_iobases()
3841 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3866 ha = base_vha->hw; in qla2x00_remove_one()
3870 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3873 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3877 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3878 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3879 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3880 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3881 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3892 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3897 if (ha->flags.fw_started) in qla2x00_remove_one()
3905 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3915 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3916 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3918 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3922 vfree(base_vha->scan.l); in qla2x00_remove_one()
3934 if (base_vha->timer_active) in qla2x00_remove_one()
3937 base_vha->flags.online = 0; in qla2x00_remove_one()
3940 if (ha->exlogin_buf) in qla2x00_remove_one()
3944 if (ha->exchoffld_buf) in qla2x00_remove_one()
3953 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3955 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3961 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3965 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3977 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3978 list_for_each_entry_safe(item, next, &list->head, list) { in qla24xx_free_purex_list()
3979 list_del(&item->list); in qla24xx_free_purex_list()
3980 if (item == &item->vha->default_item) in qla24xx_free_purex_list()
3984 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
3990 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
3995 if (vha->timer_active) in qla2x00_free_device()
3999 vha->flags.online = 0; in qla2x00_free_device()
4001 /* turn-off interrupts on the card */ in qla2x00_free_device()
4002 if (ha->interrupts_on) { in qla2x00_free_device()
4003 vha->flags.init_done = 0; in qla2x00_free_device()
4004 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
4012 if (ha->wq) { in qla2x00_free_device()
4013 destroy_workqueue(ha->wq); in qla2x00_free_device()
4014 ha->wq = NULL; in qla2x00_free_device()
4018 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
4034 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
4043 if (!fcport->rport) in qla2x00_schedule_rport_del()
4046 if (fcport->rport) { in qla2x00_schedule_rport_del()
4047 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
4049 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
4050 fcport->rport->roles); in qla2x00_schedule_rport_del()
4051 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
4068 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
4074 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
4075 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
4084 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
4090 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
4101 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
4103 fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
4104 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
4105 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
4109 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
4110 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
4113 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
4126 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4127 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4128 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4147 ha->vp_map = kcalloc(MAX_MULTI_ID_FABRIC, sizeof(struct qla_vp_map), GFP_KERNEL); in qla2x00_mem_alloc()
4148 if (!ha->vp_map) in qla2x00_mem_alloc()
4152 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
4153 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4154 if (!ha->init_cb) in qla2x00_mem_alloc()
4157 rc = btree_init32(&ha->host_map); in qla2x00_mem_alloc()
4164 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4165 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4166 if (!ha->gid_list) in qla2x00_mem_alloc()
4169 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4170 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4182 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4184 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4186 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4188 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4192 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4193 if (!ha->nvram) in qla2x00_mem_alloc()
4197 ha->pdev->device); in qla2x00_mem_alloc()
4198 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4200 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4203 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4205 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4208 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4210 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4211 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4216 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4218 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4219 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4229 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4230 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4231 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4232 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4238 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4239 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4240 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4241 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4245 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4248 return -ENOMEM; in qla2x00_mem_alloc()
4250 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4252 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4253 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4254 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4255 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4256 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4258 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4261 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4264 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4270 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4271 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4272 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4273 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4274 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4276 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4277 &ha->pool.good.head); in qla2x00_mem_alloc()
4278 ha->pool.good.count++; in qla2x00_mem_alloc()
4284 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4285 list_del(&dsd->list); in qla2x00_mem_alloc()
4286 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4287 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4288 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4290 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4293 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4295 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4296 ha->pool.unusable.count); in qla2x00_mem_alloc()
4299 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4301 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4302 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4308 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4309 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4310 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4312 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4313 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4316 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4317 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4318 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4321 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4322 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4323 if (!ha->ct_sns) in qla2x00_mem_alloc()
4325 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4327 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4333 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4337 (*req)->length = req_len; in qla2x00_mem_alloc()
4338 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4339 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4340 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4341 if (!(*req)->ring) { in qla2x00_mem_alloc()
4342 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4349 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4353 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4354 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4355 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4356 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4357 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4358 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4359 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4363 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4364 (*rsp)->req = *req; in qla2x00_mem_alloc()
4365 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4366 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4367 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4368 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4369 (*rsp)->ring); in qla2x00_mem_alloc()
4371 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4372 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4375 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4376 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4381 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4383 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4386 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4387 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4388 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4390 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4391 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4394 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4396 ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4397 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4398 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4400 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4401 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4405 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4407 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4408 &ha->async_pd_dma); in qla2x00_mem_alloc()
4409 if (!ha->async_pd) in qla2x00_mem_alloc()
4411 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4412 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4415 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4418 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4421 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4425 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4426 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4429 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4430 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4431 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4432 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4433 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4437 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4438 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4440 if (!ha->flt) { in qla2x00_mem_alloc()
4441 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4447 ha->purex_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4450 if (!ha->purex_dma_pool) { in qla2x00_mem_alloc()
4451 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4456 ha->elsrej.size = sizeof(struct fc_els_ls_rjt) + 16; in qla2x00_mem_alloc()
4457 ha->elsrej.c = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4458 ha->elsrej.size, in qla2x00_mem_alloc()
4459 &ha->elsrej.cdma, in qla2x00_mem_alloc()
4461 if (!ha->elsrej.c) { in qla2x00_mem_alloc()
4462 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4466 ha->elsrej.c->er_cmd = ELS_LS_RJT; in qla2x00_mem_alloc()
4467 ha->elsrej.c->er_reason = ELS_RJT_LOGIC; in qla2x00_mem_alloc()
4468 ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; in qla2x00_mem_alloc()
4470 ha->lsrjt.size = sizeof(struct fcnvme_ls_rjt); in qla2x00_mem_alloc()
4471 ha->lsrjt.c = dma_alloc_coherent(&ha->pdev->dev, ha->lsrjt.size, in qla2x00_mem_alloc()
4472 &ha->lsrjt.cdma, GFP_KERNEL); in qla2x00_mem_alloc()
4473 if (!ha->lsrjt.c) { in qla2x00_mem_alloc()
4474 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4482 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_alloc()
4483 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_alloc()
4485 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_alloc()
4487 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4488 ha->flt, ha->flt_dma); in qla2x00_mem_alloc()
4491 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4492 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4494 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4496 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4498 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4500 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4502 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4504 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4505 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4506 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4507 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4512 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4513 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4514 (*req)->ring = NULL; in qla2x00_mem_alloc()
4515 (*req)->dma = 0; in qla2x00_mem_alloc()
4520 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4521 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4522 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4523 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4525 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4526 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4527 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4529 if (ha->sns_cmd) in qla2x00_mem_alloc()
4530 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4531 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4536 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4538 list_del(&dsd->list); in qla2x00_mem_alloc()
4539 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4540 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4541 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4543 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4544 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4546 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4547 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4552 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4553 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4557 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4558 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4561 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4562 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4564 kfree(ha->nvram); in qla2x00_mem_alloc()
4565 ha->nvram = NULL; in qla2x00_mem_alloc()
4567 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4568 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4570 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4571 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4573 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4574 ha->gid_list, in qla2x00_mem_alloc()
4575 ha->gid_list_dma); in qla2x00_mem_alloc()
4576 ha->gid_list = NULL; in qla2x00_mem_alloc()
4577 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4581 btree_destroy32(&ha->host_map); in qla2x00_mem_alloc()
4583 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4584 ha->init_cb_dma); in qla2x00_mem_alloc()
4585 ha->init_cb = NULL; in qla2x00_mem_alloc()
4586 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4588 kfree(ha->vp_map); in qla2x00_mem_alloc()
4589 ha->vp_map = NULL; in qla2x00_mem_alloc()
4593 return -ENOMEM; in qla2x00_mem_alloc()
4602 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4615 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4623 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4625 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4632 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4635 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4636 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4637 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4638 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4640 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4645 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4664 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4665 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4666 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4667 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4668 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4676 struct init_cb_81xx *icb = (struct init_cb_81xx *)vha->hw->init_cb; in qla2x00_number_of_exch()
4679 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4680 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4683 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4684 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4686 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4687 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4690 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4691 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4692 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4695 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4696 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4698 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4700 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4701 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4703 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4717 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4719 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4728 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4739 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4742 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4743 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4747 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4755 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4758 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4759 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4760 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4761 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4764 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4766 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4767 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4769 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4771 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4772 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4775 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4777 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4779 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4782 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4783 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4786 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4797 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4798 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4801 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4803 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4818 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4819 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4820 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4821 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4822 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4836 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4839 if (ha->fce) in qla2x00_free_fw_dump()
4840 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4841 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4843 if (ha->eft) in qla2x00_free_fw_dump()
4844 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4845 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4847 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4849 ha->fce = NULL; in qla2x00_free_fw_dump()
4850 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4851 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4852 ha->eft = NULL; in qla2x00_free_fw_dump()
4853 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4854 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4855 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4856 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4857 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4858 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4861 vfree(fwdt->template); in qla2x00_free_fw_dump()
4862 fwdt->template = NULL; in qla2x00_free_fw_dump()
4863 fwdt->length = 0; in qla2x00_free_fw_dump()
4879 if (ha->mctp_dump) in qla2x00_mem_free()
4880 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4881 ha->mctp_dump_dma); in qla2x00_mem_free()
4882 ha->mctp_dump = NULL; in qla2x00_mem_free()
4884 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4885 ha->srb_mempool = NULL; in qla2x00_mem_free()
4887 if (ha->dcbx_tlv) in qla2x00_mem_free()
4888 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4889 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4890 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4892 if (ha->xgmac_data) in qla2x00_mem_free()
4893 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4894 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4895 ha->xgmac_data = NULL; in qla2x00_mem_free()
4897 if (ha->sns_cmd) in qla2x00_mem_free()
4898 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4899 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4900 ha->sns_cmd = NULL; in qla2x00_mem_free()
4901 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4903 if (ha->ct_sns) in qla2x00_mem_free()
4904 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4905 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4906 ha->ct_sns = NULL; in qla2x00_mem_free()
4907 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4909 if (ha->sfp_data) in qla2x00_mem_free()
4910 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4911 ha->sfp_data_dma); in qla2x00_mem_free()
4912 ha->sfp_data = NULL; in qla2x00_mem_free()
4914 if (ha->flt) in qla2x00_mem_free()
4915 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4917 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4918 ha->flt = NULL; in qla2x00_mem_free()
4919 ha->flt_dma = 0; in qla2x00_mem_free()
4921 if (ha->ms_iocb) in qla2x00_mem_free()
4922 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4923 ha->ms_iocb = NULL; in qla2x00_mem_free()
4924 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4926 if (ha->sf_init_cb) in qla2x00_mem_free()
4927 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4928 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4930 if (ha->ex_init_cb) in qla2x00_mem_free()
4931 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4932 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4933 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4934 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4936 if (ha->async_pd) in qla2x00_mem_free()
4937 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4938 ha->async_pd = NULL; in qla2x00_mem_free()
4939 ha->async_pd_dma = 0; in qla2x00_mem_free()
4941 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4942 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4944 if (ha->gid_list) in qla2x00_mem_free()
4945 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4946 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4947 ha->gid_list = NULL; in qla2x00_mem_free()
4948 ha->gid_list_dma = 0; in qla2x00_mem_free()
4950 if (ha->base_qpair && !list_empty(&ha->base_qpair->dsd_list)) { in qla2x00_mem_free()
4955 &ha->base_qpair->dsd_list, list) { in qla2x00_mem_free()
4956 dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, in qla2x00_mem_free()
4957 dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4958 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4963 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4964 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4966 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4967 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4969 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4970 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4972 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4975 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4977 list_del(&dsd->list); in qla2x00_mem_free()
4978 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4979 dsd->dsd_list_dma); in qla2x00_mem_free()
4980 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4982 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4983 ha->pool.unusable.count--; in qla2x00_mem_free()
4985 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
4986 list_del(&dsd->list); in qla2x00_mem_free()
4987 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4988 dsd->dsd_list_dma); in qla2x00_mem_free()
4989 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4991 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4995 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
4996 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
5001 if (ha->init_cb) in qla2x00_mem_free()
5002 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
5003 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
5005 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_free()
5006 ha->purex_dma_pool = NULL; in qla2x00_mem_free()
5008 if (ha->elsrej.c) { in qla2x00_mem_free()
5009 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_free()
5010 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_free()
5011 ha->elsrej.c = NULL; in qla2x00_mem_free()
5014 if (ha->lsrjt.c) { in qla2x00_mem_free()
5015 dma_free_coherent(&ha->pdev->dev, ha->lsrjt.size, ha->lsrjt.c, in qla2x00_mem_free()
5016 ha->lsrjt.cdma); in qla2x00_mem_free()
5017 ha->lsrjt.c = NULL; in qla2x00_mem_free()
5020 ha->init_cb = NULL; in qla2x00_mem_free()
5021 ha->init_cb_dma = 0; in qla2x00_mem_free()
5023 vfree(ha->optrom_buffer); in qla2x00_mem_free()
5024 ha->optrom_buffer = NULL; in qla2x00_mem_free()
5025 kfree(ha->nvram); in qla2x00_mem_free()
5026 ha->nvram = NULL; in qla2x00_mem_free()
5027 kfree(ha->npiv_info); in qla2x00_mem_free()
5028 ha->npiv_info = NULL; in qla2x00_mem_free()
5029 kfree(ha->swl); in qla2x00_mem_free()
5030 ha->swl = NULL; in qla2x00_mem_free()
5031 kfree(ha->loop_id_map); in qla2x00_mem_free()
5032 ha->sf_init_cb = NULL; in qla2x00_mem_free()
5033 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
5034 ha->loop_id_map = NULL; in qla2x00_mem_free()
5036 kfree(ha->vp_map); in qla2x00_mem_free()
5037 ha->vp_map = NULL; in qla2x00_mem_free()
5048 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
5057 vha->host = host; in qla2x00_create_host()
5058 vha->host_no = host->host_no; in qla2x00_create_host()
5059 vha->hw = ha; in qla2x00_create_host()
5061 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
5062 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
5063 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
5065 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
5066 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
5067 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
5068 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
5069 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
5070 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
5071 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
5072 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
5073 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
5075 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
5076 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
5078 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
5079 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
5080 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
5081 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
5086 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
5087 (ha->max_loop_id + 1); in qla2x00_create_host()
5088 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
5089 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
5090 if (!vha->gnl.l) { in qla2x00_create_host()
5093 scsi_host_put(vha->host); in qla2x00_create_host()
5098 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
5099 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
5100 if (!vha->scan.l) { in qla2x00_create_host()
5103 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
5104 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
5105 vha->gnl.l = NULL; in qla2x00_create_host()
5106 scsi_host_put(vha->host); in qla2x00_create_host()
5109 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
5111 snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", in qla2x00_create_host()
5112 QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
5115 vha->host, vha->hw, vha, in qla2x00_create_host()
5116 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
5126 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
5138 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
5139 e->type = type; in qla2x00_alloc_work()
5140 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
5150 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
5151 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
5153 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
5156 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
5159 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
5174 e->u.aen.code = code; in qla2x00_post_aen_work()
5175 e->u.aen.data = data; in qla2x00_post_aen_work()
5188 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
5203 e->u.logio.fcport = fcport; \
5205 e->u.logio.data[0] = data[0]; \
5206 e->u.logio.data[1] = data[1]; \
5208 fcport->flags |= FCF_ASYNC_ACTIVE; \
5227 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5240 vha->host_no); in qla2x00_uevent_emit()
5246 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5259 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5260 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5261 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5269 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5272 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5273 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5274 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5277 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5278 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5279 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5281 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5283 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5292 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5297 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5299 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5300 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5302 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5304 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5305 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5306 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5312 pla->ref_count--; in qla24xx_create_new_sess()
5315 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5318 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5319 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5320 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5321 fcport->tgt_short_link_down_cnt = 0; in qla24xx_create_new_sess()
5323 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5326 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5327 if (NVME_PRIORITY(vha->hw, fcport)) in qla24xx_create_new_sess()
5328 fcport->do_prli_nvme = 1; in qla24xx_create_new_sess()
5330 fcport->do_prli_nvme = 0; in qla24xx_create_new_sess()
5332 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5333 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5335 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5336 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5337 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5338 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5344 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5347 list_del(&pla->list); in qla24xx_create_new_sess()
5353 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5356 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5361 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5362 tfcp->fw_login_state); in qla24xx_create_new_sess()
5366 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5372 pla->ref_count--; in qla24xx_create_new_sess()
5375 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5378 fcport->id_changed = 1; in qla24xx_create_new_sess()
5379 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5380 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5381 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5384 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5387 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5388 fcport->local = 0; in qla24xx_create_new_sess()
5389 fcport->loop_id = in qla24xx_create_new_sess()
5391 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5392 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5395 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5398 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5401 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5403 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5409 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5411 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5418 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5419 tfcp->fw_login_state); in qla24xx_create_new_sess()
5421 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5425 fcport->login_pause = 1; in qla24xx_create_new_sess()
5426 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5429 fcport->login_pause = 1; in qla24xx_create_new_sess()
5430 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5435 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5439 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5440 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5441 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5442 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5443 fcport->fc4_type = in qla24xx_create_new_sess()
5445 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5447 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5449 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5459 list_del(&pla->list); in qla24xx_create_new_sess()
5467 struct srb *sp = e->u.iosb.sp; in qla_sp_retry() local
5470 rval = qla2x00_start_sp(sp); in qla_sp_retry()
5473 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5474 __func__, sp->name, rval); in qla_sp_retry()
5475 qla24xx_sp_unmap(vha, sp); in qla_sp_retry()
5487 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5488 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5489 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5493 switch (e->type) { in qla2x00_do_work()
5495 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5496 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5499 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5502 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5503 e->u.logio.data); in qla2x00_do_work()
5506 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5509 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5510 e->u.logio.data); in qla2x00_do_work()
5513 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5519 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5528 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5529 e->u.fcport.opt); in qla2x00_do_work()
5532 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5535 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5538 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5544 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5547 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5548 e->u.logio.data); in qla2x00_do_work()
5551 qla_fab_async_scan(vha, e->u.iosb.sp); in qla2x00_do_work()
5554 qla_fab_scan_finish(vha, e->u.iosb.sp); in qla2x00_do_work()
5557 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5563 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5567 e->u.fcport.fcport); in qla2x00_do_work()
5575 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5576 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5577 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5578 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5581 list_del_init(&e->list); in qla2x00_do_work()
5582 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5597 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5613 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5618 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5619 fcport->login_retry) { in qla2x00_relogin()
5620 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5621 fcport->disc_state == DSC_LOGIN_AUTH_PEND || in qla2x00_relogin()
5622 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5625 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5626 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5629 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5633 } else if (vha->hw->current_topology == in qla2x00_relogin()
5635 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5638 } else if (vha->hw->current_topology == in qla2x00_relogin()
5640 fcport->login_retry--; in qla2x00_relogin()
5645 fcport->old_loop_id = in qla2x00_relogin()
5646 fcport->loop_id; in qla2x00_relogin()
5649 fcport->loop_id); in qla2x00_relogin()
5654 &vha->dpc_flags); in qla2x00_relogin()
5658 fcport->login_retry, in qla2x00_relogin()
5659 fcport->loop_id); in qla2x00_relogin()
5661 fcport->login_retry = 0; in qla2x00_relogin()
5664 if (fcport->login_retry == 0 && in qla2x00_relogin()
5670 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5675 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5681 /* Schedule work on any of the dpc-workqueues */
5685 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5689 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5690 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5694 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5695 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5696 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5703 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5704 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5707 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5708 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5712 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5724 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5730 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5731 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5746 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5792 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5802 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5815 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5821 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5831 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5867 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5879 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5892 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5905 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5910 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5965 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5969 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5974 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5976 ha->portnum); in qla83xx_idc_lock()
5984 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
6004 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
6007 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
6019 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
6022 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
6023 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
6033 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
6058 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
6060 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
6077 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
6089 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6097 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6105 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6108 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6112 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
6113 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
6114 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
6115 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
6116 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
6117 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
6118 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
6119 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
6120 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
6121 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
6122 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
6123 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
6125 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
6126 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
6127 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
6129 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
6130 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
6131 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
6133 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
6134 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
6136 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
6137 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
6140 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
6141 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
6142 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
6145 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6146 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
6147 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
6148 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
6149 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6152 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6153 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
6154 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
6155 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
6156 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6159 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
6160 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6161 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
6168 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
6186 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
6193 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
6194 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
6195 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
6196 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
6197 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
6202 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
6203 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
6204 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
6205 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
6207 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
6211 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
6212 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
6213 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
6218 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
6219 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
6220 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
6221 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
6222 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6223 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6224 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6225 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6226 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6227 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6228 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6229 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6230 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6235 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6236 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6237 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6238 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6239 vha->node_name, in qla24xx_process_purex_rdp()
6240 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6241 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6242 vha->port_name, in qla24xx_process_purex_rdp()
6243 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6245 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6246 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6247 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6248 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6249 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6250 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6251 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6252 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6253 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6254 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6257 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6258 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6259 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6260 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6261 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6262 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6264 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6266 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6267 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6274 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6275 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6276 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6278 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6279 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6280 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6282 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6283 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6284 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6286 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6287 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6288 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6290 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6291 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6292 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6301 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6302 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6303 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6304 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6305 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6309 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6310 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6311 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6312 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6313 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6317 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6318 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6319 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6320 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6321 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6325 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6326 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6327 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6328 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6329 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6333 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6334 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6335 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6336 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6337 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6345 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6353 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6361 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6369 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6377 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6387 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6388 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6389 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6395 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6397 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6398 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6400 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6401 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6403 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6404 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6406 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6412 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6414 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6422 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6426 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6434 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6435 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6437 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6438 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6439 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6446 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6449 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6452 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6455 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6462 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6463 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6474 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6475 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6476 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6479 list_del(&item->list); in qla24xx_process_purex_list()
6480 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6496 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6500 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6507 if (data == ha->portnum) { in qla83xx_idc_unlock()
6509 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6514 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6522 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6526 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6533 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6538 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6555 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6560 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6584 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6589 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6612 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6616 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6617 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6645 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6657 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6685 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6690 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6691 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6710 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6713 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6716 ha->portnum); in qla83xx_idc_state_handler()
6719 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6722 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6729 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6735 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6738 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6745 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6755 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6762 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6765 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6768 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6800 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6801 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6806 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6808 "PCI device disabled, no action req for PCI error=%lx\n", in qla2x00_disable_board_on_pci_error()
6809 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6817 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6830 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6833 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6843 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6845 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6847 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6857 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6872 * is kick-off by the driver's detect code and starts up
6887 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6901 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6904 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6907 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6909 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6913 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6917 ha->dpc_active = 1; in qla2x00_do_dpc()
6921 base_vha->dpc_flags); in qla2x00_do_dpc()
6926 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6940 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6953 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6958 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6960 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6961 * Escalate to chip-reset in qla2x00_do_dpc()
6964 &base_vha->dpc_flags); in qla2x00_do_dpc()
6967 &base_vha->dpc_flags); in qla2x00_do_dpc()
6975 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6981 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6983 &base_vha->dpc_flags); in qla2x00_do_dpc()
6992 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6997 &base_vha->dpc_flags)) in qla2x00_do_dpc()
6999 &base_vha->dpc_flags); in qla2x00_do_dpc()
7007 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7011 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
7017 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7019 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
7021 * when a forced chip-reset occurs. in qla2x00_do_dpc()
7022 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
7024 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
7028 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7029 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7032 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
7037 !ha->flags.fw_started) in qla2x00_do_dpc()
7042 !ha->flags.fw_started) in qla2x00_do_dpc()
7050 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7051 base_vha->flags.online = 1; in qla2x00_do_dpc()
7054 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
7057 &base_vha->dpc_flags); in qla2x00_do_dpc()
7060 &base_vha->dpc_flags); in qla2x00_do_dpc()
7066 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7067 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7069 (&base_vha->purex_list); in qla2x00_do_dpc()
7071 &base_vha->dpc_flags); in qla2x00_do_dpc()
7078 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7087 &base_vha->dpc_flags); in qla2x00_do_dpc()
7088 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
7104 &base_vha->dpc_flags); in qla2x00_do_dpc()
7112 &base_vha->dpc_flags) && in qla2x00_do_dpc()
7113 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
7118 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
7124 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7125 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7126 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
7128 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
7129 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
7130 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
7131 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7141 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7149 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7154 &base_vha->dpc_flags); in qla2x00_do_dpc()
7164 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7165 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7166 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7171 if (!ha->interrupts_on) in qla2x00_do_dpc()
7172 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
7175 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7176 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
7177 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
7182 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7183 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
7184 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
7189 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
7190 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
7192 qpair->online = online; in qla2x00_do_dpc()
7193 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
7197 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7198 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
7200 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
7201 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
7217 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7221 ha->dpc_active = 0; in qla2x00_do_dpc()
7233 ha->dpc_active = 0; in qla2x00_do_dpc()
7241 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7242 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7244 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7258 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7259 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7260 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7262 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7268 vha->marker_needed = 1; in qla2x00_rst_aen()
7269 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7270 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7276 struct qla_hw_data *ha = vha->hw; in qla_do_heartbeat()
7285 cmpl_cnt = ha->base_qpair->cmd_completion_cnt; in qla_do_heartbeat()
7286 if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && in qla_do_heartbeat()
7287 cmpl_cnt != ha->base_qpair->cmd_cnt) { in qla_do_heartbeat()
7291 ha->base_qpair->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7293 for (i = 0; i < ha->max_qpairs; i++) { in qla_do_heartbeat()
7294 if (ha->queue_pair_map[i]) { in qla_do_heartbeat()
7295 cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; in qla_do_heartbeat()
7296 if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && in qla_do_heartbeat()
7297 cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { in qla_do_heartbeat()
7301 ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7311 struct qla_hw_data *ha = vha->hw; in qla_heart_beat()
7313 if (vha->vp_idx) in qla_heart_beat()
7316 if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) in qla_heart_beat()
7325 time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) in qla_heart_beat()
7329 ha->last_heartbeat_run_jiffies = jiffies; in qla_heart_beat()
7330 queue_work(ha->wq, &ha->heartbeat_work); in qla_heart_beat()
7336 struct qla_hw_data *ha = vha->hw; in qla_wind_down_chip()
7338 if (!ha->flags.eeh_busy) in qla_wind_down_chip()
7340 if (ha->pci_error_state) in qla_wind_down_chip()
7348 if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handling * HZ) && in qla_wind_down_chip()
7349 !ha->flags.eeh_flush) { in qla_wind_down_chip()
7353 ha->isp_ops->reset_chip(vha); in qla_wind_down_chip()
7354 ha->isp_ops->disable_intrs(ha); in qla_wind_down_chip()
7356 ha->flags.eeh_flush = EEH_FLUSH_RDY; in qla_wind_down_chip()
7357 ha->eeh_jif = jiffies; in qla_wind_down_chip()
7359 } else if (ha->flags.eeh_flush == EEH_FLUSH_RDY && in qla_wind_down_chip()
7360 time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { in qla_wind_down_chip()
7361 pci_clear_master(ha->pdev); in qla_wind_down_chip()
7365 ha->flags.eeh_flush = EEH_FLUSH_DONE; in qla_wind_down_chip()
7387 srb_t *sp; in qla2x00_timer() local
7389 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7394 if (ha->flags.eeh_busy) { in qla2x00_timer()
7399 ha->flags.eeh_busy); in qla2x00_timer()
7406 * the read returns -1 then disable the board. in qla2x00_timer()
7408 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7409 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7414 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7415 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7423 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7426 if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7427 vha->link_down_time++; in qla2x00_timer()
7429 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7430 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_timer()
7431 if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7432 fcport->tgt_link_down_time++; in qla2x00_timer()
7434 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7437 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7438 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7439 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7440 && vha->flags.online) { in qla2x00_timer()
7442 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7443 vha->loop_down_abort_time) { in qla2x00_timer()
7446 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7448 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7449 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7452 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7455 /* NPIV - scan physical port only */ in qla2x00_timer()
7456 if (!vha->vp_idx) { in qla2x00_timer()
7457 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7459 req = ha->req_q_map[0]; in qla2x00_timer()
7461 index < req->num_outstanding_cmds; in qla2x00_timer()
7465 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7466 if (!sp) in qla2x00_timer()
7468 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7470 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7472 sfcp = sp->fcport; in qla2x00_timer()
7473 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7478 &vha->dpc_flags); in qla2x00_timer()
7481 &vha->dpc_flags); in qla2x00_timer()
7484 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7491 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7492 if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { in qla2x00_timer()
7494 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7498 &vha->dpc_flags); in qla2x00_timer()
7501 &vha->dpc_flags); in qla2x00_timer()
7505 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7506 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7509 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7512 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7518 if (vha->hw->flags.edif_enabled) in qla2x00_timer()
7522 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7526 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7527 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7529 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7531 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7535 * FC-NVME in qla2x00_timer()
7538 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7539 if (!vha->vp_idx && in qla2x00_timer()
7540 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7541 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7542 !ha->flags.host_shutting_down) { in qla2x00_timer()
7543 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7546 ha->nvme_last_rptd_aen); in qla2x00_timer()
7547 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7551 if (!vha->vp_idx && in qla2x00_timer()
7552 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7556 ha->last_zio_threshold); in qla2x00_timer()
7557 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7558 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7566 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7567 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7569 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7570 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7571 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7572 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7573 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7574 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7575 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7579 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7580 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7581 start_dpc, test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7586 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7587 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7588 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7589 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7590 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7591 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7651 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7682 if (!blob->name) in qla2x00_request_firmware()
7686 if (blob->fw) in qla2x00_request_firmware()
7689 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7691 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7692 blob->fw = NULL; in qla2x00_request_firmware()
7707 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7708 release_firmware(blob->fw); in qla2x00_release_firmware()
7714 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7715 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7724 ha->chip_reset++; in qla_pci_error_cleanup()
7726 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7727 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7728 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7729 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7730 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7738 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7739 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7740 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7741 qpair->online = 0; in qla_pci_error_cleanup()
7743 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7747 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7748 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7749 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7750 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7752 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7753 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7755 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7758 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7759 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7761 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7762 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7763 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7764 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7765 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7766 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7767 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7768 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7770 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7778 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7783 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7785 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7787 "PCI device is disabled,state %x\n", state); in qla2xxx_pci_error_detected()
7796 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7806 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7809 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7827 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7828 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7829 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7834 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7845 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7847 stat = rd_reg_word(&reg->hccr); in qla2xxx_pci_mmio_enabled()
7851 stat = rd_reg_dword(&reg->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7855 stat = rd_reg_dword(&reg24->host_status); in qla2xxx_pci_mmio_enabled()
7859 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7863 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7878 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7885 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7890 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7899 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7906 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7911 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7914 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7915 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7916 qpair->online = 1; in qla2xxx_pci_slot_reset()
7917 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7919 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7920 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7921 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7922 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7923 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7926 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7945 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7957 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7964 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7965 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7969 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7972 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7973 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7974 ha->eeh_jif = jiffies; in qla_pci_set_eeh_busy()
7975 ha->flags.eeh_flush = 0; in qla_pci_set_eeh_busy()
7977 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7980 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7992 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
7993 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
7995 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
7998 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
8006 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
8018 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
8019 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
8020 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
8021 qpair->online = 0; in qla_pci_reset_prepare()
8022 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
8024 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
8033 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
8042 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
8043 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
8044 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
8045 qpair->online = 1; in qla_pci_reset_done()
8046 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
8048 base_vha->flags.online = 1; in qla_pci_reset_done()
8049 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
8050 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
8055 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
8056 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
8058 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
8061 blk_mq_map_hw_queues(qmap, &vha->hw->pdev->dev, in qla2xxx_map_queues()
8062 vha->irq_offset); in qla2xxx_map_queues()
8086 .this_id = -1,
8154 * qla2x00_module_init - Module initialization.
8254 return -ENOMEM; in qla2x00_module_init()
8263 * If initiator mode is explictly disabled by qlt_init(), in qla2x00_module_init()
8274 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
8283 ret = -ENODEV; in qla2x00_module_init()
8298 ret = -ENODEV; in qla2x00_module_init()
8332 * qla2x00_module_exit - Module cleanup.