Lines Matching +full:m +full:- +full:phy
2 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
3 * Copyright (c) 2014- QLogic Corporation.
7 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
39 bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->ioc_timer, \
41 #define bfa_ioc_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->ioc_timer)
44 bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->hb_timer, \
46 #define bfa_hb_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->hb_timer)
63 ((__ioc)->ioc_hwif->ioc_firmware_lock(__ioc))
65 ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc))
66 #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc))
67 #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc))
69 ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc))
71 ((__ioc)->ioc_hwif->ioc_sync_start(__ioc))
73 ((__ioc)->ioc_hwif->ioc_sync_join(__ioc))
75 ((__ioc)->ioc_hwif->ioc_sync_leave(__ioc))
77 ((__ioc)->ioc_hwif->ioc_sync_ack(__ioc))
79 ((__ioc)->ioc_hwif->ioc_sync_complete(__ioc))
81 ((__ioc)->ioc_hwif->ioc_set_fwstate(__ioc, __fwstate))
83 ((__ioc)->ioc_hwif->ioc_get_fwstate(__ioc))
85 ((__ioc)->ioc_hwif->ioc_set_alt_fwstate(__ioc, __fwstate))
87 ((__ioc)->ioc_hwif->ioc_get_alt_fwstate(__ioc))
90 (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \
91 readl((__ioc)->ioc_regs.hfn_mbox_cmd))
169 bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->ioc_timer, \
171 #define bfa_iocpf_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->ioc_timer)
174 bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->ioc_timer, \
178 bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->sem_timer, \
180 #define bfa_sem_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->sem_timer)
287 * Reset entry actions -- initialize state machine
292 bfa_fsm_set_state(&ioc->iocpf, bfa_iocpf_sm_reset); in bfa_ioc_sm_reset_entry()
325 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_ENABLE); in bfa_ioc_sm_enabling_entry()
345 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_enabling()
348 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); in bfa_ioc_sm_enabling()
352 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_enabling()
362 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); in bfa_ioc_sm_enabling()
400 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_getattr()
403 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_GETATTRFAIL); in bfa_ioc_sm_getattr()
422 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; in bfa_ioc_sm_op_entry()
424 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); in bfa_ioc_sm_op_entry()
450 if (ioc->iocpf.auto_recover) in bfa_ioc_sm_op()
458 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); in bfa_ioc_sm_op()
470 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; in bfa_ioc_sm_disabling_entry()
471 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); in bfa_ioc_sm_disabling_entry()
495 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); in bfa_ioc_sm_disabling()
528 ioc->cbfn->disable_cbfn(ioc->bfa); in bfa_ioc_sm_disabled()
533 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); in bfa_ioc_sm_disabled()
566 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_fail_retry()
569 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); in bfa_ioc_sm_fail_retry()
573 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_fail_retry()
586 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); in bfa_ioc_sm_fail_retry()
612 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_fail()
621 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); in bfa_ioc_sm_fail()
648 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_hwfail()
652 ioc->cbfn->disable_cbfn(ioc->bfa); in bfa_ioc_sm_hwfail()
660 /* Ignore - already in hwfail state */ in bfa_ioc_sm_hwfail()
673 * Reset entry actions -- initialize state machine
678 iocpf->fw_mismatch_notified = BFA_FALSE; in bfa_iocpf_sm_reset_entry()
679 iocpf->auto_recover = bfa_auto_recover; in bfa_iocpf_sm_reset_entry()
688 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_reset()
718 r32 = readl(iocpf->ioc->ioc_regs.ioc_init_sem_reg); in bfa_iocpf_sm_fwcheck_entry()
721 r32 = readl(iocpf->ioc->ioc_regs.ioc_init_sem_reg); in bfa_iocpf_sm_fwcheck_entry()
725 fwstate = bfa_ioc_get_cur_ioc_fwstate(iocpf->ioc); in bfa_iocpf_sm_fwcheck_entry()
727 writel(1, iocpf->ioc->ioc_regs.ioc_init_sem_reg); in bfa_iocpf_sm_fwcheck_entry()
731 bfa_ioc_fwver_get(iocpf->ioc, &fwhdr); in bfa_iocpf_sm_fwcheck_entry()
734 writel(1, iocpf->ioc->ioc_regs.ioc_init_sem_reg); in bfa_iocpf_sm_fwcheck_entry()
741 pgnum = PSS_SMEM_PGNUM(iocpf->ioc->ioc_regs.smem_pg0, loff); in bfa_iocpf_sm_fwcheck_entry()
743 writel(pgnum, iocpf->ioc->ioc_regs.host_page_num_fn); in bfa_iocpf_sm_fwcheck_entry()
746 bfa_mem_write(iocpf->ioc->ioc_regs.smem_page_start, loff, 0); in bfa_iocpf_sm_fwcheck_entry()
750 bfa_trc(iocpf->ioc, fwstate); in bfa_iocpf_sm_fwcheck_entry()
751 bfa_trc(iocpf->ioc, swab32(fwhdr.exec)); in bfa_iocpf_sm_fwcheck_entry()
752 bfa_ioc_set_cur_ioc_fwstate(iocpf->ioc, BFI_IOC_UNINIT); in bfa_iocpf_sm_fwcheck_entry()
753 bfa_ioc_set_alt_ioc_fwstate(iocpf->ioc, BFI_IOC_UNINIT); in bfa_iocpf_sm_fwcheck_entry()
758 bfa_ioc_ownership_reset(iocpf->ioc); in bfa_iocpf_sm_fwcheck_entry()
763 writel(1, iocpf->ioc->ioc_regs.ioc_init_sem_reg); in bfa_iocpf_sm_fwcheck_entry()
766 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_fwcheck_entry()
775 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_fwcheck()
787 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_fwcheck()
791 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_fwcheck()
826 if (iocpf->fw_mismatch_notified == BFA_FALSE) in bfa_iocpf_sm_mismatch_entry()
827 bfa_ioc_pf_fwmismatch(iocpf->ioc); in bfa_iocpf_sm_mismatch_entry()
829 iocpf->fw_mismatch_notified = BFA_TRUE; in bfa_iocpf_sm_mismatch_entry()
830 bfa_iocpf_timer_start(iocpf->ioc); in bfa_iocpf_sm_mismatch_entry()
839 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_mismatch()
870 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_semwait_entry()
879 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_semwait()
889 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_semwait()
912 iocpf->poll_time = 0; in bfa_iocpf_sm_hwinit_entry()
913 bfa_ioc_hwinit(iocpf->ioc, BFA_FALSE); in bfa_iocpf_sm_hwinit_entry()
923 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_hwinit()
933 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_hwinit()
941 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_hwinit()
953 bfa_iocpf_timer_start(iocpf->ioc); in bfa_iocpf_sm_enabling_entry()
957 iocpf->ioc->cbfn->reset_cbfn(iocpf->ioc->bfa); in bfa_iocpf_sm_enabling_entry()
958 bfa_ioc_send_enable(iocpf->ioc); in bfa_iocpf_sm_enabling_entry()
968 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_enabling()
975 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_enabling()
986 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_enabling()
994 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_enabling()
1006 bfa_fsm_send_event(iocpf->ioc, IOC_E_ENABLED); in bfa_iocpf_sm_ready_entry()
1012 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_ready()
1037 bfa_iocpf_timer_start(iocpf->ioc); in bfa_iocpf_sm_disabling_entry()
1038 bfa_ioc_send_disable(iocpf->ioc); in bfa_iocpf_sm_disabling_entry()
1047 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_disabling()
1079 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_disabling_sync_entry()
1088 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_disabling_sync()
1095 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_disabling_sync()
1118 bfa_ioc_mbox_flush(iocpf->ioc); in bfa_iocpf_sm_disabled_entry()
1119 bfa_fsm_send_event(iocpf->ioc, IOC_E_DISABLED); in bfa_iocpf_sm_disabled_entry()
1125 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_disabled()
1147 bfa_ioc_debug_save_ftrc(iocpf->ioc); in bfa_iocpf_sm_initfail_sync_entry()
1148 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_initfail_sync_entry()
1157 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_initfail_sync()
1166 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_initfail_sync()
1197 bfa_trc(iocpf->ioc, 0); in bfa_iocpf_sm_initfail_entry()
1206 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_initfail()
1231 bfa_ioc_lpu_stop(iocpf->ioc); in bfa_iocpf_sm_fail_sync_entry()
1236 bfa_ioc_mbox_flush(iocpf->ioc); in bfa_iocpf_sm_fail_sync_entry()
1238 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_fail_sync_entry()
1244 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_fail_sync()
1252 if (!iocpf->auto_recover) { in bfa_iocpf_sm_fail_sync()
1255 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_fail_sync()
1261 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_iocpf_sm_fail_sync()
1288 bfa_trc(iocpf->ioc, 0); in bfa_iocpf_sm_fail_entry()
1297 struct bfa_ioc_s *ioc = iocpf->ioc; in bfa_iocpf_sm_fail()
1324 list_for_each(qe, &ioc->notify_q) { in bfa_ioc_event_notify()
1326 notify->cbfn(notify->cbarg, event); in bfa_ioc_event_notify()
1333 ioc->cbfn->disable_cbfn(ioc->bfa); in bfa_ioc_disable_comp()
1367 r32 = readl(ioc->ioc_regs.ioc_sem_reg); in bfa_ioc_hw_sem_get()
1370 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_SEM_ERROR); in bfa_ioc_hw_sem_get()
1374 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_SEMLOCKED); in bfa_ioc_hw_sem_get()
1391 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1399 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1406 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1418 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1429 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_start()
1432 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_start()
1443 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_stop()
1446 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_stop()
1460 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); in bfa_ioc_fwver_get()
1462 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_fwver_get()
1467 bfa_mem_read(ioc->ioc_regs.smem_page_start, loff); in bfa_ioc_fwver_get()
1538 if (fwhdr_1->md5sum[i] != fwhdr_2->md5sum[i]) in bfa_ioc_fwver_md5_check()
1552 if (drv_fwhdr->signature != fwhdr_to_cmp->signature) in bfa_ioc_fw_ver_compatible()
1555 if (drv_fwhdr->fwver.major != fwhdr_to_cmp->fwver.major) in bfa_ioc_fw_ver_compatible()
1558 if (drv_fwhdr->fwver.minor != fwhdr_to_cmp->fwver.minor) in bfa_ioc_fw_ver_compatible()
1561 if (drv_fwhdr->fwver.maint != fwhdr_to_cmp->fwver.maint) in bfa_ioc_fw_ver_compatible()
1564 if (drv_fwhdr->fwver.patch == fwhdr_to_cmp->fwver.patch && in bfa_ioc_fw_ver_compatible()
1565 drv_fwhdr->fwver.phase == fwhdr_to_cmp->fwver.phase && in bfa_ioc_fw_ver_compatible()
1566 drv_fwhdr->fwver.build == fwhdr_to_cmp->fwver.build) { in bfa_ioc_fw_ver_compatible()
1576 if (flash_fwhdr->fwver.major == 0 || flash_fwhdr->fwver.major == 0xFF) in bfa_ioc_flash_fwver_valid()
1584 if (fwhdr->fwver.phase == 0 && in fwhdr_is_ga()
1585 fwhdr->fwver.build == 0) in fwhdr_is_ga()
1601 if (fwhdr_to_cmp->fwver.patch > base_fwhdr->fwver.patch) in bfa_ioc_fw_ver_patch_cmp()
1604 else if (fwhdr_to_cmp->fwver.patch < base_fwhdr->fwver.patch) in bfa_ioc_fw_ver_patch_cmp()
1622 if (fwhdr_to_cmp->fwver.phase > base_fwhdr->fwver.phase) in bfa_ioc_fw_ver_patch_cmp()
1624 else if (fwhdr_to_cmp->fwver.phase < base_fwhdr->fwver.phase) in bfa_ioc_fw_ver_patch_cmp()
1627 if (fwhdr_to_cmp->fwver.build > base_fwhdr->fwver.build) in bfa_ioc_fw_ver_patch_cmp()
1629 else if (fwhdr_to_cmp->fwver.build < base_fwhdr->fwver.build) in bfa_ioc_fw_ver_patch_cmp()
1645 return bfa_flash_raw_read(ioc->pcidev.pci_bar_kva, in bfa_ioc_flash_img_get_chnk()
1685 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); in bfa_ioc_fwsig_invalidate()
1687 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_fwsig_invalidate()
1688 bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, BFA_IOC_FW_INV_SIGN); in bfa_ioc_fwsig_invalidate()
1701 r32 = readl(ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgflush()
1703 writel(1, ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgflush()
1747 * just re-enable IOC. in bfa_ioc_hwinit()
1756 * When using MSI-X any pending firmware ready event should in bfa_ioc_hwinit()
1757 * be flushed. Otherwise MSI-X interrupts are not delivered. in bfa_ioc_hwinit()
1760 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FWREADY); in bfa_ioc_hwinit()
1796 ioc->ioc_regs.hfn_mbox + i * sizeof(u32)); in bfa_ioc_mbox_send()
1799 writel(0, ioc->ioc_regs.hfn_mbox + i * sizeof(u32)); in bfa_ioc_mbox_send()
1804 writel(1, ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_send()
1805 (void) readl(ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_send()
1815 enable_req.clscode = cpu_to_be16(ioc->clscode); in bfa_ioc_send_enable()
1816 /* unsigned 32-bit time_t overflow in y2106 */ in bfa_ioc_send_enable()
1828 disable_req.clscode = cpu_to_be16(ioc->clscode); in bfa_ioc_send_disable()
1829 /* unsigned 32-bit time_t overflow in y2106 */ in bfa_ioc_send_disable()
1841 bfa_dma_be_addr_set(attr_req.attr_addr, ioc->attr_dma.pa); in bfa_ioc_send_getattr()
1851 hb_count = readl(ioc->ioc_regs.heartbeat); in bfa_ioc_hb_check()
1852 if (ioc->hb_count == hb_count) { in bfa_ioc_hb_check()
1856 ioc->hb_count = hb_count; in bfa_ioc_hb_check()
1866 ioc->hb_count = readl(ioc->ioc_regs.heartbeat); in bfa_ioc_hb_monitor()
1906 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); in bfa_ioc_download_fw()
1909 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_download_fw()
1935 bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, in bfa_ioc_download_fw()
1946 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_download_fw()
1950 writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), in bfa_ioc_download_fw()
1951 ioc->ioc_regs.host_page_num_fn); in bfa_ioc_download_fw()
1960 asicmode = BFI_FWBOOT_DEVMODE(ioc->asic_gen, ioc->asic_mode, in bfa_ioc_download_fw()
1961 ioc->port0_mode, ioc->port1_mode); in bfa_ioc_download_fw()
1962 bfa_mem_write(ioc->ioc_regs.smem_page_start, BFI_FWBOOT_DEVMODE_OFF, in bfa_ioc_download_fw()
1964 bfa_mem_write(ioc->ioc_regs.smem_page_start, BFI_FWBOOT_TYPE_OFF, in bfa_ioc_download_fw()
1966 bfa_mem_write(ioc->ioc_regs.smem_page_start, BFI_FWBOOT_ENV_OFF, in bfa_ioc_download_fw()
1978 struct bfi_ioc_attr_s *attr = ioc->attr; in bfa_ioc_getattr_reply()
1980 attr->adapter_prop = be32_to_cpu(attr->adapter_prop); in bfa_ioc_getattr_reply()
1981 attr->card_type = be32_to_cpu(attr->card_type); in bfa_ioc_getattr_reply()
1982 attr->maxfrsize = be16_to_cpu(attr->maxfrsize); in bfa_ioc_getattr_reply()
1983 ioc->fcmode = (attr->port_mode == BFI_PORT_MODE_FC); in bfa_ioc_getattr_reply()
1984 attr->mfg_year = be16_to_cpu(attr->mfg_year); in bfa_ioc_getattr_reply()
1995 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_attach()
1998 INIT_LIST_HEAD(&mod->cmd_q); in bfa_ioc_mbox_attach()
2000 mod->mbhdlr[mc].cbfn = NULL; in bfa_ioc_mbox_attach()
2001 mod->mbhdlr[mc].cbarg = ioc->bfa; in bfa_ioc_mbox_attach()
2006 * Mbox poll timer -- restarts any pending mailbox requests.
2011 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_poll()
2018 if (list_empty(&mod->cmd_q)) in bfa_ioc_mbox_poll()
2024 stat = readl(ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_poll()
2031 bfa_q_deq(&mod->cmd_q, &cmd); in bfa_ioc_mbox_poll()
2032 bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); in bfa_ioc_mbox_poll()
2041 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_flush()
2044 while (!list_empty(&mod->cmd_q)) in bfa_ioc_mbox_flush()
2045 bfa_q_deq(&mod->cmd_q, &cmd); in bfa_ioc_mbox_flush()
2064 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); in bfa_ioc_smem_read()
2073 if (BFA_FALSE == bfa_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg)) { in bfa_ioc_smem_read()
2078 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_smem_read()
2083 r32 = bfa_mem_read(ioc->ioc_regs.smem_page_start, loff); in bfa_ioc_smem_read()
2093 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_smem_read()
2096 writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), in bfa_ioc_smem_read()
2097 ioc->ioc_regs.host_page_num_fn); in bfa_ioc_smem_read()
2101 readl(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_smem_read()
2102 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_smem_read()
2121 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); in bfa_ioc_smem_clr()
2130 if (BFA_FALSE == bfa_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg)) { in bfa_ioc_smem_clr()
2135 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_smem_clr()
2140 bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, 0); in bfa_ioc_smem_clr()
2149 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_smem_clr()
2152 writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), in bfa_ioc_smem_clr()
2153 ioc->ioc_regs.host_page_num_fn); in bfa_ioc_smem_clr()
2158 readl(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_smem_clr()
2159 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_smem_clr()
2167 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; in bfa_ioc_fail_notify()
2172 ioc->cbfn->hbfail_cbfn(ioc->bfa); in bfa_ioc_fail_notify()
2186 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; in bfa_ioc_pf_fwmismatch()
2190 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_pf_fwmismatch()
2204 bfa_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_pll_init()
2208 ioc->pllinit = BFA_TRUE; in bfa_ioc_pll_init()
2218 readl(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_pll_init()
2219 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_pll_init()
2309 r32 = readl(ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgget()
2318 r32 = readl(ioc->ioc_regs.lpu_mbox + in bfa_ioc_msgget()
2326 writel(1, ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgget()
2327 readl(ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgget()
2333 bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *m) in bfa_ioc_isr() argument
2336 struct bfa_iocpf_s *iocpf = &ioc->iocpf; in bfa_ioc_isr()
2338 msg = (union bfi_ioc_i2h_msg_u *) m; in bfa_ioc_isr()
2342 switch (msg->mh.msg_id) { in bfa_ioc_isr()
2347 ioc->port_mode = ioc->port_mode_cfg = in bfa_ioc_isr()
2348 (enum bfa_mode_s)msg->fw_event.port_mode; in bfa_ioc_isr()
2349 ioc->ad_cap_bm = msg->fw_event.cap_bm; in bfa_ioc_isr()
2362 bfa_trc(ioc, msg->mh.msg_id); in bfa_ioc_isr()
2377 ioc->bfa = bfa; in bfa_ioc_attach()
2378 ioc->cbfn = cbfn; in bfa_ioc_attach()
2379 ioc->timer_mod = timer_mod; in bfa_ioc_attach()
2380 ioc->fcmode = BFA_FALSE; in bfa_ioc_attach()
2381 ioc->pllinit = BFA_FALSE; in bfa_ioc_attach()
2382 ioc->dbg_fwsave_once = BFA_TRUE; in bfa_ioc_attach()
2383 ioc->iocpf.ioc = ioc; in bfa_ioc_attach()
2386 INIT_LIST_HEAD(&ioc->notify_q); in bfa_ioc_attach()
2399 INIT_LIST_HEAD(&ioc->notify_q); in bfa_ioc_detach()
2411 ioc->clscode = clscode; in bfa_ioc_pci_init()
2412 ioc->pcidev = *pcidev; in bfa_ioc_pci_init()
2417 ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_FC; in bfa_ioc_pci_init()
2418 ioc->asic_mode = BFI_ASIC_MODE_FC; in bfa_ioc_pci_init()
2420 switch (pcidev->device_id) { in bfa_ioc_pci_init()
2423 ioc->asic_gen = BFI_ASIC_GEN_CB; in bfa_ioc_pci_init()
2424 ioc->fcmode = BFA_TRUE; in bfa_ioc_pci_init()
2425 ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; in bfa_ioc_pci_init()
2426 ioc->ad_cap_bm = BFA_CM_HBA; in bfa_ioc_pci_init()
2430 ioc->asic_gen = BFI_ASIC_GEN_CT; in bfa_ioc_pci_init()
2431 ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; in bfa_ioc_pci_init()
2432 ioc->asic_mode = BFI_ASIC_MODE_ETH; in bfa_ioc_pci_init()
2433 ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_CNA; in bfa_ioc_pci_init()
2434 ioc->ad_cap_bm = BFA_CM_CNA; in bfa_ioc_pci_init()
2438 ioc->asic_gen = BFI_ASIC_GEN_CT; in bfa_ioc_pci_init()
2439 ioc->fcmode = BFA_TRUE; in bfa_ioc_pci_init()
2440 ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; in bfa_ioc_pci_init()
2441 ioc->ad_cap_bm = BFA_CM_HBA; in bfa_ioc_pci_init()
2446 ioc->asic_gen = BFI_ASIC_GEN_CT2; in bfa_ioc_pci_init()
2448 pcidev->ssid == BFA_PCI_CT2_SSID_FC) { in bfa_ioc_pci_init()
2449 ioc->asic_mode = BFI_ASIC_MODE_FC16; in bfa_ioc_pci_init()
2450 ioc->fcmode = BFA_TRUE; in bfa_ioc_pci_init()
2451 ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; in bfa_ioc_pci_init()
2452 ioc->ad_cap_bm = BFA_CM_HBA; in bfa_ioc_pci_init()
2454 ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; in bfa_ioc_pci_init()
2455 ioc->asic_mode = BFI_ASIC_MODE_ETH; in bfa_ioc_pci_init()
2456 if (pcidev->ssid == BFA_PCI_CT2_SSID_FCoE) { in bfa_ioc_pci_init()
2457 ioc->port_mode = in bfa_ioc_pci_init()
2458 ioc->port_mode_cfg = BFA_MODE_CNA; in bfa_ioc_pci_init()
2459 ioc->ad_cap_bm = BFA_CM_CNA; in bfa_ioc_pci_init()
2461 ioc->port_mode = in bfa_ioc_pci_init()
2462 ioc->port_mode_cfg = BFA_MODE_NIC; in bfa_ioc_pci_init()
2463 ioc->ad_cap_bm = BFA_CM_NIC; in bfa_ioc_pci_init()
2475 if (ioc->asic_gen == BFI_ASIC_GEN_CB) in bfa_ioc_pci_init()
2477 else if (ioc->asic_gen == BFI_ASIC_GEN_CT) in bfa_ioc_pci_init()
2480 WARN_ON(ioc->asic_gen != BFI_ASIC_GEN_CT2); in bfa_ioc_pci_init()
2501 ioc->attr_dma.kva = dm_kva; in bfa_ioc_mem_claim()
2502 ioc->attr_dma.pa = dm_pa; in bfa_ioc_mem_claim()
2503 ioc->attr = (struct bfi_ioc_attr_s *) dm_kva; in bfa_ioc_mem_claim()
2510 ioc->dbg_fwsave_once = BFA_TRUE; in bfa_ioc_enable()
2525 ioc->dbg_fwsave_once = BFA_TRUE; in bfa_ioc_suspend()
2536 ioc->dbg_fwsave = dbg_fwsave; in bfa_ioc_debug_memclaim()
2537 ioc->dbg_fwsave_len = BFA_DBG_FWTRC_LEN; in bfa_ioc_debug_memclaim()
2549 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_register()
2553 mod->mbhdlr[mc].cbfn = mcfuncs[mc]; in bfa_ioc_mbox_register()
2563 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_regisr()
2565 mod->mbhdlr[mc].cbfn = cbfn; in bfa_ioc_mbox_regisr()
2566 mod->mbhdlr[mc].cbarg = cbarg; in bfa_ioc_mbox_regisr()
2579 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_queue()
2585 if (!list_empty(&mod->cmd_q)) { in bfa_ioc_mbox_queue()
2586 list_add_tail(&cmd->qe, &mod->cmd_q); in bfa_ioc_mbox_queue()
2593 stat = readl(ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_queue()
2595 list_add_tail(&cmd->qe, &mod->cmd_q); in bfa_ioc_mbox_queue()
2600 * mailbox is free -- queue command to firmware in bfa_ioc_mbox_queue()
2602 bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); in bfa_ioc_mbox_queue()
2611 struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; in bfa_ioc_mbox_isr()
2612 struct bfi_mbmsg_s m; in bfa_ioc_mbox_isr() local
2615 if (bfa_ioc_msgget(ioc, &m)) { in bfa_ioc_mbox_isr()
2619 mc = m.mh.msg_class; in bfa_ioc_mbox_isr()
2621 bfa_ioc_isr(ioc, &m); in bfa_ioc_mbox_isr()
2625 if ((mc >= BFI_MC_MAX) || (mod->mbhdlr[mc].cbfn == NULL)) in bfa_ioc_mbox_isr()
2628 mod->mbhdlr[mc].cbfn(mod->mbhdlr[mc].cbarg, &m); in bfa_ioc_mbox_isr()
2643 ioc->stats.hb_count = ioc->hb_count; in bfa_ioc_error_isr()
2664 bfa_fsm_cmp_state(&ioc->iocpf, bfa_iocpf_sm_fwcheck) || in bfa_ioc_fw_mismatch()
2665 bfa_fsm_cmp_state(&ioc->iocpf, bfa_iocpf_sm_mismatch); in bfa_ioc_fw_mismatch()
2669 * Check if adapter is disabled -- both IOCs should be in a disabled
2684 if (ioc->pcidev.device_id != BFA_PCI_DEVICE_ID_FC_8G1P) { in bfa_ioc_adapter_is_disabled()
2710 ioc_attr = ioc->attr; in bfa_ioc_get_adapter_attr()
2712 bfa_ioc_get_adapter_serial_num(ioc, ad_attr->serial_num); in bfa_ioc_get_adapter_attr()
2713 bfa_ioc_get_adapter_fw_ver(ioc, ad_attr->fw_ver); in bfa_ioc_get_adapter_attr()
2714 bfa_ioc_get_adapter_optrom_ver(ioc, ad_attr->optrom_ver); in bfa_ioc_get_adapter_attr()
2715 bfa_ioc_get_adapter_manufacturer(ioc, ad_attr->manufacturer); in bfa_ioc_get_adapter_attr()
2716 memcpy(&ad_attr->vpd, &ioc_attr->vpd, in bfa_ioc_get_adapter_attr()
2719 ad_attr->nports = bfa_ioc_get_nports(ioc); in bfa_ioc_get_adapter_attr()
2720 ad_attr->max_speed = bfa_ioc_speed_sup(ioc); in bfa_ioc_get_adapter_attr()
2722 bfa_ioc_get_adapter_model(ioc, ad_attr->model); in bfa_ioc_get_adapter_attr()
2724 bfa_ioc_get_adapter_model(ioc, ad_attr->model_descr); in bfa_ioc_get_adapter_attr()
2726 ad_attr->card_type = ioc_attr->card_type; in bfa_ioc_get_adapter_attr()
2727 ad_attr->is_mezz = bfa_mfg_is_mezz(ioc_attr->card_type); in bfa_ioc_get_adapter_attr()
2729 if (BFI_ADAPTER_IS_SPECIAL(ioc_attr->adapter_prop)) in bfa_ioc_get_adapter_attr()
2730 ad_attr->prototype = 1; in bfa_ioc_get_adapter_attr()
2732 ad_attr->prototype = 0; in bfa_ioc_get_adapter_attr()
2734 ad_attr->pwwn = ioc->attr->pwwn; in bfa_ioc_get_adapter_attr()
2735 ad_attr->mac = bfa_ioc_get_mac(ioc); in bfa_ioc_get_adapter_attr()
2737 ad_attr->pcie_gen = ioc_attr->pcie_gen; in bfa_ioc_get_adapter_attr()
2738 ad_attr->pcie_lanes = ioc_attr->pcie_lanes; in bfa_ioc_get_adapter_attr()
2739 ad_attr->pcie_lanes_orig = ioc_attr->pcie_lanes_orig; in bfa_ioc_get_adapter_attr()
2740 ad_attr->asic_rev = ioc_attr->asic_rev; in bfa_ioc_get_adapter_attr()
2742 bfa_ioc_get_pci_chip_rev(ioc, ad_attr->hw_ver); in bfa_ioc_get_adapter_attr()
2744 ad_attr->cna_capable = bfa_ioc_is_cna(ioc); in bfa_ioc_get_adapter_attr()
2745 ad_attr->trunk_capable = (ad_attr->nports > 1) && in bfa_ioc_get_adapter_attr()
2746 !bfa_ioc_is_cna(ioc) && !ad_attr->is_mezz; in bfa_ioc_get_adapter_attr()
2747 ad_attr->mfg_day = ioc_attr->mfg_day; in bfa_ioc_get_adapter_attr()
2748 ad_attr->mfg_month = ioc_attr->mfg_month; in bfa_ioc_get_adapter_attr()
2749 ad_attr->mfg_year = ioc_attr->mfg_year; in bfa_ioc_get_adapter_attr()
2750 memcpy(ad_attr->uuid, ioc_attr->uuid, BFA_ADAPTER_UUID_LEN); in bfa_ioc_get_adapter_attr()
2756 if (ioc->clscode == BFI_PCIFN_CLASS_ETH) in bfa_ioc_get_type()
2759 WARN_ON(ioc->clscode != BFI_PCIFN_CLASS_FC); in bfa_ioc_get_type()
2761 return (ioc->attr->port_mode == BFI_PORT_MODE_FC) in bfa_ioc_get_type()
2770 (void *)ioc->attr->brcd_serialnum, in bfa_ioc_get_adapter_serial_num()
2778 memcpy(fw_ver, ioc->attr->fw_version, BFA_VERSION_LEN); in bfa_ioc_get_adapter_fw_ver()
2791 chip_rev[3] = '-'; in bfa_ioc_get_pci_chip_rev()
2792 chip_rev[4] = ioc->attr->asic_rev; in bfa_ioc_get_pci_chip_rev()
2800 memcpy(optrom_ver, ioc->attr->optrom_version, in bfa_ioc_get_adapter_optrom_ver()
2820 ioc_attr = ioc->attr; in bfa_ioc_get_adapter_model()
2822 if (bfa_asic_id_ct2(ioc->pcidev.device_id) && in bfa_ioc_get_adapter_model()
2823 (!bfa_mfg_is_mezz(ioc_attr->card_type))) in bfa_ioc_get_adapter_model()
2824 snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u-%u%s", in bfa_ioc_get_adapter_model()
2825 BFA_MFG_NAME, ioc_attr->card_type, nports, "p"); in bfa_ioc_get_adapter_model()
2827 snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", in bfa_ioc_get_adapter_model()
2828 BFA_MFG_NAME, ioc_attr->card_type); in bfa_ioc_get_adapter_model()
2835 enum bfa_ioc_state ioc_st = bfa_sm_to_state(ioc_sm_table, ioc->fsm); in bfa_ioc_get_state()
2840 iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc->iocpf.fsm); in bfa_ioc_get_state()
2876 ioc_attr->state = bfa_ioc_get_state(ioc); in bfa_ioc_get_attr()
2877 ioc_attr->port_id = bfa_ioc_portid(ioc); in bfa_ioc_get_attr()
2878 ioc_attr->port_mode = ioc->port_mode; in bfa_ioc_get_attr()
2879 ioc_attr->port_mode_cfg = ioc->port_mode_cfg; in bfa_ioc_get_attr()
2880 ioc_attr->cap_bm = ioc->ad_cap_bm; in bfa_ioc_get_attr()
2882 ioc_attr->ioc_type = bfa_ioc_get_type(ioc); in bfa_ioc_get_attr()
2884 bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); in bfa_ioc_get_attr()
2886 ioc_attr->pci_attr.device_id = bfa_ioc_devid(ioc); in bfa_ioc_get_attr()
2887 ioc_attr->pci_attr.pcifn = bfa_ioc_pcifn(ioc); in bfa_ioc_get_attr()
2888 ioc_attr->def_fn = (bfa_ioc_pcifn(ioc) == bfa_ioc_portid(ioc)); in bfa_ioc_get_attr()
2889 bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); in bfa_ioc_get_attr()
2899 return ioc->attr->fcoe_mac; in bfa_ioc_get_mac()
2901 return ioc->attr->mac; in bfa_ioc_get_mac()
2907 mac_t m; in bfa_ioc_get_mfg_mac() local
2909 m = ioc->attr->mfg_mac; in bfa_ioc_get_mfg_mac()
2910 if (bfa_mfg_is_old_wwn_mac_model(ioc->attr->card_type)) in bfa_ioc_get_mfg_mac()
2911 m.mac[MAC_ADDRLEN - 1] += bfa_ioc_pcifn(ioc); in bfa_ioc_get_mfg_mac()
2913 bfa_mfg_increment_wwn_mac(&(m.mac[MAC_ADDRLEN-3]), in bfa_ioc_get_mfg_mac()
2916 return m; in bfa_ioc_get_mfg_mac()
2925 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; in bfa_ioc_aen_post()
2936 aen_entry->aen_data.ioc.pwwn = ioc->attr->pwwn; in bfa_ioc_aen_post()
2939 aen_entry->aen_data.ioc.pwwn = ioc->attr->pwwn; in bfa_ioc_aen_post()
2940 aen_entry->aen_data.ioc.mac = bfa_ioc_get_mac(ioc); in bfa_ioc_aen_post()
2943 aen_entry->aen_data.ioc.mac = bfa_ioc_get_mac(ioc); in bfa_ioc_aen_post()
2951 aen_entry->aen_data.ioc.ioc_type = ioc_type; in bfa_ioc_aen_post()
2952 bfad_im_post_vendor_event(aen_entry, bfad, ++ioc->ioc_aen_seq, in bfa_ioc_aen_post()
2964 if (ioc->dbg_fwsave_len == 0) in bfa_ioc_debug_fwsave()
2968 if (tlen > ioc->dbg_fwsave_len) in bfa_ioc_debug_fwsave()
2969 tlen = ioc->dbg_fwsave_len; in bfa_ioc_debug_fwsave()
2971 memcpy(trcdata, ioc->dbg_fwsave, tlen); in bfa_ioc_debug_fwsave()
3004 bfi_h2i_set(req->mh, BFI_MC_IOC, BFI_IOC_H2I_DBG_SYNC, in bfa_ioc_send_fwsync()
3006 req->clscode = cpu_to_be16(ioc->clscode); in bfa_ioc_send_fwsync()
3029 fwsync_iter--; in bfa_ioc_fwsync()
3060 dlen = smem_len - loff; in bfa_ioc_debug_fwcore()
3090 if (ioc->stats_busy) { in bfa_ioc_fw_stats_get()
3091 bfa_trc(ioc, ioc->stats_busy); in bfa_ioc_fw_stats_get()
3094 ioc->stats_busy = BFA_TRUE; in bfa_ioc_fw_stats_get()
3099 ioc->stats_busy = BFA_FALSE; in bfa_ioc_fw_stats_get()
3111 if (ioc->stats_busy) { in bfa_ioc_fw_stats_clear()
3112 bfa_trc(ioc, ioc->stats_busy); in bfa_ioc_fw_stats_clear()
3115 ioc->stats_busy = BFA_TRUE; in bfa_ioc_fw_stats_clear()
3120 ioc->stats_busy = BFA_FALSE; in bfa_ioc_fw_stats_clear()
3132 if (ioc->dbg_fwsave_once) { in bfa_ioc_debug_save_ftrc()
3133 ioc->dbg_fwsave_once = BFA_FALSE; in bfa_ioc_debug_save_ftrc()
3134 if (ioc->dbg_fwsave_len) { in bfa_ioc_debug_save_ftrc()
3135 tlen = ioc->dbg_fwsave_len; in bfa_ioc_debug_save_ftrc()
3136 bfa_ioc_debug_fwtrc(ioc, ioc->dbg_fwsave, &tlen); in bfa_ioc_debug_save_ftrc()
3148 ioc->stats.hb_count = ioc->hb_count; in bfa_ioc_recover()
3161 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT); in bfa_iocpf_timeout()
3180 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FWREADY); in bfa_ioc_poll_fwinit()
3184 if (ioc->iocpf.poll_time >= (3 * BFA_IOC_TOV)) in bfa_ioc_poll_fwinit()
3187 ioc->iocpf.poll_time += BFA_IOC_POLL_TOV; in bfa_ioc_poll_fwinit()
3206 struct list_head *qh = &mod->timer_q; in bfa_timer_beat()
3219 if (elem->timeout <= BFA_TIMER_FREQ) { in bfa_timer_beat()
3220 elem->timeout = 0; in bfa_timer_beat()
3221 list_del(&elem->qe); in bfa_timer_beat()
3222 list_add_tail(&elem->qe, &timedout_q); in bfa_timer_beat()
3224 elem->timeout -= BFA_TIMER_FREQ; in bfa_timer_beat()
3235 elem->timercb(elem->arg); in bfa_timer_beat()
3248 WARN_ON(bfa_q_is_on_q(&mod->timer_q, timer)); in bfa_timer_begin()
3250 timer->timeout = timeout; in bfa_timer_begin()
3251 timer->timercb = timercb; in bfa_timer_begin()
3252 timer->arg = arg; in bfa_timer_begin()
3254 list_add_tail(&timer->qe, &mod->timer_q); in bfa_timer_begin()
3263 WARN_ON(list_empty(&timer->qe)); in bfa_timer_stop()
3265 list_del(&timer->qe); in bfa_timer_stop()
3279 cfg_inst = &cfg->inst[i]; in bfa_ablk_config_swap()
3281 be16 = cfg_inst->pf_cfg[j].pers; in bfa_ablk_config_swap()
3282 cfg_inst->pf_cfg[j].pers = be16_to_cpu(be16); in bfa_ablk_config_swap()
3283 be16 = cfg_inst->pf_cfg[j].num_qpairs; in bfa_ablk_config_swap()
3284 cfg_inst->pf_cfg[j].num_qpairs = be16_to_cpu(be16); in bfa_ablk_config_swap()
3285 be16 = cfg_inst->pf_cfg[j].num_vectors; in bfa_ablk_config_swap()
3286 cfg_inst->pf_cfg[j].num_vectors = be16_to_cpu(be16); in bfa_ablk_config_swap()
3287 be16 = cfg_inst->pf_cfg[j].bw_min; in bfa_ablk_config_swap()
3288 cfg_inst->pf_cfg[j].bw_min = be16_to_cpu(be16); in bfa_ablk_config_swap()
3289 be16 = cfg_inst->pf_cfg[j].bw_max; in bfa_ablk_config_swap()
3290 cfg_inst->pf_cfg[j].bw_max = be16_to_cpu(be16); in bfa_ablk_config_swap()
3302 WARN_ON(msg->mh.msg_class != BFI_MC_ABLK); in bfa_ablk_isr()
3303 bfa_trc(ablk->ioc, msg->mh.msg_id); in bfa_ablk_isr()
3305 switch (msg->mh.msg_id) { in bfa_ablk_isr()
3307 if (rsp->status == BFA_STATUS_OK) { in bfa_ablk_isr()
3308 memcpy(ablk->cfg, ablk->dma_addr.kva, in bfa_ablk_isr()
3310 bfa_ablk_config_swap(ablk->cfg); in bfa_ablk_isr()
3311 ablk->cfg = NULL; in bfa_ablk_isr()
3318 ablk->ioc->port_mode_cfg = rsp->port_mode; in bfa_ablk_isr()
3324 /* No-op */ in bfa_ablk_isr()
3328 *(ablk->pcifn) = rsp->pcifn; in bfa_ablk_isr()
3329 ablk->pcifn = NULL; in bfa_ablk_isr()
3336 ablk->busy = BFA_FALSE; in bfa_ablk_isr()
3337 if (ablk->cbfn) { in bfa_ablk_isr()
3338 cbfn = ablk->cbfn; in bfa_ablk_isr()
3339 ablk->cbfn = NULL; in bfa_ablk_isr()
3340 cbfn(ablk->cbarg, rsp->status); in bfa_ablk_isr()
3349 bfa_trc(ablk->ioc, event); in bfa_ablk_notify()
3353 WARN_ON(ablk->busy != BFA_FALSE); in bfa_ablk_notify()
3359 ablk->pcifn = NULL; in bfa_ablk_notify()
3360 if (ablk->busy) { in bfa_ablk_notify()
3361 if (ablk->cbfn) in bfa_ablk_notify()
3362 ablk->cbfn(ablk->cbarg, BFA_STATUS_FAILED); in bfa_ablk_notify()
3363 ablk->cbfn = NULL; in bfa_ablk_notify()
3364 ablk->busy = BFA_FALSE; in bfa_ablk_notify()
3383 ablk->dma_addr.kva = dma_kva; in bfa_ablk_memclaim()
3384 ablk->dma_addr.pa = dma_pa; in bfa_ablk_memclaim()
3390 ablk->ioc = ioc; in bfa_ablk_attach()
3392 bfa_ioc_mbox_regisr(ablk->ioc, BFI_MC_ABLK, bfa_ablk_isr, ablk); in bfa_ablk_attach()
3393 bfa_q_qe_init(&ablk->ioc_notify); in bfa_ablk_attach()
3394 bfa_ioc_notify_init(&ablk->ioc_notify, bfa_ablk_notify, ablk); in bfa_ablk_attach()
3395 list_add_tail(&ablk->ioc_notify.qe, &ablk->ioc->notify_q); in bfa_ablk_attach()
3402 struct bfi_ablk_h2i_query_s *m; in bfa_ablk_query() local
3406 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_query()
3407 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_query()
3411 if (ablk->busy) { in bfa_ablk_query()
3412 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_query()
3416 ablk->cfg = ablk_cfg; in bfa_ablk_query()
3417 ablk->cbfn = cbfn; in bfa_ablk_query()
3418 ablk->cbarg = cbarg; in bfa_ablk_query()
3419 ablk->busy = BFA_TRUE; in bfa_ablk_query()
3421 m = (struct bfi_ablk_h2i_query_s *)ablk->mb.msg; in bfa_ablk_query()
3422 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_QUERY, in bfa_ablk_query()
3423 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_query()
3424 bfa_dma_be_addr_set(m->addr, ablk->dma_addr.pa); in bfa_ablk_query()
3425 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_query()
3436 struct bfi_ablk_h2i_pf_req_s *m; in bfa_ablk_pf_create() local
3438 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_pf_create()
3439 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_pf_create()
3443 if (ablk->busy) { in bfa_ablk_pf_create()
3444 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_pf_create()
3448 ablk->pcifn = pcifn; in bfa_ablk_pf_create()
3449 ablk->cbfn = cbfn; in bfa_ablk_pf_create()
3450 ablk->cbarg = cbarg; in bfa_ablk_pf_create()
3451 ablk->busy = BFA_TRUE; in bfa_ablk_pf_create()
3453 m = (struct bfi_ablk_h2i_pf_req_s *)ablk->mb.msg; in bfa_ablk_pf_create()
3454 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_CREATE, in bfa_ablk_pf_create()
3455 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_pf_create()
3456 m->pers = cpu_to_be16((u16)personality); in bfa_ablk_pf_create()
3457 m->bw_min = cpu_to_be16(bw_min); in bfa_ablk_pf_create()
3458 m->bw_max = cpu_to_be16(bw_max); in bfa_ablk_pf_create()
3459 m->port = port; in bfa_ablk_pf_create()
3460 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_pf_create()
3469 struct bfi_ablk_h2i_pf_req_s *m; in bfa_ablk_pf_delete() local
3471 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_pf_delete()
3472 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_pf_delete()
3476 if (ablk->busy) { in bfa_ablk_pf_delete()
3477 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_pf_delete()
3481 ablk->cbfn = cbfn; in bfa_ablk_pf_delete()
3482 ablk->cbarg = cbarg; in bfa_ablk_pf_delete()
3483 ablk->busy = BFA_TRUE; in bfa_ablk_pf_delete()
3485 m = (struct bfi_ablk_h2i_pf_req_s *)ablk->mb.msg; in bfa_ablk_pf_delete()
3486 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_DELETE, in bfa_ablk_pf_delete()
3487 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_pf_delete()
3488 m->pcifn = (u8)pcifn; in bfa_ablk_pf_delete()
3489 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_pf_delete()
3498 struct bfi_ablk_h2i_cfg_req_s *m; in bfa_ablk_adapter_config() local
3500 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_adapter_config()
3501 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_adapter_config()
3505 if (ablk->busy) { in bfa_ablk_adapter_config()
3506 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_adapter_config()
3510 ablk->cbfn = cbfn; in bfa_ablk_adapter_config()
3511 ablk->cbarg = cbarg; in bfa_ablk_adapter_config()
3512 ablk->busy = BFA_TRUE; in bfa_ablk_adapter_config()
3514 m = (struct bfi_ablk_h2i_cfg_req_s *)ablk->mb.msg; in bfa_ablk_adapter_config()
3515 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_ADPT_CONFIG, in bfa_ablk_adapter_config()
3516 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_adapter_config()
3517 m->mode = (u8)mode; in bfa_ablk_adapter_config()
3518 m->max_pf = (u8)max_pf; in bfa_ablk_adapter_config()
3519 m->max_vf = (u8)max_vf; in bfa_ablk_adapter_config()
3520 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_adapter_config()
3529 struct bfi_ablk_h2i_cfg_req_s *m; in bfa_ablk_port_config() local
3531 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_port_config()
3532 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_port_config()
3536 if (ablk->busy) { in bfa_ablk_port_config()
3537 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_port_config()
3541 ablk->cbfn = cbfn; in bfa_ablk_port_config()
3542 ablk->cbarg = cbarg; in bfa_ablk_port_config()
3543 ablk->busy = BFA_TRUE; in bfa_ablk_port_config()
3545 m = (struct bfi_ablk_h2i_cfg_req_s *)ablk->mb.msg; in bfa_ablk_port_config()
3546 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PORT_CONFIG, in bfa_ablk_port_config()
3547 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_port_config()
3548 m->port = (u8)port; in bfa_ablk_port_config()
3549 m->mode = (u8)mode; in bfa_ablk_port_config()
3550 m->max_pf = (u8)max_pf; in bfa_ablk_port_config()
3551 m->max_vf = (u8)max_vf; in bfa_ablk_port_config()
3552 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_port_config()
3561 struct bfi_ablk_h2i_pf_req_s *m; in bfa_ablk_pf_update() local
3563 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_pf_update()
3564 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_pf_update()
3568 if (ablk->busy) { in bfa_ablk_pf_update()
3569 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_pf_update()
3573 ablk->cbfn = cbfn; in bfa_ablk_pf_update()
3574 ablk->cbarg = cbarg; in bfa_ablk_pf_update()
3575 ablk->busy = BFA_TRUE; in bfa_ablk_pf_update()
3577 m = (struct bfi_ablk_h2i_pf_req_s *)ablk->mb.msg; in bfa_ablk_pf_update()
3578 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_UPDATE, in bfa_ablk_pf_update()
3579 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_pf_update()
3580 m->pcifn = (u8)pcifn; in bfa_ablk_pf_update()
3581 m->bw_min = cpu_to_be16(bw_min); in bfa_ablk_pf_update()
3582 m->bw_max = cpu_to_be16(bw_max); in bfa_ablk_pf_update()
3583 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_pf_update()
3591 struct bfi_ablk_h2i_optrom_s *m; in bfa_ablk_optrom_en() local
3593 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_optrom_en()
3594 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_optrom_en()
3598 if (ablk->busy) { in bfa_ablk_optrom_en()
3599 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_optrom_en()
3603 ablk->cbfn = cbfn; in bfa_ablk_optrom_en()
3604 ablk->cbarg = cbarg; in bfa_ablk_optrom_en()
3605 ablk->busy = BFA_TRUE; in bfa_ablk_optrom_en()
3607 m = (struct bfi_ablk_h2i_optrom_s *)ablk->mb.msg; in bfa_ablk_optrom_en()
3608 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_OPTROM_ENABLE, in bfa_ablk_optrom_en()
3609 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_optrom_en()
3610 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_optrom_en()
3618 struct bfi_ablk_h2i_optrom_s *m; in bfa_ablk_optrom_dis() local
3620 if (!bfa_ioc_is_operational(ablk->ioc)) { in bfa_ablk_optrom_dis()
3621 bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); in bfa_ablk_optrom_dis()
3625 if (ablk->busy) { in bfa_ablk_optrom_dis()
3626 bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); in bfa_ablk_optrom_dis()
3630 ablk->cbfn = cbfn; in bfa_ablk_optrom_dis()
3631 ablk->cbarg = cbarg; in bfa_ablk_optrom_dis()
3632 ablk->busy = BFA_TRUE; in bfa_ablk_optrom_dis()
3634 m = (struct bfi_ablk_h2i_optrom_s *)ablk->mb.msg; in bfa_ablk_optrom_dis()
3635 bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_OPTROM_DISABLE, in bfa_ablk_optrom_dis()
3636 bfa_ioc_portid(ablk->ioc)); in bfa_ablk_optrom_dis()
3637 bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); in bfa_ablk_optrom_dis()
3655 bfa_trc(sfp, sfp->lock); in bfa_cb_sfp_show()
3656 if (sfp->cbfn) in bfa_cb_sfp_show()
3657 sfp->cbfn(sfp->cbarg, sfp->status); in bfa_cb_sfp_show()
3658 sfp->lock = 0; in bfa_cb_sfp_show()
3659 sfp->cbfn = NULL; in bfa_cb_sfp_show()
3665 bfa_trc(sfp, sfp->portspeed); in bfa_cb_sfp_state_query()
3666 if (sfp->media) { in bfa_cb_sfp_state_query()
3668 if (sfp->state_query_cbfn) in bfa_cb_sfp_state_query()
3669 sfp->state_query_cbfn(sfp->state_query_cbarg, in bfa_cb_sfp_state_query()
3670 sfp->status); in bfa_cb_sfp_state_query()
3671 sfp->media = NULL; in bfa_cb_sfp_state_query()
3674 if (sfp->portspeed) { in bfa_cb_sfp_state_query()
3675 sfp->status = bfa_sfp_speed_valid(sfp, sfp->portspeed); in bfa_cb_sfp_state_query()
3676 if (sfp->state_query_cbfn) in bfa_cb_sfp_state_query()
3677 sfp->state_query_cbfn(sfp->state_query_cbarg, in bfa_cb_sfp_state_query()
3678 sfp->status); in bfa_cb_sfp_state_query()
3679 sfp->portspeed = BFA_PORT_SPEED_UNKNOWN; in bfa_cb_sfp_state_query()
3682 sfp->state_query_lock = 0; in bfa_cb_sfp_state_query()
3683 sfp->state_query_cbfn = NULL; in bfa_cb_sfp_state_query()
3695 bfa_trc(sfp, sfp->lock); in bfa_sfp_notify()
3696 bfa_trc(sfp, sfp->state_query_lock); in bfa_sfp_notify()
3701 if (sfp->lock) { in bfa_sfp_notify()
3702 sfp->status = BFA_STATUS_IOC_FAILURE; in bfa_sfp_notify()
3706 if (sfp->state_query_lock) { in bfa_sfp_notify()
3707 sfp->status = BFA_STATUS_IOC_FAILURE; in bfa_sfp_notify()
3723 struct bfad_s *bfad = (struct bfad_s *)sfp->ioc->bfa->bfad; in bfa_sfp_scn_aen_post()
3727 bfa_trc(sfp, (((u64)rsp->pomlvl) << 16) | (((u64)rsp->sfpid) << 8) | in bfa_sfp_scn_aen_post()
3728 ((u64)rsp->event)); in bfa_sfp_scn_aen_post()
3734 aen_entry->aen_data.port.ioc_type = bfa_ioc_get_type(sfp->ioc); in bfa_sfp_scn_aen_post()
3735 aen_entry->aen_data.port.pwwn = sfp->ioc->attr->pwwn; in bfa_sfp_scn_aen_post()
3736 aen_entry->aen_data.port.mac = bfa_ioc_get_mac(sfp->ioc); in bfa_sfp_scn_aen_post()
3738 switch (rsp->event) { in bfa_sfp_scn_aen_post()
3753 aen_entry->aen_data.port.level = rsp->pomlvl; in bfa_sfp_scn_aen_post()
3756 bfa_trc(sfp, rsp->event); in bfa_sfp_scn_aen_post()
3761 bfad_im_post_vendor_event(aen_entry, bfad, ++sfp->ioc->ioc_aen_seq, in bfa_sfp_scn_aen_post()
3771 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_getdata_send()
3773 bfa_trc(sfp, req->memtype); in bfa_sfp_getdata_send()
3776 bfi_h2i_set(req->mh, BFI_MC_SFP, BFI_SFP_H2I_SHOW, in bfa_sfp_getdata_send()
3777 bfa_ioc_portid(sfp->ioc)); in bfa_sfp_getdata_send()
3780 bfa_ioc_mbox_queue(sfp->ioc, &sfp->mbcmd); in bfa_sfp_getdata_send()
3789 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_getdata()
3791 WARN_ON(sfp->lock != 0); in bfa_sfp_getdata()
3792 bfa_trc(sfp, sfp->state); in bfa_sfp_getdata()
3794 sfp->lock = 1; in bfa_sfp_getdata()
3795 sfp->memtype = memtype; in bfa_sfp_getdata()
3796 req->memtype = memtype; in bfa_sfp_getdata()
3799 bfa_alen_set(&req->alen, sizeof(struct sfp_mem_s), sfp->dbuf_pa); in bfa_sfp_getdata()
3812 switch (rsp->event) { in bfa_sfp_scn()
3814 sfp->state = BFA_SFP_STATE_INSERTED; in bfa_sfp_scn()
3815 sfp->data_valid = 0; in bfa_sfp_scn()
3819 sfp->state = BFA_SFP_STATE_REMOVED; in bfa_sfp_scn()
3820 sfp->data_valid = 0; in bfa_sfp_scn()
3824 sfp->state = BFA_SFP_STATE_FAILED; in bfa_sfp_scn()
3825 sfp->data_valid = 0; in bfa_sfp_scn()
3829 sfp->state = BFA_SFP_STATE_UNSUPPORT; in bfa_sfp_scn()
3831 if (!sfp->lock) in bfa_sfp_scn()
3838 sfp->state = BFA_SFP_STATE_VALID; in bfa_sfp_scn()
3839 if (!sfp->lock) in bfa_sfp_scn()
3843 bfa_trc(sfp, rsp->event); in bfa_sfp_scn()
3856 if (!sfp->lock) { in bfa_sfp_show_comp()
3860 bfa_trc(sfp, sfp->lock); in bfa_sfp_show_comp()
3864 bfa_trc(sfp, rsp->status); in bfa_sfp_show_comp()
3865 if (rsp->status == BFA_STATUS_OK) { in bfa_sfp_show_comp()
3866 sfp->data_valid = 1; in bfa_sfp_show_comp()
3867 if (sfp->state == BFA_SFP_STATE_VALID) in bfa_sfp_show_comp()
3868 sfp->status = BFA_STATUS_OK; in bfa_sfp_show_comp()
3869 else if (sfp->state == BFA_SFP_STATE_UNSUPPORT) in bfa_sfp_show_comp()
3870 sfp->status = BFA_STATUS_SFP_UNSUPP; in bfa_sfp_show_comp()
3872 bfa_trc(sfp, sfp->state); in bfa_sfp_show_comp()
3874 sfp->data_valid = 0; in bfa_sfp_show_comp()
3875 sfp->status = rsp->status; in bfa_sfp_show_comp()
3879 bfa_trc(sfp, sfp->memtype); in bfa_sfp_show_comp()
3880 if (sfp->memtype == BFI_SFP_MEM_DIAGEXT) { in bfa_sfp_show_comp()
3881 bfa_trc(sfp, sfp->data_valid); in bfa_sfp_show_comp()
3882 if (sfp->data_valid) { in bfa_sfp_show_comp()
3884 u8 *des = (u8 *)(sfp->sfpmem); in bfa_sfp_show_comp()
3885 memcpy(des, sfp->dbuf_kva, size); in bfa_sfp_show_comp()
3892 sfp->lock = 0; in bfa_sfp_show_comp()
3894 bfa_trc(sfp, sfp->state_query_lock); in bfa_sfp_show_comp()
3895 if (sfp->state_query_lock) { in bfa_sfp_show_comp()
3896 sfp->state = rsp->state; in bfa_sfp_show_comp()
3908 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_state_query()
3911 WARN_ON(sfp->state != BFA_SFP_STATE_INIT); in bfa_sfp_state_query()
3912 WARN_ON(sfp->state_query_lock != 0); in bfa_sfp_state_query()
3913 bfa_trc(sfp, sfp->state); in bfa_sfp_state_query()
3915 sfp->state_query_lock = 1; in bfa_sfp_state_query()
3916 req->memtype = 0; in bfa_sfp_state_query()
3918 if (!sfp->lock) in bfa_sfp_state_query()
3925 enum bfa_defs_sfp_media_e *media = sfp->media; in bfa_sfp_media_get()
3929 if (sfp->state == BFA_SFP_STATE_UNSUPPORT) in bfa_sfp_media_get()
3931 else if (sfp->state == BFA_SFP_STATE_VALID) { in bfa_sfp_media_get()
3933 struct sfp_mem_s *sfpmem = (struct sfp_mem_s *)sfp->dbuf_kva; in bfa_sfp_media_get()
3934 u16 xmtr_tech = (sfpmem->srlid_base.xcvr[4] & 0x3) << 7 | in bfa_sfp_media_get()
3935 (sfpmem->srlid_base.xcvr[5] >> 1); in bfa_sfp_media_get()
3937 e10g.b = sfpmem->srlid_base.xcvr[0]; in bfa_sfp_media_get()
3965 bfa_trc(sfp, sfp->state); in bfa_sfp_media_get()
3971 struct sfp_mem_s *sfpmem = (struct sfp_mem_s *)sfp->dbuf_kva; in bfa_sfp_speed_valid()
3972 struct sfp_xcvr_s *xcvr = (struct sfp_xcvr_s *) sfpmem->srlid_base.xcvr; in bfa_sfp_speed_valid()
3973 union sfp_xcvr_fc3_code_u fc3 = xcvr->fc3; in bfa_sfp_speed_valid()
3974 union sfp_xcvr_e10g_code_u e10g = xcvr->e10g; in bfa_sfp_speed_valid()
4006 switch (msg->mh.msg_id) { in bfa_sfp_intr()
4016 bfa_trc(sfp, msg->mh.msg_id); in bfa_sfp_intr()
4037 sfp->dev = dev; in bfa_sfp_attach()
4038 sfp->ioc = ioc; in bfa_sfp_attach()
4039 sfp->trcmod = trcmod; in bfa_sfp_attach()
4041 sfp->cbfn = NULL; in bfa_sfp_attach()
4042 sfp->cbarg = NULL; in bfa_sfp_attach()
4043 sfp->sfpmem = NULL; in bfa_sfp_attach()
4044 sfp->lock = 0; in bfa_sfp_attach()
4045 sfp->data_valid = 0; in bfa_sfp_attach()
4046 sfp->state = BFA_SFP_STATE_INIT; in bfa_sfp_attach()
4047 sfp->state_query_lock = 0; in bfa_sfp_attach()
4048 sfp->state_query_cbfn = NULL; in bfa_sfp_attach()
4049 sfp->state_query_cbarg = NULL; in bfa_sfp_attach()
4050 sfp->media = NULL; in bfa_sfp_attach()
4051 sfp->portspeed = BFA_PORT_SPEED_UNKNOWN; in bfa_sfp_attach()
4052 sfp->is_elb = BFA_FALSE; in bfa_sfp_attach()
4054 bfa_ioc_mbox_regisr(sfp->ioc, BFI_MC_SFP, bfa_sfp_intr, sfp); in bfa_sfp_attach()
4055 bfa_q_qe_init(&sfp->ioc_notify); in bfa_sfp_attach()
4056 bfa_ioc_notify_init(&sfp->ioc_notify, bfa_sfp_notify, sfp); in bfa_sfp_attach()
4057 list_add_tail(&sfp->ioc_notify.qe, &sfp->ioc->notify_q); in bfa_sfp_attach()
4066 sfp->dbuf_kva = dm_kva; in bfa_sfp_memclaim()
4067 sfp->dbuf_pa = dm_pa; in bfa_sfp_memclaim()
4068 memset(sfp->dbuf_kva, 0, sizeof(struct sfp_mem_s)); in bfa_sfp_memclaim()
4077 * @param[in] sfp - bfa sfp module
4079 * @param[out] sfpmem - sfp eeprom data
4087 if (!bfa_ioc_is_operational(sfp->ioc)) { in bfa_sfp_show()
4092 if (sfp->lock) { in bfa_sfp_show()
4097 sfp->cbfn = cbfn; in bfa_sfp_show()
4098 sfp->cbarg = cbarg; in bfa_sfp_show()
4099 sfp->sfpmem = sfpmem; in bfa_sfp_show()
4108 * @param[in] sfp - bfa sfp module
4110 * @param[out] media - port speed from user
4117 if (!bfa_ioc_is_operational(sfp->ioc)) { in bfa_sfp_media()
4122 sfp->media = media; in bfa_sfp_media()
4123 if (sfp->state == BFA_SFP_STATE_INIT) { in bfa_sfp_media()
4124 if (sfp->state_query_lock) { in bfa_sfp_media()
4128 sfp->state_query_cbfn = cbfn; in bfa_sfp_media()
4129 sfp->state_query_cbarg = cbarg; in bfa_sfp_media()
4142 * @param[in] sfp - bfa sfp module
4143 * @param[in] portspeed - port speed from user
4152 if (!bfa_ioc_is_operational(sfp->ioc)) in bfa_sfp_speed()
4156 if (bfa_mfg_is_mezz(sfp->ioc->attr->card_type)) in bfa_sfp_speed()
4160 sfp->portspeed = portspeed; in bfa_sfp_speed()
4161 if (sfp->state == BFA_SFP_STATE_INIT) { in bfa_sfp_speed()
4162 if (sfp->state_query_lock) { in bfa_sfp_speed()
4166 sfp->state_query_cbfn = cbfn; in bfa_sfp_speed()
4167 sfp->state_query_cbarg = cbarg; in bfa_sfp_speed()
4173 if (sfp->state == BFA_SFP_STATE_REMOVED || in bfa_sfp_speed()
4174 sfp->state == BFA_SFP_STATE_FAILED) { in bfa_sfp_speed()
4175 bfa_trc(sfp, sfp->state); in bfa_sfp_speed()
4179 if (sfp->state == BFA_SFP_STATE_INSERTED) { in bfa_sfp_speed()
4180 bfa_trc(sfp, sfp->state); in bfa_sfp_speed()
4185 if (sfp->is_elb) in bfa_sfp_speed()
4208 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; in bfa_flash_aen_audit_post()
4215 aen_entry->aen_data.audit.pwwn = ioc->attr->pwwn; in bfa_flash_aen_audit_post()
4216 aen_entry->aen_data.audit.partition_inst = inst; in bfa_flash_aen_audit_post()
4217 aen_entry->aen_data.audit.partition_type = type; in bfa_flash_aen_audit_post()
4220 bfad_im_post_vendor_event(aen_entry, bfad, ++ioc->ioc_aen_seq, in bfa_flash_aen_audit_post()
4227 flash->op_busy = 0; in bfa_flash_cb()
4228 if (flash->cbfn) in bfa_flash_cb()
4229 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_cb()
4241 if (flash->op_busy) { in bfa_flash_notify()
4242 flash->status = BFA_STATUS_IOC_FAILURE; in bfa_flash_notify()
4243 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_notify()
4244 flash->op_busy = 0; in bfa_flash_notify()
4256 * @param[in] cbarg - callback argument
4263 (struct bfi_flash_query_req_s *) flash->mb.msg; in bfa_flash_query_send()
4265 bfi_h2i_set(msg->mh, BFI_MC_FLASH, BFI_FLASH_H2I_QUERY_REQ, in bfa_flash_query_send()
4266 bfa_ioc_portid(flash->ioc)); in bfa_flash_query_send()
4267 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr_s), in bfa_flash_query_send()
4268 flash->dbuf_pa); in bfa_flash_query_send()
4269 bfa_ioc_mbox_queue(flash->ioc, &flash->mb); in bfa_flash_query_send()
4275 * @param[in] cbarg - callback argument
4281 (struct bfi_flash_write_req_s *) flash->mb.msg; in bfa_flash_write_send()
4284 msg->type = be32_to_cpu(flash->type); in bfa_flash_write_send()
4285 msg->instance = flash->instance; in bfa_flash_write_send()
4286 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_write_send()
4287 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_write_send()
4288 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_write_send()
4289 msg->length = be32_to_cpu(len); in bfa_flash_write_send()
4292 msg->last = (len == flash->residue) ? 1 : 0; in bfa_flash_write_send()
4294 bfi_h2i_set(msg->mh, BFI_MC_FLASH, BFI_FLASH_H2I_WRITE_REQ, in bfa_flash_write_send()
4295 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
4296 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_write_send()
4297 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len); in bfa_flash_write_send()
4298 bfa_ioc_mbox_queue(flash->ioc, &flash->mb); in bfa_flash_write_send()
4300 flash->residue -= len; in bfa_flash_write_send()
4301 flash->offset += len; in bfa_flash_write_send()
4307 * @param[in] cbarg - callback argument
4314 (struct bfi_flash_read_req_s *) flash->mb.msg; in bfa_flash_read_send()
4317 msg->type = be32_to_cpu(flash->type); in bfa_flash_read_send()
4318 msg->instance = flash->instance; in bfa_flash_read_send()
4319 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_read_send()
4320 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_read_send()
4321 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_read_send()
4322 msg->length = be32_to_cpu(len); in bfa_flash_read_send()
4323 bfi_h2i_set(msg->mh, BFI_MC_FLASH, BFI_FLASH_H2I_READ_REQ, in bfa_flash_read_send()
4324 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
4325 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_read_send()
4326 bfa_ioc_mbox_queue(flash->ioc, &flash->mb); in bfa_flash_read_send()
4332 * @param[in] cbarg - callback argument
4339 (struct bfi_flash_erase_req_s *) flash->mb.msg; in bfa_flash_erase_send()
4341 msg->type = be32_to_cpu(flash->type); in bfa_flash_erase_send()
4342 msg->instance = flash->instance; in bfa_flash_erase_send()
4343 bfi_h2i_set(msg->mh, BFI_MC_FLASH, BFI_FLASH_H2I_ERASE_REQ, in bfa_flash_erase_send()
4344 bfa_ioc_portid(flash->ioc)); in bfa_flash_erase_send()
4345 bfa_ioc_mbox_queue(flash->ioc, &flash->mb); in bfa_flash_erase_send()
4351 * @param[in] flasharg - flash structure
4352 * @param[in] msg - message structure
4367 } m; in bfa_flash_intr() local
4369 m.msg = msg; in bfa_flash_intr()
4370 bfa_trc(flash, msg->mh.msg_id); in bfa_flash_intr()
4372 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT) { in bfa_flash_intr()
4378 switch (msg->mh.msg_id) { in bfa_flash_intr()
4380 status = be32_to_cpu(m.query->status); in bfa_flash_intr()
4386 attr = (struct bfa_flash_attr_s *) flash->ubuf; in bfa_flash_intr()
4387 f = (struct bfa_flash_attr_s *) flash->dbuf_kva; in bfa_flash_intr()
4388 attr->status = be32_to_cpu(f->status); in bfa_flash_intr()
4389 attr->npart = be32_to_cpu(f->npart); in bfa_flash_intr()
4390 bfa_trc(flash, attr->status); in bfa_flash_intr()
4391 bfa_trc(flash, attr->npart); in bfa_flash_intr()
4392 for (i = 0; i < attr->npart; i++) { in bfa_flash_intr()
4393 attr->part[i].part_type = in bfa_flash_intr()
4394 be32_to_cpu(f->part[i].part_type); in bfa_flash_intr()
4395 attr->part[i].part_instance = in bfa_flash_intr()
4396 be32_to_cpu(f->part[i].part_instance); in bfa_flash_intr()
4397 attr->part[i].part_off = in bfa_flash_intr()
4398 be32_to_cpu(f->part[i].part_off); in bfa_flash_intr()
4399 attr->part[i].part_size = in bfa_flash_intr()
4400 be32_to_cpu(f->part[i].part_size); in bfa_flash_intr()
4401 attr->part[i].part_len = in bfa_flash_intr()
4402 be32_to_cpu(f->part[i].part_len); in bfa_flash_intr()
4403 attr->part[i].part_status = in bfa_flash_intr()
4404 be32_to_cpu(f->part[i].part_status); in bfa_flash_intr()
4407 flash->status = status; in bfa_flash_intr()
4411 status = be32_to_cpu(m.erase->status); in bfa_flash_intr()
4413 flash->status = status; in bfa_flash_intr()
4417 status = be32_to_cpu(m.write->status); in bfa_flash_intr()
4419 if (status != BFA_STATUS_OK || flash->residue == 0) { in bfa_flash_intr()
4420 flash->status = status; in bfa_flash_intr()
4423 bfa_trc(flash, flash->offset); in bfa_flash_intr()
4428 status = be32_to_cpu(m.read->status); in bfa_flash_intr()
4431 flash->status = status; in bfa_flash_intr()
4434 u32 len = be32_to_cpu(m.read->length); in bfa_flash_intr()
4435 bfa_trc(flash, flash->offset); in bfa_flash_intr()
4437 memcpy(flash->ubuf + flash->offset, in bfa_flash_intr()
4438 flash->dbuf_kva, len); in bfa_flash_intr()
4439 flash->residue -= len; in bfa_flash_intr()
4440 flash->offset += len; in bfa_flash_intr()
4441 if (flash->residue == 0) { in bfa_flash_intr()
4442 flash->status = status; in bfa_flash_intr()
4451 status = be32_to_cpu(m.event->status); in bfa_flash_intr()
4454 bfa_ioc_aen_post(flash->ioc, BFA_IOC_AEN_FWCFG_ERROR); in bfa_flash_intr()
4457 param = be32_to_cpu(m.event->param); in bfa_flash_intr()
4459 bfa_ioc_aen_post(flash->ioc, in bfa_flash_intr()
4472 * @param[in] mincfg - minimal cfg variable
4486 * @param[in] flash - flash structure
4487 * @param[in] ioc - ioc structure
4488 * @param[in] dev - device structure
4489 * @param[in] trcmod - trace module
4490 * @param[in] logmod - log module
4496 flash->ioc = ioc; in bfa_flash_attach()
4497 flash->trcmod = trcmod; in bfa_flash_attach()
4498 flash->cbfn = NULL; in bfa_flash_attach()
4499 flash->cbarg = NULL; in bfa_flash_attach()
4500 flash->op_busy = 0; in bfa_flash_attach()
4502 bfa_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_flash_attach()
4503 bfa_q_qe_init(&flash->ioc_notify); in bfa_flash_attach()
4504 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash); in bfa_flash_attach()
4505 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_flash_attach()
4509 flash->dbuf_kva = NULL; in bfa_flash_attach()
4510 flash->dbuf_pa = 0; in bfa_flash_attach()
4517 * @param[in] flash - flash structure
4518 * @param[in] dm_kva - pointer to virtual memory address
4519 * @param[in] dm_pa - physical memory address
4520 * @param[in] mincfg - minimal cfg variable
4529 flash->dbuf_kva = dm_kva; in bfa_flash_memclaim()
4530 flash->dbuf_pa = dm_pa; in bfa_flash_memclaim()
4531 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ); in bfa_flash_memclaim()
4539 * @param[in] flash - flash structure
4540 * @param[in] attr - flash attribute structure
4541 * @param[in] cbfn - callback function
4542 * @param[in] cbarg - callback argument
4552 if (!bfa_ioc_is_operational(flash->ioc)) in bfa_flash_get_attr()
4555 if (flash->op_busy) { in bfa_flash_get_attr()
4556 bfa_trc(flash, flash->op_busy); in bfa_flash_get_attr()
4560 flash->op_busy = 1; in bfa_flash_get_attr()
4561 flash->cbfn = cbfn; in bfa_flash_get_attr()
4562 flash->cbarg = cbarg; in bfa_flash_get_attr()
4563 flash->ubuf = (u8 *) attr; in bfa_flash_get_attr()
4572 * @param[in] flash - flash structure
4573 * @param[in] type - flash partition type
4574 * @param[in] instance - flash partition instance
4575 * @param[in] cbfn - callback function
4576 * @param[in] cbarg - callback argument
4588 if (!bfa_ioc_is_operational(flash->ioc)) in bfa_flash_erase_part()
4591 if (flash->op_busy) { in bfa_flash_erase_part()
4592 bfa_trc(flash, flash->op_busy); in bfa_flash_erase_part()
4596 flash->op_busy = 1; in bfa_flash_erase_part()
4597 flash->cbfn = cbfn; in bfa_flash_erase_part()
4598 flash->cbarg = cbarg; in bfa_flash_erase_part()
4599 flash->type = type; in bfa_flash_erase_part()
4600 flash->instance = instance; in bfa_flash_erase_part()
4603 bfa_flash_aen_audit_post(flash->ioc, BFA_AUDIT_AEN_FLASH_ERASE, in bfa_flash_erase_part()
4611 * @param[in] flash - flash structure
4612 * @param[in] type - flash partition type
4613 * @param[in] instance - flash partition instance
4614 * @param[in] buf - update data buffer
4615 * @param[in] len - data buffer length
4616 * @param[in] offset - offset relative to the partition starting address
4617 * @param[in] cbfn - callback function
4618 * @param[in] cbarg - callback argument
4633 if (!bfa_ioc_is_operational(flash->ioc)) in bfa_flash_update_part()
4637 * 'len' must be in word (4-byte) boundary in bfa_flash_update_part()
4646 if (flash->op_busy) { in bfa_flash_update_part()
4647 bfa_trc(flash, flash->op_busy); in bfa_flash_update_part()
4651 flash->op_busy = 1; in bfa_flash_update_part()
4652 flash->cbfn = cbfn; in bfa_flash_update_part()
4653 flash->cbarg = cbarg; in bfa_flash_update_part()
4654 flash->type = type; in bfa_flash_update_part()
4655 flash->instance = instance; in bfa_flash_update_part()
4656 flash->residue = len; in bfa_flash_update_part()
4657 flash->offset = 0; in bfa_flash_update_part()
4658 flash->addr_off = offset; in bfa_flash_update_part()
4659 flash->ubuf = buf; in bfa_flash_update_part()
4668 * @param[in] flash - flash structure
4669 * @param[in] type - flash partition type
4670 * @param[in] instance - flash partition instance
4671 * @param[in] buf - read data buffer
4672 * @param[in] len - data buffer length
4673 * @param[in] offset - offset relative to the partition starting address
4674 * @param[in] cbfn - callback function
4675 * @param[in] cbarg - callback argument
4690 if (!bfa_ioc_is_operational(flash->ioc)) in bfa_flash_read_part()
4694 * 'len' must be in word (4-byte) boundary in bfa_flash_read_part()
4700 if (flash->op_busy) { in bfa_flash_read_part()
4701 bfa_trc(flash, flash->op_busy); in bfa_flash_read_part()
4705 flash->op_busy = 1; in bfa_flash_read_part()
4706 flash->cbfn = cbfn; in bfa_flash_read_part()
4707 flash->cbarg = cbarg; in bfa_flash_read_part()
4708 flash->type = type; in bfa_flash_read_part()
4709 flash->instance = instance; in bfa_flash_read_part()
4710 flash->residue = len; in bfa_flash_read_part()
4711 flash->offset = 0; in bfa_flash_read_part()
4712 flash->addr_off = offset; in bfa_flash_read_part()
4713 flash->ubuf = buf; in bfa_flash_read_part()
4733 bfa_trc(diag, diag->block); in bfa_diag_notify()
4734 bfa_trc(diag, diag->fwping.lock); in bfa_diag_notify()
4735 bfa_trc(diag, diag->tsensor.lock); in bfa_diag_notify()
4740 if (diag->fwping.lock) { in bfa_diag_notify()
4741 diag->fwping.status = BFA_STATUS_IOC_FAILURE; in bfa_diag_notify()
4742 diag->fwping.cbfn(diag->fwping.cbarg, in bfa_diag_notify()
4743 diag->fwping.status); in bfa_diag_notify()
4744 diag->fwping.lock = 0; in bfa_diag_notify()
4747 if (diag->tsensor.lock) { in bfa_diag_notify()
4748 diag->tsensor.status = BFA_STATUS_IOC_FAILURE; in bfa_diag_notify()
4749 diag->tsensor.cbfn(diag->tsensor.cbarg, in bfa_diag_notify()
4750 diag->tsensor.status); in bfa_diag_notify()
4751 diag->tsensor.lock = 0; in bfa_diag_notify()
4754 if (diag->block) { in bfa_diag_notify()
4755 if (diag->timer_active) { in bfa_diag_notify()
4756 bfa_timer_stop(&diag->timer); in bfa_diag_notify()
4757 diag->timer_active = 0; in bfa_diag_notify()
4760 diag->status = BFA_STATUS_IOC_FAILURE; in bfa_diag_notify()
4761 diag->cbfn(diag->cbarg, diag->status); in bfa_diag_notify()
4762 diag->block = 0; in bfa_diag_notify()
4775 struct bfa_ioc_s *ioc = diag->ioc; in bfa_diag_memtest_done()
4776 struct bfa_diag_memtest_result *res = diag->result; in bfa_diag_memtest_done()
4780 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); in bfa_diag_memtest_done()
4783 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_diag_memtest_done()
4789 bfa_mem_read(ioc->ioc_regs.smem_page_start, loff); in bfa_diag_memtest_done()
4796 res->status = swab32(res->status); in bfa_diag_memtest_done()
4797 bfa_trc(diag, res->status); in bfa_diag_memtest_done()
4799 if (res->status == BFI_BOOT_MEMTEST_RES_SIG) in bfa_diag_memtest_done()
4800 diag->status = BFA_STATUS_OK; in bfa_diag_memtest_done()
4802 diag->status = BFA_STATUS_MEMTEST_FAILED; in bfa_diag_memtest_done()
4803 res->addr = swab32(res->addr); in bfa_diag_memtest_done()
4804 res->exp = swab32(res->exp); in bfa_diag_memtest_done()
4805 res->act = swab32(res->act); in bfa_diag_memtest_done()
4806 res->err_status = swab32(res->err_status); in bfa_diag_memtest_done()
4807 res->err_status1 = swab32(res->err_status1); in bfa_diag_memtest_done()
4808 res->err_addr = swab32(res->err_addr); in bfa_diag_memtest_done()
4809 bfa_trc(diag, res->addr); in bfa_diag_memtest_done()
4810 bfa_trc(diag, res->exp); in bfa_diag_memtest_done()
4811 bfa_trc(diag, res->act); in bfa_diag_memtest_done()
4812 bfa_trc(diag, res->err_status); in bfa_diag_memtest_done()
4813 bfa_trc(diag, res->err_status1); in bfa_diag_memtest_done()
4814 bfa_trc(diag, res->err_addr); in bfa_diag_memtest_done()
4816 diag->timer_active = 0; in bfa_diag_memtest_done()
4817 diag->cbfn(diag->cbarg, diag->status); in bfa_diag_memtest_done()
4818 diag->block = 0; in bfa_diag_memtest_done()
4834 bfa_trc(diag, diag->fwping.dbuf_pa); in diag_fwping_send()
4838 *((u32 *)diag->fwping.dbuf_kva + i) = diag->fwping.data; in diag_fwping_send()
4841 fwping_req = (struct bfi_diag_fwping_req_s *)diag->fwping.mbcmd.msg; in diag_fwping_send()
4844 bfa_alen_set(&fwping_req->alen, BFI_DIAG_DMA_BUF_SZ, in diag_fwping_send()
4845 diag->fwping.dbuf_pa); in diag_fwping_send()
4847 fwping_req->count = cpu_to_be32(diag->fwping.count); in diag_fwping_send()
4849 fwping_req->data = diag->fwping.data; in diag_fwping_send()
4852 bfi_h2i_set(fwping_req->mh, BFI_MC_DIAG, BFI_DIAG_H2I_FWPING, in diag_fwping_send()
4853 bfa_ioc_portid(diag->ioc)); in diag_fwping_send()
4856 bfa_ioc_mbox_queue(diag->ioc, &diag->fwping.mbcmd); in diag_fwping_send()
4863 u32 rsp_data = diag_rsp->data; in diag_fwping_comp()
4864 u8 rsp_dma_status = diag_rsp->dma_status; in diag_fwping_comp()
4871 pat = (diag->fwping.count & 0x1) ? ~(diag->fwping.data) : in diag_fwping_comp()
4872 diag->fwping.data; in diag_fwping_comp()
4874 if (diag->fwping.data != rsp_data) { in diag_fwping_comp()
4876 diag->fwping.result->dmastatus = in diag_fwping_comp()
4878 diag->fwping.status = BFA_STATUS_DATACORRUPTED; in diag_fwping_comp()
4879 diag->fwping.cbfn(diag->fwping.cbarg, in diag_fwping_comp()
4880 diag->fwping.status); in diag_fwping_comp()
4881 diag->fwping.lock = 0; in diag_fwping_comp()
4886 if (*((u32 *)diag->fwping.dbuf_kva + i) != pat) { in diag_fwping_comp()
4890 *((u32 *)diag->fwping.dbuf_kva + i)); in diag_fwping_comp()
4891 diag->fwping.result->dmastatus = in diag_fwping_comp()
4893 diag->fwping.status = BFA_STATUS_DATACORRUPTED; in diag_fwping_comp()
4894 diag->fwping.cbfn(diag->fwping.cbarg, in diag_fwping_comp()
4895 diag->fwping.status); in diag_fwping_comp()
4896 diag->fwping.lock = 0; in diag_fwping_comp()
4900 diag->fwping.result->dmastatus = BFA_STATUS_OK; in diag_fwping_comp()
4901 diag->fwping.status = BFA_STATUS_OK; in diag_fwping_comp()
4902 diag->fwping.cbfn(diag->fwping.cbarg, diag->fwping.status); in diag_fwping_comp()
4903 diag->fwping.lock = 0; in diag_fwping_comp()
4905 diag->fwping.status = BFA_STATUS_HDMA_FAILED; in diag_fwping_comp()
4906 diag->fwping.cbfn(diag->fwping.cbarg, diag->fwping.status); in diag_fwping_comp()
4907 diag->fwping.lock = 0; in diag_fwping_comp()
4920 msg = (struct bfi_diag_ts_req_s *)diag->tsensor.mbcmd.msg; in diag_tempsensor_send()
4921 bfa_trc(diag, msg->temp); in diag_tempsensor_send()
4923 bfi_h2i_set(msg->mh, BFI_MC_DIAG, BFI_DIAG_H2I_TEMPSENSOR, in diag_tempsensor_send()
4924 bfa_ioc_portid(diag->ioc)); in diag_tempsensor_send()
4926 bfa_ioc_mbox_queue(diag->ioc, &diag->tsensor.mbcmd); in diag_tempsensor_send()
4932 if (!diag->tsensor.lock) { in diag_tempsensor_comp()
4934 bfa_trc(diag, diag->tsensor.lock); in diag_tempsensor_comp()
4942 diag->tsensor.temp->temp = be16_to_cpu(rsp->temp); in diag_tempsensor_comp()
4943 diag->tsensor.temp->ts_junc = rsp->ts_junc; in diag_tempsensor_comp()
4944 diag->tsensor.temp->ts_brd = rsp->ts_brd; in diag_tempsensor_comp()
4946 if (rsp->ts_brd) { in diag_tempsensor_comp()
4947 /* tsensor.temp->status is brd_temp status */ in diag_tempsensor_comp()
4948 diag->tsensor.temp->status = rsp->status; in diag_tempsensor_comp()
4949 if (rsp->status == BFA_STATUS_OK) { in diag_tempsensor_comp()
4950 diag->tsensor.temp->brd_temp = in diag_tempsensor_comp()
4951 be16_to_cpu(rsp->brd_temp); in diag_tempsensor_comp()
4953 diag->tsensor.temp->brd_temp = 0; in diag_tempsensor_comp()
4956 bfa_trc(diag, rsp->status); in diag_tempsensor_comp()
4957 bfa_trc(diag, rsp->ts_junc); in diag_tempsensor_comp()
4958 bfa_trc(diag, rsp->temp); in diag_tempsensor_comp()
4959 bfa_trc(diag, rsp->ts_brd); in diag_tempsensor_comp()
4960 bfa_trc(diag, rsp->brd_temp); in diag_tempsensor_comp()
4963 diag->tsensor.status = BFA_STATUS_OK; in diag_tempsensor_comp()
4964 diag->tsensor.cbfn(diag->tsensor.cbarg, diag->tsensor.status); in diag_tempsensor_comp()
4965 diag->tsensor.lock = 0; in diag_tempsensor_comp()
4976 msg = (struct bfi_diag_ledtest_req_s *)diag->ledtest.mbcmd.msg; in diag_ledtest_send()
4978 bfi_h2i_set(msg->mh, BFI_MC_DIAG, BFI_DIAG_H2I_LEDTEST, in diag_ledtest_send()
4979 bfa_ioc_portid(diag->ioc)); in diag_ledtest_send()
4985 if (ledtest->freq) in diag_ledtest_send()
4986 ledtest->freq = 500 / ledtest->freq; in diag_ledtest_send()
4988 if (ledtest->freq == 0) in diag_ledtest_send()
4989 ledtest->freq = 1; in diag_ledtest_send()
4991 bfa_trc(diag, ledtest->freq); in diag_ledtest_send()
4992 /* mcpy(&ledtest_req->req, ledtest, sizeof(bfa_diag_ledtest_t)); */ in diag_ledtest_send()
4993 msg->cmd = (u8) ledtest->cmd; in diag_ledtest_send()
4994 msg->color = (u8) ledtest->color; in diag_ledtest_send()
4995 msg->portid = bfa_ioc_portid(diag->ioc); in diag_ledtest_send()
4996 msg->led = ledtest->led; in diag_ledtest_send()
4997 msg->freq = cpu_to_be16(ledtest->freq); in diag_ledtest_send()
5000 bfa_ioc_mbox_queue(diag->ioc, &diag->ledtest.mbcmd); in diag_ledtest_send()
5006 bfa_trc(diag, diag->ledtest.lock); in diag_ledtest_comp()
5007 diag->ledtest.lock = BFA_FALSE; in diag_ledtest_comp()
5019 msg = (struct bfi_diag_portbeacon_req_s *)diag->beacon.mbcmd.msg; in diag_portbeacon_send()
5021 bfi_h2i_set(msg->mh, BFI_MC_DIAG, BFI_DIAG_H2I_PORTBEACON, in diag_portbeacon_send()
5022 bfa_ioc_portid(diag->ioc)); in diag_portbeacon_send()
5023 msg->beacon = beacon; in diag_portbeacon_send()
5024 msg->period = cpu_to_be32(sec); in diag_portbeacon_send()
5026 bfa_ioc_mbox_queue(diag->ioc, &diag->beacon.mbcmd); in diag_portbeacon_send()
5032 bfa_trc(diag, diag->beacon.state); in diag_portbeacon_comp()
5033 diag->beacon.state = BFA_FALSE; in diag_portbeacon_comp()
5034 if (diag->cbfn_beacon) in diag_portbeacon_comp()
5035 diag->cbfn_beacon(diag->dev, BFA_FALSE, diag->beacon.link_e2e); in diag_portbeacon_comp()
5046 switch (msg->mh.msg_id) { in bfa_diag_intr()
5060 bfa_trc(diag, msg->mh.msg_id); in bfa_diag_intr()
5068 * @param[in] *diag - diag data struct
5069 * @param[in] *memtest - mem test params input from upper layer,
5070 * @param[in] pattern - mem test pattern
5071 * @param[in] *result - mem test result
5072 * @param[in] cbfn - mem test callback functioin
5073 * @param[in] cbarg - callback functioin arg
5086 if (!bfa_ioc_adapter_is_disabled(diag->ioc)) in bfa_diag_memtest()
5090 if (diag->block) { in bfa_diag_memtest()
5091 bfa_trc(diag, diag->block); in bfa_diag_memtest()
5094 diag->block = 1; in bfa_diag_memtest()
5096 diag->result = result; in bfa_diag_memtest()
5097 diag->cbfn = cbfn; in bfa_diag_memtest()
5098 diag->cbarg = cbarg; in bfa_diag_memtest()
5101 bfa_ioc_boot(diag->ioc, BFI_FWBOOT_TYPE_MEMTEST, BFI_FWBOOT_ENV_OS); in bfa_diag_memtest()
5103 memtest_tov = (bfa_ioc_asic_gen(diag->ioc) == BFI_ASIC_GEN_CT2) ? in bfa_diag_memtest()
5105 bfa_timer_begin(diag->ioc->timer_mod, &diag->timer, in bfa_diag_memtest()
5107 diag->timer_active = 1; in bfa_diag_memtest()
5114 * @param[in] *diag - diag data struct
5115 * @param[in] cnt - dma loop count for testing PCIE
5116 * @param[in] data - data pattern to pass in fw
5117 * @param[in] *result - pt to bfa_diag_fwping_result_t data struct
5118 * @param[in] cbfn - callback function
5119 * @param[in] *cbarg - callback functioin arg
5131 if (!bfa_ioc_is_operational(diag->ioc)) in bfa_diag_fwping()
5134 if (bfa_asic_id_ct2(bfa_ioc_devid((diag->ioc))) && in bfa_diag_fwping()
5135 ((diag->ioc)->clscode == BFI_PCIFN_CLASS_ETH)) in bfa_diag_fwping()
5139 if (diag->block || diag->fwping.lock) { in bfa_diag_fwping()
5140 bfa_trc(diag, diag->block); in bfa_diag_fwping()
5141 bfa_trc(diag, diag->fwping.lock); in bfa_diag_fwping()
5146 diag->fwping.lock = 1; in bfa_diag_fwping()
5147 diag->fwping.cbfn = cbfn; in bfa_diag_fwping()
5148 diag->fwping.cbarg = cbarg; in bfa_diag_fwping()
5149 diag->fwping.result = result; in bfa_diag_fwping()
5150 diag->fwping.data = data; in bfa_diag_fwping()
5151 diag->fwping.count = cnt; in bfa_diag_fwping()
5154 diag->fwping.result->data = 0; in bfa_diag_fwping()
5155 diag->fwping.result->status = BFA_STATUS_OK; in bfa_diag_fwping()
5165 * @param[in] *diag - diag data struct
5166 * @param[in] *result - pt to bfa_diag_temp_t data struct
5167 * @param[in] cbfn - callback function
5168 * @param[in] *cbarg - callback functioin arg
5178 if (diag->block || diag->tsensor.lock) { in bfa_diag_tsensor_query()
5179 bfa_trc(diag, diag->block); in bfa_diag_tsensor_query()
5180 bfa_trc(diag, diag->tsensor.lock); in bfa_diag_tsensor_query()
5184 if (!bfa_ioc_is_operational(diag->ioc)) in bfa_diag_tsensor_query()
5188 diag->tsensor.lock = 1; in bfa_diag_tsensor_query()
5189 diag->tsensor.temp = result; in bfa_diag_tsensor_query()
5190 diag->tsensor.cbfn = cbfn; in bfa_diag_tsensor_query()
5191 diag->tsensor.cbarg = cbarg; in bfa_diag_tsensor_query()
5192 diag->tsensor.status = BFA_STATUS_OK; in bfa_diag_tsensor_query()
5203 * @param[in] *diag - diag data struct
5204 * @param[in] *ledtest - pt to ledtest data structure
5211 bfa_trc(diag, ledtest->cmd); in bfa_diag_ledtest()
5213 if (!bfa_ioc_is_operational(diag->ioc)) in bfa_diag_ledtest()
5216 if (diag->beacon.state) in bfa_diag_ledtest()
5219 if (diag->ledtest.lock) in bfa_diag_ledtest()
5223 diag->ledtest.lock = BFA_TRUE; in bfa_diag_ledtest()
5232 * @param[in] *diag - diag data struct
5233 * @param[in] beacon - port beaconing 1:ON 0:OFF
5234 * @param[in] link_e2e_beacon - link beaconing 1:ON 0:OFF
5235 * @param[in] sec - beaconing duration in seconds
5247 if (!bfa_ioc_is_operational(diag->ioc)) in bfa_diag_beacon_port()
5250 if (diag->ledtest.lock) in bfa_diag_beacon_port()
5253 if (diag->beacon.state && beacon) /* beacon alread on */ in bfa_diag_beacon_port()
5256 diag->beacon.state = beacon; in bfa_diag_beacon_port()
5257 diag->beacon.link_e2e = link_e2e_beacon; in bfa_diag_beacon_port()
5258 if (diag->cbfn_beacon) in bfa_diag_beacon_port()
5259 diag->cbfn_beacon(diag->dev, beacon, link_e2e_beacon); in bfa_diag_beacon_port()
5283 diag->dev = dev; in bfa_diag_attach()
5284 diag->ioc = ioc; in bfa_diag_attach()
5285 diag->trcmod = trcmod; in bfa_diag_attach()
5287 diag->block = 0; in bfa_diag_attach()
5288 diag->cbfn = NULL; in bfa_diag_attach()
5289 diag->cbarg = NULL; in bfa_diag_attach()
5290 diag->result = NULL; in bfa_diag_attach()
5291 diag->cbfn_beacon = cbfn_beacon; in bfa_diag_attach()
5293 bfa_ioc_mbox_regisr(diag->ioc, BFI_MC_DIAG, bfa_diag_intr, diag); in bfa_diag_attach()
5294 bfa_q_qe_init(&diag->ioc_notify); in bfa_diag_attach()
5295 bfa_ioc_notify_init(&diag->ioc_notify, bfa_diag_notify, diag); in bfa_diag_attach()
5296 list_add_tail(&diag->ioc_notify.qe, &diag->ioc->notify_q); in bfa_diag_attach()
5302 diag->fwping.dbuf_kva = dm_kva; in bfa_diag_memclaim()
5303 diag->fwping.dbuf_pa = dm_pa; in bfa_diag_memclaim()
5304 memset(diag->fwping.dbuf_kva, 0, BFI_DIAG_DMA_BUF_SZ); in bfa_diag_memclaim()
5308 * PHY module specific
5311 #define BFA_PHY_LOCK_STATUS 0x018878 /* phy semaphore status reg */
5316 int i, m = sz >> 2; in bfa_phy_ntoh32() local
5318 for (i = 0; i < m; i++) in bfa_phy_ntoh32()
5323 bfa_phy_present(struct bfa_phy_s *phy) in bfa_phy_present() argument
5325 return (phy->ioc->attr->card_type == BFA_MFG_TYPE_LIGHTNING); in bfa_phy_present()
5331 struct bfa_phy_s *phy = cbarg; in bfa_phy_notify() local
5333 bfa_trc(phy, event); in bfa_phy_notify()
5338 if (phy->op_busy) { in bfa_phy_notify()
5339 phy->status = BFA_STATUS_IOC_FAILURE; in bfa_phy_notify()
5340 phy->cbfn(phy->cbarg, phy->status); in bfa_phy_notify()
5341 phy->op_busy = 0; in bfa_phy_notify()
5351 * Send phy attribute query request.
5353 * @param[in] cbarg - callback argument
5358 struct bfa_phy_s *phy = cbarg; in bfa_phy_query_send() local
5360 (struct bfi_phy_query_req_s *) phy->mb.msg; in bfa_phy_query_send()
5362 msg->instance = phy->instance; in bfa_phy_query_send()
5363 bfi_h2i_set(msg->mh, BFI_MC_PHY, BFI_PHY_H2I_QUERY_REQ, in bfa_phy_query_send()
5364 bfa_ioc_portid(phy->ioc)); in bfa_phy_query_send()
5365 bfa_alen_set(&msg->alen, sizeof(struct bfa_phy_attr_s), phy->dbuf_pa); in bfa_phy_query_send()
5366 bfa_ioc_mbox_queue(phy->ioc, &phy->mb); in bfa_phy_query_send()
5370 * Send phy write request.
5372 * @param[in] cbarg - callback argument
5377 struct bfa_phy_s *phy = cbarg; in bfa_phy_write_send() local
5379 (struct bfi_phy_write_req_s *) phy->mb.msg; in bfa_phy_write_send()
5384 msg->instance = phy->instance; in bfa_phy_write_send()
5385 msg->offset = cpu_to_be32(phy->addr_off + phy->offset); in bfa_phy_write_send()
5386 len = (phy->residue < BFA_PHY_DMA_BUF_SZ) ? in bfa_phy_write_send()
5387 phy->residue : BFA_PHY_DMA_BUF_SZ; in bfa_phy_write_send()
5388 msg->length = cpu_to_be32(len); in bfa_phy_write_send()
5391 msg->last = (len == phy->residue) ? 1 : 0; in bfa_phy_write_send()
5393 bfi_h2i_set(msg->mh, BFI_MC_PHY, BFI_PHY_H2I_WRITE_REQ, in bfa_phy_write_send()
5394 bfa_ioc_portid(phy->ioc)); in bfa_phy_write_send()
5395 bfa_alen_set(&msg->alen, len, phy->dbuf_pa); in bfa_phy_write_send()
5397 buf = (u16 *) (phy->ubuf + phy->offset); in bfa_phy_write_send()
5398 dbuf = (u16 *)phy->dbuf_kva; in bfa_phy_write_send()
5403 bfa_ioc_mbox_queue(phy->ioc, &phy->mb); in bfa_phy_write_send()
5405 phy->residue -= len; in bfa_phy_write_send()
5406 phy->offset += len; in bfa_phy_write_send()
5410 * Send phy read request.
5412 * @param[in] cbarg - callback argument
5417 struct bfa_phy_s *phy = cbarg; in bfa_phy_read_send() local
5419 (struct bfi_phy_read_req_s *) phy->mb.msg; in bfa_phy_read_send()
5422 msg->instance = phy->instance; in bfa_phy_read_send()
5423 msg->offset = cpu_to_be32(phy->addr_off + phy->offset); in bfa_phy_read_send()
5424 len = (phy->residue < BFA_PHY_DMA_BUF_SZ) ? in bfa_phy_read_send()
5425 phy->residue : BFA_PHY_DMA_BUF_SZ; in bfa_phy_read_send()
5426 msg->length = cpu_to_be32(len); in bfa_phy_read_send()
5427 bfi_h2i_set(msg->mh, BFI_MC_PHY, BFI_PHY_H2I_READ_REQ, in bfa_phy_read_send()
5428 bfa_ioc_portid(phy->ioc)); in bfa_phy_read_send()
5429 bfa_alen_set(&msg->alen, len, phy->dbuf_pa); in bfa_phy_read_send()
5430 bfa_ioc_mbox_queue(phy->ioc, &phy->mb); in bfa_phy_read_send()
5434 * Send phy stats request.
5436 * @param[in] cbarg - callback argument
5441 struct bfa_phy_s *phy = cbarg; in bfa_phy_stats_send() local
5443 (struct bfi_phy_stats_req_s *) phy->mb.msg; in bfa_phy_stats_send()
5445 msg->instance = phy->instance; in bfa_phy_stats_send()
5446 bfi_h2i_set(msg->mh, BFI_MC_PHY, BFI_PHY_H2I_STATS_REQ, in bfa_phy_stats_send()
5447 bfa_ioc_portid(phy->ioc)); in bfa_phy_stats_send()
5448 bfa_alen_set(&msg->alen, sizeof(struct bfa_phy_stats_s), phy->dbuf_pa); in bfa_phy_stats_send()
5449 bfa_ioc_mbox_queue(phy->ioc, &phy->mb); in bfa_phy_stats_send()
5455 * @param[in] mincfg - minimal cfg variable
5460 /* min driver doesn't need phy */ in bfa_phy_meminfo()
5470 * @param[in] phy - phy structure
5471 * @param[in] ioc - ioc structure
5472 * @param[in] dev - device structure
5473 * @param[in] trcmod - trace module
5474 * @param[in] logmod - log module
5477 bfa_phy_attach(struct bfa_phy_s *phy, struct bfa_ioc_s *ioc, void *dev, in bfa_phy_attach() argument
5480 phy->ioc = ioc; in bfa_phy_attach()
5481 phy->trcmod = trcmod; in bfa_phy_attach()
5482 phy->cbfn = NULL; in bfa_phy_attach()
5483 phy->cbarg = NULL; in bfa_phy_attach()
5484 phy->op_busy = 0; in bfa_phy_attach()
5486 bfa_ioc_mbox_regisr(phy->ioc, BFI_MC_PHY, bfa_phy_intr, phy); in bfa_phy_attach()
5487 bfa_q_qe_init(&phy->ioc_notify); in bfa_phy_attach()
5488 bfa_ioc_notify_init(&phy->ioc_notify, bfa_phy_notify, phy); in bfa_phy_attach()
5489 list_add_tail(&phy->ioc_notify.qe, &phy->ioc->notify_q); in bfa_phy_attach()
5491 /* min driver doesn't need phy */ in bfa_phy_attach()
5493 phy->dbuf_kva = NULL; in bfa_phy_attach()
5494 phy->dbuf_pa = 0; in bfa_phy_attach()
5499 * Claim memory for phy
5501 * @param[in] phy - phy structure
5502 * @param[in] dm_kva - pointer to virtual memory address
5503 * @param[in] dm_pa - physical memory address
5504 * @param[in] mincfg - minimal cfg variable
5507 bfa_phy_memclaim(struct bfa_phy_s *phy, u8 *dm_kva, u64 dm_pa, in bfa_phy_memclaim() argument
5513 phy->dbuf_kva = dm_kva; in bfa_phy_memclaim()
5514 phy->dbuf_pa = dm_pa; in bfa_phy_memclaim()
5515 memset(phy->dbuf_kva, 0, BFA_PHY_DMA_BUF_SZ); in bfa_phy_memclaim()
5530 * Get phy attribute.
5532 * @param[in] phy - phy structure
5533 * @param[in] attr - phy attribute structure
5534 * @param[in] cbfn - callback function
5535 * @param[in] cbarg - callback argument
5540 bfa_phy_get_attr(struct bfa_phy_s *phy, u8 instance, in bfa_phy_get_attr() argument
5543 bfa_trc(phy, BFI_PHY_H2I_QUERY_REQ); in bfa_phy_get_attr()
5544 bfa_trc(phy, instance); in bfa_phy_get_attr()
5546 if (!bfa_phy_present(phy)) in bfa_phy_get_attr()
5549 if (!bfa_ioc_is_operational(phy->ioc)) in bfa_phy_get_attr()
5552 if (phy->op_busy || bfa_phy_busy(phy->ioc)) { in bfa_phy_get_attr()
5553 bfa_trc(phy, phy->op_busy); in bfa_phy_get_attr()
5557 phy->op_busy = 1; in bfa_phy_get_attr()
5558 phy->cbfn = cbfn; in bfa_phy_get_attr()
5559 phy->cbarg = cbarg; in bfa_phy_get_attr()
5560 phy->instance = instance; in bfa_phy_get_attr()
5561 phy->ubuf = (uint8_t *) attr; in bfa_phy_get_attr()
5562 bfa_phy_query_send(phy); in bfa_phy_get_attr()
5568 * Get phy stats.
5570 * @param[in] phy - phy structure
5571 * @param[in] instance - phy image instance
5572 * @param[in] stats - pointer to phy stats
5573 * @param[in] cbfn - callback function
5574 * @param[in] cbarg - callback argument
5579 bfa_phy_get_stats(struct bfa_phy_s *phy, u8 instance, in bfa_phy_get_stats() argument
5583 bfa_trc(phy, BFI_PHY_H2I_STATS_REQ); in bfa_phy_get_stats()
5584 bfa_trc(phy, instance); in bfa_phy_get_stats()
5586 if (!bfa_phy_present(phy)) in bfa_phy_get_stats()
5589 if (!bfa_ioc_is_operational(phy->ioc)) in bfa_phy_get_stats()
5592 if (phy->op_busy || bfa_phy_busy(phy->ioc)) { in bfa_phy_get_stats()
5593 bfa_trc(phy, phy->op_busy); in bfa_phy_get_stats()
5597 phy->op_busy = 1; in bfa_phy_get_stats()
5598 phy->cbfn = cbfn; in bfa_phy_get_stats()
5599 phy->cbarg = cbarg; in bfa_phy_get_stats()
5600 phy->instance = instance; in bfa_phy_get_stats()
5601 phy->ubuf = (u8 *) stats; in bfa_phy_get_stats()
5602 bfa_phy_stats_send(phy); in bfa_phy_get_stats()
5608 * Update phy image.
5610 * @param[in] phy - phy structure
5611 * @param[in] instance - phy image instance
5612 * @param[in] buf - update data buffer
5613 * @param[in] len - data buffer length
5614 * @param[in] offset - offset relative to starting address
5615 * @param[in] cbfn - callback function
5616 * @param[in] cbarg - callback argument
5621 bfa_phy_update(struct bfa_phy_s *phy, u8 instance, in bfa_phy_update() argument
5625 bfa_trc(phy, BFI_PHY_H2I_WRITE_REQ); in bfa_phy_update()
5626 bfa_trc(phy, instance); in bfa_phy_update()
5627 bfa_trc(phy, len); in bfa_phy_update()
5628 bfa_trc(phy, offset); in bfa_phy_update()
5630 if (!bfa_phy_present(phy)) in bfa_phy_update()
5633 if (!bfa_ioc_is_operational(phy->ioc)) in bfa_phy_update()
5636 /* 'len' must be in word (4-byte) boundary */ in bfa_phy_update()
5640 if (phy->op_busy || bfa_phy_busy(phy->ioc)) { in bfa_phy_update()
5641 bfa_trc(phy, phy->op_busy); in bfa_phy_update()
5645 phy->op_busy = 1; in bfa_phy_update()
5646 phy->cbfn = cbfn; in bfa_phy_update()
5647 phy->cbarg = cbarg; in bfa_phy_update()
5648 phy->instance = instance; in bfa_phy_update()
5649 phy->residue = len; in bfa_phy_update()
5650 phy->offset = 0; in bfa_phy_update()
5651 phy->addr_off = offset; in bfa_phy_update()
5652 phy->ubuf = buf; in bfa_phy_update()
5654 bfa_phy_write_send(phy); in bfa_phy_update()
5659 * Read phy image.
5661 * @param[in] phy - phy structure
5662 * @param[in] instance - phy image instance
5663 * @param[in] buf - read data buffer
5664 * @param[in] len - data buffer length
5665 * @param[in] offset - offset relative to starting address
5666 * @param[in] cbfn - callback function
5667 * @param[in] cbarg - callback argument
5672 bfa_phy_read(struct bfa_phy_s *phy, u8 instance, in bfa_phy_read() argument
5676 bfa_trc(phy, BFI_PHY_H2I_READ_REQ); in bfa_phy_read()
5677 bfa_trc(phy, instance); in bfa_phy_read()
5678 bfa_trc(phy, len); in bfa_phy_read()
5679 bfa_trc(phy, offset); in bfa_phy_read()
5681 if (!bfa_phy_present(phy)) in bfa_phy_read()
5684 if (!bfa_ioc_is_operational(phy->ioc)) in bfa_phy_read()
5687 /* 'len' must be in word (4-byte) boundary */ in bfa_phy_read()
5691 if (phy->op_busy || bfa_phy_busy(phy->ioc)) { in bfa_phy_read()
5692 bfa_trc(phy, phy->op_busy); in bfa_phy_read()
5696 phy->op_busy = 1; in bfa_phy_read()
5697 phy->cbfn = cbfn; in bfa_phy_read()
5698 phy->cbarg = cbarg; in bfa_phy_read()
5699 phy->instance = instance; in bfa_phy_read()
5700 phy->residue = len; in bfa_phy_read()
5701 phy->offset = 0; in bfa_phy_read()
5702 phy->addr_off = offset; in bfa_phy_read()
5703 phy->ubuf = buf; in bfa_phy_read()
5704 bfa_phy_read_send(phy); in bfa_phy_read()
5710 * Process phy response messages upon receiving interrupts.
5712 * @param[in] phyarg - phy structure
5713 * @param[in] msg - message structure
5718 struct bfa_phy_s *phy = phyarg; in bfa_phy_intr() local
5727 } m; in bfa_phy_intr() local
5729 m.msg = msg; in bfa_phy_intr()
5730 bfa_trc(phy, msg->mh.msg_id); in bfa_phy_intr()
5732 if (!phy->op_busy) { in bfa_phy_intr()
5734 bfa_trc(phy, 0x9999); in bfa_phy_intr()
5738 switch (msg->mh.msg_id) { in bfa_phy_intr()
5740 status = be32_to_cpu(m.query->status); in bfa_phy_intr()
5741 bfa_trc(phy, status); in bfa_phy_intr()
5745 (struct bfa_phy_attr_s *) phy->ubuf; in bfa_phy_intr()
5746 bfa_phy_ntoh32((u32 *)attr, (u32 *)phy->dbuf_kva, in bfa_phy_intr()
5748 bfa_trc(phy, attr->status); in bfa_phy_intr()
5749 bfa_trc(phy, attr->length); in bfa_phy_intr()
5752 phy->status = status; in bfa_phy_intr()
5753 phy->op_busy = 0; in bfa_phy_intr()
5754 if (phy->cbfn) in bfa_phy_intr()
5755 phy->cbfn(phy->cbarg, phy->status); in bfa_phy_intr()
5758 status = be32_to_cpu(m.stats->status); in bfa_phy_intr()
5759 bfa_trc(phy, status); in bfa_phy_intr()
5763 (struct bfa_phy_stats_s *) phy->ubuf; in bfa_phy_intr()
5764 bfa_phy_ntoh32((u32 *)stats, (u32 *)phy->dbuf_kva, in bfa_phy_intr()
5766 bfa_trc(phy, stats->status); in bfa_phy_intr()
5769 phy->status = status; in bfa_phy_intr()
5770 phy->op_busy = 0; in bfa_phy_intr()
5771 if (phy->cbfn) in bfa_phy_intr()
5772 phy->cbfn(phy->cbarg, phy->status); in bfa_phy_intr()
5775 status = be32_to_cpu(m.write->status); in bfa_phy_intr()
5776 bfa_trc(phy, status); in bfa_phy_intr()
5778 if (status != BFA_STATUS_OK || phy->residue == 0) { in bfa_phy_intr()
5779 phy->status = status; in bfa_phy_intr()
5780 phy->op_busy = 0; in bfa_phy_intr()
5781 if (phy->cbfn) in bfa_phy_intr()
5782 phy->cbfn(phy->cbarg, phy->status); in bfa_phy_intr()
5784 bfa_trc(phy, phy->offset); in bfa_phy_intr()
5785 bfa_phy_write_send(phy); in bfa_phy_intr()
5789 status = be32_to_cpu(m.read->status); in bfa_phy_intr()
5790 bfa_trc(phy, status); in bfa_phy_intr()
5793 phy->status = status; in bfa_phy_intr()
5794 phy->op_busy = 0; in bfa_phy_intr()
5795 if (phy->cbfn) in bfa_phy_intr()
5796 phy->cbfn(phy->cbarg, phy->status); in bfa_phy_intr()
5798 u32 len = be32_to_cpu(m.read->length); in bfa_phy_intr()
5799 u16 *buf = (u16 *)(phy->ubuf + phy->offset); in bfa_phy_intr()
5800 u16 *dbuf = (u16 *)phy->dbuf_kva; in bfa_phy_intr()
5803 bfa_trc(phy, phy->offset); in bfa_phy_intr()
5804 bfa_trc(phy, len); in bfa_phy_intr()
5809 phy->residue -= len; in bfa_phy_intr()
5810 phy->offset += len; in bfa_phy_intr()
5812 if (phy->residue == 0) { in bfa_phy_intr()
5813 phy->status = status; in bfa_phy_intr()
5814 phy->op_busy = 0; in bfa_phy_intr()
5815 if (phy->cbfn) in bfa_phy_intr()
5816 phy->cbfn(phy->cbarg, phy->status); in bfa_phy_intr()
5818 bfa_phy_read_send(phy); in bfa_phy_intr()
5866 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_uninit()
5870 if (dconf->min_cfg) { in bfa_dconf_sm_uninit()
5871 bfa_trc(dconf->bfa, dconf->min_cfg); in bfa_dconf_sm_uninit()
5872 bfa_fsm_send_event(&dconf->bfa->iocfc, in bfa_dconf_sm_uninit()
5877 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_uninit()
5879 bfa_status = bfa_flash_read_part(BFA_FLASH(dconf->bfa), in bfa_dconf_sm_uninit()
5880 BFA_FLASH_PART_DRV, dconf->instance, in bfa_dconf_sm_uninit()
5881 dconf->dconf, in bfa_dconf_sm_uninit()
5883 bfa_dconf_init_cb, dconf->bfa); in bfa_dconf_sm_uninit()
5885 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_uninit()
5886 bfa_dconf_init_cb(dconf->bfa, BFA_STATUS_FAILED); in bfa_dconf_sm_uninit()
5892 bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE); in bfa_dconf_sm_uninit()
5898 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_uninit()
5909 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_flash_read()
5913 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_flash_read()
5918 bfa_ioc_suspend(&dconf->bfa->ioc); in bfa_dconf_sm_flash_read()
5921 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_flash_read()
5923 bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE); in bfa_dconf_sm_flash_read()
5926 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_flash_read()
5930 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_flash_read()
5940 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_ready()
5944 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_ready()
5950 bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE); in bfa_dconf_sm_ready()
5956 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_ready()
5967 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_dirty()
5975 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_dirty()
5976 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_dirty()
5980 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_dirty()
5981 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_dirty()
5989 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_dirty()
5993 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_dirty()
6004 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_final_sync()
6009 bfa_timer_stop(&dconf->timer); in bfa_dconf_sm_final_sync()
6012 bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE); in bfa_dconf_sm_final_sync()
6015 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_final_sync()
6022 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_sync()
6029 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_sync()
6034 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_sync()
6042 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_sync()
6050 bfa_trc(dconf->bfa, event); in bfa_dconf_sm_iocdown_dirty()
6054 bfa_timer_start(dconf->bfa, &dconf->timer, in bfa_dconf_sm_iocdown_dirty()
6060 bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE); in bfa_dconf_sm_iocdown_dirty()
6065 bfa_sm_fault(dconf->bfa, event); in bfa_dconf_sm_iocdown_dirty()
6078 if (cfg->drvcfg.min_cfg) in bfa_dconf_meminfo()
6091 dconf->bfad = bfad; in bfa_dconf_attach()
6092 dconf->bfa = bfa; in bfa_dconf_attach()
6093 dconf->instance = bfa->ioc.port_id; in bfa_dconf_attach()
6094 bfa_trc(bfa, dconf->instance); in bfa_dconf_attach()
6096 dconf->dconf = (struct bfa_dconf_s *) bfa_mem_kva_curp(dconf); in bfa_dconf_attach()
6097 if (cfg->drvcfg.min_cfg) { in bfa_dconf_attach()
6099 dconf->min_cfg = BFA_TRUE; in bfa_dconf_attach()
6101 dconf->min_cfg = BFA_FALSE; in bfa_dconf_attach()
6117 if (dconf->dconf->hdr.signature != BFI_DCONF_SIGNATURE) in bfa_dconf_init_cb()
6118 dconf->dconf->hdr.signature = BFI_DCONF_SIGNATURE; in bfa_dconf_init_cb()
6119 if (dconf->dconf->hdr.version != BFI_DCONF_VERSION) in bfa_dconf_init_cb()
6120 dconf->dconf->hdr.version = BFI_DCONF_VERSION; in bfa_dconf_init_cb()
6123 bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_DCONF_DONE); in bfa_dconf_init_cb()
6150 bfa_trc(dconf->bfa, 0); in bfa_dconf_flash_write()
6152 bfa_status = bfa_flash_update_part(BFA_FLASH(dconf->bfa), in bfa_dconf_flash_write()
6153 BFA_FLASH_PART_DRV, dconf->instance, in bfa_dconf_flash_write()
6154 dconf->dconf, sizeof(struct bfa_dconf_s), 0, in bfa_dconf_flash_write()
6158 bfa_trc(dconf->bfa, bfa_status); in bfa_dconf_flash_write()
6167 bfa_trc(dconf->bfa, 0); in bfa_dconf_update()
6171 if (dconf->min_cfg) { in bfa_dconf_update()
6172 bfa_trc(dconf->bfa, dconf->min_cfg); in bfa_dconf_update()
6213 if (fru->op_busy) { in bfa_fru_notify()
6214 fru->status = BFA_STATUS_IOC_FAILURE; in bfa_fru_notify()
6215 fru->cbfn(fru->cbarg, fru->status); in bfa_fru_notify()
6216 fru->op_busy = 0; in bfa_fru_notify()
6228 * @param[in] cbarg - callback argument
6235 (struct bfi_fru_write_req_s *) fru->mb.msg; in bfa_fru_write_send()
6238 msg->offset = cpu_to_be32(fru->addr_off + fru->offset); in bfa_fru_write_send()
6239 len = (fru->residue < BFA_FRU_DMA_BUF_SZ) ? in bfa_fru_write_send()
6240 fru->residue : BFA_FRU_DMA_BUF_SZ; in bfa_fru_write_send()
6241 msg->length = cpu_to_be32(len); in bfa_fru_write_send()
6246 msg->last = (len == fru->residue) ? 1 : 0; in bfa_fru_write_send()
6248 msg->trfr_cmpl = (len == fru->residue) ? fru->trfr_cmpl : 0; in bfa_fru_write_send()
6249 bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); in bfa_fru_write_send()
6250 bfa_alen_set(&msg->alen, len, fru->dbuf_pa); in bfa_fru_write_send()
6252 memcpy(fru->dbuf_kva, fru->ubuf + fru->offset, len); in bfa_fru_write_send()
6253 bfa_ioc_mbox_queue(fru->ioc, &fru->mb); in bfa_fru_write_send()
6255 fru->residue -= len; in bfa_fru_write_send()
6256 fru->offset += len; in bfa_fru_write_send()
6262 * @param[in] cbarg - callback argument
6269 (struct bfi_fru_read_req_s *) fru->mb.msg; in bfa_fru_read_send()
6272 msg->offset = cpu_to_be32(fru->addr_off + fru->offset); in bfa_fru_read_send()
6273 len = (fru->residue < BFA_FRU_DMA_BUF_SZ) ? in bfa_fru_read_send()
6274 fru->residue : BFA_FRU_DMA_BUF_SZ; in bfa_fru_read_send()
6275 msg->length = cpu_to_be32(len); in bfa_fru_read_send()
6276 bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); in bfa_fru_read_send()
6277 bfa_alen_set(&msg->alen, len, fru->dbuf_pa); in bfa_fru_read_send()
6278 bfa_ioc_mbox_queue(fru->ioc, &fru->mb); in bfa_fru_read_send()
6284 * @param[in] mincfg - minimal cfg variable
6299 * @param[in] fru - fru structure
6300 * @param[in] ioc - ioc structure
6301 * @param[in] dev - device structure
6302 * @param[in] trcmod - trace module
6303 * @param[in] logmod - log module
6309 fru->ioc = ioc; in bfa_fru_attach()
6310 fru->trcmod = trcmod; in bfa_fru_attach()
6311 fru->cbfn = NULL; in bfa_fru_attach()
6312 fru->cbarg = NULL; in bfa_fru_attach()
6313 fru->op_busy = 0; in bfa_fru_attach()
6315 bfa_ioc_mbox_regisr(fru->ioc, BFI_MC_FRU, bfa_fru_intr, fru); in bfa_fru_attach()
6316 bfa_q_qe_init(&fru->ioc_notify); in bfa_fru_attach()
6317 bfa_ioc_notify_init(&fru->ioc_notify, bfa_fru_notify, fru); in bfa_fru_attach()
6318 list_add_tail(&fru->ioc_notify.qe, &fru->ioc->notify_q); in bfa_fru_attach()
6322 fru->dbuf_kva = NULL; in bfa_fru_attach()
6323 fru->dbuf_pa = 0; in bfa_fru_attach()
6330 * @param[in] fru - fru structure
6331 * @param[in] dm_kva - pointer to virtual memory address
6332 * @param[in] dm_pa - frusical memory address
6333 * @param[in] mincfg - minimal cfg variable
6342 fru->dbuf_kva = dm_kva; in bfa_fru_memclaim()
6343 fru->dbuf_pa = dm_pa; in bfa_fru_memclaim()
6344 memset(fru->dbuf_kva, 0, BFA_FRU_DMA_BUF_SZ); in bfa_fru_memclaim()
6352 * @param[in] fru - fru structure
6353 * @param[in] buf - update data buffer
6354 * @param[in] len - data buffer length
6355 * @param[in] offset - offset relative to starting address
6356 * @param[in] cbfn - callback function
6357 * @param[in] cbarg - callback argument
6369 if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2 && in bfa_fruvpd_update()
6370 fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2) in bfa_fruvpd_update()
6373 if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) in bfa_fruvpd_update()
6376 if (!bfa_ioc_is_operational(fru->ioc)) in bfa_fruvpd_update()
6379 if (fru->op_busy) { in bfa_fruvpd_update()
6380 bfa_trc(fru, fru->op_busy); in bfa_fruvpd_update()
6384 fru->op_busy = 1; in bfa_fruvpd_update()
6386 fru->cbfn = cbfn; in bfa_fruvpd_update()
6387 fru->cbarg = cbarg; in bfa_fruvpd_update()
6388 fru->residue = len; in bfa_fruvpd_update()
6389 fru->offset = 0; in bfa_fruvpd_update()
6390 fru->addr_off = offset; in bfa_fruvpd_update()
6391 fru->ubuf = buf; in bfa_fruvpd_update()
6392 fru->trfr_cmpl = trfr_cmpl; in bfa_fruvpd_update()
6402 * @param[in] fru - fru structure
6403 * @param[in] buf - read data buffer
6404 * @param[in] len - data buffer length
6405 * @param[in] offset - offset relative to starting address
6406 * @param[in] cbfn - callback function
6407 * @param[in] cbarg - callback argument
6419 if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) in bfa_fruvpd_read()
6422 if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK && in bfa_fruvpd_read()
6423 fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2) in bfa_fruvpd_read()
6426 if (!bfa_ioc_is_operational(fru->ioc)) in bfa_fruvpd_read()
6429 if (fru->op_busy) { in bfa_fruvpd_read()
6430 bfa_trc(fru, fru->op_busy); in bfa_fruvpd_read()
6434 fru->op_busy = 1; in bfa_fruvpd_read()
6436 fru->cbfn = cbfn; in bfa_fruvpd_read()
6437 fru->cbarg = cbarg; in bfa_fruvpd_read()
6438 fru->residue = len; in bfa_fruvpd_read()
6439 fru->offset = 0; in bfa_fruvpd_read()
6440 fru->addr_off = offset; in bfa_fruvpd_read()
6441 fru->ubuf = buf; in bfa_fruvpd_read()
6450 * @param[in] fru - fru structure
6451 * @param[out] size - maximum size of fru vpd data
6458 if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) in bfa_fruvpd_get_max_size()
6461 if (!bfa_ioc_is_operational(fru->ioc)) in bfa_fruvpd_get_max_size()
6464 if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK || in bfa_fruvpd_get_max_size()
6465 fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK2) in bfa_fruvpd_get_max_size()
6474 * @param[in] fru - fru structure
6475 * @param[in] buf - update data buffer
6476 * @param[in] len - data buffer length
6477 * @param[in] offset - offset relative to starting address
6478 * @param[in] cbfn - callback function
6479 * @param[in] cbarg - callback argument
6492 if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) in bfa_tfru_write()
6495 if (!bfa_ioc_is_operational(fru->ioc)) in bfa_tfru_write()
6498 if (fru->op_busy) { in bfa_tfru_write()
6499 bfa_trc(fru, fru->op_busy); in bfa_tfru_write()
6503 fru->op_busy = 1; in bfa_tfru_write()
6505 fru->cbfn = cbfn; in bfa_tfru_write()
6506 fru->cbarg = cbarg; in bfa_tfru_write()
6507 fru->residue = len; in bfa_tfru_write()
6508 fru->offset = 0; in bfa_tfru_write()
6509 fru->addr_off = offset; in bfa_tfru_write()
6510 fru->ubuf = buf; in bfa_tfru_write()
6520 * @param[in] fru - fru structure
6521 * @param[in] buf - read data buffer
6522 * @param[in] len - data buffer length
6523 * @param[in] offset - offset relative to starting address
6524 * @param[in] cbfn - callback function
6525 * @param[in] cbarg - callback argument
6537 if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) in bfa_tfru_read()
6540 if (!bfa_ioc_is_operational(fru->ioc)) in bfa_tfru_read()
6543 if (fru->op_busy) { in bfa_tfru_read()
6544 bfa_trc(fru, fru->op_busy); in bfa_tfru_read()
6548 fru->op_busy = 1; in bfa_tfru_read()
6550 fru->cbfn = cbfn; in bfa_tfru_read()
6551 fru->cbarg = cbarg; in bfa_tfru_read()
6552 fru->residue = len; in bfa_tfru_read()
6553 fru->offset = 0; in bfa_tfru_read()
6554 fru->addr_off = offset; in bfa_tfru_read()
6555 fru->ubuf = buf; in bfa_tfru_read()
6564 * @param[in] fruarg - fru structure
6565 * @param[in] msg - message structure
6574 bfa_trc(fru, msg->mh.msg_id); in bfa_fru_intr()
6576 if (!fru->op_busy) { in bfa_fru_intr()
6584 switch (msg->mh.msg_id) { in bfa_fru_intr()
6587 status = be32_to_cpu(rsp->status); in bfa_fru_intr()
6590 if (status != BFA_STATUS_OK || fru->residue == 0) { in bfa_fru_intr()
6591 fru->status = status; in bfa_fru_intr()
6592 fru->op_busy = 0; in bfa_fru_intr()
6593 if (fru->cbfn) in bfa_fru_intr()
6594 fru->cbfn(fru->cbarg, fru->status); in bfa_fru_intr()
6596 bfa_trc(fru, fru->offset); in bfa_fru_intr()
6597 if (msg->mh.msg_id == BFI_FRUVPD_I2H_WRITE_RSP) in bfa_fru_intr()
6607 status = be32_to_cpu(rsp->status); in bfa_fru_intr()
6611 fru->status = status; in bfa_fru_intr()
6612 fru->op_busy = 0; in bfa_fru_intr()
6613 if (fru->cbfn) in bfa_fru_intr()
6614 fru->cbfn(fru->cbarg, fru->status); in bfa_fru_intr()
6616 u32 len = be32_to_cpu(rsp->length); in bfa_fru_intr()
6618 bfa_trc(fru, fru->offset); in bfa_fru_intr()
6621 memcpy(fru->ubuf + fru->offset, fru->dbuf_kva, len); in bfa_fru_intr()
6622 fru->residue -= len; in bfa_fru_intr()
6623 fru->offset += len; in bfa_fru_intr()
6625 if (fru->residue == 0) { in bfa_fru_intr()
6626 fru->status = status; in bfa_fru_intr()
6627 fru->op_busy = 0; in bfa_fru_intr()
6628 if (fru->cbfn) in bfa_fru_intr()
6629 fru->cbfn(fru->cbarg, fru->status); in bfa_fru_intr()
6631 if (msg->mh.msg_id == BFI_FRUVPD_I2H_READ_RSP) in bfa_fru_intr()
6667 BFA_FLASH_NOT_PRESENT = -1, /*!< flash not present */
6668 BFA_FLASH_UNINIT = -2, /*!< flash not initialized */
6669 BFA_FLASH_BAD = -3, /*!< flash bad */
6670 BFA_FLASH_BUSY = -4, /*!< flash busy */
6671 BFA_FLASH_ERR_CMD_ACT = -5, /*!< command active never cleared */
6672 BFA_FLASH_ERR_FIFO_CNT = -6, /*!< fifo count never cleared */
6673 BFA_FLASH_ERR_WIP = -7, /*!< write-in-progress never cleared */
6674 BFA_FLASH_ERR_TIMEOUT = -8, /*!< fli timeout */
6675 BFA_FLASH_ERR_LEN = -9, /*!< invalid length */
6789 * @param[in] pci_bar - pci bar address
6790 * @param[in] dev_status - device status
6829 * @param[in] pci_bar - pci bar address
6874 * @param[in] pci_bar - pci bar address
6875 * @param[in] offset - flash address offset
6876 * @param[in] len - read data length
6877 * @param[in] buf - read data buffer
6904 * check if write-in-progress bit is cleared in bfa_flash_read_start()
6920 * @param[in] pci_bar - pci bar address
6936 * @param[in] pci_bar - pci bar address
6937 * @param[in] len - read data length
6938 * @param[in] buf - read data buffer
6962 * @param[in] pci_bar - pci bar address
6963 * @param[in] offset - flash partition address offset
6964 * @param[in] buf - read data buffer
6965 * @param[in] len - read data length
6990 if (--n <= 0) in bfa_flash_sem_get()
7021 l = (n + 1) * fifo_sz - s; in bfa_flash_raw_read()
7034 if (--n <= 0) { in bfa_flash_raw_read()
7042 residue -= l; in bfa_flash_raw_read()