Lines Matching +full:mctp +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
15 #include <linux/blk-mq-pci.h>
65 "Enable/disable security. 0(Default) - Security disabled. 1 - Security enabled.");
71 "beginning. Default is 0 - class 2 not supported.");
83 "a PORT-DOWN status.");
90 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
102 "vary by ISP type. Default is 1 - allocate memory.");
109 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
110 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
111 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
112 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
113 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
114 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
115 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
116 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
117 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
118 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
119 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
120 "\t\t0x1e400000 - Preferred value for capturing essential "
141 "0 - no FDMI registrations. "
142 "1 - provide FDMI registrations (default).");
154 " Enable T10-CRC-DIF:\n"
156 " 0 -- No DIF Support\n"
157 " 1 -- Enable DIF for all types\n"
158 " 2 -- Enable DIF for all types, except Type 0.\n");
168 "0 - no NVMe. Default is Y");
173 " Enable T10-CRC-DIF Error isolation by HBA:\n"
175 " 0 -- Error isolation disabled\n"
176 " 1 -- Error isolation enabled only for DIX Type 0\n"
177 " 2 -- Error isolation enabled for all Types\n");
183 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
197 " 2 -- load firmware via the request_firmware() (hotplug).\n"
199 " 1 -- load firmware from flash.\n"
200 " 0 -- use default semantics.\n");
206 "Default is 0 - skip ETS enablement.");
212 " 0 -- Regular doorbell.\n"
213 " 1 -- CAMRAM doorbell (faster).\n");
219 "Default is 0 - Do not use GFF_ID information.");
225 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
231 " 0 (Default) -- Reset on failure.\n"
232 " 1 -- Do not reset on failure.\n");
244 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
250 "0 - MiniDump disabled. "
251 "1 (Default) - MiniDump enabled.");
257 "0 (Default)- Disabled.");
274 "1 - Set fw option to hold ABTS.");
281 "1 - Move IOCBs.");
292 "Set to enable MSI or MSI-X interrupt mechanism.\n"
293 " Default is 1, enable MSI-X interrupt mechanism.\n"
294 " 0 -- enable traditional pin-based mechanism.\n"
295 " 1 -- enable MSI-X interrupt mechanism.\n"
296 " 2 -- enable MSI interrupt mechanism.\n");
314 " 0 -- Let HBA firmware decide\n"
315 " 1 -- Force T10 CRC\n"
316 " 2 -- Force IP checksum\n");
330 " Default is 0 - No SmartSAN registration,"
331 " 1 - Register SmartSAN Management Attributes.");
338 "0 - no RDP responses (default). "
339 "1 - provide RDP responses.");
349 "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n");
361 "1 - Minimum number of queues supported\n"
362 "8 - Default value");
368 "0 - FC2 Target support is disabled. "
369 "1 - FC2 Target support is enabled (default).");
382 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
383 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
384 add_timer(&vha->timer); in qla2x00_start_timer()
385 vha->timer_active = 1; in qla2x00_start_timer()
392 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
398 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
404 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
405 vha->timer_active = 0; in qla2x00_stop_timer()
419 /* -------------------------------------------------------------------------- */
423 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
425 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
426 rsp->req = req; in qla_init_base_qpair()
427 ha->base_qpair->hw = ha; in qla_init_base_qpair()
428 ha->base_qpair->req = req; in qla_init_base_qpair()
429 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
430 ha->base_qpair->vha = vha; in qla_init_base_qpair()
431 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
432 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
433 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
434 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
435 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
436 INIT_LIST_HEAD(&ha->base_qpair->dsd_list); in qla_init_base_qpair()
437 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
439 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
440 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
443 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
449 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
451 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
453 if (!ha->req_q_map) { in qla2x00_alloc_queues()
459 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
461 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
467 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
468 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
476 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
477 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
479 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
485 kfree(ha->queue_pair_map); in qla2x00_alloc_queues()
486 ha->queue_pair_map = NULL; in qla2x00_alloc_queues()
495 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
496 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
497 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
498 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
502 kfree(ha->base_qpair); in qla2x00_alloc_queues()
503 ha->base_qpair = NULL; in qla2x00_alloc_queues()
505 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
506 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
508 kfree(ha->req_q_map); in qla2x00_alloc_queues()
509 ha->req_q_map = NULL; in qla2x00_alloc_queues()
511 return -ENOMEM; in qla2x00_alloc_queues()
517 if (req && req->ring_fx00) in qla2x00_free_req_que()
518 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
519 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
520 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
521 } else if (req && req->ring) in qla2x00_free_req_que()
522 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
523 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
524 req->ring, req->dma); in qla2x00_free_req_que()
527 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
535 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
536 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
537 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
538 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
539 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
540 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
541 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
542 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
554 if (ha->queue_pair_map) { in qla2x00_free_queues()
555 kfree(ha->queue_pair_map); in qla2x00_free_queues()
556 ha->queue_pair_map = NULL; in qla2x00_free_queues()
558 if (ha->base_qpair) { in qla2x00_free_queues()
559 kfree(ha->base_qpair); in qla2x00_free_queues()
560 ha->base_qpair = NULL; in qla2x00_free_queues()
564 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
565 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
566 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
569 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
570 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
571 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
573 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
575 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
577 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
579 kfree(ha->req_q_map); in qla2x00_free_queues()
580 ha->req_q_map = NULL; in qla2x00_free_queues()
583 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
584 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
585 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
588 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
589 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
590 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
591 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
593 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
595 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
597 kfree(ha->rsp_q_map); in qla2x00_free_queues()
598 ha->rsp_q_map = NULL; in qla2x00_free_queues()
604 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
610 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
612 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
615 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
628 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
631 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
635 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
661 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
666 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
677 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
679 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
680 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
682 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
687 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
701 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
705 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
714 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
716 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
717 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
723 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
726 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
728 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
731 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
732 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
733 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
734 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
737 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
739 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
740 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
743 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
744 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
746 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
747 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
750 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
751 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
753 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
754 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
755 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2x00_sp_free_dma()
756 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
757 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
760 if (sp->flags & SRB_GOT_BUF) in qla2x00_sp_free_dma()
761 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2x00_sp_free_dma()
767 struct completion *comp = sp->comp; in qla2x00_sp_compl()
770 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_compl()
771 cmd->result = res; in qla2x00_sp_compl()
772 sp->type = 0; in qla2x00_sp_compl()
781 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
783 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
785 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
788 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
789 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
790 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
791 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
794 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
796 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
797 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
800 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
801 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
805 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
806 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
807 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
808 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
810 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
814 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
815 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
816 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
817 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
819 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
822 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
823 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
824 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
825 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
828 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
829 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
830 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
831 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
833 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
836 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
837 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
839 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
840 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
841 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2xxx_qpair_sp_free_dma()
842 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
843 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
844 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
847 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
848 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
850 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
851 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
854 if (sp->flags & SRB_GOT_BUF) in qla2xxx_qpair_sp_free_dma()
855 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2xxx_qpair_sp_free_dma()
861 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
864 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_qpair_sp_compl()
865 cmd->result = res; in qla2xxx_qpair_sp_compl()
866 sp->type = 0; in qla2xxx_qpair_sp_compl()
876 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
877 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
878 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
879 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
883 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
885 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
889 if (ha->mqenable) { in qla2xxx_queuecommand()
896 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
902 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
903 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
907 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
911 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
918 cmd->result = rval; in qla2xxx_queuecommand()
925 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
930 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
934 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
935 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
939 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
940 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
941 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
944 atomic_read(&fcport->state), in qla2xxx_queuecommand()
945 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
946 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
953 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
956 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
958 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
959 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
965 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
967 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
968 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
969 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
970 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
972 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
983 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_queuecommand()
1000 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
1001 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
1002 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
1003 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
1009 cmd->result = rval; in qla2xxx_mqueuecommand()
1016 if (!qpair->online) { in qla2xxx_mqueuecommand()
1018 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
1019 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1023 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
1024 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
1028 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
1029 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
1030 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
1033 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
1034 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
1035 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1042 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
1045 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
1047 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
1048 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1056 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1057 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1058 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1059 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1061 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1072 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_mqueuecommand()
1090 * ha - pointer to host adapter structure
1093 * Does context switching-Release SPIN_LOCK
1105 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1106 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1109 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1110 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1111 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1112 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1116 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1126 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1131 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1134 vha, vha->fcport_count); in test_fcport_count()
1135 res = (vha->fcport_count == 0); in test_fcport_count()
1139 list_for_each_entry(fcport, &vha->vp_fcports, list) { in test_fcport_count()
1140 if (fcport->deleted != QLA_SESS_DELETED) { in test_fcport_count()
1151 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1168 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1173 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1181 * ha - pointer to host adapter structure
1184 * Does context switching-Release SPIN_LOCK
1191 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1192 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1194 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1195 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1196 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1197 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1198 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1209 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1210 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1213 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1214 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1215 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1216 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1220 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1221 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1224 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1250 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1257 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1276 qpair = sp->qpair; in qla2xxx_eh_abort()
1278 vha->cmd_timeout_cnt++; in qla2xxx_eh_abort()
1280 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1283 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1284 sp->comp = ∁ in qla2xxx_eh_abort()
1285 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1288 id = cmd->device->id; in qla2xxx_eh_abort()
1289 lun = cmd->device->lun; in qla2xxx_eh_abort()
1293 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1300 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1306 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1313 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1324 sp->comp = NULL; in qla2xxx_eh_abort()
1327 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1328 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1345 scsi_qla_host_t *vha = qpair->vha; in __qla2x00_eh_wait_for_pending_commands()
1346 struct req_que *req = qpair->req; in __qla2x00_eh_wait_for_pending_commands()
1351 struct qla_hw_data *ha = vha->hw; in __qla2x00_eh_wait_for_pending_commands()
1355 while (wait_iter--) { in __qla2x00_eh_wait_for_pending_commands()
1358 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1359 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_eh_wait_for_pending_commands()
1360 sp = req->outstanding_cmds[cnt]; in __qla2x00_eh_wait_for_pending_commands()
1363 if (sp->type != SRB_SCSI_CMD) in __qla2x00_eh_wait_for_pending_commands()
1365 if (vha->vp_idx != sp->vha->vp_idx) in __qla2x00_eh_wait_for_pending_commands()
1374 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1375 match = sp->fcport->d_id.b24 == t; in __qla2x00_eh_wait_for_pending_commands()
1380 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1381 match = (sp->fcport->d_id.b24 == t && in __qla2x00_eh_wait_for_pending_commands()
1382 cmd->device->lun == l); in __qla2x00_eh_wait_for_pending_commands()
1390 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1392 if (unlikely(pci_channel_offline(ha->pdev)) || in __qla2x00_eh_wait_for_pending_commands()
1393 ha->flags.eeh_busy) { in __qla2x00_eh_wait_for_pending_commands()
1405 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1408 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1414 if (wait_iter == -1) in __qla2x00_eh_wait_for_pending_commands()
1425 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1428 status = __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, in qla2x00_eh_wait_for_pending_commands()
1430 for (i = 0; status == QLA_SUCCESS && i < ha->max_qpairs; i++) { in qla2x00_eh_wait_for_pending_commands()
1431 qpair = ha->queue_pair_map[i]; in qla2x00_eh_wait_for_pending_commands()
1450 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_device_reset()
1451 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_eh_device_reset()
1453 fc_port_t *fcport = (struct fc_port *) sdev->hostdata; in qla2xxx_eh_device_reset()
1454 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1472 if (fcport->deleted) in qla2xxx_eh_device_reset()
1476 "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, in qla2xxx_eh_device_reset()
1477 sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1486 if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) in qla2xxx_eh_device_reset()
1493 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, in qla2xxx_eh_device_reset()
1494 cmd->device->lun, in qla2xxx_eh_device_reset()
1503 vha->host_no, sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1510 reset_errors[err], vha->host_no, sdev->id, sdev->lun, in qla2xxx_eh_device_reset()
1512 vha->reset_cmd_err_cnt++; in qla2xxx_eh_device_reset()
1519 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_target_reset()
1522 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1523 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_eh_target_reset()
1541 if (fcport->deleted) in qla2xxx_eh_target_reset()
1545 "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no, in qla2xxx_eh_target_reset()
1546 sdev->id, cmd); in qla2xxx_eh_target_reset()
1555 if (ha->isp_ops->target_reset(fcport, 0, 0) != QLA_SUCCESS) { in qla2xxx_eh_target_reset()
1561 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, 0, in qla2xxx_eh_target_reset()
1570 vha->host_no, sdev->id, cmd); in qla2xxx_eh_target_reset()
1577 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in qla2xxx_eh_target_reset()
1579 vha->reset_cmd_err_cnt++; in qla2xxx_eh_target_reset()
1601 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1605 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1614 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1615 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1621 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1646 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1669 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1670 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1674 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1683 id = cmd->device->id; in qla2xxx_eh_host_reset()
1684 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1687 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1693 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1700 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1708 if (ha->wq) in qla2xxx_eh_host_reset()
1709 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1711 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1712 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1713 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1715 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1723 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1734 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1753 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1758 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1759 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1760 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1769 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1777 vha->marker_needed = 1; in qla2x00_loop_reset()
1788 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1789 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1792 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1793 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1799 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1802 sp->done(sp, res); in qla2x00_abort_srb()
1806 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1807 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1808 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1810 if (sp->comp) { in qla2x00_abort_srb()
1811 sp->done(sp, res); in qla2x00_abort_srb()
1815 sp->comp = ∁ in qla2x00_abort_srb()
1816 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1818 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1821 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1828 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1838 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1839 switch (sp->type) { in qla2x00_abort_srb()
1842 sp->done(sp, res); in qla2x00_abort_srb()
1846 sp->done(sp, res); in qla2x00_abort_srb()
1850 sp->done(sp, res); in qla2x00_abort_srb()
1864 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1865 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1867 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1870 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1872 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1873 req = qp->req; in __qla2x00_abort_all_cmds()
1874 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1875 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1881 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1882 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1883 sp->done(sp, res); in __qla2x00_abort_all_cmds()
1884 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1888 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1893 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1896 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1897 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1901 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1909 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1912 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1923 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1926 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1928 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1930 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1932 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1933 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1936 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1946 return -ENXIO; in qla2xxx_slave_alloc()
1948 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_slave_alloc()
1956 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_slave_configure()
1957 struct req_que *req = vha->req; in qla2xxx_slave_configure()
1959 if (IS_T10_PI_CAPABLE(vha->hw)) in qla2xxx_slave_configure()
1960 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); in qla2xxx_slave_configure()
1962 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_slave_configure()
1969 sdev->hostdata = NULL; in qla2xxx_slave_destroy()
1973 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1983 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1985 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1986 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1987 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1988 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1990 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1991 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1992 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1997 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1998 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
2005 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
2007 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2008 ha->interrupts_on = 1; in qla2x00_enable_intrs()
2010 wrt_reg_word(®->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
2011 rd_reg_word(®->ictrl); in qla2x00_enable_intrs()
2012 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2020 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
2022 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2023 ha->interrupts_on = 0; in qla2x00_disable_intrs()
2025 wrt_reg_word(®->ictrl, 0); in qla2x00_disable_intrs()
2026 rd_reg_word(®->ictrl); in qla2x00_disable_intrs()
2027 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2034 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
2036 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2037 ha->interrupts_on = 1; in qla24xx_enable_intrs()
2038 wrt_reg_dword(®->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
2039 rd_reg_dword(®->ictrl); in qla24xx_enable_intrs()
2040 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2047 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
2051 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2052 ha->interrupts_on = 0; in qla24xx_disable_intrs()
2053 wrt_reg_dword(®->ictrl, 0); in qla24xx_disable_intrs()
2054 rd_reg_dword(®->ictrl); in qla24xx_disable_intrs()
2055 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2064 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
2066 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
2068 pci_name(ha->pdev)); in qla2x00_iospace_config()
2071 if (!(ha->bars & 1)) in qla2x00_iospace_config()
2075 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
2076 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
2077 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2078 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
2080 pci_name(ha->pdev)); in qla2x00_iospace_config()
2084 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
2086 pci_name(ha->pdev)); in qla2x00_iospace_config()
2089 ha->pio_address = pio; in qla2x00_iospace_config()
2090 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
2092 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2096 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2097 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2099 pci_name(ha->pdev)); in qla2x00_iospace_config()
2102 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2103 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2105 pci_name(ha->pdev)); in qla2x00_iospace_config()
2109 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2110 if (!ha->iobase) { in qla2x00_iospace_config()
2111 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2113 pci_name(ha->pdev)); in qla2x00_iospace_config()
2118 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2119 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2122 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2129 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2130 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2131 if (ha->mqiobase) { in qla2x00_iospace_config()
2132 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2133 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2135 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2136 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2139 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2140 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2142 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2143 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2144 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2146 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2147 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2149 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2153 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2154 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2158 return (-ENOMEM); in qla2x00_iospace_config()
2167 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2169 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2171 pci_name(ha->pdev)); in qla83xx_iospace_config()
2177 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2178 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2180 pci_name(ha->pdev)); in qla83xx_iospace_config()
2183 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2184 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2186 pci_name(ha->pdev)); in qla83xx_iospace_config()
2190 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2191 if (!ha->iobase) { in qla83xx_iospace_config()
2192 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2194 pci_name(ha->pdev)); in qla83xx_iospace_config()
2198 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2200 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2201 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2202 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2203 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2204 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2206 if (!ha->mqiobase) { in qla83xx_iospace_config()
2207 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2212 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2213 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2214 if (ha->msixbase) { in qla83xx_iospace_config()
2216 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2218 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2225 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2229 ha->max_req_queues--; in qla83xx_iospace_config()
2231 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2235 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2236 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2237 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2239 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2240 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2242 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2246 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2247 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2251 return -ENOMEM; in qla83xx_iospace_config()
2648 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2649 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2651 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2652 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2653 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2656 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2657 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2658 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2661 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2662 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2663 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2666 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2667 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2668 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2671 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2672 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2673 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2674 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2675 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2676 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2679 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2680 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2683 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2684 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2687 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2688 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2689 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2690 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2691 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2694 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2695 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2696 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2697 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2698 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2701 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2702 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2703 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2704 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2705 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2708 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2709 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2710 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2713 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2714 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2715 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2718 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2719 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2720 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2721 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2722 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2725 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2726 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2727 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2728 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2729 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2732 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2733 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2734 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2735 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2740 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2741 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2742 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2743 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2748 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2749 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2750 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2751 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2752 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2753 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2756 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2757 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2758 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2759 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2760 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2761 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2764 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2767 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2768 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2769 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2770 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2771 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2772 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2775 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2776 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2777 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2778 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2779 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2780 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2783 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2784 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2785 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2786 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2787 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2788 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2792 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2793 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2794 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2795 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2796 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2797 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2801 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2802 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2803 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2804 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2805 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2806 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2811 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2814 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2817 ha->port_no--; in qla2x00_set_isp_flags()
2819 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2822 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2824 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2832 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2835 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2836 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2837 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2838 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2846 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2848 if (!vha->host) in qla2xxx_scan_finished()
2850 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2853 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2860 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_heartbeat_work_fn()
2862 if (!ha->flags.mbox_busy && base_vha->flags.init_done) in qla_heartbeat_work_fn()
2870 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2871 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2875 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2878 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2880 i--; in qla2x00_iocb_work_fn()
2883 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2884 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2885 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2915 int ret = -ENODEV; in qla2x00_probe_one()
2930 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2931 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2932 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2933 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2934 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2935 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2936 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2937 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2938 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2939 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2940 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2941 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2942 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2943 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2944 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2945 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2946 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2947 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2948 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2978 ha->pdev = pdev; in qla2x00_probe_one()
2979 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2980 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2981 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2982 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2984 spin_lock_init(&ha->sadb_lock); in qla2x00_probe_one()
2985 INIT_LIST_HEAD(&ha->sadb_tx_index_list); in qla2x00_probe_one()
2986 INIT_LIST_HEAD(&ha->sadb_rx_index_list); in qla2x00_probe_one()
2988 spin_lock_init(&ha->sadb_fp_lock); in qla2x00_probe_one()
2995 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2998 ha->bars = bars; in qla2x00_probe_one()
2999 ha->mem_only = mem_only; in qla2x00_probe_one()
3000 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
3001 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
3002 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
3003 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
3005 /* Set ISP-type information. */ in qla2x00_probe_one()
3011 pdev->needs_freset = 1; in qla2x00_probe_one()
3013 ha->prev_topology = 0; in qla2x00_probe_one()
3014 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
3015 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
3016 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
3017 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
3018 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
3019 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
3020 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
3021 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
3022 INIT_LIST_HEAD(&ha->tmf_pending); in qla2x00_probe_one()
3023 INIT_LIST_HEAD(&ha->tmf_active); in qla2x00_probe_one()
3027 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3028 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
3031 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3032 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3033 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3034 ha->flash_data_off = ~0; in qla2x00_probe_one()
3035 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3036 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3037 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3039 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3040 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
3043 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3044 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3045 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3046 ha->flash_data_off = ~0; in qla2x00_probe_one()
3047 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3048 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3049 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3051 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3052 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3055 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3056 ha->gid_list_info_size = 6; in qla2x00_probe_one()
3058 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
3059 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3060 ha->flash_data_off = ~0; in qla2x00_probe_one()
3061 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3062 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3063 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
3065 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3066 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3069 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3070 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3071 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3072 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3073 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
3074 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
3075 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
3076 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3077 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3078 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3079 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3081 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3082 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3085 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3086 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3087 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3088 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3089 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
3090 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3091 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
3092 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3093 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3094 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3095 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3097 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3098 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3101 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3102 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3103 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3104 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3105 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
3106 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3107 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
3108 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3109 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3110 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3111 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3113 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3114 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3117 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3118 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3119 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3120 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
3121 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3122 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
3123 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3124 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3125 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3126 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3128 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3129 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3132 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3133 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3134 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3135 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3136 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3137 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
3138 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3139 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3140 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3141 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3143 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3144 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3145 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3148 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3149 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3150 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3151 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3152 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3153 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3154 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3155 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3156 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3157 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3158 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3160 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3161 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3162 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3165 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3166 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3167 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3168 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3169 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3170 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3171 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3172 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3174 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3175 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3176 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3179 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3180 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3181 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3182 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3183 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3184 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3185 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3186 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3187 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3188 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3189 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3191 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3192 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3193 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3196 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3197 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3198 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3199 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3200 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3201 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3202 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3203 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3204 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3205 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3206 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3214 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3215 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3216 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3220 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3221 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3224 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3230 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3231 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3232 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3233 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3234 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3235 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3236 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3237 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3239 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3244 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3254 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3256 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3261 ret = -ENOMEM; in qla2x00_probe_one()
3266 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3268 host = base_vha->host; in qla2x00_probe_one()
3269 base_vha->req = req; in qla2x00_probe_one()
3271 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3274 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3275 base_vha->vp_idx; in qla2x00_probe_one()
3278 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3279 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3280 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3281 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3282 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3283 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3292 host->sg_tablesize = 32; in qla2x00_probe_one()
3295 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3297 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3298 host->cmd_per_lun = 3; in qla2x00_probe_one()
3299 host->unique_id = host->host_no; in qla2x00_probe_one()
3308 host->max_cmd_len = 32; in qla2x00_probe_one()
3310 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3311 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3312 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3315 host->max_lun = 0xffff; in qla2x00_probe_one()
3317 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3318 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3319 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3324 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3325 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3326 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3327 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3329 INIT_WORK(&ha->heartbeat_work, qla_heartbeat_work_fn); in qla2x00_probe_one()
3342 ret = -ENODEV; in qla2x00_probe_one()
3346 if (ha->mqenable) { in qla2x00_probe_one()
3347 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3348 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3351 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3354 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3356 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3357 host->nr_hw_queues); in qla2x00_probe_one()
3360 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3369 rsp->req = req; in qla2x00_probe_one()
3370 req->rsp = rsp; in qla2x00_probe_one()
3373 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3374 ha->req_q_map[0] = req; in qla2x00_probe_one()
3375 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3376 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3379 /* FWI2-capable only. */ in qla2x00_probe_one()
3380 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3381 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3382 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3383 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3384 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3386 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3387 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3388 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3389 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3393 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3394 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3395 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3396 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3400 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3401 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3402 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3406 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3407 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3409 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3410 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3411 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3412 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3414 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3415 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3417 "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()
3418 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3420 ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); in qla2x00_probe_one()
3421 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3422 ret = -ENOMEM; in qla2x00_probe_one()
3426 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3428 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3429 base_vha->device_flags); in qla2x00_probe_one()
3448 ret = -ENODEV; in qla2x00_probe_one()
3453 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3455 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3459 host->can_queue, base_vha->req, in qla2x00_probe_one()
3460 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3463 if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6)) in qla2x00_probe_one()
3464 ha->mqenable = 0; in qla2x00_probe_one()
3466 if (ha->mqenable) { in qla2x00_probe_one()
3476 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3481 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3487 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3488 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3489 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3492 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3493 ha->dpc_thread = NULL; in qla2x00_probe_one()
3507 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3510 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3511 ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3512 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3514 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3515 ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3516 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3517 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3519 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3524 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3525 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3537 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3540 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3565 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3568 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3572 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3573 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3577 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3581 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3582 base_vha->flags.online = 1; in qla2x00_probe_one()
3583 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3593 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3599 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3603 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3611 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3614 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3616 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3617 base_vha->host_no, in qla2x00_probe_one()
3618 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3622 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3624 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3625 return -ENODEV; in qla2x00_probe_one()
3632 vfree(base_vha->scan.l); in qla2x00_probe_one()
3633 if (base_vha->gnl.l) { in qla2x00_probe_one()
3634 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3635 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3636 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3639 if (base_vha->timer_active) in qla2x00_probe_one()
3641 base_vha->flags.online = 0; in qla2x00_probe_one()
3642 if (ha->dpc_thread) { in qla2x00_probe_one()
3643 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3645 ha->dpc_thread = NULL; in qla2x00_probe_one()
3650 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3668 if (!ha->nx_pcibase) in qla2x00_probe_one()
3669 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3671 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3673 if (ha->iobase) in qla2x00_probe_one()
3674 iounmap(ha->iobase); in qla2x00_probe_one()
3675 if (ha->cregbase) in qla2x00_probe_one()
3676 iounmap(ha->cregbase); in qla2x00_probe_one()
3678 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3695 ha = base_vha->hw; in __qla_set_remove_flag()
3697 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3698 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3699 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3705 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3706 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3716 ha = vha->hw; in qla2x00_shutdown()
3726 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3728 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3735 /* Turn-off FCE trace */ in qla2x00_shutdown()
3736 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3738 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3741 /* Turn-off EFT trace */ in qla2x00_shutdown()
3742 if (ha->eft) in qla2x00_shutdown()
3747 if (ha->flags.fw_started) in qla2x00_shutdown()
3755 if (vha->timer_active) in qla2x00_shutdown()
3759 vha->flags.online = 0; in qla2x00_shutdown()
3761 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3762 if (ha->interrupts_on) { in qla2x00_shutdown()
3763 vha->flags.init_done = 0; in qla2x00_shutdown()
3764 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3783 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3784 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3785 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3787 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3788 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3789 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3790 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3792 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3793 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3797 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3798 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3800 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3802 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3810 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3811 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3812 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3813 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3816 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3817 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3818 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3819 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3820 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3821 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3825 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3826 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3829 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3832 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3842 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3844 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3846 if (ha->iobase) in qla2x00_unmap_iobases()
3847 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3849 if (ha->cregbase) in qla2x00_unmap_iobases()
3850 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3852 if (ha->mqiobase) in qla2x00_unmap_iobases()
3853 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3855 if (ha->msixbase) in qla2x00_unmap_iobases()
3856 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3881 ha = base_vha->hw; in qla2x00_remove_one()
3885 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3888 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3892 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3893 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3894 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3895 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3896 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3907 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3912 if (ha->flags.fw_started) in qla2x00_remove_one()
3920 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3930 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3931 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3933 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3937 vfree(base_vha->scan.l); in qla2x00_remove_one()
3949 if (base_vha->timer_active) in qla2x00_remove_one()
3952 base_vha->flags.online = 0; in qla2x00_remove_one()
3955 if (ha->exlogin_buf) in qla2x00_remove_one()
3959 if (ha->exchoffld_buf) in qla2x00_remove_one()
3968 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3970 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3976 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3980 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3992 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3993 list_for_each_entry_safe(item, next, &list->head, list) { in qla24xx_free_purex_list()
3994 list_del(&item->list); in qla24xx_free_purex_list()
3995 if (item == &item->vha->default_item) in qla24xx_free_purex_list()
3999 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
4005 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
4010 if (vha->timer_active) in qla2x00_free_device()
4014 vha->flags.online = 0; in qla2x00_free_device()
4016 /* turn-off interrupts on the card */ in qla2x00_free_device()
4017 if (ha->interrupts_on) { in qla2x00_free_device()
4018 vha->flags.init_done = 0; in qla2x00_free_device()
4019 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
4027 if (ha->wq) { in qla2x00_free_device()
4028 destroy_workqueue(ha->wq); in qla2x00_free_device()
4029 ha->wq = NULL; in qla2x00_free_device()
4033 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
4049 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
4058 if (!fcport->rport) in qla2x00_schedule_rport_del()
4061 if (fcport->rport) { in qla2x00_schedule_rport_del()
4062 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
4064 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
4065 fcport->rport->roles); in qla2x00_schedule_rport_del()
4066 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
4083 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
4089 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
4090 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
4099 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
4105 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
4116 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
4118 fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
4119 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
4120 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
4124 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
4125 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
4128 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
4141 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4142 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4143 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4162 ha->vp_map = kcalloc(MAX_MULTI_ID_FABRIC, sizeof(struct qla_vp_map), GFP_KERNEL); in qla2x00_mem_alloc()
4163 if (!ha->vp_map) in qla2x00_mem_alloc()
4167 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
4168 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4169 if (!ha->init_cb) in qla2x00_mem_alloc()
4172 rc = btree_init32(&ha->host_map); in qla2x00_mem_alloc()
4179 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4180 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4181 if (!ha->gid_list) in qla2x00_mem_alloc()
4184 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4185 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4197 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4199 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4201 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4203 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4207 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4208 if (!ha->nvram) in qla2x00_mem_alloc()
4212 ha->pdev->device); in qla2x00_mem_alloc()
4213 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4215 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4218 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4220 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4223 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4225 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4226 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4231 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4233 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4234 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4244 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4245 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4246 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4247 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4253 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4254 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4255 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4256 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4260 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4263 return -ENOMEM; in qla2x00_mem_alloc()
4265 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4267 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4268 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4269 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4270 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4271 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4273 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4276 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4279 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4285 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4286 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4287 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4288 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4289 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4291 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4292 &ha->pool.good.head); in qla2x00_mem_alloc()
4293 ha->pool.good.count++; in qla2x00_mem_alloc()
4299 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4300 list_del(&dsd->list); in qla2x00_mem_alloc()
4301 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4302 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4303 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4305 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4308 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4310 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4311 ha->pool.unusable.count); in qla2x00_mem_alloc()
4314 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4316 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4317 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4323 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4324 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4325 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4327 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4328 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4331 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4332 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4333 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4336 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4337 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4338 if (!ha->ct_sns) in qla2x00_mem_alloc()
4340 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4342 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4348 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4352 (*req)->length = req_len; in qla2x00_mem_alloc()
4353 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4354 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4355 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4356 if (!(*req)->ring) { in qla2x00_mem_alloc()
4357 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4364 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4368 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4369 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4370 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4371 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4372 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4373 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4374 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4378 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4379 (*rsp)->req = *req; in qla2x00_mem_alloc()
4380 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4381 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4382 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4383 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4384 (*rsp)->ring); in qla2x00_mem_alloc()
4386 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4387 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4390 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4391 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4396 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4398 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4401 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4402 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4403 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4405 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4406 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4409 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4411 ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4412 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4413 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4415 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4416 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4420 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4422 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4423 &ha->async_pd_dma); in qla2x00_mem_alloc()
4424 if (!ha->async_pd) in qla2x00_mem_alloc()
4426 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4427 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4430 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4433 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4436 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4440 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4441 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4444 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4445 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4446 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4447 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4448 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4452 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4453 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4455 if (!ha->flt) { in qla2x00_mem_alloc()
4456 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4462 ha->purex_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4465 if (!ha->purex_dma_pool) { in qla2x00_mem_alloc()
4466 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4471 ha->elsrej.size = sizeof(struct fc_els_ls_rjt) + 16; in qla2x00_mem_alloc()
4472 ha->elsrej.c = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4473 ha->elsrej.size, in qla2x00_mem_alloc()
4474 &ha->elsrej.cdma, in qla2x00_mem_alloc()
4476 if (!ha->elsrej.c) { in qla2x00_mem_alloc()
4477 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4481 ha->elsrej.c->er_cmd = ELS_LS_RJT; in qla2x00_mem_alloc()
4482 ha->elsrej.c->er_reason = ELS_RJT_LOGIC; in qla2x00_mem_alloc()
4483 ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; in qla2x00_mem_alloc()
4485 ha->lsrjt.size = sizeof(struct fcnvme_ls_rjt); in qla2x00_mem_alloc()
4486 ha->lsrjt.c = dma_alloc_coherent(&ha->pdev->dev, ha->lsrjt.size, in qla2x00_mem_alloc()
4487 &ha->lsrjt.cdma, GFP_KERNEL); in qla2x00_mem_alloc()
4488 if (!ha->lsrjt.c) { in qla2x00_mem_alloc()
4489 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4497 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_alloc()
4498 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_alloc()
4500 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_alloc()
4502 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4503 ha->flt, ha->flt_dma); in qla2x00_mem_alloc()
4506 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4507 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4509 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4511 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4513 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4515 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4517 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4519 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4520 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4521 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4522 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4527 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4528 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4529 (*req)->ring = NULL; in qla2x00_mem_alloc()
4530 (*req)->dma = 0; in qla2x00_mem_alloc()
4535 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4536 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4537 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4538 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4540 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4541 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4542 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4544 if (ha->sns_cmd) in qla2x00_mem_alloc()
4545 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4546 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4551 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4553 list_del(&dsd->list); in qla2x00_mem_alloc()
4554 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4555 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4556 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4558 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4559 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4561 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4562 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4567 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4568 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4572 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4573 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4576 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4577 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4579 kfree(ha->nvram); in qla2x00_mem_alloc()
4580 ha->nvram = NULL; in qla2x00_mem_alloc()
4582 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4583 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4585 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4586 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4588 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4589 ha->gid_list, in qla2x00_mem_alloc()
4590 ha->gid_list_dma); in qla2x00_mem_alloc()
4591 ha->gid_list = NULL; in qla2x00_mem_alloc()
4592 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4596 btree_destroy32(&ha->host_map); in qla2x00_mem_alloc()
4598 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4599 ha->init_cb_dma); in qla2x00_mem_alloc()
4600 ha->init_cb = NULL; in qla2x00_mem_alloc()
4601 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4603 kfree(ha->vp_map); in qla2x00_mem_alloc()
4607 return -ENOMEM; in qla2x00_mem_alloc()
4616 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4629 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4637 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4639 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4646 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4649 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4650 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4651 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4652 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4654 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4659 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4678 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4679 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4680 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4681 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4682 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4690 struct init_cb_81xx *icb = (struct init_cb_81xx *)&vha->hw->init_cb; in qla2x00_number_of_exch()
4693 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4694 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4697 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4698 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4700 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4701 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4704 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4705 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4706 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4709 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4710 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4712 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4714 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4715 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4717 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4731 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4733 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4742 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4753 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4756 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4757 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4761 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4769 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4772 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4773 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4774 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4775 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4778 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4780 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4781 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4783 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4785 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4786 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4789 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4791 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4793 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4796 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4797 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4800 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4811 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4812 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4815 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4817 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4832 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4833 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4834 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4835 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4836 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4850 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4853 if (ha->fce) in qla2x00_free_fw_dump()
4854 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4855 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4857 if (ha->eft) in qla2x00_free_fw_dump()
4858 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4859 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4861 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4863 ha->fce = NULL; in qla2x00_free_fw_dump()
4864 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4865 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4866 ha->eft = NULL; in qla2x00_free_fw_dump()
4867 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4868 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4869 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4870 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4871 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4872 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4875 vfree(fwdt->template); in qla2x00_free_fw_dump()
4876 fwdt->template = NULL; in qla2x00_free_fw_dump()
4877 fwdt->length = 0; in qla2x00_free_fw_dump()
4893 if (ha->mctp_dump) in qla2x00_mem_free()
4894 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4895 ha->mctp_dump_dma); in qla2x00_mem_free()
4896 ha->mctp_dump = NULL; in qla2x00_mem_free()
4898 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4899 ha->srb_mempool = NULL; in qla2x00_mem_free()
4901 if (ha->dcbx_tlv) in qla2x00_mem_free()
4902 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4903 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4904 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4906 if (ha->xgmac_data) in qla2x00_mem_free()
4907 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4908 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4909 ha->xgmac_data = NULL; in qla2x00_mem_free()
4911 if (ha->sns_cmd) in qla2x00_mem_free()
4912 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4913 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4914 ha->sns_cmd = NULL; in qla2x00_mem_free()
4915 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4917 if (ha->ct_sns) in qla2x00_mem_free()
4918 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4919 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4920 ha->ct_sns = NULL; in qla2x00_mem_free()
4921 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4923 if (ha->sfp_data) in qla2x00_mem_free()
4924 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4925 ha->sfp_data_dma); in qla2x00_mem_free()
4926 ha->sfp_data = NULL; in qla2x00_mem_free()
4928 if (ha->flt) in qla2x00_mem_free()
4929 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4931 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4932 ha->flt = NULL; in qla2x00_mem_free()
4933 ha->flt_dma = 0; in qla2x00_mem_free()
4935 if (ha->ms_iocb) in qla2x00_mem_free()
4936 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4937 ha->ms_iocb = NULL; in qla2x00_mem_free()
4938 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4940 if (ha->sf_init_cb) in qla2x00_mem_free()
4941 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4942 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4944 if (ha->ex_init_cb) in qla2x00_mem_free()
4945 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4946 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4947 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4948 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4950 if (ha->async_pd) in qla2x00_mem_free()
4951 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4952 ha->async_pd = NULL; in qla2x00_mem_free()
4953 ha->async_pd_dma = 0; in qla2x00_mem_free()
4955 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4956 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4958 if (ha->gid_list) in qla2x00_mem_free()
4959 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4960 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4961 ha->gid_list = NULL; in qla2x00_mem_free()
4962 ha->gid_list_dma = 0; in qla2x00_mem_free()
4964 if (ha->base_qpair && !list_empty(&ha->base_qpair->dsd_list)) { in qla2x00_mem_free()
4969 &ha->base_qpair->dsd_list, list) { in qla2x00_mem_free()
4970 dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, in qla2x00_mem_free()
4971 dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4972 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4977 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4978 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4980 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4981 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4983 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4984 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4986 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4989 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4991 list_del(&dsd->list); in qla2x00_mem_free()
4992 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4993 dsd->dsd_list_dma); in qla2x00_mem_free()
4994 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4996 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4997 ha->pool.unusable.count--; in qla2x00_mem_free()
4999 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
5000 list_del(&dsd->list); in qla2x00_mem_free()
5001 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
5002 dsd->dsd_list_dma); in qla2x00_mem_free()
5003 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
5005 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
5009 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
5010 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
5015 if (ha->init_cb) in qla2x00_mem_free()
5016 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
5017 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
5019 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_free()
5020 ha->purex_dma_pool = NULL; in qla2x00_mem_free()
5022 if (ha->elsrej.c) { in qla2x00_mem_free()
5023 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_free()
5024 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_free()
5025 ha->elsrej.c = NULL; in qla2x00_mem_free()
5028 if (ha->lsrjt.c) { in qla2x00_mem_free()
5029 dma_free_coherent(&ha->pdev->dev, ha->lsrjt.size, ha->lsrjt.c, in qla2x00_mem_free()
5030 ha->lsrjt.cdma); in qla2x00_mem_free()
5031 ha->lsrjt.c = NULL; in qla2x00_mem_free()
5034 ha->init_cb = NULL; in qla2x00_mem_free()
5035 ha->init_cb_dma = 0; in qla2x00_mem_free()
5037 vfree(ha->optrom_buffer); in qla2x00_mem_free()
5038 ha->optrom_buffer = NULL; in qla2x00_mem_free()
5039 kfree(ha->nvram); in qla2x00_mem_free()
5040 ha->nvram = NULL; in qla2x00_mem_free()
5041 kfree(ha->npiv_info); in qla2x00_mem_free()
5042 ha->npiv_info = NULL; in qla2x00_mem_free()
5043 kfree(ha->swl); in qla2x00_mem_free()
5044 ha->swl = NULL; in qla2x00_mem_free()
5045 kfree(ha->loop_id_map); in qla2x00_mem_free()
5046 ha->sf_init_cb = NULL; in qla2x00_mem_free()
5047 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
5048 ha->loop_id_map = NULL; in qla2x00_mem_free()
5050 kfree(ha->vp_map); in qla2x00_mem_free()
5051 ha->vp_map = NULL; in qla2x00_mem_free()
5062 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
5071 vha->host = host; in qla2x00_create_host()
5072 vha->host_no = host->host_no; in qla2x00_create_host()
5073 vha->hw = ha; in qla2x00_create_host()
5075 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
5076 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
5077 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
5079 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
5080 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
5081 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
5082 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
5083 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
5084 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
5085 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
5086 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
5087 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
5089 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
5090 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
5092 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
5093 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
5094 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
5095 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
5100 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
5101 (ha->max_loop_id + 1); in qla2x00_create_host()
5102 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
5103 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
5104 if (!vha->gnl.l) { in qla2x00_create_host()
5107 scsi_host_put(vha->host); in qla2x00_create_host()
5112 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
5113 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
5114 if (!vha->scan.l) { in qla2x00_create_host()
5117 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
5118 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
5119 vha->gnl.l = NULL; in qla2x00_create_host()
5120 scsi_host_put(vha->host); in qla2x00_create_host()
5123 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
5125 snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", in qla2x00_create_host()
5126 QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
5129 vha->host, vha->hw, vha, in qla2x00_create_host()
5130 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
5140 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
5152 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
5153 e->type = type; in qla2x00_alloc_work()
5154 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
5164 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
5165 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
5167 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
5170 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
5173 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
5188 e->u.aen.code = code; in qla2x00_post_aen_work()
5189 e->u.aen.data = data; in qla2x00_post_aen_work()
5202 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
5217 e->u.logio.fcport = fcport; \
5219 e->u.logio.data[0] = data[0]; \
5220 e->u.logio.data[1] = data[1]; \
5222 fcport->flags |= FCF_ASYNC_ACTIVE; \
5241 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5254 vha->host_no); in qla2x00_uevent_emit()
5260 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5273 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5274 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5275 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5283 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5286 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5287 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5288 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5291 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5292 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5293 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5295 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5297 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5306 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5311 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5313 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5314 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5316 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5318 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5319 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5320 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5326 pla->ref_count--; in qla24xx_create_new_sess()
5329 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5332 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5333 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5334 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5335 fcport->tgt_short_link_down_cnt = 0; in qla24xx_create_new_sess()
5337 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5340 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5341 if (NVME_PRIORITY(vha->hw, fcport)) in qla24xx_create_new_sess()
5342 fcport->do_prli_nvme = 1; in qla24xx_create_new_sess()
5344 fcport->do_prli_nvme = 0; in qla24xx_create_new_sess()
5346 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5347 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5349 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5350 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5351 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5352 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5358 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5361 list_del(&pla->list); in qla24xx_create_new_sess()
5367 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5370 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5375 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5376 tfcp->fw_login_state); in qla24xx_create_new_sess()
5380 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5386 pla->ref_count--; in qla24xx_create_new_sess()
5389 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5392 fcport->id_changed = 1; in qla24xx_create_new_sess()
5393 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5394 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5395 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5398 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5401 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5402 fcport->local = 0; in qla24xx_create_new_sess()
5403 fcport->loop_id = in qla24xx_create_new_sess()
5405 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5406 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5409 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5412 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5415 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5417 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5423 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5425 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5432 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5433 tfcp->fw_login_state); in qla24xx_create_new_sess()
5435 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5439 fcport->login_pause = 1; in qla24xx_create_new_sess()
5440 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5443 fcport->login_pause = 1; in qla24xx_create_new_sess()
5444 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5449 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5453 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5454 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5455 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5456 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5457 fcport->fc4_type = in qla24xx_create_new_sess()
5459 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5461 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5463 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5473 list_del(&pla->list); in qla24xx_create_new_sess()
5481 struct srb *sp = e->u.iosb.sp; in qla_sp_retry()
5487 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5488 __func__, sp->name, rval); in qla_sp_retry()
5501 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5502 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5503 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5507 switch (e->type) { in qla2x00_do_work()
5509 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5510 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5513 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5516 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5517 e->u.logio.data); in qla2x00_do_work()
5520 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5523 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5524 e->u.logio.data); in qla2x00_do_work()
5527 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5533 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5542 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5543 e->u.fcport.opt); in qla2x00_do_work()
5546 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5549 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5552 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5558 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5561 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5562 e->u.logio.data); in qla2x00_do_work()
5565 qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, in qla2x00_do_work()
5566 e->u.gpnft.sp); in qla2x00_do_work()
5569 qla24xx_async_gpnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5572 qla24xx_async_gnnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5575 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5581 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5585 e->u.fcport.fcport, false); in qla2x00_do_work()
5593 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5594 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5595 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5596 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5599 list_del_init(&e->list); in qla2x00_do_work()
5600 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5615 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5631 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5636 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5637 fcport->login_retry) { in qla2x00_relogin()
5638 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5639 fcport->disc_state == DSC_LOGIN_AUTH_PEND || in qla2x00_relogin()
5640 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5643 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5644 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5647 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5651 } else if (vha->hw->current_topology == in qla2x00_relogin()
5653 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5656 } else if (vha->hw->current_topology == in qla2x00_relogin()
5658 fcport->login_retry--; in qla2x00_relogin()
5663 fcport->old_loop_id = in qla2x00_relogin()
5664 fcport->loop_id; in qla2x00_relogin()
5667 fcport->loop_id); in qla2x00_relogin()
5672 &vha->dpc_flags); in qla2x00_relogin()
5676 fcport->login_retry, in qla2x00_relogin()
5677 fcport->loop_id); in qla2x00_relogin()
5679 fcport->login_retry = 0; in qla2x00_relogin()
5682 if (fcport->login_retry == 0 && in qla2x00_relogin()
5688 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5693 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5699 /* Schedule work on any of the dpc-workqueues */
5703 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5707 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5708 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5712 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5713 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5714 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5721 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5722 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5725 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5726 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5730 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5742 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5748 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5749 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5764 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5810 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5816 "Failed to dump mctp\n"); in qla83xx_nic_core_reset_work()
5820 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5833 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5839 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5849 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5885 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5897 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5910 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5923 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5928 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5983 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5987 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5992 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5994 ha->portnum); in qla83xx_idc_lock()
6002 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
6022 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
6025 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
6026 /* if RDP request is not from Domain Controller: */ in qla25xx_rdp_rsp_reduce_size()
6037 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
6040 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
6041 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
6051 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
6076 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
6078 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
6095 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
6107 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6115 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6123 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6126 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6130 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
6131 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
6132 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
6133 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
6134 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
6135 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
6136 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
6137 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
6138 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
6139 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
6140 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
6141 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
6143 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
6144 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
6145 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
6147 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
6148 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
6149 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
6151 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
6152 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
6154 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
6155 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
6158 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
6159 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
6160 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
6163 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6164 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
6165 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
6166 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
6167 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6170 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6171 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
6172 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
6173 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
6174 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6177 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
6178 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6179 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
6186 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
6204 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
6211 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
6212 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
6213 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
6214 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
6215 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
6220 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
6221 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
6222 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
6223 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
6225 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
6229 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
6230 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
6231 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
6236 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
6237 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
6238 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
6239 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
6240 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6241 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6242 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6243 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6244 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6245 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6246 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6247 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6248 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6253 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6254 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6255 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6256 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6257 vha->node_name, in qla24xx_process_purex_rdp()
6258 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6259 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6260 vha->port_name, in qla24xx_process_purex_rdp()
6261 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6263 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6264 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6265 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6266 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6267 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6268 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6269 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6270 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6271 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6272 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6275 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6276 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6277 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6278 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6279 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6280 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6282 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6284 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6285 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6292 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6293 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6294 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6296 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6297 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6298 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6300 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6301 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6302 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6304 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6305 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6306 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6308 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6309 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6310 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6319 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6320 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6321 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6322 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6323 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6327 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6328 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6329 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6330 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6331 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6335 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6336 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6337 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6338 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6339 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6343 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6344 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6345 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6346 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6347 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6351 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6352 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6353 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6354 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6355 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6363 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6371 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6379 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6387 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6395 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6405 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6406 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6407 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6413 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6415 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6416 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6418 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6419 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6421 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6422 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6424 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6430 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6432 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6440 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6444 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6452 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6453 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6455 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6456 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6457 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6464 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6467 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6470 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6473 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6480 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6481 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6492 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6493 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6494 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6497 list_del(&item->list); in qla24xx_process_purex_list()
6498 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6514 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6518 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6525 if (data == ha->portnum) { in qla83xx_idc_unlock()
6527 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6532 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6540 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6544 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6551 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6556 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6573 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6578 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6602 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6607 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6630 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6634 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6635 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6663 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6675 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6703 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6708 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6709 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6728 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6731 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6734 ha->portnum); in qla83xx_idc_state_handler()
6737 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6740 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6747 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6753 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6756 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6763 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6773 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6780 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6783 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6786 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6818 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6819 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6824 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6827 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6835 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6848 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6851 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6861 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6863 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6865 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6875 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6890 * is kick-off by the driver's detect code and starts up
6905 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6916 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6919 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6922 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6924 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6928 ha->dpc_active = 1; in qla2x00_do_dpc()
6932 base_vha->dpc_flags); in qla2x00_do_dpc()
6934 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6940 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6954 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6967 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6972 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6974 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6975 * Escalate to chip-reset in qla2x00_do_dpc()
6978 &base_vha->dpc_flags); in qla2x00_do_dpc()
6981 &base_vha->dpc_flags); in qla2x00_do_dpc()
6989 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6995 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6997 &base_vha->dpc_flags); in qla2x00_do_dpc()
7006 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7011 &base_vha->dpc_flags)) in qla2x00_do_dpc()
7013 &base_vha->dpc_flags); in qla2x00_do_dpc()
7021 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7025 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
7031 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7033 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
7035 * when a forced chip-reset occurs. in qla2x00_do_dpc()
7036 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
7038 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
7042 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7043 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7046 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
7051 !ha->flags.fw_started) in qla2x00_do_dpc()
7056 !ha->flags.fw_started) in qla2x00_do_dpc()
7064 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7065 base_vha->flags.online = 1; in qla2x00_do_dpc()
7068 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
7071 &base_vha->dpc_flags); in qla2x00_do_dpc()
7074 &base_vha->dpc_flags); in qla2x00_do_dpc()
7080 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7081 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7083 (&base_vha->purex_list); in qla2x00_do_dpc()
7085 &base_vha->dpc_flags); in qla2x00_do_dpc()
7092 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7101 &base_vha->dpc_flags); in qla2x00_do_dpc()
7102 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
7118 &base_vha->dpc_flags); in qla2x00_do_dpc()
7126 &base_vha->dpc_flags) && in qla2x00_do_dpc()
7127 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
7132 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
7138 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7139 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7140 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
7142 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
7143 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
7144 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
7145 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7155 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7163 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7168 &base_vha->dpc_flags); in qla2x00_do_dpc()
7178 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7179 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7180 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7185 if (!ha->interrupts_on) in qla2x00_do_dpc()
7186 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
7189 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7190 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
7191 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
7196 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7197 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
7198 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
7203 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
7204 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
7206 qpair->online = online; in qla2x00_do_dpc()
7207 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
7211 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7212 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
7214 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
7215 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
7231 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7235 ha->dpc_active = 0; in qla2x00_do_dpc()
7247 ha->dpc_active = 0; in qla2x00_do_dpc()
7258 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7259 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7261 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7275 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7276 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7277 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7279 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7285 vha->marker_needed = 1; in qla2x00_rst_aen()
7286 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7287 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7293 struct qla_hw_data *ha = vha->hw; in qla_do_heartbeat()
7302 cmpl_cnt = ha->base_qpair->cmd_completion_cnt; in qla_do_heartbeat()
7303 if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && in qla_do_heartbeat()
7304 cmpl_cnt != ha->base_qpair->cmd_cnt) { in qla_do_heartbeat()
7308 ha->base_qpair->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7310 for (i = 0; i < ha->max_qpairs; i++) { in qla_do_heartbeat()
7311 if (ha->queue_pair_map[i]) { in qla_do_heartbeat()
7312 cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; in qla_do_heartbeat()
7313 if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && in qla_do_heartbeat()
7314 cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { in qla_do_heartbeat()
7318 ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7328 struct qla_hw_data *ha = vha->hw; in qla_heart_beat()
7330 if (vha->vp_idx) in qla_heart_beat()
7333 if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) in qla_heart_beat()
7342 time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) in qla_heart_beat()
7346 ha->last_heartbeat_run_jiffies = jiffies; in qla_heart_beat()
7347 queue_work(ha->wq, &ha->heartbeat_work); in qla_heart_beat()
7353 struct qla_hw_data *ha = vha->hw; in qla_wind_down_chip()
7355 if (!ha->flags.eeh_busy) in qla_wind_down_chip()
7357 if (ha->pci_error_state) in qla_wind_down_chip()
7365 if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handling * HZ) && in qla_wind_down_chip()
7366 !ha->flags.eeh_flush) { in qla_wind_down_chip()
7370 ha->isp_ops->reset_chip(vha); in qla_wind_down_chip()
7371 ha->isp_ops->disable_intrs(ha); in qla_wind_down_chip()
7373 ha->flags.eeh_flush = EEH_FLUSH_RDY; in qla_wind_down_chip()
7374 ha->eeh_jif = jiffies; in qla_wind_down_chip()
7376 } else if (ha->flags.eeh_flush == EEH_FLUSH_RDY && in qla_wind_down_chip()
7377 time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { in qla_wind_down_chip()
7378 pci_clear_master(ha->pdev); in qla_wind_down_chip()
7382 ha->flags.eeh_flush = EEH_FLUSH_DONE; in qla_wind_down_chip()
7406 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7411 if (ha->flags.eeh_busy) { in qla2x00_timer()
7416 ha->flags.eeh_busy); in qla2x00_timer()
7423 * the read returns -1 then disable the board. in qla2x00_timer()
7425 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7426 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7431 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7432 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7440 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7443 if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7444 vha->link_down_time++; in qla2x00_timer()
7446 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7447 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_timer()
7448 if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7449 fcport->tgt_link_down_time++; in qla2x00_timer()
7451 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7454 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7455 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7456 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7457 && vha->flags.online) { in qla2x00_timer()
7459 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7460 vha->loop_down_abort_time) { in qla2x00_timer()
7463 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7465 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7466 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7469 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7472 /* NPIV - scan physical port only */ in qla2x00_timer()
7473 if (!vha->vp_idx) { in qla2x00_timer()
7474 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7476 req = ha->req_q_map[0]; in qla2x00_timer()
7478 index < req->num_outstanding_cmds; in qla2x00_timer()
7482 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7485 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7487 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7489 sfcp = sp->fcport; in qla2x00_timer()
7490 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7495 &vha->dpc_flags); in qla2x00_timer()
7498 &vha->dpc_flags); in qla2x00_timer()
7501 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7508 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7509 if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { in qla2x00_timer()
7511 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7515 &vha->dpc_flags); in qla2x00_timer()
7518 &vha->dpc_flags); in qla2x00_timer()
7522 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7523 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7526 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7529 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7535 if (vha->hw->flags.edif_enabled) in qla2x00_timer()
7539 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7543 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7544 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7546 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7548 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7552 * FC-NVME in qla2x00_timer()
7555 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7556 if (!vha->vp_idx && in qla2x00_timer()
7557 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7558 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7559 !ha->flags.host_shutting_down) { in qla2x00_timer()
7560 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7563 ha->nvme_last_rptd_aen); in qla2x00_timer()
7564 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7568 if (!vha->vp_idx && in qla2x00_timer()
7569 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7573 ha->last_zio_threshold); in qla2x00_timer()
7574 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7575 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7583 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7584 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7586 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7587 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7588 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7589 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7590 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7591 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7592 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7596 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7597 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7598 start_dpc, test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7603 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7604 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7605 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7606 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7607 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7608 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7668 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7699 if (!blob->name) in qla2x00_request_firmware()
7703 if (blob->fw) in qla2x00_request_firmware()
7706 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7708 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7709 blob->fw = NULL; in qla2x00_request_firmware()
7724 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7725 release_firmware(blob->fw); in qla2x00_release_firmware()
7731 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7732 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7741 ha->chip_reset++; in qla_pci_error_cleanup()
7743 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7744 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7745 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7746 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7747 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7755 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7756 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7757 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7758 qpair->online = 0; in qla_pci_error_cleanup()
7760 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7764 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7765 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7766 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7767 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7769 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7770 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7772 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7775 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7776 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7778 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7779 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7780 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7781 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7782 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7783 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7784 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7785 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7787 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7795 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7800 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7802 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7813 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7823 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7826 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7844 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7845 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7846 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7851 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7862 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7864 stat = rd_reg_word(®->hccr); in qla2xxx_pci_mmio_enabled()
7868 stat = rd_reg_dword(®->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7872 stat = rd_reg_dword(®24->host_status); in qla2xxx_pci_mmio_enabled()
7876 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7880 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7895 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7902 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7907 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7916 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7923 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7928 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7931 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7932 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7933 qpair->online = 1; in qla2xxx_pci_slot_reset()
7934 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7936 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7937 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7938 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7939 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7940 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7943 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7962 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7974 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7981 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7982 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7986 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7989 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7990 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7991 ha->eeh_jif = jiffies; in qla_pci_set_eeh_busy()
7992 ha->flags.eeh_flush = 0; in qla_pci_set_eeh_busy()
7994 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7997 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
8009 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
8010 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
8012 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
8015 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
8023 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
8035 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
8036 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
8037 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
8038 qpair->online = 0; in qla_pci_reset_prepare()
8039 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
8041 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
8050 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
8059 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
8060 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
8061 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
8062 qpair->online = 1; in qla_pci_reset_done()
8063 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
8065 base_vha->flags.online = 1; in qla_pci_reset_done()
8066 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
8067 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
8072 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
8073 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
8075 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
8078 blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); in qla2xxx_map_queues()
8102 .this_id = -1,
8173 * qla2x00_module_init - Module initialization.
8273 return -ENOMEM; in qla2x00_module_init()
8293 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
8302 ret = -ENODEV; in qla2x00_module_init()
8317 ret = -ENODEV; in qla2x00_module_init()
8351 * qla2x00_module_exit - Module cleanup.