• Home
  • Raw
  • Download

Lines Matching refs:ioc

50 static void bfa_ioc_hw_sem_init(struct bfa_ioc *ioc);
51 static void bfa_ioc_hw_sem_get(struct bfa_ioc *ioc);
52 static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc *ioc);
53 static void bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force);
54 static void bfa_ioc_poll_fwinit(struct bfa_ioc *ioc);
55 static void bfa_ioc_send_enable(struct bfa_ioc *ioc);
56 static void bfa_ioc_send_disable(struct bfa_ioc *ioc);
57 static void bfa_ioc_send_getattr(struct bfa_ioc *ioc);
58 static void bfa_ioc_hb_monitor(struct bfa_ioc *ioc);
59 static void bfa_ioc_hb_stop(struct bfa_ioc *ioc);
60 static void bfa_ioc_reset(struct bfa_ioc *ioc, bool force);
61 static void bfa_ioc_mbox_poll(struct bfa_ioc *ioc);
62 static void bfa_ioc_mbox_flush(struct bfa_ioc *ioc);
63 static void bfa_ioc_recover(struct bfa_ioc *ioc);
65 static void bfa_ioc_disable_comp(struct bfa_ioc *ioc);
66 static void bfa_ioc_lpu_stop(struct bfa_ioc *ioc);
67 static void bfa_nw_ioc_debug_save_ftrc(struct bfa_ioc *ioc);
68 static void bfa_ioc_fail_notify(struct bfa_ioc *ioc);
69 static void bfa_ioc_pf_enabled(struct bfa_ioc *ioc);
70 static void bfa_ioc_pf_disabled(struct bfa_ioc *ioc);
71 static void bfa_ioc_pf_failed(struct bfa_ioc *ioc);
72 static void bfa_ioc_pf_hwfailed(struct bfa_ioc *ioc);
73 static void bfa_ioc_pf_fwmismatch(struct bfa_ioc *ioc);
74 static enum bfa_status bfa_ioc_boot(struct bfa_ioc *ioc,
76 static u32 bfa_ioc_smem_pgnum(struct bfa_ioc *ioc, u32 fmaddr);
77 static void bfa_ioc_get_adapter_serial_num(struct bfa_ioc *ioc,
79 static void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc *ioc,
81 static void bfa_ioc_get_pci_chip_rev(struct bfa_ioc *ioc,
83 static void bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc *ioc,
85 static void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc *ioc,
87 static void bfa_ioc_get_adapter_model(struct bfa_ioc *ioc, char *model);
88 static u64 bfa_ioc_get_pwwn(struct bfa_ioc *ioc);
133 static void bfa_iocpf_enable(struct bfa_ioc *ioc);
134 static void bfa_iocpf_disable(struct bfa_ioc *ioc);
135 static void bfa_iocpf_fail(struct bfa_ioc *ioc);
136 static void bfa_iocpf_initfail(struct bfa_ioc *ioc);
137 static void bfa_iocpf_getattrfail(struct bfa_ioc *ioc);
138 static void bfa_iocpf_stop(struct bfa_ioc *ioc);
207 bfa_ioc_sm_uninit_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_uninit_entry() argument
213 bfa_ioc_sm_uninit(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_uninit() argument
217 bfa_fsm_set_state(ioc, bfa_ioc_sm_reset); in bfa_ioc_sm_uninit()
227 bfa_ioc_sm_reset_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_reset_entry() argument
229 bfa_fsm_set_state(&ioc->iocpf, bfa_iocpf_sm_reset); in bfa_ioc_sm_reset_entry()
234 bfa_ioc_sm_reset(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_reset() argument
238 bfa_fsm_set_state(ioc, bfa_ioc_sm_enabling); in bfa_ioc_sm_reset()
242 bfa_ioc_disable_comp(ioc); in bfa_ioc_sm_reset()
246 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_ioc_sm_reset()
255 bfa_ioc_sm_enabling_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_enabling_entry() argument
257 bfa_iocpf_enable(ioc); in bfa_ioc_sm_enabling_entry()
264 bfa_ioc_sm_enabling(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_enabling() argument
268 bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); in bfa_ioc_sm_enabling()
274 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_enabling()
275 bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); in bfa_ioc_sm_enabling()
277 bfa_iocpf_initfail(ioc); in bfa_ioc_sm_enabling()
281 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_enabling()
282 bfa_fsm_set_state(ioc, bfa_ioc_sm_hwfail); in bfa_ioc_sm_enabling()
286 bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); in bfa_ioc_sm_enabling()
290 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_ioc_sm_enabling()
291 bfa_iocpf_stop(ioc); in bfa_ioc_sm_enabling()
304 bfa_ioc_sm_getattr_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_getattr_entry() argument
306 mod_timer(&ioc->ioc_timer, jiffies + in bfa_ioc_sm_getattr_entry()
308 bfa_ioc_send_getattr(ioc); in bfa_ioc_sm_getattr_entry()
313 bfa_ioc_sm_getattr(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_getattr() argument
317 del_timer(&ioc->ioc_timer); in bfa_ioc_sm_getattr()
318 bfa_fsm_set_state(ioc, bfa_ioc_sm_op); in bfa_ioc_sm_getattr()
323 del_timer(&ioc->ioc_timer); in bfa_ioc_sm_getattr()
326 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_getattr()
327 bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); in bfa_ioc_sm_getattr()
329 bfa_iocpf_getattrfail(ioc); in bfa_ioc_sm_getattr()
333 del_timer(&ioc->ioc_timer); in bfa_ioc_sm_getattr()
334 bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); in bfa_ioc_sm_getattr()
346 bfa_ioc_sm_op_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_op_entry() argument
348 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); in bfa_ioc_sm_op_entry()
349 bfa_ioc_event_notify(ioc, BFA_IOC_E_ENABLED); in bfa_ioc_sm_op_entry()
350 bfa_ioc_hb_monitor(ioc); in bfa_ioc_sm_op_entry()
354 bfa_ioc_sm_op(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_op() argument
361 bfa_ioc_hb_stop(ioc); in bfa_ioc_sm_op()
362 bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); in bfa_ioc_sm_op()
367 bfa_ioc_hb_stop(ioc); in bfa_ioc_sm_op()
371 if (ioc->iocpf.auto_recover) in bfa_ioc_sm_op()
372 bfa_fsm_set_state(ioc, bfa_ioc_sm_fail_retry); in bfa_ioc_sm_op()
374 bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); in bfa_ioc_sm_op()
376 bfa_ioc_fail_notify(ioc); in bfa_ioc_sm_op()
379 bfa_iocpf_fail(ioc); in bfa_ioc_sm_op()
388 bfa_ioc_sm_disabling_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_disabling_entry() argument
390 bfa_iocpf_disable(ioc); in bfa_ioc_sm_disabling_entry()
395 bfa_ioc_sm_disabling(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_disabling() argument
399 bfa_fsm_set_state(ioc, bfa_ioc_sm_disabled); in bfa_ioc_sm_disabling()
408 bfa_iocpf_fail(ioc); in bfa_ioc_sm_disabling()
412 bfa_fsm_set_state(ioc, bfa_ioc_sm_hwfail); in bfa_ioc_sm_disabling()
413 bfa_ioc_disable_comp(ioc); in bfa_ioc_sm_disabling()
423 bfa_ioc_sm_disabled_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_disabled_entry() argument
425 bfa_ioc_disable_comp(ioc); in bfa_ioc_sm_disabled_entry()
429 bfa_ioc_sm_disabled(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_disabled() argument
433 bfa_fsm_set_state(ioc, bfa_ioc_sm_enabling); in bfa_ioc_sm_disabled()
437 ioc->cbfn->disable_cbfn(ioc->bfa); in bfa_ioc_sm_disabled()
441 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_ioc_sm_disabled()
442 bfa_iocpf_stop(ioc); in bfa_ioc_sm_disabled()
451 bfa_ioc_sm_fail_retry_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_fail_retry_entry() argument
457 bfa_ioc_sm_fail_retry(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_fail_retry() argument
461 bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); in bfa_ioc_sm_fail_retry()
469 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_fail_retry()
470 bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); in bfa_ioc_sm_fail_retry()
472 bfa_iocpf_initfail(ioc); in bfa_ioc_sm_fail_retry()
476 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_fail_retry()
477 bfa_fsm_set_state(ioc, bfa_ioc_sm_hwfail); in bfa_ioc_sm_fail_retry()
484 bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); in bfa_ioc_sm_fail_retry()
488 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_ioc_sm_fail_retry()
489 bfa_iocpf_stop(ioc); in bfa_ioc_sm_fail_retry()
498 bfa_ioc_sm_fail_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_fail_entry() argument
504 bfa_ioc_sm_fail(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_fail() argument
508 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_fail()
512 bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); in bfa_ioc_sm_fail()
516 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_ioc_sm_fail()
517 bfa_iocpf_stop(ioc); in bfa_ioc_sm_fail()
530 bfa_ioc_sm_hwfail_entry(struct bfa_ioc *ioc) in bfa_ioc_sm_hwfail_entry() argument
536 bfa_ioc_sm_hwfail(struct bfa_ioc *ioc, enum ioc_event event) in bfa_ioc_sm_hwfail() argument
541 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_sm_hwfail()
545 ioc->cbfn->disable_cbfn(ioc->bfa); in bfa_ioc_sm_hwfail()
549 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_ioc_sm_hwfail()
588 bfa_ioc_hw_sem_init(iocpf->ioc); in bfa_iocpf_sm_fwcheck_entry()
589 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_fwcheck_entry()
596 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_fwcheck() local
600 if (bfa_ioc_firmware_lock(ioc)) { in bfa_iocpf_sm_fwcheck()
601 if (bfa_ioc_sync_start(ioc)) { in bfa_iocpf_sm_fwcheck()
602 bfa_ioc_sync_join(ioc); in bfa_iocpf_sm_fwcheck()
605 bfa_ioc_firmware_unlock(ioc); in bfa_iocpf_sm_fwcheck()
606 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_fwcheck()
607 mod_timer(&ioc->sem_timer, jiffies + in bfa_iocpf_sm_fwcheck()
611 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_fwcheck()
618 bfa_ioc_pf_hwfailed(ioc); in bfa_iocpf_sm_fwcheck()
622 bfa_ioc_hw_sem_get_cancel(ioc); in bfa_iocpf_sm_fwcheck()
624 bfa_ioc_pf_disabled(ioc); in bfa_iocpf_sm_fwcheck()
628 bfa_ioc_hw_sem_get_cancel(ioc); in bfa_iocpf_sm_fwcheck()
643 bfa_ioc_pf_fwmismatch(iocpf->ioc); in bfa_iocpf_sm_mismatch_entry()
646 mod_timer(&(iocpf->ioc)->iocpf_timer, jiffies + in bfa_iocpf_sm_mismatch_entry()
654 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_mismatch() local
662 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_mismatch()
664 bfa_ioc_pf_disabled(ioc); in bfa_iocpf_sm_mismatch()
668 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_mismatch()
681 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_semwait_entry()
688 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_semwait() local
692 if (bfa_ioc_sync_complete(ioc)) { in bfa_iocpf_sm_semwait()
693 bfa_ioc_sync_join(ioc); in bfa_iocpf_sm_semwait()
696 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_semwait()
697 mod_timer(&ioc->sem_timer, jiffies + in bfa_iocpf_sm_semwait()
704 bfa_ioc_pf_hwfailed(ioc); in bfa_iocpf_sm_semwait()
708 bfa_ioc_hw_sem_get_cancel(ioc); in bfa_iocpf_sm_semwait()
721 bfa_ioc_reset(iocpf->ioc, false); in bfa_iocpf_sm_hwinit_entry()
730 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_hwinit() local
738 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_hwinit()
739 bfa_ioc_pf_failed(ioc); in bfa_iocpf_sm_hwinit()
744 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_hwinit()
745 bfa_ioc_sync_leave(ioc); in bfa_iocpf_sm_hwinit()
746 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_hwinit()
758 mod_timer(&(iocpf->ioc)->iocpf_timer, jiffies + in bfa_iocpf_sm_enabling_entry()
763 iocpf->ioc->cbfn->reset_cbfn(iocpf->ioc->bfa); in bfa_iocpf_sm_enabling_entry()
764 bfa_ioc_send_enable(iocpf->ioc); in bfa_iocpf_sm_enabling_entry()
773 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_enabling() local
777 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_enabling()
778 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_enabling()
783 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_enabling()
787 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_enabling()
789 bfa_ioc_pf_failed(ioc); in bfa_iocpf_sm_enabling()
794 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_enabling()
795 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_enabling()
807 bfa_ioc_pf_enabled(iocpf->ioc); in bfa_iocpf_sm_ready_entry()
834 mod_timer(&(iocpf->ioc)->iocpf_timer, jiffies + in bfa_iocpf_sm_disabling_entry()
836 bfa_ioc_send_disable(iocpf->ioc); in bfa_iocpf_sm_disabling_entry()
843 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_disabling() local
847 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_disabling()
852 del_timer(&ioc->iocpf_timer); in bfa_iocpf_sm_disabling()
856 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); in bfa_iocpf_sm_disabling()
871 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_disabling_sync_entry()
878 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_disabling_sync() local
882 bfa_ioc_sync_leave(ioc); in bfa_iocpf_sm_disabling_sync()
883 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_disabling_sync()
889 bfa_ioc_pf_hwfailed(ioc); in bfa_iocpf_sm_disabling_sync()
904 bfa_ioc_mbox_flush(iocpf->ioc); in bfa_iocpf_sm_disabled_entry()
905 bfa_ioc_pf_disabled(iocpf->ioc); in bfa_iocpf_sm_disabled_entry()
911 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_disabled() local
919 bfa_ioc_firmware_unlock(ioc); in bfa_iocpf_sm_disabled()
931 bfa_nw_ioc_debug_save_ftrc(iocpf->ioc); in bfa_iocpf_sm_initfail_sync_entry()
932 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_initfail_sync_entry()
939 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_initfail_sync() local
943 bfa_ioc_notify_fail(ioc); in bfa_iocpf_sm_initfail_sync()
944 bfa_ioc_sync_leave(ioc); in bfa_iocpf_sm_initfail_sync()
945 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); in bfa_iocpf_sm_initfail_sync()
946 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_initfail_sync()
952 bfa_ioc_pf_hwfailed(ioc); in bfa_iocpf_sm_initfail_sync()
956 bfa_ioc_hw_sem_get_cancel(ioc); in bfa_iocpf_sm_initfail_sync()
961 bfa_ioc_hw_sem_get_cancel(ioc); in bfa_iocpf_sm_initfail_sync()
962 bfa_ioc_firmware_unlock(ioc); in bfa_iocpf_sm_initfail_sync()
983 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_initfail() local
991 bfa_ioc_firmware_unlock(ioc); in bfa_iocpf_sm_initfail()
1006 bfa_ioc_lpu_stop(iocpf->ioc); in bfa_iocpf_sm_fail_sync_entry()
1011 bfa_ioc_mbox_flush(iocpf->ioc); in bfa_iocpf_sm_fail_sync_entry()
1012 bfa_ioc_hw_sem_get(iocpf->ioc); in bfa_iocpf_sm_fail_sync_entry()
1019 struct bfa_ioc *ioc = iocpf->ioc; in bfa_iocpf_sm_fail_sync() local
1023 bfa_ioc_sync_ack(ioc); in bfa_iocpf_sm_fail_sync()
1024 bfa_ioc_notify_fail(ioc); in bfa_iocpf_sm_fail_sync()
1026 bfa_ioc_sync_leave(ioc); in bfa_iocpf_sm_fail_sync()
1027 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); in bfa_iocpf_sm_fail_sync()
1028 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_fail_sync()
1031 if (bfa_ioc_sync_complete(ioc)) in bfa_iocpf_sm_fail_sync()
1034 bfa_nw_ioc_hw_sem_release(ioc); in bfa_iocpf_sm_fail_sync()
1042 bfa_ioc_pf_hwfailed(ioc); in bfa_iocpf_sm_fail_sync()
1046 bfa_ioc_hw_sem_get_cancel(ioc); in bfa_iocpf_sm_fail_sync()
1081 bfa_ioc_event_notify(struct bfa_ioc *ioc, enum bfa_ioc_event event) in bfa_ioc_event_notify() argument
1085 list_for_each_entry(notify, &ioc->notify_q, qe) in bfa_ioc_event_notify()
1090 bfa_ioc_disable_comp(struct bfa_ioc *ioc) in bfa_ioc_disable_comp() argument
1092 ioc->cbfn->disable_cbfn(ioc->bfa); in bfa_ioc_disable_comp()
1093 bfa_ioc_event_notify(ioc, BFA_IOC_E_DISABLED); in bfa_ioc_disable_comp()
1126 bfa_ioc_fwver_clear(struct bfa_ioc *ioc) in bfa_ioc_fwver_clear() argument
1131 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); in bfa_ioc_fwver_clear()
1132 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_fwver_clear()
1135 writel(0, ioc->ioc_regs.smem_page_start + loff); in bfa_ioc_fwver_clear()
1142 bfa_ioc_hw_sem_init(struct bfa_ioc *ioc) in bfa_ioc_hw_sem_init() argument
1148 r32 = readl(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_hw_sem_init()
1151 r32 = readl(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_hw_sem_init()
1154 fwstate = bfa_ioc_get_cur_ioc_fwstate(ioc); in bfa_ioc_hw_sem_init()
1156 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_hw_sem_init()
1160 bfa_nw_ioc_fwver_get(ioc, &fwhdr); in bfa_ioc_hw_sem_init()
1163 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_hw_sem_init()
1167 bfa_ioc_fwver_clear(ioc); in bfa_ioc_hw_sem_init()
1168 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_UNINIT); in bfa_ioc_hw_sem_init()
1169 bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_UNINIT); in bfa_ioc_hw_sem_init()
1174 readl(ioc->ioc_regs.ioc_sem_reg); in bfa_ioc_hw_sem_init()
1175 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_ioc_hw_sem_init()
1178 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_hw_sem_init()
1182 bfa_ioc_hw_sem_get(struct bfa_ioc *ioc) in bfa_ioc_hw_sem_get() argument
1190 r32 = readl(ioc->ioc_regs.ioc_sem_reg); in bfa_ioc_hw_sem_get()
1192 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_SEM_ERROR); in bfa_ioc_hw_sem_get()
1196 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_SEMLOCKED); in bfa_ioc_hw_sem_get()
1200 mod_timer(&ioc->sem_timer, jiffies + in bfa_ioc_hw_sem_get()
1205 bfa_nw_ioc_hw_sem_release(struct bfa_ioc *ioc) in bfa_nw_ioc_hw_sem_release() argument
1207 writel(1, ioc->ioc_regs.ioc_sem_reg); in bfa_nw_ioc_hw_sem_release()
1211 bfa_ioc_hw_sem_get_cancel(struct bfa_ioc *ioc) in bfa_ioc_hw_sem_get_cancel() argument
1213 del_timer(&ioc->sem_timer); in bfa_ioc_hw_sem_get_cancel()
1218 bfa_ioc_lmem_init(struct bfa_ioc *ioc) in bfa_ioc_lmem_init() argument
1224 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1232 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1239 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1250 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lmem_init()
1254 bfa_ioc_lpu_start(struct bfa_ioc *ioc) in bfa_ioc_lpu_start() argument
1261 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_start()
1264 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_start()
1268 bfa_ioc_lpu_stop(struct bfa_ioc *ioc) in bfa_ioc_lpu_stop() argument
1275 pss_ctl = readl(ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_stop()
1278 writel(pss_ctl, ioc->ioc_regs.pss_ctl_reg); in bfa_ioc_lpu_stop()
1283 bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr) in bfa_nw_ioc_fwver_get() argument
1290 pgnum = bfa_ioc_smem_pgnum(ioc, loff); in bfa_nw_ioc_fwver_get()
1291 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_nw_ioc_fwver_get()
1296 swab32(readl(loff + ioc->ioc_regs.smem_page_start)); in bfa_nw_ioc_fwver_get()
1740 bfa_nw_ioc_flash_img_get_chnk(struct bfa_ioc *ioc, u32 off, in bfa_nw_ioc_flash_img_get_chnk() argument
1743 return bfa_flash_raw_read(ioc->pcidev.pci_bar_kva, in bfa_nw_ioc_flash_img_get_chnk()
1749 bfa_ioc_flash_fwver_cmp(struct bfa_ioc *ioc, in bfa_ioc_flash_fwver_cmp() argument
1756 status = bfa_nw_ioc_flash_img_get_chnk(ioc, 0, fwimg); in bfa_ioc_flash_fwver_cmp()
1771 bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr) in bfa_nw_ioc_fwver_cmp() argument
1777 bfa_cb_image_get_chunk(bfa_ioc_asic_gen(ioc), 0); in bfa_nw_ioc_fwver_cmp()
1790 smem_flash_cmp = bfa_ioc_flash_fwver_cmp(ioc, fwhdr); in bfa_nw_ioc_fwver_cmp()
1805 bfa_ioc_fwver_valid(struct bfa_ioc *ioc, u32 boot_env) in bfa_ioc_fwver_valid() argument
1809 bfa_nw_ioc_fwver_get(ioc, &fwhdr); in bfa_ioc_fwver_valid()
1813 return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr); in bfa_ioc_fwver_valid()
1818 bfa_ioc_msgflush(struct bfa_ioc *ioc) in bfa_ioc_msgflush() argument
1822 r32 = readl(ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgflush()
1824 writel(1, ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgflush()
1828 bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) in bfa_ioc_hwinit() argument
1834 ioc_fwstate = bfa_ioc_get_cur_ioc_fwstate(ioc); in bfa_ioc_hwinit()
1845 false : bfa_ioc_fwver_valid(ioc, boot_env); in bfa_ioc_hwinit()
1848 if (bfa_ioc_boot(ioc, BFI_FWBOOT_TYPE_NORMAL, boot_env) == in bfa_ioc_hwinit()
1850 bfa_ioc_poll_fwinit(ioc); in bfa_ioc_hwinit()
1860 bfa_ioc_poll_fwinit(ioc); in bfa_ioc_hwinit()
1873 bfa_ioc_msgflush(ioc); in bfa_ioc_hwinit()
1874 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FWREADY); in bfa_ioc_hwinit()
1881 if (bfa_ioc_boot(ioc, BFI_FWBOOT_TYPE_NORMAL, boot_env) == in bfa_ioc_hwinit()
1883 bfa_ioc_poll_fwinit(ioc); in bfa_ioc_hwinit()
1887 bfa_nw_ioc_timeout(struct bfa_ioc *ioc) in bfa_nw_ioc_timeout() argument
1889 bfa_fsm_send_event(ioc, IOC_E_TIMEOUT); in bfa_nw_ioc_timeout()
1893 bfa_ioc_mbox_send(struct bfa_ioc *ioc, void *ioc_msg, int len) in bfa_ioc_mbox_send() argument
1905 ioc->ioc_regs.hfn_mbox + i * sizeof(u32)); in bfa_ioc_mbox_send()
1908 writel(0, ioc->ioc_regs.hfn_mbox + i * sizeof(u32)); in bfa_ioc_mbox_send()
1913 writel(1, ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_send()
1914 (void) readl(ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_send()
1918 bfa_ioc_send_enable(struct bfa_ioc *ioc) in bfa_ioc_send_enable() argument
1923 bfa_ioc_portid(ioc)); in bfa_ioc_send_enable()
1924 enable_req.clscode = htons(ioc->clscode); in bfa_ioc_send_enable()
1928 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req)); in bfa_ioc_send_enable()
1932 bfa_ioc_send_disable(struct bfa_ioc *ioc) in bfa_ioc_send_disable() argument
1937 bfa_ioc_portid(ioc)); in bfa_ioc_send_disable()
1938 disable_req.clscode = htons(ioc->clscode); in bfa_ioc_send_disable()
1942 bfa_ioc_mbox_send(ioc, &disable_req, sizeof(struct bfi_ioc_ctrl_req)); in bfa_ioc_send_disable()
1946 bfa_ioc_send_getattr(struct bfa_ioc *ioc) in bfa_ioc_send_getattr() argument
1951 bfa_ioc_portid(ioc)); in bfa_ioc_send_getattr()
1952 bfa_dma_be_addr_set(attr_req.attr_addr, ioc->attr_dma.pa); in bfa_ioc_send_getattr()
1953 bfa_ioc_mbox_send(ioc, &attr_req, sizeof(attr_req)); in bfa_ioc_send_getattr()
1957 bfa_nw_ioc_hb_check(struct bfa_ioc *ioc) in bfa_nw_ioc_hb_check() argument
1961 hb_count = readl(ioc->ioc_regs.heartbeat); in bfa_nw_ioc_hb_check()
1962 if (ioc->hb_count == hb_count) { in bfa_nw_ioc_hb_check()
1963 bfa_ioc_recover(ioc); in bfa_nw_ioc_hb_check()
1966 ioc->hb_count = hb_count; in bfa_nw_ioc_hb_check()
1969 bfa_ioc_mbox_poll(ioc); in bfa_nw_ioc_hb_check()
1970 mod_timer(&ioc->hb_timer, jiffies + in bfa_nw_ioc_hb_check()
1975 bfa_ioc_hb_monitor(struct bfa_ioc *ioc) in bfa_ioc_hb_monitor() argument
1977 ioc->hb_count = readl(ioc->ioc_regs.heartbeat); in bfa_ioc_hb_monitor()
1978 mod_timer(&ioc->hb_timer, jiffies + in bfa_ioc_hb_monitor()
1983 bfa_ioc_hb_stop(struct bfa_ioc *ioc) in bfa_ioc_hb_stop() argument
1985 del_timer(&ioc->hb_timer); in bfa_ioc_hb_stop()
1990 bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, in bfa_ioc_download_fw() argument
2007 status = bfa_nw_ioc_flash_img_get_chnk(ioc, in bfa_ioc_download_fw()
2014 fwimg_size = bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)); in bfa_ioc_download_fw()
2015 fwimg = bfa_cb_image_get_chunk(bfa_ioc_asic_gen(ioc), in bfa_ioc_download_fw()
2019 pgnum = bfa_ioc_smem_pgnum(ioc, loff); in bfa_ioc_download_fw()
2021 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_ioc_download_fw()
2028 status = bfa_nw_ioc_flash_img_get_chnk(ioc, in bfa_ioc_download_fw()
2037 bfa_ioc_asic_gen(ioc), in bfa_ioc_download_fw()
2046 ioc->ioc_regs.smem_page_start + loff); in bfa_ioc_download_fw()
2057 ioc->ioc_regs.host_page_num_fn); in bfa_ioc_download_fw()
2061 writel(bfa_ioc_smem_pgnum(ioc, 0), in bfa_ioc_download_fw()
2062 ioc->ioc_regs.host_page_num_fn); in bfa_ioc_download_fw()
2071 asicmode = BFI_FWBOOT_DEVMODE(ioc->asic_gen, ioc->asic_mode, in bfa_ioc_download_fw()
2072 ioc->port0_mode, ioc->port1_mode); in bfa_ioc_download_fw()
2073 writel(asicmode, ((ioc->ioc_regs.smem_page_start) in bfa_ioc_download_fw()
2075 writel(boot_type, ((ioc->ioc_regs.smem_page_start) in bfa_ioc_download_fw()
2077 writel(boot_env, ((ioc->ioc_regs.smem_page_start) in bfa_ioc_download_fw()
2083 bfa_ioc_reset(struct bfa_ioc *ioc, bool force) in bfa_ioc_reset() argument
2085 bfa_ioc_hwinit(ioc, force); in bfa_ioc_reset()
2090 bfa_ioc_enable_reply(struct bfa_ioc *ioc, enum bfa_mode port_mode, in bfa_ioc_enable_reply() argument
2093 struct bfa_iocpf *iocpf = &ioc->iocpf; in bfa_ioc_enable_reply()
2095 ioc->port_mode = ioc->port_mode_cfg = port_mode; in bfa_ioc_enable_reply()
2096 ioc->ad_cap_bm = cap_bm; in bfa_ioc_enable_reply()
2102 bfa_ioc_getattr_reply(struct bfa_ioc *ioc) in bfa_ioc_getattr_reply() argument
2104 struct bfi_ioc_attr *attr = ioc->attr; in bfa_ioc_getattr_reply()
2110 bfa_fsm_send_event(ioc, IOC_E_FWRSP_GETATTR); in bfa_ioc_getattr_reply()
2115 bfa_ioc_mbox_attach(struct bfa_ioc *ioc) in bfa_ioc_mbox_attach() argument
2117 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; in bfa_ioc_mbox_attach()
2123 mod->mbhdlr[mc].cbarg = ioc->bfa; in bfa_ioc_mbox_attach()
2129 bfa_ioc_mbox_poll(struct bfa_ioc *ioc) in bfa_ioc_mbox_poll() argument
2131 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; in bfa_ioc_mbox_poll()
2146 stat = readl(ioc->ioc_regs.hfn_mbox_cmd); in bfa_ioc_mbox_poll()
2155 bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); in bfa_ioc_mbox_poll()
2170 bfa_ioc_mbox_flush(struct bfa_ioc *ioc) in bfa_ioc_mbox_flush() argument
2172 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; in bfa_ioc_mbox_flush()
2190 bfa_nw_ioc_smem_read(struct bfa_ioc *ioc, void *tbuf, u32 soff, u32 sz) in bfa_nw_ioc_smem_read() argument
2196 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); in bfa_nw_ioc_smem_read()
2202 if (!bfa_nw_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg)) in bfa_nw_ioc_smem_read()
2205 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_nw_ioc_smem_read()
2209 r32 = swab32(readl(loff + ioc->ioc_regs.smem_page_start)); in bfa_nw_ioc_smem_read()
2219 writel(pgnum, ioc->ioc_regs.host_page_num_fn); in bfa_nw_ioc_smem_read()
2223 writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), in bfa_nw_ioc_smem_read()
2224 ioc->ioc_regs.host_page_num_fn); in bfa_nw_ioc_smem_read()
2229 readl(ioc->ioc_regs.ioc_init_sem_reg); in bfa_nw_ioc_smem_read()
2230 writel(1, ioc->ioc_regs.ioc_init_sem_reg); in bfa_nw_ioc_smem_read()
2236 bfa_nw_ioc_debug_fwtrc(struct bfa_ioc *ioc, void *trcdata, int *trclen) in bfa_nw_ioc_debug_fwtrc() argument
2238 u32 loff = BFI_IOC_TRC_OFF + BNA_DBG_FWTRC_LEN * ioc->port_id; in bfa_nw_ioc_debug_fwtrc()
2245 status = bfa_nw_ioc_smem_read(ioc, trcdata, loff, tlen); in bfa_nw_ioc_debug_fwtrc()
2252 bfa_nw_ioc_debug_save_ftrc(struct bfa_ioc *ioc) in bfa_nw_ioc_debug_save_ftrc() argument
2256 if (ioc->dbg_fwsave_once) { in bfa_nw_ioc_debug_save_ftrc()
2257 ioc->dbg_fwsave_once = false; in bfa_nw_ioc_debug_save_ftrc()
2258 if (ioc->dbg_fwsave_len) { in bfa_nw_ioc_debug_save_ftrc()
2259 tlen = ioc->dbg_fwsave_len; in bfa_nw_ioc_debug_save_ftrc()
2260 bfa_nw_ioc_debug_fwtrc(ioc, ioc->dbg_fwsave, &tlen); in bfa_nw_ioc_debug_save_ftrc()
2267 bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen) in bfa_nw_ioc_debug_fwsave() argument
2271 if (ioc->dbg_fwsave_len == 0) in bfa_nw_ioc_debug_fwsave()
2275 if (tlen > ioc->dbg_fwsave_len) in bfa_nw_ioc_debug_fwsave()
2276 tlen = ioc->dbg_fwsave_len; in bfa_nw_ioc_debug_fwsave()
2278 memcpy(trcdata, ioc->dbg_fwsave, tlen); in bfa_nw_ioc_debug_fwsave()
2284 bfa_ioc_fail_notify(struct bfa_ioc *ioc) in bfa_ioc_fail_notify() argument
2289 ioc->cbfn->hbfail_cbfn(ioc->bfa); in bfa_ioc_fail_notify()
2290 bfa_ioc_event_notify(ioc, BFA_IOC_E_FAILED); in bfa_ioc_fail_notify()
2291 bfa_nw_ioc_debug_save_ftrc(ioc); in bfa_ioc_fail_notify()
2296 bfa_ioc_pf_enabled(struct bfa_ioc *ioc) in bfa_ioc_pf_enabled() argument
2298 bfa_fsm_send_event(ioc, IOC_E_ENABLED); in bfa_ioc_pf_enabled()
2302 bfa_ioc_pf_disabled(struct bfa_ioc *ioc) in bfa_ioc_pf_disabled() argument
2304 bfa_fsm_send_event(ioc, IOC_E_DISABLED); in bfa_ioc_pf_disabled()
2308 bfa_ioc_pf_failed(struct bfa_ioc *ioc) in bfa_ioc_pf_failed() argument
2310 bfa_fsm_send_event(ioc, IOC_E_PFFAILED); in bfa_ioc_pf_failed()
2314 bfa_ioc_pf_hwfailed(struct bfa_ioc *ioc) in bfa_ioc_pf_hwfailed() argument
2316 bfa_fsm_send_event(ioc, IOC_E_HWFAILED); in bfa_ioc_pf_hwfailed()
2320 bfa_ioc_pf_fwmismatch(struct bfa_ioc *ioc) in bfa_ioc_pf_fwmismatch() argument
2325 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); in bfa_ioc_pf_fwmismatch()
2330 bfa_ioc_pll_init(struct bfa_ioc *ioc) in bfa_ioc_pll_init() argument
2335 bfa_nw_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_pll_init()
2337 bfa_ioc_pll_init_asic(ioc); in bfa_ioc_pll_init()
2339 ioc->pllinit = true; in bfa_ioc_pll_init()
2342 bfa_ioc_lmem_init(ioc); in bfa_ioc_pll_init()
2347 bfa_nw_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); in bfa_ioc_pll_init()
2356 bfa_ioc_boot(struct bfa_ioc *ioc, enum bfi_fwboot_type boot_type, in bfa_ioc_boot() argument
2361 bfa_ioc_stats(ioc, ioc_boots); in bfa_ioc_boot()
2363 if (bfa_ioc_pll_init(ioc) != BFA_STATUS_OK) in bfa_ioc_boot()
2368 bfa_cb_image_get_chunk(bfa_ioc_asic_gen(ioc), 0); in bfa_ioc_boot()
2372 if (bfa_ioc_flash_fwver_cmp(ioc, drv_fwhdr) == in bfa_ioc_boot()
2381 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_MEMTEST); in bfa_ioc_boot()
2382 bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_MEMTEST); in bfa_ioc_boot()
2384 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_INITING); in bfa_ioc_boot()
2385 bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_INITING); in bfa_ioc_boot()
2388 bfa_ioc_msgflush(ioc); in bfa_ioc_boot()
2389 status = bfa_ioc_download_fw(ioc, boot_type, boot_env); in bfa_ioc_boot()
2391 bfa_ioc_lpu_start(ioc); in bfa_ioc_boot()
2393 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT); in bfa_ioc_boot()
2406 bfa_ioc_msgget(struct bfa_ioc *ioc, void *mbmsg) in bfa_ioc_msgget() argument
2412 r32 = readl(ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgget()
2421 r32 = readl(ioc->ioc_regs.lpu_mbox + in bfa_ioc_msgget()
2429 writel(1, ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgget()
2430 readl(ioc->ioc_regs.lpu_mbox_cmd); in bfa_ioc_msgget()
2436 bfa_ioc_isr(struct bfa_ioc *ioc, struct bfi_mbmsg *m) in bfa_ioc_isr() argument
2439 struct bfa_iocpf *iocpf = &ioc->iocpf; in bfa_ioc_isr()
2443 bfa_ioc_stats(ioc, ioc_isrs); in bfa_ioc_isr()
2450 bfa_ioc_enable_reply(ioc, in bfa_ioc_isr()
2460 bfa_ioc_getattr_reply(ioc); in bfa_ioc_isr()
2476 bfa_nw_ioc_attach(struct bfa_ioc *ioc, void *bfa, struct bfa_ioc_cbfn *cbfn) in bfa_nw_ioc_attach() argument
2478 ioc->bfa = bfa; in bfa_nw_ioc_attach()
2479 ioc->cbfn = cbfn; in bfa_nw_ioc_attach()
2480 ioc->fcmode = false; in bfa_nw_ioc_attach()
2481 ioc->pllinit = false; in bfa_nw_ioc_attach()
2482 ioc->dbg_fwsave_once = true; in bfa_nw_ioc_attach()
2483 ioc->iocpf.ioc = ioc; in bfa_nw_ioc_attach()
2485 bfa_ioc_mbox_attach(ioc); in bfa_nw_ioc_attach()
2486 INIT_LIST_HEAD(&ioc->notify_q); in bfa_nw_ioc_attach()
2488 bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); in bfa_nw_ioc_attach()
2489 bfa_fsm_send_event(ioc, IOC_E_RESET); in bfa_nw_ioc_attach()
2494 bfa_nw_ioc_detach(struct bfa_ioc *ioc) in bfa_nw_ioc_detach() argument
2496 bfa_fsm_send_event(ioc, IOC_E_DETACH); in bfa_nw_ioc_detach()
2499 INIT_LIST_HEAD(&ioc->notify_q); in bfa_nw_ioc_detach()
2510 bfa_nw_ioc_pci_init(struct bfa_ioc *ioc, struct bfa_pcidev *pcidev, in bfa_nw_ioc_pci_init() argument
2513 ioc->clscode = clscode; in bfa_nw_ioc_pci_init()
2514 ioc->pcidev = *pcidev; in bfa_nw_ioc_pci_init()
2519 ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_FC; in bfa_nw_ioc_pci_init()
2520 ioc->asic_mode = BFI_ASIC_MODE_FC; in bfa_nw_ioc_pci_init()
2524 ioc->asic_gen = BFI_ASIC_GEN_CT; in bfa_nw_ioc_pci_init()
2525 ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; in bfa_nw_ioc_pci_init()
2526 ioc->asic_mode = BFI_ASIC_MODE_ETH; in bfa_nw_ioc_pci_init()
2527 ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_CNA; in bfa_nw_ioc_pci_init()
2528 ioc->ad_cap_bm = BFA_CM_CNA; in bfa_nw_ioc_pci_init()
2532 ioc->asic_gen = BFI_ASIC_GEN_CT2; in bfa_nw_ioc_pci_init()
2535 ioc->asic_mode = BFI_ASIC_MODE_FC16; in bfa_nw_ioc_pci_init()
2536 ioc->fcmode = true; in bfa_nw_ioc_pci_init()
2537 ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; in bfa_nw_ioc_pci_init()
2538 ioc->ad_cap_bm = BFA_CM_HBA; in bfa_nw_ioc_pci_init()
2540 ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; in bfa_nw_ioc_pci_init()
2541 ioc->asic_mode = BFI_ASIC_MODE_ETH; in bfa_nw_ioc_pci_init()
2543 ioc->port_mode = in bfa_nw_ioc_pci_init()
2544 ioc->port_mode_cfg = BFA_MODE_CNA; in bfa_nw_ioc_pci_init()
2545 ioc->ad_cap_bm = BFA_CM_CNA; in bfa_nw_ioc_pci_init()
2547 ioc->port_mode = in bfa_nw_ioc_pci_init()
2548 ioc->port_mode_cfg = BFA_MODE_NIC; in bfa_nw_ioc_pci_init()
2549 ioc->ad_cap_bm = BFA_CM_NIC; in bfa_nw_ioc_pci_init()
2561 if (ioc->asic_gen == BFI_ASIC_GEN_CT) in bfa_nw_ioc_pci_init()
2562 bfa_nw_ioc_set_ct_hwif(ioc); in bfa_nw_ioc_pci_init()
2564 WARN_ON(ioc->asic_gen != BFI_ASIC_GEN_CT2); in bfa_nw_ioc_pci_init()
2565 bfa_nw_ioc_set_ct2_hwif(ioc); in bfa_nw_ioc_pci_init()
2566 bfa_nw_ioc_ct2_poweron(ioc); in bfa_nw_ioc_pci_init()
2569 bfa_ioc_map_port(ioc); in bfa_nw_ioc_pci_init()
2570 bfa_ioc_reg_init(ioc); in bfa_nw_ioc_pci_init()
2581 bfa_nw_ioc_mem_claim(struct bfa_ioc *ioc, u8 *dm_kva, u64 dm_pa) in bfa_nw_ioc_mem_claim() argument
2586 ioc->attr_dma.kva = dm_kva; in bfa_nw_ioc_mem_claim()
2587 ioc->attr_dma.pa = dm_pa; in bfa_nw_ioc_mem_claim()
2588 ioc->attr = (struct bfi_ioc_attr *) dm_kva; in bfa_nw_ioc_mem_claim()
2599 bfa_nw_ioc_enable(struct bfa_ioc *ioc) in bfa_nw_ioc_enable() argument
2601 bfa_ioc_stats(ioc, ioc_enables); in bfa_nw_ioc_enable()
2602 ioc->dbg_fwsave_once = true; in bfa_nw_ioc_enable()
2604 bfa_fsm_send_event(ioc, IOC_E_ENABLE); in bfa_nw_ioc_enable()
2608 bfa_nw_ioc_disable(struct bfa_ioc *ioc) in bfa_nw_ioc_disable() argument
2610 bfa_ioc_stats(ioc, ioc_disables); in bfa_nw_ioc_disable()
2611 bfa_fsm_send_event(ioc, IOC_E_DISABLE); in bfa_nw_ioc_disable()
2616 bfa_nw_ioc_debug_memclaim(struct bfa_ioc *ioc, void *dbg_fwsave) in bfa_nw_ioc_debug_memclaim() argument
2618 ioc->dbg_fwsave = dbg_fwsave; in bfa_nw_ioc_debug_memclaim()
2619 ioc->dbg_fwsave_len = ioc->iocpf.auto_recover ? BNA_DBG_FWTRC_LEN : 0; in bfa_nw_ioc_debug_memclaim()
2623 bfa_ioc_smem_pgnum(struct bfa_ioc *ioc, u32 fmaddr) in bfa_ioc_smem_pgnum() argument
2625 return PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, fmaddr); in bfa_ioc_smem_pgnum()
2630 bfa_nw_ioc_mbox_regisr(struct bfa_ioc *ioc, enum bfi_mclass mc, in bfa_nw_ioc_mbox_regisr() argument
2633 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; in bfa_nw_ioc_mbox_regisr()
2650 bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc, struct bfa_mbox_cmd *cmd, in bfa_nw_ioc_mbox_queue() argument
2653 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; in bfa_nw_ioc_mbox_queue()
2670 stat = readl(ioc->ioc_regs.hfn_mbox_cmd); in bfa_nw_ioc_mbox_queue()
2679 bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg)); in bfa_nw_ioc_mbox_queue()
2686 bfa_nw_ioc_mbox_isr(struct bfa_ioc *ioc) in bfa_nw_ioc_mbox_isr() argument
2688 struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod; in bfa_nw_ioc_mbox_isr()
2692 if (bfa_ioc_msgget(ioc, &m)) { in bfa_nw_ioc_mbox_isr()
2698 bfa_ioc_isr(ioc, &m); in bfa_nw_ioc_mbox_isr()
2708 bfa_ioc_lpu_read_stat(ioc); in bfa_nw_ioc_mbox_isr()
2713 bfa_ioc_mbox_poll(ioc); in bfa_nw_ioc_mbox_isr()
2717 bfa_nw_ioc_error_isr(struct bfa_ioc *ioc) in bfa_nw_ioc_error_isr() argument
2719 bfa_ioc_stats(ioc, ioc_hbfails); in bfa_nw_ioc_error_isr()
2720 bfa_ioc_stats_hb_count(ioc, ioc->hb_count); in bfa_nw_ioc_error_isr()
2721 bfa_fsm_send_event(ioc, IOC_E_HWERROR); in bfa_nw_ioc_error_isr()
2726 bfa_nw_ioc_is_disabled(struct bfa_ioc *ioc) in bfa_nw_ioc_is_disabled() argument
2728 return bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabling) || in bfa_nw_ioc_is_disabled()
2729 bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabled); in bfa_nw_ioc_is_disabled()
2734 bfa_nw_ioc_is_operational(struct bfa_ioc *ioc) in bfa_nw_ioc_is_operational() argument
2736 return bfa_fsm_cmp_state(ioc, bfa_ioc_sm_op); in bfa_nw_ioc_is_operational()
2743 bfa_nw_ioc_notify_register(struct bfa_ioc *ioc, in bfa_nw_ioc_notify_register() argument
2746 list_add_tail(&notify->qe, &ioc->notify_q); in bfa_nw_ioc_notify_register()
2751 bfa_ioc_get_adapter_attr(struct bfa_ioc *ioc, in bfa_ioc_get_adapter_attr() argument
2756 ioc_attr = ioc->attr; in bfa_ioc_get_adapter_attr()
2758 bfa_ioc_get_adapter_serial_num(ioc, ad_attr->serial_num); in bfa_ioc_get_adapter_attr()
2759 bfa_ioc_get_adapter_fw_ver(ioc, ad_attr->fw_ver); in bfa_ioc_get_adapter_attr()
2760 bfa_ioc_get_adapter_optrom_ver(ioc, ad_attr->optrom_ver); in bfa_ioc_get_adapter_attr()
2761 bfa_ioc_get_adapter_manufacturer(ioc, ad_attr->manufacturer); in bfa_ioc_get_adapter_attr()
2765 ad_attr->nports = bfa_ioc_get_nports(ioc); in bfa_ioc_get_adapter_attr()
2766 ad_attr->max_speed = bfa_ioc_speed_sup(ioc); in bfa_ioc_get_adapter_attr()
2768 bfa_ioc_get_adapter_model(ioc, ad_attr->model); in bfa_ioc_get_adapter_attr()
2770 bfa_ioc_get_adapter_model(ioc, ad_attr->model_descr); in bfa_ioc_get_adapter_attr()
2780 ad_attr->pwwn = bfa_ioc_get_pwwn(ioc); in bfa_ioc_get_adapter_attr()
2781 bfa_nw_ioc_get_mac(ioc, ad_attr->mac); in bfa_ioc_get_adapter_attr()
2788 bfa_ioc_get_pci_chip_rev(ioc, ad_attr->hw_ver); in bfa_ioc_get_adapter_attr()
2792 bfa_ioc_get_type(struct bfa_ioc *ioc) in bfa_ioc_get_type() argument
2794 if (ioc->clscode == BFI_PCIFN_CLASS_ETH) in bfa_ioc_get_type()
2797 BUG_ON(!(ioc->clscode == BFI_PCIFN_CLASS_FC)); in bfa_ioc_get_type()
2799 return (ioc->attr->port_mode == BFI_PORT_MODE_FC) in bfa_ioc_get_type()
2804 bfa_ioc_get_adapter_serial_num(struct bfa_ioc *ioc, char *serial_num) in bfa_ioc_get_adapter_serial_num() argument
2807 (void *)ioc->attr->brcd_serialnum, in bfa_ioc_get_adapter_serial_num()
2812 bfa_ioc_get_adapter_fw_ver(struct bfa_ioc *ioc, char *fw_ver) in bfa_ioc_get_adapter_fw_ver() argument
2814 memcpy(fw_ver, ioc->attr->fw_version, BFA_VERSION_LEN); in bfa_ioc_get_adapter_fw_ver()
2818 bfa_ioc_get_pci_chip_rev(struct bfa_ioc *ioc, char *chip_rev) in bfa_ioc_get_pci_chip_rev() argument
2828 chip_rev[4] = ioc->attr->asic_rev; in bfa_ioc_get_pci_chip_rev()
2833 bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc *ioc, char *optrom_ver) in bfa_ioc_get_adapter_optrom_ver() argument
2835 memcpy(optrom_ver, ioc->attr->optrom_version, in bfa_ioc_get_adapter_optrom_ver()
2840 bfa_ioc_get_adapter_manufacturer(struct bfa_ioc *ioc, char *manufacturer) in bfa_ioc_get_adapter_manufacturer() argument
2846 bfa_ioc_get_adapter_model(struct bfa_ioc *ioc, char *model) in bfa_ioc_get_adapter_model() argument
2853 ioc_attr = ioc->attr; in bfa_ioc_get_adapter_model()
2860 bfa_ioc_get_state(struct bfa_ioc *ioc) in bfa_ioc_get_state() argument
2863 enum bfa_ioc_state ioc_st = bfa_sm_to_state(ioc_sm_table, ioc->fsm); in bfa_ioc_get_state()
2868 iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc->iocpf.fsm); in bfa_ioc_get_state()
2899 bfa_nw_ioc_get_attr(struct bfa_ioc *ioc, struct bfa_ioc_attr *ioc_attr) in bfa_nw_ioc_get_attr() argument
2903 ioc_attr->state = bfa_ioc_get_state(ioc); in bfa_nw_ioc_get_attr()
2904 ioc_attr->port_id = bfa_ioc_portid(ioc); in bfa_nw_ioc_get_attr()
2905 ioc_attr->port_mode = ioc->port_mode; in bfa_nw_ioc_get_attr()
2907 ioc_attr->port_mode_cfg = ioc->port_mode_cfg; in bfa_nw_ioc_get_attr()
2908 ioc_attr->cap_bm = ioc->ad_cap_bm; in bfa_nw_ioc_get_attr()
2910 ioc_attr->ioc_type = bfa_ioc_get_type(ioc); in bfa_nw_ioc_get_attr()
2912 bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); in bfa_nw_ioc_get_attr()
2914 ioc_attr->pci_attr.device_id = bfa_ioc_devid(ioc); in bfa_nw_ioc_get_attr()
2915 ioc_attr->pci_attr.pcifn = bfa_ioc_pcifn(ioc); in bfa_nw_ioc_get_attr()
2916 ioc_attr->def_fn = bfa_ioc_is_default(ioc); in bfa_nw_ioc_get_attr()
2917 bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); in bfa_nw_ioc_get_attr()
2922 bfa_ioc_get_pwwn(struct bfa_ioc *ioc) in bfa_ioc_get_pwwn() argument
2924 return ioc->attr->pwwn; in bfa_ioc_get_pwwn()
2928 bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac) in bfa_nw_ioc_get_mac() argument
2930 ether_addr_copy(mac, ioc->attr->mac); in bfa_nw_ioc_get_mac()
2935 bfa_ioc_recover(struct bfa_ioc *ioc) in bfa_ioc_recover() argument
2938 bfa_ioc_stats(ioc, ioc_hbfails); in bfa_ioc_recover()
2939 bfa_ioc_stats_hb_count(ioc, ioc->hb_count); in bfa_ioc_recover()
2940 bfa_fsm_send_event(ioc, IOC_E_HBFAIL); in bfa_ioc_recover()
2946 bfa_iocpf_enable(struct bfa_ioc *ioc) in bfa_iocpf_enable() argument
2948 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_ENABLE); in bfa_iocpf_enable()
2952 bfa_iocpf_disable(struct bfa_ioc *ioc) in bfa_iocpf_disable() argument
2954 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); in bfa_iocpf_disable()
2958 bfa_iocpf_fail(struct bfa_ioc *ioc) in bfa_iocpf_fail() argument
2960 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); in bfa_iocpf_fail()
2964 bfa_iocpf_initfail(struct bfa_ioc *ioc) in bfa_iocpf_initfail() argument
2966 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); in bfa_iocpf_initfail()
2970 bfa_iocpf_getattrfail(struct bfa_ioc *ioc) in bfa_iocpf_getattrfail() argument
2972 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_GETATTRFAIL); in bfa_iocpf_getattrfail()
2976 bfa_iocpf_stop(struct bfa_ioc *ioc) in bfa_iocpf_stop() argument
2978 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); in bfa_iocpf_stop()
2982 bfa_nw_iocpf_timeout(struct bfa_ioc *ioc) in bfa_nw_iocpf_timeout() argument
2986 iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc->iocpf.fsm); in bfa_nw_iocpf_timeout()
2989 bfa_ioc_poll_fwinit(ioc); in bfa_nw_iocpf_timeout()
2991 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT); in bfa_nw_iocpf_timeout()
2995 bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc) in bfa_nw_iocpf_sem_timeout() argument
2997 bfa_ioc_hw_sem_get(ioc); in bfa_nw_iocpf_sem_timeout()
3001 bfa_ioc_poll_fwinit(struct bfa_ioc *ioc) in bfa_ioc_poll_fwinit() argument
3003 u32 fwstate = bfa_ioc_get_cur_ioc_fwstate(ioc); in bfa_ioc_poll_fwinit()
3006 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FWREADY); in bfa_ioc_poll_fwinit()
3010 if (ioc->iocpf.poll_time >= BFA_IOC_TOV) { in bfa_ioc_poll_fwinit()
3011 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT); in bfa_ioc_poll_fwinit()
3013 ioc->iocpf.poll_time += BFA_IOC_POLL_TOV; in bfa_ioc_poll_fwinit()
3014 mod_timer(&ioc->iocpf_timer, jiffies + in bfa_ioc_poll_fwinit()
3080 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
3083 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_write_send()
3109 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
3111 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_read_send()
3219 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) in bfa_nw_flash_attach() argument
3221 flash->ioc = ioc; in bfa_nw_flash_attach()
3226 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_nw_flash_attach()
3228 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_nw_flash_attach()
3265 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_get_attr()
3277 bfa_ioc_portid(flash->ioc)); in bfa_nw_flash_get_attr()
3279 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_nw_flash_get_attr()
3303 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_update_part()
3352 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_read_part()