2 * Linux network driver for Brocade Converged Network Adapter.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License (GPL) Version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
22 #include "bfi_ctreg.h"
26 * IOC local definitions
30 * Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details.
33 #define bfa_ioc_firmware_lock(__ioc) \
34 ((__ioc)->ioc_hwif->ioc_firmware_lock(__ioc))
35 #define bfa_ioc_firmware_unlock(__ioc) \
36 ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc))
37 #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc))
38 #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc))
39 #define bfa_ioc_notify_fail(__ioc) \
40 ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc))
41 #define bfa_ioc_sync_start(__ioc) \
42 ((__ioc)->ioc_hwif->ioc_sync_start(__ioc))
43 #define bfa_ioc_sync_join(__ioc) \
44 ((__ioc)->ioc_hwif->ioc_sync_join(__ioc))
45 #define bfa_ioc_sync_leave(__ioc) \
46 ((__ioc)->ioc_hwif->ioc_sync_leave(__ioc))
47 #define bfa_ioc_sync_ack(__ioc) \
48 ((__ioc)->ioc_hwif->ioc_sync_ack(__ioc))
49 #define bfa_ioc_sync_complete(__ioc) \
50 ((__ioc)->ioc_hwif->ioc_sync_complete(__ioc))
52 #define bfa_ioc_mbox_cmd_pending(__ioc) \
53 (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \
54 readl((__ioc)->ioc_regs.hfn_mbox_cmd))
56 static bool bfa_nw_auto_recover
= true;
59 * forward declarations
61 static void bfa_ioc_hw_sem_get(struct bfa_ioc
*ioc
);
62 static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc
*ioc
);
63 static void bfa_ioc_hwinit(struct bfa_ioc
*ioc
, bool force
);
64 static void bfa_ioc_send_enable(struct bfa_ioc
*ioc
);
65 static void bfa_ioc_send_disable(struct bfa_ioc
*ioc
);
66 static void bfa_ioc_send_getattr(struct bfa_ioc
*ioc
);
67 static void bfa_ioc_hb_monitor(struct bfa_ioc
*ioc
);
68 static void bfa_ioc_hb_stop(struct bfa_ioc
*ioc
);
69 static void bfa_ioc_reset(struct bfa_ioc
*ioc
, bool force
);
70 static void bfa_ioc_mbox_poll(struct bfa_ioc
*ioc
);
71 static void bfa_ioc_mbox_hbfail(struct bfa_ioc
*ioc
);
72 static void bfa_ioc_recover(struct bfa_ioc
*ioc
);
73 static void bfa_ioc_check_attr_wwns(struct bfa_ioc
*ioc
);
74 static void bfa_ioc_disable_comp(struct bfa_ioc
*ioc
);
75 static void bfa_ioc_lpu_stop(struct bfa_ioc
*ioc
);
76 static void bfa_ioc_fail_notify(struct bfa_ioc
*ioc
);
77 static void bfa_ioc_pf_enabled(struct bfa_ioc
*ioc
);
78 static void bfa_ioc_pf_disabled(struct bfa_ioc
*ioc
);
79 static void bfa_ioc_pf_initfailed(struct bfa_ioc
*ioc
);
80 static void bfa_ioc_pf_failed(struct bfa_ioc
*ioc
);
81 static void bfa_ioc_pf_fwmismatch(struct bfa_ioc
*ioc
);
82 static void bfa_ioc_boot(struct bfa_ioc
*ioc
, u32 boot_type
,
84 static u32
bfa_ioc_smem_pgnum(struct bfa_ioc
*ioc
, u32 fmaddr
);
85 static void bfa_ioc_get_adapter_serial_num(struct bfa_ioc
*ioc
,
87 static void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc
*ioc
,
89 static void bfa_ioc_get_pci_chip_rev(struct bfa_ioc
*ioc
,
91 static void bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc
*ioc
,
93 static void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc
*ioc
,
95 static void bfa_ioc_get_adapter_model(struct bfa_ioc
*ioc
, char *model
);
96 static u64
bfa_ioc_get_pwwn(struct bfa_ioc
*ioc
);
99 * IOC state machine definitions/declarations
102 IOC_E_RESET
= 1, /*!< IOC reset request */
103 IOC_E_ENABLE
= 2, /*!< IOC enable request */
104 IOC_E_DISABLE
= 3, /*!< IOC disable request */
105 IOC_E_DETACH
= 4, /*!< driver detach cleanup */
106 IOC_E_ENABLED
= 5, /*!< f/w enabled */
107 IOC_E_FWRSP_GETATTR
= 6, /*!< IOC get attribute response */
108 IOC_E_DISABLED
= 7, /*!< f/w disabled */
109 IOC_E_INITFAILED
= 8, /*!< failure notice by iocpf sm */
110 IOC_E_PFAILED
= 9, /*!< failure notice by iocpf sm */
111 IOC_E_HBFAIL
= 10, /*!< heartbeat failure */
112 IOC_E_HWERROR
= 11, /*!< hardware error interrupt */
113 IOC_E_TIMEOUT
= 12, /*!< timeout */
116 bfa_fsm_state_decl(bfa_ioc
, uninit
, struct bfa_ioc
, enum ioc_event
);
117 bfa_fsm_state_decl(bfa_ioc
, reset
, struct bfa_ioc
, enum ioc_event
);
118 bfa_fsm_state_decl(bfa_ioc
, enabling
, struct bfa_ioc
, enum ioc_event
);
119 bfa_fsm_state_decl(bfa_ioc
, getattr
, struct bfa_ioc
, enum ioc_event
);
120 bfa_fsm_state_decl(bfa_ioc
, op
, struct bfa_ioc
, enum ioc_event
);
121 bfa_fsm_state_decl(bfa_ioc
, fail_retry
, struct bfa_ioc
, enum ioc_event
);
122 bfa_fsm_state_decl(bfa_ioc
, fail
, struct bfa_ioc
, enum ioc_event
);
123 bfa_fsm_state_decl(bfa_ioc
, disabling
, struct bfa_ioc
, enum ioc_event
);
124 bfa_fsm_state_decl(bfa_ioc
, disabled
, struct bfa_ioc
, enum ioc_event
);
126 static struct bfa_sm_table ioc_sm_table
[] = {
127 {BFA_SM(bfa_ioc_sm_uninit
), BFA_IOC_UNINIT
},
128 {BFA_SM(bfa_ioc_sm_reset
), BFA_IOC_RESET
},
129 {BFA_SM(bfa_ioc_sm_enabling
), BFA_IOC_ENABLING
},
130 {BFA_SM(bfa_ioc_sm_getattr
), BFA_IOC_GETATTR
},
131 {BFA_SM(bfa_ioc_sm_op
), BFA_IOC_OPERATIONAL
},
132 {BFA_SM(bfa_ioc_sm_fail_retry
), BFA_IOC_INITFAIL
},
133 {BFA_SM(bfa_ioc_sm_fail
), BFA_IOC_FAIL
},
134 {BFA_SM(bfa_ioc_sm_disabling
), BFA_IOC_DISABLING
},
135 {BFA_SM(bfa_ioc_sm_disabled
), BFA_IOC_DISABLED
},
139 * IOCPF state machine definitions/declarations
143 * Forward declareations for iocpf state machine
145 static void bfa_iocpf_enable(struct bfa_ioc
*ioc
);
146 static void bfa_iocpf_disable(struct bfa_ioc
*ioc
);
147 static void bfa_iocpf_fail(struct bfa_ioc
*ioc
);
148 static void bfa_iocpf_initfail(struct bfa_ioc
*ioc
);
149 static void bfa_iocpf_getattrfail(struct bfa_ioc
*ioc
);
150 static void bfa_iocpf_stop(struct bfa_ioc
*ioc
);
153 * IOCPF state machine events
156 IOCPF_E_ENABLE
= 1, /*!< IOCPF enable request */
157 IOCPF_E_DISABLE
= 2, /*!< IOCPF disable request */
158 IOCPF_E_STOP
= 3, /*!< stop on driver detach */
159 IOCPF_E_FWREADY
= 4, /*!< f/w initialization done */
160 IOCPF_E_FWRSP_ENABLE
= 5, /*!< enable f/w response */
161 IOCPF_E_FWRSP_DISABLE
= 6, /*!< disable f/w response */
162 IOCPF_E_FAIL
= 7, /*!< failure notice by ioc sm */
163 IOCPF_E_INITFAIL
= 8, /*!< init fail notice by ioc sm */
164 IOCPF_E_GETATTRFAIL
= 9, /*!< init fail notice by ioc sm */
165 IOCPF_E_SEMLOCKED
= 10, /*!< h/w semaphore is locked */
166 IOCPF_E_TIMEOUT
= 11, /*!< f/w response timeout */
172 enum bfa_iocpf_state
{
173 BFA_IOCPF_RESET
= 1, /*!< IOC is in reset state */
174 BFA_IOCPF_SEMWAIT
= 2, /*!< Waiting for IOC h/w semaphore */
175 BFA_IOCPF_HWINIT
= 3, /*!< IOC h/w is being initialized */
176 BFA_IOCPF_READY
= 4, /*!< IOCPF is initialized */
177 BFA_IOCPF_INITFAIL
= 5, /*!< IOCPF failed */
178 BFA_IOCPF_FAIL
= 6, /*!< IOCPF failed */
179 BFA_IOCPF_DISABLING
= 7, /*!< IOCPF is being disabled */
180 BFA_IOCPF_DISABLED
= 8, /*!< IOCPF is disabled */
181 BFA_IOCPF_FWMISMATCH
= 9, /*!< IOC f/w different from drivers */
184 bfa_fsm_state_decl(bfa_iocpf
, reset
, struct bfa_iocpf
, enum iocpf_event
);
185 bfa_fsm_state_decl(bfa_iocpf
, fwcheck
, struct bfa_iocpf
, enum iocpf_event
);
186 bfa_fsm_state_decl(bfa_iocpf
, mismatch
, struct bfa_iocpf
, enum iocpf_event
);
187 bfa_fsm_state_decl(bfa_iocpf
, semwait
, struct bfa_iocpf
, enum iocpf_event
);
188 bfa_fsm_state_decl(bfa_iocpf
, hwinit
, struct bfa_iocpf
, enum iocpf_event
);
189 bfa_fsm_state_decl(bfa_iocpf
, enabling
, struct bfa_iocpf
, enum iocpf_event
);
190 bfa_fsm_state_decl(bfa_iocpf
, ready
, struct bfa_iocpf
, enum iocpf_event
);
191 bfa_fsm_state_decl(bfa_iocpf
, initfail_sync
, struct bfa_iocpf
,
193 bfa_fsm_state_decl(bfa_iocpf
, initfail
, struct bfa_iocpf
, enum iocpf_event
);
194 bfa_fsm_state_decl(bfa_iocpf
, fail_sync
, struct bfa_iocpf
, enum iocpf_event
);
195 bfa_fsm_state_decl(bfa_iocpf
, fail
, struct bfa_iocpf
, enum iocpf_event
);
196 bfa_fsm_state_decl(bfa_iocpf
, disabling
, struct bfa_iocpf
, enum iocpf_event
);
197 bfa_fsm_state_decl(bfa_iocpf
, disabling_sync
, struct bfa_iocpf
,
199 bfa_fsm_state_decl(bfa_iocpf
, disabled
, struct bfa_iocpf
, enum iocpf_event
);
201 static struct bfa_sm_table iocpf_sm_table
[] = {
202 {BFA_SM(bfa_iocpf_sm_reset
), BFA_IOCPF_RESET
},
203 {BFA_SM(bfa_iocpf_sm_fwcheck
), BFA_IOCPF_FWMISMATCH
},
204 {BFA_SM(bfa_iocpf_sm_mismatch
), BFA_IOCPF_FWMISMATCH
},
205 {BFA_SM(bfa_iocpf_sm_semwait
), BFA_IOCPF_SEMWAIT
},
206 {BFA_SM(bfa_iocpf_sm_hwinit
), BFA_IOCPF_HWINIT
},
207 {BFA_SM(bfa_iocpf_sm_enabling
), BFA_IOCPF_HWINIT
},
208 {BFA_SM(bfa_iocpf_sm_ready
), BFA_IOCPF_READY
},
209 {BFA_SM(bfa_iocpf_sm_initfail_sync
), BFA_IOCPF_INITFAIL
},
210 {BFA_SM(bfa_iocpf_sm_initfail
), BFA_IOCPF_INITFAIL
},
211 {BFA_SM(bfa_iocpf_sm_fail_sync
), BFA_IOCPF_FAIL
},
212 {BFA_SM(bfa_iocpf_sm_fail
), BFA_IOCPF_FAIL
},
213 {BFA_SM(bfa_iocpf_sm_disabling
), BFA_IOCPF_DISABLING
},
214 {BFA_SM(bfa_iocpf_sm_disabling_sync
), BFA_IOCPF_DISABLING
},
215 {BFA_SM(bfa_iocpf_sm_disabled
), BFA_IOCPF_DISABLED
},
223 * Beginning state. IOC uninit state.
226 bfa_ioc_sm_uninit_entry(struct bfa_ioc
*ioc
)
231 * IOC is in uninit state.
234 bfa_ioc_sm_uninit(struct bfa_ioc
*ioc
, enum ioc_event event
)
238 bfa_fsm_set_state(ioc
, bfa_ioc_sm_reset
);
242 bfa_sm_fault(ioc
, event
);
247 * Reset entry actions -- initialize state machine
250 bfa_ioc_sm_reset_entry(struct bfa_ioc
*ioc
)
252 bfa_fsm_set_state(&ioc
->iocpf
, bfa_iocpf_sm_reset
);
256 * IOC is in reset state.
259 bfa_ioc_sm_reset(struct bfa_ioc
*ioc
, enum ioc_event event
)
263 bfa_fsm_set_state(ioc
, bfa_ioc_sm_enabling
);
267 bfa_ioc_disable_comp(ioc
);
271 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
275 bfa_sm_fault(ioc
, event
);
280 bfa_ioc_sm_enabling_entry(struct bfa_ioc
*ioc
)
282 bfa_iocpf_enable(ioc
);
286 * Host IOC function is being enabled, awaiting response from firmware.
287 * Semaphore is acquired.
290 bfa_ioc_sm_enabling(struct bfa_ioc
*ioc
, enum ioc_event event
)
294 bfa_fsm_set_state(ioc
, bfa_ioc_sm_getattr
);
298 /* !!! fall through !!! */
300 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
301 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail_retry
);
302 if (event
!= IOC_E_PFAILED
)
303 bfa_iocpf_initfail(ioc
);
307 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
311 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
319 bfa_sm_fault(ioc
, event
);
324 * Semaphore should be acquired for version check.
327 bfa_ioc_sm_getattr_entry(struct bfa_ioc
*ioc
)
329 mod_timer(&ioc
->ioc_timer
, jiffies
+
330 msecs_to_jiffies(BFA_IOC_TOV
));
331 bfa_ioc_send_getattr(ioc
);
335 * IOC configuration in progress. Timer is active.
338 bfa_ioc_sm_getattr(struct bfa_ioc
*ioc
, enum ioc_event event
)
341 case IOC_E_FWRSP_GETATTR
:
342 del_timer(&ioc
->ioc_timer
);
343 bfa_ioc_check_attr_wwns(ioc
);
344 bfa_fsm_set_state(ioc
, bfa_ioc_sm_op
);
349 del_timer(&ioc
->ioc_timer
);
352 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
353 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail_retry
);
354 if (event
!= IOC_E_PFAILED
)
355 bfa_iocpf_getattrfail(ioc
);
359 del_timer(&ioc
->ioc_timer
);
360 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
367 bfa_sm_fault(ioc
, event
);
372 bfa_ioc_sm_op_entry(struct bfa_ioc
*ioc
)
374 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_OK
);
375 bfa_ioc_hb_monitor(ioc
);
379 bfa_ioc_sm_op(struct bfa_ioc
*ioc
, enum ioc_event event
)
386 bfa_ioc_hb_stop(ioc
);
387 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
392 bfa_ioc_hb_stop(ioc
);
393 /* !!! fall through !!! */
395 bfa_ioc_fail_notify(ioc
);
396 if (ioc
->iocpf
.auto_recover
)
397 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail_retry
);
399 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail
);
401 if (event
!= IOC_E_PFAILED
)
406 bfa_sm_fault(ioc
, event
);
411 bfa_ioc_sm_disabling_entry(struct bfa_ioc
*ioc
)
413 bfa_iocpf_disable(ioc
);
417 * IOC is being desabled
420 bfa_ioc_sm_disabling(struct bfa_ioc
*ioc
, enum ioc_event event
)
424 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabled
);
429 * No state change. Will move to disabled state
430 * after iocpf sm completes failure processing and
431 * moves to disabled state.
437 bfa_sm_fault(ioc
, event
);
442 * IOC desable completion entry.
445 bfa_ioc_sm_disabled_entry(struct bfa_ioc
*ioc
)
447 bfa_ioc_disable_comp(ioc
);
451 bfa_ioc_sm_disabled(struct bfa_ioc
*ioc
, enum ioc_event event
)
455 bfa_fsm_set_state(ioc
, bfa_ioc_sm_enabling
);
459 ioc
->cbfn
->disable_cbfn(ioc
->bfa
);
463 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
468 bfa_sm_fault(ioc
, event
);
473 bfa_ioc_sm_fail_retry_entry(struct bfa_ioc
*ioc
)
478 * Hardware initialization retry.
481 bfa_ioc_sm_fail_retry(struct bfa_ioc
*ioc
, enum ioc_event event
)
485 bfa_fsm_set_state(ioc
, bfa_ioc_sm_getattr
);
491 * Initialization retry failed.
493 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
494 if (event
!= IOC_E_PFAILED
)
495 bfa_iocpf_initfail(ioc
);
498 case IOC_E_INITFAILED
:
499 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail
);
506 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
510 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
515 bfa_sm_fault(ioc
, event
);
520 bfa_ioc_sm_fail_entry(struct bfa_ioc
*ioc
)
528 bfa_ioc_sm_fail(struct bfa_ioc
*ioc
, enum ioc_event event
)
532 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
536 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
540 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
545 /* HB failure notification, ignore. */
549 bfa_sm_fault(ioc
, event
);
554 * IOCPF State Machine
558 * Reset entry actions -- initialize state machine
561 bfa_iocpf_sm_reset_entry(struct bfa_iocpf
*iocpf
)
563 iocpf
->retry_count
= 0;
564 iocpf
->auto_recover
= bfa_nw_auto_recover
;
568 * Beginning state. IOC is in reset state.
571 bfa_iocpf_sm_reset(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
575 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fwcheck
);
582 bfa_sm_fault(iocpf
->ioc
, event
);
587 * Semaphore should be acquired for version check.
590 bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf
*iocpf
)
592 bfa_ioc_hw_sem_get(iocpf
->ioc
);
596 * Awaiting h/w semaphore to continue with version check.
599 bfa_iocpf_sm_fwcheck(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
601 struct bfa_ioc
*ioc
= iocpf
->ioc
;
604 case IOCPF_E_SEMLOCKED
:
605 if (bfa_ioc_firmware_lock(ioc
)) {
606 if (bfa_ioc_sync_start(ioc
)) {
607 iocpf
->retry_count
= 0;
608 bfa_ioc_sync_join(ioc
);
609 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
611 bfa_ioc_firmware_unlock(ioc
);
612 bfa_nw_ioc_hw_sem_release(ioc
);
613 mod_timer(&ioc
->sem_timer
, jiffies
+
614 msecs_to_jiffies(BFA_IOC_HWSEM_TOV
));
617 bfa_nw_ioc_hw_sem_release(ioc
);
618 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_mismatch
);
622 case IOCPF_E_DISABLE
:
623 bfa_ioc_hw_sem_get_cancel(ioc
);
624 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
625 bfa_ioc_pf_disabled(ioc
);
629 bfa_ioc_hw_sem_get_cancel(ioc
);
630 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
634 bfa_sm_fault(ioc
, event
);
639 * Notify enable completion callback
642 bfa_iocpf_sm_mismatch_entry(struct bfa_iocpf
*iocpf
)
644 /* Call only the first time sm enters fwmismatch state. */
645 if (iocpf
->retry_count
== 0)
646 bfa_ioc_pf_fwmismatch(iocpf
->ioc
);
648 iocpf
->retry_count
++;
649 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
650 msecs_to_jiffies(BFA_IOC_TOV
));
654 * Awaiting firmware version match.
657 bfa_iocpf_sm_mismatch(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
659 struct bfa_ioc
*ioc
= iocpf
->ioc
;
662 case IOCPF_E_TIMEOUT
:
663 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fwcheck
);
666 case IOCPF_E_DISABLE
:
667 del_timer(&ioc
->iocpf_timer
);
668 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
669 bfa_ioc_pf_disabled(ioc
);
673 del_timer(&ioc
->iocpf_timer
);
674 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
678 bfa_sm_fault(ioc
, event
);
683 * Request for semaphore.
686 bfa_iocpf_sm_semwait_entry(struct bfa_iocpf
*iocpf
)
688 bfa_ioc_hw_sem_get(iocpf
->ioc
);
692 * Awaiting semaphore for h/w initialzation.
695 bfa_iocpf_sm_semwait(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
697 struct bfa_ioc
*ioc
= iocpf
->ioc
;
700 case IOCPF_E_SEMLOCKED
:
701 if (bfa_ioc_sync_complete(ioc
)) {
702 bfa_ioc_sync_join(ioc
);
703 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
705 bfa_nw_ioc_hw_sem_release(ioc
);
706 mod_timer(&ioc
->sem_timer
, jiffies
+
707 msecs_to_jiffies(BFA_IOC_HWSEM_TOV
));
711 case IOCPF_E_DISABLE
:
712 bfa_ioc_hw_sem_get_cancel(ioc
);
713 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
717 bfa_sm_fault(ioc
, event
);
722 bfa_iocpf_sm_hwinit_entry(struct bfa_iocpf
*iocpf
)
724 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
725 msecs_to_jiffies(BFA_IOC_TOV
));
726 bfa_ioc_reset(iocpf
->ioc
, 0);
730 * Hardware is being initialized. Interrupts are enabled.
731 * Holding hardware semaphore lock.
734 bfa_iocpf_sm_hwinit(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
736 struct bfa_ioc
*ioc
= iocpf
->ioc
;
739 case IOCPF_E_FWREADY
:
740 del_timer(&ioc
->iocpf_timer
);
741 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_enabling
);
744 case IOCPF_E_INITFAIL
:
745 del_timer(&ioc
->iocpf_timer
);
747 * !!! fall through !!!
750 case IOCPF_E_TIMEOUT
:
751 bfa_nw_ioc_hw_sem_release(ioc
);
752 if (event
== IOCPF_E_TIMEOUT
)
753 bfa_ioc_pf_failed(ioc
);
754 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
757 case IOCPF_E_DISABLE
:
758 del_timer(&ioc
->iocpf_timer
);
759 bfa_ioc_sync_leave(ioc
);
760 bfa_nw_ioc_hw_sem_release(ioc
);
761 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
765 bfa_sm_fault(ioc
, event
);
770 bfa_iocpf_sm_enabling_entry(struct bfa_iocpf
*iocpf
)
772 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
773 msecs_to_jiffies(BFA_IOC_TOV
));
774 bfa_ioc_send_enable(iocpf
->ioc
);
778 * Host IOC function is being enabled, awaiting response from firmware.
779 * Semaphore is acquired.
782 bfa_iocpf_sm_enabling(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
784 struct bfa_ioc
*ioc
= iocpf
->ioc
;
787 case IOCPF_E_FWRSP_ENABLE
:
788 del_timer(&ioc
->iocpf_timer
);
789 bfa_nw_ioc_hw_sem_release(ioc
);
790 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_ready
);
793 case IOCPF_E_INITFAIL
:
794 del_timer(&ioc
->iocpf_timer
);
796 * !!! fall through !!!
798 case IOCPF_E_TIMEOUT
:
799 bfa_nw_ioc_hw_sem_release(ioc
);
800 if (event
== IOCPF_E_TIMEOUT
)
801 bfa_ioc_pf_failed(ioc
);
802 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
805 case IOCPF_E_DISABLE
:
806 del_timer(&ioc
->iocpf_timer
);
807 bfa_nw_ioc_hw_sem_release(ioc
);
808 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling
);
811 case IOCPF_E_FWREADY
:
812 bfa_ioc_send_enable(ioc
);
816 bfa_sm_fault(ioc
, event
);
821 bfa_nw_ioc_is_operational(struct bfa_ioc
*ioc
)
823 return bfa_fsm_cmp_state(ioc
, bfa_ioc_sm_op
);
827 bfa_iocpf_sm_ready_entry(struct bfa_iocpf
*iocpf
)
829 bfa_ioc_pf_enabled(iocpf
->ioc
);
833 bfa_iocpf_sm_ready(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
835 struct bfa_ioc
*ioc
= iocpf
->ioc
;
838 case IOCPF_E_DISABLE
:
839 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling
);
842 case IOCPF_E_GETATTRFAIL
:
843 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
847 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fail_sync
);
850 case IOCPF_E_FWREADY
:
851 bfa_ioc_pf_failed(ioc
);
852 if (bfa_nw_ioc_is_operational(ioc
))
853 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fail_sync
);
855 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
859 bfa_sm_fault(ioc
, event
);
864 bfa_iocpf_sm_disabling_entry(struct bfa_iocpf
*iocpf
)
866 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
867 msecs_to_jiffies(BFA_IOC_TOV
));
868 bfa_ioc_send_disable(iocpf
->ioc
);
872 * IOC is being disabled
875 bfa_iocpf_sm_disabling(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
877 struct bfa_ioc
*ioc
= iocpf
->ioc
;
880 case IOCPF_E_FWRSP_DISABLE
:
881 case IOCPF_E_FWREADY
:
882 del_timer(&ioc
->iocpf_timer
);
883 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
887 del_timer(&ioc
->iocpf_timer
);
889 * !!! fall through !!!
892 case IOCPF_E_TIMEOUT
:
893 writel(BFI_IOC_FAIL
, ioc
->ioc_regs
.ioc_fwstate
);
894 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
897 case IOCPF_E_FWRSP_ENABLE
:
901 bfa_sm_fault(ioc
, event
);
906 bfa_iocpf_sm_disabling_sync_entry(struct bfa_iocpf
*iocpf
)
908 bfa_ioc_hw_sem_get(iocpf
->ioc
);
912 * IOC hb ack request is being removed.
915 bfa_iocpf_sm_disabling_sync(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
917 struct bfa_ioc
*ioc
= iocpf
->ioc
;
920 case IOCPF_E_SEMLOCKED
:
921 bfa_ioc_sync_leave(ioc
);
922 bfa_nw_ioc_hw_sem_release(ioc
);
923 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
930 bfa_sm_fault(ioc
, event
);
935 * IOC disable completion entry.
938 bfa_iocpf_sm_disabled_entry(struct bfa_iocpf
*iocpf
)
940 bfa_ioc_pf_disabled(iocpf
->ioc
);
944 bfa_iocpf_sm_disabled(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
946 struct bfa_ioc
*ioc
= iocpf
->ioc
;
950 iocpf
->retry_count
= 0;
951 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_semwait
);
955 bfa_ioc_firmware_unlock(ioc
);
956 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
960 bfa_sm_fault(ioc
, event
);
965 bfa_iocpf_sm_initfail_sync_entry(struct bfa_iocpf
*iocpf
)
967 bfa_ioc_hw_sem_get(iocpf
->ioc
);
971 * Hardware initialization failed.
974 bfa_iocpf_sm_initfail_sync(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
976 struct bfa_ioc
*ioc
= iocpf
->ioc
;
979 case IOCPF_E_SEMLOCKED
:
980 bfa_ioc_notify_fail(ioc
);
981 bfa_ioc_sync_ack(ioc
);
982 iocpf
->retry_count
++;
983 if (iocpf
->retry_count
>= BFA_IOC_HWINIT_MAX
) {
984 bfa_ioc_sync_leave(ioc
);
985 bfa_nw_ioc_hw_sem_release(ioc
);
986 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail
);
988 if (bfa_ioc_sync_complete(ioc
))
989 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
991 bfa_nw_ioc_hw_sem_release(ioc
);
992 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_semwait
);
997 case IOCPF_E_DISABLE
:
998 bfa_ioc_hw_sem_get_cancel(ioc
);
999 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
1003 bfa_ioc_hw_sem_get_cancel(ioc
);
1004 bfa_ioc_firmware_unlock(ioc
);
1005 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
1012 bfa_sm_fault(ioc
, event
);
1017 bfa_iocpf_sm_initfail_entry(struct bfa_iocpf
*iocpf
)
1019 bfa_ioc_pf_initfailed(iocpf
->ioc
);
1023 * Hardware initialization failed.
1026 bfa_iocpf_sm_initfail(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
1028 struct bfa_ioc
*ioc
= iocpf
->ioc
;
1031 case IOCPF_E_DISABLE
:
1032 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
1036 bfa_ioc_firmware_unlock(ioc
);
1037 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
1041 bfa_sm_fault(ioc
, event
);
1046 bfa_iocpf_sm_fail_sync_entry(struct bfa_iocpf
*iocpf
)
1049 * Mark IOC as failed in hardware and stop firmware.
1051 bfa_ioc_lpu_stop(iocpf
->ioc
);
1054 * Flush any queued up mailbox requests.
1056 bfa_ioc_mbox_hbfail(iocpf
->ioc
);
1057 bfa_ioc_hw_sem_get(iocpf
->ioc
);
1061 * IOC is in failed state.
1064 bfa_iocpf_sm_fail_sync(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
1066 struct bfa_ioc
*ioc
= iocpf
->ioc
;
1069 case IOCPF_E_SEMLOCKED
:
1070 iocpf
->retry_count
= 0;
1071 bfa_ioc_sync_ack(ioc
);
1072 bfa_ioc_notify_fail(ioc
);
1073 if (!iocpf
->auto_recover
) {
1074 bfa_ioc_sync_leave(ioc
);
1075 bfa_nw_ioc_hw_sem_release(ioc
);
1076 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fail
);
1078 if (bfa_ioc_sync_complete(ioc
))
1079 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
1081 bfa_nw_ioc_hw_sem_release(ioc
);
1082 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_semwait
);
1087 case IOCPF_E_DISABLE
:
1088 bfa_ioc_hw_sem_get_cancel(ioc
);
1089 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
1096 bfa_sm_fault(ioc
, event
);
1101 bfa_iocpf_sm_fail_entry(struct bfa_iocpf
*iocpf
)
1107 * IOC is in failed state.
1110 bfa_iocpf_sm_fail(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
1113 case IOCPF_E_DISABLE
:
1114 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
1118 bfa_sm_fault(iocpf
->ioc
, event
);
1123 * BFA IOC private functions
1127 bfa_ioc_disable_comp(struct bfa_ioc
*ioc
)
1129 struct list_head
*qe
;
1130 struct bfa_ioc_hbfail_notify
*notify
;
1132 ioc
->cbfn
->disable_cbfn(ioc
->bfa
);
1135 * Notify common modules registered for notification.
1137 list_for_each(qe
, &ioc
->hb_notify_q
) {
1138 notify
= (struct bfa_ioc_hbfail_notify
*) qe
;
1139 notify
->cbfn(notify
->cbarg
);
1144 bfa_nw_ioc_sem_get(void __iomem
*sem_reg
)
1148 #define BFA_SEM_SPINCNT 3000
1150 r32
= readl(sem_reg
);
1152 while (r32
&& (cnt
< BFA_SEM_SPINCNT
)) {
1155 r32
= readl(sem_reg
);
1161 BUG_ON(!(cnt
< BFA_SEM_SPINCNT
));
1166 bfa_nw_ioc_sem_release(void __iomem
*sem_reg
)
1172 bfa_ioc_hw_sem_get(struct bfa_ioc
*ioc
)
1177 * First read to the semaphore register will return 0, subsequent reads
1178 * will return 1. Semaphore is released by writing 1 to the register
1180 r32
= readl(ioc
->ioc_regs
.ioc_sem_reg
);
1182 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_SEMLOCKED
);
1186 mod_timer(&ioc
->sem_timer
, jiffies
+
1187 msecs_to_jiffies(BFA_IOC_HWSEM_TOV
));
1191 bfa_nw_ioc_hw_sem_release(struct bfa_ioc
*ioc
)
1193 writel(1, ioc
->ioc_regs
.ioc_sem_reg
);
1197 bfa_ioc_hw_sem_get_cancel(struct bfa_ioc
*ioc
)
1199 del_timer(&ioc
->sem_timer
);
1204 * Initialize LPU local memory (aka secondary memory / SRAM)
1207 bfa_ioc_lmem_init(struct bfa_ioc
*ioc
)
1211 #define PSS_LMEM_INIT_TIME 10000
1213 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1214 pss_ctl
&= ~__PSS_LMEM_RESET
;
1215 pss_ctl
|= __PSS_LMEM_INIT_EN
;
1218 * i2c workaround 12.5khz clock
1220 pss_ctl
|= __PSS_I2C_CLK_DIV(3UL);
1221 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1224 * wait for memory initialization to be complete
1228 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1230 } while (!(pss_ctl
& __PSS_LMEM_INIT_DONE
) && (i
< PSS_LMEM_INIT_TIME
));
1233 * If memory initialization is not successful, IOC timeout will catch
1236 BUG_ON(!(pss_ctl
& __PSS_LMEM_INIT_DONE
));
1238 pss_ctl
&= ~(__PSS_LMEM_INIT_DONE
| __PSS_LMEM_INIT_EN
);
1239 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1243 bfa_ioc_lpu_start(struct bfa_ioc
*ioc
)
1248 * Take processor out of reset.
1250 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1251 pss_ctl
&= ~__PSS_LPU0_RESET
;
1253 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1257 bfa_ioc_lpu_stop(struct bfa_ioc
*ioc
)
1262 * Put processors in reset.
1264 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1265 pss_ctl
|= (__PSS_LPU0_RESET
| __PSS_LPU1_RESET
);
1267 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1271 * Get driver and firmware versions.
1274 bfa_nw_ioc_fwver_get(struct bfa_ioc
*ioc
, struct bfi_ioc_image_hdr
*fwhdr
)
1279 u32
*fwsig
= (u32
*) fwhdr
;
1281 pgnum
= bfa_ioc_smem_pgnum(ioc
, loff
);
1282 writel(pgnum
, ioc
->ioc_regs
.host_page_num_fn
);
1284 for (i
= 0; i
< (sizeof(struct bfi_ioc_image_hdr
) / sizeof(u32
));
1287 swab32(readl((loff
) + (ioc
->ioc_regs
.smem_page_start
)));
1288 loff
+= sizeof(u32
);
1293 * Returns TRUE if same.
1296 bfa_nw_ioc_fwver_cmp(struct bfa_ioc
*ioc
, struct bfi_ioc_image_hdr
*fwhdr
)
1298 struct bfi_ioc_image_hdr
*drv_fwhdr
;
1301 drv_fwhdr
= (struct bfi_ioc_image_hdr
*)
1302 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
), 0);
1304 for (i
= 0; i
< BFI_IOC_MD5SUM_SZ
; i
++) {
1305 if (fwhdr
->md5sum
[i
] != drv_fwhdr
->md5sum
[i
])
1313 * Return true if current running version is valid. Firmware signature and
1314 * execution context (driver/bios) must match.
1317 bfa_ioc_fwver_valid(struct bfa_ioc
*ioc
, u32 boot_env
)
1319 struct bfi_ioc_image_hdr fwhdr
, *drv_fwhdr
;
1321 bfa_nw_ioc_fwver_get(ioc
, &fwhdr
);
1322 drv_fwhdr
= (struct bfi_ioc_image_hdr
*)
1323 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
), 0);
1325 if (fwhdr
.signature
!= drv_fwhdr
->signature
)
1328 if (swab32(fwhdr
.param
) != boot_env
)
1331 return bfa_nw_ioc_fwver_cmp(ioc
, &fwhdr
);
1335 * Conditionally flush any pending message from firmware at start.
1338 bfa_ioc_msgflush(struct bfa_ioc
*ioc
)
1342 r32
= readl(ioc
->ioc_regs
.lpu_mbox_cmd
);
1344 writel(1, ioc
->ioc_regs
.lpu_mbox_cmd
);
1348 * @img ioc_init_logic.jpg
1351 bfa_ioc_hwinit(struct bfa_ioc
*ioc
, bool force
)
1353 enum bfi_ioc_state ioc_fwstate
;
1357 ioc_fwstate
= readl(ioc
->ioc_regs
.ioc_fwstate
);
1359 boot_env
= BFI_BOOT_LOADER_OS
;
1362 ioc_fwstate
= BFI_IOC_UNINIT
;
1365 * check if firmware is valid
1367 fwvalid
= (ioc_fwstate
== BFI_IOC_UNINIT
) ?
1368 false : bfa_ioc_fwver_valid(ioc
, boot_env
);
1371 bfa_ioc_boot(ioc
, BFI_BOOT_TYPE_NORMAL
, boot_env
);
1376 * If hardware initialization is in progress (initialized by other IOC),
1377 * just wait for an initialization completion interrupt.
1379 if (ioc_fwstate
== BFI_IOC_INITING
) {
1380 ioc
->cbfn
->reset_cbfn(ioc
->bfa
);
1385 * If IOC function is disabled and firmware version is same,
1386 * just re-enable IOC.
1388 if (ioc_fwstate
== BFI_IOC_DISABLED
|| ioc_fwstate
== BFI_IOC_OP
) {
1390 * When using MSI-X any pending firmware ready event should
1391 * be flushed. Otherwise MSI-X interrupts are not delivered.
1393 bfa_ioc_msgflush(ioc
);
1394 ioc
->cbfn
->reset_cbfn(ioc
->bfa
);
1395 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_FWREADY
);
1400 * Initialize the h/w for any other states.
1402 bfa_ioc_boot(ioc
, BFI_BOOT_TYPE_NORMAL
, boot_env
);
1406 bfa_nw_ioc_timeout(void *ioc_arg
)
1408 struct bfa_ioc
*ioc
= (struct bfa_ioc
*) ioc_arg
;
1410 bfa_fsm_send_event(ioc
, IOC_E_TIMEOUT
);
1414 bfa_ioc_mbox_send(struct bfa_ioc
*ioc
, void *ioc_msg
, int len
)
1416 u32
*msgp
= (u32
*) ioc_msg
;
1419 BUG_ON(!(len
<= BFI_IOC_MSGLEN_MAX
));
1422 * first write msg to mailbox registers
1424 for (i
= 0; i
< len
/ sizeof(u32
); i
++)
1425 writel(cpu_to_le32(msgp
[i
]),
1426 ioc
->ioc_regs
.hfn_mbox
+ i
* sizeof(u32
));
1428 for (; i
< BFI_IOC_MSGLEN_MAX
/ sizeof(u32
); i
++)
1429 writel(0, ioc
->ioc_regs
.hfn_mbox
+ i
* sizeof(u32
));
1432 * write 1 to mailbox CMD to trigger LPU event
1434 writel(1, ioc
->ioc_regs
.hfn_mbox_cmd
);
1435 (void) readl(ioc
->ioc_regs
.hfn_mbox_cmd
);
1439 bfa_ioc_send_enable(struct bfa_ioc
*ioc
)
1441 struct bfi_ioc_ctrl_req enable_req
;
1444 bfi_h2i_set(enable_req
.mh
, BFI_MC_IOC
, BFI_IOC_H2I_ENABLE_REQ
,
1445 bfa_ioc_portid(ioc
));
1446 enable_req
.ioc_class
= ioc
->ioc_mc
;
1447 do_gettimeofday(&tv
);
1448 enable_req
.tv_sec
= ntohl(tv
.tv_sec
);
1449 bfa_ioc_mbox_send(ioc
, &enable_req
, sizeof(struct bfi_ioc_ctrl_req
));
1453 bfa_ioc_send_disable(struct bfa_ioc
*ioc
)
1455 struct bfi_ioc_ctrl_req disable_req
;
1457 bfi_h2i_set(disable_req
.mh
, BFI_MC_IOC
, BFI_IOC_H2I_DISABLE_REQ
,
1458 bfa_ioc_portid(ioc
));
1459 bfa_ioc_mbox_send(ioc
, &disable_req
, sizeof(struct bfi_ioc_ctrl_req
));
1463 bfa_ioc_send_getattr(struct bfa_ioc
*ioc
)
1465 struct bfi_ioc_getattr_req attr_req
;
1467 bfi_h2i_set(attr_req
.mh
, BFI_MC_IOC
, BFI_IOC_H2I_GETATTR_REQ
,
1468 bfa_ioc_portid(ioc
));
1469 bfa_dma_be_addr_set(attr_req
.attr_addr
, ioc
->attr_dma
.pa
);
1470 bfa_ioc_mbox_send(ioc
, &attr_req
, sizeof(attr_req
));
1474 bfa_nw_ioc_hb_check(void *cbarg
)
1476 struct bfa_ioc
*ioc
= cbarg
;
1479 hb_count
= readl(ioc
->ioc_regs
.heartbeat
);
1480 if (ioc
->hb_count
== hb_count
) {
1481 bfa_ioc_recover(ioc
);
1484 ioc
->hb_count
= hb_count
;
1487 bfa_ioc_mbox_poll(ioc
);
1488 mod_timer(&ioc
->hb_timer
, jiffies
+
1489 msecs_to_jiffies(BFA_IOC_HB_TOV
));
1493 bfa_ioc_hb_monitor(struct bfa_ioc
*ioc
)
1495 ioc
->hb_count
= readl(ioc
->ioc_regs
.heartbeat
);
1496 mod_timer(&ioc
->hb_timer
, jiffies
+
1497 msecs_to_jiffies(BFA_IOC_HB_TOV
));
1501 bfa_ioc_hb_stop(struct bfa_ioc
*ioc
)
1503 del_timer(&ioc
->hb_timer
);
1508 * Initiate a full firmware download.
1511 bfa_ioc_download_fw(struct bfa_ioc
*ioc
, u32 boot_type
,
1521 * Initialize LMEM first before code download
1523 bfa_ioc_lmem_init(ioc
);
1525 fwimg
= bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
), chunkno
);
1527 pgnum
= bfa_ioc_smem_pgnum(ioc
, loff
);
1529 writel(pgnum
, ioc
->ioc_regs
.host_page_num_fn
);
1531 for (i
= 0; i
< bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc
)); i
++) {
1532 if (BFA_IOC_FLASH_CHUNK_NO(i
) != chunkno
) {
1533 chunkno
= BFA_IOC_FLASH_CHUNK_NO(i
);
1534 fwimg
= bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
),
1535 BFA_IOC_FLASH_CHUNK_ADDR(chunkno
));
1541 writel((swab32(fwimg
[BFA_IOC_FLASH_OFFSET_IN_CHUNK(i
)])),
1542 ((ioc
->ioc_regs
.smem_page_start
) + (loff
)));
1544 loff
+= sizeof(u32
);
1547 * handle page offset wrap around
1549 loff
= PSS_SMEM_PGOFF(loff
);
1553 ioc
->ioc_regs
.host_page_num_fn
);
1557 writel(bfa_ioc_smem_pgnum(ioc
, 0),
1558 ioc
->ioc_regs
.host_page_num_fn
);
1561 * Set boot type and boot param at the end.
1563 writel(boot_type
, ((ioc
->ioc_regs
.smem_page_start
)
1564 + (BFI_BOOT_TYPE_OFF
)));
1565 writel(boot_env
, ((ioc
->ioc_regs
.smem_page_start
)
1566 + (BFI_BOOT_LOADER_OFF
)));
1570 bfa_ioc_reset(struct bfa_ioc
*ioc
, bool force
)
1572 bfa_ioc_hwinit(ioc
, force
);
1577 * Update BFA configuration from firmware configuration.
1580 bfa_ioc_getattr_reply(struct bfa_ioc
*ioc
)
1582 struct bfi_ioc_attr
*attr
= ioc
->attr
;
1584 attr
->adapter_prop
= ntohl(attr
->adapter_prop
);
1585 attr
->card_type
= ntohl(attr
->card_type
);
1586 attr
->maxfrsize
= ntohs(attr
->maxfrsize
);
1588 bfa_fsm_send_event(ioc
, IOC_E_FWRSP_GETATTR
);
1592 * Attach time initialization of mbox logic.
1595 bfa_ioc_mbox_attach(struct bfa_ioc
*ioc
)
1597 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1600 INIT_LIST_HEAD(&mod
->cmd_q
);
1601 for (mc
= 0; mc
< BFI_MC_MAX
; mc
++) {
1602 mod
->mbhdlr
[mc
].cbfn
= NULL
;
1603 mod
->mbhdlr
[mc
].cbarg
= ioc
->bfa
;
1608 * Mbox poll timer -- restarts any pending mailbox requests.
1611 bfa_ioc_mbox_poll(struct bfa_ioc
*ioc
)
1613 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1614 struct bfa_mbox_cmd
*cmd
;
1618 * If no command pending, do nothing
1620 if (list_empty(&mod
->cmd_q
))
1624 * If previous command is not yet fetched by firmware, do nothing
1626 stat
= readl(ioc
->ioc_regs
.hfn_mbox_cmd
);
1631 * Enqueue command to firmware.
1633 bfa_q_deq(&mod
->cmd_q
, &cmd
);
1634 bfa_ioc_mbox_send(ioc
, cmd
->msg
, sizeof(cmd
->msg
));
1638 * Cleanup any pending requests.
1641 bfa_ioc_mbox_hbfail(struct bfa_ioc
*ioc
)
1643 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1644 struct bfa_mbox_cmd
*cmd
;
1646 while (!list_empty(&mod
->cmd_q
))
1647 bfa_q_deq(&mod
->cmd_q
, &cmd
);
1651 bfa_ioc_fail_notify(struct bfa_ioc
*ioc
)
1653 struct list_head
*qe
;
1654 struct bfa_ioc_hbfail_notify
*notify
;
1657 * Notify driver and common modules registered for notification.
1659 ioc
->cbfn
->hbfail_cbfn(ioc
->bfa
);
1660 list_for_each(qe
, &ioc
->hb_notify_q
) {
1661 notify
= (struct bfa_ioc_hbfail_notify
*) qe
;
1662 notify
->cbfn(notify
->cbarg
);
1667 bfa_ioc_pf_enabled(struct bfa_ioc
*ioc
)
1669 bfa_fsm_send_event(ioc
, IOC_E_ENABLED
);
1673 bfa_ioc_pf_disabled(struct bfa_ioc
*ioc
)
1675 bfa_fsm_send_event(ioc
, IOC_E_DISABLED
);
1679 bfa_ioc_pf_initfailed(struct bfa_ioc
*ioc
)
1681 bfa_fsm_send_event(ioc
, IOC_E_INITFAILED
);
1685 bfa_ioc_pf_failed(struct bfa_ioc
*ioc
)
1687 bfa_fsm_send_event(ioc
, IOC_E_PFAILED
);
1691 bfa_ioc_pf_fwmismatch(struct bfa_ioc
*ioc
)
1694 * Provide enable completion callback and AEN notification.
1696 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
1702 static enum bfa_status
1703 bfa_ioc_pll_init(struct bfa_ioc
*ioc
)
1706 * Hold semaphore so that nobody can access the chip during init.
1708 bfa_nw_ioc_sem_get(ioc
->ioc_regs
.ioc_init_sem_reg
);
1710 bfa_ioc_pll_init_asic(ioc
);
1712 ioc
->pllinit
= true;
1714 * release semaphore.
1716 bfa_nw_ioc_sem_release(ioc
->ioc_regs
.ioc_init_sem_reg
);
1718 return BFA_STATUS_OK
;
1722 * Interface used by diag module to do firmware boot with memory test
1723 * as the entry vector.
1726 bfa_ioc_boot(struct bfa_ioc
*ioc
, u32 boot_type
, u32 boot_env
)
1730 bfa_ioc_stats(ioc
, ioc_boots
);
1732 if (bfa_ioc_pll_init(ioc
) != BFA_STATUS_OK
)
1736 * Initialize IOC state of all functions on a chip reset.
1738 rb
= ioc
->pcidev
.pci_bar_kva
;
1739 if (boot_type
== BFI_BOOT_TYPE_MEMTEST
) {
1740 writel(BFI_IOC_MEMTEST
, (rb
+ BFA_IOC0_STATE_REG
));
1741 writel(BFI_IOC_MEMTEST
, (rb
+ BFA_IOC1_STATE_REG
));
1743 writel(BFI_IOC_INITING
, (rb
+ BFA_IOC0_STATE_REG
));
1744 writel(BFI_IOC_INITING
, (rb
+ BFA_IOC1_STATE_REG
));
1747 bfa_ioc_msgflush(ioc
);
1748 bfa_ioc_download_fw(ioc
, boot_type
, boot_env
);
1751 * Enable interrupts just before starting LPU
1753 ioc
->cbfn
->reset_cbfn(ioc
->bfa
);
1754 bfa_ioc_lpu_start(ioc
);
1758 * Enable/disable IOC failure auto recovery.
1761 bfa_nw_ioc_auto_recover(bool auto_recover
)
1763 bfa_nw_auto_recover
= auto_recover
;
1767 bfa_ioc_msgget(struct bfa_ioc
*ioc
, void *mbmsg
)
1776 for (i
= 0; i
< (sizeof(union bfi_ioc_i2h_msg_u
) / sizeof(u32
));
1778 r32
= readl(ioc
->ioc_regs
.lpu_mbox
+
1780 msgp
[i
] = htonl(r32
);
1784 * turn off mailbox interrupt by clearing mailbox status
1786 writel(1, ioc
->ioc_regs
.lpu_mbox_cmd
);
1787 readl(ioc
->ioc_regs
.lpu_mbox_cmd
);
1791 bfa_ioc_isr(struct bfa_ioc
*ioc
, struct bfi_mbmsg
*m
)
1793 union bfi_ioc_i2h_msg_u
*msg
;
1794 struct bfa_iocpf
*iocpf
= &ioc
->iocpf
;
1796 msg
= (union bfi_ioc_i2h_msg_u
*) m
;
1798 bfa_ioc_stats(ioc
, ioc_isrs
);
1800 switch (msg
->mh
.msg_id
) {
1801 case BFI_IOC_I2H_HBEAT
:
1804 case BFI_IOC_I2H_READY_EVENT
:
1805 bfa_fsm_send_event(iocpf
, IOCPF_E_FWREADY
);
1808 case BFI_IOC_I2H_ENABLE_REPLY
:
1809 bfa_fsm_send_event(iocpf
, IOCPF_E_FWRSP_ENABLE
);
1812 case BFI_IOC_I2H_DISABLE_REPLY
:
1813 bfa_fsm_send_event(iocpf
, IOCPF_E_FWRSP_DISABLE
);
1816 case BFI_IOC_I2H_GETATTR_REPLY
:
1817 bfa_ioc_getattr_reply(ioc
);
1826 * IOC attach time initialization and setup.
1828 * @param[in] ioc memory for IOC
1829 * @param[in] bfa driver instance structure
1832 bfa_nw_ioc_attach(struct bfa_ioc
*ioc
, void *bfa
, struct bfa_ioc_cbfn
*cbfn
)
1836 ioc
->fcmode
= false;
1837 ioc
->pllinit
= false;
1838 ioc
->dbg_fwsave_once
= true;
1839 ioc
->iocpf
.ioc
= ioc
;
1841 bfa_ioc_mbox_attach(ioc
);
1842 INIT_LIST_HEAD(&ioc
->hb_notify_q
);
1844 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
1845 bfa_fsm_send_event(ioc
, IOC_E_RESET
);
1849 * Driver detach time IOC cleanup.
1852 bfa_nw_ioc_detach(struct bfa_ioc
*ioc
)
1854 bfa_fsm_send_event(ioc
, IOC_E_DETACH
);
1858 * Setup IOC PCI properties.
1860 * @param[in] pcidev PCI device information for this IOC
1863 bfa_nw_ioc_pci_init(struct bfa_ioc
*ioc
, struct bfa_pcidev
*pcidev
,
1867 ioc
->pcidev
= *pcidev
;
1868 ioc
->ctdev
= bfa_asic_id_ct(ioc
->pcidev
.device_id
);
1869 ioc
->cna
= ioc
->ctdev
&& !ioc
->fcmode
;
1871 bfa_nw_ioc_set_ct_hwif(ioc
);
1873 bfa_ioc_map_port(ioc
);
1874 bfa_ioc_reg_init(ioc
);
1878 * Initialize IOC dma memory
1880 * @param[in] dm_kva kernel virtual address of IOC dma memory
1881 * @param[in] dm_pa physical address of IOC dma memory
1884 bfa_nw_ioc_mem_claim(struct bfa_ioc
*ioc
, u8
*dm_kva
, u64 dm_pa
)
1887 * dma memory for firmware attribute
1889 ioc
->attr_dma
.kva
= dm_kva
;
1890 ioc
->attr_dma
.pa
= dm_pa
;
1891 ioc
->attr
= (struct bfi_ioc_attr
*) dm_kva
;
1895 * Return size of dma memory required.
1898 bfa_nw_ioc_meminfo(void)
1900 return roundup(sizeof(struct bfi_ioc_attr
), BFA_DMA_ALIGN_SZ
);
1904 bfa_nw_ioc_enable(struct bfa_ioc
*ioc
)
1906 bfa_ioc_stats(ioc
, ioc_enables
);
1907 ioc
->dbg_fwsave_once
= true;
1909 bfa_fsm_send_event(ioc
, IOC_E_ENABLE
);
1913 bfa_nw_ioc_disable(struct bfa_ioc
*ioc
)
1915 bfa_ioc_stats(ioc
, ioc_disables
);
1916 bfa_fsm_send_event(ioc
, IOC_E_DISABLE
);
1920 bfa_ioc_smem_pgnum(struct bfa_ioc
*ioc
, u32 fmaddr
)
1922 return PSS_SMEM_PGNUM(ioc
->ioc_regs
.smem_pg0
, fmaddr
);
1926 * Register mailbox message handler function, to be called by common modules
1929 bfa_nw_ioc_mbox_regisr(struct bfa_ioc
*ioc
, enum bfi_mclass mc
,
1930 bfa_ioc_mbox_mcfunc_t cbfn
, void *cbarg
)
1932 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1934 mod
->mbhdlr
[mc
].cbfn
= cbfn
;
1935 mod
->mbhdlr
[mc
].cbarg
= cbarg
;
1939 * Queue a mailbox command request to firmware. Waits if mailbox is busy.
1940 * Responsibility of caller to serialize
1942 * @param[in] ioc IOC instance
1943 * @param[i] cmd Mailbox command
1946 bfa_nw_ioc_mbox_queue(struct bfa_ioc
*ioc
, struct bfa_mbox_cmd
*cmd
)
1948 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1952 * If a previous command is pending, queue new command
1954 if (!list_empty(&mod
->cmd_q
)) {
1955 list_add_tail(&cmd
->qe
, &mod
->cmd_q
);
1960 * If mailbox is busy, queue command for poll timer
1962 stat
= readl(ioc
->ioc_regs
.hfn_mbox_cmd
);
1964 list_add_tail(&cmd
->qe
, &mod
->cmd_q
);
1969 * mailbox is free -- queue command to firmware
1971 bfa_ioc_mbox_send(ioc
, cmd
->msg
, sizeof(cmd
->msg
));
1975 * Handle mailbox interrupts
1978 bfa_nw_ioc_mbox_isr(struct bfa_ioc
*ioc
)
1980 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1984 bfa_ioc_msgget(ioc
, &m
);
1987 * Treat IOC message class as special.
1989 mc
= m
.mh
.msg_class
;
1990 if (mc
== BFI_MC_IOC
) {
1991 bfa_ioc_isr(ioc
, &m
);
1995 if ((mc
>= BFI_MC_MAX
) || (mod
->mbhdlr
[mc
].cbfn
== NULL
))
1998 mod
->mbhdlr
[mc
].cbfn(mod
->mbhdlr
[mc
].cbarg
, &m
);
2002 bfa_nw_ioc_error_isr(struct bfa_ioc
*ioc
)
2004 bfa_fsm_send_event(ioc
, IOC_E_HWERROR
);
2008 * Add to IOC heartbeat failure notification queue. To be used by common
2009 * modules such as cee, port, diag.
2012 bfa_nw_ioc_hbfail_register(struct bfa_ioc
*ioc
,
2013 struct bfa_ioc_hbfail_notify
*notify
)
2015 list_add_tail(¬ify
->qe
, &ioc
->hb_notify_q
);
2018 #define BFA_MFG_NAME "Brocade"
2020 bfa_ioc_get_adapter_attr(struct bfa_ioc
*ioc
,
2021 struct bfa_adapter_attr
*ad_attr
)
2023 struct bfi_ioc_attr
*ioc_attr
;
2025 ioc_attr
= ioc
->attr
;
2027 bfa_ioc_get_adapter_serial_num(ioc
, ad_attr
->serial_num
);
2028 bfa_ioc_get_adapter_fw_ver(ioc
, ad_attr
->fw_ver
);
2029 bfa_ioc_get_adapter_optrom_ver(ioc
, ad_attr
->optrom_ver
);
2030 bfa_ioc_get_adapter_manufacturer(ioc
, ad_attr
->manufacturer
);
2031 memcpy(&ad_attr
->vpd
, &ioc_attr
->vpd
,
2032 sizeof(struct bfa_mfg_vpd
));
2034 ad_attr
->nports
= bfa_ioc_get_nports(ioc
);
2035 ad_attr
->max_speed
= bfa_ioc_speed_sup(ioc
);
2037 bfa_ioc_get_adapter_model(ioc
, ad_attr
->model
);
2038 /* For now, model descr uses same model string */
2039 bfa_ioc_get_adapter_model(ioc
, ad_attr
->model_descr
);
2041 ad_attr
->card_type
= ioc_attr
->card_type
;
2042 ad_attr
->is_mezz
= bfa_mfg_is_mezz(ioc_attr
->card_type
);
2044 if (BFI_ADAPTER_IS_SPECIAL(ioc_attr
->adapter_prop
))
2045 ad_attr
->prototype
= 1;
2047 ad_attr
->prototype
= 0;
2049 ad_attr
->pwwn
= bfa_ioc_get_pwwn(ioc
);
2050 ad_attr
->mac
= bfa_nw_ioc_get_mac(ioc
);
2052 ad_attr
->pcie_gen
= ioc_attr
->pcie_gen
;
2053 ad_attr
->pcie_lanes
= ioc_attr
->pcie_lanes
;
2054 ad_attr
->pcie_lanes_orig
= ioc_attr
->pcie_lanes_orig
;
2055 ad_attr
->asic_rev
= ioc_attr
->asic_rev
;
2057 bfa_ioc_get_pci_chip_rev(ioc
, ad_attr
->hw_ver
);
2059 ad_attr
->cna_capable
= ioc
->cna
;
2060 ad_attr
->trunk_capable
= (ad_attr
->nports
> 1) && !ioc
->cna
;
2063 static enum bfa_ioc_type
2064 bfa_ioc_get_type(struct bfa_ioc
*ioc
)
2066 if (!ioc
->ctdev
|| ioc
->fcmode
)
2067 return BFA_IOC_TYPE_FC
;
2068 else if (ioc
->ioc_mc
== BFI_MC_IOCFC
)
2069 return BFA_IOC_TYPE_FCoE
;
2070 else if (ioc
->ioc_mc
== BFI_MC_LL
)
2071 return BFA_IOC_TYPE_LL
;
2073 BUG_ON(!(ioc
->ioc_mc
== BFI_MC_LL
));
2074 return BFA_IOC_TYPE_LL
;
2079 bfa_ioc_get_adapter_serial_num(struct bfa_ioc
*ioc
, char *serial_num
)
2081 memset(serial_num
, 0, BFA_ADAPTER_SERIAL_NUM_LEN
);
2083 (void *)ioc
->attr
->brcd_serialnum
,
2084 BFA_ADAPTER_SERIAL_NUM_LEN
);
2088 bfa_ioc_get_adapter_fw_ver(struct bfa_ioc
*ioc
, char *fw_ver
)
2090 memset(fw_ver
, 0, BFA_VERSION_LEN
);
2091 memcpy(fw_ver
, ioc
->attr
->fw_version
, BFA_VERSION_LEN
);
2095 bfa_ioc_get_pci_chip_rev(struct bfa_ioc
*ioc
, char *chip_rev
)
2097 BUG_ON(!(chip_rev
));
2099 memset(chip_rev
, 0, BFA_IOC_CHIP_REV_LEN
);
2105 chip_rev
[4] = ioc
->attr
->asic_rev
;
2110 bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc
*ioc
, char *optrom_ver
)
2112 memset(optrom_ver
, 0, BFA_VERSION_LEN
);
2113 memcpy(optrom_ver
, ioc
->attr
->optrom_version
,
2118 bfa_ioc_get_adapter_manufacturer(struct bfa_ioc
*ioc
, char *manufacturer
)
2120 memset(manufacturer
, 0, BFA_ADAPTER_MFG_NAME_LEN
);
2121 memcpy(manufacturer
, BFA_MFG_NAME
, BFA_ADAPTER_MFG_NAME_LEN
);
2125 bfa_ioc_get_adapter_model(struct bfa_ioc
*ioc
, char *model
)
2127 struct bfi_ioc_attr
*ioc_attr
;
2130 memset(model
, 0, BFA_ADAPTER_MODEL_NAME_LEN
);
2132 ioc_attr
= ioc
->attr
;
2137 snprintf(model
, BFA_ADAPTER_MODEL_NAME_LEN
, "%s-%u",
2138 BFA_MFG_NAME
, ioc_attr
->card_type
);
2141 static enum bfa_ioc_state
2142 bfa_ioc_get_state(struct bfa_ioc
*ioc
)
2144 enum bfa_iocpf_state iocpf_st
;
2145 enum bfa_ioc_state ioc_st
= bfa_sm_to_state(ioc_sm_table
, ioc
->fsm
);
2147 if (ioc_st
== BFA_IOC_ENABLING
||
2148 ioc_st
== BFA_IOC_FAIL
|| ioc_st
== BFA_IOC_INITFAIL
) {
2150 iocpf_st
= bfa_sm_to_state(iocpf_sm_table
, ioc
->iocpf
.fsm
);
2153 case BFA_IOCPF_SEMWAIT
:
2154 ioc_st
= BFA_IOC_SEMWAIT
;
2157 case BFA_IOCPF_HWINIT
:
2158 ioc_st
= BFA_IOC_HWINIT
;
2161 case BFA_IOCPF_FWMISMATCH
:
2162 ioc_st
= BFA_IOC_FWMISMATCH
;
2165 case BFA_IOCPF_FAIL
:
2166 ioc_st
= BFA_IOC_FAIL
;
2169 case BFA_IOCPF_INITFAIL
:
2170 ioc_st
= BFA_IOC_INITFAIL
;
2181 bfa_nw_ioc_get_attr(struct bfa_ioc
*ioc
, struct bfa_ioc_attr
*ioc_attr
)
2183 memset((void *)ioc_attr
, 0, sizeof(struct bfa_ioc_attr
));
2185 ioc_attr
->state
= bfa_ioc_get_state(ioc
);
2186 ioc_attr
->port_id
= ioc
->port_id
;
2188 ioc_attr
->ioc_type
= bfa_ioc_get_type(ioc
);
2190 bfa_ioc_get_adapter_attr(ioc
, &ioc_attr
->adapter_attr
);
2192 ioc_attr
->pci_attr
.device_id
= ioc
->pcidev
.device_id
;
2193 ioc_attr
->pci_attr
.pcifn
= ioc
->pcidev
.pci_func
;
2194 bfa_ioc_get_pci_chip_rev(ioc
, ioc_attr
->pci_attr
.chip_rev
);
2201 bfa_ioc_get_pwwn(struct bfa_ioc
*ioc
)
2203 return ioc
->attr
->pwwn
;
2207 bfa_nw_ioc_get_mac(struct bfa_ioc
*ioc
)
2209 return ioc
->attr
->mac
;
2213 * Firmware failure detected. Start recovery actions.
2216 bfa_ioc_recover(struct bfa_ioc
*ioc
)
2218 pr_crit("Heart Beat of IOC has failed\n");
2219 bfa_ioc_stats(ioc
, ioc_hbfails
);
2220 bfa_fsm_send_event(ioc
, IOC_E_HBFAIL
);
2224 bfa_ioc_check_attr_wwns(struct bfa_ioc
*ioc
)
2226 if (bfa_ioc_get_type(ioc
) == BFA_IOC_TYPE_LL
)
2231 * @dg hal_iocpf_pvt BFA IOC PF private functions
2236 bfa_iocpf_enable(struct bfa_ioc
*ioc
)
2238 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_ENABLE
);
2242 bfa_iocpf_disable(struct bfa_ioc
*ioc
)
2244 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_DISABLE
);
2248 bfa_iocpf_fail(struct bfa_ioc
*ioc
)
2250 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_FAIL
);
2254 bfa_iocpf_initfail(struct bfa_ioc
*ioc
)
2256 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_INITFAIL
);
2260 bfa_iocpf_getattrfail(struct bfa_ioc
*ioc
)
2262 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_GETATTRFAIL
);
2266 bfa_iocpf_stop(struct bfa_ioc
*ioc
)
2268 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_STOP
);
2272 bfa_nw_iocpf_timeout(void *ioc_arg
)
2274 struct bfa_ioc
*ioc
= (struct bfa_ioc
*) ioc_arg
;
2276 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_TIMEOUT
);
2280 bfa_nw_iocpf_sem_timeout(void *ioc_arg
)
2282 struct bfa_ioc
*ioc
= (struct bfa_ioc
*) ioc_arg
;
2284 bfa_ioc_hw_sem_get(ioc
);