Lines Matching +full:mctp +full:- +full:controller

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
16 #include <linux/blk-mq-pci.h>
66 "Enable/disable security. 0(Default) - Security disabled. 1 - Security enabled.");
72 "beginning. Default is 0 - class 2 not supported.");
84 "a PORT-DOWN status.");
91 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
103 "vary by ISP type. Default is 1 - allocate memory.");
110 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
111 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
112 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
113 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
114 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
115 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
116 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
117 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
118 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
119 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
120 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
121 "\t\t0x1e400000 - Preferred value for capturing essential "
142 "0 - no FDMI registrations. "
143 "1 - provide FDMI registrations (default).");
155 " Enable T10-CRC-DIF:\n"
157 " 0 -- No DIF Support\n"
158 " 1 -- Enable DIF for all types\n"
159 " 2 -- Enable DIF for all types, except Type 0.\n");
169 "0 - no NVMe. Default is Y");
174 " Enable T10-CRC-DIF Error isolation by HBA:\n"
176 " 0 -- Error isolation disabled\n"
177 " 1 -- Error isolation enabled only for DIX Type 0\n"
178 " 2 -- Error isolation enabled for all Types\n");
184 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
198 " 2 -- load firmware via the request_firmware() (hotplug).\n"
200 " 1 -- load firmware from flash.\n"
201 " 0 -- use default semantics.\n");
207 "Default is 0 - skip ETS enablement.");
213 " 0 -- Regular doorbell.\n"
214 " 1 -- CAMRAM doorbell (faster).\n");
220 "Default is 0 - Do not use GFF_ID information.");
226 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
232 " 0 (Default) -- Reset on failure.\n"
233 " 1 -- Do not reset on failure.\n");
245 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
251 "0 - MiniDump disabled. "
252 "1 (Default) - MiniDump enabled.");
258 "0 (Default)- Disabled.");
275 "1 - Set fw option to hold ABTS.");
282 "1 - Move IOCBs.");
293 "Set to enable MSI or MSI-X interrupt mechanism.\n"
294 " Default is 1, enable MSI-X interrupt mechanism.\n"
295 " 0 -- enable traditional pin-based mechanism.\n"
296 " 1 -- enable MSI-X interrupt mechanism.\n"
297 " 2 -- enable MSI interrupt mechanism.\n");
315 " 0 -- Let HBA firmware decide\n"
316 " 1 -- Force T10 CRC\n"
317 " 2 -- Force IP checksum\n");
331 " Default is 0 - No SmartSAN registration,"
332 " 1 - Register SmartSAN Management Attributes.");
339 "0 - no RDP responses (default). "
340 "1 - provide RDP responses.");
350 "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n");
362 "1 - Minimum number of queues supported\n"
363 "8 - Default value");
369 "0 - FC2 Target support is disabled. "
370 "1 - FC2 Target support is enabled (default).");
383 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
384 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
385 add_timer(&vha->timer); in qla2x00_start_timer()
386 vha->timer_active = 1; in qla2x00_start_timer()
393 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
399 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
405 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
406 vha->timer_active = 0; in qla2x00_stop_timer()
420 /* -------------------------------------------------------------------------- */
424 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
426 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
427 rsp->req = req; in qla_init_base_qpair()
428 ha->base_qpair->hw = ha; in qla_init_base_qpair()
429 ha->base_qpair->req = req; in qla_init_base_qpair()
430 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
431 ha->base_qpair->vha = vha; in qla_init_base_qpair()
432 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
433 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
434 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
435 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
436 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
437 INIT_LIST_HEAD(&ha->base_qpair->dsd_list); in qla_init_base_qpair()
438 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
440 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
441 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
444 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
450 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
452 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
454 if (!ha->req_q_map) { in qla2x00_alloc_queues()
460 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
462 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
468 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
469 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
477 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
478 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
480 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
486 kfree(ha->queue_pair_map); in qla2x00_alloc_queues()
487 ha->queue_pair_map = NULL; in qla2x00_alloc_queues()
496 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
497 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
498 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
499 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
503 kfree(ha->base_qpair); in qla2x00_alloc_queues()
504 ha->base_qpair = NULL; in qla2x00_alloc_queues()
506 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
507 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
509 kfree(ha->req_q_map); in qla2x00_alloc_queues()
510 ha->req_q_map = NULL; in qla2x00_alloc_queues()
512 return -ENOMEM; in qla2x00_alloc_queues()
518 if (req && req->ring_fx00) in qla2x00_free_req_que()
519 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
520 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
521 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
522 } else if (req && req->ring) in qla2x00_free_req_que()
523 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
524 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
525 req->ring, req->dma); in qla2x00_free_req_que()
528 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
536 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
537 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
538 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
539 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
540 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
541 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
542 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
543 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
555 if (ha->queue_pair_map) { in qla2x00_free_queues()
556 kfree(ha->queue_pair_map); in qla2x00_free_queues()
557 ha->queue_pair_map = NULL; in qla2x00_free_queues()
559 if (ha->base_qpair) { in qla2x00_free_queues()
560 kfree(ha->base_qpair); in qla2x00_free_queues()
561 ha->base_qpair = NULL; in qla2x00_free_queues()
565 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
566 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
567 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
570 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
571 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
572 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
574 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
576 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
578 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
580 kfree(ha->req_q_map); in qla2x00_free_queues()
581 ha->req_q_map = NULL; in qla2x00_free_queues()
584 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
585 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
586 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
589 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
590 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
591 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
592 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
594 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
596 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
598 kfree(ha->rsp_q_map); in qla2x00_free_queues()
599 ha->rsp_q_map = NULL; in qla2x00_free_queues()
605 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
611 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
613 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
616 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
629 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
632 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
636 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
662 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
667 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
678 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
680 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
681 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
683 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
688 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
702 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
706 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
715 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
717 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
718 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
724 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
727 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
729 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
732 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
733 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
734 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
735 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
738 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
740 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
741 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
744 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
745 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
747 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
748 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
751 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
752 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
754 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
755 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
756 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2x00_sp_free_dma()
757 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
758 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
761 if (sp->flags & SRB_GOT_BUF) in qla2x00_sp_free_dma()
762 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2x00_sp_free_dma()
768 struct completion *comp = sp->comp; in qla2x00_sp_compl()
771 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_compl()
772 cmd->result = res; in qla2x00_sp_compl()
773 sp->type = 0; in qla2x00_sp_compl()
782 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
784 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
786 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
789 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
790 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
791 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
792 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
795 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
797 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
798 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
801 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
802 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
806 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
807 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
808 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
809 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
811 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
815 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
816 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
817 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
818 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
820 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
823 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
824 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
825 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
826 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
829 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
830 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
831 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
832 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
834 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
837 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
838 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
840 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
841 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
842 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2xxx_qpair_sp_free_dma()
843 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
844 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
845 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
848 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
849 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
851 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
852 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
855 if (sp->flags & SRB_GOT_BUF) in qla2xxx_qpair_sp_free_dma()
856 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2xxx_qpair_sp_free_dma()
862 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
865 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_qpair_sp_compl()
866 cmd->result = res; in qla2xxx_qpair_sp_compl()
867 sp->type = 0; in qla2xxx_qpair_sp_compl()
877 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
878 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
879 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
880 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
884 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
886 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
890 if (ha->mqenable) { in qla2xxx_queuecommand()
897 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
903 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
904 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
908 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
912 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
919 cmd->result = rval; in qla2xxx_queuecommand()
926 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
931 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
935 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
936 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
940 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
941 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
942 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
945 atomic_read(&fcport->state), in qla2xxx_queuecommand()
946 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
947 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
954 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
957 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
959 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
960 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
966 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
968 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
969 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
970 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
971 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
973 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
984 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_queuecommand()
1001 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
1002 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
1003 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
1004 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
1010 cmd->result = rval; in qla2xxx_mqueuecommand()
1017 if (!qpair->online) { in qla2xxx_mqueuecommand()
1019 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
1020 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1024 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
1025 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
1029 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
1030 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
1031 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
1034 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
1035 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
1036 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1043 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
1046 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
1048 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
1049 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1057 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1058 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1059 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1060 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1062 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1073 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_mqueuecommand()
1091 * ha - pointer to host adapter structure
1094 * Does context switching-Release SPIN_LOCK
1106 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1107 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1110 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1111 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1112 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1113 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1117 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1127 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1132 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1135 vha, vha->fcport_count); in test_fcport_count()
1136 res = (vha->fcport_count == 0); in test_fcport_count()
1140 list_for_each_entry(fcport, &vha->vp_fcports, list) { in test_fcport_count()
1141 if (fcport->deleted != QLA_SESS_DELETED) { in test_fcport_count()
1152 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1169 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1174 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1182 * ha - pointer to host adapter structure
1185 * Does context switching-Release SPIN_LOCK
1192 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1193 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1195 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1196 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1197 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1198 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1199 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1210 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1211 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1214 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1215 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1216 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1217 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1221 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1222 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1225 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1251 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1258 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1277 qpair = sp->qpair; in qla2xxx_eh_abort()
1279 vha->cmd_timeout_cnt++; in qla2xxx_eh_abort()
1281 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1284 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1285 sp->comp = &comp; in qla2xxx_eh_abort()
1286 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1289 id = cmd->device->id; in qla2xxx_eh_abort()
1290 lun = cmd->device->lun; in qla2xxx_eh_abort()
1294 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1301 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1307 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1314 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1325 sp->comp = NULL; in qla2xxx_eh_abort()
1328 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1329 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1346 scsi_qla_host_t *vha = qpair->vha; in __qla2x00_eh_wait_for_pending_commands()
1347 struct req_que *req = qpair->req; in __qla2x00_eh_wait_for_pending_commands()
1352 struct qla_hw_data *ha = vha->hw; in __qla2x00_eh_wait_for_pending_commands()
1356 while (wait_iter--) { in __qla2x00_eh_wait_for_pending_commands()
1359 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1360 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_eh_wait_for_pending_commands()
1361 sp = req->outstanding_cmds[cnt]; in __qla2x00_eh_wait_for_pending_commands()
1364 if (sp->type != SRB_SCSI_CMD) in __qla2x00_eh_wait_for_pending_commands()
1366 if (vha->vp_idx != sp->vha->vp_idx) in __qla2x00_eh_wait_for_pending_commands()
1375 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1376 match = sp->fcport->d_id.b24 == t; in __qla2x00_eh_wait_for_pending_commands()
1381 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1382 match = (sp->fcport->d_id.b24 == t && in __qla2x00_eh_wait_for_pending_commands()
1383 cmd->device->lun == l); in __qla2x00_eh_wait_for_pending_commands()
1391 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1393 if (unlikely(pci_channel_offline(ha->pdev)) || in __qla2x00_eh_wait_for_pending_commands()
1394 ha->flags.eeh_busy) { in __qla2x00_eh_wait_for_pending_commands()
1406 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1409 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1415 if (wait_iter == -1) in __qla2x00_eh_wait_for_pending_commands()
1426 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1429 status = __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, in qla2x00_eh_wait_for_pending_commands()
1431 for (i = 0; status == QLA_SUCCESS && i < ha->max_qpairs; i++) { in qla2x00_eh_wait_for_pending_commands()
1432 qpair = ha->queue_pair_map[i]; in qla2x00_eh_wait_for_pending_commands()
1451 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_device_reset()
1452 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_eh_device_reset()
1454 fc_port_t *fcport = (struct fc_port *) sdev->hostdata; in qla2xxx_eh_device_reset()
1455 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1473 if (fcport->deleted) in qla2xxx_eh_device_reset()
1477 "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, in qla2xxx_eh_device_reset()
1478 sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1487 if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) in qla2xxx_eh_device_reset()
1494 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, in qla2xxx_eh_device_reset()
1495 cmd->device->lun, in qla2xxx_eh_device_reset()
1504 vha->host_no, sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1511 reset_errors[err], vha->host_no, sdev->id, sdev->lun, in qla2xxx_eh_device_reset()
1513 vha->reset_cmd_err_cnt++; in qla2xxx_eh_device_reset()
1520 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_target_reset()
1523 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1524 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_eh_target_reset()
1542 if (fcport->deleted) in qla2xxx_eh_target_reset()
1546 "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no, in qla2xxx_eh_target_reset()
1547 sdev->id, cmd); in qla2xxx_eh_target_reset()
1556 if (ha->isp_ops->target_reset(fcport, 0, 0) != QLA_SUCCESS) { in qla2xxx_eh_target_reset()
1562 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, 0, in qla2xxx_eh_target_reset()
1571 vha->host_no, sdev->id, cmd); in qla2xxx_eh_target_reset()
1578 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in qla2xxx_eh_target_reset()
1580 vha->reset_cmd_err_cnt++; in qla2xxx_eh_target_reset()
1602 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1606 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1615 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1616 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1622 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1647 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1670 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1671 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1675 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1684 id = cmd->device->id; in qla2xxx_eh_host_reset()
1685 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1688 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1694 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1701 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1709 if (ha->wq) in qla2xxx_eh_host_reset()
1710 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1712 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1713 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1714 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1716 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1724 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1735 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1754 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1759 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1760 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1761 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1770 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1778 vha->marker_needed = 1; in qla2x00_loop_reset()
1789 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1790 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1793 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1794 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1800 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1803 sp->done(sp, res); in qla2x00_abort_srb()
1807 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1808 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1809 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1811 if (sp->comp) { in qla2x00_abort_srb()
1812 sp->done(sp, res); in qla2x00_abort_srb()
1816 sp->comp = &comp; in qla2x00_abort_srb()
1817 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1819 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1822 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1829 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1839 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1840 switch (sp->type) { in qla2x00_abort_srb()
1843 sp->done(sp, res); in qla2x00_abort_srb()
1847 sp->done(sp, res); in qla2x00_abort_srb()
1851 sp->done(sp, res); in qla2x00_abort_srb()
1865 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1866 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1868 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1871 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1873 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1874 req = qp->req; in __qla2x00_abort_all_cmds()
1875 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1876 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1882 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1883 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1884 sp->done(sp, res); in __qla2x00_abort_all_cmds()
1885 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1889 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1894 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1897 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1898 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1902 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1910 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1913 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1924 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1927 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1929 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1931 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1933 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1934 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1937 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1947 return -ENXIO; in qla2xxx_slave_alloc()
1949 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_slave_alloc()
1957 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_slave_configure()
1958 struct req_que *req = vha->req; in qla2xxx_slave_configure()
1960 if (IS_T10_PI_CAPABLE(vha->hw)) in qla2xxx_slave_configure()
1961 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); in qla2xxx_slave_configure()
1963 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_slave_configure()
1970 sdev->hostdata = NULL; in qla2xxx_slave_destroy()
1974 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1984 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1986 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1987 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1988 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1989 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1991 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1992 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1993 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1998 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1999 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
2006 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
2008 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2009 ha->interrupts_on = 1; in qla2x00_enable_intrs()
2011 wrt_reg_word(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
2012 rd_reg_word(&reg->ictrl); in qla2x00_enable_intrs()
2013 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2021 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
2023 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2024 ha->interrupts_on = 0; in qla2x00_disable_intrs()
2026 wrt_reg_word(&reg->ictrl, 0); in qla2x00_disable_intrs()
2027 rd_reg_word(&reg->ictrl); in qla2x00_disable_intrs()
2028 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2035 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
2037 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2038 ha->interrupts_on = 1; in qla24xx_enable_intrs()
2039 wrt_reg_dword(&reg->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
2040 rd_reg_dword(&reg->ictrl); in qla24xx_enable_intrs()
2041 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2048 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
2052 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2053 ha->interrupts_on = 0; in qla24xx_disable_intrs()
2054 wrt_reg_dword(&reg->ictrl, 0); in qla24xx_disable_intrs()
2055 rd_reg_dword(&reg->ictrl); in qla24xx_disable_intrs()
2056 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2065 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
2067 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
2069 pci_name(ha->pdev)); in qla2x00_iospace_config()
2072 if (!(ha->bars & 1)) in qla2x00_iospace_config()
2076 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
2077 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
2078 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2079 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
2081 pci_name(ha->pdev)); in qla2x00_iospace_config()
2085 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
2087 pci_name(ha->pdev)); in qla2x00_iospace_config()
2090 ha->pio_address = pio; in qla2x00_iospace_config()
2091 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
2093 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2097 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2098 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2100 pci_name(ha->pdev)); in qla2x00_iospace_config()
2103 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2104 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2106 pci_name(ha->pdev)); in qla2x00_iospace_config()
2110 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2111 if (!ha->iobase) { in qla2x00_iospace_config()
2112 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2114 pci_name(ha->pdev)); in qla2x00_iospace_config()
2119 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2120 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2123 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2130 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2131 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2132 if (ha->mqiobase) { in qla2x00_iospace_config()
2133 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2134 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2136 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2137 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2140 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2141 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2143 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2144 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2145 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2147 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2148 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2150 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2154 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2155 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2159 return (-ENOMEM); in qla2x00_iospace_config()
2168 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2170 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2172 pci_name(ha->pdev)); in qla83xx_iospace_config()
2178 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2179 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2181 pci_name(ha->pdev)); in qla83xx_iospace_config()
2184 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2185 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2187 pci_name(ha->pdev)); in qla83xx_iospace_config()
2191 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2192 if (!ha->iobase) { in qla83xx_iospace_config()
2193 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2195 pci_name(ha->pdev)); in qla83xx_iospace_config()
2199 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2201 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2202 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2203 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2204 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2205 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2207 if (!ha->mqiobase) { in qla83xx_iospace_config()
2208 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2213 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2214 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2215 if (ha->msixbase) { in qla83xx_iospace_config()
2217 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2219 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2226 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2230 ha->max_req_queues--; in qla83xx_iospace_config()
2232 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2236 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2237 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2238 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2240 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2241 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2243 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2247 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2248 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2252 return -ENOMEM; in qla83xx_iospace_config()
2649 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2650 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2652 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2653 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2654 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2657 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2658 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2659 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2662 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2663 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2664 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2667 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2668 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2669 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2672 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2673 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2674 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2675 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2676 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2677 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2680 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2681 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2684 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2685 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2688 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2689 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2690 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2691 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2692 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2695 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2696 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2697 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2698 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2699 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2702 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2703 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2704 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2705 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2706 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2709 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2710 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2711 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2714 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2715 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2716 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2719 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2720 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2721 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2722 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2723 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2726 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2727 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2728 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2729 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2730 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2733 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2734 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2735 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2736 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2741 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2742 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2743 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2744 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2749 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2750 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2751 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2752 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2753 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2754 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2757 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2758 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2759 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2760 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2761 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2762 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2765 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2768 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2769 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2770 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2771 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2772 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2773 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2776 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2777 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2778 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2779 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2780 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2781 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2784 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2785 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2786 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2787 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2788 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2789 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2793 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2794 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2795 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2796 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2797 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2798 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2802 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2803 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2804 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2805 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2806 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2807 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2812 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2815 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2818 ha->port_no--; in qla2x00_set_isp_flags()
2820 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2823 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2825 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2833 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2836 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2837 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2838 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2839 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2847 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2849 if (!vha->host) in qla2xxx_scan_finished()
2851 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2854 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2861 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_heartbeat_work_fn()
2863 if (!ha->flags.mbox_busy && base_vha->flags.init_done) in qla_heartbeat_work_fn()
2871 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2872 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2876 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2879 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2881 i--; in qla2x00_iocb_work_fn()
2884 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2885 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2886 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2916 int ret = -ENODEV; in qla2x00_probe_one()
2931 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2932 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2933 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2934 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2935 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2936 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2937 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2938 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2939 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2940 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2941 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2942 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2943 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2944 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2945 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2946 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2947 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2948 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2949 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2979 ha->pdev = pdev; in qla2x00_probe_one()
2980 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2981 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2982 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2983 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2985 spin_lock_init(&ha->sadb_lock); in qla2x00_probe_one()
2986 INIT_LIST_HEAD(&ha->sadb_tx_index_list); in qla2x00_probe_one()
2987 INIT_LIST_HEAD(&ha->sadb_rx_index_list); in qla2x00_probe_one()
2989 spin_lock_init(&ha->sadb_fp_lock); in qla2x00_probe_one()
2996 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2999 ha->bars = bars; in qla2x00_probe_one()
3000 ha->mem_only = mem_only; in qla2x00_probe_one()
3001 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
3002 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
3003 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
3004 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
3006 /* Set ISP-type information. */ in qla2x00_probe_one()
3012 pdev->needs_freset = 1; in qla2x00_probe_one()
3014 ha->prev_topology = 0; in qla2x00_probe_one()
3015 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
3016 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
3017 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
3018 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
3019 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
3020 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
3021 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
3022 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
3023 INIT_LIST_HEAD(&ha->tmf_pending); in qla2x00_probe_one()
3024 INIT_LIST_HEAD(&ha->tmf_active); in qla2x00_probe_one()
3028 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3029 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
3032 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3033 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3034 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3035 ha->flash_data_off = ~0; in qla2x00_probe_one()
3036 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3037 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3038 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3040 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3041 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
3044 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3045 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3046 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3047 ha->flash_data_off = ~0; in qla2x00_probe_one()
3048 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3049 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3050 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3052 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3053 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3056 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3057 ha->gid_list_info_size = 6; in qla2x00_probe_one()
3059 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
3060 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3061 ha->flash_data_off = ~0; in qla2x00_probe_one()
3062 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3063 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3064 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
3066 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3067 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3070 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3071 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3072 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3073 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3074 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
3075 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
3076 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
3077 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3078 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3079 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3080 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3082 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3083 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3086 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3087 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3088 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3089 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3090 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
3091 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3092 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
3093 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3094 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3095 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3096 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3098 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3099 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3102 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3103 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3104 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3105 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3106 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
3107 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3108 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
3109 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3110 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3111 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3112 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3114 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3115 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3118 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3119 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3120 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3121 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
3122 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3123 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
3124 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3125 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3126 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3127 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3129 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3130 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3133 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3134 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3135 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3136 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3137 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3138 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
3139 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3140 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3141 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3142 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3144 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3145 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3146 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3149 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3150 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3151 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3152 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3153 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3154 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3155 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3156 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3157 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3158 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3159 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3161 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3162 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3163 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3166 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3167 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3168 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3169 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3170 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3171 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3172 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3173 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3175 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3176 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3177 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3180 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3181 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3182 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3183 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3184 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3185 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3186 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3187 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3188 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3189 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3190 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3192 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3193 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3194 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3197 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3198 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3199 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3200 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3201 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3202 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3203 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3204 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3205 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3206 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3207 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3215 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3216 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3217 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3221 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3222 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3225 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3231 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3232 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3233 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3234 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3235 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3236 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3237 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3238 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3240 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3245 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3255 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3257 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3262 ret = -ENOMEM; in qla2x00_probe_one()
3267 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3269 host = base_vha->host; in qla2x00_probe_one()
3270 base_vha->req = req; in qla2x00_probe_one()
3272 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3275 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3276 base_vha->vp_idx; in qla2x00_probe_one()
3279 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3280 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3281 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3282 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3283 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3284 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3293 host->sg_tablesize = 32; in qla2x00_probe_one()
3296 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3298 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3299 host->cmd_per_lun = 3; in qla2x00_probe_one()
3300 host->unique_id = host->host_no; in qla2x00_probe_one()
3309 host->max_cmd_len = 32; in qla2x00_probe_one()
3311 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3312 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3313 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3316 host->max_lun = 0xffff; in qla2x00_probe_one()
3318 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3319 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3320 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3325 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3326 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3327 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3328 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3330 INIT_WORK(&ha->heartbeat_work, qla_heartbeat_work_fn); in qla2x00_probe_one()
3343 ret = -ENODEV; in qla2x00_probe_one()
3347 if (ha->mqenable) { in qla2x00_probe_one()
3348 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3349 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3352 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3355 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3357 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3358 host->nr_hw_queues); in qla2x00_probe_one()
3361 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3370 rsp->req = req; in qla2x00_probe_one()
3371 req->rsp = rsp; in qla2x00_probe_one()
3374 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3375 ha->req_q_map[0] = req; in qla2x00_probe_one()
3376 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3377 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3380 /* FWI2-capable only. */ in qla2x00_probe_one()
3381 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3382 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3383 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3384 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3385 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3387 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3388 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3389 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3390 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3394 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3395 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3396 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3397 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3401 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3402 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3403 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3407 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3408 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3410 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3411 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3412 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3413 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3415 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3416 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3418 "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()
3419 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3421 ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); in qla2x00_probe_one()
3422 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3423 ret = -ENOMEM; in qla2x00_probe_one()
3427 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3429 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3430 base_vha->device_flags); in qla2x00_probe_one()
3449 ret = -ENODEV; in qla2x00_probe_one()
3454 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3456 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3460 host->can_queue, base_vha->req, in qla2x00_probe_one()
3461 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3464 if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6)) in qla2x00_probe_one()
3465 ha->mqenable = 0; in qla2x00_probe_one()
3467 if (ha->mqenable) { in qla2x00_probe_one()
3477 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3482 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3488 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3489 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3490 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3493 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3494 ha->dpc_thread = NULL; in qla2x00_probe_one()
3508 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3511 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3512 ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3513 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3515 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3516 ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3517 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3518 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3520 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3525 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3526 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3538 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3541 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3566 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3569 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3573 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3574 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3578 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3582 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3583 base_vha->flags.online = 1; in qla2x00_probe_one()
3584 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3594 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3600 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3604 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3612 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3615 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3617 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3618 base_vha->host_no, in qla2x00_probe_one()
3619 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3623 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3625 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3626 return -ENODEV; in qla2x00_probe_one()
3633 vfree(base_vha->scan.l); in qla2x00_probe_one()
3634 if (base_vha->gnl.l) { in qla2x00_probe_one()
3635 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3636 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3637 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3640 if (base_vha->timer_active) in qla2x00_probe_one()
3642 base_vha->flags.online = 0; in qla2x00_probe_one()
3643 if (ha->dpc_thread) { in qla2x00_probe_one()
3644 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3646 ha->dpc_thread = NULL; in qla2x00_probe_one()
3651 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3669 if (!ha->nx_pcibase) in qla2x00_probe_one()
3670 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3672 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3674 if (ha->iobase) in qla2x00_probe_one()
3675 iounmap(ha->iobase); in qla2x00_probe_one()
3676 if (ha->cregbase) in qla2x00_probe_one()
3677 iounmap(ha->cregbase); in qla2x00_probe_one()
3679 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3696 ha = base_vha->hw; in __qla_set_remove_flag()
3698 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3699 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3700 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3706 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3707 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3717 ha = vha->hw; in qla2x00_shutdown()
3727 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3729 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3736 /* Turn-off FCE trace */ in qla2x00_shutdown()
3737 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3739 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3742 /* Turn-off EFT trace */ in qla2x00_shutdown()
3743 if (ha->eft) in qla2x00_shutdown()
3748 if (ha->flags.fw_started) in qla2x00_shutdown()
3756 if (vha->timer_active) in qla2x00_shutdown()
3760 vha->flags.online = 0; in qla2x00_shutdown()
3762 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3763 if (ha->interrupts_on) { in qla2x00_shutdown()
3764 vha->flags.init_done = 0; in qla2x00_shutdown()
3765 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3784 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3785 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3786 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3788 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3789 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3790 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3791 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3793 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3794 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3798 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3799 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3801 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3803 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3811 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3812 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3813 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3814 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3817 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3818 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3819 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3820 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3821 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3822 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3826 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3827 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3830 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3833 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3843 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3845 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3847 if (ha->iobase) in qla2x00_unmap_iobases()
3848 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3850 if (ha->cregbase) in qla2x00_unmap_iobases()
3851 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3853 if (ha->mqiobase) in qla2x00_unmap_iobases()
3854 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3856 if (ha->msixbase) in qla2x00_unmap_iobases()
3857 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3882 ha = base_vha->hw; in qla2x00_remove_one()
3886 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3889 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3893 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3894 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3895 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3896 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3897 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3908 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3913 if (ha->flags.fw_started) in qla2x00_remove_one()
3921 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3931 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3932 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3934 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3938 vfree(base_vha->scan.l); in qla2x00_remove_one()
3950 if (base_vha->timer_active) in qla2x00_remove_one()
3953 base_vha->flags.online = 0; in qla2x00_remove_one()
3956 if (ha->exlogin_buf) in qla2x00_remove_one()
3960 if (ha->exchoffld_buf) in qla2x00_remove_one()
3969 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3971 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3977 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3981 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3993 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3994 list_for_each_entry_safe(item, next, &list->head, list) { in qla24xx_free_purex_list()
3995 list_del(&item->list); in qla24xx_free_purex_list()
3996 if (item == &item->vha->default_item) in qla24xx_free_purex_list()
4000 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
4006 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
4011 if (vha->timer_active) in qla2x00_free_device()
4015 vha->flags.online = 0; in qla2x00_free_device()
4017 /* turn-off interrupts on the card */ in qla2x00_free_device()
4018 if (ha->interrupts_on) { in qla2x00_free_device()
4019 vha->flags.init_done = 0; in qla2x00_free_device()
4020 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
4028 if (ha->wq) { in qla2x00_free_device()
4029 destroy_workqueue(ha->wq); in qla2x00_free_device()
4030 ha->wq = NULL; in qla2x00_free_device()
4034 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
4050 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
4059 if (!fcport->rport) in qla2x00_schedule_rport_del()
4062 if (fcport->rport) { in qla2x00_schedule_rport_del()
4063 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
4065 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
4066 fcport->rport->roles); in qla2x00_schedule_rport_del()
4067 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
4084 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
4090 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
4091 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
4100 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
4106 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
4117 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
4119 fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
4120 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
4121 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
4125 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
4126 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
4129 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
4142 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4143 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4144 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4163 ha->vp_map = kcalloc(MAX_MULTI_ID_FABRIC, sizeof(struct qla_vp_map), GFP_KERNEL); in qla2x00_mem_alloc()
4164 if (!ha->vp_map) in qla2x00_mem_alloc()
4168 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
4169 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4170 if (!ha->init_cb) in qla2x00_mem_alloc()
4173 rc = btree_init32(&ha->host_map); in qla2x00_mem_alloc()
4180 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4181 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4182 if (!ha->gid_list) in qla2x00_mem_alloc()
4185 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4186 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4198 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4200 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4202 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4204 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4208 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4209 if (!ha->nvram) in qla2x00_mem_alloc()
4213 ha->pdev->device); in qla2x00_mem_alloc()
4214 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4216 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4219 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4221 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4224 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4226 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4227 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4232 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4234 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4235 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4245 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4246 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4247 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4248 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4254 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4255 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4256 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4257 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4261 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4264 return -ENOMEM; in qla2x00_mem_alloc()
4266 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4268 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4269 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4270 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4271 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4272 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4274 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4277 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4280 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4286 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4287 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4288 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4289 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4290 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4292 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4293 &ha->pool.good.head); in qla2x00_mem_alloc()
4294 ha->pool.good.count++; in qla2x00_mem_alloc()
4300 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4301 list_del(&dsd->list); in qla2x00_mem_alloc()
4302 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4303 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4304 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4306 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4309 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4311 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4312 ha->pool.unusable.count); in qla2x00_mem_alloc()
4315 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4317 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4318 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4324 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4325 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4326 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4328 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4329 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4332 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4333 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4334 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4337 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4338 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4339 if (!ha->ct_sns) in qla2x00_mem_alloc()
4341 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4343 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4349 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4353 (*req)->length = req_len; in qla2x00_mem_alloc()
4354 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4355 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4356 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4357 if (!(*req)->ring) { in qla2x00_mem_alloc()
4358 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4365 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4369 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4370 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4371 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4372 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4373 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4374 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4375 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4379 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4380 (*rsp)->req = *req; in qla2x00_mem_alloc()
4381 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4382 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4383 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4384 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4385 (*rsp)->ring); in qla2x00_mem_alloc()
4387 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4388 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4391 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4392 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4397 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4399 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4402 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4403 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4404 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4406 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4407 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4410 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4412 ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4413 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4414 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4416 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4417 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4421 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4423 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4424 &ha->async_pd_dma); in qla2x00_mem_alloc()
4425 if (!ha->async_pd) in qla2x00_mem_alloc()
4427 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4428 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4431 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4434 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4437 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4441 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4442 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4445 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4446 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4447 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4448 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4449 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4453 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4454 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4456 if (!ha->flt) { in qla2x00_mem_alloc()
4457 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4463 ha->purex_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4466 if (!ha->purex_dma_pool) { in qla2x00_mem_alloc()
4467 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4472 ha->elsrej.size = sizeof(struct fc_els_ls_rjt) + 16; in qla2x00_mem_alloc()
4473 ha->elsrej.c = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4474 ha->elsrej.size, in qla2x00_mem_alloc()
4475 &ha->elsrej.cdma, in qla2x00_mem_alloc()
4477 if (!ha->elsrej.c) { in qla2x00_mem_alloc()
4478 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4482 ha->elsrej.c->er_cmd = ELS_LS_RJT; in qla2x00_mem_alloc()
4483 ha->elsrej.c->er_reason = ELS_RJT_LOGIC; in qla2x00_mem_alloc()
4484 ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; in qla2x00_mem_alloc()
4486 ha->lsrjt.size = sizeof(struct fcnvme_ls_rjt); in qla2x00_mem_alloc()
4487 ha->lsrjt.c = dma_alloc_coherent(&ha->pdev->dev, ha->lsrjt.size, in qla2x00_mem_alloc()
4488 &ha->lsrjt.cdma, GFP_KERNEL); in qla2x00_mem_alloc()
4489 if (!ha->lsrjt.c) { in qla2x00_mem_alloc()
4490 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4498 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_alloc()
4499 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_alloc()
4501 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_alloc()
4503 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4504 ha->flt, ha->flt_dma); in qla2x00_mem_alloc()
4507 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4508 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4510 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4512 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4514 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4516 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4518 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4520 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4521 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4522 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4523 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4528 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4529 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4530 (*req)->ring = NULL; in qla2x00_mem_alloc()
4531 (*req)->dma = 0; in qla2x00_mem_alloc()
4536 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4537 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4538 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4539 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4541 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4542 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4543 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4545 if (ha->sns_cmd) in qla2x00_mem_alloc()
4546 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4547 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4552 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4554 list_del(&dsd->list); in qla2x00_mem_alloc()
4555 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4556 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4557 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4559 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4560 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4562 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4563 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4568 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4569 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4573 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4574 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4577 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4578 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4580 kfree(ha->nvram); in qla2x00_mem_alloc()
4581 ha->nvram = NULL; in qla2x00_mem_alloc()
4583 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4584 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4586 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4587 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4589 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4590 ha->gid_list, in qla2x00_mem_alloc()
4591 ha->gid_list_dma); in qla2x00_mem_alloc()
4592 ha->gid_list = NULL; in qla2x00_mem_alloc()
4593 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4597 btree_destroy32(&ha->host_map); in qla2x00_mem_alloc()
4599 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4600 ha->init_cb_dma); in qla2x00_mem_alloc()
4601 ha->init_cb = NULL; in qla2x00_mem_alloc()
4602 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4604 kfree(ha->vp_map); in qla2x00_mem_alloc()
4608 return -ENOMEM; in qla2x00_mem_alloc()
4617 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4630 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4638 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4640 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4647 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4650 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4651 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4652 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4653 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4655 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4660 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4679 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4680 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4681 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4682 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4683 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4691 struct init_cb_81xx *icb = (struct init_cb_81xx *)&vha->hw->init_cb; in qla2x00_number_of_exch()
4694 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4695 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4698 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4699 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4701 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4702 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4705 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4706 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4707 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4710 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4711 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4713 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4715 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4716 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4718 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4732 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4734 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4743 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4754 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4757 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4758 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4762 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4770 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4773 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4774 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4775 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4776 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4779 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4781 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4782 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4784 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4786 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4787 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4790 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4792 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4794 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4797 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4798 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4801 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4812 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4813 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4816 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4818 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4833 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4834 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4835 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4836 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4837 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4851 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4854 if (ha->fce) in qla2x00_free_fw_dump()
4855 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4856 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4858 if (ha->eft) in qla2x00_free_fw_dump()
4859 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4860 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4862 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4864 ha->fce = NULL; in qla2x00_free_fw_dump()
4865 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4866 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4867 ha->eft = NULL; in qla2x00_free_fw_dump()
4868 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4869 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4870 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4871 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4872 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4873 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4876 vfree(fwdt->template); in qla2x00_free_fw_dump()
4877 fwdt->template = NULL; in qla2x00_free_fw_dump()
4878 fwdt->length = 0; in qla2x00_free_fw_dump()
4894 if (ha->mctp_dump) in qla2x00_mem_free()
4895 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4896 ha->mctp_dump_dma); in qla2x00_mem_free()
4897 ha->mctp_dump = NULL; in qla2x00_mem_free()
4899 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4900 ha->srb_mempool = NULL; in qla2x00_mem_free()
4902 if (ha->dcbx_tlv) in qla2x00_mem_free()
4903 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4904 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4905 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4907 if (ha->xgmac_data) in qla2x00_mem_free()
4908 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4909 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4910 ha->xgmac_data = NULL; in qla2x00_mem_free()
4912 if (ha->sns_cmd) in qla2x00_mem_free()
4913 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4914 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4915 ha->sns_cmd = NULL; in qla2x00_mem_free()
4916 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4918 if (ha->ct_sns) in qla2x00_mem_free()
4919 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4920 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4921 ha->ct_sns = NULL; in qla2x00_mem_free()
4922 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4924 if (ha->sfp_data) in qla2x00_mem_free()
4925 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4926 ha->sfp_data_dma); in qla2x00_mem_free()
4927 ha->sfp_data = NULL; in qla2x00_mem_free()
4929 if (ha->flt) in qla2x00_mem_free()
4930 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4932 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4933 ha->flt = NULL; in qla2x00_mem_free()
4934 ha->flt_dma = 0; in qla2x00_mem_free()
4936 if (ha->ms_iocb) in qla2x00_mem_free()
4937 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4938 ha->ms_iocb = NULL; in qla2x00_mem_free()
4939 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4941 if (ha->sf_init_cb) in qla2x00_mem_free()
4942 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4943 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4945 if (ha->ex_init_cb) in qla2x00_mem_free()
4946 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4947 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4948 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4949 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4951 if (ha->async_pd) in qla2x00_mem_free()
4952 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4953 ha->async_pd = NULL; in qla2x00_mem_free()
4954 ha->async_pd_dma = 0; in qla2x00_mem_free()
4956 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4957 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4959 if (ha->gid_list) in qla2x00_mem_free()
4960 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4961 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4962 ha->gid_list = NULL; in qla2x00_mem_free()
4963 ha->gid_list_dma = 0; in qla2x00_mem_free()
4965 if (ha->base_qpair && !list_empty(&ha->base_qpair->dsd_list)) { in qla2x00_mem_free()
4970 &ha->base_qpair->dsd_list, list) { in qla2x00_mem_free()
4971 dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, in qla2x00_mem_free()
4972 dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4973 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4978 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4979 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4981 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4982 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4984 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4985 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4987 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4990 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4992 list_del(&dsd->list); in qla2x00_mem_free()
4993 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4994 dsd->dsd_list_dma); in qla2x00_mem_free()
4995 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4997 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4998 ha->pool.unusable.count--; in qla2x00_mem_free()
5000 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
5001 list_del(&dsd->list); in qla2x00_mem_free()
5002 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
5003 dsd->dsd_list_dma); in qla2x00_mem_free()
5004 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
5006 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
5010 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
5011 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
5016 if (ha->init_cb) in qla2x00_mem_free()
5017 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
5018 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
5020 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_free()
5021 ha->purex_dma_pool = NULL; in qla2x00_mem_free()
5023 if (ha->elsrej.c) { in qla2x00_mem_free()
5024 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_free()
5025 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_free()
5026 ha->elsrej.c = NULL; in qla2x00_mem_free()
5029 if (ha->lsrjt.c) { in qla2x00_mem_free()
5030 dma_free_coherent(&ha->pdev->dev, ha->lsrjt.size, ha->lsrjt.c, in qla2x00_mem_free()
5031 ha->lsrjt.cdma); in qla2x00_mem_free()
5032 ha->lsrjt.c = NULL; in qla2x00_mem_free()
5035 ha->init_cb = NULL; in qla2x00_mem_free()
5036 ha->init_cb_dma = 0; in qla2x00_mem_free()
5038 vfree(ha->optrom_buffer); in qla2x00_mem_free()
5039 ha->optrom_buffer = NULL; in qla2x00_mem_free()
5040 kfree(ha->nvram); in qla2x00_mem_free()
5041 ha->nvram = NULL; in qla2x00_mem_free()
5042 kfree(ha->npiv_info); in qla2x00_mem_free()
5043 ha->npiv_info = NULL; in qla2x00_mem_free()
5044 kfree(ha->swl); in qla2x00_mem_free()
5045 ha->swl = NULL; in qla2x00_mem_free()
5046 kfree(ha->loop_id_map); in qla2x00_mem_free()
5047 ha->sf_init_cb = NULL; in qla2x00_mem_free()
5048 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
5049 ha->loop_id_map = NULL; in qla2x00_mem_free()
5051 kfree(ha->vp_map); in qla2x00_mem_free()
5052 ha->vp_map = NULL; in qla2x00_mem_free()
5063 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
5072 vha->host = host; in qla2x00_create_host()
5073 vha->host_no = host->host_no; in qla2x00_create_host()
5074 vha->hw = ha; in qla2x00_create_host()
5076 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
5077 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
5078 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
5080 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
5081 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
5082 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
5083 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
5084 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
5085 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
5086 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
5087 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
5088 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
5090 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
5091 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
5093 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
5094 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
5095 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
5096 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
5101 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
5102 (ha->max_loop_id + 1); in qla2x00_create_host()
5103 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
5104 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
5105 if (!vha->gnl.l) { in qla2x00_create_host()
5108 scsi_host_put(vha->host); in qla2x00_create_host()
5113 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
5114 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
5115 if (!vha->scan.l) { in qla2x00_create_host()
5118 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
5119 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
5120 vha->gnl.l = NULL; in qla2x00_create_host()
5121 scsi_host_put(vha->host); in qla2x00_create_host()
5124 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
5126 snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", in qla2x00_create_host()
5127 QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
5130 vha->host, vha->hw, vha, in qla2x00_create_host()
5131 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
5141 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
5153 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
5154 e->type = type; in qla2x00_alloc_work()
5155 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
5165 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
5166 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
5168 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
5171 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
5174 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
5189 e->u.aen.code = code; in qla2x00_post_aen_work()
5190 e->u.aen.data = data; in qla2x00_post_aen_work()
5203 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
5218 e->u.logio.fcport = fcport; \
5220 e->u.logio.data[0] = data[0]; \
5221 e->u.logio.data[1] = data[1]; \
5223 fcport->flags |= FCF_ASYNC_ACTIVE; \
5242 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5255 vha->host_no); in qla2x00_uevent_emit()
5261 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5274 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5275 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5276 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5284 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5287 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5288 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5289 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5292 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5293 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5294 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5296 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5298 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5307 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5312 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5314 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5315 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5317 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5319 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5320 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5321 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5327 pla->ref_count--; in qla24xx_create_new_sess()
5330 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5333 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5334 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5335 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5336 fcport->tgt_short_link_down_cnt = 0; in qla24xx_create_new_sess()
5338 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5341 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5342 if (NVME_PRIORITY(vha->hw, fcport)) in qla24xx_create_new_sess()
5343 fcport->do_prli_nvme = 1; in qla24xx_create_new_sess()
5345 fcport->do_prli_nvme = 0; in qla24xx_create_new_sess()
5347 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5348 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5350 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5351 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5352 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5353 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5359 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5362 list_del(&pla->list); in qla24xx_create_new_sess()
5368 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5371 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5376 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5377 tfcp->fw_login_state); in qla24xx_create_new_sess()
5381 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5387 pla->ref_count--; in qla24xx_create_new_sess()
5390 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5393 fcport->id_changed = 1; in qla24xx_create_new_sess()
5394 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5395 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5396 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5399 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5402 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5403 fcport->local = 0; in qla24xx_create_new_sess()
5404 fcport->loop_id = in qla24xx_create_new_sess()
5406 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5407 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5410 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5413 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5416 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5418 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5424 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5426 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5433 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5434 tfcp->fw_login_state); in qla24xx_create_new_sess()
5436 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5440 fcport->login_pause = 1; in qla24xx_create_new_sess()
5441 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5444 fcport->login_pause = 1; in qla24xx_create_new_sess()
5445 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5450 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5454 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5455 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5456 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5457 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5458 fcport->fc4_type = in qla24xx_create_new_sess()
5460 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5462 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5464 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5474 list_del(&pla->list); in qla24xx_create_new_sess()
5482 struct srb *sp = e->u.iosb.sp; in qla_sp_retry()
5488 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5489 __func__, sp->name, rval); in qla_sp_retry()
5502 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5503 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5504 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5508 switch (e->type) { in qla2x00_do_work()
5510 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5511 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5514 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5517 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5518 e->u.logio.data); in qla2x00_do_work()
5521 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5524 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5525 e->u.logio.data); in qla2x00_do_work()
5528 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5534 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5543 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5544 e->u.fcport.opt); in qla2x00_do_work()
5547 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5550 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5553 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5559 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5562 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5563 e->u.logio.data); in qla2x00_do_work()
5566 qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, in qla2x00_do_work()
5567 e->u.gpnft.sp); in qla2x00_do_work()
5570 qla24xx_async_gpnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5573 qla24xx_async_gnnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5576 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5582 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5586 e->u.fcport.fcport, false); in qla2x00_do_work()
5594 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5595 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5596 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5597 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5600 list_del_init(&e->list); in qla2x00_do_work()
5601 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5616 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5632 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5637 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5638 fcport->login_retry) { in qla2x00_relogin()
5639 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5640 fcport->disc_state == DSC_LOGIN_AUTH_PEND || in qla2x00_relogin()
5641 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5644 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5645 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5648 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5652 } else if (vha->hw->current_topology == in qla2x00_relogin()
5654 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5657 } else if (vha->hw->current_topology == in qla2x00_relogin()
5659 fcport->login_retry--; in qla2x00_relogin()
5664 fcport->old_loop_id = in qla2x00_relogin()
5665 fcport->loop_id; in qla2x00_relogin()
5668 fcport->loop_id); in qla2x00_relogin()
5673 &vha->dpc_flags); in qla2x00_relogin()
5677 fcport->login_retry, in qla2x00_relogin()
5678 fcport->loop_id); in qla2x00_relogin()
5680 fcport->login_retry = 0; in qla2x00_relogin()
5683 if (fcport->login_retry == 0 && in qla2x00_relogin()
5689 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5694 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5700 /* Schedule work on any of the dpc-workqueues */
5704 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5708 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5709 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5713 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5714 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5715 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5722 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5723 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5726 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5727 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5731 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5743 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5749 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5750 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5765 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5811 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5817 "Failed to dump mctp\n"); in qla83xx_nic_core_reset_work()
5821 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5834 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5840 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5850 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5886 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5898 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5911 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5924 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5929 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5984 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5988 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5993 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5995 ha->portnum); in qla83xx_idc_lock()
6003 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
6023 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
6026 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
6027 /* if RDP request is not from Domain Controller: */ in qla25xx_rdp_rsp_reduce_size()
6038 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
6041 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
6042 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
6052 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
6077 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
6079 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
6096 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
6108 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6116 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6124 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6127 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6131 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
6132 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
6133 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
6134 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
6135 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
6136 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
6137 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
6138 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
6139 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
6140 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
6141 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
6142 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
6144 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
6145 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
6146 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
6148 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
6149 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
6150 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
6152 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
6153 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
6155 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
6156 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
6159 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
6160 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
6161 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
6164 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6165 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
6166 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
6167 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
6168 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6171 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6172 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
6173 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
6174 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
6175 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6178 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
6179 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6180 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
6187 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
6205 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
6212 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
6213 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
6214 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
6215 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
6216 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
6221 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
6222 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
6223 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
6224 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
6226 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
6230 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
6231 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
6232 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
6237 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
6238 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
6239 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
6240 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
6241 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6242 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6243 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6244 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6245 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6246 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6247 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6248 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6249 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6254 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6255 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6256 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6257 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6258 vha->node_name, in qla24xx_process_purex_rdp()
6259 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6260 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6261 vha->port_name, in qla24xx_process_purex_rdp()
6262 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6264 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6265 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6266 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6267 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6268 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6269 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6270 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6271 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6272 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6273 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6276 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6277 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6278 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6279 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6280 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6281 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6283 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6285 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6286 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6293 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6294 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6295 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6297 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6298 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6299 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6301 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6302 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6303 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6305 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6306 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6307 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6309 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6310 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6311 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6320 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6321 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6322 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6323 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6324 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6328 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6329 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6330 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6331 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6332 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6336 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6337 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6338 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6339 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6340 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6344 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6345 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6346 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6347 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6348 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6352 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6353 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6354 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6355 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6356 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6364 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6372 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6380 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6388 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6396 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6406 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6407 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6408 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6414 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6416 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6417 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6419 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6420 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6422 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6423 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6425 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6431 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6433 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6441 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6445 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6453 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6454 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6456 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6457 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6458 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6465 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6468 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6471 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6474 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6481 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6482 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6493 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6494 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6495 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6498 list_del(&item->list); in qla24xx_process_purex_list()
6499 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6515 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6519 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6526 if (data == ha->portnum) { in qla83xx_idc_unlock()
6528 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6533 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6541 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6545 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6552 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6557 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6574 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6579 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6603 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6608 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6631 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6635 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6636 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6664 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6676 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6704 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6709 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6710 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6729 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6732 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6735 ha->portnum); in qla83xx_idc_state_handler()
6738 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6741 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6748 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6754 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6757 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6764 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6774 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6781 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6784 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6787 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6819 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6820 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6825 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6828 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6836 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6849 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6852 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6862 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6864 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6866 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6876 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6891 * is kick-off by the driver's detect code and starts up
6906 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6917 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6920 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6923 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6925 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6929 ha->dpc_active = 1; in qla2x00_do_dpc()
6933 base_vha->dpc_flags); in qla2x00_do_dpc()
6935 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6941 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6955 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6968 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6973 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6975 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6976 * Escalate to chip-reset in qla2x00_do_dpc()
6979 &base_vha->dpc_flags); in qla2x00_do_dpc()
6982 &base_vha->dpc_flags); in qla2x00_do_dpc()
6990 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6996 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6998 &base_vha->dpc_flags); in qla2x00_do_dpc()
7007 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7012 &base_vha->dpc_flags)) in qla2x00_do_dpc()
7014 &base_vha->dpc_flags); in qla2x00_do_dpc()
7022 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7026 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
7032 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7034 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
7036 * when a forced chip-reset occurs. in qla2x00_do_dpc()
7037 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
7039 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
7043 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7044 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7047 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
7052 !ha->flags.fw_started) in qla2x00_do_dpc()
7057 !ha->flags.fw_started) in qla2x00_do_dpc()
7065 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7066 base_vha->flags.online = 1; in qla2x00_do_dpc()
7069 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
7072 &base_vha->dpc_flags); in qla2x00_do_dpc()
7075 &base_vha->dpc_flags); in qla2x00_do_dpc()
7081 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7082 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7084 (&base_vha->purex_list); in qla2x00_do_dpc()
7086 &base_vha->dpc_flags); in qla2x00_do_dpc()
7093 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7102 &base_vha->dpc_flags); in qla2x00_do_dpc()
7103 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
7119 &base_vha->dpc_flags); in qla2x00_do_dpc()
7127 &base_vha->dpc_flags) && in qla2x00_do_dpc()
7128 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
7133 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
7139 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7140 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7141 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
7143 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
7144 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
7145 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
7146 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7156 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7164 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7169 &base_vha->dpc_flags); in qla2x00_do_dpc()
7179 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7180 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7181 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7186 if (!ha->interrupts_on) in qla2x00_do_dpc()
7187 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
7190 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7191 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
7192 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
7197 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7198 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
7199 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
7204 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
7205 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
7207 qpair->online = online; in qla2x00_do_dpc()
7208 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
7212 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7213 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
7215 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
7216 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
7232 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7236 ha->dpc_active = 0; in qla2x00_do_dpc()
7248 ha->dpc_active = 0; in qla2x00_do_dpc()
7259 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7260 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7262 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7276 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7277 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7278 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7280 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7286 vha->marker_needed = 1; in qla2x00_rst_aen()
7287 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7288 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7294 struct qla_hw_data *ha = vha->hw; in qla_do_heartbeat()
7303 cmpl_cnt = ha->base_qpair->cmd_completion_cnt; in qla_do_heartbeat()
7304 if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && in qla_do_heartbeat()
7305 cmpl_cnt != ha->base_qpair->cmd_cnt) { in qla_do_heartbeat()
7309 ha->base_qpair->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7311 for (i = 0; i < ha->max_qpairs; i++) { in qla_do_heartbeat()
7312 if (ha->queue_pair_map[i]) { in qla_do_heartbeat()
7313 cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; in qla_do_heartbeat()
7314 if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && in qla_do_heartbeat()
7315 cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { in qla_do_heartbeat()
7319 ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7329 struct qla_hw_data *ha = vha->hw; in qla_heart_beat()
7331 if (vha->vp_idx) in qla_heart_beat()
7334 if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) in qla_heart_beat()
7343 time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) in qla_heart_beat()
7347 ha->last_heartbeat_run_jiffies = jiffies; in qla_heart_beat()
7348 queue_work(ha->wq, &ha->heartbeat_work); in qla_heart_beat()
7354 struct qla_hw_data *ha = vha->hw; in qla_wind_down_chip()
7356 if (!ha->flags.eeh_busy) in qla_wind_down_chip()
7358 if (ha->pci_error_state) in qla_wind_down_chip()
7366 if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handling * HZ) && in qla_wind_down_chip()
7367 !ha->flags.eeh_flush) { in qla_wind_down_chip()
7371 ha->isp_ops->reset_chip(vha); in qla_wind_down_chip()
7372 ha->isp_ops->disable_intrs(ha); in qla_wind_down_chip()
7374 ha->flags.eeh_flush = EEH_FLUSH_RDY; in qla_wind_down_chip()
7375 ha->eeh_jif = jiffies; in qla_wind_down_chip()
7377 } else if (ha->flags.eeh_flush == EEH_FLUSH_RDY && in qla_wind_down_chip()
7378 time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { in qla_wind_down_chip()
7379 pci_clear_master(ha->pdev); in qla_wind_down_chip()
7383 ha->flags.eeh_flush = EEH_FLUSH_DONE; in qla_wind_down_chip()
7407 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7412 if (ha->flags.eeh_busy) { in qla2x00_timer()
7417 ha->flags.eeh_busy); in qla2x00_timer()
7424 * the read returns -1 then disable the board. in qla2x00_timer()
7426 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7427 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7432 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7433 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7441 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7444 if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7445 vha->link_down_time++; in qla2x00_timer()
7447 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7448 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_timer()
7449 if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7450 fcport->tgt_link_down_time++; in qla2x00_timer()
7452 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7455 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7456 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7457 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7458 && vha->flags.online) { in qla2x00_timer()
7460 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7461 vha->loop_down_abort_time) { in qla2x00_timer()
7464 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7466 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7467 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7470 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7473 /* NPIV - scan physical port only */ in qla2x00_timer()
7474 if (!vha->vp_idx) { in qla2x00_timer()
7475 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7477 req = ha->req_q_map[0]; in qla2x00_timer()
7479 index < req->num_outstanding_cmds; in qla2x00_timer()
7483 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7486 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7488 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7490 sfcp = sp->fcport; in qla2x00_timer()
7491 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7496 &vha->dpc_flags); in qla2x00_timer()
7499 &vha->dpc_flags); in qla2x00_timer()
7502 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7509 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7510 if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { in qla2x00_timer()
7512 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7516 &vha->dpc_flags); in qla2x00_timer()
7519 &vha->dpc_flags); in qla2x00_timer()
7523 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7524 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7527 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7530 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7536 if (vha->hw->flags.edif_enabled) in qla2x00_timer()
7540 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7544 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7545 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7547 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7549 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7553 * FC-NVME in qla2x00_timer()
7556 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7557 if (!vha->vp_idx && in qla2x00_timer()
7558 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7559 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7560 !ha->flags.host_shutting_down) { in qla2x00_timer()
7561 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7564 ha->nvme_last_rptd_aen); in qla2x00_timer()
7565 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7569 if (!vha->vp_idx && in qla2x00_timer()
7570 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7574 ha->last_zio_threshold); in qla2x00_timer()
7575 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7576 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7584 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7585 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7587 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7588 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7589 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7590 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7591 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7592 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7593 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7597 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7598 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7599 start_dpc, test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7604 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7605 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7606 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7607 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7608 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7609 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7669 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7700 if (!blob->name) in qla2x00_request_firmware()
7704 if (blob->fw) in qla2x00_request_firmware()
7707 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7709 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7710 blob->fw = NULL; in qla2x00_request_firmware()
7725 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7726 release_firmware(blob->fw); in qla2x00_release_firmware()
7732 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7733 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7742 ha->chip_reset++; in qla_pci_error_cleanup()
7744 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7745 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7746 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7747 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7748 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7756 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7757 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7758 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7759 qpair->online = 0; in qla_pci_error_cleanup()
7761 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7765 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7766 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7767 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7768 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7770 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7771 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7773 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7776 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7777 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7779 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7780 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7781 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7782 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7783 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7784 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7785 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7786 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7788 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7796 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7801 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7803 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7814 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7824 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7827 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7845 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7846 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7847 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7852 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7863 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7865 stat = rd_reg_word(&reg->hccr); in qla2xxx_pci_mmio_enabled()
7869 stat = rd_reg_dword(&reg->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7873 stat = rd_reg_dword(&reg24->host_status); in qla2xxx_pci_mmio_enabled()
7877 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7881 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7896 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7903 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7908 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7917 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7924 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7929 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7932 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7933 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7934 qpair->online = 1; in qla2xxx_pci_slot_reset()
7935 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7937 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7938 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7939 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7940 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7941 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7944 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7963 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7975 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7982 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7983 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7987 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7990 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7991 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7992 ha->eeh_jif = jiffies; in qla_pci_set_eeh_busy()
7993 ha->flags.eeh_flush = 0; in qla_pci_set_eeh_busy()
7995 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7998 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
8010 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
8011 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
8013 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
8016 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
8024 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
8036 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
8037 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
8038 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
8039 qpair->online = 0; in qla_pci_reset_prepare()
8040 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
8042 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
8051 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
8060 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
8061 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
8062 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
8063 qpair->online = 1; in qla_pci_reset_done()
8064 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
8066 base_vha->flags.online = 1; in qla_pci_reset_done()
8067 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
8068 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
8073 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
8074 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
8076 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
8079 blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); in qla2xxx_map_queues()
8103 .this_id = -1,
8174 * qla2x00_module_init - Module initialization.
8274 return -ENOMEM; in qla2x00_module_init()
8294 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
8303 ret = -ENODEV; in qla2x00_module_init()
8318 ret = -ENODEV; in qla2x00_module_init()
8352 * qla2x00_module_exit - Module cleanup.