Lines Matching refs:phba

76 static int lpfc_hba_down_post_s3(struct lpfc_hba *phba);
77 static int lpfc_hba_down_post_s4(struct lpfc_hba *phba);
83 static void lpfc_sli4_oas_verify(struct lpfc_hba *phba);
104 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
106 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
116 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
118 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
123 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
125 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
134 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
140 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
143 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_config_port_prep()
148 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
151 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
152 sizeof(phba->wwnn)); in lpfc_config_port_prep()
153 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
154 sizeof(phba->wwpn)); in lpfc_config_port_prep()
157 phba->sli3_options = 0x0; in lpfc_config_port_prep()
160 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
161 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
163 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_prep()
167 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
178 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_prep()
181 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
185 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
186 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
213 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
215 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
216 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
217 sizeof (phba->RandomData)); in lpfc_config_port_prep()
224 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
225 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
228 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
246 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
250 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
265 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
268 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
270 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
271 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
286 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
295 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
309 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
312 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
315 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
332 if (vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
333 u64_to_wwn(vport->phba->cfg_soft_wwnn, in lpfc_update_vport_wwn()
335 if (vport->phba->cfg_soft_wwpn) in lpfc_update_vport_wwn()
336 u64_to_wwn(vport->phba->cfg_soft_wwpn, in lpfc_update_vport_wwn()
343 if (vport->fc_nodename.u.wwn[0] == 0 || vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
350 if (vport->fc_portname.u.wwn[0] == 0 || vport->phba->cfg_soft_wwpn) in lpfc_update_vport_wwn()
372 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
374 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
379 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
384 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
389 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
390 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
391 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
393 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
395 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
401 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
403 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
408 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
409 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_post()
413 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
415 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
416 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
424 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
432 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
436 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
444 phba->SerialNumber[i] = in lpfc_config_port_post()
447 phba->SerialNumber[i] = in lpfc_config_port_post()
452 phba->SerialNumber[i] = in lpfc_config_port_post()
455 phba->SerialNumber[i] = in lpfc_config_port_post()
460 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
462 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
463 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_post()
467 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
468 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
473 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
477 if (phba->cfg_hba_queue_depth > i) { in lpfc_config_port_post()
478 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
480 phba->cfg_hba_queue_depth, i); in lpfc_config_port_post()
481 phba->cfg_hba_queue_depth = i; in lpfc_config_port_post()
486 if (phba->pport->cfg_lun_queue_depth > i) { in lpfc_config_port_post()
487 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
489 phba->pport->cfg_lun_queue_depth, i); in lpfc_config_port_post()
490 phba->pport->cfg_lun_queue_depth = i; in lpfc_config_port_post()
493 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
496 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
498 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
509 if (phba->sli_rev != 3) in lpfc_config_port_post()
510 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
515 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
516 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
518 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
521 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
523 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_config_port_post()
528 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
533 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
535 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
538 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
539 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
552 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
553 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
556 writel(status, phba->HCregaddr); in lpfc_config_port_post()
557 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
558 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
561 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
565 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
567 phba->hb_outstanding = 0; in lpfc_config_port_post()
568 phba->last_completion_time = jiffies; in lpfc_config_port_post()
570 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
573 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
574 lpfc_printf_log(phba, in lpfc_config_port_post()
577 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
579 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
581 lpfc_printf_log(phba, in lpfc_config_port_post()
586 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
589 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
590 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
591 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
596 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
598 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
602 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
604 pmb->vport = phba->pport; in lpfc_config_port_post()
605 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
608 lpfc_printf_log(phba, in lpfc_config_port_post()
614 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
618 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
620 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
624 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
626 pmb->vport = phba->pport; in lpfc_config_port_post()
627 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
630 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0435 Adapter failed " in lpfc_config_port_post()
632 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
653 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
655 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
674 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
677 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
682 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
684 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
690 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
691 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
692 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
693 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
694 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
695 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
696 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
697 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
698 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
699 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
700 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
701 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
702 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
703 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
704 !(phba->lmt & LMT_32Gb))) { in lpfc_hba_init_link_fc_topology()
706 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, in lpfc_hba_init_link_fc_topology()
709 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
710 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
712 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
714 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
715 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
716 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
718 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_hba_init_link_fc_topology()
722 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
724 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
725 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
727 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
728 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
730 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
732 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
735 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
737 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
756 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
761 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
763 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
767 lpfc_printf_log(phba, in lpfc_hba_down_link()
770 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
772 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
774 lpfc_printf_log(phba, in lpfc_hba_down_link()
779 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
783 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
800 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
805 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
807 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
808 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
811 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
812 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
814 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
816 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
819 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
838 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
844 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
845 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
846 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
848 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
850 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
851 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
853 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
859 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
865 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
882 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
884 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
890 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
891 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
895 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
897 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
903 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
907 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
909 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
924 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
926 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
933 if (phba->sli_rev >= LPFC_SLI_REV4) in lpfc_hba_clean_txcmplq()
936 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
943 if (phba->sli_rev >= LPFC_SLI_REV4) in lpfc_hba_clean_txcmplq()
946 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
949 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_hba_clean_txcmplq()
951 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
968 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
970 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
971 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
987 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
993 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_down_post_s4()
996 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s4()
997 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1006 spin_lock_irq(&phba->hbalock); /* required for lpfc_sgl_list and */ in lpfc_hba_down_post_s4()
1011 spin_lock(&phba->sli4_hba.abts_sgl_list_lock); in lpfc_hba_down_post_s4()
1013 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1017 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1018 &phba->sli4_hba.lpfc_sgl_list); in lpfc_hba_down_post_s4()
1020 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock); in lpfc_hba_down_post_s4()
1024 spin_lock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_hba_down_post_s4()
1025 list_splice_init(&phba->sli4_hba.lpfc_abts_scsi_buf_list, in lpfc_hba_down_post_s4()
1027 spin_unlock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_hba_down_post_s4()
1028 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1034 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1035 list_splice(&aborts, &phba->lpfc_scsi_buf_list_put); in lpfc_hba_down_post_s4()
1036 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1038 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1054 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1056 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1074 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1078 phba = (struct lpfc_hba *)ptr; in lpfc_hb_timeout()
1081 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1082 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1084 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1085 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1089 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1108 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1111 phba = (struct lpfc_hba *)ptr; in lpfc_rrq_timeout()
1112 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1113 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1114 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1116 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1117 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1119 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1120 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1140 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1144 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1145 phba->hb_outstanding = 0; in lpfc_hb_mbox_cmpl()
1146 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1149 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1150 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1151 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1152 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1153 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1176 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1182 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1185 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1187 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_hb_timeout_handler()
1189 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1191 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1192 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1193 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1196 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1198 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1201 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1202 if (!phba->hb_outstanding) in lpfc_hb_timeout_handler()
1203 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1207 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1212 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1214 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1215 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1216 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1217 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1218 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1219 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1220 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1225 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1229 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1232 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1233 if (!phba->hb_outstanding) { in lpfc_hb_timeout_handler()
1236 pmboxq = mempool_alloc(phba->mbox_mem_pool, in lpfc_hb_timeout_handler()
1239 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1246 lpfc_heart_beat(phba, pmboxq); in lpfc_hb_timeout_handler()
1248 pmboxq->vport = phba->pport; in lpfc_hb_timeout_handler()
1249 retval = lpfc_sli_issue_mbox(phba, pmboxq, in lpfc_hb_timeout_handler()
1255 phba->mbox_mem_pool); in lpfc_hb_timeout_handler()
1256 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1262 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1263 phba->hb_outstanding = 1; in lpfc_hb_timeout_handler()
1264 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1265 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1266 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1270 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1272 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1274 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1284 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1288 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1289 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1304 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1306 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1308 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1310 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1311 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1313 lpfc_offline(phba); in lpfc_offline_eratt()
1314 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1315 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1316 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1317 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1318 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1319 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1320 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1321 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1333 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1335 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1336 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1337 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1339 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1340 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1341 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1342 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1355 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1357 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1358 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1363 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1364 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1365 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1366 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1370 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_deferred_eratt()
1373 phba->work_hs, in lpfc_handle_deferred_eratt()
1374 phba->work_status[0], phba->work_status[1]); in lpfc_handle_deferred_eratt()
1376 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1378 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1386 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1392 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1393 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1396 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1398 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1399 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1403 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1404 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1414 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1415 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1417 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1418 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1419 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1420 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1421 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1425 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1432 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1450 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1452 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1453 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1462 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1463 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1464 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1465 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1470 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1474 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1476 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1477 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1479 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1480 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1482 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1485 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1486 phba->work_status[1]); in lpfc_handle_eratt_s3()
1487 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1489 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1492 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1493 phba->work_status[1]); in lpfc_handle_eratt_s3()
1495 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1497 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1505 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1511 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1512 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1513 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1514 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1515 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1518 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1519 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1520 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1525 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1529 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1530 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1532 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1539 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1540 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1541 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1542 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1549 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1552 phba->work_hs, in lpfc_handle_eratt_s3()
1553 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1561 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1578 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1588 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1592 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1595 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1596 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1598 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1599 lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1601 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1603 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1607 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1609 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1611 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1624 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1626 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
1641 if (pci_channel_offline(phba->pcidev)) in lpfc_handle_eratt_s4()
1644 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
1648 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
1651 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
1656 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1661 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
1665 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1667 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
1670 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
1671 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
1673 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1682 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
1689 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1690 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
1691 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1692 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1697 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1703 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1707 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1711 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
1715 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
1726 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1729 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1735 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
1738 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
1759 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
1761 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
1772 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
1774 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
1775 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
1781 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
1793 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_handle_latt()
1800 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
1803 lpfc_read_topology(phba, pmb, mp); in lpfc_handle_latt()
1807 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
1808 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
1815 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
1816 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
1817 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
1818 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
1823 phba->sli.ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
1824 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_handle_latt()
1828 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
1831 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
1833 control = readl(phba->HCregaddr); in lpfc_handle_latt()
1835 writel(control, phba->HCregaddr); in lpfc_handle_latt()
1836 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
1839 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
1840 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
1841 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
1842 lpfc_linkdown(phba); in lpfc_handle_latt()
1843 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
1845 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_handle_latt()
1866 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
1878 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
1912 phba->SerialNumber[j++] = vpd[index++]; in lpfc_parse_vpd()
1916 phba->SerialNumber[j] = 0; in lpfc_parse_vpd()
1920 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_parse_vpd()
1927 phba->ModelDesc[j++] = vpd[index++]; in lpfc_parse_vpd()
1931 phba->ModelDesc[j] = 0; in lpfc_parse_vpd()
1935 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_parse_vpd()
1942 phba->ModelName[j++] = vpd[index++]; in lpfc_parse_vpd()
1946 phba->ModelName[j] = 0; in lpfc_parse_vpd()
1950 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_parse_vpd()
1957 phba->ProgramType[j++] = vpd[index++]; in lpfc_parse_vpd()
1961 phba->ProgramType[j] = 0; in lpfc_parse_vpd()
1965 phba->vpd_flag |= VPD_PORT; in lpfc_parse_vpd()
1972 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_parse_vpd()
1973 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
1978 phba->Port[j++] = vpd[index++]; in lpfc_parse_vpd()
1982 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_parse_vpd()
1983 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
1985 phba->Port[j] = 0; in lpfc_parse_vpd()
2023 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2026 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2040 if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2042 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2044 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2046 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2048 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2050 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2052 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2057 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2260 phba->Port); in lpfc_get_hba_model_desc()
2286 lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_post_buffer() argument
2297 iocb = lpfc_sli_get_iocbq(phba); in lpfc_post_buffer()
2308 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_post_buffer()
2311 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2321 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_post_buffer()
2325 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2327 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2353 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_post_buffer()
2355 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2359 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_post_buffer()
2363 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2367 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_post_buffer()
2369 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_post_buffer()
2387 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2389 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2392 lpfc_post_buffer(phba, &psli->ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
2498 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
2502 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
2512 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
2531 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
2535 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
2544 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2546 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2551 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2554 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2559 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2638 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2641 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2644 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2657 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2659 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2660 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
2662 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2665 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2667 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2668 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2679 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
2681 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
2682 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
2683 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
2684 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
2685 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
2686 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
2687 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
2688 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
2690 phba->hb_outstanding = 0; in lpfc_stop_hba_timers()
2692 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
2695 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
2699 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
2702 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_stop_hba_timers()
2704 phba->pci_dev_grp); in lpfc_stop_hba_timers()
2721 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
2727 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2728 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
2729 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2733 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2734 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
2735 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
2739 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
2740 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
2742 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2745 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
2749 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_block_mgmt_io()
2752 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
2767 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
2773 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
2776 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
2778 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
2787 lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
2801 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
2817 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
2824 if (!phba) in lpfc_online()
2826 vport = phba->pport; in lpfc_online()
2831 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
2834 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
2836 if (!lpfc_sli_queue_setup(phba)) { in lpfc_online()
2837 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2841 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
2842 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
2843 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2846 spin_lock_irq(&phba->hbalock); in lpfc_online()
2847 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
2849 spin_unlock_irq(&phba->hbalock); in lpfc_online()
2851 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
2852 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2857 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
2859 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
2864 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
2866 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
2876 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
2878 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2894 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
2898 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
2899 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
2900 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
2912 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
2914 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
2923 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
2925 lpfc_linkdown(phba); in lpfc_offline_prep()
2928 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
2930 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
2962 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
2972 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
2978 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
2980 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
2992 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
2998 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3002 lpfc_stop_port(phba); in lpfc_offline()
3003 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3005 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3007 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3008 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3012 lpfc_sli_hba_down(phba); in lpfc_offline()
3013 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3014 phba->work_ha = 0; in lpfc_offline()
3015 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3016 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3018 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3025 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3037 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3042 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3046 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3047 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3050 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data, in lpfc_scsi_free()
3053 phba->total_scsi_bufs--; in lpfc_scsi_free()
3055 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3057 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3058 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3061 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data, in lpfc_scsi_free()
3064 phba->total_scsi_bufs--; in lpfc_scsi_free()
3066 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3069 list_for_each_entry_safe(io, io_next, &phba->lpfc_iocb_list, list) { in lpfc_scsi_free()
3072 phba->total_iocbq_bufs--; in lpfc_scsi_free()
3075 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3091 lpfc_sli4_xri_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_xri_sgl_update() argument
3099 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_sli4_xri_sgl_update()
3104 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_xri_sgl_update()
3105 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_xri_sgl_update()
3107 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_xri_sgl_update()
3108 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3110 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_xri_sgl_update()
3117 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3124 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_xri_sgl_update()
3128 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3139 spin_lock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3141 list_splice_init(&els_sgl_list, &phba->sli4_hba.lpfc_sgl_list); in lpfc_sli4_xri_sgl_update()
3143 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3144 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_xri_sgl_update()
3146 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_xri_sgl_update()
3147 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3149 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_xri_sgl_update()
3151 spin_lock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3153 list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &els_sgl_list); in lpfc_sli4_xri_sgl_update()
3155 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3161 lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_xri_sgl_update()
3166 spin_lock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3168 list_splice_init(&els_sgl_list, &phba->sli4_hba.lpfc_sgl_list); in lpfc_sli4_xri_sgl_update()
3170 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3172 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3175 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_xri_sgl_update()
3181 &phba->sli4_hba.lpfc_sgl_list, list) { in lpfc_sli4_xri_sgl_update()
3182 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_xri_sgl_update()
3184 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3191 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_xri_sgl_update()
3197 phba->total_scsi_bufs = 0; in lpfc_sli4_xri_sgl_update()
3200 phba->sli4_hba.scsi_xri_max = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_xri_sgl_update()
3203 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3206 phba->sli4_hba.scsi_xri_cnt, in lpfc_sli4_xri_sgl_update()
3207 phba->sli4_hba.scsi_xri_max); in lpfc_sli4_xri_sgl_update()
3209 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3210 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3211 list_splice_init(&phba->lpfc_scsi_buf_list_get, &scsi_sgl_list); in lpfc_sli4_xri_sgl_update()
3212 list_splice(&phba->lpfc_scsi_buf_list_put, &scsi_sgl_list); in lpfc_sli4_xri_sgl_update()
3213 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3214 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3216 if (phba->sli4_hba.scsi_xri_cnt > phba->sli4_hba.scsi_xri_max) { in lpfc_sli4_xri_sgl_update()
3218 scsi_xri_cnt = phba->sli4_hba.scsi_xri_cnt - in lpfc_sli4_xri_sgl_update()
3219 phba->sli4_hba.scsi_xri_max; in lpfc_sli4_xri_sgl_update()
3225 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, in lpfc_sli4_xri_sgl_update()
3230 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3231 phba->sli4_hba.scsi_xri_cnt -= scsi_xri_cnt; in lpfc_sli4_xri_sgl_update()
3232 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3239 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_xri_sgl_update()
3241 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3248 psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_xri_sgl_update()
3250 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3251 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3252 list_splice_init(&scsi_sgl_list, &phba->lpfc_scsi_buf_list_get); in lpfc_sli4_xri_sgl_update()
3253 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_sli4_xri_sgl_update()
3254 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3255 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3260 lpfc_free_els_sgl_list(phba); in lpfc_sli4_xri_sgl_update()
3261 lpfc_scsi_free(phba); in lpfc_sli4_xri_sgl_update()
3282 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
3288 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
3292 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_create_port()
3303 vport->phba = phba; in lpfc_create_port()
3314 shost->nr_hw_queues = phba->cfg_fcp_io_channel; in lpfc_create_port()
3315 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
3317 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
3318 shost->sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_create_port()
3326 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
3327 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
3356 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
3360 spin_lock_irq(&phba->hbalock); in lpfc_create_port()
3361 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
3362 spin_unlock_irq(&phba->hbalock); in lpfc_create_port()
3382 struct lpfc_hba *phba = vport->phba; in destroy_port() local
3388 spin_lock_irq(&phba->hbalock); in destroy_port()
3390 spin_unlock_irq(&phba->hbalock); in destroy_port()
3433 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
3443 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
3450 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
3451 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
3464 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
3484 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
3502 if (phba->lmt & LMT_32Gb) in lpfc_host_attrib_init()
3504 if (phba->lmt & LMT_16Gb) in lpfc_host_attrib_init()
3506 if (phba->lmt & LMT_10Gb) in lpfc_host_attrib_init()
3508 if (phba->lmt & LMT_8Gb) in lpfc_host_attrib_init()
3510 if (phba->lmt & LMT_4Gb) in lpfc_host_attrib_init()
3512 if (phba->lmt & LMT_2Gb) in lpfc_host_attrib_init()
3514 if (phba->lmt & LMT_1Gb) in lpfc_host_attrib_init()
3529 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
3544 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
3547 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
3548 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
3550 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
3551 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
3554 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
3555 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
3567 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
3570 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
3571 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
3572 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
3583 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
3585 phba->lpfc_stop_port(phba); in lpfc_stop_port()
3595 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
3600 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
3601 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
3603 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
3605 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
3606 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
3622 struct lpfc_hba *phba = (struct lpfc_hba *)ptr; in lpfc_sli4_fcf_redisc_wait_tmo() local
3625 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
3626 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
3627 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
3631 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
3633 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
3634 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
3635 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
3638 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
3653 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
3665 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_fault()
3685 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
3703 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_type()
3723 lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_link_speed() argument
3746 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_link_speed()
3764 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
3768 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
3771 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
3808 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
3888 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
3898 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
3901 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
3902 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
3904 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
3910 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
3914 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_link_evt()
3916 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
3922 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
3925 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
3928 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
3931 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_link_evt()
3933 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
3936 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
3937 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
3939 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
3941 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
3943 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
3945 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
3947 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
3949 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
3952 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
3956 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
3957 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
3958 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
3959 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
3960 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
3961 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
3962 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
3967 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
3968 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
3980 mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
3987 lpfc_sli4_parse_latt_link_speed(phba, acqe_link)); in lpfc_sli4_async_link_evt()
3998 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
4005 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_link_evt()
4018 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
4026 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4032 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
4033 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
4035 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
4036 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
4038 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
4040 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
4042 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
4044 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
4046 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
4048 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
4052 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
4053 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
4054 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
4055 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
4056 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
4057 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
4058 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
4059 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
4061 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4067 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4071 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_fc_evt()
4073 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4079 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
4082 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
4085 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
4088 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_fc_evt()
4090 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
4092 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
4100 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_fc_evt()
4111 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
4124 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_sli4_async_sli_evt()
4126 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4134 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
4144 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
4148 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
4160 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4164 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
4176 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
4221 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
4226 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4232 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4256 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
4260 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
4261 if (!phba) in lpfc_sli4_perform_vport_cvl()
4266 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); in lpfc_sli4_perform_vport_cvl()
4280 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
4281 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
4284 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
4307 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
4312 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
4314 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
4316 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
4327 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
4339 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4340 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4345 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
4352 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
4358 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
4364 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
4369 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
4373 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4374 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
4375 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4379 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { in lpfc_sli4_async_fip_evt()
4380 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4385 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
4386 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4389 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4392 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4396 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
4399 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4405 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
4412 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4413 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4420 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4421 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
4422 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4424 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
4427 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4430 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
4439 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4441 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
4442 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4444 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4448 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
4450 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
4455 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4456 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
4457 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4462 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
4465 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
4470 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
4474 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4475 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4479 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
4486 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
4488 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
4497 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
4527 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4528 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
4529 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4533 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
4534 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4535 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
4539 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
4541 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
4546 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4547 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
4548 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4553 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
4559 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
4563 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
4578 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
4581 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
4582 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_dcbx_evt()
4597 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
4602 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
4603 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
4604 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
4605 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
4607 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
4610 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
4620 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
4625 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4626 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
4627 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4629 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
4631 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4632 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
4634 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4638 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
4642 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
4645 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
4649 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
4653 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
4656 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
4659 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_event_proc()
4666 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
4677 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
4681 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
4683 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
4685 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
4687 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
4688 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
4691 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
4693 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
4695 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
4711 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
4716 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
4720 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
4723 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4727 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4731 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4735 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4750 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
4754 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
4758 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
4762 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
4766 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_intr_mode()
4785 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
4791 if (!phba->pcidev) in lpfc_enable_pci_dev()
4794 pdev = phba->pcidev; in lpfc_enable_pci_dev()
4817 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
4830 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
4836 if (!phba->pcidev) in lpfc_disable_pci_dev()
4839 pdev = phba->pcidev; in lpfc_disable_pci_dev()
4859 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
4862 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
4863 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
4866 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_reset_hba()
4867 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
4869 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
4870 lpfc_offline(phba); in lpfc_reset_hba()
4871 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
4872 lpfc_online(phba); in lpfc_reset_hba()
4873 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
4887 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
4889 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
4913 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
4915 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
4919 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
4921 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
4929 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
4934 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
4952 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
4962 init_timer(&phba->hb_tmofunc); in lpfc_sli_driver_resource_setup()
4963 phba->hb_tmofunc.function = lpfc_hb_timeout; in lpfc_sli_driver_resource_setup()
4964 phba->hb_tmofunc.data = (unsigned long)phba; in lpfc_sli_driver_resource_setup()
4966 psli = &phba->sli; in lpfc_sli_driver_resource_setup()
4970 psli->mbox_tmo.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4972 init_timer(&phba->fcp_poll_timer); in lpfc_sli_driver_resource_setup()
4973 phba->fcp_poll_timer.function = lpfc_poll_timeout; in lpfc_sli_driver_resource_setup()
4974 phba->fcp_poll_timer.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4976 init_timer(&phba->fabric_block_timer); in lpfc_sli_driver_resource_setup()
4977 phba->fabric_block_timer.function = lpfc_fabric_block_timeout; in lpfc_sli_driver_resource_setup()
4978 phba->fabric_block_timer.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4980 init_timer(&phba->eratt_poll); in lpfc_sli_driver_resource_setup()
4981 phba->eratt_poll.function = lpfc_poll_eratt; in lpfc_sli_driver_resource_setup()
4982 phba->eratt_poll.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4985 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
4986 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
4989 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
4990 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
4991 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
4993 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
4994 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
4997 if (!phba->sli.ring) in lpfc_sli_driver_resource_setup()
4998 phba->sli.ring = kzalloc(LPFC_SLI3_MAX_RING * in lpfc_sli_driver_resource_setup()
5000 if (!phba->sli.ring) in lpfc_sli_driver_resource_setup()
5009 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
5010 lpfc_template_s3.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
5013 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
5023 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
5027 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
5028 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
5031 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
5038 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
5040 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); in lpfc_sli_driver_resource_setup()
5043 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
5046 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
5048 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
5049 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
5051 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
5053 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
5058 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
5059 lpfc_sli_queue_setup(phba); in lpfc_sli_driver_resource_setup()
5062 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
5069 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
5070 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
5071 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
5073 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
5077 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
5078 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
5093 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
5096 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
5113 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
5125 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
5128 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
5137 init_timer(&phba->hb_tmofunc); in lpfc_sli4_driver_resource_setup()
5138 phba->hb_tmofunc.function = lpfc_hb_timeout; in lpfc_sli4_driver_resource_setup()
5139 phba->hb_tmofunc.data = (unsigned long)phba; in lpfc_sli4_driver_resource_setup()
5140 init_timer(&phba->rrq_tmr); in lpfc_sli4_driver_resource_setup()
5141 phba->rrq_tmr.function = lpfc_rrq_timeout; in lpfc_sli4_driver_resource_setup()
5142 phba->rrq_tmr.data = (unsigned long)phba; in lpfc_sli4_driver_resource_setup()
5144 psli = &phba->sli; in lpfc_sli4_driver_resource_setup()
5148 psli->mbox_tmo.data = (unsigned long) phba; in lpfc_sli4_driver_resource_setup()
5150 init_timer(&phba->fabric_block_timer); in lpfc_sli4_driver_resource_setup()
5151 phba->fabric_block_timer.function = lpfc_fabric_block_timeout; in lpfc_sli4_driver_resource_setup()
5152 phba->fabric_block_timer.data = (unsigned long) phba; in lpfc_sli4_driver_resource_setup()
5154 init_timer(&phba->eratt_poll); in lpfc_sli4_driver_resource_setup()
5155 phba->eratt_poll.function = lpfc_poll_eratt; in lpfc_sli4_driver_resource_setup()
5156 phba->eratt_poll.data = (unsigned long) phba; in lpfc_sli4_driver_resource_setup()
5158 init_timer(&phba->fcf.redisc_wait); in lpfc_sli4_driver_resource_setup()
5159 phba->fcf.redisc_wait.function = lpfc_sli4_fcf_redisc_wait_tmo; in lpfc_sli4_driver_resource_setup()
5160 phba->fcf.redisc_wait.data = (unsigned long)phba; in lpfc_sli4_driver_resource_setup()
5166 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
5168 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
5170 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
5173 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
5176 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
5177 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
5178 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
5179 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
5185 if (!phba->sli.ring) in lpfc_sli4_driver_resource_setup()
5186 phba->sli.ring = kzalloc( in lpfc_sli4_driver_resource_setup()
5187 (LPFC_SLI3_MAX_RING + phba->cfg_fcp_io_channel) * in lpfc_sli4_driver_resource_setup()
5189 if (!phba->sli.ring) in lpfc_sli4_driver_resource_setup()
5198 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - 2) in lpfc_sli4_driver_resource_setup()
5199 phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - 2; in lpfc_sli4_driver_resource_setup()
5206 if (phba->cfg_enable_bg) { in lpfc_sli4_driver_resource_setup()
5216 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
5220 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
5222 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
5223 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
5230 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
5232 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct sli4_sge)); in lpfc_sli4_driver_resource_setup()
5235 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli4_driver_resource_setup()
5243 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5244 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5246 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
5247 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
5249 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
5250 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
5252 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
5254 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
5255 phba->cfg_total_seg_cnt); in lpfc_sli4_driver_resource_setup()
5260 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
5261 INIT_LIST_HEAD(&phba->rb_pend_list); in lpfc_sli4_driver_resource_setup()
5262 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
5263 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
5269 spin_lock_init(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_driver_resource_setup()
5270 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_driver_resource_setup()
5272 spin_lock_init(&phba->sli4_hba.abts_sgl_list_lock); in lpfc_sli4_driver_resource_setup()
5279 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
5281 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
5283 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
5285 INIT_LIST_HEAD(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
5287 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
5289 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
5292 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
5293 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
5294 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
5295 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
5298 lpfc_sli_setup(phba); in lpfc_sli4_driver_resource_setup()
5299 lpfc_sli_queue_setup(phba); in lpfc_sli4_driver_resource_setup()
5302 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
5307 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
5309 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
5312 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
5316 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
5321 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
5326 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
5329 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
5334 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
5336 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
5341 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
5350 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
5358 phba->sli4_hba.pc_sli4_params.supported = 1; in lpfc_sli4_driver_resource_setup()
5365 if (phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_driver_resource_setup()
5366 rc = lpfc_pc_sli4_params_get(phba, mboxq); in lpfc_sli4_driver_resource_setup()
5368 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
5378 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
5380 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
5381 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
5382 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5388 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
5391 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
5392 if (phba->cfg_fof) in lpfc_sli4_driver_resource_setup()
5396 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
5401 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
5406 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
5409 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
5411 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5415 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
5417 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5424 phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
5426 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
5427 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5434 phba->sli4_hba.fcp_eq_hdl = in lpfc_sli4_driver_resource_setup()
5436 (fof_vectors + phba->cfg_fcp_io_channel)), in lpfc_sli4_driver_resource_setup()
5438 if (!phba->sli4_hba.fcp_eq_hdl) { in lpfc_sli4_driver_resource_setup()
5439 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5446 phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * in lpfc_sli4_driver_resource_setup()
5448 phba->cfg_fcp_io_channel)), GFP_KERNEL); in lpfc_sli4_driver_resource_setup()
5449 if (!phba->sli4_hba.msix_entries) { in lpfc_sli4_driver_resource_setup()
5450 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5457 phba->sli4_hba.cpu_map = kzalloc((sizeof(struct lpfc_vector_map_info) * in lpfc_sli4_driver_resource_setup()
5458 phba->sli4_hba.num_present_cpu), in lpfc_sli4_driver_resource_setup()
5460 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
5461 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5471 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5474 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
5483 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_driver_resource_setup()
5485 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_sli4_driver_resource_setup()
5488 if (rc >= phba->cfg_fcp_io_channel) in lpfc_sli4_driver_resource_setup()
5496 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
5497 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
5498 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
5500 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5504 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
5505 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
5512 kfree(phba->sli4_hba.msix_entries); in lpfc_sli4_driver_resource_setup()
5514 kfree(phba->sli4_hba.fcp_eq_hdl); in lpfc_sli4_driver_resource_setup()
5516 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
5518 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
5520 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
5522 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
5524 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
5526 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
5538 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
5543 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
5544 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
5545 phba->sli4_hba.num_online_cpu = 0; in lpfc_sli4_driver_resource_unset()
5546 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
5549 kfree(phba->sli4_hba.msix_entries); in lpfc_sli4_driver_resource_unset()
5552 kfree(phba->sli4_hba.fcp_eq_hdl); in lpfc_sli4_driver_resource_unset()
5555 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
5556 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
5559 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
5562 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
5563 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
5566 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
5567 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
5570 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
5573 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
5576 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
5580 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
5599 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
5601 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
5602 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
5603 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
5606 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
5607 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
5608 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
5611 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
5612 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
5613 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
5616 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
5637 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
5642 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
5643 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
5646 spin_lock_init(&phba->ndlp_lock); in lpfc_setup_driver_resource_phase1()
5648 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
5649 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
5650 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
5653 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
5656 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
5657 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
5658 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
5659 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
5662 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
5665 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
5668 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
5671 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
5672 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
5689 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
5694 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
5695 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
5696 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
5697 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
5713 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
5716 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
5726 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
5730 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
5732 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
5735 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
5737 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
5754 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
5761 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
5771 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
5781 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
5782 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
5783 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
5784 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
5790 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
5803 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
5809 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
5821 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
5824 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_free_els_sgl_list()
5827 spin_lock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
5829 list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
5831 spin_unlock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
5834 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
5845 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
5849 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
5851 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
5853 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
5867 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
5869 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
5881 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
5884 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_sgl_list); in lpfc_init_sgl_list()
5885 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
5888 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
5891 phba->sli4_hba.scsi_xri_cnt = 0; in lpfc_init_sgl_list()
5909 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
5914 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
5915 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
5917 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
5920 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
5922 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_init_rpi_hdrs()
5924 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
5945 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
5957 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
5959 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
5963 rpi_limit = phba->sli4_hba.max_cfg_param.rpi_base + in lpfc_sli4_create_rpi_hdr()
5964 phba->sli4_hba.max_cfg_param.max_rpi - 1; in lpfc_sli4_create_rpi_hdr()
5966 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
5972 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
5973 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
5995 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
6016 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6020 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
6026 phba->sli4_hba.next_rpi += rpi_count; in lpfc_sli4_create_rpi_hdr()
6027 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6031 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
6048 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
6052 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
6056 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
6058 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
6065 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
6083 struct lpfc_hba *phba; in lpfc_hba_alloc() local
6086 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
6087 if (!phba) { in lpfc_hba_alloc()
6093 phba->pcidev = pdev; in lpfc_hba_alloc()
6096 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
6097 if (phba->brd_no < 0) { in lpfc_hba_alloc()
6098 kfree(phba); in lpfc_hba_alloc()
6102 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
6103 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
6105 return phba; in lpfc_hba_alloc()
6116 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
6119 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
6122 kfree(phba->sli.ring); in lpfc_hba_free()
6123 phba->sli.ring = NULL; in lpfc_hba_free()
6125 kfree(phba); in lpfc_hba_free()
6141 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
6147 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
6148 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
6149 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
6150 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
6152 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
6153 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
6158 phba->pport = vport; in lpfc_create_shost()
6161 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
6174 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
6176 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
6193 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
6200 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
6220 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
6228 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
6240 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6252 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6256 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6264 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6276 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6280 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6293 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
6299 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
6305 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
6306 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
6307 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_post_init_setup()
6308 lpfc_setup_bg(phba, shost); in lpfc_post_init_setup()
6312 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
6314 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
6318 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
6342 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
6351 if (!phba->pcidev) in lpfc_sli_pci_mem_setup()
6354 pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
6368 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
6371 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
6375 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
6376 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
6383 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
6384 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
6391 phba->slim2p.virt = dma_zalloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
6392 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
6393 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
6396 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
6397 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
6399 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
6400 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
6403 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
6405 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
6407 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
6411 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
6413 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
6414 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
6418 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
6419 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
6421 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
6423 INIT_LIST_HEAD(&phba->rb_pend_list); in lpfc_sli_pci_mem_setup()
6425 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
6426 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6427 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6428 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6429 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6435 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
6437 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
6439 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
6452 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
6457 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
6460 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
6464 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
6466 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
6469 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
6470 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
6485 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
6494 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
6499 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
6517 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
6531 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
6536 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6538 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6540 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6542 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6544 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6546 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
6553 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
6556 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
6557 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
6558 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
6559 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
6561 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
6563 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
6564 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
6565 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
6566 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
6575 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
6576 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
6582 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
6586 phba->work_status[0] = in lpfc_sli4_post_status_check()
6587 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
6589 phba->work_status[1] = in lpfc_sli4_post_status_check()
6590 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
6592 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
6599 phba->work_status[0], in lpfc_sli4_post_status_check()
6600 phba->work_status[1]); in lpfc_sli4_post_status_check()
6621 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
6625 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
6626 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
6627 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
6628 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
6629 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
6630 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
6631 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
6632 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
6633 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
6634 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
6637 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
6638 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6640 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
6641 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6643 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
6644 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6646 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
6647 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6649 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
6650 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
6651 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
6652 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6654 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6655 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6657 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6658 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6660 phba->sli4_hba.EQCQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6661 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
6662 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6663 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
6664 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
6665 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
6669 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
6684 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba) in lpfc_sli4_bar1_register_memmap() argument
6686 phba->sli4_hba.PSMPHRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6688 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6690 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6692 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6707 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
6712 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6715 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6718 phba->sli4_hba.EQCQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6720 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6722 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6743 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
6760 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
6774 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
6775 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
6777 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
6779 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
6790 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
6791 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
6796 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
6814 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
6816 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
6817 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
6818 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
6819 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
6821 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
6822 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
6840 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
6851 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
6853 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6859 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
6861 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
6863 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6872 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
6873 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
6875 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
6877 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
6879 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
6880 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
6882 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
6885 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
6887 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
6889 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
6891 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
6893 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
6895 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
6897 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
6899 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
6901 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
6903 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
6905 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
6907 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
6909 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
6911 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
6913 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
6914 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
6915 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
6916 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
6917 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
6918 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
6919 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
6920 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
6927 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
6928 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
6929 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
6930 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
6931 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
6932 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
6933 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
6934 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
6935 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
6936 phba->sli4_hba.max_cfg_param.max_fcfi); in lpfc_sli4_read_config()
6943 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
6944 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
6945 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
6946 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
6948 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
6949 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
6952 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_sli4_read_config()
6959 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
6963 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
6969 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6992 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
6994 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
7001 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
7003 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
7004 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
7006 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7012 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
7030 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
7037 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
7040 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
7043 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
7056 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
7058 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
7064 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
7088 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
7093 int fof_vectors = phba->cfg_fof ? 1 : 0; in lpfc_sli4_queue_verify()
7101 cfg_fcp_io_channel = phba->cfg_fcp_io_channel; in lpfc_sli4_queue_verify()
7108 phba->sli4_hba.num_online_cpu = i; in lpfc_sli4_queue_verify()
7109 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_queue_verify()
7110 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_queue_verify()
7113 lpfc_printf_log(phba, in lpfc_sli4_queue_verify()
7122 phba->sli4_hba.max_cfg_param.max_eq) { in lpfc_sli4_queue_verify()
7123 if (phba->sli4_hba.max_cfg_param.max_eq < in lpfc_sli4_queue_verify()
7125 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
7129 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_queue_verify()
7130 phba->cfg_fcp_io_channel); in lpfc_sli4_queue_verify()
7133 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
7137 phba->sli4_hba.max_cfg_param.max_eq); in lpfc_sli4_queue_verify()
7138 cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq - in lpfc_sli4_queue_verify()
7143 phba->cfg_fcp_io_channel = cfg_fcp_io_channel; in lpfc_sli4_queue_verify()
7146 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
7147 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
7150 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
7151 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
7173 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
7181 if (!phba->cfg_fcp_io_channel) in lpfc_sli4_queue_create()
7184 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
7185 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
7186 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
7187 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
7188 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
7189 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
7191 phba->sli4_hba.hba_eq = kzalloc((sizeof(struct lpfc_queue *) * in lpfc_sli4_queue_create()
7192 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7193 if (!phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_create()
7194 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7200 phba->sli4_hba.fcp_cq = kzalloc((sizeof(struct lpfc_queue *) * in lpfc_sli4_queue_create()
7201 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7202 if (!phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_create()
7203 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7209 phba->sli4_hba.fcp_wq = kzalloc((sizeof(struct lpfc_queue *) * in lpfc_sli4_queue_create()
7210 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7211 if (!phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_create()
7212 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7223 phba->sli4_hba.fcp_cq_map = kzalloc((sizeof(uint16_t) * in lpfc_sli4_queue_create()
7224 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7225 if (!phba->sli4_hba.fcp_cq_map) { in lpfc_sli4_queue_create()
7226 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7236 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_create()
7239 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
7240 phba->sli4_hba.eq_ecount); in lpfc_sli4_queue_create()
7242 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7246 phba->sli4_hba.hba_eq[idx] = qdesc; in lpfc_sli4_queue_create()
7249 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
7250 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
7252 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7257 phba->sli4_hba.fcp_cq[idx] = qdesc; in lpfc_sli4_queue_create()
7260 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
7261 phba->sli4_hba.wq_ecount); in lpfc_sli4_queue_create()
7263 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7268 phba->sli4_hba.fcp_wq[idx] = qdesc; in lpfc_sli4_queue_create()
7277 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
7278 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
7280 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7284 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
7287 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
7288 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
7290 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7294 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
7303 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
7304 phba->sli4_hba.mq_ecount); in lpfc_sli4_queue_create()
7306 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7310 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
7317 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
7318 phba->sli4_hba.wq_ecount); in lpfc_sli4_queue_create()
7320 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7324 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
7331 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
7332 phba->sli4_hba.rq_ecount); in lpfc_sli4_queue_create()
7334 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7338 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
7341 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
7342 phba->sli4_hba.rq_ecount); in lpfc_sli4_queue_create()
7344 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7348 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
7351 if (phba->cfg_fof) in lpfc_sli4_queue_create()
7352 lpfc_fof_queue_create(phba); in lpfc_sli4_queue_create()
7356 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
7373 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
7377 if (phba->cfg_fof) in lpfc_sli4_queue_destroy()
7378 lpfc_fof_queue_destroy(phba); in lpfc_sli4_queue_destroy()
7380 if (phba->sli4_hba.hba_eq != NULL) { in lpfc_sli4_queue_destroy()
7382 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_destroy()
7383 if (phba->sli4_hba.hba_eq[idx] != NULL) { in lpfc_sli4_queue_destroy()
7385 phba->sli4_hba.hba_eq[idx]); in lpfc_sli4_queue_destroy()
7386 phba->sli4_hba.hba_eq[idx] = NULL; in lpfc_sli4_queue_destroy()
7389 kfree(phba->sli4_hba.hba_eq); in lpfc_sli4_queue_destroy()
7390 phba->sli4_hba.hba_eq = NULL; in lpfc_sli4_queue_destroy()
7393 if (phba->sli4_hba.fcp_cq != NULL) { in lpfc_sli4_queue_destroy()
7395 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_destroy()
7396 if (phba->sli4_hba.fcp_cq[idx] != NULL) { in lpfc_sli4_queue_destroy()
7398 phba->sli4_hba.fcp_cq[idx]); in lpfc_sli4_queue_destroy()
7399 phba->sli4_hba.fcp_cq[idx] = NULL; in lpfc_sli4_queue_destroy()
7402 kfree(phba->sli4_hba.fcp_cq); in lpfc_sli4_queue_destroy()
7403 phba->sli4_hba.fcp_cq = NULL; in lpfc_sli4_queue_destroy()
7406 if (phba->sli4_hba.fcp_wq != NULL) { in lpfc_sli4_queue_destroy()
7408 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_destroy()
7409 if (phba->sli4_hba.fcp_wq[idx] != NULL) { in lpfc_sli4_queue_destroy()
7411 phba->sli4_hba.fcp_wq[idx]); in lpfc_sli4_queue_destroy()
7412 phba->sli4_hba.fcp_wq[idx] = NULL; in lpfc_sli4_queue_destroy()
7415 kfree(phba->sli4_hba.fcp_wq); in lpfc_sli4_queue_destroy()
7416 phba->sli4_hba.fcp_wq = NULL; in lpfc_sli4_queue_destroy()
7420 if (phba->sli4_hba.fcp_cq_map != NULL) { in lpfc_sli4_queue_destroy()
7421 kfree(phba->sli4_hba.fcp_cq_map); in lpfc_sli4_queue_destroy()
7422 phba->sli4_hba.fcp_cq_map = NULL; in lpfc_sli4_queue_destroy()
7426 if (phba->sli4_hba.mbx_wq != NULL) { in lpfc_sli4_queue_destroy()
7427 lpfc_sli4_queue_free(phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
7428 phba->sli4_hba.mbx_wq = NULL; in lpfc_sli4_queue_destroy()
7432 if (phba->sli4_hba.els_wq != NULL) { in lpfc_sli4_queue_destroy()
7433 lpfc_sli4_queue_free(phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
7434 phba->sli4_hba.els_wq = NULL; in lpfc_sli4_queue_destroy()
7438 if (phba->sli4_hba.hdr_rq != NULL) { in lpfc_sli4_queue_destroy()
7439 lpfc_sli4_queue_free(phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
7440 phba->sli4_hba.hdr_rq = NULL; in lpfc_sli4_queue_destroy()
7442 if (phba->sli4_hba.dat_rq != NULL) { in lpfc_sli4_queue_destroy()
7443 lpfc_sli4_queue_free(phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
7444 phba->sli4_hba.dat_rq = NULL; in lpfc_sli4_queue_destroy()
7448 if (phba->sli4_hba.els_cq != NULL) { in lpfc_sli4_queue_destroy()
7449 lpfc_sli4_queue_free(phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
7450 phba->sli4_hba.els_cq = NULL; in lpfc_sli4_queue_destroy()
7454 if (phba->sli4_hba.mbx_cq != NULL) { in lpfc_sli4_queue_destroy()
7455 lpfc_sli4_queue_free(phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
7456 phba->sli4_hba.mbx_cq = NULL; in lpfc_sli4_queue_destroy()
7475 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
7477 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_queue_setup()
7488 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
7490 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7497 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
7501 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
7508 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7513 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
7518 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
7520 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
7521 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
7522 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
7524 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7526 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
7527 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
7530 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
7537 if (phba->cfg_fcp_io_channel && !phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_setup()
7538 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7543 for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_io_channel; fcp_eqidx++) { in lpfc_sli4_queue_setup()
7544 if (!phba->sli4_hba.hba_eq[fcp_eqidx]) { in lpfc_sli4_queue_setup()
7545 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7551 rc = lpfc_eq_create(phba, phba->sli4_hba.hba_eq[fcp_eqidx], in lpfc_sli4_queue_setup()
7552 (phba->cfg_fcp_imax / phba->cfg_fcp_io_channel)); in lpfc_sli4_queue_setup()
7554 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7560 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7563 phba->sli4_hba.hba_eq[fcp_eqidx]->queue_id); in lpfc_sli4_queue_setup()
7567 if (!phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_setup()
7568 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7575 for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++) { in lpfc_sli4_queue_setup()
7576 if (!phba->sli4_hba.fcp_cq[fcp_cqidx]) { in lpfc_sli4_queue_setup()
7577 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7583 rc = lpfc_cq_create(phba, phba->sli4_hba.fcp_cq[fcp_cqidx], in lpfc_sli4_queue_setup()
7584 phba->sli4_hba.hba_eq[fcp_cqidx], LPFC_WCQ, LPFC_FCP); in lpfc_sli4_queue_setup()
7586 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7594 phba->sli4_hba.fcp_cq_map[fcp_cqidx] = in lpfc_sli4_queue_setup()
7595 phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id; in lpfc_sli4_queue_setup()
7597 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7601 phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id, in lpfc_sli4_queue_setup()
7603 phba->sli4_hba.hba_eq[fcp_cqidx]->queue_id); in lpfc_sli4_queue_setup()
7607 if (!phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_setup()
7608 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7615 for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) { in lpfc_sli4_queue_setup()
7616 if (!phba->sli4_hba.fcp_wq[fcp_wqidx]) { in lpfc_sli4_queue_setup()
7617 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7623 rc = lpfc_wq_create(phba, phba->sli4_hba.fcp_wq[fcp_wqidx], in lpfc_sli4_queue_setup()
7624 phba->sli4_hba.fcp_cq[fcp_wqidx], in lpfc_sli4_queue_setup()
7627 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7636 pring->sli.sli4.wqp = (void *)phba->sli4_hba.fcp_wq[fcp_wqidx]; in lpfc_sli4_queue_setup()
7637 phba->sli4_hba.fcp_cq[fcp_wqidx]->pring = pring; in lpfc_sli4_queue_setup()
7639 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7643 phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id, in lpfc_sli4_queue_setup()
7645 phba->sli4_hba.fcp_cq[fcp_wqidx]->queue_id); in lpfc_sli4_queue_setup()
7652 if (!phba->sli4_hba.mbx_cq) { in lpfc_sli4_queue_setup()
7653 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7658 rc = lpfc_cq_create(phba, phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
7659 phba->sli4_hba.hba_eq[0], LPFC_MCQ, LPFC_MBOX); in lpfc_sli4_queue_setup()
7661 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7666 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7668 phba->sli4_hba.mbx_cq->queue_id, in lpfc_sli4_queue_setup()
7669 phba->sli4_hba.hba_eq[0]->queue_id); in lpfc_sli4_queue_setup()
7672 if (!phba->sli4_hba.els_cq) { in lpfc_sli4_queue_setup()
7673 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7678 rc = lpfc_cq_create(phba, phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
7679 phba->sli4_hba.hba_eq[0], LPFC_WCQ, LPFC_ELS); in lpfc_sli4_queue_setup()
7681 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7686 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7688 phba->sli4_hba.els_cq->queue_id, in lpfc_sli4_queue_setup()
7689 phba->sli4_hba.hba_eq[0]->queue_id); in lpfc_sli4_queue_setup()
7696 if (!phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
7697 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7702 rc = lpfc_mq_create(phba, phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
7703 phba->sli4_hba.mbx_cq, LPFC_MBOX); in lpfc_sli4_queue_setup()
7705 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7710 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7712 phba->sli4_hba.mbx_wq->queue_id, in lpfc_sli4_queue_setup()
7713 phba->sli4_hba.mbx_cq->queue_id); in lpfc_sli4_queue_setup()
7716 if (!phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
7717 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7722 rc = lpfc_wq_create(phba, phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
7723 phba->sli4_hba.els_cq, LPFC_ELS); in lpfc_sli4_queue_setup()
7725 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7733 pring->sli.sli4.wqp = (void *)phba->sli4_hba.els_wq; in lpfc_sli4_queue_setup()
7734 phba->sli4_hba.els_cq->pring = pring; in lpfc_sli4_queue_setup()
7736 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7738 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
7739 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
7744 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
7745 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7751 lpfc_rq_adjust_repost(phba, phba->sli4_hba.hdr_rq, LPFC_ELS_HBQ); in lpfc_sli4_queue_setup()
7752 lpfc_rq_adjust_repost(phba, phba->sli4_hba.dat_rq, LPFC_ELS_HBQ); in lpfc_sli4_queue_setup()
7754 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
7755 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
7757 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7763 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7766 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
7767 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
7768 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
7770 if (phba->cfg_fof) { in lpfc_sli4_queue_setup()
7771 rc = lpfc_fof_queue_setup(phba); in lpfc_sli4_queue_setup()
7773 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7784 for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_setup()
7786 lpfc_modify_fcp_eq_delay(phba, fcp_eqidx); in lpfc_sli4_queue_setup()
7790 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq); in lpfc_sli4_queue_setup()
7792 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_setup()
7794 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_setup()
7796 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_setup()
7798 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_setup()
7801 lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[fcp_wqidx]); in lpfc_sli4_queue_setup()
7804 lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_cqidx]); in lpfc_sli4_queue_setup()
7807 lpfc_eq_destroy(phba, phba->sli4_hba.hba_eq[fcp_eqidx]); in lpfc_sli4_queue_setup()
7825 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
7830 if (phba->cfg_fof) in lpfc_sli4_queue_unset()
7831 lpfc_fof_queue_destroy(phba); in lpfc_sli4_queue_unset()
7833 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
7835 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
7837 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
7839 if (phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_unset()
7840 for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_unset()
7842 lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[fcp_qidx]); in lpfc_sli4_queue_unset()
7845 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
7847 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
7849 if (phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_unset()
7850 for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_unset()
7852 lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_qidx]); in lpfc_sli4_queue_unset()
7855 if (phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_unset()
7856 for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_unset()
7858 lpfc_eq_destroy(phba, phba->sli4_hba.hba_eq[fcp_qidx]); in lpfc_sli4_queue_unset()
7879 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
7884 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
7889 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
7894 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
7909 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
7914 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
7931 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
7935 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
7951 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
7956 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
7957 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
7958 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
7971 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
7974 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
7986 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
7990 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
7991 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
7992 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
8003 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
8010 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
8012 list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
8015 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
8018 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
8020 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
8024 lpfc_sli4_cq_event_release(phba, cqe); in lpfc_sli4_cq_event_release_all()
8041 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
8052 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
8055 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
8058 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8066 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
8069 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
8076 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
8078 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8094 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
8105 phba->work_status[0] = readl( in lpfc_pci_function_reset()
8106 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
8107 phba->work_status[1] = readl( in lpfc_pci_function_reset()
8108 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
8109 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8113 phba->work_status[0], in lpfc_pci_function_reset()
8114 phba->work_status[1]); in lpfc_pci_function_reset()
8128 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
8131 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
8151 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8172 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
8180 if (!phba->pcidev) in lpfc_sli4_pci_mem_setup()
8183 pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
8199 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
8204 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
8206 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
8209 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
8213 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
8221 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
8228 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8229 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
8230 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8236 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
8238 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
8240 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
8247 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8248 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
8249 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8255 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
8264 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
8266 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8267 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
8268 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8273 phba->pci_bar2_memmap_p = phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
8274 lpfc_sli4_bar1_register_memmap(phba); in lpfc_sli4_pci_mem_setup()
8283 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
8285 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8286 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
8287 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8292 phba->pci_bar4_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
8293 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
8301 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
8303 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
8305 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
8318 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
8321 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
8325 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8326 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8327 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8330 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8334 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
8362 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
8369 phba->msix_entries[i].entry = i; in lpfc_sli_enable_msix()
8372 rc = pci_enable_msix_exact(phba->pcidev, phba->msix_entries, in lpfc_sli_enable_msix()
8375 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
8380 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
8383 phba->msix_entries[i].vector, in lpfc_sli_enable_msix()
8384 phba->msix_entries[i].entry); in lpfc_sli_enable_msix()
8390 rc = request_irq(phba->msix_entries[0].vector, in lpfc_sli_enable_msix()
8392 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
8394 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
8401 rc = request_irq(phba->msix_entries[1].vector, in lpfc_sli_enable_msix()
8403 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
8406 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
8415 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
8419 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_enable_msix()
8424 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
8427 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
8429 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
8437 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
8442 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
8446 free_irq(phba->msix_entries[1].vector, phba); in lpfc_sli_enable_msix()
8450 free_irq(phba->msix_entries[0].vector, phba); in lpfc_sli_enable_msix()
8454 pci_disable_msix(phba->pcidev); in lpfc_sli_enable_msix()
8468 lpfc_sli_disable_msix(struct lpfc_hba *phba) in lpfc_sli_disable_msix() argument
8474 free_irq(phba->msix_entries[i].vector, phba); in lpfc_sli_disable_msix()
8476 pci_disable_msix(phba->pcidev); in lpfc_sli_disable_msix()
8496 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
8500 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
8502 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
8505 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
8510 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
8511 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
8513 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
8514 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
8531 lpfc_sli_disable_msi(struct lpfc_hba *phba) in lpfc_sli_disable_msi() argument
8533 free_irq(phba->pcidev->irq, phba); in lpfc_sli_disable_msi()
8534 pci_disable_msi(phba->pcidev); in lpfc_sli_disable_msi()
8555 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
8562 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
8565 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
8568 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
8575 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
8576 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
8579 phba->intr_type = MSI; in lpfc_sli_enable_intr()
8585 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
8586 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
8587 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
8590 phba->intr_type = INTx; in lpfc_sli_enable_intr()
8607 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
8610 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
8611 lpfc_sli_disable_msix(phba); in lpfc_sli_disable_intr()
8612 else if (phba->intr_type == MSI) in lpfc_sli_disable_intr()
8613 lpfc_sli_disable_msi(phba); in lpfc_sli_disable_intr()
8614 else if (phba->intr_type == INTx) in lpfc_sli_disable_intr()
8615 free_irq(phba->pcidev->irq, phba); in lpfc_sli_disable_intr()
8618 phba->intr_type = NONE; in lpfc_sli_disable_intr()
8619 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
8631 lpfc_find_next_cpu(struct lpfc_hba *phba, uint32_t phys_id) in lpfc_find_next_cpu() argument
8636 cpup = phba->sli4_hba.cpu_map; in lpfc_find_next_cpu()
8637 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_find_next_cpu()
8655 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_find_next_cpu()
8660 cpup = phba->sli4_hba.cpu_map; in lpfc_find_next_cpu()
8661 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_find_next_cpu()
8685 lpfc_sli4_set_affinity(struct lpfc_hba *phba, int vectors) in lpfc_sli4_set_affinity() argument
8697 if (!phba->cfg_fcp_cpu_map) in lpfc_sli4_set_affinity()
8701 memset(phba->sli4_hba.cpu_map, 0xff, in lpfc_sli4_set_affinity()
8703 phba->sli4_hba.num_present_cpu)); in lpfc_sli4_set_affinity()
8712 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8713 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_sli4_set_affinity()
8724 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8738 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8739 cpu = lpfc_find_next_cpu(phba, phys_id); in lpfc_sli4_set_affinity()
8747 cpu = lpfc_find_next_cpu(phba, phys_id); in lpfc_sli4_set_affinity()
8754 phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_ROUND_ROBIN; in lpfc_sli4_set_affinity()
8756 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8757 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_sli4_set_affinity()
8761 if (chan >= phba->cfg_fcp_io_channel) in lpfc_sli4_set_affinity()
8765 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_set_affinity()
8773 if (phba->cfg_fcp_cpu_map == LPFC_DRIVER_CPU_MAP) in lpfc_sli4_set_affinity()
8777 cpup->irq = phba->sli4_hba.msix_entries[idx].vector; in lpfc_sli4_set_affinity()
8787 i = irq_set_affinity_hint(phba->sli4_hba.msix_entries[idx]. in lpfc_sli4_set_affinity()
8790 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8794 phba->sli4_hba.msix_entries[idx].vector, i); in lpfc_sli4_set_affinity()
8815 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) in lpfc_sli4_set_affinity()
8826 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8829 for (idx = 0; idx < phba->sli4_hba.num_present_cpu; in lpfc_sli4_set_affinity()
8846 phba->cfg_fcp_io_channel; in lpfc_sli4_set_affinity()
8855 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8862 if (cpu >= phba->sli4_hba.num_present_cpu) { in lpfc_sli4_set_affinity()
8863 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8871 if (phba->sli4_hba.num_online_cpu != phba->sli4_hba.num_present_cpu) { in lpfc_sli4_set_affinity()
8872 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8873 for (idx = 0; idx < phba->sli4_hba.num_present_cpu; idx++) { in lpfc_sli4_set_affinity()
8878 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8888 if (num_io_channel != phba->sli4_hba.num_present_cpu) in lpfc_sli4_set_affinity()
8889 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_set_affinity()
8892 num_io_channel, phba->sli4_hba.num_present_cpu, in lpfc_sli4_set_affinity()
8896 phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_BY_CPU; in lpfc_sli4_set_affinity()
8920 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
8925 for (index = 0; index < phba->cfg_fcp_io_channel; index++) in lpfc_sli4_enable_msix()
8926 phba->sli4_hba.msix_entries[index].entry = index; in lpfc_sli4_enable_msix()
8929 vectors = phba->cfg_fcp_io_channel; in lpfc_sli4_enable_msix()
8930 if (phba->cfg_fof) { in lpfc_sli4_enable_msix()
8931 phba->sli4_hba.msix_entries[index].entry = index; in lpfc_sli4_enable_msix()
8934 rc = pci_enable_msix_range(phba->pcidev, phba->sli4_hba.msix_entries, in lpfc_sli4_enable_msix()
8937 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
8945 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
8948 phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8949 phba->sli4_hba.msix_entries[index].entry); in lpfc_sli4_enable_msix()
8953 memset(&phba->sli4_hba.handler_name[index], 0, 16); in lpfc_sli4_enable_msix()
8954 snprintf((char *)&phba->sli4_hba.handler_name[index], in lpfc_sli4_enable_msix()
8958 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_msix()
8959 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msix()
8960 atomic_set(&phba->sli4_hba.fcp_eq_hdl[index].fcp_eq_in_use, 1); in lpfc_sli4_enable_msix()
8961 if (phba->cfg_fof && (index == (vectors - 1))) in lpfc_sli4_enable_msix()
8963 phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8965 (char *)&phba->sli4_hba.handler_name[index], in lpfc_sli4_enable_msix()
8966 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_enable_msix()
8969 phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8971 (char *)&phba->sli4_hba.handler_name[index], in lpfc_sli4_enable_msix()
8972 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_enable_msix()
8974 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
8981 if (phba->cfg_fof) in lpfc_sli4_enable_msix()
8984 if (vectors != phba->cfg_fcp_io_channel) { in lpfc_sli4_enable_msix()
8985 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_enable_msix()
8988 phba->cfg_fcp_io_channel, vectors); in lpfc_sli4_enable_msix()
8989 phba->cfg_fcp_io_channel = vectors; in lpfc_sli4_enable_msix()
8992 if (!shost_use_blk_mq(lpfc_shost_from_vport(phba->pport))) in lpfc_sli4_enable_msix()
8993 lpfc_sli4_set_affinity(phba, vectors); in lpfc_sli4_enable_msix()
8999 irq_set_affinity_hint(phba->sli4_hba.msix_entries[index]. in lpfc_sli4_enable_msix()
9001 free_irq(phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
9002 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_enable_msix()
9006 pci_disable_msix(phba->pcidev); in lpfc_sli4_enable_msix()
9020 lpfc_sli4_disable_msix(struct lpfc_hba *phba) in lpfc_sli4_disable_msix() argument
9025 for (index = 0; index < phba->cfg_fcp_io_channel; index++) { in lpfc_sli4_disable_msix()
9026 irq_set_affinity_hint(phba->sli4_hba.msix_entries[index]. in lpfc_sli4_disable_msix()
9028 free_irq(phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_disable_msix()
9029 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_disable_msix()
9031 if (phba->cfg_fof) { in lpfc_sli4_disable_msix()
9032 free_irq(phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_disable_msix()
9033 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_disable_msix()
9036 pci_disable_msix(phba->pcidev); in lpfc_sli4_disable_msix()
9056 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
9060 rc = pci_enable_msi(phba->pcidev); in lpfc_sli4_enable_msi()
9062 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
9065 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
9070 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
9071 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
9073 pci_disable_msi(phba->pcidev); in lpfc_sli4_enable_msi()
9074 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
9079 for (index = 0; index < phba->cfg_fcp_io_channel; index++) { in lpfc_sli4_enable_msi()
9080 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
9081 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
9084 if (phba->cfg_fof) { in lpfc_sli4_enable_msi()
9085 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
9086 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
9102 lpfc_sli4_disable_msi(struct lpfc_hba *phba) in lpfc_sli4_disable_msi() argument
9104 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_msi()
9105 pci_disable_msi(phba->pcidev); in lpfc_sli4_disable_msi()
9126 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
9136 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
9139 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
9146 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
9147 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
9150 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
9156 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
9157 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
9158 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
9161 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
9163 for (index = 0; index < phba->cfg_fcp_io_channel; in lpfc_sli4_enable_intr()
9165 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_intr()
9166 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_intr()
9167 atomic_set(&phba->sli4_hba.fcp_eq_hdl[index]. in lpfc_sli4_enable_intr()
9170 if (phba->cfg_fof) { in lpfc_sli4_enable_intr()
9171 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_intr()
9172 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_intr()
9173 atomic_set(&phba->sli4_hba.fcp_eq_hdl[index]. in lpfc_sli4_enable_intr()
9191 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
9194 if (phba->intr_type == MSIX) in lpfc_sli4_disable_intr()
9195 lpfc_sli4_disable_msix(phba); in lpfc_sli4_disable_intr()
9196 else if (phba->intr_type == MSI) in lpfc_sli4_disable_intr()
9197 lpfc_sli4_disable_msi(phba); in lpfc_sli4_disable_intr()
9198 else if (phba->intr_type == INTx) in lpfc_sli4_disable_intr()
9199 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
9202 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
9203 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
9216 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
9218 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
9225 kfree(phba->vpi_bmask); in lpfc_unset_hba()
9226 kfree(phba->vpi_ids); in lpfc_unset_hba()
9228 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
9230 phba->pport->work_port_events = 0; in lpfc_unset_hba()
9232 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
9234 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
9236 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
9255 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
9258 int fcp_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
9259 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
9264 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
9269 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
9280 list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
9282 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
9297 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
9301 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
9303 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
9304 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
9312 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9313 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
9314 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9316 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
9322 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
9323 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9324 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
9326 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
9327 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
9328 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
9329 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9333 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
9336 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
9339 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
9342 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
9346 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
9349 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
9350 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
9353 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
9369 lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_pc_sli4_params_get() argument
9381 if (!phba->sli4_hba.intr_enable) in lpfc_pc_sli4_params_get()
9382 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pc_sli4_params_get()
9384 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_pc_sli4_params_get()
9385 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_pc_sli4_params_get()
9391 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_pc_sli4_params_get()
9441 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
9455 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
9460 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
9463 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
9464 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
9466 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
9467 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
9471 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
9481 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
9483 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
9496 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
9497 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
9526 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
9533 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
9534 if (!phba) in lpfc_pci_probe_one_s3()
9538 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
9543 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
9548 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
9550 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9556 error = lpfc_setup_driver_resource_phase1(phba); in lpfc_pci_probe_one_s3()
9558 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9564 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
9566 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9572 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
9574 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9580 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
9582 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9588 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
9591 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
9593 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9599 vport = phba->pport; in lpfc_pci_probe_one_s3()
9602 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9609 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
9612 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
9614 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
9616 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9622 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
9623 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9633 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
9635 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
9636 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
9639 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
9644 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
9651 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
9654 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
9659 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
9663 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
9665 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
9667 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
9669 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
9671 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
9673 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
9677 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
9696 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
9700 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9702 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9707 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
9709 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
9714 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
9728 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
9730 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
9732 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
9734 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
9735 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
9737 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
9738 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9740 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9745 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
9749 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
9757 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
9758 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
9761 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
9765 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
9768 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
9769 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
9771 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
9802 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
9804 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
9808 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
9809 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
9810 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
9813 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
9845 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
9849 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
9866 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
9867 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
9868 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
9869 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
9870 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
9877 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
9879 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
9883 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
9886 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
9887 lpfc_online(phba); in lpfc_pci_resume_one_s3()
9890 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
9903 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
9905 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_recover()
9912 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
9924 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
9926 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_reset()
9930 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
9933 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
9936 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli_prep_dev_for_reset()
9939 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
9942 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
9943 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
9955 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
9957 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_perm_failure()
9960 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
9963 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
9966 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
9991 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
9996 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
10000 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
10004 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
10008 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s3()
10010 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
10037 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
10038 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
10059 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
10061 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
10064 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
10066 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s3()
10071 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
10074 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
10075 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
10076 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
10079 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
10098 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
10101 lpfc_online(phba); in lpfc_io_resume_s3()
10104 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_io_resume_s3()
10115 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
10117 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
10119 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
10147 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
10168 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
10177 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
10179 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
10190 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
10215 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
10226 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
10232 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
10245 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
10252 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_sli4_request_firmware_update()
10256 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
10260 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
10261 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
10264 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
10266 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
10295 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
10303 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
10304 if (!phba) in lpfc_pci_probe_one_s4()
10308 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
10313 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
10318 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
10320 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10326 error = lpfc_setup_driver_resource_phase1(phba); in lpfc_pci_probe_one_s4()
10328 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10334 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
10336 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10343 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s4()
10345 phba->cfg_iocb_cnt*1024); in lpfc_pci_probe_one_s4()
10346 error = lpfc_init_iocb_list(phba, phba->cfg_iocb_cnt*1024); in lpfc_pci_probe_one_s4()
10349 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10354 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
10355 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
10358 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
10360 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10366 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
10369 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
10371 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10377 vport = phba->pport; in lpfc_pci_probe_one_s4()
10380 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10387 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
10390 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
10392 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
10394 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10400 if (phba->intr_type != MSIX) in lpfc_pci_probe_one_s4()
10403 adjusted_fcp_io_channel = phba->cfg_fcp_io_channel; in lpfc_pci_probe_one_s4()
10404 phba->cfg_fcp_io_channel = adjusted_fcp_io_channel; in lpfc_pci_probe_one_s4()
10406 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
10407 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10414 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
10415 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
10418 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
10421 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
10422 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
10425 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
10429 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
10433 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
10435 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
10437 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s4()
10439 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
10441 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
10443 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
10447 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
10466 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
10470 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10472 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10478 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
10480 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
10485 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
10500 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
10502 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10504 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10509 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s4()
10511 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
10514 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
10518 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
10521 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
10551 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
10553 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
10557 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
10558 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
10559 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
10562 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
10563 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
10595 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
10599 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
10616 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
10617 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
10618 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
10619 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
10620 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
10627 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
10629 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
10633 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
10636 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
10637 lpfc_online(phba); in lpfc_pci_resume_one_s4()
10640 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
10653 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
10655 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_recover()
10661 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
10673 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
10675 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
10679 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
10682 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
10685 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli4_prep_dev_for_reset()
10688 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
10691 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
10692 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
10693 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
10705 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
10707 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_perm_failure()
10711 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
10714 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
10717 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
10740 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
10745 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
10749 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
10753 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
10757 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
10759 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
10786 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
10787 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
10808 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
10810 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
10813 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
10815 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s4()
10820 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
10823 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
10842 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
10850 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
10852 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
10853 lpfc_offline(phba); in lpfc_io_resume_s4()
10854 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
10856 lpfc_online(phba); in lpfc_io_resume_s4()
10860 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_io_resume_s4()
10914 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
10916 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
10924 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_remove_one()
10926 phba->pci_dev_grp); in lpfc_pci_remove_one()
10950 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
10953 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
10961 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_suspend_one()
10963 phba->pci_dev_grp); in lpfc_pci_suspend_one()
10986 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
10989 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
10997 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one()
10999 phba->pci_dev_grp); in lpfc_pci_resume_one()
11024 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
11027 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
11035 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected()
11037 phba->pci_dev_grp); in lpfc_io_error_detected()
11061 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
11064 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
11072 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset()
11074 phba->pci_dev_grp); in lpfc_io_slot_reset()
11094 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
11096 switch (phba->pci_dev_grp) { in lpfc_io_resume()
11104 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_resume()
11106 phba->pci_dev_grp); in lpfc_io_resume()
11123 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
11126 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
11129 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
11130 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
11132 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
11133 if (phba->device_data_mem_pool) in lpfc_sli4_oas_verify()
11134 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
11135 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
11153 lpfc_fof_queue_setup(struct lpfc_hba *phba) in lpfc_fof_queue_setup() argument
11155 struct lpfc_sli *psli = &phba->sli; in lpfc_fof_queue_setup()
11158 rc = lpfc_eq_create(phba, phba->sli4_hba.fof_eq, LPFC_MAX_IMAX); in lpfc_fof_queue_setup()
11162 if (phba->cfg_fof) { in lpfc_fof_queue_setup()
11164 rc = lpfc_cq_create(phba, phba->sli4_hba.oas_cq, in lpfc_fof_queue_setup()
11165 phba->sli4_hba.fof_eq, LPFC_WCQ, LPFC_FCP); in lpfc_fof_queue_setup()
11169 rc = lpfc_wq_create(phba, phba->sli4_hba.oas_wq, in lpfc_fof_queue_setup()
11170 phba->sli4_hba.oas_cq, LPFC_FCP); in lpfc_fof_queue_setup()
11174 phba->sli4_hba.oas_cq->pring = &psli->ring[LPFC_FCP_OAS_RING]; in lpfc_fof_queue_setup()
11175 phba->sli4_hba.oas_ring = &psli->ring[LPFC_FCP_OAS_RING]; in lpfc_fof_queue_setup()
11181 lpfc_cq_destroy(phba, phba->sli4_hba.oas_cq); in lpfc_fof_queue_setup()
11183 lpfc_eq_destroy(phba, phba->sli4_hba.fof_eq); in lpfc_fof_queue_setup()
11203 lpfc_fof_queue_create(struct lpfc_hba *phba) in lpfc_fof_queue_create() argument
11208 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.eq_esize, in lpfc_fof_queue_create()
11209 phba->sli4_hba.eq_ecount); in lpfc_fof_queue_create()
11213 phba->sli4_hba.fof_eq = qdesc; in lpfc_fof_queue_create()
11215 if (phba->cfg_fof) { in lpfc_fof_queue_create()
11218 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_fof_queue_create()
11219 phba->sli4_hba.cq_ecount); in lpfc_fof_queue_create()
11223 phba->sli4_hba.oas_cq = qdesc; in lpfc_fof_queue_create()
11226 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, in lpfc_fof_queue_create()
11227 phba->sli4_hba.wq_ecount); in lpfc_fof_queue_create()
11231 phba->sli4_hba.oas_wq = qdesc; in lpfc_fof_queue_create()
11237 lpfc_fof_queue_destroy(phba); in lpfc_fof_queue_create()
11252 lpfc_fof_queue_destroy(struct lpfc_hba *phba) in lpfc_fof_queue_destroy() argument
11255 if (phba->sli4_hba.fof_eq != NULL) { in lpfc_fof_queue_destroy()
11256 lpfc_sli4_queue_free(phba->sli4_hba.fof_eq); in lpfc_fof_queue_destroy()
11257 phba->sli4_hba.fof_eq = NULL; in lpfc_fof_queue_destroy()
11261 if (phba->sli4_hba.oas_cq != NULL) { in lpfc_fof_queue_destroy()
11262 lpfc_sli4_queue_free(phba->sli4_hba.oas_cq); in lpfc_fof_queue_destroy()
11263 phba->sli4_hba.oas_cq = NULL; in lpfc_fof_queue_destroy()
11267 if (phba->sli4_hba.oas_wq != NULL) { in lpfc_fof_queue_destroy()
11268 lpfc_sli4_queue_free(phba->sli4_hba.oas_wq); in lpfc_fof_queue_destroy()
11269 phba->sli4_hba.oas_wq = NULL; in lpfc_fof_queue_destroy()