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_init(struct bfa_ioc
*ioc
);
62 static void bfa_ioc_hw_sem_get(struct bfa_ioc
*ioc
);
63 static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc
*ioc
);
64 static void bfa_ioc_hwinit(struct bfa_ioc
*ioc
, bool force
);
65 static void bfa_ioc_send_enable(struct bfa_ioc
*ioc
);
66 static void bfa_ioc_send_disable(struct bfa_ioc
*ioc
);
67 static void bfa_ioc_send_getattr(struct bfa_ioc
*ioc
);
68 static void bfa_ioc_hb_monitor(struct bfa_ioc
*ioc
);
69 static void bfa_ioc_hb_stop(struct bfa_ioc
*ioc
);
70 static void bfa_ioc_reset(struct bfa_ioc
*ioc
, bool force
);
71 static void bfa_ioc_mbox_poll(struct bfa_ioc
*ioc
);
72 static void bfa_ioc_mbox_flush(struct bfa_ioc
*ioc
);
73 static void bfa_ioc_recover(struct bfa_ioc
*ioc
);
74 static void bfa_ioc_check_attr_wwns(struct bfa_ioc
*ioc
);
75 static void bfa_ioc_event_notify(struct bfa_ioc
*, enum bfa_ioc_event
);
76 static void bfa_ioc_disable_comp(struct bfa_ioc
*ioc
);
77 static void bfa_ioc_lpu_stop(struct bfa_ioc
*ioc
);
78 static void bfa_ioc_fail_notify(struct bfa_ioc
*ioc
);
79 static void bfa_ioc_pf_enabled(struct bfa_ioc
*ioc
);
80 static void bfa_ioc_pf_disabled(struct bfa_ioc
*ioc
);
81 static void bfa_ioc_pf_initfailed(struct bfa_ioc
*ioc
);
82 static void bfa_ioc_pf_failed(struct bfa_ioc
*ioc
);
83 static void bfa_ioc_pf_fwmismatch(struct bfa_ioc
*ioc
);
84 static void bfa_ioc_boot(struct bfa_ioc
*ioc
, u32 boot_type
,
86 static u32
bfa_ioc_smem_pgnum(struct bfa_ioc
*ioc
, u32 fmaddr
);
87 static void bfa_ioc_get_adapter_serial_num(struct bfa_ioc
*ioc
,
89 static void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc
*ioc
,
91 static void bfa_ioc_get_pci_chip_rev(struct bfa_ioc
*ioc
,
93 static void bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc
*ioc
,
95 static void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc
*ioc
,
97 static void bfa_ioc_get_adapter_model(struct bfa_ioc
*ioc
, char *model
);
98 static u64
bfa_ioc_get_pwwn(struct bfa_ioc
*ioc
);
101 * IOC state machine definitions/declarations
104 IOC_E_RESET
= 1, /*!< IOC reset request */
105 IOC_E_ENABLE
= 2, /*!< IOC enable request */
106 IOC_E_DISABLE
= 3, /*!< IOC disable request */
107 IOC_E_DETACH
= 4, /*!< driver detach cleanup */
108 IOC_E_ENABLED
= 5, /*!< f/w enabled */
109 IOC_E_FWRSP_GETATTR
= 6, /*!< IOC get attribute response */
110 IOC_E_DISABLED
= 7, /*!< f/w disabled */
111 IOC_E_INITFAILED
= 8, /*!< failure notice by iocpf sm */
112 IOC_E_PFFAILED
= 9, /*!< failure notice by iocpf sm */
113 IOC_E_HBFAIL
= 10, /*!< heartbeat failure */
114 IOC_E_HWERROR
= 11, /*!< hardware error interrupt */
115 IOC_E_TIMEOUT
= 12, /*!< timeout */
118 bfa_fsm_state_decl(bfa_ioc
, uninit
, struct bfa_ioc
, enum ioc_event
);
119 bfa_fsm_state_decl(bfa_ioc
, reset
, struct bfa_ioc
, enum ioc_event
);
120 bfa_fsm_state_decl(bfa_ioc
, enabling
, struct bfa_ioc
, enum ioc_event
);
121 bfa_fsm_state_decl(bfa_ioc
, getattr
, struct bfa_ioc
, enum ioc_event
);
122 bfa_fsm_state_decl(bfa_ioc
, op
, struct bfa_ioc
, enum ioc_event
);
123 bfa_fsm_state_decl(bfa_ioc
, fail_retry
, struct bfa_ioc
, enum ioc_event
);
124 bfa_fsm_state_decl(bfa_ioc
, fail
, struct bfa_ioc
, enum ioc_event
);
125 bfa_fsm_state_decl(bfa_ioc
, disabling
, struct bfa_ioc
, enum ioc_event
);
126 bfa_fsm_state_decl(bfa_ioc
, disabled
, struct bfa_ioc
, enum ioc_event
);
128 static struct bfa_sm_table ioc_sm_table
[] = {
129 {BFA_SM(bfa_ioc_sm_uninit
), BFA_IOC_UNINIT
},
130 {BFA_SM(bfa_ioc_sm_reset
), BFA_IOC_RESET
},
131 {BFA_SM(bfa_ioc_sm_enabling
), BFA_IOC_ENABLING
},
132 {BFA_SM(bfa_ioc_sm_getattr
), BFA_IOC_GETATTR
},
133 {BFA_SM(bfa_ioc_sm_op
), BFA_IOC_OPERATIONAL
},
134 {BFA_SM(bfa_ioc_sm_fail_retry
), BFA_IOC_INITFAIL
},
135 {BFA_SM(bfa_ioc_sm_fail
), BFA_IOC_FAIL
},
136 {BFA_SM(bfa_ioc_sm_disabling
), BFA_IOC_DISABLING
},
137 {BFA_SM(bfa_ioc_sm_disabled
), BFA_IOC_DISABLED
},
141 * IOCPF state machine definitions/declarations
145 * Forward declareations for iocpf state machine
147 static void bfa_iocpf_enable(struct bfa_ioc
*ioc
);
148 static void bfa_iocpf_disable(struct bfa_ioc
*ioc
);
149 static void bfa_iocpf_fail(struct bfa_ioc
*ioc
);
150 static void bfa_iocpf_initfail(struct bfa_ioc
*ioc
);
151 static void bfa_iocpf_getattrfail(struct bfa_ioc
*ioc
);
152 static void bfa_iocpf_stop(struct bfa_ioc
*ioc
);
155 * IOCPF state machine events
158 IOCPF_E_ENABLE
= 1, /*!< IOCPF enable request */
159 IOCPF_E_DISABLE
= 2, /*!< IOCPF disable request */
160 IOCPF_E_STOP
= 3, /*!< stop on driver detach */
161 IOCPF_E_FWREADY
= 4, /*!< f/w initialization done */
162 IOCPF_E_FWRSP_ENABLE
= 5, /*!< enable f/w response */
163 IOCPF_E_FWRSP_DISABLE
= 6, /*!< disable f/w response */
164 IOCPF_E_FAIL
= 7, /*!< failure notice by ioc sm */
165 IOCPF_E_INITFAIL
= 8, /*!< init fail notice by ioc sm */
166 IOCPF_E_GETATTRFAIL
= 9, /*!< init fail notice by ioc sm */
167 IOCPF_E_SEMLOCKED
= 10, /*!< h/w semaphore is locked */
168 IOCPF_E_TIMEOUT
= 11, /*!< f/w response timeout */
174 enum bfa_iocpf_state
{
175 BFA_IOCPF_RESET
= 1, /*!< IOC is in reset state */
176 BFA_IOCPF_SEMWAIT
= 2, /*!< Waiting for IOC h/w semaphore */
177 BFA_IOCPF_HWINIT
= 3, /*!< IOC h/w is being initialized */
178 BFA_IOCPF_READY
= 4, /*!< IOCPF is initialized */
179 BFA_IOCPF_INITFAIL
= 5, /*!< IOCPF failed */
180 BFA_IOCPF_FAIL
= 6, /*!< IOCPF failed */
181 BFA_IOCPF_DISABLING
= 7, /*!< IOCPF is being disabled */
182 BFA_IOCPF_DISABLED
= 8, /*!< IOCPF is disabled */
183 BFA_IOCPF_FWMISMATCH
= 9, /*!< IOC f/w different from drivers */
186 bfa_fsm_state_decl(bfa_iocpf
, reset
, struct bfa_iocpf
, enum iocpf_event
);
187 bfa_fsm_state_decl(bfa_iocpf
, fwcheck
, struct bfa_iocpf
, enum iocpf_event
);
188 bfa_fsm_state_decl(bfa_iocpf
, mismatch
, struct bfa_iocpf
, enum iocpf_event
);
189 bfa_fsm_state_decl(bfa_iocpf
, semwait
, struct bfa_iocpf
, enum iocpf_event
);
190 bfa_fsm_state_decl(bfa_iocpf
, hwinit
, struct bfa_iocpf
, enum iocpf_event
);
191 bfa_fsm_state_decl(bfa_iocpf
, enabling
, struct bfa_iocpf
, enum iocpf_event
);
192 bfa_fsm_state_decl(bfa_iocpf
, ready
, struct bfa_iocpf
, enum iocpf_event
);
193 bfa_fsm_state_decl(bfa_iocpf
, initfail_sync
, struct bfa_iocpf
,
195 bfa_fsm_state_decl(bfa_iocpf
, initfail
, struct bfa_iocpf
, enum iocpf_event
);
196 bfa_fsm_state_decl(bfa_iocpf
, fail_sync
, struct bfa_iocpf
, enum iocpf_event
);
197 bfa_fsm_state_decl(bfa_iocpf
, fail
, struct bfa_iocpf
, enum iocpf_event
);
198 bfa_fsm_state_decl(bfa_iocpf
, disabling
, struct bfa_iocpf
, enum iocpf_event
);
199 bfa_fsm_state_decl(bfa_iocpf
, disabling_sync
, struct bfa_iocpf
,
201 bfa_fsm_state_decl(bfa_iocpf
, disabled
, struct bfa_iocpf
, enum iocpf_event
);
203 static struct bfa_sm_table iocpf_sm_table
[] = {
204 {BFA_SM(bfa_iocpf_sm_reset
), BFA_IOCPF_RESET
},
205 {BFA_SM(bfa_iocpf_sm_fwcheck
), BFA_IOCPF_FWMISMATCH
},
206 {BFA_SM(bfa_iocpf_sm_mismatch
), BFA_IOCPF_FWMISMATCH
},
207 {BFA_SM(bfa_iocpf_sm_semwait
), BFA_IOCPF_SEMWAIT
},
208 {BFA_SM(bfa_iocpf_sm_hwinit
), BFA_IOCPF_HWINIT
},
209 {BFA_SM(bfa_iocpf_sm_enabling
), BFA_IOCPF_HWINIT
},
210 {BFA_SM(bfa_iocpf_sm_ready
), BFA_IOCPF_READY
},
211 {BFA_SM(bfa_iocpf_sm_initfail_sync
), BFA_IOCPF_INITFAIL
},
212 {BFA_SM(bfa_iocpf_sm_initfail
), BFA_IOCPF_INITFAIL
},
213 {BFA_SM(bfa_iocpf_sm_fail_sync
), BFA_IOCPF_FAIL
},
214 {BFA_SM(bfa_iocpf_sm_fail
), BFA_IOCPF_FAIL
},
215 {BFA_SM(bfa_iocpf_sm_disabling
), BFA_IOCPF_DISABLING
},
216 {BFA_SM(bfa_iocpf_sm_disabling_sync
), BFA_IOCPF_DISABLING
},
217 {BFA_SM(bfa_iocpf_sm_disabled
), BFA_IOCPF_DISABLED
},
225 * Beginning state. IOC uninit state.
228 bfa_ioc_sm_uninit_entry(struct bfa_ioc
*ioc
)
233 * IOC is in uninit state.
236 bfa_ioc_sm_uninit(struct bfa_ioc
*ioc
, enum ioc_event event
)
240 bfa_fsm_set_state(ioc
, bfa_ioc_sm_reset
);
249 * Reset entry actions -- initialize state machine
252 bfa_ioc_sm_reset_entry(struct bfa_ioc
*ioc
)
254 bfa_fsm_set_state(&ioc
->iocpf
, bfa_iocpf_sm_reset
);
258 * IOC is in reset state.
261 bfa_ioc_sm_reset(struct bfa_ioc
*ioc
, enum ioc_event event
)
265 bfa_fsm_set_state(ioc
, bfa_ioc_sm_enabling
);
269 bfa_ioc_disable_comp(ioc
);
273 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
282 bfa_ioc_sm_enabling_entry(struct bfa_ioc
*ioc
)
284 bfa_iocpf_enable(ioc
);
288 * Host IOC function is being enabled, awaiting response from firmware.
289 * Semaphore is acquired.
292 bfa_ioc_sm_enabling(struct bfa_ioc
*ioc
, enum ioc_event event
)
296 bfa_fsm_set_state(ioc
, bfa_ioc_sm_getattr
);
300 /* !!! fall through !!! */
302 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
303 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail_retry
);
304 if (event
!= IOC_E_PFFAILED
)
305 bfa_iocpf_initfail(ioc
);
309 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
313 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
326 * Semaphore should be acquired for version check.
329 bfa_ioc_sm_getattr_entry(struct bfa_ioc
*ioc
)
331 mod_timer(&ioc
->ioc_timer
, jiffies
+
332 msecs_to_jiffies(BFA_IOC_TOV
));
333 bfa_ioc_send_getattr(ioc
);
337 * IOC configuration in progress. Timer is active.
340 bfa_ioc_sm_getattr(struct bfa_ioc
*ioc
, enum ioc_event event
)
343 case IOC_E_FWRSP_GETATTR
:
344 del_timer(&ioc
->ioc_timer
);
345 bfa_ioc_check_attr_wwns(ioc
);
346 bfa_fsm_set_state(ioc
, bfa_ioc_sm_op
);
351 del_timer(&ioc
->ioc_timer
);
354 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
355 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail_retry
);
356 if (event
!= IOC_E_PFFAILED
)
357 bfa_iocpf_getattrfail(ioc
);
361 del_timer(&ioc
->ioc_timer
);
362 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
374 bfa_ioc_sm_op_entry(struct bfa_ioc
*ioc
)
376 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_OK
);
377 bfa_ioc_hb_monitor(ioc
);
381 bfa_ioc_sm_op(struct bfa_ioc
*ioc
, enum ioc_event event
)
388 bfa_ioc_hb_stop(ioc
);
389 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
394 bfa_ioc_hb_stop(ioc
);
395 /* !!! fall through !!! */
397 bfa_ioc_fail_notify(ioc
);
398 if (ioc
->iocpf
.auto_recover
)
399 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail_retry
);
401 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail
);
403 if (event
!= IOC_E_PFFAILED
)
413 bfa_ioc_sm_disabling_entry(struct bfa_ioc
*ioc
)
415 bfa_iocpf_disable(ioc
);
419 * IOC is being desabled
422 bfa_ioc_sm_disabling(struct bfa_ioc
*ioc
, enum ioc_event event
)
426 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabled
);
431 * No state change. Will move to disabled state
432 * after iocpf sm completes failure processing and
433 * moves to disabled state.
444 * IOC desable completion entry.
447 bfa_ioc_sm_disabled_entry(struct bfa_ioc
*ioc
)
449 bfa_ioc_disable_comp(ioc
);
453 bfa_ioc_sm_disabled(struct bfa_ioc
*ioc
, enum ioc_event event
)
457 bfa_fsm_set_state(ioc
, bfa_ioc_sm_enabling
);
461 ioc
->cbfn
->disable_cbfn(ioc
->bfa
);
465 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
475 bfa_ioc_sm_fail_retry_entry(struct bfa_ioc
*ioc
)
480 * Hardware initialization retry.
483 bfa_ioc_sm_fail_retry(struct bfa_ioc
*ioc
, enum ioc_event event
)
487 bfa_fsm_set_state(ioc
, bfa_ioc_sm_getattr
);
493 * Initialization retry failed.
495 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
496 if (event
!= IOC_E_PFFAILED
)
497 bfa_iocpf_initfail(ioc
);
500 case IOC_E_INITFAILED
:
501 bfa_fsm_set_state(ioc
, bfa_ioc_sm_fail
);
508 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
512 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
522 bfa_ioc_sm_fail_entry(struct bfa_ioc
*ioc
)
530 bfa_ioc_sm_fail(struct bfa_ioc
*ioc
, enum ioc_event event
)
534 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
538 bfa_fsm_set_state(ioc
, bfa_ioc_sm_disabling
);
542 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
547 /* HB failure notification, ignore. */
556 * IOCPF State Machine
560 * Reset entry actions -- initialize state machine
563 bfa_iocpf_sm_reset_entry(struct bfa_iocpf
*iocpf
)
565 iocpf
->retry_count
= 0;
566 iocpf
->auto_recover
= bfa_nw_auto_recover
;
570 * Beginning state. IOC is in reset state.
573 bfa_iocpf_sm_reset(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
577 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fwcheck
);
589 * Semaphore should be acquired for version check.
592 bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf
*iocpf
)
594 bfa_ioc_hw_sem_init(iocpf
->ioc
);
595 bfa_ioc_hw_sem_get(iocpf
->ioc
);
599 * Awaiting h/w semaphore to continue with version check.
602 bfa_iocpf_sm_fwcheck(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
604 struct bfa_ioc
*ioc
= iocpf
->ioc
;
607 case IOCPF_E_SEMLOCKED
:
608 if (bfa_ioc_firmware_lock(ioc
)) {
609 if (bfa_ioc_sync_start(ioc
)) {
610 iocpf
->retry_count
= 0;
611 bfa_ioc_sync_join(ioc
);
612 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
614 bfa_ioc_firmware_unlock(ioc
);
615 bfa_nw_ioc_hw_sem_release(ioc
);
616 mod_timer(&ioc
->sem_timer
, jiffies
+
617 msecs_to_jiffies(BFA_IOC_HWSEM_TOV
));
620 bfa_nw_ioc_hw_sem_release(ioc
);
621 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_mismatch
);
625 case IOCPF_E_DISABLE
:
626 bfa_ioc_hw_sem_get_cancel(ioc
);
627 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
628 bfa_ioc_pf_disabled(ioc
);
632 bfa_ioc_hw_sem_get_cancel(ioc
);
633 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
642 * Notify enable completion callback
645 bfa_iocpf_sm_mismatch_entry(struct bfa_iocpf
*iocpf
)
647 /* Call only the first time sm enters fwmismatch state. */
648 if (iocpf
->retry_count
== 0)
649 bfa_ioc_pf_fwmismatch(iocpf
->ioc
);
651 iocpf
->retry_count
++;
652 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
653 msecs_to_jiffies(BFA_IOC_TOV
));
657 * Awaiting firmware version match.
660 bfa_iocpf_sm_mismatch(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
662 struct bfa_ioc
*ioc
= iocpf
->ioc
;
665 case IOCPF_E_TIMEOUT
:
666 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fwcheck
);
669 case IOCPF_E_DISABLE
:
670 del_timer(&ioc
->iocpf_timer
);
671 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
672 bfa_ioc_pf_disabled(ioc
);
676 del_timer(&ioc
->iocpf_timer
);
677 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
686 * Request for semaphore.
689 bfa_iocpf_sm_semwait_entry(struct bfa_iocpf
*iocpf
)
691 bfa_ioc_hw_sem_get(iocpf
->ioc
);
695 * Awaiting semaphore for h/w initialzation.
698 bfa_iocpf_sm_semwait(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
700 struct bfa_ioc
*ioc
= iocpf
->ioc
;
703 case IOCPF_E_SEMLOCKED
:
704 if (bfa_ioc_sync_complete(ioc
)) {
705 bfa_ioc_sync_join(ioc
);
706 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
708 bfa_nw_ioc_hw_sem_release(ioc
);
709 mod_timer(&ioc
->sem_timer
, jiffies
+
710 msecs_to_jiffies(BFA_IOC_HWSEM_TOV
));
714 case IOCPF_E_DISABLE
:
715 bfa_ioc_hw_sem_get_cancel(ioc
);
716 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
725 bfa_iocpf_sm_hwinit_entry(struct bfa_iocpf
*iocpf
)
727 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
728 msecs_to_jiffies(BFA_IOC_TOV
));
729 bfa_ioc_reset(iocpf
->ioc
, 0);
733 * Hardware is being initialized. Interrupts are enabled.
734 * Holding hardware semaphore lock.
737 bfa_iocpf_sm_hwinit(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
739 struct bfa_ioc
*ioc
= iocpf
->ioc
;
742 case IOCPF_E_FWREADY
:
743 del_timer(&ioc
->iocpf_timer
);
744 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_enabling
);
747 case IOCPF_E_INITFAIL
:
748 del_timer(&ioc
->iocpf_timer
);
750 * !!! fall through !!!
753 case IOCPF_E_TIMEOUT
:
754 bfa_nw_ioc_hw_sem_release(ioc
);
755 if (event
== IOCPF_E_TIMEOUT
)
756 bfa_ioc_pf_failed(ioc
);
757 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
760 case IOCPF_E_DISABLE
:
761 del_timer(&ioc
->iocpf_timer
);
762 bfa_ioc_sync_leave(ioc
);
763 bfa_nw_ioc_hw_sem_release(ioc
);
764 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
773 bfa_iocpf_sm_enabling_entry(struct bfa_iocpf
*iocpf
)
775 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
776 msecs_to_jiffies(BFA_IOC_TOV
));
777 bfa_ioc_send_enable(iocpf
->ioc
);
781 * Host IOC function is being enabled, awaiting response from firmware.
782 * Semaphore is acquired.
785 bfa_iocpf_sm_enabling(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
787 struct bfa_ioc
*ioc
= iocpf
->ioc
;
790 case IOCPF_E_FWRSP_ENABLE
:
791 del_timer(&ioc
->iocpf_timer
);
792 bfa_nw_ioc_hw_sem_release(ioc
);
793 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_ready
);
796 case IOCPF_E_INITFAIL
:
797 del_timer(&ioc
->iocpf_timer
);
799 * !!! fall through !!!
801 case IOCPF_E_TIMEOUT
:
802 bfa_nw_ioc_hw_sem_release(ioc
);
803 if (event
== IOCPF_E_TIMEOUT
)
804 bfa_ioc_pf_failed(ioc
);
805 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
808 case IOCPF_E_DISABLE
:
809 del_timer(&ioc
->iocpf_timer
);
810 bfa_nw_ioc_hw_sem_release(ioc
);
811 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling
);
814 case IOCPF_E_FWREADY
:
815 bfa_ioc_send_enable(ioc
);
824 bfa_nw_ioc_is_operational(struct bfa_ioc
*ioc
)
826 return bfa_fsm_cmp_state(ioc
, bfa_ioc_sm_op
);
830 bfa_iocpf_sm_ready_entry(struct bfa_iocpf
*iocpf
)
832 bfa_ioc_pf_enabled(iocpf
->ioc
);
836 bfa_iocpf_sm_ready(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
838 struct bfa_ioc
*ioc
= iocpf
->ioc
;
841 case IOCPF_E_DISABLE
:
842 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling
);
845 case IOCPF_E_GETATTRFAIL
:
846 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
850 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fail_sync
);
853 case IOCPF_E_FWREADY
:
854 bfa_ioc_pf_failed(ioc
);
855 if (bfa_nw_ioc_is_operational(ioc
))
856 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fail_sync
);
858 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail_sync
);
867 bfa_iocpf_sm_disabling_entry(struct bfa_iocpf
*iocpf
)
869 mod_timer(&(iocpf
->ioc
)->iocpf_timer
, jiffies
+
870 msecs_to_jiffies(BFA_IOC_TOV
));
871 bfa_ioc_send_disable(iocpf
->ioc
);
875 * IOC is being disabled
878 bfa_iocpf_sm_disabling(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
880 struct bfa_ioc
*ioc
= iocpf
->ioc
;
883 case IOCPF_E_FWRSP_DISABLE
:
884 case IOCPF_E_FWREADY
:
885 del_timer(&ioc
->iocpf_timer
);
886 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
890 del_timer(&ioc
->iocpf_timer
);
892 * !!! fall through !!!
895 case IOCPF_E_TIMEOUT
:
896 writel(BFI_IOC_FAIL
, ioc
->ioc_regs
.ioc_fwstate
);
897 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
900 case IOCPF_E_FWRSP_ENABLE
:
909 bfa_iocpf_sm_disabling_sync_entry(struct bfa_iocpf
*iocpf
)
911 bfa_ioc_hw_sem_get(iocpf
->ioc
);
915 * IOC hb ack request is being removed.
918 bfa_iocpf_sm_disabling_sync(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
920 struct bfa_ioc
*ioc
= iocpf
->ioc
;
923 case IOCPF_E_SEMLOCKED
:
924 bfa_ioc_sync_leave(ioc
);
925 bfa_nw_ioc_hw_sem_release(ioc
);
926 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
938 * IOC disable completion entry.
941 bfa_iocpf_sm_disabled_entry(struct bfa_iocpf
*iocpf
)
943 bfa_ioc_mbox_flush(iocpf
->ioc
);
944 bfa_ioc_pf_disabled(iocpf
->ioc
);
948 bfa_iocpf_sm_disabled(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
950 struct bfa_ioc
*ioc
= iocpf
->ioc
;
954 iocpf
->retry_count
= 0;
955 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_semwait
);
959 bfa_ioc_firmware_unlock(ioc
);
960 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
969 bfa_iocpf_sm_initfail_sync_entry(struct bfa_iocpf
*iocpf
)
971 bfa_ioc_hw_sem_get(iocpf
->ioc
);
975 * Hardware initialization failed.
978 bfa_iocpf_sm_initfail_sync(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
980 struct bfa_ioc
*ioc
= iocpf
->ioc
;
983 case IOCPF_E_SEMLOCKED
:
984 bfa_ioc_notify_fail(ioc
);
985 bfa_ioc_sync_ack(ioc
);
986 iocpf
->retry_count
++;
987 if (iocpf
->retry_count
>= BFA_IOC_HWINIT_MAX
) {
988 bfa_ioc_sync_leave(ioc
);
989 bfa_nw_ioc_hw_sem_release(ioc
);
990 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_initfail
);
992 if (bfa_ioc_sync_complete(ioc
))
993 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
995 bfa_nw_ioc_hw_sem_release(ioc
);
996 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_semwait
);
1001 case IOCPF_E_DISABLE
:
1002 bfa_ioc_hw_sem_get_cancel(ioc
);
1003 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
1007 bfa_ioc_hw_sem_get_cancel(ioc
);
1008 bfa_ioc_firmware_unlock(ioc
);
1009 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
1016 bfa_sm_fault(event
);
1021 bfa_iocpf_sm_initfail_entry(struct bfa_iocpf
*iocpf
)
1023 bfa_ioc_pf_initfailed(iocpf
->ioc
);
1027 * Hardware initialization failed.
1030 bfa_iocpf_sm_initfail(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
1032 struct bfa_ioc
*ioc
= iocpf
->ioc
;
1035 case IOCPF_E_DISABLE
:
1036 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
1040 bfa_ioc_firmware_unlock(ioc
);
1041 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_reset
);
1045 bfa_sm_fault(event
);
1050 bfa_iocpf_sm_fail_sync_entry(struct bfa_iocpf
*iocpf
)
1053 * Mark IOC as failed in hardware and stop firmware.
1055 bfa_ioc_lpu_stop(iocpf
->ioc
);
1058 * Flush any queued up mailbox requests.
1060 bfa_ioc_mbox_flush(iocpf
->ioc
);
1061 bfa_ioc_hw_sem_get(iocpf
->ioc
);
1065 * IOC is in failed state.
1068 bfa_iocpf_sm_fail_sync(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
1070 struct bfa_ioc
*ioc
= iocpf
->ioc
;
1073 case IOCPF_E_SEMLOCKED
:
1074 iocpf
->retry_count
= 0;
1075 bfa_ioc_sync_ack(ioc
);
1076 bfa_ioc_notify_fail(ioc
);
1077 if (!iocpf
->auto_recover
) {
1078 bfa_ioc_sync_leave(ioc
);
1079 bfa_nw_ioc_hw_sem_release(ioc
);
1080 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_fail
);
1082 if (bfa_ioc_sync_complete(ioc
))
1083 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_hwinit
);
1085 bfa_nw_ioc_hw_sem_release(ioc
);
1086 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_semwait
);
1091 case IOCPF_E_DISABLE
:
1092 bfa_ioc_hw_sem_get_cancel(ioc
);
1093 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabling_sync
);
1100 bfa_sm_fault(event
);
1105 bfa_iocpf_sm_fail_entry(struct bfa_iocpf
*iocpf
)
1111 * IOC is in failed state.
1114 bfa_iocpf_sm_fail(struct bfa_iocpf
*iocpf
, enum iocpf_event event
)
1117 case IOCPF_E_DISABLE
:
1118 bfa_fsm_set_state(iocpf
, bfa_iocpf_sm_disabled
);
1122 bfa_sm_fault(event
);
1127 * BFA IOC private functions
1131 * Notify common modules registered for notification.
1134 bfa_ioc_event_notify(struct bfa_ioc
*ioc
, enum bfa_ioc_event event
)
1136 struct bfa_ioc_notify
*notify
;
1137 struct list_head
*qe
;
1139 list_for_each(qe
, &ioc
->notify_q
) {
1140 notify
= (struct bfa_ioc_notify
*)qe
;
1141 notify
->cbfn(notify
->cbarg
, event
);
1146 bfa_ioc_disable_comp(struct bfa_ioc
*ioc
)
1148 ioc
->cbfn
->disable_cbfn(ioc
->bfa
);
1149 bfa_ioc_event_notify(ioc
, BFA_IOC_E_DISABLED
);
1153 bfa_nw_ioc_sem_get(void __iomem
*sem_reg
)
1157 #define BFA_SEM_SPINCNT 3000
1159 r32
= readl(sem_reg
);
1161 while (r32
&& (cnt
< BFA_SEM_SPINCNT
)) {
1164 r32
= readl(sem_reg
);
1170 BUG_ON(!(cnt
< BFA_SEM_SPINCNT
));
1175 bfa_nw_ioc_sem_release(void __iomem
*sem_reg
)
1181 bfa_ioc_hw_sem_init(struct bfa_ioc
*ioc
)
1183 struct bfi_ioc_image_hdr fwhdr
;
1184 u32 fwstate
= readl(ioc
->ioc_regs
.ioc_fwstate
);
1186 if (fwstate
== BFI_IOC_UNINIT
)
1189 bfa_nw_ioc_fwver_get(ioc
, &fwhdr
);
1191 if (swab32(fwhdr
.exec
) == BFI_FWBOOT_TYPE_NORMAL
)
1194 writel(BFI_IOC_UNINIT
, ioc
->ioc_regs
.ioc_fwstate
);
1197 * Try to lock and then unlock the semaphore.
1199 readl(ioc
->ioc_regs
.ioc_sem_reg
);
1200 writel(1, ioc
->ioc_regs
.ioc_sem_reg
);
1204 bfa_ioc_hw_sem_get(struct bfa_ioc
*ioc
)
1209 * First read to the semaphore register will return 0, subsequent reads
1210 * will return 1. Semaphore is released by writing 1 to the register
1212 r32
= readl(ioc
->ioc_regs
.ioc_sem_reg
);
1214 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_SEMLOCKED
);
1218 mod_timer(&ioc
->sem_timer
, jiffies
+
1219 msecs_to_jiffies(BFA_IOC_HWSEM_TOV
));
1223 bfa_nw_ioc_hw_sem_release(struct bfa_ioc
*ioc
)
1225 writel(1, ioc
->ioc_regs
.ioc_sem_reg
);
1229 bfa_ioc_hw_sem_get_cancel(struct bfa_ioc
*ioc
)
1231 del_timer(&ioc
->sem_timer
);
1236 * Initialize LPU local memory (aka secondary memory / SRAM)
1239 bfa_ioc_lmem_init(struct bfa_ioc
*ioc
)
1243 #define PSS_LMEM_INIT_TIME 10000
1245 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1246 pss_ctl
&= ~__PSS_LMEM_RESET
;
1247 pss_ctl
|= __PSS_LMEM_INIT_EN
;
1250 * i2c workaround 12.5khz clock
1252 pss_ctl
|= __PSS_I2C_CLK_DIV(3UL);
1253 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1256 * wait for memory initialization to be complete
1260 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1262 } while (!(pss_ctl
& __PSS_LMEM_INIT_DONE
) && (i
< PSS_LMEM_INIT_TIME
));
1265 * If memory initialization is not successful, IOC timeout will catch
1268 BUG_ON(!(pss_ctl
& __PSS_LMEM_INIT_DONE
));
1270 pss_ctl
&= ~(__PSS_LMEM_INIT_DONE
| __PSS_LMEM_INIT_EN
);
1271 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1275 bfa_ioc_lpu_start(struct bfa_ioc
*ioc
)
1280 * Take processor out of reset.
1282 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1283 pss_ctl
&= ~__PSS_LPU0_RESET
;
1285 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1289 bfa_ioc_lpu_stop(struct bfa_ioc
*ioc
)
1294 * Put processors in reset.
1296 pss_ctl
= readl(ioc
->ioc_regs
.pss_ctl_reg
);
1297 pss_ctl
|= (__PSS_LPU0_RESET
| __PSS_LPU1_RESET
);
1299 writel(pss_ctl
, ioc
->ioc_regs
.pss_ctl_reg
);
1303 * Get driver and firmware versions.
1306 bfa_nw_ioc_fwver_get(struct bfa_ioc
*ioc
, struct bfi_ioc_image_hdr
*fwhdr
)
1311 u32
*fwsig
= (u32
*) fwhdr
;
1313 pgnum
= bfa_ioc_smem_pgnum(ioc
, loff
);
1314 writel(pgnum
, ioc
->ioc_regs
.host_page_num_fn
);
1316 for (i
= 0; i
< (sizeof(struct bfi_ioc_image_hdr
) / sizeof(u32
));
1319 swab32(readl((loff
) + (ioc
->ioc_regs
.smem_page_start
)));
1320 loff
+= sizeof(u32
);
1325 * Returns TRUE if same.
1328 bfa_nw_ioc_fwver_cmp(struct bfa_ioc
*ioc
, struct bfi_ioc_image_hdr
*fwhdr
)
1330 struct bfi_ioc_image_hdr
*drv_fwhdr
;
1333 drv_fwhdr
= (struct bfi_ioc_image_hdr
*)
1334 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
), 0);
1336 for (i
= 0; i
< BFI_IOC_MD5SUM_SZ
; i
++) {
1337 if (fwhdr
->md5sum
[i
] != drv_fwhdr
->md5sum
[i
])
1345 * Return true if current running version is valid. Firmware signature and
1346 * execution context (driver/bios) must match.
1349 bfa_ioc_fwver_valid(struct bfa_ioc
*ioc
, u32 boot_env
)
1351 struct bfi_ioc_image_hdr fwhdr
, *drv_fwhdr
;
1353 bfa_nw_ioc_fwver_get(ioc
, &fwhdr
);
1354 drv_fwhdr
= (struct bfi_ioc_image_hdr
*)
1355 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
), 0);
1357 if (fwhdr
.signature
!= drv_fwhdr
->signature
)
1360 if (swab32(fwhdr
.param
) != boot_env
)
1363 return bfa_nw_ioc_fwver_cmp(ioc
, &fwhdr
);
1367 * Conditionally flush any pending message from firmware at start.
1370 bfa_ioc_msgflush(struct bfa_ioc
*ioc
)
1374 r32
= readl(ioc
->ioc_regs
.lpu_mbox_cmd
);
1376 writel(1, ioc
->ioc_regs
.lpu_mbox_cmd
);
1380 * @img ioc_init_logic.jpg
1383 bfa_ioc_hwinit(struct bfa_ioc
*ioc
, bool force
)
1385 enum bfi_ioc_state ioc_fwstate
;
1389 ioc_fwstate
= readl(ioc
->ioc_regs
.ioc_fwstate
);
1391 boot_env
= BFI_BOOT_LOADER_OS
;
1394 ioc_fwstate
= BFI_IOC_UNINIT
;
1397 * check if firmware is valid
1399 fwvalid
= (ioc_fwstate
== BFI_IOC_UNINIT
) ?
1400 false : bfa_ioc_fwver_valid(ioc
, boot_env
);
1403 bfa_ioc_boot(ioc
, BFI_BOOT_TYPE_NORMAL
, boot_env
);
1408 * If hardware initialization is in progress (initialized by other IOC),
1409 * just wait for an initialization completion interrupt.
1411 if (ioc_fwstate
== BFI_IOC_INITING
) {
1412 ioc
->cbfn
->reset_cbfn(ioc
->bfa
);
1417 * If IOC function is disabled and firmware version is same,
1418 * just re-enable IOC.
1420 if (ioc_fwstate
== BFI_IOC_DISABLED
|| ioc_fwstate
== BFI_IOC_OP
) {
1422 * When using MSI-X any pending firmware ready event should
1423 * be flushed. Otherwise MSI-X interrupts are not delivered.
1425 bfa_ioc_msgflush(ioc
);
1426 ioc
->cbfn
->reset_cbfn(ioc
->bfa
);
1427 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_FWREADY
);
1432 * Initialize the h/w for any other states.
1434 bfa_ioc_boot(ioc
, BFI_BOOT_TYPE_NORMAL
, boot_env
);
1438 bfa_nw_ioc_timeout(void *ioc_arg
)
1440 struct bfa_ioc
*ioc
= (struct bfa_ioc
*) ioc_arg
;
1442 bfa_fsm_send_event(ioc
, IOC_E_TIMEOUT
);
1446 bfa_ioc_mbox_send(struct bfa_ioc
*ioc
, void *ioc_msg
, int len
)
1448 u32
*msgp
= (u32
*) ioc_msg
;
1451 BUG_ON(!(len
<= BFI_IOC_MSGLEN_MAX
));
1454 * first write msg to mailbox registers
1456 for (i
= 0; i
< len
/ sizeof(u32
); i
++)
1457 writel(cpu_to_le32(msgp
[i
]),
1458 ioc
->ioc_regs
.hfn_mbox
+ i
* sizeof(u32
));
1460 for (; i
< BFI_IOC_MSGLEN_MAX
/ sizeof(u32
); i
++)
1461 writel(0, ioc
->ioc_regs
.hfn_mbox
+ i
* sizeof(u32
));
1464 * write 1 to mailbox CMD to trigger LPU event
1466 writel(1, ioc
->ioc_regs
.hfn_mbox_cmd
);
1467 (void) readl(ioc
->ioc_regs
.hfn_mbox_cmd
);
1471 bfa_ioc_send_enable(struct bfa_ioc
*ioc
)
1473 struct bfi_ioc_ctrl_req enable_req
;
1476 bfi_h2i_set(enable_req
.mh
, BFI_MC_IOC
, BFI_IOC_H2I_ENABLE_REQ
,
1477 bfa_ioc_portid(ioc
));
1478 enable_req
.ioc_class
= ioc
->ioc_mc
;
1479 do_gettimeofday(&tv
);
1480 enable_req
.tv_sec
= ntohl(tv
.tv_sec
);
1481 bfa_ioc_mbox_send(ioc
, &enable_req
, sizeof(struct bfi_ioc_ctrl_req
));
1485 bfa_ioc_send_disable(struct bfa_ioc
*ioc
)
1487 struct bfi_ioc_ctrl_req disable_req
;
1489 bfi_h2i_set(disable_req
.mh
, BFI_MC_IOC
, BFI_IOC_H2I_DISABLE_REQ
,
1490 bfa_ioc_portid(ioc
));
1491 bfa_ioc_mbox_send(ioc
, &disable_req
, sizeof(struct bfi_ioc_ctrl_req
));
1495 bfa_ioc_send_getattr(struct bfa_ioc
*ioc
)
1497 struct bfi_ioc_getattr_req attr_req
;
1499 bfi_h2i_set(attr_req
.mh
, BFI_MC_IOC
, BFI_IOC_H2I_GETATTR_REQ
,
1500 bfa_ioc_portid(ioc
));
1501 bfa_dma_be_addr_set(attr_req
.attr_addr
, ioc
->attr_dma
.pa
);
1502 bfa_ioc_mbox_send(ioc
, &attr_req
, sizeof(attr_req
));
1506 bfa_nw_ioc_hb_check(void *cbarg
)
1508 struct bfa_ioc
*ioc
= cbarg
;
1511 hb_count
= readl(ioc
->ioc_regs
.heartbeat
);
1512 if (ioc
->hb_count
== hb_count
) {
1513 bfa_ioc_recover(ioc
);
1516 ioc
->hb_count
= hb_count
;
1519 bfa_ioc_mbox_poll(ioc
);
1520 mod_timer(&ioc
->hb_timer
, jiffies
+
1521 msecs_to_jiffies(BFA_IOC_HB_TOV
));
1525 bfa_ioc_hb_monitor(struct bfa_ioc
*ioc
)
1527 ioc
->hb_count
= readl(ioc
->ioc_regs
.heartbeat
);
1528 mod_timer(&ioc
->hb_timer
, jiffies
+
1529 msecs_to_jiffies(BFA_IOC_HB_TOV
));
1533 bfa_ioc_hb_stop(struct bfa_ioc
*ioc
)
1535 del_timer(&ioc
->hb_timer
);
1540 * Initiate a full firmware download.
1543 bfa_ioc_download_fw(struct bfa_ioc
*ioc
, u32 boot_type
,
1553 * Initialize LMEM first before code download
1555 bfa_ioc_lmem_init(ioc
);
1557 fwimg
= bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
), chunkno
);
1559 pgnum
= bfa_ioc_smem_pgnum(ioc
, loff
);
1561 writel(pgnum
, ioc
->ioc_regs
.host_page_num_fn
);
1563 for (i
= 0; i
< bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc
)); i
++) {
1564 if (BFA_IOC_FLASH_CHUNK_NO(i
) != chunkno
) {
1565 chunkno
= BFA_IOC_FLASH_CHUNK_NO(i
);
1566 fwimg
= bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc
),
1567 BFA_IOC_FLASH_CHUNK_ADDR(chunkno
));
1573 writel((swab32(fwimg
[BFA_IOC_FLASH_OFFSET_IN_CHUNK(i
)])),
1574 ((ioc
->ioc_regs
.smem_page_start
) + (loff
)));
1576 loff
+= sizeof(u32
);
1579 * handle page offset wrap around
1581 loff
= PSS_SMEM_PGOFF(loff
);
1585 ioc
->ioc_regs
.host_page_num_fn
);
1589 writel(bfa_ioc_smem_pgnum(ioc
, 0),
1590 ioc
->ioc_regs
.host_page_num_fn
);
1593 * Set boot type and boot param at the end.
1595 writel(boot_type
, ((ioc
->ioc_regs
.smem_page_start
)
1596 + (BFI_BOOT_TYPE_OFF
)));
1597 writel(boot_env
, ((ioc
->ioc_regs
.smem_page_start
)
1598 + (BFI_BOOT_LOADER_OFF
)));
1602 bfa_ioc_reset(struct bfa_ioc
*ioc
, bool force
)
1604 bfa_ioc_hwinit(ioc
, force
);
1609 * Update BFA configuration from firmware configuration.
1612 bfa_ioc_getattr_reply(struct bfa_ioc
*ioc
)
1614 struct bfi_ioc_attr
*attr
= ioc
->attr
;
1616 attr
->adapter_prop
= ntohl(attr
->adapter_prop
);
1617 attr
->card_type
= ntohl(attr
->card_type
);
1618 attr
->maxfrsize
= ntohs(attr
->maxfrsize
);
1620 bfa_fsm_send_event(ioc
, IOC_E_FWRSP_GETATTR
);
1624 * Attach time initialization of mbox logic.
1627 bfa_ioc_mbox_attach(struct bfa_ioc
*ioc
)
1629 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1632 INIT_LIST_HEAD(&mod
->cmd_q
);
1633 for (mc
= 0; mc
< BFI_MC_MAX
; mc
++) {
1634 mod
->mbhdlr
[mc
].cbfn
= NULL
;
1635 mod
->mbhdlr
[mc
].cbarg
= ioc
->bfa
;
1640 * Mbox poll timer -- restarts any pending mailbox requests.
1643 bfa_ioc_mbox_poll(struct bfa_ioc
*ioc
)
1645 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1646 struct bfa_mbox_cmd
*cmd
;
1650 * If no command pending, do nothing
1652 if (list_empty(&mod
->cmd_q
))
1656 * If previous command is not yet fetched by firmware, do nothing
1658 stat
= readl(ioc
->ioc_regs
.hfn_mbox_cmd
);
1663 * Enqueue command to firmware.
1665 bfa_q_deq(&mod
->cmd_q
, &cmd
);
1666 bfa_ioc_mbox_send(ioc
, cmd
->msg
, sizeof(cmd
->msg
));
1670 * Cleanup any pending requests.
1673 bfa_ioc_mbox_flush(struct bfa_ioc
*ioc
)
1675 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1676 struct bfa_mbox_cmd
*cmd
;
1678 while (!list_empty(&mod
->cmd_q
))
1679 bfa_q_deq(&mod
->cmd_q
, &cmd
);
1683 bfa_ioc_fail_notify(struct bfa_ioc
*ioc
)
1686 * Notify driver and common modules registered for notification.
1688 ioc
->cbfn
->hbfail_cbfn(ioc
->bfa
);
1689 bfa_ioc_event_notify(ioc
, BFA_IOC_E_FAILED
);
1693 bfa_ioc_pf_enabled(struct bfa_ioc
*ioc
)
1695 bfa_fsm_send_event(ioc
, IOC_E_ENABLED
);
1699 bfa_ioc_pf_disabled(struct bfa_ioc
*ioc
)
1701 bfa_fsm_send_event(ioc
, IOC_E_DISABLED
);
1705 bfa_ioc_pf_initfailed(struct bfa_ioc
*ioc
)
1707 bfa_fsm_send_event(ioc
, IOC_E_INITFAILED
);
1711 bfa_ioc_pf_failed(struct bfa_ioc
*ioc
)
1713 bfa_fsm_send_event(ioc
, IOC_E_PFFAILED
);
1717 bfa_ioc_pf_fwmismatch(struct bfa_ioc
*ioc
)
1720 * Provide enable completion callback and AEN notification.
1722 ioc
->cbfn
->enable_cbfn(ioc
->bfa
, BFA_STATUS_IOC_FAILURE
);
1728 static enum bfa_status
1729 bfa_ioc_pll_init(struct bfa_ioc
*ioc
)
1732 * Hold semaphore so that nobody can access the chip during init.
1734 bfa_nw_ioc_sem_get(ioc
->ioc_regs
.ioc_init_sem_reg
);
1736 bfa_ioc_pll_init_asic(ioc
);
1738 ioc
->pllinit
= true;
1740 * release semaphore.
1742 bfa_nw_ioc_sem_release(ioc
->ioc_regs
.ioc_init_sem_reg
);
1744 return BFA_STATUS_OK
;
1748 * Interface used by diag module to do firmware boot with memory test
1749 * as the entry vector.
1752 bfa_ioc_boot(struct bfa_ioc
*ioc
, u32 boot_type
, u32 boot_env
)
1756 bfa_ioc_stats(ioc
, ioc_boots
);
1758 if (bfa_ioc_pll_init(ioc
) != BFA_STATUS_OK
)
1762 * Initialize IOC state of all functions on a chip reset.
1764 rb
= ioc
->pcidev
.pci_bar_kva
;
1765 if (boot_type
== BFI_BOOT_TYPE_MEMTEST
) {
1766 writel(BFI_IOC_MEMTEST
, (rb
+ BFA_IOC0_STATE_REG
));
1767 writel(BFI_IOC_MEMTEST
, (rb
+ BFA_IOC1_STATE_REG
));
1769 writel(BFI_IOC_INITING
, (rb
+ BFA_IOC0_STATE_REG
));
1770 writel(BFI_IOC_INITING
, (rb
+ BFA_IOC1_STATE_REG
));
1773 bfa_ioc_msgflush(ioc
);
1774 bfa_ioc_download_fw(ioc
, boot_type
, boot_env
);
1777 * Enable interrupts just before starting LPU
1779 ioc
->cbfn
->reset_cbfn(ioc
->bfa
);
1780 bfa_ioc_lpu_start(ioc
);
1784 * Enable/disable IOC failure auto recovery.
1787 bfa_nw_ioc_auto_recover(bool auto_recover
)
1789 bfa_nw_auto_recover
= auto_recover
;
1793 bfa_ioc_msgget(struct bfa_ioc
*ioc
, void *mbmsg
)
1802 for (i
= 0; i
< (sizeof(union bfi_ioc_i2h_msg_u
) / sizeof(u32
));
1804 r32
= readl(ioc
->ioc_regs
.lpu_mbox
+
1806 msgp
[i
] = htonl(r32
);
1810 * turn off mailbox interrupt by clearing mailbox status
1812 writel(1, ioc
->ioc_regs
.lpu_mbox_cmd
);
1813 readl(ioc
->ioc_regs
.lpu_mbox_cmd
);
1817 bfa_ioc_isr(struct bfa_ioc
*ioc
, struct bfi_mbmsg
*m
)
1819 union bfi_ioc_i2h_msg_u
*msg
;
1820 struct bfa_iocpf
*iocpf
= &ioc
->iocpf
;
1822 msg
= (union bfi_ioc_i2h_msg_u
*) m
;
1824 bfa_ioc_stats(ioc
, ioc_isrs
);
1826 switch (msg
->mh
.msg_id
) {
1827 case BFI_IOC_I2H_HBEAT
:
1830 case BFI_IOC_I2H_READY_EVENT
:
1831 bfa_fsm_send_event(iocpf
, IOCPF_E_FWREADY
);
1834 case BFI_IOC_I2H_ENABLE_REPLY
:
1835 bfa_fsm_send_event(iocpf
, IOCPF_E_FWRSP_ENABLE
);
1838 case BFI_IOC_I2H_DISABLE_REPLY
:
1839 bfa_fsm_send_event(iocpf
, IOCPF_E_FWRSP_DISABLE
);
1842 case BFI_IOC_I2H_GETATTR_REPLY
:
1843 bfa_ioc_getattr_reply(ioc
);
1852 * IOC attach time initialization and setup.
1854 * @param[in] ioc memory for IOC
1855 * @param[in] bfa driver instance structure
1858 bfa_nw_ioc_attach(struct bfa_ioc
*ioc
, void *bfa
, struct bfa_ioc_cbfn
*cbfn
)
1862 ioc
->fcmode
= false;
1863 ioc
->pllinit
= false;
1864 ioc
->dbg_fwsave_once
= true;
1865 ioc
->iocpf
.ioc
= ioc
;
1867 bfa_ioc_mbox_attach(ioc
);
1868 INIT_LIST_HEAD(&ioc
->notify_q
);
1870 bfa_fsm_set_state(ioc
, bfa_ioc_sm_uninit
);
1871 bfa_fsm_send_event(ioc
, IOC_E_RESET
);
1875 * Driver detach time IOC cleanup.
1878 bfa_nw_ioc_detach(struct bfa_ioc
*ioc
)
1880 bfa_fsm_send_event(ioc
, IOC_E_DETACH
);
1884 * Setup IOC PCI properties.
1886 * @param[in] pcidev PCI device information for this IOC
1889 bfa_nw_ioc_pci_init(struct bfa_ioc
*ioc
, struct bfa_pcidev
*pcidev
,
1893 ioc
->pcidev
= *pcidev
;
1894 ioc
->ctdev
= bfa_asic_id_ct(ioc
->pcidev
.device_id
);
1895 ioc
->cna
= ioc
->ctdev
&& !ioc
->fcmode
;
1897 bfa_nw_ioc_set_ct_hwif(ioc
);
1899 bfa_ioc_map_port(ioc
);
1900 bfa_ioc_reg_init(ioc
);
1904 * Initialize IOC dma memory
1906 * @param[in] dm_kva kernel virtual address of IOC dma memory
1907 * @param[in] dm_pa physical address of IOC dma memory
1910 bfa_nw_ioc_mem_claim(struct bfa_ioc
*ioc
, u8
*dm_kva
, u64 dm_pa
)
1913 * dma memory for firmware attribute
1915 ioc
->attr_dma
.kva
= dm_kva
;
1916 ioc
->attr_dma
.pa
= dm_pa
;
1917 ioc
->attr
= (struct bfi_ioc_attr
*) dm_kva
;
1921 * Return size of dma memory required.
1924 bfa_nw_ioc_meminfo(void)
1926 return roundup(sizeof(struct bfi_ioc_attr
), BFA_DMA_ALIGN_SZ
);
1930 bfa_nw_ioc_enable(struct bfa_ioc
*ioc
)
1932 bfa_ioc_stats(ioc
, ioc_enables
);
1933 ioc
->dbg_fwsave_once
= true;
1935 bfa_fsm_send_event(ioc
, IOC_E_ENABLE
);
1939 bfa_nw_ioc_disable(struct bfa_ioc
*ioc
)
1941 bfa_ioc_stats(ioc
, ioc_disables
);
1942 bfa_fsm_send_event(ioc
, IOC_E_DISABLE
);
1946 bfa_ioc_smem_pgnum(struct bfa_ioc
*ioc
, u32 fmaddr
)
1948 return PSS_SMEM_PGNUM(ioc
->ioc_regs
.smem_pg0
, fmaddr
);
1952 * Register mailbox message handler function, to be called by common modules
1955 bfa_nw_ioc_mbox_regisr(struct bfa_ioc
*ioc
, enum bfi_mclass mc
,
1956 bfa_ioc_mbox_mcfunc_t cbfn
, void *cbarg
)
1958 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1960 mod
->mbhdlr
[mc
].cbfn
= cbfn
;
1961 mod
->mbhdlr
[mc
].cbarg
= cbarg
;
1965 * Queue a mailbox command request to firmware. Waits if mailbox is busy.
1966 * Responsibility of caller to serialize
1968 * @param[in] ioc IOC instance
1969 * @param[i] cmd Mailbox command
1972 bfa_nw_ioc_mbox_queue(struct bfa_ioc
*ioc
, struct bfa_mbox_cmd
*cmd
)
1974 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
1978 * If a previous command is pending, queue new command
1980 if (!list_empty(&mod
->cmd_q
)) {
1981 list_add_tail(&cmd
->qe
, &mod
->cmd_q
);
1986 * If mailbox is busy, queue command for poll timer
1988 stat
= readl(ioc
->ioc_regs
.hfn_mbox_cmd
);
1990 list_add_tail(&cmd
->qe
, &mod
->cmd_q
);
1995 * mailbox is free -- queue command to firmware
1997 bfa_ioc_mbox_send(ioc
, cmd
->msg
, sizeof(cmd
->msg
));
2003 * Handle mailbox interrupts
2006 bfa_nw_ioc_mbox_isr(struct bfa_ioc
*ioc
)
2008 struct bfa_ioc_mbox_mod
*mod
= &ioc
->mbox_mod
;
2012 bfa_ioc_msgget(ioc
, &m
);
2015 * Treat IOC message class as special.
2017 mc
= m
.mh
.msg_class
;
2018 if (mc
== BFI_MC_IOC
) {
2019 bfa_ioc_isr(ioc
, &m
);
2023 if ((mc
>= BFI_MC_MAX
) || (mod
->mbhdlr
[mc
].cbfn
== NULL
))
2026 mod
->mbhdlr
[mc
].cbfn(mod
->mbhdlr
[mc
].cbarg
, &m
);
2030 bfa_nw_ioc_error_isr(struct bfa_ioc
*ioc
)
2032 bfa_ioc_stats(ioc
, ioc_hbfails
);
2033 bfa_ioc_stats_hb_count(ioc
, ioc
->hb_count
);
2034 bfa_fsm_send_event(ioc
, IOC_E_HWERROR
);
2038 * return true if IOC is disabled
2041 bfa_nw_ioc_is_disabled(struct bfa_ioc
*ioc
)
2043 return bfa_fsm_cmp_state(ioc
, bfa_ioc_sm_disabling
) ||
2044 bfa_fsm_cmp_state(ioc
, bfa_ioc_sm_disabled
);
2048 * Add to IOC heartbeat failure notification queue. To be used by common
2049 * modules such as cee, port, diag.
2052 bfa_nw_ioc_notify_register(struct bfa_ioc
*ioc
,
2053 struct bfa_ioc_notify
*notify
)
2055 list_add_tail(¬ify
->qe
, &ioc
->notify_q
);
2058 #define BFA_MFG_NAME "Brocade"
2060 bfa_ioc_get_adapter_attr(struct bfa_ioc
*ioc
,
2061 struct bfa_adapter_attr
*ad_attr
)
2063 struct bfi_ioc_attr
*ioc_attr
;
2065 ioc_attr
= ioc
->attr
;
2067 bfa_ioc_get_adapter_serial_num(ioc
, ad_attr
->serial_num
);
2068 bfa_ioc_get_adapter_fw_ver(ioc
, ad_attr
->fw_ver
);
2069 bfa_ioc_get_adapter_optrom_ver(ioc
, ad_attr
->optrom_ver
);
2070 bfa_ioc_get_adapter_manufacturer(ioc
, ad_attr
->manufacturer
);
2071 memcpy(&ad_attr
->vpd
, &ioc_attr
->vpd
,
2072 sizeof(struct bfa_mfg_vpd
));
2074 ad_attr
->nports
= bfa_ioc_get_nports(ioc
);
2075 ad_attr
->max_speed
= bfa_ioc_speed_sup(ioc
);
2077 bfa_ioc_get_adapter_model(ioc
, ad_attr
->model
);
2078 /* For now, model descr uses same model string */
2079 bfa_ioc_get_adapter_model(ioc
, ad_attr
->model_descr
);
2081 ad_attr
->card_type
= ioc_attr
->card_type
;
2082 ad_attr
->is_mezz
= bfa_mfg_is_mezz(ioc_attr
->card_type
);
2084 if (BFI_ADAPTER_IS_SPECIAL(ioc_attr
->adapter_prop
))
2085 ad_attr
->prototype
= 1;
2087 ad_attr
->prototype
= 0;
2089 ad_attr
->pwwn
= bfa_ioc_get_pwwn(ioc
);
2090 ad_attr
->mac
= bfa_nw_ioc_get_mac(ioc
);
2092 ad_attr
->pcie_gen
= ioc_attr
->pcie_gen
;
2093 ad_attr
->pcie_lanes
= ioc_attr
->pcie_lanes
;
2094 ad_attr
->pcie_lanes_orig
= ioc_attr
->pcie_lanes_orig
;
2095 ad_attr
->asic_rev
= ioc_attr
->asic_rev
;
2097 bfa_ioc_get_pci_chip_rev(ioc
, ad_attr
->hw_ver
);
2099 ad_attr
->cna_capable
= ioc
->cna
;
2100 ad_attr
->trunk_capable
= (ad_attr
->nports
> 1) && !ioc
->cna
;
2103 static enum bfa_ioc_type
2104 bfa_ioc_get_type(struct bfa_ioc
*ioc
)
2106 if (!ioc
->ctdev
|| ioc
->fcmode
)
2107 return BFA_IOC_TYPE_FC
;
2108 else if (ioc
->ioc_mc
== BFI_MC_IOCFC
)
2109 return BFA_IOC_TYPE_FCoE
;
2110 else if (ioc
->ioc_mc
== BFI_MC_LL
)
2111 return BFA_IOC_TYPE_LL
;
2113 BUG_ON(!(ioc
->ioc_mc
== BFI_MC_LL
));
2114 return BFA_IOC_TYPE_LL
;
2119 bfa_ioc_get_adapter_serial_num(struct bfa_ioc
*ioc
, char *serial_num
)
2121 memset(serial_num
, 0, BFA_ADAPTER_SERIAL_NUM_LEN
);
2123 (void *)ioc
->attr
->brcd_serialnum
,
2124 BFA_ADAPTER_SERIAL_NUM_LEN
);
2128 bfa_ioc_get_adapter_fw_ver(struct bfa_ioc
*ioc
, char *fw_ver
)
2130 memset(fw_ver
, 0, BFA_VERSION_LEN
);
2131 memcpy(fw_ver
, ioc
->attr
->fw_version
, BFA_VERSION_LEN
);
2135 bfa_ioc_get_pci_chip_rev(struct bfa_ioc
*ioc
, char *chip_rev
)
2137 BUG_ON(!(chip_rev
));
2139 memset(chip_rev
, 0, BFA_IOC_CHIP_REV_LEN
);
2145 chip_rev
[4] = ioc
->attr
->asic_rev
;
2150 bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc
*ioc
, char *optrom_ver
)
2152 memset(optrom_ver
, 0, BFA_VERSION_LEN
);
2153 memcpy(optrom_ver
, ioc
->attr
->optrom_version
,
2158 bfa_ioc_get_adapter_manufacturer(struct bfa_ioc
*ioc
, char *manufacturer
)
2160 memset(manufacturer
, 0, BFA_ADAPTER_MFG_NAME_LEN
);
2161 memcpy(manufacturer
, BFA_MFG_NAME
, BFA_ADAPTER_MFG_NAME_LEN
);
2165 bfa_ioc_get_adapter_model(struct bfa_ioc
*ioc
, char *model
)
2167 struct bfi_ioc_attr
*ioc_attr
;
2170 memset(model
, 0, BFA_ADAPTER_MODEL_NAME_LEN
);
2172 ioc_attr
= ioc
->attr
;
2177 snprintf(model
, BFA_ADAPTER_MODEL_NAME_LEN
, "%s-%u",
2178 BFA_MFG_NAME
, ioc_attr
->card_type
);
2181 static enum bfa_ioc_state
2182 bfa_ioc_get_state(struct bfa_ioc
*ioc
)
2184 enum bfa_iocpf_state iocpf_st
;
2185 enum bfa_ioc_state ioc_st
= bfa_sm_to_state(ioc_sm_table
, ioc
->fsm
);
2187 if (ioc_st
== BFA_IOC_ENABLING
||
2188 ioc_st
== BFA_IOC_FAIL
|| ioc_st
== BFA_IOC_INITFAIL
) {
2190 iocpf_st
= bfa_sm_to_state(iocpf_sm_table
, ioc
->iocpf
.fsm
);
2193 case BFA_IOCPF_SEMWAIT
:
2194 ioc_st
= BFA_IOC_SEMWAIT
;
2197 case BFA_IOCPF_HWINIT
:
2198 ioc_st
= BFA_IOC_HWINIT
;
2201 case BFA_IOCPF_FWMISMATCH
:
2202 ioc_st
= BFA_IOC_FWMISMATCH
;
2205 case BFA_IOCPF_FAIL
:
2206 ioc_st
= BFA_IOC_FAIL
;
2209 case BFA_IOCPF_INITFAIL
:
2210 ioc_st
= BFA_IOC_INITFAIL
;
2221 bfa_nw_ioc_get_attr(struct bfa_ioc
*ioc
, struct bfa_ioc_attr
*ioc_attr
)
2223 memset((void *)ioc_attr
, 0, sizeof(struct bfa_ioc_attr
));
2225 ioc_attr
->state
= bfa_ioc_get_state(ioc
);
2226 ioc_attr
->port_id
= ioc
->port_id
;
2228 ioc_attr
->ioc_type
= bfa_ioc_get_type(ioc
);
2230 bfa_ioc_get_adapter_attr(ioc
, &ioc_attr
->adapter_attr
);
2232 ioc_attr
->pci_attr
.device_id
= ioc
->pcidev
.device_id
;
2233 ioc_attr
->pci_attr
.pcifn
= ioc
->pcidev
.pci_func
;
2234 bfa_ioc_get_pci_chip_rev(ioc
, ioc_attr
->pci_attr
.chip_rev
);
2241 bfa_ioc_get_pwwn(struct bfa_ioc
*ioc
)
2243 return ioc
->attr
->pwwn
;
2247 bfa_nw_ioc_get_mac(struct bfa_ioc
*ioc
)
2249 return ioc
->attr
->mac
;
2253 * Firmware failure detected. Start recovery actions.
2256 bfa_ioc_recover(struct bfa_ioc
*ioc
)
2258 pr_crit("Heart Beat of IOC has failed\n");
2259 bfa_ioc_stats(ioc
, ioc_hbfails
);
2260 bfa_ioc_stats_hb_count(ioc
, ioc
->hb_count
);
2261 bfa_fsm_send_event(ioc
, IOC_E_HBFAIL
);
2265 bfa_ioc_check_attr_wwns(struct bfa_ioc
*ioc
)
2267 if (bfa_ioc_get_type(ioc
) == BFA_IOC_TYPE_LL
)
2272 * @dg hal_iocpf_pvt BFA IOC PF private functions
2277 bfa_iocpf_enable(struct bfa_ioc
*ioc
)
2279 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_ENABLE
);
2283 bfa_iocpf_disable(struct bfa_ioc
*ioc
)
2285 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_DISABLE
);
2289 bfa_iocpf_fail(struct bfa_ioc
*ioc
)
2291 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_FAIL
);
2295 bfa_iocpf_initfail(struct bfa_ioc
*ioc
)
2297 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_INITFAIL
);
2301 bfa_iocpf_getattrfail(struct bfa_ioc
*ioc
)
2303 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_GETATTRFAIL
);
2307 bfa_iocpf_stop(struct bfa_ioc
*ioc
)
2309 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_STOP
);
2313 bfa_nw_iocpf_timeout(void *ioc_arg
)
2315 struct bfa_ioc
*ioc
= (struct bfa_ioc
*) ioc_arg
;
2317 bfa_fsm_send_event(&ioc
->iocpf
, IOCPF_E_TIMEOUT
);
2321 bfa_nw_iocpf_sem_timeout(void *ioc_arg
)
2323 struct bfa_ioc
*ioc
= (struct bfa_ioc
*) ioc_arg
;
2325 bfa_ioc_hw_sem_get(ioc
);