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()
704 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, in lpfc_hba_init_link_fc_topology()
707 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
708 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
710 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
712 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
713 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
714 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
716 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_hba_init_link_fc_topology()
720 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
722 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
723 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
725 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
726 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
728 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
730 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
733 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
735 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
754 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
759 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
761 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
765 lpfc_printf_log(phba, in lpfc_hba_down_link()
768 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
770 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
772 lpfc_printf_log(phba, in lpfc_hba_down_link()
777 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
781 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
798 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
803 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
805 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
806 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
809 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
810 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
812 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
814 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
817 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
836 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
842 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
843 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
844 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
846 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
848 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
849 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
851 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
857 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
863 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
880 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
882 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
888 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
889 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
893 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
895 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
901 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
905 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
907 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
922 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
924 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
931 if (phba->sli_rev >= LPFC_SLI_REV4) in lpfc_hba_clean_txcmplq()
934 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
941 if (phba->sli_rev >= LPFC_SLI_REV4) in lpfc_hba_clean_txcmplq()
944 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
947 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_hba_clean_txcmplq()
949 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
966 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
968 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
969 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
985 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
991 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_down_post_s4()
994 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s4()
995 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1004 spin_lock_irq(&phba->hbalock); /* required for lpfc_sgl_list and */ in lpfc_hba_down_post_s4()
1009 spin_lock(&phba->sli4_hba.abts_sgl_list_lock); in lpfc_hba_down_post_s4()
1011 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1015 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1016 &phba->sli4_hba.lpfc_sgl_list); in lpfc_hba_down_post_s4()
1018 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock); in lpfc_hba_down_post_s4()
1022 spin_lock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_hba_down_post_s4()
1023 list_splice_init(&phba->sli4_hba.lpfc_abts_scsi_buf_list, in lpfc_hba_down_post_s4()
1025 spin_unlock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_hba_down_post_s4()
1026 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1032 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1033 list_splice(&aborts, &phba->lpfc_scsi_buf_list_put); in lpfc_hba_down_post_s4()
1034 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1036 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1052 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1054 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1072 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1076 phba = (struct lpfc_hba *)ptr; in lpfc_hb_timeout()
1079 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1080 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1082 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1083 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1087 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1106 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1109 phba = (struct lpfc_hba *)ptr; in lpfc_rrq_timeout()
1110 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1111 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1112 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1114 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1115 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1117 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1118 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1138 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1142 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1143 phba->hb_outstanding = 0; in lpfc_hb_mbox_cmpl()
1144 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1147 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1148 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1149 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1150 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1151 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1174 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1180 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1183 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1185 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_hb_timeout_handler()
1187 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1189 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1190 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1191 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1194 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1196 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1199 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1200 if (!phba->hb_outstanding) in lpfc_hb_timeout_handler()
1201 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1205 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1210 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1212 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1213 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1214 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1215 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1216 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1217 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1218 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1223 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1227 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1230 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1231 if (!phba->hb_outstanding) { in lpfc_hb_timeout_handler()
1234 pmboxq = mempool_alloc(phba->mbox_mem_pool, in lpfc_hb_timeout_handler()
1237 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1244 lpfc_heart_beat(phba, pmboxq); in lpfc_hb_timeout_handler()
1246 pmboxq->vport = phba->pport; in lpfc_hb_timeout_handler()
1247 retval = lpfc_sli_issue_mbox(phba, pmboxq, in lpfc_hb_timeout_handler()
1253 phba->mbox_mem_pool); in lpfc_hb_timeout_handler()
1254 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1260 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1261 phba->hb_outstanding = 1; in lpfc_hb_timeout_handler()
1262 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1263 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1264 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1268 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1270 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1272 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1282 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1286 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1287 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1302 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1304 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1306 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1308 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1309 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1311 lpfc_offline(phba); in lpfc_offline_eratt()
1312 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1313 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1314 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1315 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1316 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1317 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1318 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1319 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1331 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1333 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1334 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1335 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1337 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1338 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1339 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1340 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1353 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1355 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1356 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1361 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1362 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1363 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1364 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1368 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_deferred_eratt()
1371 phba->work_hs, in lpfc_handle_deferred_eratt()
1372 phba->work_status[0], phba->work_status[1]); in lpfc_handle_deferred_eratt()
1374 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1376 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1384 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1390 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1391 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1394 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1396 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1397 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1401 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1402 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1412 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1413 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1415 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1416 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1417 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1418 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1419 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1423 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1430 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1448 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1450 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1451 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1460 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1461 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1462 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1463 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1468 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1472 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1474 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1475 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1477 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1478 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1480 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1483 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1484 phba->work_status[1]); in lpfc_handle_eratt_s3()
1485 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1487 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1490 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1491 phba->work_status[1]); in lpfc_handle_eratt_s3()
1493 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1495 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1503 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1509 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1510 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1511 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1512 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1513 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1516 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1517 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1518 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1523 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1527 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1528 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1530 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1537 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1538 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1539 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1540 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1547 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1550 phba->work_hs, in lpfc_handle_eratt_s3()
1551 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1559 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1576 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1586 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1590 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1593 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1594 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1596 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1597 lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1599 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1601 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1605 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1607 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1609 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1622 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1624 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
1639 if (pci_channel_offline(phba->pcidev)) in lpfc_handle_eratt_s4()
1642 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
1646 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
1649 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
1654 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1659 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
1663 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1665 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
1668 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
1669 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
1671 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1680 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
1687 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1688 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
1689 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1690 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1695 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1701 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1705 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1709 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
1713 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
1724 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1727 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1733 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
1736 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
1757 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
1759 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
1770 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
1772 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
1773 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
1779 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
1791 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_handle_latt()
1798 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
1801 lpfc_read_topology(phba, pmb, mp); in lpfc_handle_latt()
1805 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
1806 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
1813 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
1814 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
1815 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
1816 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
1821 phba->sli.ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
1822 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_handle_latt()
1826 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
1829 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
1831 control = readl(phba->HCregaddr); in lpfc_handle_latt()
1833 writel(control, phba->HCregaddr); in lpfc_handle_latt()
1834 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
1837 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
1838 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
1839 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
1840 lpfc_linkdown(phba); in lpfc_handle_latt()
1841 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
1843 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_handle_latt()
1864 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
1876 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
1910 phba->SerialNumber[j++] = vpd[index++]; in lpfc_parse_vpd()
1914 phba->SerialNumber[j] = 0; in lpfc_parse_vpd()
1918 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_parse_vpd()
1925 phba->ModelDesc[j++] = vpd[index++]; in lpfc_parse_vpd()
1929 phba->ModelDesc[j] = 0; in lpfc_parse_vpd()
1933 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_parse_vpd()
1940 phba->ModelName[j++] = vpd[index++]; in lpfc_parse_vpd()
1944 phba->ModelName[j] = 0; in lpfc_parse_vpd()
1948 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_parse_vpd()
1955 phba->ProgramType[j++] = vpd[index++]; in lpfc_parse_vpd()
1959 phba->ProgramType[j] = 0; in lpfc_parse_vpd()
1963 phba->vpd_flag |= VPD_PORT; in lpfc_parse_vpd()
1970 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_parse_vpd()
1971 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
1976 phba->Port[j++] = vpd[index++]; in lpfc_parse_vpd()
1980 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_parse_vpd()
1981 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
1983 phba->Port[j] = 0; in lpfc_parse_vpd()
2021 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2024 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2038 if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2040 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2042 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2044 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2046 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2048 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2053 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2253 phba->Port); in lpfc_get_hba_model_desc()
2279 lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_post_buffer() argument
2290 iocb = lpfc_sli_get_iocbq(phba); in lpfc_post_buffer()
2301 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_post_buffer()
2304 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2314 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_post_buffer()
2318 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2320 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2346 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_post_buffer()
2348 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2352 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_post_buffer()
2356 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2360 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_post_buffer()
2362 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_post_buffer()
2380 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2382 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2385 lpfc_post_buffer(phba, &psli->ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
2491 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
2495 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
2505 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
2524 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
2528 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
2537 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2539 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2544 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2547 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2552 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2631 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2634 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2637 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2650 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2652 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2653 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
2655 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2658 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2660 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2661 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2672 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
2674 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
2675 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
2676 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
2677 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
2678 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
2679 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
2680 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
2681 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
2683 phba->hb_outstanding = 0; in lpfc_stop_hba_timers()
2685 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
2688 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
2692 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
2695 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_stop_hba_timers()
2697 phba->pci_dev_grp); in lpfc_stop_hba_timers()
2714 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
2720 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2721 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
2722 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2726 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2727 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
2728 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
2732 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
2733 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
2735 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2738 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
2742 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_block_mgmt_io()
2745 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
2760 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
2766 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
2769 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
2771 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
2780 lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
2794 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
2810 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
2817 if (!phba) in lpfc_online()
2819 vport = phba->pport; in lpfc_online()
2824 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
2827 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
2829 if (!lpfc_sli_queue_setup(phba)) { in lpfc_online()
2830 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2834 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
2835 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
2836 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2839 spin_lock_irq(&phba->hbalock); in lpfc_online()
2840 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
2842 spin_unlock_irq(&phba->hbalock); in lpfc_online()
2844 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
2845 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2850 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
2852 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
2857 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
2859 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
2868 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
2870 lpfc_unblock_mgmt_io(phba); in lpfc_online()
2886 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
2890 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
2891 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
2892 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
2904 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
2906 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
2915 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
2917 lpfc_linkdown(phba); in lpfc_offline_prep()
2920 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
2922 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
2954 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
2964 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
2970 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
2972 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
2984 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
2990 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
2994 lpfc_stop_port(phba); in lpfc_offline()
2995 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
2997 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
2999 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3000 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3004 lpfc_sli_hba_down(phba); in lpfc_offline()
3005 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3006 phba->work_ha = 0; in lpfc_offline()
3007 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3008 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3010 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3017 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3029 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3034 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3038 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3039 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3042 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data, in lpfc_scsi_free()
3045 phba->total_scsi_bufs--; in lpfc_scsi_free()
3047 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3049 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3050 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3053 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data, in lpfc_scsi_free()
3056 phba->total_scsi_bufs--; in lpfc_scsi_free()
3058 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3061 list_for_each_entry_safe(io, io_next, &phba->lpfc_iocb_list, list) { in lpfc_scsi_free()
3064 phba->total_iocbq_bufs--; in lpfc_scsi_free()
3067 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3083 lpfc_sli4_xri_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_xri_sgl_update() argument
3091 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_sli4_xri_sgl_update()
3096 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_xri_sgl_update()
3097 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_xri_sgl_update()
3099 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_xri_sgl_update()
3100 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3102 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_xri_sgl_update()
3109 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3116 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_xri_sgl_update()
3120 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3131 spin_lock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3133 list_splice_init(&els_sgl_list, &phba->sli4_hba.lpfc_sgl_list); in lpfc_sli4_xri_sgl_update()
3135 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3136 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_xri_sgl_update()
3138 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_xri_sgl_update()
3139 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3141 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_xri_sgl_update()
3143 spin_lock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3145 list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &els_sgl_list); in lpfc_sli4_xri_sgl_update()
3147 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3153 lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_xri_sgl_update()
3158 spin_lock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3160 list_splice_init(&els_sgl_list, &phba->sli4_hba.lpfc_sgl_list); in lpfc_sli4_xri_sgl_update()
3162 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_xri_sgl_update()
3164 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3167 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_xri_sgl_update()
3173 &phba->sli4_hba.lpfc_sgl_list, list) { in lpfc_sli4_xri_sgl_update()
3174 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_xri_sgl_update()
3176 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3183 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_xri_sgl_update()
3189 phba->total_scsi_bufs = 0; in lpfc_sli4_xri_sgl_update()
3192 phba->sli4_hba.scsi_xri_max = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_xri_sgl_update()
3195 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3198 phba->sli4_hba.scsi_xri_cnt, in lpfc_sli4_xri_sgl_update()
3199 phba->sli4_hba.scsi_xri_max); in lpfc_sli4_xri_sgl_update()
3201 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3202 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3203 list_splice_init(&phba->lpfc_scsi_buf_list_get, &scsi_sgl_list); in lpfc_sli4_xri_sgl_update()
3204 list_splice(&phba->lpfc_scsi_buf_list_put, &scsi_sgl_list); in lpfc_sli4_xri_sgl_update()
3205 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3206 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3208 if (phba->sli4_hba.scsi_xri_cnt > phba->sli4_hba.scsi_xri_max) { in lpfc_sli4_xri_sgl_update()
3210 scsi_xri_cnt = phba->sli4_hba.scsi_xri_cnt - in lpfc_sli4_xri_sgl_update()
3211 phba->sli4_hba.scsi_xri_max; in lpfc_sli4_xri_sgl_update()
3217 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, in lpfc_sli4_xri_sgl_update()
3222 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3223 phba->sli4_hba.scsi_xri_cnt -= scsi_xri_cnt; in lpfc_sli4_xri_sgl_update()
3224 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3231 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_xri_sgl_update()
3233 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_xri_sgl_update()
3240 psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_xri_sgl_update()
3242 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3243 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3244 list_splice_init(&scsi_sgl_list, &phba->lpfc_scsi_buf_list_get); in lpfc_sli4_xri_sgl_update()
3245 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_sli4_xri_sgl_update()
3246 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_xri_sgl_update()
3247 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_xri_sgl_update()
3252 lpfc_free_els_sgl_list(phba); in lpfc_sli4_xri_sgl_update()
3253 lpfc_scsi_free(phba); in lpfc_sli4_xri_sgl_update()
3274 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
3280 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
3284 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_create_port()
3295 vport->phba = phba; in lpfc_create_port()
3306 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
3308 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
3309 shost->sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_create_port()
3317 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
3318 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
3347 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
3351 spin_lock_irq(&phba->hbalock); in lpfc_create_port()
3352 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
3353 spin_unlock_irq(&phba->hbalock); in lpfc_create_port()
3373 struct lpfc_hba *phba = vport->phba; in destroy_port() local
3379 spin_lock_irq(&phba->hbalock); in destroy_port()
3381 spin_unlock_irq(&phba->hbalock); in destroy_port()
3424 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
3434 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
3441 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
3442 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
3455 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
3475 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
3493 if (phba->lmt & LMT_16Gb) in lpfc_host_attrib_init()
3495 if (phba->lmt & LMT_10Gb) in lpfc_host_attrib_init()
3497 if (phba->lmt & LMT_8Gb) in lpfc_host_attrib_init()
3499 if (phba->lmt & LMT_4Gb) in lpfc_host_attrib_init()
3501 if (phba->lmt & LMT_2Gb) in lpfc_host_attrib_init()
3503 if (phba->lmt & LMT_1Gb) in lpfc_host_attrib_init()
3518 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
3533 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
3536 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
3537 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
3539 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
3540 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
3543 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
3544 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
3556 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
3559 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
3560 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
3561 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
3572 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
3574 phba->lpfc_stop_port(phba); in lpfc_stop_port()
3584 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
3589 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
3590 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
3592 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
3594 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
3595 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
3611 struct lpfc_hba *phba = (struct lpfc_hba *)ptr; in lpfc_sli4_fcf_redisc_wait_tmo() local
3614 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
3615 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
3616 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
3620 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
3622 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
3623 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
3624 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
3627 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
3642 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
3654 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_fault()
3674 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
3692 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_type()
3712 lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_link_speed() argument
3735 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_link_speed()
3753 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
3757 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
3760 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
3797 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
3874 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
3884 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
3887 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
3888 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
3890 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
3896 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
3900 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_link_evt()
3902 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
3908 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
3911 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
3914 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
3917 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_link_evt()
3919 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
3922 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
3923 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
3925 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
3927 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
3929 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
3931 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
3933 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
3935 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
3938 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
3942 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
3943 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
3944 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
3945 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
3946 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
3947 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
3948 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
3953 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
3954 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
3966 mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
3973 lpfc_sli4_parse_latt_link_speed(phba, acqe_link)); in lpfc_sli4_async_link_evt()
3984 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
3991 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_link_evt()
4004 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
4012 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4018 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
4019 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
4021 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
4022 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
4024 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
4026 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
4028 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
4030 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
4032 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
4034 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
4038 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
4039 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
4040 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
4041 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()
4043 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
4044 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
4045 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
4047 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4053 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4057 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_fc_evt()
4059 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4065 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
4068 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
4071 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
4074 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_fc_evt()
4076 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
4078 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
4086 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_fc_evt()
4097 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
4110 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_sli4_async_sli_evt()
4112 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4120 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
4130 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
4134 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
4146 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4150 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
4162 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
4207 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
4212 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4218 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4242 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
4246 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
4247 if (!phba) in lpfc_sli4_perform_vport_cvl()
4252 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); in lpfc_sli4_perform_vport_cvl()
4266 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
4267 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
4270 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
4293 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
4298 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
4300 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
4302 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
4313 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
4325 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4326 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4331 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
4338 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
4344 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
4350 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
4355 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
4359 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4360 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
4361 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4365 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { in lpfc_sli4_async_fip_evt()
4366 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4371 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
4372 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4375 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4378 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4382 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
4385 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4391 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
4398 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4399 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4406 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4407 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
4408 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4410 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
4413 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4416 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
4425 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4427 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
4428 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4430 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4434 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
4436 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
4441 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4442 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
4443 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4448 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
4451 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
4456 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
4460 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
4461 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
4465 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
4472 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
4474 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
4483 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
4507 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4508 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
4509 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4513 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
4514 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4515 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
4519 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
4521 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
4526 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4527 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
4528 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
4533 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
4539 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
4543 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
4558 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
4561 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
4562 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_dcbx_evt()
4577 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
4582 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
4583 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
4584 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
4585 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
4587 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
4590 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
4600 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
4605 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4606 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
4607 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4609 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
4611 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4612 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
4614 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
4618 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
4622 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
4625 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
4629 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
4633 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
4636 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
4639 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_event_proc()
4646 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
4657 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
4661 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
4663 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
4665 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
4667 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
4668 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
4671 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
4673 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
4675 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
4691 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
4696 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
4700 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
4703 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4707 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4711 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4715 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
4730 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
4734 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
4738 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
4742 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
4746 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_intr_mode()
4765 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
4771 if (!phba->pcidev) in lpfc_enable_pci_dev()
4774 pdev = phba->pcidev; in lpfc_enable_pci_dev()
4797 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
4810 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
4816 if (!phba->pcidev) in lpfc_disable_pci_dev()
4819 pdev = phba->pcidev; in lpfc_disable_pci_dev()
4839 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
4842 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
4843 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
4846 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_reset_hba()
4847 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
4849 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
4850 lpfc_offline(phba); in lpfc_reset_hba()
4851 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
4852 lpfc_online(phba); in lpfc_reset_hba()
4853 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
4867 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
4869 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
4893 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
4895 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
4899 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
4901 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
4909 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
4914 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
4932 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
4942 init_timer(&phba->hb_tmofunc); in lpfc_sli_driver_resource_setup()
4943 phba->hb_tmofunc.function = lpfc_hb_timeout; in lpfc_sli_driver_resource_setup()
4944 phba->hb_tmofunc.data = (unsigned long)phba; in lpfc_sli_driver_resource_setup()
4946 psli = &phba->sli; in lpfc_sli_driver_resource_setup()
4950 psli->mbox_tmo.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4952 init_timer(&phba->fcp_poll_timer); in lpfc_sli_driver_resource_setup()
4953 phba->fcp_poll_timer.function = lpfc_poll_timeout; in lpfc_sli_driver_resource_setup()
4954 phba->fcp_poll_timer.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4956 init_timer(&phba->fabric_block_timer); in lpfc_sli_driver_resource_setup()
4957 phba->fabric_block_timer.function = lpfc_fabric_block_timeout; in lpfc_sli_driver_resource_setup()
4958 phba->fabric_block_timer.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4960 init_timer(&phba->eratt_poll); in lpfc_sli_driver_resource_setup()
4961 phba->eratt_poll.function = lpfc_poll_eratt; in lpfc_sli_driver_resource_setup()
4962 phba->eratt_poll.data = (unsigned long) phba; in lpfc_sli_driver_resource_setup()
4965 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
4966 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
4969 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
4970 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
4971 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
4973 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
4974 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
4977 if (!phba->sli.ring) in lpfc_sli_driver_resource_setup()
4978 phba->sli.ring = (struct lpfc_sli_ring *) in lpfc_sli_driver_resource_setup()
4981 if (!phba->sli.ring) in lpfc_sli_driver_resource_setup()
4990 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
4991 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
4994 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
5004 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
5008 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
5009 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
5012 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
5019 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
5021 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); in lpfc_sli_driver_resource_setup()
5024 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
5027 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
5029 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
5030 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
5032 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
5034 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
5039 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
5040 lpfc_sli_queue_setup(phba); in lpfc_sli_driver_resource_setup()
5043 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
5050 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
5051 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
5052 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
5054 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
5058 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
5059 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
5074 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
5077 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
5094 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
5106 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
5109 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
5118 init_timer(&phba->hb_tmofunc); in lpfc_sli4_driver_resource_setup()
5119 phba->hb_tmofunc.function = lpfc_hb_timeout; in lpfc_sli4_driver_resource_setup()
5120 phba->hb_tmofunc.data = (unsigned long)phba; in lpfc_sli4_driver_resource_setup()
5121 init_timer(&phba->rrq_tmr); in lpfc_sli4_driver_resource_setup()
5122 phba->rrq_tmr.function = lpfc_rrq_timeout; in lpfc_sli4_driver_resource_setup()
5123 phba->rrq_tmr.data = (unsigned long)phba; in lpfc_sli4_driver_resource_setup()
5125 psli = &phba->sli; in lpfc_sli4_driver_resource_setup()
5129 psli->mbox_tmo.data = (unsigned long) phba; in lpfc_sli4_driver_resource_setup()
5131 init_timer(&phba->fabric_block_timer); in lpfc_sli4_driver_resource_setup()
5132 phba->fabric_block_timer.function = lpfc_fabric_block_timeout; in lpfc_sli4_driver_resource_setup()
5133 phba->fabric_block_timer.data = (unsigned long) phba; in lpfc_sli4_driver_resource_setup()
5135 init_timer(&phba->eratt_poll); in lpfc_sli4_driver_resource_setup()
5136 phba->eratt_poll.function = lpfc_poll_eratt; in lpfc_sli4_driver_resource_setup()
5137 phba->eratt_poll.data = (unsigned long) phba; in lpfc_sli4_driver_resource_setup()
5139 init_timer(&phba->fcf.redisc_wait); in lpfc_sli4_driver_resource_setup()
5140 phba->fcf.redisc_wait.function = lpfc_sli4_fcf_redisc_wait_tmo; in lpfc_sli4_driver_resource_setup()
5141 phba->fcf.redisc_wait.data = (unsigned long)phba; in lpfc_sli4_driver_resource_setup()
5147 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
5149 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
5151 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
5154 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
5157 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
5158 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
5159 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
5160 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
5166 if (!phba->sli.ring) in lpfc_sli4_driver_resource_setup()
5167 phba->sli.ring = kzalloc( in lpfc_sli4_driver_resource_setup()
5168 (LPFC_SLI3_MAX_RING + phba->cfg_fcp_io_channel) * in lpfc_sli4_driver_resource_setup()
5170 if (!phba->sli.ring) in lpfc_sli4_driver_resource_setup()
5179 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - 2) in lpfc_sli4_driver_resource_setup()
5180 phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - 2; in lpfc_sli4_driver_resource_setup()
5187 if (phba->cfg_enable_bg) { in lpfc_sli4_driver_resource_setup()
5197 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
5201 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
5203 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
5204 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
5211 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
5213 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct sli4_sge)); in lpfc_sli4_driver_resource_setup()
5216 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli4_driver_resource_setup()
5224 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5225 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5227 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
5228 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
5230 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
5231 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
5233 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
5235 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
5236 phba->cfg_total_seg_cnt); in lpfc_sli4_driver_resource_setup()
5241 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
5242 INIT_LIST_HEAD(&phba->rb_pend_list); in lpfc_sli4_driver_resource_setup()
5243 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
5244 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
5250 spin_lock_init(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_driver_resource_setup()
5251 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_driver_resource_setup()
5253 spin_lock_init(&phba->sli4_hba.abts_sgl_list_lock); in lpfc_sli4_driver_resource_setup()
5260 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
5262 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
5264 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
5266 INIT_LIST_HEAD(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
5268 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
5270 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
5273 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
5274 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
5275 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
5276 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
5279 lpfc_sli_setup(phba); in lpfc_sli4_driver_resource_setup()
5280 lpfc_sli_queue_setup(phba); in lpfc_sli4_driver_resource_setup()
5283 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
5288 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
5290 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
5293 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
5297 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
5302 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
5307 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
5310 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
5315 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
5317 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
5322 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
5331 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
5339 phba->sli4_hba.pc_sli4_params.supported = 1; in lpfc_sli4_driver_resource_setup()
5346 if (phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_driver_resource_setup()
5347 rc = lpfc_pc_sli4_params_get(phba, mboxq); in lpfc_sli4_driver_resource_setup()
5349 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
5359 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
5361 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
5362 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
5363 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5369 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
5372 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
5373 if (phba->cfg_fof) in lpfc_sli4_driver_resource_setup()
5377 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
5382 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
5387 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
5390 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
5392 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5396 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
5398 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5405 phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
5407 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
5408 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5415 phba->sli4_hba.fcp_eq_hdl = in lpfc_sli4_driver_resource_setup()
5417 (fof_vectors + phba->cfg_fcp_io_channel)), in lpfc_sli4_driver_resource_setup()
5419 if (!phba->sli4_hba.fcp_eq_hdl) { in lpfc_sli4_driver_resource_setup()
5420 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5427 phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * in lpfc_sli4_driver_resource_setup()
5429 phba->cfg_fcp_io_channel)), GFP_KERNEL); in lpfc_sli4_driver_resource_setup()
5430 if (!phba->sli4_hba.msix_entries) { in lpfc_sli4_driver_resource_setup()
5431 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5438 phba->sli4_hba.cpu_map = kzalloc((sizeof(struct lpfc_vector_map_info) * in lpfc_sli4_driver_resource_setup()
5439 phba->sli4_hba.num_present_cpu), in lpfc_sli4_driver_resource_setup()
5441 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
5442 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5452 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5455 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
5464 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_driver_resource_setup()
5466 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_sli4_driver_resource_setup()
5469 if (rc >= phba->cfg_fcp_io_channel) in lpfc_sli4_driver_resource_setup()
5477 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
5478 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
5479 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
5481 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
5485 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
5486 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
5493 kfree(phba->sli4_hba.msix_entries); in lpfc_sli4_driver_resource_setup()
5495 kfree(phba->sli4_hba.fcp_eq_hdl); in lpfc_sli4_driver_resource_setup()
5497 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
5499 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
5501 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
5503 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
5505 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
5507 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
5519 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
5524 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
5525 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
5526 phba->sli4_hba.num_online_cpu = 0; in lpfc_sli4_driver_resource_unset()
5527 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
5530 kfree(phba->sli4_hba.msix_entries); in lpfc_sli4_driver_resource_unset()
5533 kfree(phba->sli4_hba.fcp_eq_hdl); in lpfc_sli4_driver_resource_unset()
5536 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
5537 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
5540 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
5543 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
5544 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
5547 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
5548 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
5551 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
5554 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
5557 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
5561 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
5580 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
5582 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
5583 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
5584 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
5587 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
5588 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
5589 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
5592 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
5593 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
5594 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
5597 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
5618 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
5623 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
5624 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
5627 spin_lock_init(&phba->ndlp_lock); in lpfc_setup_driver_resource_phase1()
5629 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
5630 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
5631 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
5634 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
5637 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
5638 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
5639 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
5640 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
5643 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
5646 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
5649 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
5652 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
5653 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
5670 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
5675 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
5676 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
5677 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
5678 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
5694 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
5697 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
5707 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
5711 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
5713 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
5716 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
5718 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
5735 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
5742 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
5752 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
5762 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
5763 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
5764 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
5765 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
5771 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
5784 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
5790 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
5802 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
5805 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_free_els_sgl_list()
5808 spin_lock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
5810 list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
5812 spin_unlock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
5815 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
5826 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
5830 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
5832 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
5834 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
5848 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
5850 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
5862 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
5865 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_sgl_list); in lpfc_init_sgl_list()
5866 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
5869 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
5872 phba->sli4_hba.scsi_xri_cnt = 0; in lpfc_init_sgl_list()
5890 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
5895 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
5896 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
5898 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
5901 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
5903 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_init_rpi_hdrs()
5905 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
5926 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
5938 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
5940 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
5944 rpi_limit = phba->sli4_hba.max_cfg_param.rpi_base + in lpfc_sli4_create_rpi_hdr()
5945 phba->sli4_hba.max_cfg_param.max_rpi - 1; in lpfc_sli4_create_rpi_hdr()
5947 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
5953 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
5954 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
5976 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
5997 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6001 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
6007 phba->sli4_hba.next_rpi += rpi_count; in lpfc_sli4_create_rpi_hdr()
6008 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6012 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
6029 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
6033 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
6037 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
6039 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
6046 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
6064 struct lpfc_hba *phba; in lpfc_hba_alloc() local
6067 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
6068 if (!phba) { in lpfc_hba_alloc()
6074 phba->pcidev = pdev; in lpfc_hba_alloc()
6077 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
6078 if (phba->brd_no < 0) { in lpfc_hba_alloc()
6079 kfree(phba); in lpfc_hba_alloc()
6083 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
6084 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
6086 return phba; in lpfc_hba_alloc()
6097 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
6100 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
6103 kfree(phba->sli.ring); in lpfc_hba_free()
6104 phba->sli.ring = NULL; in lpfc_hba_free()
6106 kfree(phba); in lpfc_hba_free()
6122 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
6128 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
6129 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
6130 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
6131 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
6133 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
6134 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
6139 phba->pport = vport; in lpfc_create_shost()
6142 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
6155 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
6157 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
6174 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
6181 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
6201 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
6209 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
6221 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6233 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6237 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6245 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6257 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6261 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
6274 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
6280 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
6286 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
6287 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
6288 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_post_init_setup()
6289 lpfc_setup_bg(phba, shost); in lpfc_post_init_setup()
6293 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
6295 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
6299 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
6323 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
6332 if (!phba->pcidev) in lpfc_sli_pci_mem_setup()
6335 pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
6349 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
6352 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
6356 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
6357 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
6364 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
6365 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
6372 phba->slim2p.virt = dma_zalloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
6373 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
6374 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
6377 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
6378 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
6380 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
6381 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
6384 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
6386 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
6388 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
6392 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
6394 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
6395 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
6399 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
6400 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
6402 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
6404 INIT_LIST_HEAD(&phba->rb_pend_list); in lpfc_sli_pci_mem_setup()
6406 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
6407 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6408 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6409 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6410 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
6416 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
6418 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
6420 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
6433 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
6438 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
6441 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
6445 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
6447 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
6450 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
6451 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
6466 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
6475 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
6480 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
6498 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
6512 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
6517 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6519 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6521 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6523 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6525 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
6527 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
6534 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
6537 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
6538 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
6539 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
6540 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
6542 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
6544 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
6545 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
6546 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
6547 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
6556 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
6557 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
6563 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
6567 phba->work_status[0] = in lpfc_sli4_post_status_check()
6568 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
6570 phba->work_status[1] = in lpfc_sli4_post_status_check()
6571 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
6573 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
6580 phba->work_status[0], in lpfc_sli4_post_status_check()
6581 phba->work_status[1]); in lpfc_sli4_post_status_check()
6602 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
6606 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
6607 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
6608 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
6609 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
6610 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
6611 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
6612 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
6613 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
6614 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
6615 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
6618 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
6619 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6621 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
6622 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6624 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
6625 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6627 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
6628 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6630 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
6631 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
6632 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
6633 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6635 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6636 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6638 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6639 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
6641 phba->sli4_hba.EQCQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6642 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
6643 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
6644 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
6645 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
6646 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
6650 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
6665 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba) in lpfc_sli4_bar1_register_memmap() argument
6667 phba->sli4_hba.PSMPHRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6669 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6671 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6673 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
6688 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
6693 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6696 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6699 phba->sli4_hba.EQCQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6701 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6703 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
6724 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
6741 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
6755 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
6756 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
6758 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
6760 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
6771 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
6772 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
6777 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
6795 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
6797 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
6798 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
6799 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
6800 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
6802 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
6803 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
6821 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
6832 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
6834 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6840 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
6842 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
6844 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6853 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
6854 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
6856 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
6858 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
6860 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
6861 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
6863 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
6866 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
6868 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
6870 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
6872 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
6874 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
6876 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
6878 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
6880 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
6882 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
6884 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
6886 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
6888 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
6890 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
6892 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
6894 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
6895 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
6896 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
6897 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
6898 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
6899 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
6900 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
6901 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
6908 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
6909 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
6910 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
6911 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
6912 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
6913 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
6914 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
6915 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
6916 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
6917 phba->sli4_hba.max_cfg_param.max_fcfi); in lpfc_sli4_read_config()
6924 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
6925 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
6926 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
6927 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
6929 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
6930 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
6933 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_sli4_read_config()
6940 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
6944 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
6950 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6973 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
6975 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
6982 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
6984 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
6985 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
6987 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
6993 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
7011 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
7018 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
7021 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
7024 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
7037 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
7039 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
7045 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
7069 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
7074 int fof_vectors = phba->cfg_fof ? 1 : 0; in lpfc_sli4_queue_verify()
7082 cfg_fcp_io_channel = phba->cfg_fcp_io_channel; in lpfc_sli4_queue_verify()
7089 phba->sli4_hba.num_online_cpu = i; in lpfc_sli4_queue_verify()
7090 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_queue_verify()
7091 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_queue_verify()
7094 lpfc_printf_log(phba, in lpfc_sli4_queue_verify()
7103 phba->sli4_hba.max_cfg_param.max_eq) { in lpfc_sli4_queue_verify()
7104 if (phba->sli4_hba.max_cfg_param.max_eq < in lpfc_sli4_queue_verify()
7106 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
7110 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_queue_verify()
7111 phba->cfg_fcp_io_channel); in lpfc_sli4_queue_verify()
7114 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
7118 phba->sli4_hba.max_cfg_param.max_eq); in lpfc_sli4_queue_verify()
7119 cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq - in lpfc_sli4_queue_verify()
7124 phba->cfg_fcp_io_channel = cfg_fcp_io_channel; in lpfc_sli4_queue_verify()
7127 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
7128 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
7131 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
7132 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
7154 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
7162 if (!phba->cfg_fcp_io_channel) in lpfc_sli4_queue_create()
7165 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
7166 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
7167 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
7168 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
7169 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
7170 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
7172 phba->sli4_hba.hba_eq = kzalloc((sizeof(struct lpfc_queue *) * in lpfc_sli4_queue_create()
7173 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7174 if (!phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_create()
7175 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7181 phba->sli4_hba.fcp_cq = kzalloc((sizeof(struct lpfc_queue *) * in lpfc_sli4_queue_create()
7182 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7183 if (!phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_create()
7184 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7190 phba->sli4_hba.fcp_wq = kzalloc((sizeof(struct lpfc_queue *) * in lpfc_sli4_queue_create()
7191 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7192 if (!phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_create()
7193 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7204 phba->sli4_hba.fcp_cq_map = kzalloc((sizeof(uint16_t) * in lpfc_sli4_queue_create()
7205 phba->cfg_fcp_io_channel), GFP_KERNEL); in lpfc_sli4_queue_create()
7206 if (!phba->sli4_hba.fcp_cq_map) { in lpfc_sli4_queue_create()
7207 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7217 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_create()
7220 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
7221 phba->sli4_hba.eq_ecount); in lpfc_sli4_queue_create()
7223 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7227 phba->sli4_hba.hba_eq[idx] = qdesc; in lpfc_sli4_queue_create()
7230 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
7231 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
7233 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7238 phba->sli4_hba.fcp_cq[idx] = qdesc; in lpfc_sli4_queue_create()
7241 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
7242 phba->sli4_hba.wq_ecount); in lpfc_sli4_queue_create()
7244 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7249 phba->sli4_hba.fcp_wq[idx] = qdesc; in lpfc_sli4_queue_create()
7258 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
7259 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
7261 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7265 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
7268 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
7269 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
7271 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7275 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
7284 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
7285 phba->sli4_hba.mq_ecount); in lpfc_sli4_queue_create()
7287 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7291 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
7298 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
7299 phba->sli4_hba.wq_ecount); in lpfc_sli4_queue_create()
7301 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7305 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
7312 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
7313 phba->sli4_hba.rq_ecount); in lpfc_sli4_queue_create()
7315 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7319 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
7322 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
7323 phba->sli4_hba.rq_ecount); in lpfc_sli4_queue_create()
7325 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
7329 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
7332 if (phba->cfg_fof) in lpfc_sli4_queue_create()
7333 lpfc_fof_queue_create(phba); in lpfc_sli4_queue_create()
7337 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
7354 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
7358 if (phba->cfg_fof) in lpfc_sli4_queue_destroy()
7359 lpfc_fof_queue_destroy(phba); in lpfc_sli4_queue_destroy()
7361 if (phba->sli4_hba.hba_eq != NULL) { in lpfc_sli4_queue_destroy()
7363 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_destroy()
7364 if (phba->sli4_hba.hba_eq[idx] != NULL) { in lpfc_sli4_queue_destroy()
7366 phba->sli4_hba.hba_eq[idx]); in lpfc_sli4_queue_destroy()
7367 phba->sli4_hba.hba_eq[idx] = NULL; in lpfc_sli4_queue_destroy()
7370 kfree(phba->sli4_hba.hba_eq); in lpfc_sli4_queue_destroy()
7371 phba->sli4_hba.hba_eq = NULL; in lpfc_sli4_queue_destroy()
7374 if (phba->sli4_hba.fcp_cq != NULL) { in lpfc_sli4_queue_destroy()
7376 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_destroy()
7377 if (phba->sli4_hba.fcp_cq[idx] != NULL) { in lpfc_sli4_queue_destroy()
7379 phba->sli4_hba.fcp_cq[idx]); in lpfc_sli4_queue_destroy()
7380 phba->sli4_hba.fcp_cq[idx] = NULL; in lpfc_sli4_queue_destroy()
7383 kfree(phba->sli4_hba.fcp_cq); in lpfc_sli4_queue_destroy()
7384 phba->sli4_hba.fcp_cq = NULL; in lpfc_sli4_queue_destroy()
7387 if (phba->sli4_hba.fcp_wq != NULL) { in lpfc_sli4_queue_destroy()
7389 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) { in lpfc_sli4_queue_destroy()
7390 if (phba->sli4_hba.fcp_wq[idx] != NULL) { in lpfc_sli4_queue_destroy()
7392 phba->sli4_hba.fcp_wq[idx]); in lpfc_sli4_queue_destroy()
7393 phba->sli4_hba.fcp_wq[idx] = NULL; in lpfc_sli4_queue_destroy()
7396 kfree(phba->sli4_hba.fcp_wq); in lpfc_sli4_queue_destroy()
7397 phba->sli4_hba.fcp_wq = NULL; in lpfc_sli4_queue_destroy()
7401 if (phba->sli4_hba.fcp_cq_map != NULL) { in lpfc_sli4_queue_destroy()
7402 kfree(phba->sli4_hba.fcp_cq_map); in lpfc_sli4_queue_destroy()
7403 phba->sli4_hba.fcp_cq_map = NULL; in lpfc_sli4_queue_destroy()
7407 if (phba->sli4_hba.mbx_wq != NULL) { in lpfc_sli4_queue_destroy()
7408 lpfc_sli4_queue_free(phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
7409 phba->sli4_hba.mbx_wq = NULL; in lpfc_sli4_queue_destroy()
7413 if (phba->sli4_hba.els_wq != NULL) { in lpfc_sli4_queue_destroy()
7414 lpfc_sli4_queue_free(phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
7415 phba->sli4_hba.els_wq = NULL; in lpfc_sli4_queue_destroy()
7419 if (phba->sli4_hba.hdr_rq != NULL) { in lpfc_sli4_queue_destroy()
7420 lpfc_sli4_queue_free(phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
7421 phba->sli4_hba.hdr_rq = NULL; in lpfc_sli4_queue_destroy()
7423 if (phba->sli4_hba.dat_rq != NULL) { in lpfc_sli4_queue_destroy()
7424 lpfc_sli4_queue_free(phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
7425 phba->sli4_hba.dat_rq = NULL; in lpfc_sli4_queue_destroy()
7429 if (phba->sli4_hba.els_cq != NULL) { in lpfc_sli4_queue_destroy()
7430 lpfc_sli4_queue_free(phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
7431 phba->sli4_hba.els_cq = NULL; in lpfc_sli4_queue_destroy()
7435 if (phba->sli4_hba.mbx_cq != NULL) { in lpfc_sli4_queue_destroy()
7436 lpfc_sli4_queue_free(phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
7437 phba->sli4_hba.mbx_cq = NULL; in lpfc_sli4_queue_destroy()
7456 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
7458 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_queue_setup()
7469 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
7471 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7478 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
7482 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
7489 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7494 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
7499 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
7501 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
7502 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
7503 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7505 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
7506 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
7509 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
7516 if (phba->cfg_fcp_io_channel && !phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_setup()
7517 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7522 for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_io_channel; fcp_eqidx++) { in lpfc_sli4_queue_setup()
7523 if (!phba->sli4_hba.hba_eq[fcp_eqidx]) { in lpfc_sli4_queue_setup()
7524 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7530 rc = lpfc_eq_create(phba, phba->sli4_hba.hba_eq[fcp_eqidx], in lpfc_sli4_queue_setup()
7531 (phba->cfg_fcp_imax / phba->cfg_fcp_io_channel)); in lpfc_sli4_queue_setup()
7533 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7539 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7542 phba->sli4_hba.hba_eq[fcp_eqidx]->queue_id); in lpfc_sli4_queue_setup()
7546 if (!phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_setup()
7547 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7554 for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++) { in lpfc_sli4_queue_setup()
7555 if (!phba->sli4_hba.fcp_cq[fcp_cqidx]) { in lpfc_sli4_queue_setup()
7556 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7562 rc = lpfc_cq_create(phba, phba->sli4_hba.fcp_cq[fcp_cqidx], in lpfc_sli4_queue_setup()
7563 phba->sli4_hba.hba_eq[fcp_cqidx], LPFC_WCQ, LPFC_FCP); in lpfc_sli4_queue_setup()
7565 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7573 phba->sli4_hba.fcp_cq_map[fcp_cqidx] = in lpfc_sli4_queue_setup()
7574 phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id; in lpfc_sli4_queue_setup()
7576 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7580 phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id, in lpfc_sli4_queue_setup()
7582 phba->sli4_hba.hba_eq[fcp_cqidx]->queue_id); in lpfc_sli4_queue_setup()
7586 if (!phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_setup()
7587 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7594 for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) { in lpfc_sli4_queue_setup()
7595 if (!phba->sli4_hba.fcp_wq[fcp_wqidx]) { in lpfc_sli4_queue_setup()
7596 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7602 rc = lpfc_wq_create(phba, phba->sli4_hba.fcp_wq[fcp_wqidx], in lpfc_sli4_queue_setup()
7603 phba->sli4_hba.fcp_cq[fcp_wqidx], in lpfc_sli4_queue_setup()
7606 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7615 pring->sli.sli4.wqp = (void *)phba->sli4_hba.fcp_wq[fcp_wqidx]; in lpfc_sli4_queue_setup()
7616 phba->sli4_hba.fcp_cq[fcp_wqidx]->pring = pring; in lpfc_sli4_queue_setup()
7618 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7622 phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id, in lpfc_sli4_queue_setup()
7624 phba->sli4_hba.fcp_cq[fcp_wqidx]->queue_id); in lpfc_sli4_queue_setup()
7631 if (!phba->sli4_hba.mbx_cq) { in lpfc_sli4_queue_setup()
7632 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7637 rc = lpfc_cq_create(phba, phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
7638 phba->sli4_hba.hba_eq[0], LPFC_MCQ, LPFC_MBOX); in lpfc_sli4_queue_setup()
7640 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7645 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7647 phba->sli4_hba.mbx_cq->queue_id, in lpfc_sli4_queue_setup()
7648 phba->sli4_hba.hba_eq[0]->queue_id); in lpfc_sli4_queue_setup()
7651 if (!phba->sli4_hba.els_cq) { in lpfc_sli4_queue_setup()
7652 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7657 rc = lpfc_cq_create(phba, phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
7658 phba->sli4_hba.hba_eq[0], LPFC_WCQ, LPFC_ELS); in lpfc_sli4_queue_setup()
7660 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7665 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7667 phba->sli4_hba.els_cq->queue_id, in lpfc_sli4_queue_setup()
7668 phba->sli4_hba.hba_eq[0]->queue_id); in lpfc_sli4_queue_setup()
7675 if (!phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
7676 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7681 rc = lpfc_mq_create(phba, phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
7682 phba->sli4_hba.mbx_cq, LPFC_MBOX); in lpfc_sli4_queue_setup()
7684 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7689 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7691 phba->sli4_hba.mbx_wq->queue_id, in lpfc_sli4_queue_setup()
7692 phba->sli4_hba.mbx_cq->queue_id); in lpfc_sli4_queue_setup()
7695 if (!phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
7696 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7701 rc = lpfc_wq_create(phba, phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
7702 phba->sli4_hba.els_cq, LPFC_ELS); in lpfc_sli4_queue_setup()
7704 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7712 pring->sli.sli4.wqp = (void *)phba->sli4_hba.els_wq; in lpfc_sli4_queue_setup()
7713 phba->sli4_hba.els_cq->pring = pring; in lpfc_sli4_queue_setup()
7715 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7717 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
7718 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
7723 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
7724 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7730 lpfc_rq_adjust_repost(phba, phba->sli4_hba.hdr_rq, LPFC_ELS_HBQ); in lpfc_sli4_queue_setup()
7731 lpfc_rq_adjust_repost(phba, phba->sli4_hba.dat_rq, LPFC_ELS_HBQ); in lpfc_sli4_queue_setup()
7733 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
7734 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
7736 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7742 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
7745 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
7746 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
7747 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
7749 if (phba->cfg_fof) { in lpfc_sli4_queue_setup()
7750 rc = lpfc_fof_queue_setup(phba); in lpfc_sli4_queue_setup()
7752 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
7763 for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_setup()
7765 lpfc_modify_fcp_eq_delay(phba, fcp_eqidx); in lpfc_sli4_queue_setup()
7769 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq); in lpfc_sli4_queue_setup()
7771 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_setup()
7773 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_setup()
7775 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_setup()
7777 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_setup()
7780 lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[fcp_wqidx]); in lpfc_sli4_queue_setup()
7783 lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_cqidx]); in lpfc_sli4_queue_setup()
7786 lpfc_eq_destroy(phba, phba->sli4_hba.hba_eq[fcp_eqidx]); in lpfc_sli4_queue_setup()
7804 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
7809 if (phba->cfg_fof) in lpfc_sli4_queue_unset()
7810 lpfc_fof_queue_destroy(phba); in lpfc_sli4_queue_unset()
7812 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
7814 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
7816 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
7818 if (phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_unset()
7819 for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_unset()
7821 lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[fcp_qidx]); in lpfc_sli4_queue_unset()
7824 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
7826 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
7828 if (phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_unset()
7829 for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_unset()
7831 lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_qidx]); in lpfc_sli4_queue_unset()
7834 if (phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_unset()
7835 for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_io_channel; in lpfc_sli4_queue_unset()
7837 lpfc_eq_destroy(phba, phba->sli4_hba.hba_eq[fcp_qidx]); in lpfc_sli4_queue_unset()
7858 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
7863 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
7868 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
7873 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
7888 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
7893 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
7910 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
7914 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
7930 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
7935 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
7936 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
7937 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
7950 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
7953 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
7965 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
7969 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
7970 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
7971 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
7982 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
7989 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
7991 list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
7994 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
7997 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
7999 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
8003 lpfc_sli4_cq_event_release(phba, cqe); in lpfc_sli4_cq_event_release_all()
8020 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
8031 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
8034 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
8037 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8045 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
8048 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
8055 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
8057 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8073 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
8084 phba->work_status[0] = readl( in lpfc_pci_function_reset()
8085 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
8086 phba->work_status[1] = readl( in lpfc_pci_function_reset()
8087 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
8088 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8092 phba->work_status[0], in lpfc_pci_function_reset()
8093 phba->work_status[1]); in lpfc_pci_function_reset()
8107 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
8110 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
8130 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
8151 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
8159 if (!phba->pcidev) in lpfc_sli4_pci_mem_setup()
8162 pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
8178 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
8183 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
8185 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
8188 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
8192 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
8200 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
8207 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8208 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
8209 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8215 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
8217 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
8219 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
8226 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8227 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
8228 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8234 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
8243 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
8245 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8246 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
8247 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8252 phba->pci_bar2_memmap_p = phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
8253 lpfc_sli4_bar1_register_memmap(phba); in lpfc_sli4_pci_mem_setup()
8262 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
8264 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
8265 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
8266 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
8271 phba->pci_bar4_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
8272 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
8280 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
8282 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
8284 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
8297 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
8300 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
8304 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8305 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8306 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8309 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
8313 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
8341 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
8348 phba->msix_entries[i].entry = i; in lpfc_sli_enable_msix()
8351 rc = pci_enable_msix_exact(phba->pcidev, phba->msix_entries, in lpfc_sli_enable_msix()
8354 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
8359 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
8362 phba->msix_entries[i].vector, in lpfc_sli_enable_msix()
8363 phba->msix_entries[i].entry); in lpfc_sli_enable_msix()
8369 rc = request_irq(phba->msix_entries[0].vector, in lpfc_sli_enable_msix()
8371 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
8373 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
8380 rc = request_irq(phba->msix_entries[1].vector, in lpfc_sli_enable_msix()
8382 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
8385 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
8394 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
8398 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_enable_msix()
8403 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
8406 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
8408 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
8416 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
8421 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
8425 free_irq(phba->msix_entries[1].vector, phba); in lpfc_sli_enable_msix()
8429 free_irq(phba->msix_entries[0].vector, phba); in lpfc_sli_enable_msix()
8433 pci_disable_msix(phba->pcidev); in lpfc_sli_enable_msix()
8447 lpfc_sli_disable_msix(struct lpfc_hba *phba) in lpfc_sli_disable_msix() argument
8453 free_irq(phba->msix_entries[i].vector, phba); in lpfc_sli_disable_msix()
8455 pci_disable_msix(phba->pcidev); in lpfc_sli_disable_msix()
8475 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
8479 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
8481 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
8484 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
8489 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
8490 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
8492 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
8493 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
8510 lpfc_sli_disable_msi(struct lpfc_hba *phba) in lpfc_sli_disable_msi() argument
8512 free_irq(phba->pcidev->irq, phba); in lpfc_sli_disable_msi()
8513 pci_disable_msi(phba->pcidev); in lpfc_sli_disable_msi()
8534 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
8541 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
8544 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
8547 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
8554 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
8555 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
8558 phba->intr_type = MSI; in lpfc_sli_enable_intr()
8564 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
8565 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
8566 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
8569 phba->intr_type = INTx; in lpfc_sli_enable_intr()
8586 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
8589 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
8590 lpfc_sli_disable_msix(phba); in lpfc_sli_disable_intr()
8591 else if (phba->intr_type == MSI) in lpfc_sli_disable_intr()
8592 lpfc_sli_disable_msi(phba); in lpfc_sli_disable_intr()
8593 else if (phba->intr_type == INTx) in lpfc_sli_disable_intr()
8594 free_irq(phba->pcidev->irq, phba); in lpfc_sli_disable_intr()
8597 phba->intr_type = NONE; in lpfc_sli_disable_intr()
8598 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
8610 lpfc_find_next_cpu(struct lpfc_hba *phba, uint32_t phys_id) in lpfc_find_next_cpu() argument
8615 cpup = phba->sli4_hba.cpu_map; in lpfc_find_next_cpu()
8616 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_find_next_cpu()
8634 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_find_next_cpu()
8639 cpup = phba->sli4_hba.cpu_map; in lpfc_find_next_cpu()
8640 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_find_next_cpu()
8664 lpfc_sli4_set_affinity(struct lpfc_hba *phba, int vectors) in lpfc_sli4_set_affinity() argument
8677 if (!phba->cfg_fcp_cpu_map) in lpfc_sli4_set_affinity()
8681 memset(phba->sli4_hba.cpu_map, 0xff, in lpfc_sli4_set_affinity()
8683 phba->sli4_hba.num_present_cpu)); in lpfc_sli4_set_affinity()
8692 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8693 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_sli4_set_affinity()
8704 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8718 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8719 cpu = lpfc_find_next_cpu(phba, phys_id); in lpfc_sli4_set_affinity()
8727 cpu = lpfc_find_next_cpu(phba, phys_id); in lpfc_sli4_set_affinity()
8734 phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_ROUND_ROBIN; in lpfc_sli4_set_affinity()
8736 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8737 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_sli4_set_affinity()
8741 if (chan >= phba->cfg_fcp_io_channel) in lpfc_sli4_set_affinity()
8745 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_set_affinity()
8753 if (phba->cfg_fcp_cpu_map == LPFC_DRIVER_CPU_MAP) in lpfc_sli4_set_affinity()
8757 cpup->irq = phba->sli4_hba.msix_entries[idx].vector; in lpfc_sli4_set_affinity()
8770 i = irq_set_affinity_hint(phba->sli4_hba.msix_entries[idx]. in lpfc_sli4_set_affinity()
8773 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8777 phba->sli4_hba.msix_entries[idx].vector, i); in lpfc_sli4_set_affinity()
8798 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) in lpfc_sli4_set_affinity()
8809 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8812 for (idx = 0; idx < phba->sli4_hba.num_present_cpu; in lpfc_sli4_set_affinity()
8829 phba->cfg_fcp_io_channel; in lpfc_sli4_set_affinity()
8838 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8845 if (cpu >= phba->sli4_hba.num_present_cpu) { in lpfc_sli4_set_affinity()
8846 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8854 if (phba->sli4_hba.num_online_cpu != phba->sli4_hba.num_present_cpu) { in lpfc_sli4_set_affinity()
8855 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_set_affinity()
8856 for (idx = 0; idx < phba->sli4_hba.num_present_cpu; idx++) { in lpfc_sli4_set_affinity()
8861 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_set_affinity()
8871 if (num_io_channel != phba->sli4_hba.num_present_cpu) in lpfc_sli4_set_affinity()
8872 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_set_affinity()
8875 num_io_channel, phba->sli4_hba.num_present_cpu, in lpfc_sli4_set_affinity()
8879 phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_BY_CPU; in lpfc_sli4_set_affinity()
8903 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
8908 for (index = 0; index < phba->cfg_fcp_io_channel; index++) in lpfc_sli4_enable_msix()
8909 phba->sli4_hba.msix_entries[index].entry = index; in lpfc_sli4_enable_msix()
8912 vectors = phba->cfg_fcp_io_channel; in lpfc_sli4_enable_msix()
8913 if (phba->cfg_fof) { in lpfc_sli4_enable_msix()
8914 phba->sli4_hba.msix_entries[index].entry = index; in lpfc_sli4_enable_msix()
8917 rc = pci_enable_msix_range(phba->pcidev, phba->sli4_hba.msix_entries, in lpfc_sli4_enable_msix()
8920 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
8928 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
8931 phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8932 phba->sli4_hba.msix_entries[index].entry); in lpfc_sli4_enable_msix()
8936 memset(&phba->sli4_hba.handler_name[index], 0, 16); in lpfc_sli4_enable_msix()
8937 snprintf((char *)&phba->sli4_hba.handler_name[index], in lpfc_sli4_enable_msix()
8941 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_msix()
8942 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msix()
8943 atomic_set(&phba->sli4_hba.fcp_eq_hdl[index].fcp_eq_in_use, 1); in lpfc_sli4_enable_msix()
8944 if (phba->cfg_fof && (index == (vectors - 1))) in lpfc_sli4_enable_msix()
8946 phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8948 (char *)&phba->sli4_hba.handler_name[index], in lpfc_sli4_enable_msix()
8949 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_enable_msix()
8952 phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8954 (char *)&phba->sli4_hba.handler_name[index], in lpfc_sli4_enable_msix()
8955 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_enable_msix()
8957 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
8964 if (phba->cfg_fof) in lpfc_sli4_enable_msix()
8967 if (vectors != phba->cfg_fcp_io_channel) { in lpfc_sli4_enable_msix()
8968 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_enable_msix()
8971 phba->cfg_fcp_io_channel, vectors); in lpfc_sli4_enable_msix()
8972 phba->cfg_fcp_io_channel = vectors; in lpfc_sli4_enable_msix()
8975 lpfc_sli4_set_affinity(phba, vectors); in lpfc_sli4_enable_msix()
8981 irq_set_affinity_hint(phba->sli4_hba.msix_entries[index]. in lpfc_sli4_enable_msix()
8983 free_irq(phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_enable_msix()
8984 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_enable_msix()
8988 pci_disable_msix(phba->pcidev); in lpfc_sli4_enable_msix()
9002 lpfc_sli4_disable_msix(struct lpfc_hba *phba) in lpfc_sli4_disable_msix() argument
9007 for (index = 0; index < phba->cfg_fcp_io_channel; index++) { in lpfc_sli4_disable_msix()
9008 irq_set_affinity_hint(phba->sli4_hba.msix_entries[index]. in lpfc_sli4_disable_msix()
9010 free_irq(phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_disable_msix()
9011 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_disable_msix()
9013 if (phba->cfg_fof) { in lpfc_sli4_disable_msix()
9014 free_irq(phba->sli4_hba.msix_entries[index].vector, in lpfc_sli4_disable_msix()
9015 &phba->sli4_hba.fcp_eq_hdl[index]); in lpfc_sli4_disable_msix()
9018 pci_disable_msix(phba->pcidev); in lpfc_sli4_disable_msix()
9038 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
9042 rc = pci_enable_msi(phba->pcidev); in lpfc_sli4_enable_msi()
9044 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
9047 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
9052 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
9053 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
9055 pci_disable_msi(phba->pcidev); in lpfc_sli4_enable_msi()
9056 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
9061 for (index = 0; index < phba->cfg_fcp_io_channel; index++) { in lpfc_sli4_enable_msi()
9062 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
9063 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
9066 if (phba->cfg_fof) { in lpfc_sli4_enable_msi()
9067 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
9068 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
9084 lpfc_sli4_disable_msi(struct lpfc_hba *phba) in lpfc_sli4_disable_msi() argument
9086 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_msi()
9087 pci_disable_msi(phba->pcidev); in lpfc_sli4_disable_msi()
9108 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
9118 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
9121 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
9128 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
9129 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
9132 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
9138 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
9139 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
9140 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
9143 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
9145 for (index = 0; index < phba->cfg_fcp_io_channel; in lpfc_sli4_enable_intr()
9147 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_intr()
9148 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_intr()
9149 atomic_set(&phba->sli4_hba.fcp_eq_hdl[index]. in lpfc_sli4_enable_intr()
9152 if (phba->cfg_fof) { in lpfc_sli4_enable_intr()
9153 phba->sli4_hba.fcp_eq_hdl[index].idx = index; in lpfc_sli4_enable_intr()
9154 phba->sli4_hba.fcp_eq_hdl[index].phba = phba; in lpfc_sli4_enable_intr()
9155 atomic_set(&phba->sli4_hba.fcp_eq_hdl[index]. in lpfc_sli4_enable_intr()
9173 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
9176 if (phba->intr_type == MSIX) in lpfc_sli4_disable_intr()
9177 lpfc_sli4_disable_msix(phba); in lpfc_sli4_disable_intr()
9178 else if (phba->intr_type == MSI) in lpfc_sli4_disable_intr()
9179 lpfc_sli4_disable_msi(phba); in lpfc_sli4_disable_intr()
9180 else if (phba->intr_type == INTx) in lpfc_sli4_disable_intr()
9181 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
9184 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
9185 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
9198 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
9200 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
9207 kfree(phba->vpi_bmask); in lpfc_unset_hba()
9208 kfree(phba->vpi_ids); in lpfc_unset_hba()
9210 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
9212 phba->pport->work_port_events = 0; in lpfc_unset_hba()
9214 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
9216 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
9218 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
9237 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
9240 int fcp_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
9241 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
9246 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
9251 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
9262 list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
9264 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
9279 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
9283 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
9285 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
9286 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
9294 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9295 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
9296 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9298 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
9304 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
9305 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9306 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
9308 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
9309 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
9310 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
9311 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
9315 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
9318 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
9321 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
9324 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
9328 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
9331 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
9332 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
9335 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
9351 lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_pc_sli4_params_get() argument
9363 if (!phba->sli4_hba.intr_enable) in lpfc_pc_sli4_params_get()
9364 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pc_sli4_params_get()
9366 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_pc_sli4_params_get()
9367 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_pc_sli4_params_get()
9373 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_pc_sli4_params_get()
9423 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
9437 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
9442 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
9445 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
9446 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
9448 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
9449 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
9453 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
9463 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
9465 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
9478 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
9479 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
9508 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
9515 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
9516 if (!phba) in lpfc_pci_probe_one_s3()
9520 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
9525 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
9530 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
9532 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9538 error = lpfc_setup_driver_resource_phase1(phba); in lpfc_pci_probe_one_s3()
9540 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9546 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
9548 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9554 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
9556 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9562 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
9564 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9570 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
9573 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
9575 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9581 vport = phba->pport; in lpfc_pci_probe_one_s3()
9584 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9591 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
9594 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
9596 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
9598 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9604 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
9605 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
9615 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
9617 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
9618 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
9621 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
9626 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
9633 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
9636 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
9641 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
9645 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
9647 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
9649 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
9651 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
9653 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
9655 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
9659 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
9678 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
9682 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9684 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9689 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
9691 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
9696 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
9710 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
9712 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
9714 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
9716 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
9717 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
9719 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
9720 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9722 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
9727 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
9731 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
9739 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
9740 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
9743 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
9747 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
9750 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
9751 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
9753 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
9784 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
9786 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
9790 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
9791 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
9792 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
9795 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
9827 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
9831 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
9848 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
9849 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
9850 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
9851 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
9852 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
9859 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
9861 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
9865 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
9868 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
9869 lpfc_online(phba); in lpfc_pci_resume_one_s3()
9872 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
9885 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
9887 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_recover()
9894 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
9906 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
9908 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_reset()
9912 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
9915 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
9918 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli_prep_dev_for_reset()
9921 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
9924 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
9925 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
9937 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
9939 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_perm_failure()
9942 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
9945 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
9948 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
9973 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
9978 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
9982 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
9986 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
9990 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s3()
9992 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
10019 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
10020 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
10041 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
10043 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
10046 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
10048 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s3()
10053 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
10056 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
10057 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
10058 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
10061 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
10080 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
10083 lpfc_online(phba); in lpfc_io_resume_s3()
10086 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_io_resume_s3()
10097 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
10099 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
10101 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
10129 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
10150 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
10159 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
10161 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
10172 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
10197 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
10208 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
10214 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
10227 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
10234 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_sli4_request_firmware_update()
10238 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
10242 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
10243 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
10246 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
10248 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
10277 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
10285 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
10286 if (!phba) in lpfc_pci_probe_one_s4()
10290 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
10295 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
10300 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
10302 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10308 error = lpfc_setup_driver_resource_phase1(phba); in lpfc_pci_probe_one_s4()
10310 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10316 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
10318 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10325 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s4()
10327 phba->cfg_iocb_cnt*1024); in lpfc_pci_probe_one_s4()
10328 error = lpfc_init_iocb_list(phba, phba->cfg_iocb_cnt*1024); in lpfc_pci_probe_one_s4()
10331 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10336 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
10337 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
10340 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
10342 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10348 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
10351 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
10353 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10359 vport = phba->pport; in lpfc_pci_probe_one_s4()
10362 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10369 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
10372 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
10374 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
10376 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10382 if (phba->intr_type != MSIX) in lpfc_pci_probe_one_s4()
10385 adjusted_fcp_io_channel = phba->cfg_fcp_io_channel; in lpfc_pci_probe_one_s4()
10386 phba->cfg_fcp_io_channel = adjusted_fcp_io_channel; in lpfc_pci_probe_one_s4()
10388 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
10389 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
10396 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
10397 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
10400 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
10403 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
10404 ret = lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
10407 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
10411 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
10415 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
10417 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
10419 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s4()
10421 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
10423 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
10425 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
10429 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
10448 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
10452 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10454 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10460 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
10462 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
10467 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
10482 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
10484 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10486 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
10491 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s4()
10493 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
10496 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
10500 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
10503 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
10533 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
10535 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
10539 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
10540 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
10541 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
10544 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
10545 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
10577 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
10581 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
10598 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
10599 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
10600 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
10601 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
10602 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
10609 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
10611 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
10615 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
10618 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
10619 lpfc_online(phba); in lpfc_pci_resume_one_s4()
10622 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
10635 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
10637 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_recover()
10643 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
10655 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
10657 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
10661 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
10664 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
10667 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli4_prep_dev_for_reset()
10670 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
10673 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
10674 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
10675 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
10687 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
10689 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_perm_failure()
10693 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
10696 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
10699 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
10722 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
10727 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
10731 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
10735 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
10739 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
10741 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
10768 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
10769 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
10790 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
10792 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
10795 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
10797 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s4()
10802 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
10805 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
10824 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
10832 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
10834 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
10835 lpfc_offline(phba); in lpfc_io_resume_s4()
10836 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
10838 lpfc_online(phba); in lpfc_io_resume_s4()
10842 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_io_resume_s4()
10896 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
10898 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
10906 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_remove_one()
10908 phba->pci_dev_grp); in lpfc_pci_remove_one()
10932 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
10935 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
10943 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_suspend_one()
10945 phba->pci_dev_grp); in lpfc_pci_suspend_one()
10968 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
10971 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
10979 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one()
10981 phba->pci_dev_grp); in lpfc_pci_resume_one()
11006 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
11009 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
11017 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected()
11019 phba->pci_dev_grp); in lpfc_io_error_detected()
11043 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
11046 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
11054 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset()
11056 phba->pci_dev_grp); in lpfc_io_slot_reset()
11076 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
11078 switch (phba->pci_dev_grp) { in lpfc_io_resume()
11086 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_resume()
11088 phba->pci_dev_grp); in lpfc_io_resume()
11105 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
11108 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
11111 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
11112 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
11114 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
11115 if (phba->device_data_mem_pool) in lpfc_sli4_oas_verify()
11116 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
11117 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
11135 lpfc_fof_queue_setup(struct lpfc_hba *phba) in lpfc_fof_queue_setup() argument
11137 struct lpfc_sli *psli = &phba->sli; in lpfc_fof_queue_setup()
11140 rc = lpfc_eq_create(phba, phba->sli4_hba.fof_eq, LPFC_MAX_IMAX); in lpfc_fof_queue_setup()
11144 if (phba->cfg_fof) { in lpfc_fof_queue_setup()
11146 rc = lpfc_cq_create(phba, phba->sli4_hba.oas_cq, in lpfc_fof_queue_setup()
11147 phba->sli4_hba.fof_eq, LPFC_WCQ, LPFC_FCP); in lpfc_fof_queue_setup()
11151 rc = lpfc_wq_create(phba, phba->sli4_hba.oas_wq, in lpfc_fof_queue_setup()
11152 phba->sli4_hba.oas_cq, LPFC_FCP); in lpfc_fof_queue_setup()
11156 phba->sli4_hba.oas_cq->pring = &psli->ring[LPFC_FCP_OAS_RING]; in lpfc_fof_queue_setup()
11157 phba->sli4_hba.oas_ring = &psli->ring[LPFC_FCP_OAS_RING]; in lpfc_fof_queue_setup()
11163 lpfc_cq_destroy(phba, phba->sli4_hba.oas_cq); in lpfc_fof_queue_setup()
11165 lpfc_eq_destroy(phba, phba->sli4_hba.fof_eq); in lpfc_fof_queue_setup()
11185 lpfc_fof_queue_create(struct lpfc_hba *phba) in lpfc_fof_queue_create() argument
11190 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.eq_esize, in lpfc_fof_queue_create()
11191 phba->sli4_hba.eq_ecount); in lpfc_fof_queue_create()
11195 phba->sli4_hba.fof_eq = qdesc; in lpfc_fof_queue_create()
11197 if (phba->cfg_fof) { in lpfc_fof_queue_create()
11200 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, in lpfc_fof_queue_create()
11201 phba->sli4_hba.cq_ecount); in lpfc_fof_queue_create()
11205 phba->sli4_hba.oas_cq = qdesc; in lpfc_fof_queue_create()
11208 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, in lpfc_fof_queue_create()
11209 phba->sli4_hba.wq_ecount); in lpfc_fof_queue_create()
11213 phba->sli4_hba.oas_wq = qdesc; in lpfc_fof_queue_create()
11219 lpfc_fof_queue_destroy(phba); in lpfc_fof_queue_create()
11234 lpfc_fof_queue_destroy(struct lpfc_hba *phba) in lpfc_fof_queue_destroy() argument
11237 if (phba->sli4_hba.fof_eq != NULL) { in lpfc_fof_queue_destroy()
11238 lpfc_sli4_queue_free(phba->sli4_hba.fof_eq); in lpfc_fof_queue_destroy()
11239 phba->sli4_hba.fof_eq = NULL; in lpfc_fof_queue_destroy()
11243 if (phba->sli4_hba.oas_cq != NULL) { in lpfc_fof_queue_destroy()
11244 lpfc_sli4_queue_free(phba->sli4_hba.oas_cq); in lpfc_fof_queue_destroy()
11245 phba->sli4_hba.oas_cq = NULL; in lpfc_fof_queue_destroy()
11249 if (phba->sli4_hba.oas_wq != NULL) { in lpfc_fof_queue_destroy()
11250 lpfc_sli4_queue_free(phba->sli4_hba.oas_wq); in lpfc_fof_queue_destroy()
11251 phba->sli4_hba.oas_wq = NULL; in lpfc_fof_queue_destroy()