Lines Matching +full:rx +full:- +full:sched +full:- +full:sp

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
15 #include <linux/blk-mq-pci.h>
60 "beginning. Default is 0 - class 2 not supported.");
72 "a PORT-DOWN status.");
79 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
91 "vary by ISP type. Default is 1 - allocate memory.");
98 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
99 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
100 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
101 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
102 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
103 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
104 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
105 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
106 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
107 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
108 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
109 "\t\t0x1e400000 - Preferred value for capturing essential "
125 "0 - no FDMI registrations. "
126 "1 - provide FDMI registrations (default).");
138 " Enable T10-CRC-DIF:\n"
140 " 0 -- No DIF Support\n"
141 " 1 -- Enable DIF for all types\n"
142 " 2 -- Enable DIF for all types, except Type 0.\n");
152 "0 - no NVMe. Default is Y");
157 " Enable T10-CRC-DIF Error isolation by HBA:\n"
159 " 0 -- Error isolation disabled\n"
160 " 1 -- Error isolation enabled only for DIX Type 0\n"
161 " 2 -- Error isolation enabled for all Types\n");
167 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
181 " 2 -- load firmware via the request_firmware() (hotplug).\n"
183 " 1 -- load firmware from flash.\n"
184 " 0 -- use default semantics.\n");
190 "Default is 0 - skip ETS enablement.");
196 " 0 -- Regular doorbell.\n"
197 " 1 -- CAMRAM doorbell (faster).\n");
203 "Default is 1 - use hw defaults.");
209 "Default is 0 - Do not use GFF_ID information.");
215 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
221 " 0 (Default) -- Reset on failure.\n"
222 " 1 -- Do not reset on failure.\n");
234 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
240 "0 - MiniDump disabled. "
241 "1 (Default) - MiniDump enabled.");
247 "0 (Default)- Disabled.");
264 "1 - Set fw option to hold ABTS.");
269 "Move PUREX, ABTS RX and RIDA IOCBs to ATIOQ"
271 "1 - Move IOCBs.");
282 "Set to enable MSI or MSI-X interrupt mechanism.\n"
283 " Default is 1, enable MSI-X interrupt mechanism.\n"
284 " 0 -- enable traditional pin-based mechanism.\n"
285 " 1 -- enable MSI-X interrupt mechanism.\n"
286 " 2 -- enable MSI interrupt mechanism.\n");
304 " 0 -- Let HBA firmware decide\n"
305 " 1 -- Force T10 CRC\n"
306 " 2 -- Force IP checksum\n");
320 " Default is 0 - No SmartSAN registration,"
321 " 1 - Register SmartSAN Management Attributes.");
328 "0 - no RDP responses (default). "
329 "1 - provide RDP responses.");
348 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
349 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
350 add_timer(&vha->timer); in qla2x00_start_timer()
351 vha->timer_active = 1; in qla2x00_start_timer()
358 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
364 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
370 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
371 vha->timer_active = 0; in qla2x00_stop_timer()
385 /* -------------------------------------------------------------------------- */
389 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
391 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
392 rsp->req = req; in qla_init_base_qpair()
393 ha->base_qpair->hw = ha; in qla_init_base_qpair()
394 ha->base_qpair->req = req; in qla_init_base_qpair()
395 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
396 ha->base_qpair->vha = vha; in qla_init_base_qpair()
397 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
398 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
399 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
400 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
401 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
402 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
404 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
405 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
408 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
414 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
416 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
418 if (!ha->req_q_map) { in qla2x00_alloc_queues()
424 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
426 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
432 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
433 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
441 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
442 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
444 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
455 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
456 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
457 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
458 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
462 kfree(ha->base_qpair); in qla2x00_alloc_queues()
463 ha->base_qpair = NULL; in qla2x00_alloc_queues()
465 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
466 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
468 kfree(ha->req_q_map); in qla2x00_alloc_queues()
469 ha->req_q_map = NULL; in qla2x00_alloc_queues()
471 return -ENOMEM; in qla2x00_alloc_queues()
477 if (req && req->ring_fx00) in qla2x00_free_req_que()
478 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
479 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
480 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
481 } else if (req && req->ring) in qla2x00_free_req_que()
482 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
483 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
484 req->ring, req->dma); in qla2x00_free_req_que()
487 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
495 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
496 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
497 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
498 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
499 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
500 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
501 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
502 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
514 if (ha->queue_pair_map) { in qla2x00_free_queues()
515 kfree(ha->queue_pair_map); in qla2x00_free_queues()
516 ha->queue_pair_map = NULL; in qla2x00_free_queues()
518 if (ha->base_qpair) { in qla2x00_free_queues()
519 kfree(ha->base_qpair); in qla2x00_free_queues()
520 ha->base_qpair = NULL; in qla2x00_free_queues()
523 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
524 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
525 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
528 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
529 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
530 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
532 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
534 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
536 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
538 kfree(ha->req_q_map); in qla2x00_free_queues()
539 ha->req_q_map = NULL; in qla2x00_free_queues()
542 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
543 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
544 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
547 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
548 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
549 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
550 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
552 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
554 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
556 kfree(ha->rsp_q_map); in qla2x00_free_queues()
557 ha->rsp_q_map = NULL; in qla2x00_free_queues()
563 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
569 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
571 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
574 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
587 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
590 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
594 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
620 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
625 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
636 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
638 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
639 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
641 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
646 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
660 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
664 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
673 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
675 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
676 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
680 void qla2x00_sp_free_dma(srb_t *sp) in qla2x00_sp_free_dma() argument
682 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
683 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_sp_free_dma()
685 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
687 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
690 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
691 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
692 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
693 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
696 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
698 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
699 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
702 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
703 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
705 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
706 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
709 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
710 struct ct6_dsd *ctx1 = sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
712 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
713 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
714 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); in qla2x00_sp_free_dma()
715 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
716 ha->gbl_dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
717 mempool_free(ctx1, ha->ctx_mempool); in qla2x00_sp_free_dma()
721 void qla2x00_sp_compl(srb_t *sp, int res) in qla2x00_sp_compl() argument
723 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_sp_compl()
724 struct completion *comp = sp->comp; in qla2x00_sp_compl()
726 sp->free(sp); in qla2x00_sp_compl()
727 cmd->result = res; in qla2x00_sp_compl()
729 cmd->scsi_done(cmd); in qla2x00_sp_compl()
734 void qla2xxx_qpair_sp_free_dma(srb_t *sp) in qla2xxx_qpair_sp_free_dma() argument
736 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2xxx_qpair_sp_free_dma()
737 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
739 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
741 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
744 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
745 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
746 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
747 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
750 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
752 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
753 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
756 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
757 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
761 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
762 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
763 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
764 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
766 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
770 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
771 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
772 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
773 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
775 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
778 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
779 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
780 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
781 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
784 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
785 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
786 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
787 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
789 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
792 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
793 struct ct6_dsd *ctx1 = sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
795 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
796 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
797 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); in qla2xxx_qpair_sp_free_dma()
798 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
799 ha->gbl_dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
800 mempool_free(ctx1, ha->ctx_mempool); in qla2xxx_qpair_sp_free_dma()
801 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
804 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
805 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
807 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
808 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
812 void qla2xxx_qpair_sp_compl(srb_t *sp, int res) in qla2xxx_qpair_sp_compl() argument
814 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2xxx_qpair_sp_compl()
815 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
817 sp->free(sp); in qla2xxx_qpair_sp_compl()
818 cmd->result = res; in qla2xxx_qpair_sp_compl()
820 cmd->scsi_done(cmd); in qla2xxx_qpair_sp_compl()
829 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
830 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
831 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
832 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
833 srb_t *sp; in qla2xxx_queuecommand() local
836 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
838 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
842 if (ha->mqenable) { in qla2xxx_queuecommand()
847 tag = blk_mq_unique_tag(cmd->request); in qla2xxx_queuecommand()
849 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
855 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
856 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
860 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
864 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
871 cmd->result = rval; in qla2xxx_queuecommand()
878 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
883 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
888 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
892 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
893 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
894 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
897 atomic_read(&fcport->state), in qla2xxx_queuecommand()
898 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
899 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
906 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
909 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
911 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
912 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
916 sp = scsi_cmd_priv(cmd); in qla2xxx_queuecommand()
917 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
919 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
920 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
922 CMD_SP(cmd) = (void *)sp; in qla2xxx_queuecommand()
923 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
924 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
926 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
936 sp->free(sp); in qla2xxx_queuecommand()
942 cmd->scsi_done(cmd); in qla2xxx_queuecommand()
953 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
954 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
955 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
956 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
957 srb_t *sp; in qla2xxx_mqueuecommand() local
962 cmd->result = rval; in qla2xxx_mqueuecommand()
970 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
974 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
975 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
976 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
979 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
980 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
981 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
988 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
991 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
993 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
994 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
998 sp = scsi_cmd_priv(cmd); in qla2xxx_mqueuecommand()
999 qla2xxx_init_sp(sp, vha, qpair, fcport); in qla2xxx_mqueuecommand()
1001 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1002 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1003 CMD_SP(cmd) = (void *)sp; in qla2xxx_mqueuecommand()
1004 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1005 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1007 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1019 sp->free(sp); in qla2xxx_mqueuecommand()
1025 sp->free(sp); in qla2xxx_mqueuecommand()
1027 qla2xxx_rel_qpair_sp(sp->qpair, sp); in qla2xxx_mqueuecommand()
1030 cmd->scsi_done(cmd); in qla2xxx_mqueuecommand()
1053 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2x00_eh_wait_on_command()
1054 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_on_command()
1057 if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) { in qla2x00_eh_wait_on_command()
1063 while (CMD_SP(cmd) && wait_iter--) { in qla2x00_eh_wait_on_command()
1079 * ha - pointer to host adapter structure
1082 * Does context switching-Release SPIN_LOCK
1094 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1095 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1098 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1099 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1100 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1101 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1105 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1115 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1119 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1122 vha, vha->fcport_count); in test_fcport_count()
1123 res = (vha->fcport_count == 0); in test_fcport_count()
1124 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1141 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1146 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1154 * ha - pointer to host adapter structure
1157 * Does context switching-Release SPIN_LOCK
1164 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1165 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1167 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1168 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1169 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1170 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1171 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1182 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1183 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1186 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1187 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1188 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1189 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1193 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1194 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1197 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1224 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla2x00_isp_reg_stat()
1225 struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82; in qla2x00_isp_reg_stat()
1228 return ((rd_reg_dword(&reg82->host_int)) == ISP_REG_DISCONNECT); in qla2x00_isp_reg_stat()
1230 return ((rd_reg_dword(&reg->host_status)) == in qla2x00_isp_reg_stat()
1252 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1254 srb_t *sp; in qla2xxx_eh_abort() local
1259 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1274 sp = scsi_cmd_priv(cmd); in qla2xxx_eh_abort()
1275 qpair = sp->qpair; in qla2xxx_eh_abort()
1277 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1280 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1281 sp->comp = &comp; in qla2xxx_eh_abort()
1282 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1285 id = cmd->device->id; in qla2xxx_eh_abort()
1286 lun = cmd->device->lun; in qla2xxx_eh_abort()
1289 "Aborting from RISC nexus=%ld:%d:%llu sp=%p cmd=%p handle=%x\n", in qla2xxx_eh_abort()
1290 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1293 * Abort will release the original Command/sp from FW. Let the in qla2xxx_eh_abort()
1297 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1303 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1310 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1321 sp->comp = NULL; in qla2xxx_eh_abort()
1324 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1325 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1339 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1341 srb_t *sp; in qla2x00_eh_wait_for_pending_commands() local
1346 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1347 req = vha->req; in qla2x00_eh_wait_for_pending_commands()
1349 cnt < req->num_outstanding_cmds; cnt++) { in qla2x00_eh_wait_for_pending_commands()
1350 sp = req->outstanding_cmds[cnt]; in qla2x00_eh_wait_for_pending_commands()
1351 if (!sp) in qla2x00_eh_wait_for_pending_commands()
1353 if (sp->type != SRB_SCSI_CMD) in qla2x00_eh_wait_for_pending_commands()
1355 if (vha->vp_idx != sp->vha->vp_idx) in qla2x00_eh_wait_for_pending_commands()
1358 cmd = GET_CMD_SP(sp); in qla2x00_eh_wait_for_pending_commands()
1364 match = cmd->device->id == t; in qla2x00_eh_wait_for_pending_commands()
1367 match = (cmd->device->id == t && in qla2x00_eh_wait_for_pending_commands()
1368 cmd->device->lun == l); in qla2x00_eh_wait_for_pending_commands()
1374 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1376 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1378 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_eh_wait_for_pending_commands()
1394 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in __qla2xxx_eh_generic_reset()
1395 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in __qla2xxx_eh_generic_reset()
1406 if (fcport->deleted) in __qla2xxx_eh_generic_reset()
1410 "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no, in __qla2xxx_eh_generic_reset()
1411 cmd->device->id, cmd->device->lun, cmd); in __qla2xxx_eh_generic_reset()
1420 if (do_reset(fcport, cmd->device->lun, 1) in __qla2xxx_eh_generic_reset()
1427 if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, in __qla2xxx_eh_generic_reset()
1428 cmd->device->lun, type) != QLA_SUCCESS) { in __qla2xxx_eh_generic_reset()
1436 vha->host_no, cmd->device->id, cmd->device->lun, cmd); in __qla2xxx_eh_generic_reset()
1443 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in __qla2xxx_eh_generic_reset()
1451 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_device_reset()
1452 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1461 ha->isp_ops->lun_reset); in qla2xxx_eh_device_reset()
1467 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_target_reset()
1468 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1477 ha->isp_ops->target_reset); in qla2xxx_eh_target_reset()
1498 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1499 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_eh_bus_reset()
1503 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1511 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1512 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1527 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1552 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1575 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1576 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1580 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1585 schedule_work(&ha->board_disable); in qla2xxx_eh_host_reset()
1589 id = cmd->device->id; in qla2xxx_eh_host_reset()
1590 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1593 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1599 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1606 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1614 if (ha->wq) in qla2xxx_eh_host_reset()
1615 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1617 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1618 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1619 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1621 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1629 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1640 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1660 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1666 if (ql2xtargetreset == 1 && ha->flags.enable_target_reset) { in qla2x00_loop_reset()
1667 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_loop_reset()
1668 if (fcport->port_type != FCT_TARGET) in qla2x00_loop_reset()
1671 ret = ha->isp_ops->target_reset(fcport, 0, 0); in qla2x00_loop_reset()
1675 "d_id=%x.\n", ret, fcport->d_id.b24); in qla2x00_loop_reset()
1681 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1682 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1683 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1692 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1700 vha->marker_needed = 1; in qla2x00_loop_reset()
1709 static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, in qla2x00_abort_srb() argument
1711 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1712 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1715 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1716 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1717 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_abort_srb()
1722 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1725 sp->done(sp, res); in qla2x00_abort_srb()
1729 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1730 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1731 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1733 if (sp->comp) { in qla2x00_abort_srb()
1734 sp->done(sp, res); in qla2x00_abort_srb()
1738 sp->comp = &comp; in qla2x00_abort_srb()
1739 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1741 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1744 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1751 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1754 /* else FW return SP to driver */ in qla2x00_abort_srb()
1761 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1762 if (ret_cmd && blk_mq_request_started(cmd->request)) in qla2x00_abort_srb()
1763 sp->done(sp, res); in qla2x00_abort_srb()
1765 sp->done(sp, res); in qla2x00_abort_srb()
1778 srb_t *sp; in __qla2x00_abort_all_cmds() local
1779 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1780 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1782 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1785 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1787 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1788 req = qp->req; in __qla2x00_abort_all_cmds()
1789 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1790 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1791 if (sp) { in __qla2x00_abort_all_cmds()
1792 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1794 qla2x00_abort_srb(qp, sp, res, &flags); in __qla2x00_abort_all_cmds()
1797 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1800 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1801 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1804 cmd = (struct qla_tgt_cmd *)sp; in __qla2x00_abort_all_cmds()
1805 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1813 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1816 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1827 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1830 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1832 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1834 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1836 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1837 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1840 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1850 return -ENXIO; in qla2xxx_slave_alloc()
1852 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_slave_alloc()
1860 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_slave_configure()
1861 struct req_que *req = vha->req; in qla2xxx_slave_configure()
1863 if (IS_T10_PI_CAPABLE(vha->hw)) in qla2xxx_slave_configure()
1864 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); in qla2xxx_slave_configure()
1866 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_slave_configure()
1873 sdev->hostdata = NULL; in qla2xxx_slave_destroy()
1877 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1887 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1889 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1890 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1891 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1892 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1894 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1895 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1896 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1901 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1902 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1909 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
1911 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1912 ha->interrupts_on = 1; in qla2x00_enable_intrs()
1914 wrt_reg_word(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
1915 rd_reg_word(&reg->ictrl); in qla2x00_enable_intrs()
1916 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
1924 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
1926 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
1927 ha->interrupts_on = 0; in qla2x00_disable_intrs()
1929 wrt_reg_word(&reg->ictrl, 0); in qla2x00_disable_intrs()
1930 rd_reg_word(&reg->ictrl); in qla2x00_disable_intrs()
1931 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
1938 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
1940 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
1941 ha->interrupts_on = 1; in qla24xx_enable_intrs()
1942 wrt_reg_dword(&reg->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
1943 rd_reg_dword(&reg->ictrl); in qla24xx_enable_intrs()
1944 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
1951 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
1955 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
1956 ha->interrupts_on = 0; in qla24xx_disable_intrs()
1957 wrt_reg_dword(&reg->ictrl, 0); in qla24xx_disable_intrs()
1958 rd_reg_dword(&reg->ictrl); in qla24xx_disable_intrs()
1959 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
1968 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
1970 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
1972 pci_name(ha->pdev)); in qla2x00_iospace_config()
1975 if (!(ha->bars & 1)) in qla2x00_iospace_config()
1979 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
1980 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
1981 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
1982 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
1984 pci_name(ha->pdev)); in qla2x00_iospace_config()
1988 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
1990 pci_name(ha->pdev)); in qla2x00_iospace_config()
1993 ha->pio_address = pio; in qla2x00_iospace_config()
1994 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
1996 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2000 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2001 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2003 pci_name(ha->pdev)); in qla2x00_iospace_config()
2006 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2007 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2009 pci_name(ha->pdev)); in qla2x00_iospace_config()
2013 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2014 if (!ha->iobase) { in qla2x00_iospace_config()
2015 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2017 pci_name(ha->pdev)); in qla2x00_iospace_config()
2022 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2023 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2026 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2033 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2034 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2035 if (ha->mqiobase) { in qla2x00_iospace_config()
2036 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2037 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2039 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2040 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2043 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2044 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2046 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2047 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2048 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2050 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2051 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2053 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2057 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2058 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2062 return (-ENOMEM); in qla2x00_iospace_config()
2071 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2073 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2075 pci_name(ha->pdev)); in qla83xx_iospace_config()
2081 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2082 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2084 pci_name(ha->pdev)); in qla83xx_iospace_config()
2087 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2088 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2090 pci_name(ha->pdev)); in qla83xx_iospace_config()
2094 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2095 if (!ha->iobase) { in qla83xx_iospace_config()
2096 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2098 pci_name(ha->pdev)); in qla83xx_iospace_config()
2102 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2104 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2105 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2106 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2107 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2108 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2110 if (!ha->mqiobase) { in qla83xx_iospace_config()
2111 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2116 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2117 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2118 if (ha->msixbase) { in qla83xx_iospace_config()
2120 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2122 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2129 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2133 ha->max_req_queues--; in qla83xx_iospace_config()
2135 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2139 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2140 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2141 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2143 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2144 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2146 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2150 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2151 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2155 return -ENOMEM; in qla83xx_iospace_config()
2552 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2553 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2555 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2556 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2557 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2560 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2561 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2562 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2565 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2566 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2567 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2570 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2571 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2572 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2575 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2576 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2577 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2578 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2579 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2580 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2583 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2584 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2587 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2588 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2591 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2592 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2593 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2594 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2595 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2598 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2599 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2600 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2601 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2602 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2605 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2606 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2607 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2608 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2609 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2612 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2613 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2614 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2617 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2618 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2619 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2622 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2623 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2624 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2625 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2626 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2629 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2630 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2631 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2632 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2633 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2636 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2637 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2638 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2639 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2644 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2645 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2646 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2647 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2652 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2653 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2654 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2655 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2656 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2657 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2660 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2661 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2662 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2663 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2664 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2665 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2668 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2671 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2672 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2673 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2674 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2675 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2676 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2679 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2680 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2681 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2682 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2683 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2684 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2687 ha->isp_type |= DT_ISP2261; 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->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2692 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2696 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2697 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2698 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2699 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2700 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2701 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2705 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2706 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2707 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2708 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2709 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2710 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2715 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2718 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2721 ha->port_no--; in qla2x00_set_isp_flags()
2723 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2726 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2728 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2736 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2739 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2740 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2741 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2742 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2750 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2752 if (!vha->host) in qla2xxx_scan_finished()
2754 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2757 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2764 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2765 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2769 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2772 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2774 i--; in qla2x00_iocb_work_fn()
2777 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2778 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2779 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2788 int ret = -ENODEV; in qla2x00_probe_one()
2803 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2804 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2805 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2806 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2807 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2808 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2809 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2810 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2811 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2812 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2813 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2814 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2815 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2816 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2817 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2818 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2819 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2820 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2821 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2849 ha->pdev = pdev; in qla2x00_probe_one()
2850 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2851 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2852 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2853 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2855 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2858 ha->bars = bars; in qla2x00_probe_one()
2859 ha->mem_only = mem_only; in qla2x00_probe_one()
2860 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
2861 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
2862 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
2863 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
2865 /* Set ISP-type information. */ in qla2x00_probe_one()
2871 pdev->needs_freset = 1; in qla2x00_probe_one()
2873 ha->prev_topology = 0; in qla2x00_probe_one()
2874 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
2875 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
2876 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
2877 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
2878 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
2879 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
2880 atomic_set(&ha->num_pend_mbx_stage3, 0); in qla2x00_probe_one()
2881 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
2882 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
2886 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2887 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
2890 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
2891 ha->gid_list_info_size = 4; in qla2x00_probe_one()
2892 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2893 ha->flash_data_off = ~0; in qla2x00_probe_one()
2894 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2895 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2896 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
2898 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2899 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
2902 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
2903 ha->gid_list_info_size = 4; in qla2x00_probe_one()
2904 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2905 ha->flash_data_off = ~0; in qla2x00_probe_one()
2906 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2907 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2908 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
2910 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
2911 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2914 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2915 ha->gid_list_info_size = 6; in qla2x00_probe_one()
2917 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
2918 ha->flash_conf_off = ~0; in qla2x00_probe_one()
2919 ha->flash_data_off = ~0; in qla2x00_probe_one()
2920 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2921 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2922 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
2924 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2925 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2928 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2929 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2930 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
2931 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2932 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
2933 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
2934 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
2935 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2936 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2937 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2938 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2940 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2941 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2944 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2945 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2946 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
2947 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2948 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
2949 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2950 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
2951 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2952 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2953 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2954 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2956 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2957 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2960 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
2961 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2962 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2963 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2964 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
2965 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2966 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
2967 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
2968 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
2969 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
2970 ha->nvram_data_off = ~0; in qla2x00_probe_one()
2972 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2973 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2976 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2977 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2978 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2979 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
2980 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2981 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
2982 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2983 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2984 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
2985 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
2987 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
2988 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
2991 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
2992 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
2993 ha->gid_list_info_size = 8; in qla2x00_probe_one()
2994 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
2995 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
2996 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
2997 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
2998 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
2999 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3000 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3002 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3003 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3004 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3007 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3008 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3009 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3010 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3011 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3012 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3013 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3014 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3015 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3016 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3017 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3019 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3020 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3021 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3024 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3025 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3026 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3027 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3028 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3029 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3030 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3031 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3033 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3034 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3035 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3038 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3039 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3040 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3041 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3042 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3043 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3044 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3045 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3046 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3047 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3048 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3050 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3051 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3052 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3055 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3056 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3057 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3058 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3059 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3060 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3061 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3062 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3063 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3064 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3065 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3073 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3074 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3075 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3079 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3080 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3083 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3089 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3090 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3091 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3092 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3093 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3094 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3095 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3096 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3098 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3103 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3113 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3115 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3120 ret = -ENOMEM; in qla2x00_probe_one()
3125 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3127 host = base_vha->host; in qla2x00_probe_one()
3128 base_vha->req = req; in qla2x00_probe_one()
3130 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3133 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3134 base_vha->vp_idx; in qla2x00_probe_one()
3137 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3138 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3139 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3140 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3141 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3142 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3147 host->sg_tablesize = 32; in qla2x00_probe_one()
3150 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3152 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3153 host->cmd_per_lun = 3; in qla2x00_probe_one()
3154 host->unique_id = host->host_no; in qla2x00_probe_one()
3156 host->max_cmd_len = 32; in qla2x00_probe_one()
3158 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3159 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3160 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3163 host->max_lun = 0xffff; in qla2x00_probe_one()
3165 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3166 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3167 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3172 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3173 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3174 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3175 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3177 INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_probe_one()
3190 ret = -ENODEV; in qla2x00_probe_one()
3194 if (ha->mqenable) { in qla2x00_probe_one()
3195 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3196 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3199 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3202 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3204 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3205 host->nr_hw_queues); in qla2x00_probe_one()
3208 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3217 rsp->req = req; in qla2x00_probe_one()
3218 req->rsp = rsp; in qla2x00_probe_one()
3221 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3222 ha->req_q_map[0] = req; in qla2x00_probe_one()
3223 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3224 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3227 /* FWI2-capable only. */ in qla2x00_probe_one()
3228 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3229 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3230 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3231 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3232 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3234 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3235 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3236 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3237 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3241 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3242 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3243 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3244 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3248 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3249 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3250 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3254 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3255 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3257 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3258 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3259 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3260 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3262 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3263 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3265 "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()
3266 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3268 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0); in qla2x00_probe_one()
3269 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3270 ret = -ENOMEM; in qla2x00_probe_one()
3274 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3276 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3277 base_vha->device_flags); in qla2x00_probe_one()
3296 ret = -ENODEV; in qla2x00_probe_one()
3301 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3303 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3307 host->can_queue, base_vha->req, in qla2x00_probe_one()
3308 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3310 if (ha->mqenable) { in qla2x00_probe_one()
3320 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3325 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3331 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3332 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3333 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3336 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3337 ha->dpc_thread = NULL; in qla2x00_probe_one()
3351 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3354 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3355 ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3356 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3358 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3359 ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); in qla2x00_probe_one()
3360 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3361 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3363 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3368 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3369 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3381 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3384 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3411 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3414 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3418 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3419 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3423 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3427 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3428 base_vha->flags.online = 1; in qla2x00_probe_one()
3429 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3439 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3445 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3449 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3457 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3460 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3462 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3463 base_vha->host_no, in qla2x00_probe_one()
3464 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3468 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3470 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3471 return -ENODEV; in qla2x00_probe_one()
3476 if (base_vha->gnl.l) { in qla2x00_probe_one()
3477 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3478 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3479 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3482 if (base_vha->timer_active) in qla2x00_probe_one()
3484 base_vha->flags.online = 0; in qla2x00_probe_one()
3485 if (ha->dpc_thread) { in qla2x00_probe_one()
3486 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3488 ha->dpc_thread = NULL; in qla2x00_probe_one()
3493 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3511 if (!ha->nx_pcibase) in qla2x00_probe_one()
3512 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3514 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3516 if (ha->iobase) in qla2x00_probe_one()
3517 iounmap(ha->iobase); in qla2x00_probe_one()
3518 if (ha->cregbase) in qla2x00_probe_one()
3519 iounmap(ha->cregbase); in qla2x00_probe_one()
3521 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3538 ha = base_vha->hw; in __qla_set_remove_flag()
3540 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3541 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3542 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3548 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3549 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3559 ha = vha->hw; in qla2x00_shutdown()
3569 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3571 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3578 /* Turn-off FCE trace */ in qla2x00_shutdown()
3579 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3581 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3584 /* Turn-off EFT trace */ in qla2x00_shutdown()
3585 if (ha->eft) in qla2x00_shutdown()
3590 if (ha->flags.fw_started) in qla2x00_shutdown()
3598 if (vha->timer_active) in qla2x00_shutdown()
3602 vha->flags.online = 0; in qla2x00_shutdown()
3604 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3605 if (ha->interrupts_on) { in qla2x00_shutdown()
3606 vha->flags.init_done = 0; in qla2x00_shutdown()
3607 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3626 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3627 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3628 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3630 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3631 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3632 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3633 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3635 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3636 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3640 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3641 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3643 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3645 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3653 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3654 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3655 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3656 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3659 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3660 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3661 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3662 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3663 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3664 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3668 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3669 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3672 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3675 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3685 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3687 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3689 if (ha->iobase) in qla2x00_unmap_iobases()
3690 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3692 if (ha->cregbase) in qla2x00_unmap_iobases()
3693 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3695 if (ha->mqiobase) in qla2x00_unmap_iobases()
3696 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3699 ha->msixbase) in qla2x00_unmap_iobases()
3700 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3725 ha = base_vha->hw; in qla2x00_remove_one()
3729 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3732 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3736 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3737 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3738 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3739 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3740 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3751 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3756 if (ha->flags.fw_started) in qla2x00_remove_one()
3764 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3774 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3775 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3777 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3779 vfree(base_vha->scan.l); in qla2x00_remove_one()
3791 if (base_vha->timer_active) in qla2x00_remove_one()
3794 base_vha->flags.online = 0; in qla2x00_remove_one()
3797 if (ha->exlogin_buf) in qla2x00_remove_one()
3801 if (ha->exchoffld_buf) in qla2x00_remove_one()
3810 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3813 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3819 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3823 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3837 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3838 list_for_each_safe(item, next, &list->head) { in qla24xx_free_purex_list()
3842 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
3848 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
3853 if (vha->timer_active) in qla2x00_free_device()
3857 vha->flags.online = 0; in qla2x00_free_device()
3859 /* turn-off interrupts on the card */ in qla2x00_free_device()
3860 if (ha->interrupts_on) { in qla2x00_free_device()
3861 vha->flags.init_done = 0; in qla2x00_free_device()
3862 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
3870 if (ha->wq) { in qla2x00_free_device()
3871 flush_workqueue(ha->wq); in qla2x00_free_device()
3872 destroy_workqueue(ha->wq); in qla2x00_free_device()
3873 ha->wq = NULL; in qla2x00_free_device()
3877 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
3890 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
3899 if (!fcport->rport) in qla2x00_schedule_rport_del()
3902 if (fcport->rport) { in qla2x00_schedule_rport_del()
3903 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
3905 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
3906 fcport->rport->roles); in qla2x00_schedule_rport_del()
3907 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
3924 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
3930 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
3931 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
3939 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
3945 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
3956 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
3957 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
3970 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
3971 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
3972 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
3989 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
3990 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
3991 if (!ha->init_cb) in qla2x00_mem_alloc()
3997 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
3998 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
3999 if (!ha->gid_list) in qla2x00_mem_alloc()
4002 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4003 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4015 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4017 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4019 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4021 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4025 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4026 if (!ha->nvram) in qla2x00_mem_alloc()
4030 ha->pdev->device); in qla2x00_mem_alloc()
4031 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4033 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4036 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4038 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4041 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4043 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4044 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4049 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4051 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4052 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4062 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4063 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4064 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4065 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4071 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4072 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4073 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4074 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4078 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4083 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4085 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4086 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4087 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4088 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4089 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4091 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4094 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4097 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4103 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4104 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4105 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4106 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4107 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4109 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4110 &ha->pool.good.head); in qla2x00_mem_alloc()
4111 ha->pool.good.count++; in qla2x00_mem_alloc()
4117 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4118 list_del(&dsd->list); in qla2x00_mem_alloc()
4119 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4120 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4121 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4123 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4126 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4128 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4129 ha->pool.unusable.count); in qla2x00_mem_alloc()
4132 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4134 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4135 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4141 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4142 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4143 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4145 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4146 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4149 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4150 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4151 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4154 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4155 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4156 if (!ha->ct_sns) in qla2x00_mem_alloc()
4158 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4160 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4166 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4170 (*req)->length = req_len; in qla2x00_mem_alloc()
4171 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4172 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4173 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4174 if (!(*req)->ring) { in qla2x00_mem_alloc()
4175 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4182 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4186 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4187 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4188 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4189 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4190 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4191 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4192 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4196 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4197 (*rsp)->req = *req; in qla2x00_mem_alloc()
4198 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4199 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4200 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4201 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4202 (*rsp)->ring); in qla2x00_mem_alloc()
4204 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4205 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4208 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4209 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4214 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4216 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4219 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4220 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4221 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4223 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4224 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4227 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4229 ha->sf_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4230 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4231 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4233 memset(ha->sf_init_cb, 0, sizeof(struct init_sf_cb)); in qla2x00_mem_alloc()
4234 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4235 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4238 INIT_LIST_HEAD(&ha->gbl_dsd_list); in qla2x00_mem_alloc()
4240 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4242 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4243 &ha->async_pd_dma); in qla2x00_mem_alloc()
4244 if (!ha->async_pd) in qla2x00_mem_alloc()
4246 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4247 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4250 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4253 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4256 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4260 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4261 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4264 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4265 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4266 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4267 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4268 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4272 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4273 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4275 if (!ha->flt) { in qla2x00_mem_alloc()
4276 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4284 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4285 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4287 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4289 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4291 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4293 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4295 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4297 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4298 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4299 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4300 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4305 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4306 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4307 (*req)->ring = NULL; in qla2x00_mem_alloc()
4308 (*req)->dma = 0; in qla2x00_mem_alloc()
4313 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4314 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4315 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4316 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4318 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4319 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4320 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4322 if (ha->sns_cmd) in qla2x00_mem_alloc()
4323 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4324 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4329 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4331 list_del(&dsd->list); in qla2x00_mem_alloc()
4332 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4333 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4334 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4336 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4337 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4339 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4340 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4345 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4346 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4350 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4351 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4354 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4355 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4357 kfree(ha->nvram); in qla2x00_mem_alloc()
4358 ha->nvram = NULL; in qla2x00_mem_alloc()
4360 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4361 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4363 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4364 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4366 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4367 ha->gid_list, in qla2x00_mem_alloc()
4368 ha->gid_list_dma); in qla2x00_mem_alloc()
4369 ha->gid_list = NULL; in qla2x00_mem_alloc()
4370 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4374 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4375 ha->init_cb_dma); in qla2x00_mem_alloc()
4376 ha->init_cb = NULL; in qla2x00_mem_alloc()
4377 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4381 return -ENOMEM; in qla2x00_mem_alloc()
4390 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4403 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4411 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4413 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4420 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4423 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4424 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4425 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4426 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4428 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4433 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4452 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4453 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4454 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4455 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4456 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4464 struct init_cb_81xx *icb = (struct init_cb_81xx *)&vha->hw->init_cb; in qla2x00_number_of_exch()
4467 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4468 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4471 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4472 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4474 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4475 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4478 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4479 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4480 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4483 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4484 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4486 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4488 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4489 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4491 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4505 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4507 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4516 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4527 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4530 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4531 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4535 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4543 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4546 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4547 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4548 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4549 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4552 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4554 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4555 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4557 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4559 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4560 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4563 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4565 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4567 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4570 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4571 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4574 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4585 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4586 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4589 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4591 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4606 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4607 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4608 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4609 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4610 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4624 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4627 if (ha->fce) in qla2x00_free_fw_dump()
4628 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4629 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4631 if (ha->eft) in qla2x00_free_fw_dump()
4632 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4633 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4635 if (ha->fw_dump) in qla2x00_free_fw_dump()
4636 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4638 ha->fce = NULL; in qla2x00_free_fw_dump()
4639 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4640 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4641 ha->eft = NULL; in qla2x00_free_fw_dump()
4642 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4643 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4644 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4645 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4646 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4647 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4650 if (fwdt->template) in qla2x00_free_fw_dump()
4651 vfree(fwdt->template); in qla2x00_free_fw_dump()
4652 fwdt->template = NULL; in qla2x00_free_fw_dump()
4653 fwdt->length = 0; in qla2x00_free_fw_dump()
4669 if (ha->mctp_dump) in qla2x00_mem_free()
4670 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4671 ha->mctp_dump_dma); in qla2x00_mem_free()
4672 ha->mctp_dump = NULL; in qla2x00_mem_free()
4674 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4675 ha->srb_mempool = NULL; in qla2x00_mem_free()
4677 if (ha->dcbx_tlv) in qla2x00_mem_free()
4678 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4679 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4680 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4682 if (ha->xgmac_data) in qla2x00_mem_free()
4683 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4684 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4685 ha->xgmac_data = NULL; in qla2x00_mem_free()
4687 if (ha->sns_cmd) in qla2x00_mem_free()
4688 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4689 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4690 ha->sns_cmd = NULL; in qla2x00_mem_free()
4691 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4693 if (ha->ct_sns) in qla2x00_mem_free()
4694 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4695 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4696 ha->ct_sns = NULL; in qla2x00_mem_free()
4697 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4699 if (ha->sfp_data) in qla2x00_mem_free()
4700 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4701 ha->sfp_data_dma); in qla2x00_mem_free()
4702 ha->sfp_data = NULL; in qla2x00_mem_free()
4704 if (ha->flt) in qla2x00_mem_free()
4705 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4707 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4708 ha->flt = NULL; in qla2x00_mem_free()
4709 ha->flt_dma = 0; in qla2x00_mem_free()
4711 if (ha->ms_iocb) in qla2x00_mem_free()
4712 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4713 ha->ms_iocb = NULL; in qla2x00_mem_free()
4714 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4716 if (ha->sf_init_cb) in qla2x00_mem_free()
4717 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4718 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4720 if (ha->ex_init_cb) in qla2x00_mem_free()
4721 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4722 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4723 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4724 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4726 if (ha->async_pd) in qla2x00_mem_free()
4727 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4728 ha->async_pd = NULL; in qla2x00_mem_free()
4729 ha->async_pd_dma = 0; in qla2x00_mem_free()
4731 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4732 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4734 if (ha->gid_list) in qla2x00_mem_free()
4735 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4736 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4737 ha->gid_list = NULL; in qla2x00_mem_free()
4738 ha->gid_list_dma = 0; in qla2x00_mem_free()
4741 if (!list_empty(&ha->gbl_dsd_list)) { in qla2x00_mem_free()
4746 tdsd_ptr, &ha->gbl_dsd_list, list) { in qla2x00_mem_free()
4747 dma_pool_free(ha->dl_dma_pool, in qla2x00_mem_free()
4748 dsd_ptr->dsd_addr, dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4749 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4755 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4756 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4758 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4759 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4761 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4762 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4764 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4767 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4769 list_del(&dsd->list); in qla2x00_mem_free()
4770 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4771 dsd->dsd_list_dma); in qla2x00_mem_free()
4772 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4774 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4775 ha->pool.unusable.count--; in qla2x00_mem_free()
4777 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
4778 list_del(&dsd->list); in qla2x00_mem_free()
4779 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4780 dsd->dsd_list_dma); in qla2x00_mem_free()
4781 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4783 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4787 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
4788 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
4792 if (ha->init_cb) in qla2x00_mem_free()
4793 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
4794 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
4795 ha->init_cb = NULL; in qla2x00_mem_free()
4796 ha->init_cb_dma = 0; in qla2x00_mem_free()
4798 vfree(ha->optrom_buffer); in qla2x00_mem_free()
4799 ha->optrom_buffer = NULL; in qla2x00_mem_free()
4800 kfree(ha->nvram); in qla2x00_mem_free()
4801 ha->nvram = NULL; in qla2x00_mem_free()
4802 kfree(ha->npiv_info); in qla2x00_mem_free()
4803 ha->npiv_info = NULL; in qla2x00_mem_free()
4804 kfree(ha->swl); in qla2x00_mem_free()
4805 ha->swl = NULL; in qla2x00_mem_free()
4806 kfree(ha->loop_id_map); in qla2x00_mem_free()
4807 ha->sf_init_cb = NULL; in qla2x00_mem_free()
4808 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
4809 ha->loop_id_map = NULL; in qla2x00_mem_free()
4820 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
4829 vha->host = host; in qla2x00_create_host()
4830 vha->host_no = host->host_no; in qla2x00_create_host()
4831 vha->hw = ha; in qla2x00_create_host()
4833 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
4834 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
4835 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
4837 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
4838 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
4839 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
4840 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
4841 INIT_LIST_HEAD(&vha->qla_sess_op_cmd_list); in qla2x00_create_host()
4842 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
4843 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
4844 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
4845 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
4846 INIT_LIST_HEAD(&vha->gpnid_list); in qla2x00_create_host()
4847 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
4849 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
4850 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
4852 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
4853 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
4854 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
4855 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
4857 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
4858 (ha->max_loop_id + 1); in qla2x00_create_host()
4859 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
4860 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
4861 if (!vha->gnl.l) { in qla2x00_create_host()
4864 scsi_host_put(vha->host); in qla2x00_create_host()
4869 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
4870 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
4871 if (!vha->scan.l) { in qla2x00_create_host()
4874 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
4875 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
4876 vha->gnl.l = NULL; in qla2x00_create_host()
4877 scsi_host_put(vha->host); in qla2x00_create_host()
4880 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
4882 sprintf(vha->host_str, "%s_%lu", QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
4885 vha->host, vha->hw, vha, in qla2x00_create_host()
4886 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
4897 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
4910 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
4911 e->type = type; in qla2x00_alloc_work()
4912 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
4922 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
4923 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
4925 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
4928 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
4931 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
4946 e->u.aen.code = code; in qla2x00_post_aen_work()
4947 e->u.aen.data = data; in qla2x00_post_aen_work()
4960 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
4975 e->u.logio.fcport = fcport; \
4977 e->u.logio.data[0] = data[0]; \
4978 e->u.logio.data[1] = data[1]; \
4980 fcport->flags |= FCF_ASYNC_ACTIVE; \
4999 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5012 vha->host_no); in qla2x00_uevent_emit()
5018 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5031 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5032 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5033 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5041 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5044 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5045 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5046 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5049 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5050 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5051 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5053 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5055 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5064 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5069 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5071 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5072 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5074 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5076 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5077 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5078 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5084 pla->ref_count--; in qla24xx_create_new_sess()
5087 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5090 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5091 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5092 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5094 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5097 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5098 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5099 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5101 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5102 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5103 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5104 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5110 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5113 list_del(&pla->list); in qla24xx_create_new_sess()
5119 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5122 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5127 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5128 tfcp->fw_login_state); in qla24xx_create_new_sess()
5132 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5138 pla->ref_count--; in qla24xx_create_new_sess()
5141 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5144 fcport->id_changed = 1; in qla24xx_create_new_sess()
5145 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5146 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5147 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5150 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5153 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5154 fcport->local = 0; in qla24xx_create_new_sess()
5155 fcport->loop_id = in qla24xx_create_new_sess()
5157 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5158 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5161 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5164 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5167 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5169 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5175 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5177 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5184 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5185 tfcp->fw_login_state); in qla24xx_create_new_sess()
5187 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5191 fcport->login_pause = 1; in qla24xx_create_new_sess()
5192 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5195 fcport->login_pause = 1; in qla24xx_create_new_sess()
5196 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5201 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5205 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5206 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5207 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5208 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5209 fcport->fc4_type = in qla24xx_create_new_sess()
5211 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5213 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5215 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5225 list_del(&pla->list); in qla24xx_create_new_sess()
5233 struct srb *sp = e->u.iosb.sp; in qla_sp_retry() local
5236 rval = qla2x00_start_sp(sp); in qla_sp_retry()
5239 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5240 __func__, sp->name, rval); in qla_sp_retry()
5241 qla24xx_sp_unmap(vha, sp); in qla_sp_retry()
5253 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5254 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5255 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5259 switch (e->type) { in qla2x00_do_work()
5261 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5262 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5265 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5268 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5269 e->u.logio.data); in qla2x00_do_work()
5272 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5275 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5276 e->u.logio.data); in qla2x00_do_work()
5279 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5285 qla24xx_async_gpnid(vha, &e->u.gpnid.id); in qla2x00_do_work()
5288 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5297 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5298 e->u.fcport.opt); in qla2x00_do_work()
5301 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5304 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5307 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5313 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5316 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5317 e->u.logio.data); in qla2x00_do_work()
5320 qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, in qla2x00_do_work()
5321 e->u.gpnft.sp); in qla2x00_do_work()
5324 qla24xx_async_gpnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5327 qla24xx_async_gnnft_done(vha, e->u.iosb.sp); in qla2x00_do_work()
5330 qla24xx_async_gnnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5333 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5339 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5343 e->u.fcport.fcport, false); in qla2x00_do_work()
5348 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5349 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5350 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5351 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5354 list_del_init(&e->list); in qla2x00_do_work()
5355 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5370 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5386 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5391 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5392 fcport->login_retry) { in qla2x00_relogin()
5393 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5394 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5397 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5398 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5401 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5405 } else if (vha->hw->current_topology == in qla2x00_relogin()
5407 fcport->login_retry--; in qla2x00_relogin()
5412 fcport->old_loop_id = in qla2x00_relogin()
5413 fcport->loop_id; in qla2x00_relogin()
5416 fcport->loop_id); in qla2x00_relogin()
5421 &vha->dpc_flags); in qla2x00_relogin()
5425 fcport->login_retry, in qla2x00_relogin()
5426 fcport->loop_id); in qla2x00_relogin()
5428 fcport->login_retry = 0; in qla2x00_relogin()
5431 if (fcport->login_retry == 0 && in qla2x00_relogin()
5437 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5442 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5448 /* Schedule work on any of the dpc-workqueues */
5452 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5456 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5457 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5461 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5462 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5463 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5470 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5471 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5474 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5475 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5479 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5491 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5497 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5498 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5513 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5559 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5569 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5582 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5588 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5598 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5649 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5661 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5674 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5687 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5692 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5744 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5746 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5751 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5753 ha->portnum); in qla83xx_idc_lock()
5761 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
5781 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
5784 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
5796 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
5799 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
5800 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
5810 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
5835 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
5837 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
5854 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
5866 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
5874 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
5882 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
5885 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
5889 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
5890 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
5891 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
5892 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
5893 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
5894 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
5895 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
5896 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
5897 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
5898 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
5899 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
5900 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
5902 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
5903 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
5904 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
5906 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
5907 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
5908 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
5910 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
5911 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
5913 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
5914 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
5917 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
5918 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
5919 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
5922 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
5923 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
5924 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
5925 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
5926 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
5929 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
5930 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
5931 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
5932 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
5933 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
5936 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
5937 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
5938 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
5945 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
5963 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
5970 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
5971 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
5972 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
5973 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
5974 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
5979 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
5980 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
5981 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
5982 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
5984 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
5988 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
5989 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
5990 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
5995 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
5996 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
5997 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
5998 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
5999 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6000 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6001 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6002 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6003 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6004 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6005 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6006 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6007 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6012 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6013 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6014 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6015 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6016 vha->node_name, in qla24xx_process_purex_rdp()
6017 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6018 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6019 vha->port_name, in qla24xx_process_purex_rdp()
6020 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6022 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6023 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6024 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6025 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6026 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6027 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6028 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6029 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6030 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6031 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6034 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6035 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6036 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6037 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6038 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6039 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6041 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6043 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6044 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6051 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6052 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6053 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6055 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6056 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6057 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6059 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6060 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6061 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6063 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6064 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6065 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6066 /* Optical Element Descriptor, Rx Power */ in qla24xx_process_purex_rdp()
6067 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6068 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6069 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6078 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6079 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6080 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6081 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6082 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6086 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6087 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6088 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6089 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6090 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6094 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6095 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6096 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6097 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6098 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6102 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6103 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6104 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6105 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6106 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6109 /* Optical Element Descriptor, Rx Power */ in qla24xx_process_purex_rdp()
6110 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6111 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6112 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6113 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6114 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6122 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6130 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6138 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6146 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6153 /* Rx Power high/low alarm/warning */ in qla24xx_process_purex_rdp()
6154 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6164 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6165 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6166 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6172 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6174 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6175 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6177 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6178 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6180 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6181 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6183 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6189 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6191 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6199 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6203 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6211 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6212 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6214 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6215 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6216 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6223 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6226 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6229 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6232 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6239 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6240 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6251 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6252 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6253 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6256 list_del(&item->list); in qla24xx_process_purex_list()
6257 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6270 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6272 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6279 if (data == ha->portnum) { in qla83xx_idc_unlock()
6281 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6286 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6294 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6298 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6305 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6310 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6327 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6332 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6356 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6361 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6384 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6388 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6389 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6417 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6429 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6457 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6462 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6463 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6482 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6485 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6488 ha->portnum); in qla83xx_idc_state_handler()
6491 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6494 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6501 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6507 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6510 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6517 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6527 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6534 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6537 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6540 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6572 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6573 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6578 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6581 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6589 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6602 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6605 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6615 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6617 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6619 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6629 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6645 * is kick-off by the driver's detect code and starts up
6660 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6671 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6674 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6676 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6680 ha->dpc_active = 1; in qla2x00_do_dpc()
6684 base_vha->dpc_flags); in qla2x00_do_dpc()
6686 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6692 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6706 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6719 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6724 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6726 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6727 * Escalate to chip-reset in qla2x00_do_dpc()
6730 &base_vha->dpc_flags); in qla2x00_do_dpc()
6733 &base_vha->dpc_flags); in qla2x00_do_dpc()
6741 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6747 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6749 &base_vha->dpc_flags); in qla2x00_do_dpc()
6758 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6763 &base_vha->dpc_flags)) in qla2x00_do_dpc()
6765 &base_vha->dpc_flags); in qla2x00_do_dpc()
6773 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6777 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
6783 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6785 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
6787 * when a forced chip-reset occurs. in qla2x00_do_dpc()
6788 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
6790 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
6794 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6795 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6798 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
6803 !ha->flags.fw_started) in qla2x00_do_dpc()
6808 !ha->flags.fw_started) in qla2x00_do_dpc()
6816 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6817 base_vha->flags.online = 1; in qla2x00_do_dpc()
6820 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
6823 &base_vha->dpc_flags); in qla2x00_do_dpc()
6826 &base_vha->dpc_flags); in qla2x00_do_dpc()
6832 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6833 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
6835 (&base_vha->purex_list); in qla2x00_do_dpc()
6837 &base_vha->dpc_flags); in qla2x00_do_dpc()
6842 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6849 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6858 &base_vha->dpc_flags); in qla2x00_do_dpc()
6859 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
6875 &base_vha->dpc_flags); in qla2x00_do_dpc()
6883 &base_vha->dpc_flags) && in qla2x00_do_dpc()
6884 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
6889 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
6895 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6896 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6897 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
6899 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
6900 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
6901 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
6902 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
6911 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6917 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6922 &base_vha->dpc_flags); in qla2x00_do_dpc()
6932 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
6933 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
6934 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
6939 if (!ha->interrupts_on) in qla2x00_do_dpc()
6940 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
6943 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6944 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
6945 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
6950 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6951 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
6952 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
6957 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
6958 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
6960 qpair->online = online; in qla2x00_do_dpc()
6961 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
6965 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6968 ha->nvme_last_rptd_aen); in qla2x00_do_dpc()
6970 ha->nvme_last_rptd_aen)) { in qla2x00_do_dpc()
6973 ha->nvme_last_rptd_aen); in qla2x00_do_dpc()
6978 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6981 ha->last_zio_threshold); in qla2x00_do_dpc()
6983 ha->last_zio_threshold); in qla2x00_do_dpc()
6990 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6994 ha->dpc_active = 0; in qla2x00_do_dpc()
7006 ha->dpc_active = 0; in qla2x00_do_dpc()
7017 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7018 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7020 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7034 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7035 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7036 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7038 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7044 vha->marker_needed = 1; in qla2x00_rst_aen()
7045 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7046 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7065 srb_t *sp; in qla2x00_timer() local
7067 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7070 if (ha->flags.eeh_busy) { in qla2x00_timer()
7073 ha->flags.eeh_busy); in qla2x00_timer()
7080 * the read returns -1 then disable the board. in qla2x00_timer()
7082 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7083 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7088 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7089 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7097 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7101 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7102 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7103 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7104 && vha->flags.online) { in qla2x00_timer()
7106 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7107 vha->loop_down_abort_time) { in qla2x00_timer()
7110 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7112 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7113 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7116 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7119 /* NPIV - scan physical port only */ in qla2x00_timer()
7120 if (!vha->vp_idx) { in qla2x00_timer()
7121 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7123 req = ha->req_q_map[0]; in qla2x00_timer()
7125 index < req->num_outstanding_cmds; in qla2x00_timer()
7129 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7130 if (!sp) in qla2x00_timer()
7132 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7134 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7136 sfcp = sp->fcport; in qla2x00_timer()
7137 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7142 &vha->dpc_flags); in qla2x00_timer()
7145 &vha->dpc_flags); in qla2x00_timer()
7148 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7155 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7156 if (!(vha->device_flags & DFLG_NO_CABLE)) { in qla2x00_timer()
7158 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7162 &vha->dpc_flags); in qla2x00_timer()
7165 &vha->dpc_flags); in qla2x00_timer()
7169 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7170 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7173 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7176 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7182 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7186 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7187 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7189 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7191 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7195 * FC-NVME in qla2x00_timer()
7198 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7199 if (!vha->vp_idx && in qla2x00_timer()
7200 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7202 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7203 !ha->flags.host_shutting_down) { in qla2x00_timer()
7205 "nvme: Sched: Set ZIO exchange threshold to %d.\n", in qla2x00_timer()
7206 ha->nvme_last_rptd_aen); in qla2x00_timer()
7207 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7208 set_bit(SET_NVME_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7212 if (!vha->vp_idx && in qla2x00_timer()
7213 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7216 "Sched: Set ZIO exchange threshold to %d.\n", in qla2x00_timer()
7217 ha->last_zio_threshold); in qla2x00_timer()
7218 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7219 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7224 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7225 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7226 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7228 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7229 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7230 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7231 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7232 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7233 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7234 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7239 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7240 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7241 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7243 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7248 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7249 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7250 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7251 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7252 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7253 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7310 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7341 if (!blob->name) in qla2x00_request_firmware()
7345 if (blob->fw) in qla2x00_request_firmware()
7348 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7350 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7351 blob->fw = NULL; in qla2x00_request_firmware()
7366 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7367 release_firmware(blob->fw); in qla2x00_release_firmware()
7373 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7374 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7381 ha->chip_reset++; in qla_pci_error_cleanup()
7383 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7384 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7385 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7386 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7387 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7391 if (atomic_read(&ha->num_pend_mbx_stage3)) { in qla_pci_error_cleanup()
7392 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); in qla_pci_error_cleanup()
7393 complete(&ha->mbx_intr_comp); in qla_pci_error_cleanup()
7398 while (atomic_read(&ha->num_pend_mbx_stage3) || in qla_pci_error_cleanup()
7399 atomic_read(&ha->num_pend_mbx_stage2) || in qla_pci_error_cleanup()
7400 atomic_read(&ha->num_pend_mbx_stage1)) { in qla_pci_error_cleanup()
7407 ha->flags.purge_mbox = 0; in qla_pci_error_cleanup()
7409 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7410 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7411 qpair->online = 0; in qla_pci_error_cleanup()
7412 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7416 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7417 list_for_each_entry(vp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7418 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7419 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7421 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7422 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7424 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7427 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7428 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7430 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7431 list_for_each_entry(vp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7432 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7433 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7434 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7435 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7436 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7437 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7439 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7447 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7452 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7460 ha->flags.eeh_busy = 0; in qla2xxx_pci_error_detected()
7462 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7467 ha->flags.eeh_busy = 1; in qla2xxx_pci_error_detected()
7471 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7474 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7489 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7490 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7491 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7496 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7498 stat = rd_reg_word(&reg->hccr); in qla2xxx_pci_mmio_enabled()
7502 stat = rd_reg_dword(&reg->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7506 stat = rd_reg_dword(&reg24->host_status); in qla2xxx_pci_mmio_enabled()
7510 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7514 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7527 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7538 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7547 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7554 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7559 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7562 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7563 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7564 qpair->online = 1; in qla2xxx_pci_slot_reset()
7565 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7567 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7568 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7569 if (ha->isp_ops->abort_isp(base_vha) == QLA_SUCCESS) in qla2xxx_pci_slot_reset()
7571 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7585 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7591 ha->flags.eeh_busy = 0; in qla2xxx_pci_resume()
7604 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
7616 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
7617 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
7618 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
7619 qpair->online = 0; in qla_pci_reset_prepare()
7620 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
7622 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
7631 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
7640 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
7641 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
7642 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
7643 qpair->online = 1; in qla_pci_reset_done()
7644 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
7646 base_vha->flags.online = 1; in qla_pci_reset_done()
7647 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
7648 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
7654 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
7655 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
7657 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
7660 rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); in qla2xxx_map_queues()
7684 .this_id = -1,
7755 * qla2x00_module_init - Module initialization.
7853 return -ENOMEM; in qla2x00_module_init()
7873 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
7885 ret = -ENODEV; in qla2x00_module_init()
7900 ret = -ENODEV; in qla2x00_module_init()
7932 * qla2x00_module_exit - Module cleanup.