152fa7bf9SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
28b230ed8SRasesh Mody /*
32732ba56SRasesh Mody * Linux network driver for QLogic BR-series Converged Network Adapter.
48b230ed8SRasesh Mody */
58b230ed8SRasesh Mody /*
62732ba56SRasesh Mody * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
72732ba56SRasesh Mody * Copyright (c) 2014-2015 QLogic Corporation
88b230ed8SRasesh Mody * All rights reserved
92732ba56SRasesh Mody * www.qlogic.com
108b230ed8SRasesh Mody */
118b230ed8SRasesh Mody
128b230ed8SRasesh Mody #ifndef __BFA_IOC_H__
138b230ed8SRasesh Mody #define __BFA_IOC_H__
148b230ed8SRasesh Mody
15758ccc34SRasesh Mody #include "bfa_cs.h"
168b230ed8SRasesh Mody #include "bfi.h"
178b230ed8SRasesh Mody #include "cna.h"
188b230ed8SRasesh Mody
198b230ed8SRasesh Mody #define BFA_IOC_TOV 3000 /* msecs */
208b230ed8SRasesh Mody #define BFA_IOC_HWSEM_TOV 500 /* msecs */
218b230ed8SRasesh Mody #define BFA_IOC_HB_TOV 500 /* msecs */
22078086f3SRasesh Mody #define BFA_IOC_POLL_TOV 200 /* msecs */
237afc5dbdSKrishna Gudipati #define BNA_DBG_FWTRC_LEN (BFI_IOC_TRC_ENTS * BFI_IOC_TRC_ENT_SZ + \
247afc5dbdSKrishna Gudipati BFI_IOC_TRC_HDR_SZ)
258b230ed8SRasesh Mody
261aa8b471SBen Hutchings /* PCI device information required by IOC */
278b230ed8SRasesh Mody struct bfa_pcidev {
288b230ed8SRasesh Mody int pci_slot;
298b230ed8SRasesh Mody u8 pci_func;
308b230ed8SRasesh Mody u16 device_id;
31586b2816SRasesh Mody u16 ssid;
328b230ed8SRasesh Mody void __iomem *pci_bar_kva;
338b230ed8SRasesh Mody };
348b230ed8SRasesh Mody
351aa8b471SBen Hutchings /* Structure used to remember the DMA-able memory block's KVA and Physical
368b230ed8SRasesh Mody * Address
378b230ed8SRasesh Mody */
388b230ed8SRasesh Mody struct bfa_dma {
398b230ed8SRasesh Mody void *kva; /* ! Kernel virtual address */
408b230ed8SRasesh Mody u64 pa; /* ! Physical address */
418b230ed8SRasesh Mody };
428b230ed8SRasesh Mody
438b230ed8SRasesh Mody #define BFA_DMA_ALIGN_SZ 256
448b230ed8SRasesh Mody
451aa8b471SBen Hutchings /* smem size for Crossbow and Catapult */
468b230ed8SRasesh Mody #define BFI_SMEM_CB_SIZE 0x200000U /* ! 2MB for crossbow */
478b230ed8SRasesh Mody #define BFI_SMEM_CT_SIZE 0x280000U /* ! 2.5MB for catapult */
488b230ed8SRasesh Mody
491aa8b471SBen Hutchings /* BFA dma address assignment macro. (big endian format) */
508b230ed8SRasesh Mody #define bfa_dma_be_addr_set(dma_addr, pa) \
518b230ed8SRasesh Mody __bfa_dma_be_addr_set(&dma_addr, (u64)pa)
528b230ed8SRasesh Mody static inline void
__bfa_dma_be_addr_set(union bfi_addr_u * dma_addr,u64 pa)538b230ed8SRasesh Mody __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa)
548b230ed8SRasesh Mody {
558b230ed8SRasesh Mody dma_addr->a32.addr_lo = (u32) htonl(pa);
568b230ed8SRasesh Mody dma_addr->a32.addr_hi = (u32) htonl(upper_32_bits(pa));
578b230ed8SRasesh Mody }
588b230ed8SRasesh Mody
5972a9730bSKrishna Gudipati #define bfa_alen_set(__alen, __len, __pa) \
6072a9730bSKrishna Gudipati __bfa_alen_set(__alen, __len, (u64)__pa)
6172a9730bSKrishna Gudipati
6272a9730bSKrishna Gudipati static inline void
__bfa_alen_set(struct bfi_alen * alen,u32 len,u64 pa)6372a9730bSKrishna Gudipati __bfa_alen_set(struct bfi_alen *alen, u32 len, u64 pa)
6472a9730bSKrishna Gudipati {
6572a9730bSKrishna Gudipati alen->al_len = cpu_to_be32(len);
6672a9730bSKrishna Gudipati bfa_dma_be_addr_set(alen->al_addr, pa);
6772a9730bSKrishna Gudipati }
6872a9730bSKrishna Gudipati
698b230ed8SRasesh Mody struct bfa_ioc_regs {
708b230ed8SRasesh Mody void __iomem *hfn_mbox_cmd;
718b230ed8SRasesh Mody void __iomem *hfn_mbox;
728b230ed8SRasesh Mody void __iomem *lpu_mbox_cmd;
738b230ed8SRasesh Mody void __iomem *lpu_mbox;
74be3a84d1SRasesh Mody void __iomem *lpu_read_stat;
758b230ed8SRasesh Mody void __iomem *pss_ctl_reg;
768b230ed8SRasesh Mody void __iomem *pss_err_status_reg;
778b230ed8SRasesh Mody void __iomem *app_pll_fast_ctl_reg;
788b230ed8SRasesh Mody void __iomem *app_pll_slow_ctl_reg;
798b230ed8SRasesh Mody void __iomem *ioc_sem_reg;
808b230ed8SRasesh Mody void __iomem *ioc_usage_sem_reg;
818b230ed8SRasesh Mody void __iomem *ioc_init_sem_reg;
828b230ed8SRasesh Mody void __iomem *ioc_usage_reg;
838b230ed8SRasesh Mody void __iomem *host_page_num_fn;
848b230ed8SRasesh Mody void __iomem *heartbeat;
858b230ed8SRasesh Mody void __iomem *ioc_fwstate;
861d32f769SRasesh Mody void __iomem *alt_ioc_fwstate;
878b230ed8SRasesh Mody void __iomem *ll_halt;
881d32f769SRasesh Mody void __iomem *alt_ll_halt;
898b230ed8SRasesh Mody void __iomem *err_set;
901d32f769SRasesh Mody void __iomem *ioc_fail_sync;
918b230ed8SRasesh Mody void __iomem *shirq_isr_next;
928b230ed8SRasesh Mody void __iomem *shirq_msk_next;
938b230ed8SRasesh Mody void __iomem *smem_page_start;
948b230ed8SRasesh Mody u32 smem_pg0;
958b230ed8SRasesh Mody };
968b230ed8SRasesh Mody
971aa8b471SBen Hutchings /* IOC Mailbox structures */
98bd5a92e9SRasesh Mody typedef void (*bfa_mbox_cmd_cbfn_t)(void *cbarg);
998b230ed8SRasesh Mody struct bfa_mbox_cmd {
1008b230ed8SRasesh Mody struct list_head qe;
101bd5a92e9SRasesh Mody bfa_mbox_cmd_cbfn_t cbfn;
102bd5a92e9SRasesh Mody void *cbarg;
1038b230ed8SRasesh Mody u32 msg[BFI_IOC_MSGSZ];
1048b230ed8SRasesh Mody };
1058b230ed8SRasesh Mody
1061aa8b471SBen Hutchings /* IOC mailbox module */
1078b230ed8SRasesh Mody typedef void (*bfa_ioc_mbox_mcfunc_t)(void *cbarg, struct bfi_mbmsg *m);
1088b230ed8SRasesh Mody struct bfa_ioc_mbox_mod {
1098b230ed8SRasesh Mody struct list_head cmd_q; /*!< pending mbox queue */
1108b230ed8SRasesh Mody int nmclass; /*!< number of handlers */
1118b230ed8SRasesh Mody struct {
1128b230ed8SRasesh Mody bfa_ioc_mbox_mcfunc_t cbfn; /*!< message handlers */
1138b230ed8SRasesh Mody void *cbarg;
1148b230ed8SRasesh Mody } mbhdlr[BFI_MC_MAX];
1158b230ed8SRasesh Mody };
1168b230ed8SRasesh Mody
1171aa8b471SBen Hutchings /* IOC callback function interfaces */
1188b230ed8SRasesh Mody typedef void (*bfa_ioc_enable_cbfn_t)(void *bfa, enum bfa_status status);
1198b230ed8SRasesh Mody typedef void (*bfa_ioc_disable_cbfn_t)(void *bfa);
1208b230ed8SRasesh Mody typedef void (*bfa_ioc_hbfail_cbfn_t)(void *bfa);
1218b230ed8SRasesh Mody typedef void (*bfa_ioc_reset_cbfn_t)(void *bfa);
1228b230ed8SRasesh Mody struct bfa_ioc_cbfn {
1238b230ed8SRasesh Mody bfa_ioc_enable_cbfn_t enable_cbfn;
1248b230ed8SRasesh Mody bfa_ioc_disable_cbfn_t disable_cbfn;
1258b230ed8SRasesh Mody bfa_ioc_hbfail_cbfn_t hbfail_cbfn;
1268b230ed8SRasesh Mody bfa_ioc_reset_cbfn_t reset_cbfn;
1278b230ed8SRasesh Mody };
1288b230ed8SRasesh Mody
1291aa8b471SBen Hutchings /* IOC event notification mechanism. */
130bd5a92e9SRasesh Mody enum bfa_ioc_event {
131bd5a92e9SRasesh Mody BFA_IOC_E_ENABLED = 1,
132bd5a92e9SRasesh Mody BFA_IOC_E_DISABLED = 2,
133bd5a92e9SRasesh Mody BFA_IOC_E_FAILED = 3,
134bd5a92e9SRasesh Mody };
135bd5a92e9SRasesh Mody
136bd5a92e9SRasesh Mody typedef void (*bfa_ioc_notify_cbfn_t)(void *, enum bfa_ioc_event);
137bd5a92e9SRasesh Mody
138bd5a92e9SRasesh Mody struct bfa_ioc_notify {
139bd5a92e9SRasesh Mody struct list_head qe;
140bd5a92e9SRasesh Mody bfa_ioc_notify_cbfn_t cbfn;
141bd5a92e9SRasesh Mody void *cbarg;
142bd5a92e9SRasesh Mody };
143bd5a92e9SRasesh Mody
1441aa8b471SBen Hutchings /* Initialize a IOC event notification structure */
145bd5a92e9SRasesh Mody #define bfa_ioc_notify_init(__notify, __cbfn, __cbarg) do { \
1468b230ed8SRasesh Mody (__notify)->cbfn = (__cbfn); \
1478b230ed8SRasesh Mody (__notify)->cbarg = (__cbarg); \
1488b230ed8SRasesh Mody } while (0)
1498b230ed8SRasesh Mody
150*8719a1c3SGustavo A. R. Silva enum iocpf_event;
151*8719a1c3SGustavo A. R. Silva
1521d32f769SRasesh Mody struct bfa_iocpf {
153*8719a1c3SGustavo A. R. Silva void (*fsm)(struct bfa_iocpf *s, enum iocpf_event e);
1541d32f769SRasesh Mody struct bfa_ioc *ioc;
155078086f3SRasesh Mody bool fw_mismatch_notified;
1561d32f769SRasesh Mody bool auto_recover;
157078086f3SRasesh Mody u32 poll_time;
1581d32f769SRasesh Mody };
1591d32f769SRasesh Mody
160*8719a1c3SGustavo A. R. Silva enum ioc_event;
161*8719a1c3SGustavo A. R. Silva
1628b230ed8SRasesh Mody struct bfa_ioc {
163*8719a1c3SGustavo A. R. Silva void (*fsm)(struct bfa_ioc *s, enum ioc_event e);
1648b230ed8SRasesh Mody struct bfa *bfa;
1658b230ed8SRasesh Mody struct bfa_pcidev pcidev;
1668b230ed8SRasesh Mody struct timer_list ioc_timer;
1671d32f769SRasesh Mody struct timer_list iocpf_timer;
1688b230ed8SRasesh Mody struct timer_list sem_timer;
1698b230ed8SRasesh Mody struct timer_list hb_timer;
1708b230ed8SRasesh Mody u32 hb_count;
171bd5a92e9SRasesh Mody struct list_head notify_q;
1728b230ed8SRasesh Mody void *dbg_fwsave;
1738b230ed8SRasesh Mody int dbg_fwsave_len;
1748b230ed8SRasesh Mody bool dbg_fwsave_once;
175078086f3SRasesh Mody enum bfi_pcifn_class clscode;
1768b230ed8SRasesh Mody struct bfa_ioc_regs ioc_regs;
1778b230ed8SRasesh Mody struct bfa_ioc_drv_stats stats;
1788b230ed8SRasesh Mody bool fcmode;
1798b230ed8SRasesh Mody bool pllinit;
1808b230ed8SRasesh Mody bool stats_busy; /*!< outstanding stats */
1818b230ed8SRasesh Mody u8 port_id;
1828b230ed8SRasesh Mody
1838b230ed8SRasesh Mody struct bfa_dma attr_dma;
1848b230ed8SRasesh Mody struct bfi_ioc_attr *attr;
1858b230ed8SRasesh Mody struct bfa_ioc_cbfn *cbfn;
1868b230ed8SRasesh Mody struct bfa_ioc_mbox_mod mbox_mod;
187d91d25d5Sstephen hemminger const struct bfa_ioc_hwif *ioc_hwif;
1881d32f769SRasesh Mody struct bfa_iocpf iocpf;
189078086f3SRasesh Mody enum bfi_asic_gen asic_gen;
190078086f3SRasesh Mody enum bfi_asic_mode asic_mode;
191078086f3SRasesh Mody enum bfi_port_mode port0_mode;
192078086f3SRasesh Mody enum bfi_port_mode port1_mode;
193078086f3SRasesh Mody enum bfa_mode port_mode;
194078086f3SRasesh Mody u8 ad_cap_bm; /*!< adapter cap bit mask */
195078086f3SRasesh Mody u8 port_mode_cfg; /*!< config port mode */
1968b230ed8SRasesh Mody };
1978b230ed8SRasesh Mody
1988b230ed8SRasesh Mody struct bfa_ioc_hwif {
199078086f3SRasesh Mody enum bfa_status (*ioc_pll_init) (void __iomem *rb,
200078086f3SRasesh Mody enum bfi_asic_mode m);
2018b230ed8SRasesh Mody bool (*ioc_firmware_lock) (struct bfa_ioc *ioc);
2028b230ed8SRasesh Mody void (*ioc_firmware_unlock) (struct bfa_ioc *ioc);
2038b230ed8SRasesh Mody void (*ioc_reg_init) (struct bfa_ioc *ioc);
2048b230ed8SRasesh Mody void (*ioc_map_port) (struct bfa_ioc *ioc);
2058b230ed8SRasesh Mody void (*ioc_isr_mode_set) (struct bfa_ioc *ioc,
2068b230ed8SRasesh Mody bool msix);
2071d32f769SRasesh Mody void (*ioc_notify_fail) (struct bfa_ioc *ioc);
2088b230ed8SRasesh Mody void (*ioc_ownership_reset) (struct bfa_ioc *ioc);
20979ea6c89SRasesh Mody bool (*ioc_sync_start) (struct bfa_ioc *ioc);
2101d32f769SRasesh Mody void (*ioc_sync_join) (struct bfa_ioc *ioc);
2111d32f769SRasesh Mody void (*ioc_sync_leave) (struct bfa_ioc *ioc);
2121d32f769SRasesh Mody void (*ioc_sync_ack) (struct bfa_ioc *ioc);
2131d32f769SRasesh Mody bool (*ioc_sync_complete) (struct bfa_ioc *ioc);
214078086f3SRasesh Mody bool (*ioc_lpu_read_stat) (struct bfa_ioc *ioc);
21541ed903aSRasesh Mody void (*ioc_set_fwstate) (struct bfa_ioc *ioc,
21641ed903aSRasesh Mody enum bfi_ioc_state fwstate);
21741ed903aSRasesh Mody enum bfi_ioc_state (*ioc_get_fwstate) (struct bfa_ioc *ioc);
21841ed903aSRasesh Mody void (*ioc_set_alt_fwstate) (struct bfa_ioc *ioc,
21941ed903aSRasesh Mody enum bfi_ioc_state fwstate);
22041ed903aSRasesh Mody enum bfi_ioc_state (*ioc_get_alt_fwstate) (struct bfa_ioc *ioc);
22141ed903aSRasesh Mody
2228b230ed8SRasesh Mody };
2238b230ed8SRasesh Mody
2248b230ed8SRasesh Mody #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func)
2258b230ed8SRasesh Mody #define bfa_ioc_devid(__ioc) ((__ioc)->pcidev.device_id)
2268b230ed8SRasesh Mody #define bfa_ioc_bar0(__ioc) ((__ioc)->pcidev.pci_bar_kva)
2278b230ed8SRasesh Mody #define bfa_ioc_portid(__ioc) ((__ioc)->port_id)
228078086f3SRasesh Mody #define bfa_ioc_asic_gen(__ioc) ((__ioc)->asic_gen)
22943c07adaSRasesh Mody #define bfa_ioc_is_default(__ioc) \
23043c07adaSRasesh Mody (bfa_ioc_pcifn(__ioc) == bfa_ioc_portid(__ioc))
2318b230ed8SRasesh Mody #define bfa_ioc_speed_sup(__ioc) \
2328b230ed8SRasesh Mody BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop)
2338b230ed8SRasesh Mody #define bfa_ioc_get_nports(__ioc) \
2348b230ed8SRasesh Mody BFI_ADAPTER_GETP(NPORTS, (__ioc)->attr->adapter_prop)
2358b230ed8SRasesh Mody
2368b230ed8SRasesh Mody #define bfa_ioc_stats(_ioc, _stats) ((_ioc)->stats._stats++)
2379b08a4fcSRasesh Mody #define bfa_ioc_stats_hb_count(_ioc, _hb_count) \
2389b08a4fcSRasesh Mody ((_ioc)->stats.hb_count = (_hb_count))
2398b230ed8SRasesh Mody #define BFA_IOC_FWIMG_MINSZ (16 * 1024)
2408b230ed8SRasesh Mody #define BFA_IOC_FW_SMEM_SIZE(__ioc) \
241078086f3SRasesh Mody ((bfa_ioc_asic_gen(__ioc) == BFI_ASIC_GEN_CB) \
242078086f3SRasesh Mody ? BFI_SMEM_CB_SIZE : BFI_SMEM_CT_SIZE)
2438b230ed8SRasesh Mody #define BFA_IOC_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS)
2448b230ed8SRasesh Mody #define BFA_IOC_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS)
2458b230ed8SRasesh Mody #define BFA_IOC_FLASH_CHUNK_ADDR(chunkno) (chunkno * BFI_FLASH_CHUNK_SZ_WORDS)
2468b230ed8SRasesh Mody
2471aa8b471SBen Hutchings /* IOC mailbox interface */
248af027a34SRasesh Mody bool bfa_nw_ioc_mbox_queue(struct bfa_ioc *ioc,
249af027a34SRasesh Mody struct bfa_mbox_cmd *cmd,
250af027a34SRasesh Mody bfa_mbox_cmd_cbfn_t cbfn, void *cbarg);
2518a891429SRasesh Mody void bfa_nw_ioc_mbox_isr(struct bfa_ioc *ioc);
2528a891429SRasesh Mody void bfa_nw_ioc_mbox_regisr(struct bfa_ioc *ioc, enum bfi_mclass mc,
2538b230ed8SRasesh Mody bfa_ioc_mbox_mcfunc_t cbfn, void *cbarg);
2548b230ed8SRasesh Mody
2551aa8b471SBen Hutchings /* IOC interfaces */
2568b230ed8SRasesh Mody
2578b230ed8SRasesh Mody #define bfa_ioc_pll_init_asic(__ioc) \
2588b230ed8SRasesh Mody ((__ioc)->ioc_hwif->ioc_pll_init((__ioc)->pcidev.pci_bar_kva, \
259078086f3SRasesh Mody (__ioc)->asic_mode))
2608b230ed8SRasesh Mody
261078086f3SRasesh Mody #define bfa_ioc_lpu_read_stat(__ioc) do { \
262078086f3SRasesh Mody if ((__ioc)->ioc_hwif->ioc_lpu_read_stat) \
263078086f3SRasesh Mody ((__ioc)->ioc_hwif->ioc_lpu_read_stat(__ioc)); \
264078086f3SRasesh Mody } while (0)
265078086f3SRasesh Mody
2668a891429SRasesh Mody void bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc);
267be3a84d1SRasesh Mody void bfa_nw_ioc_set_ct2_hwif(struct bfa_ioc *ioc);
26870f14381SRasesh Mody void bfa_nw_ioc_ct2_poweron(struct bfa_ioc *ioc);
2698b230ed8SRasesh Mody
2708a891429SRasesh Mody void bfa_nw_ioc_attach(struct bfa_ioc *ioc, void *bfa,
2718b230ed8SRasesh Mody struct bfa_ioc_cbfn *cbfn);
2728a891429SRasesh Mody void bfa_nw_ioc_auto_recover(bool auto_recover);
2738a891429SRasesh Mody void bfa_nw_ioc_detach(struct bfa_ioc *ioc);
2748a891429SRasesh Mody void bfa_nw_ioc_pci_init(struct bfa_ioc *ioc, struct bfa_pcidev *pcidev,
275078086f3SRasesh Mody enum bfi_pcifn_class clscode);
2768a891429SRasesh Mody u32 bfa_nw_ioc_meminfo(void);
2778a891429SRasesh Mody void bfa_nw_ioc_mem_claim(struct bfa_ioc *ioc, u8 *dm_kva, u64 dm_pa);
2788a891429SRasesh Mody void bfa_nw_ioc_enable(struct bfa_ioc *ioc);
2798a891429SRasesh Mody void bfa_nw_ioc_disable(struct bfa_ioc *ioc);
2808b230ed8SRasesh Mody
2818a891429SRasesh Mody void bfa_nw_ioc_error_isr(struct bfa_ioc *ioc);
282bd5a92e9SRasesh Mody bool bfa_nw_ioc_is_disabled(struct bfa_ioc *ioc);
2837afc5dbdSKrishna Gudipati bool bfa_nw_ioc_is_operational(struct bfa_ioc *ioc);
2848a891429SRasesh Mody void bfa_nw_ioc_get_attr(struct bfa_ioc *ioc, struct bfa_ioc_attr *ioc_attr);
285c107ba17SRasesh Mody enum bfa_status bfa_nw_ioc_fwsig_invalidate(struct bfa_ioc *ioc);
286bd5a92e9SRasesh Mody void bfa_nw_ioc_notify_register(struct bfa_ioc *ioc,
287bd5a92e9SRasesh Mody struct bfa_ioc_notify *notify);
2888a891429SRasesh Mody bool bfa_nw_ioc_sem_get(void __iomem *sem_reg);
2898a891429SRasesh Mody void bfa_nw_ioc_sem_release(void __iomem *sem_reg);
2908a891429SRasesh Mody void bfa_nw_ioc_hw_sem_release(struct bfa_ioc *ioc);
2918a891429SRasesh Mody void bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc,
2928b230ed8SRasesh Mody struct bfi_ioc_image_hdr *fwhdr);
2938a891429SRasesh Mody bool bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc,
2948b230ed8SRasesh Mody struct bfi_ioc_image_hdr *fwhdr);
295d6b30598SIvan Vecera void bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac);
2967afc5dbdSKrishna Gudipati void bfa_nw_ioc_debug_memclaim(struct bfa_ioc *ioc, void *dbg_fwsave);
2977afc5dbdSKrishna Gudipati int bfa_nw_ioc_debug_fwtrc(struct bfa_ioc *ioc, void *trcdata, int *trclen);
2987afc5dbdSKrishna Gudipati int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen);
2998b230ed8SRasesh Mody
3008b230ed8SRasesh Mody /*
3018b230ed8SRasesh Mody * Timeout APIs
3028b230ed8SRasesh Mody */
303ad24d6f0SIvan Vecera void bfa_nw_ioc_timeout(struct bfa_ioc *ioc);
304ad24d6f0SIvan Vecera void bfa_nw_ioc_hb_check(struct bfa_ioc *ioc);
305ad24d6f0SIvan Vecera void bfa_nw_iocpf_timeout(struct bfa_ioc *ioc);
306ad24d6f0SIvan Vecera void bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc);
3078b230ed8SRasesh Mody
3088b230ed8SRasesh Mody /*
3098b230ed8SRasesh Mody * F/W Image Size & Chunk
3108b230ed8SRasesh Mody */
311078086f3SRasesh Mody u32 *bfa_cb_image_get_chunk(enum bfi_asic_gen asic_gen, u32 off);
312078086f3SRasesh Mody u32 bfa_cb_image_get_size(enum bfi_asic_gen asic_gen);
3138b230ed8SRasesh Mody
31472a9730bSKrishna Gudipati /*
31572a9730bSKrishna Gudipati * Flash module specific
31672a9730bSKrishna Gudipati */
31772a9730bSKrishna Gudipati typedef void (*bfa_cb_flash) (void *cbarg, enum bfa_status status);
31872a9730bSKrishna Gudipati
31972a9730bSKrishna Gudipati struct bfa_flash {
32072a9730bSKrishna Gudipati struct bfa_ioc *ioc; /* back pointer to ioc */
32172a9730bSKrishna Gudipati u32 type; /* partition type */
32272a9730bSKrishna Gudipati u8 instance; /* partition instance */
32372a9730bSKrishna Gudipati u8 rsv[3];
32472a9730bSKrishna Gudipati u32 op_busy; /* operation busy flag */
32572a9730bSKrishna Gudipati u32 residue; /* residual length */
32672a9730bSKrishna Gudipati u32 offset; /* offset */
32772a9730bSKrishna Gudipati enum bfa_status status; /* status */
32872a9730bSKrishna Gudipati u8 *dbuf_kva; /* dma buf virtual address */
32972a9730bSKrishna Gudipati u64 dbuf_pa; /* dma buf physical address */
33072a9730bSKrishna Gudipati bfa_cb_flash cbfn; /* user callback function */
33172a9730bSKrishna Gudipati void *cbarg; /* user callback arg */
33272a9730bSKrishna Gudipati u8 *ubuf; /* user supplied buffer */
33372a9730bSKrishna Gudipati u32 addr_off; /* partition address offset */
33472a9730bSKrishna Gudipati struct bfa_mbox_cmd mb; /* mailbox */
33572a9730bSKrishna Gudipati struct bfa_ioc_notify ioc_notify; /* ioc event notify */
33672a9730bSKrishna Gudipati };
33772a9730bSKrishna Gudipati
33872a9730bSKrishna Gudipati enum bfa_status bfa_nw_flash_get_attr(struct bfa_flash *flash,
33972a9730bSKrishna Gudipati struct bfa_flash_attr *attr,
34072a9730bSKrishna Gudipati bfa_cb_flash cbfn, void *cbarg);
34172a9730bSKrishna Gudipati enum bfa_status bfa_nw_flash_update_part(struct bfa_flash *flash,
34272a9730bSKrishna Gudipati u32 type, u8 instance, void *buf, u32 len, u32 offset,
34372a9730bSKrishna Gudipati bfa_cb_flash cbfn, void *cbarg);
34472a9730bSKrishna Gudipati enum bfa_status bfa_nw_flash_read_part(struct bfa_flash *flash,
34572a9730bSKrishna Gudipati u32 type, u8 instance, void *buf, u32 len, u32 offset,
34672a9730bSKrishna Gudipati bfa_cb_flash cbfn, void *cbarg);
34772a9730bSKrishna Gudipati u32 bfa_nw_flash_meminfo(void);
34872a9730bSKrishna Gudipati void bfa_nw_flash_attach(struct bfa_flash *flash,
34972a9730bSKrishna Gudipati struct bfa_ioc *ioc, void *dev);
35072a9730bSKrishna Gudipati void bfa_nw_flash_memclaim(struct bfa_flash *flash, u8 *dm_kva, u64 dm_pa);
35172a9730bSKrishna Gudipati
3528b230ed8SRasesh Mody #endif /* __BFA_IOC_H__ */
353