Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3)  * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4)  * Copyright (c) 2014- QLogic Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)  * All rights reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)  * www.qlogic.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8)  * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) #ifndef __BFA_IOC_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #define __BFA_IOC_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) #include "bfad_drv.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #include "bfa_cs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) #include "bfi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #define BFA_DBG_FWTRC_ENTS	(BFI_IOC_TRC_ENTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) #define BFA_DBG_FWTRC_LEN					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) 	(BFA_DBG_FWTRC_ENTS * sizeof(struct bfa_trc_s) +	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) 	(sizeof(struct bfa_trc_mod_s) -				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) 	BFA_TRC_MAX * sizeof(struct bfa_trc_s)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24)  * BFA timer declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) typedef void (*bfa_timer_cbfn_t)(void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29)  * BFA timer data structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) struct bfa_timer_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) 	struct list_head	qe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) 	bfa_timer_cbfn_t timercb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) 	void		*arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) 	int		timeout;	/* in millisecs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39)  * Timer module structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) struct bfa_timer_mod_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) 	struct list_head timer_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #define BFA_TIMER_FREQ 200 /* specified in millisecs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) void bfa_timer_beat(struct bfa_timer_mod_s *mod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) void bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) 			bfa_timer_cbfn_t timercb, void *arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) 			unsigned int timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) void bfa_timer_stop(struct bfa_timer_s *timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54)  * Generic Scatter Gather Element used by driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) struct bfa_sge_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) 	u32	sg_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) 	void		*sg_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) #define bfa_sge_word_swap(__sge) do {					     \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) 	((u32 *)(__sge))[0] = swab32(((u32 *)(__sge))[0]);      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 	((u32 *)(__sge))[1] = swab32(((u32 *)(__sge))[1]);      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) 	((u32 *)(__sge))[2] = swab32(((u32 *)(__sge))[2]);      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) #define bfa_swap_words(_x)  (	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) 	((u64)(_x) << 32) | ((u64)(_x) >> 32))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) #ifdef __BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) #define bfa_sge_to_be(_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) #define bfa_sge_to_le(_x)	bfa_sge_word_swap(_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) #define bfa_sgaddr_le(_x)	bfa_swap_words(_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) #define	bfa_sge_to_be(_x)	bfa_sge_word_swap(_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) #define bfa_sge_to_le(_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) #define bfa_sgaddr_le(_x)	(_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81)  * BFA memory resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) struct bfa_mem_dma_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) 	struct list_head qe;		/* Queue of DMA elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 	u32		mem_len;	/* Total Length in Bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 	u8		*kva;		/* kernel virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 	u64		dma;		/* dma address if DMA memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) 	u8		*kva_curp;	/* kva allocation cursor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) 	u64		dma_curp;	/* dma allocation cursor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) #define bfa_mem_dma_t struct bfa_mem_dma_s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) struct bfa_mem_kva_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) 	struct list_head qe;		/* Queue of KVA elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 	u32		mem_len;	/* Total Length in Bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) 	u8		*kva;		/* kernel virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) 	u8		*kva_curp;	/* kva allocation cursor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) #define bfa_mem_kva_t struct bfa_mem_kva_s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) struct bfa_meminfo_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 	struct bfa_mem_dma_s dma_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 	struct bfa_mem_kva_s kva_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) /* BFA memory segment setup helpers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) static inline void bfa_mem_dma_setup(struct bfa_meminfo_s *meminfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) 				     struct bfa_mem_dma_s *dm_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) 				     size_t seg_sz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) 	dm_ptr->mem_len = seg_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 	if (seg_sz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 		list_add_tail(&dm_ptr->qe, &meminfo->dma_info.qe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) static inline void bfa_mem_kva_setup(struct bfa_meminfo_s *meminfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 				     struct bfa_mem_kva_s *kva_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) 				     size_t seg_sz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 	kva_ptr->mem_len = seg_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 	if (seg_sz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) 		list_add_tail(&kva_ptr->qe, &meminfo->kva_info.qe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) /* BFA dma memory segments iterator */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) #define bfa_mem_dma_sptr(_mod, _i)	(&(_mod)->dma_seg[(_i)])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) #define bfa_mem_dma_seg_iter(_mod, _sptr, _nr, _i)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) 	for (_i = 0, _sptr = bfa_mem_dma_sptr(_mod, _i); _i < (_nr);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) 	     _i++, _sptr = bfa_mem_dma_sptr(_mod, _i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) #define bfa_mem_kva_curp(_mod)	((_mod)->kva_seg.kva_curp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) #define bfa_mem_dma_virt(_sptr)	((_sptr)->kva_curp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) #define bfa_mem_dma_phys(_sptr)	((_sptr)->dma_curp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) #define bfa_mem_dma_len(_sptr)	((_sptr)->mem_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) /* Get the corresponding dma buf kva for a req - from the tag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) #define bfa_mem_get_dmabuf_kva(_mod, _tag, _rqsz)			      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) 	(((u8 *)(_mod)->dma_seg[BFI_MEM_SEG_FROM_TAG(_tag, _rqsz)].kva_curp) +\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) 	 BFI_MEM_SEG_REQ_OFFSET(_tag, _rqsz) * (_rqsz))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) /* Get the corresponding dma buf pa for a req - from the tag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) #define bfa_mem_get_dmabuf_pa(_mod, _tag, _rqsz)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	((_mod)->dma_seg[BFI_MEM_SEG_FROM_TAG(_tag, _rqsz)].dma_curp +	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 	 BFI_MEM_SEG_REQ_OFFSET(_tag, _rqsz) * (_rqsz))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147)  * PCI device information required by IOC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) struct bfa_pcidev_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 	int		pci_slot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 	u8		pci_func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	u16		device_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	u16		ssid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 	void __iomem	*pci_bar_kva;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158)  * Structure used to remember the DMA-able memory block's KVA and Physical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159)  * Address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) struct bfa_dma_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	void		*kva;	/* ! Kernel virtual address	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) 	u64	pa;	/* ! Physical address		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) #define BFA_DMA_ALIGN_SZ	256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) #define BFA_ROUNDUP(_l, _s)	(((_l) + ((_s) - 1)) & ~((_s) - 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170)  * smem size for Crossbow and Catapult
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) #define BFI_SMEM_CB_SIZE	0x200000U	/* ! 2MB for crossbow	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) #define BFI_SMEM_CT_SIZE	0x280000U	/* ! 2.5MB for catapult	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) #define bfa_dma_be_addr_set(dma_addr, pa)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 		__bfa_dma_be_addr_set(&dma_addr, (u64)pa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 	dma_addr->a32.addr_lo = cpu_to_be32(pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) 	dma_addr->a32.addr_hi = cpu_to_be32(pa >> 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) #define bfa_alen_set(__alen, __len, __pa)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 	__bfa_alen_set(__alen, __len, (u64)__pa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) __bfa_alen_set(struct bfi_alen_s *alen, u32 len, u64 pa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	alen->al_len = cpu_to_be32(len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 	bfa_dma_be_addr_set(alen->al_addr, pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) struct bfa_ioc_regs_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	void __iomem *hfn_mbox_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 	void __iomem *hfn_mbox;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	void __iomem *lpu_mbox_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	void __iomem *lpu_mbox;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 	void __iomem *lpu_read_stat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	void __iomem *pss_ctl_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 	void __iomem *pss_err_status_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	void __iomem *app_pll_fast_ctl_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 	void __iomem *app_pll_slow_ctl_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 	void __iomem *ioc_sem_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 	void __iomem *ioc_usage_sem_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) 	void __iomem *ioc_init_sem_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 	void __iomem *ioc_usage_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) 	void __iomem *host_page_num_fn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	void __iomem *heartbeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 	void __iomem *ioc_fwstate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 	void __iomem *alt_ioc_fwstate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 	void __iomem *ll_halt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 	void __iomem *alt_ll_halt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 	void __iomem *err_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 	void __iomem *ioc_fail_sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 	void __iomem *shirq_isr_next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 	void __iomem *shirq_msk_next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) 	void __iomem *smem_page_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) 	u32	smem_pg0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) #define bfa_mem_read(_raddr, _off)	swab32(readl(((_raddr) + (_off))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) #define bfa_mem_write(_raddr, _off, _val)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) 			writel(swab32((_val)), ((_raddr) + (_off)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226)  * IOC Mailbox structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) struct bfa_mbox_cmd_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) 	struct list_head	qe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 	u32	msg[BFI_IOC_MSGSZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234)  * IOC mailbox module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) typedef void (*bfa_ioc_mbox_mcfunc_t)(void *cbarg, struct bfi_mbmsg_s *m);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) struct bfa_ioc_mbox_mod_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 	struct list_head		cmd_q;	/*  pending mbox queue	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 	int			nmclass;	/*  number of handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 		bfa_ioc_mbox_mcfunc_t	cbfn;	/*  message handlers	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) 		void			*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 	} mbhdlr[BFI_MC_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247)  * IOC callback function interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) typedef void (*bfa_ioc_enable_cbfn_t)(void *bfa, enum bfa_status status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) typedef void (*bfa_ioc_disable_cbfn_t)(void *bfa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) typedef void (*bfa_ioc_hbfail_cbfn_t)(void *bfa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) typedef void (*bfa_ioc_reset_cbfn_t)(void *bfa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) struct bfa_ioc_cbfn_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) 	bfa_ioc_enable_cbfn_t	enable_cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 	bfa_ioc_disable_cbfn_t	disable_cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) 	bfa_ioc_hbfail_cbfn_t	hbfail_cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 	bfa_ioc_reset_cbfn_t	reset_cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261)  * IOC event notification mechanism.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) enum bfa_ioc_event_e {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) 	BFA_IOC_E_ENABLED	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 	BFA_IOC_E_DISABLED	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 	BFA_IOC_E_FAILED	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) typedef void (*bfa_ioc_notify_cbfn_t)(void *, enum bfa_ioc_event_e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) struct bfa_ioc_notify_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	struct list_head		qe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 	bfa_ioc_notify_cbfn_t	cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 	void			*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278)  * Initialize a IOC event notification structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) #define bfa_ioc_notify_init(__notify, __cbfn, __cbarg) do {	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 	(__notify)->cbfn = (__cbfn);      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	(__notify)->cbarg = (__cbarg);      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) struct bfa_iocpf_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	bfa_fsm_t		fsm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	struct bfa_ioc_s	*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 	bfa_boolean_t		fw_mismatch_notified;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 	bfa_boolean_t		auto_recover;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 	u32			poll_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) struct bfa_ioc_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 	bfa_fsm_t		fsm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	struct bfa_s		*bfa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 	struct bfa_pcidev_s	pcidev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	struct bfa_timer_mod_s	*timer_mod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) 	struct bfa_timer_s	ioc_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 	struct bfa_timer_s	sem_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 	struct bfa_timer_s	hb_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 	u32		hb_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 	struct list_head	notify_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 	void			*dbg_fwsave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 	int			dbg_fwsave_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	bfa_boolean_t		dbg_fwsave_once;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 	enum bfi_pcifn_class	clscode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 	struct bfa_ioc_regs_s	ioc_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 	struct bfa_trc_mod_s	*trcmod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 	struct bfa_ioc_drv_stats_s	stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 	bfa_boolean_t		fcmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 	bfa_boolean_t		pllinit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 	bfa_boolean_t		stats_busy;	/*  outstanding stats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 	u8			port_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 	struct bfa_dma_s	attr_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 	struct bfi_ioc_attr_s	*attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 	struct bfa_ioc_cbfn_s	*cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 	struct bfa_ioc_mbox_mod_s mbox_mod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 	struct bfa_ioc_hwif_s	*ioc_hwif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) 	struct bfa_iocpf_s	iocpf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 	enum bfi_asic_gen	asic_gen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	enum bfi_asic_mode	asic_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	enum bfi_port_mode	port0_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 	enum bfi_port_mode	port1_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 	enum bfa_mode_s		port_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 	u8			ad_cap_bm;	/* adapter cap bit mask */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 	u8			port_mode_cfg;	/* config port mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	int			ioc_aen_seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) struct bfa_ioc_hwif_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	bfa_status_t (*ioc_pll_init) (void __iomem *rb, enum bfi_asic_mode m);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) 	bfa_boolean_t	(*ioc_firmware_lock)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 	void		(*ioc_firmware_unlock)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 	void		(*ioc_reg_init)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) 	void		(*ioc_map_port)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) 	void		(*ioc_isr_mode_set)	(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 					bfa_boolean_t msix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	void		(*ioc_notify_fail)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 	void		(*ioc_ownership_reset)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 	bfa_boolean_t   (*ioc_sync_start)       (struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	void		(*ioc_sync_join)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 	void		(*ioc_sync_leave)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	void		(*ioc_sync_ack)		(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 	bfa_boolean_t	(*ioc_sync_complete)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) 	bfa_boolean_t	(*ioc_lpu_read_stat)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 	void		(*ioc_set_fwstate)	(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 					enum bfi_ioc_state fwstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	enum bfi_ioc_state	(*ioc_get_fwstate)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) 	void		(*ioc_set_alt_fwstate)	(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 					enum bfi_ioc_state fwstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 	enum bfi_ioc_state	(*ioc_get_alt_fwstate)	(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355)  * Queue element to wait for room in request queue. FIFO order is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356)  * maintained when fullfilling requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) struct bfa_reqq_wait_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	struct list_head	qe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	void	(*qresume) (void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	void	*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) typedef void	(*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367)  * Generic BFA callback element.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) struct bfa_cb_qe_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 	struct list_head	qe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) 	bfa_cb_cbfn_t	cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 	bfa_boolean_t	once;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 	bfa_boolean_t	pre_rmv;	/* set for stack based qe(s) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) 	bfa_status_t	fw_status;	/* to access fw status in comp proc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 	void		*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379)  * IOCFC state machine definitions/declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) enum iocfc_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 	IOCFC_E_INIT		= 1,	/* IOCFC init request		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 	IOCFC_E_START		= 2,	/* IOCFC mod start request	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 	IOCFC_E_STOP		= 3,	/* IOCFC stop request		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) 	IOCFC_E_ENABLE		= 4,	/* IOCFC enable request		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 	IOCFC_E_DISABLE		= 5,	/* IOCFC disable request	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) 	IOCFC_E_IOC_ENABLED	= 6,	/* IOC enabled message		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) 	IOCFC_E_IOC_DISABLED	= 7,	/* IOC disabled message		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) 	IOCFC_E_IOC_FAILED	= 8,	/* failure notice by IOC sm	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) 	IOCFC_E_DCONF_DONE	= 9,	/* dconf read/write done	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 	IOCFC_E_CFG_DONE	= 10,	/* IOCFC config complete	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395)  * ASIC block configurtion related
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) typedef void (*bfa_ablk_cbfn_t)(void *, enum bfa_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) struct bfa_ablk_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 	struct bfa_ioc_s	*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 	struct bfa_ablk_cfg_s	*cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) 	u16			*pcifn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 	struct bfa_dma_s	dma_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 	bfa_boolean_t		busy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) 	struct bfa_mbox_cmd_s	mb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) 	bfa_ablk_cbfn_t		cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) 	void			*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) 	struct bfa_ioc_notify_s	ioc_notify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) 	struct bfa_mem_dma_s	ablk_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) #define BFA_MEM_ABLK_DMA(__bfa)		(&((__bfa)->modules.ablk.ablk_dma))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415)  *	SFP module specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) typedef void	(*bfa_cb_sfp_t) (void *cbarg, bfa_status_t status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) struct bfa_sfp_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 	void	*dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) 	struct bfa_ioc_s	*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 	struct bfa_trc_mod_s	*trcmod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) 	struct sfp_mem_s	*sfpmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 	bfa_cb_sfp_t		cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	void			*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 	enum bfi_sfp_mem_e	memtype; /* mem access type   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 	u32			status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 	struct bfa_mbox_cmd_s	mbcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 	u8			*dbuf_kva; /* dma buf virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 	u64			dbuf_pa;   /* dma buf physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 	struct bfa_ioc_notify_s	ioc_notify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 	enum bfa_defs_sfp_media_e *media;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 	enum bfa_port_speed	portspeed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 	bfa_cb_sfp_t		state_query_cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 	void			*state_query_cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 	u8			lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 	u8			data_valid; /* data in dbuf is valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 	u8			state;	    /* sfp state  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 	u8			state_query_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 	struct bfa_mem_dma_s	sfp_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 	u8			is_elb;	    /* eloopback  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) #define BFA_SFP_MOD(__bfa)	(&(__bfa)->modules.sfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) #define BFA_MEM_SFP_DMA(__bfa)	(&(BFA_SFP_MOD(__bfa)->sfp_dma))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) u32	bfa_sfp_meminfo(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) void	bfa_sfp_attach(struct bfa_sfp_s *sfp, struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 			void *dev, struct bfa_trc_mod_s *trcmod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) void	bfa_sfp_memclaim(struct bfa_sfp_s *diag, u8 *dm_kva, u64 dm_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) void	bfa_sfp_intr(void *bfaarg, struct bfi_mbmsg_s *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) bfa_status_t	bfa_sfp_show(struct bfa_sfp_s *sfp, struct sfp_mem_s *sfpmem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 			     bfa_cb_sfp_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) bfa_status_t	bfa_sfp_media(struct bfa_sfp_s *sfp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 			enum bfa_defs_sfp_media_e *media,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 			bfa_cb_sfp_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) bfa_status_t	bfa_sfp_speed(struct bfa_sfp_s *sfp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 			enum bfa_port_speed portspeed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 			bfa_cb_sfp_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467)  *	Flash module specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) typedef void	(*bfa_cb_flash_t) (void *cbarg, bfa_status_t status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) struct bfa_flash_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 	struct bfa_ioc_s *ioc;		/* back pointer to ioc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) 	struct bfa_trc_mod_s *trcmod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) 	u32		type;           /* partition type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 	u8		instance;       /* partition instance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) 	u8		rsv[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 	u32		op_busy;        /*  operation busy flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 	u32		residue;        /*  residual length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) 	u32		offset;         /*  offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 	bfa_status_t	status;         /*  status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 	u8		*dbuf_kva;      /*  dma buf virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) 	u64		dbuf_pa;        /*  dma buf physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	struct bfa_reqq_wait_s	reqq_wait; /*  to wait for room in reqq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 	bfa_cb_flash_t	cbfn;           /*  user callback function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 	void		*cbarg;         /*  user callback arg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 	u8		*ubuf;          /*  user supplied buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) 	struct bfa_cb_qe_s	hcb_qe; /*  comp: BFA callback qelem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	u32		addr_off;       /*  partition address offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) 	struct bfa_mbox_cmd_s	mb;       /*  mailbox */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) 	struct bfa_ioc_notify_s	ioc_notify; /*  ioc event notify */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) 	struct bfa_mem_dma_s	flash_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) #define BFA_FLASH(__bfa)		(&(__bfa)->modules.flash)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) #define BFA_MEM_FLASH_DMA(__bfa)	(&(BFA_FLASH(__bfa)->flash_dma))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) bfa_status_t bfa_flash_get_attr(struct bfa_flash_s *flash,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 			struct bfa_flash_attr_s *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 			bfa_cb_flash_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) bfa_status_t bfa_flash_erase_part(struct bfa_flash_s *flash,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 			enum bfa_flash_part_type type, u8 instance,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 			bfa_cb_flash_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) bfa_status_t bfa_flash_update_part(struct bfa_flash_s *flash,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 			enum bfa_flash_part_type type, u8 instance,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) 			bfa_cb_flash_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) bfa_status_t bfa_flash_read_part(struct bfa_flash_s *flash,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) 			enum bfa_flash_part_type type, u8 instance, void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 			u32 len, u32 offset, bfa_cb_flash_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) u32	bfa_flash_meminfo(bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) void bfa_flash_attach(struct bfa_flash_s *flash, struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 		void *dev, struct bfa_trc_mod_s *trcmod, bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) void bfa_flash_memclaim(struct bfa_flash_s *flash,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) 		u8 *dm_kva, u64 dm_pa, bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) bfa_status_t    bfa_flash_raw_read(void __iomem *pci_bar_kva,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 				u32 offset, char *buf, u32 len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519)  *	DIAG module specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) typedef void (*bfa_cb_diag_t) (void *cbarg, bfa_status_t status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) typedef void (*bfa_cb_diag_beacon_t) (void *dev, bfa_boolean_t beacon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 			bfa_boolean_t link_e2e_beacon);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527)  *      Firmware ping test results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) struct bfa_diag_results_fwping {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 	u32     data;   /* store the corrupted data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 	u32     status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) 	u32     dmastatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	u8      rsvd[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) struct bfa_diag_qtest_result_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 	u32	status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) 	u16	count;	/* successful queue test count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) 	u8	queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) 	u8	rsvd;	/* 64-bit align */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544)  * Firmware ping test results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) struct bfa_diag_fwping_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 	struct bfa_diag_results_fwping *result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 	bfa_cb_diag_t  cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	void            *cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 	u32             data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 	u8              lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 	u8              rsv[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 	u32             status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) 	u32             count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 	struct bfa_mbox_cmd_s   mbcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 	u8              *dbuf_kva;      /* dma buf virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	u64             dbuf_pa;        /* dma buf physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561)  *      Temperature sensor query results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) struct bfa_diag_results_tempsensor_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 	u32     status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 	u16     temp;           /* 10-bit A/D value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	u16     brd_temp;       /* 9-bit board temp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 	u8      ts_junc;        /* show junction tempsensor   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 	u8      ts_brd;         /* show board tempsensor      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 	u8      rsvd[6];        /* keep 8 bytes alignment     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) struct bfa_diag_tsensor_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 	bfa_cb_diag_t   cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	void            *cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 	struct bfa_diag_results_tempsensor_s *temp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 	u8              lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	u8              rsv[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	u32             status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 	struct bfa_mbox_cmd_s   mbcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) struct bfa_diag_sfpshow_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	struct sfp_mem_s        *sfpmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	bfa_cb_diag_t           cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 	void                    *cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 	u8      lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 	u8      static_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 	u8      rsv[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 	u32     status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	struct bfa_mbox_cmd_s    mbcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 	u8      *dbuf_kva;      /* dma buf virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 	u64     dbuf_pa;        /* dma buf physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) struct bfa_diag_led_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 	struct bfa_mbox_cmd_s   mbcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 	bfa_boolean_t   lock;   /* 1: ledtest is operating */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) struct bfa_diag_beacon_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) 	struct bfa_mbox_cmd_s   mbcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	bfa_boolean_t   state;          /* port beacon state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) 	bfa_boolean_t   link_e2e;       /* link beacon state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) struct bfa_diag_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 	void	*dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 	struct bfa_ioc_s		*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) 	struct bfa_trc_mod_s		*trcmod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) 	struct bfa_diag_fwping_s	fwping;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 	struct bfa_diag_tsensor_s	tsensor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 	struct bfa_diag_sfpshow_s	sfpshow;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 	struct bfa_diag_led_s		ledtest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 	struct bfa_diag_beacon_s	beacon;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 	void	*result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	struct bfa_timer_s timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 	bfa_cb_diag_beacon_t  cbfn_beacon;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 	bfa_cb_diag_t  cbfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 	void		*cbarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	u8		block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 	u8		timer_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	u8		rsvd[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	u32		status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 	struct bfa_ioc_notify_s	ioc_notify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	struct bfa_mem_dma_s	diag_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) #define BFA_DIAG_MOD(__bfa)     (&(__bfa)->modules.diag_mod)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) #define BFA_MEM_DIAG_DMA(__bfa) (&(BFA_DIAG_MOD(__bfa)->diag_dma))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) u32	bfa_diag_meminfo(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) void bfa_diag_memclaim(struct bfa_diag_s *diag, u8 *dm_kva, u64 dm_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) void bfa_diag_attach(struct bfa_diag_s *diag, struct bfa_ioc_s *ioc, void *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 		     bfa_cb_diag_beacon_t cbfn_beacon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 		     struct bfa_trc_mod_s *trcmod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) bfa_status_t	bfa_diag_reg_read(struct bfa_diag_s *diag, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 			u32 len, u32 *buf, u32 force);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) bfa_status_t	bfa_diag_reg_write(struct bfa_diag_s *diag, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 			u32 len, u32 value, u32 force);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) bfa_status_t	bfa_diag_tsensor_query(struct bfa_diag_s *diag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 			struct bfa_diag_results_tempsensor_s *result,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 			bfa_cb_diag_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) bfa_status_t	bfa_diag_fwping(struct bfa_diag_s *diag, u32 cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 			u32 pattern, struct bfa_diag_results_fwping *result,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 			bfa_cb_diag_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) bfa_status_t	bfa_diag_sfpshow(struct bfa_diag_s *diag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 			struct sfp_mem_s *sfpmem, u8 static_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 			bfa_cb_diag_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) bfa_status_t	bfa_diag_memtest(struct bfa_diag_s *diag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 			struct bfa_diag_memtest_s *memtest, u32 pattern,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 			struct bfa_diag_memtest_result *result,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 			bfa_cb_diag_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) bfa_status_t	bfa_diag_ledtest(struct bfa_diag_s *diag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 			struct bfa_diag_ledtest_s *ledtest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) bfa_status_t	bfa_diag_beacon_port(struct bfa_diag_s *diag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 			bfa_boolean_t beacon, bfa_boolean_t link_e2e_beacon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 			u32 sec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660)  *	PHY module specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) typedef void (*bfa_cb_phy_t) (void *cbarg, bfa_status_t status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) struct bfa_phy_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	struct bfa_ioc_s *ioc;          /* back pointer to ioc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 	struct bfa_trc_mod_s *trcmod;   /* trace module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 	u8	instance;       /* port instance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 	u8	op_busy;        /* operation busy flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 	u8	rsv[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 	u32	residue;        /* residual length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 	u32	offset;         /* offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 	bfa_status_t	status;         /* status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	u8	*dbuf_kva;      /* dma buf virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 	u64	dbuf_pa;        /* dma buf physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 	struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	bfa_cb_phy_t	cbfn;           /* user callback function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 	void		*cbarg;         /* user callback arg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 	u8		*ubuf;          /* user supplied buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 	struct bfa_cb_qe_s	hcb_qe; /* comp: BFA callback qelem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 	u32	addr_off;       /* phy address offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	struct bfa_mbox_cmd_s	mb;       /* mailbox */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	struct bfa_ioc_notify_s	ioc_notify; /* ioc event notify */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	struct bfa_mem_dma_s	phy_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) #define BFA_PHY(__bfa)	(&(__bfa)->modules.phy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) #define BFA_MEM_PHY_DMA(__bfa)	(&(BFA_PHY(__bfa)->phy_dma))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) bfa_boolean_t bfa_phy_busy(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) bfa_status_t bfa_phy_get_attr(struct bfa_phy_s *phy, u8 instance,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 			struct bfa_phy_attr_s *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 			bfa_cb_phy_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) bfa_status_t bfa_phy_get_stats(struct bfa_phy_s *phy, u8 instance,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 			struct bfa_phy_stats_s *stats,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 			bfa_cb_phy_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) bfa_status_t bfa_phy_update(struct bfa_phy_s *phy, u8 instance,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 			bfa_cb_phy_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) bfa_status_t bfa_phy_read(struct bfa_phy_s *phy, u8 instance,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 			bfa_cb_phy_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) u32	bfa_phy_meminfo(bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) void bfa_phy_attach(struct bfa_phy_s *phy, struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 		void *dev, struct bfa_trc_mod_s *trcmod, bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) void bfa_phy_memclaim(struct bfa_phy_s *phy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 		u8 *dm_kva, u64 dm_pa, bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) void bfa_phy_intr(void *phyarg, struct bfi_mbmsg_s *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710)  * FRU module specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) typedef void (*bfa_cb_fru_t) (void *cbarg, bfa_status_t status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) struct bfa_fru_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 	struct bfa_ioc_s *ioc;		/* back pointer to ioc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	struct bfa_trc_mod_s *trcmod;	/* trace module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 	u8		op_busy;	/* operation busy flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	u8		rsv[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	u32		residue;	/* residual length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 	u32		offset;		/* offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) 	bfa_status_t	status;		/* status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 	u8		*dbuf_kva;	/* dma buf virtual address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) 	u64		dbuf_pa;	/* dma buf physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	bfa_cb_fru_t	cbfn;		/* user callback function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 	void		*cbarg;		/* user callback arg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	u8		*ubuf;		/* user supplied buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	struct bfa_cb_qe_s	hcb_qe;	/* comp: BFA callback qelem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 	u32		addr_off;	/* fru address offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 	struct bfa_mbox_cmd_s mb;	/* mailbox */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 	struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 	struct bfa_mem_dma_s	fru_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) 	u8		trfr_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) #define BFA_FRU(__bfa)	(&(__bfa)->modules.fru)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) #define BFA_MEM_FRU_DMA(__bfa)	(&(BFA_FRU(__bfa)->fru_dma))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 			bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 			bfa_cb_fru_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) bfa_status_t bfa_fruvpd_get_max_size(struct bfa_fru_s *fru, u32 *max_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) bfa_status_t bfa_tfru_write(struct bfa_fru_s *fru,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 			bfa_cb_fru_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) bfa_status_t bfa_tfru_read(struct bfa_fru_s *fru,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 			void *buf, u32 len, u32 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 			bfa_cb_fru_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) u32	bfa_fru_meminfo(bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) void bfa_fru_attach(struct bfa_fru_s *fru, struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 		void *dev, struct bfa_trc_mod_s *trcmod, bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) void bfa_fru_memclaim(struct bfa_fru_s *fru,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 		u8 *dm_kva, u64 dm_pa, bfa_boolean_t mincfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) void bfa_fru_intr(void *fruarg, struct bfi_mbmsg_s *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760)  * Driver Config( dconf) specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) #define BFI_DCONF_SIGNATURE	0xabcdabcd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) #define BFI_DCONF_VERSION	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) #pragma pack(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) struct bfa_dconf_hdr_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	u32	signature;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 	u32	version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) struct bfa_dconf_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	struct bfa_dconf_hdr_s		hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	struct bfa_lunmask_cfg_s	lun_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 	struct bfa_throttle_cfg_s	throttle_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) #pragma pack()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) struct bfa_dconf_mod_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 	bfa_sm_t		sm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 	u8			instance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 	bfa_boolean_t		read_data_valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 	bfa_boolean_t		min_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 	struct bfa_timer_s	timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	struct bfa_s		*bfa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 	void			*bfad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 	void			*trcmod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	struct bfa_dconf_s	*dconf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 	struct bfa_mem_kva_s	kva_seg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) #define BFA_DCONF_MOD(__bfa)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 	(&(__bfa)->modules.dconf_mod)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) #define BFA_MEM_DCONF_KVA(__bfa)	(&(BFA_DCONF_MOD(__bfa)->kva_seg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) #define bfa_dconf_read_data_valid(__bfa)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 	(BFA_DCONF_MOD(__bfa)->read_data_valid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) #define BFA_DCONF_UPDATE_TOV	5000	/* memtest timeout in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) #define bfa_dconf_get_min_cfg(__bfa)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	(BFA_DCONF_MOD(__bfa)->min_cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) void	bfa_dconf_modinit(struct bfa_s *bfa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) void	bfa_dconf_modexit(struct bfa_s *bfa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) bfa_status_t	bfa_dconf_update(struct bfa_s *bfa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805)  *	IOC specfic macros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) #define bfa_ioc_pcifn(__ioc)		((__ioc)->pcidev.pci_func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) #define bfa_ioc_devid(__ioc)		((__ioc)->pcidev.device_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) #define bfa_ioc_bar0(__ioc)		((__ioc)->pcidev.pci_bar_kva)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) #define bfa_ioc_portid(__ioc)		((__ioc)->port_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) #define bfa_ioc_asic_gen(__ioc)		((__ioc)->asic_gen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) #define bfa_ioc_is_cna(__ioc)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	((bfa_ioc_get_type(__ioc) == BFA_IOC_TYPE_FCoE) ||	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	 (bfa_ioc_get_type(__ioc) == BFA_IOC_TYPE_LL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) #define bfa_ioc_fetch_stats(__ioc, __stats) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 		(((__stats)->drv_stats) = (__ioc)->stats)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) #define bfa_ioc_clr_stats(__ioc)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 		memset(&(__ioc)->stats, 0, sizeof((__ioc)->stats))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) #define bfa_ioc_maxfrsize(__ioc)	((__ioc)->attr->maxfrsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) #define bfa_ioc_rx_bbcredit(__ioc)	((__ioc)->attr->rx_bbcredit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) #define bfa_ioc_speed_sup(__ioc)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	((bfa_ioc_is_cna(__ioc)) ? BFA_PORT_SPEED_10GBPS :	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 	 BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) #define bfa_ioc_get_nports(__ioc)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 	BFI_ADAPTER_GETP(NPORTS, (__ioc)->attr->adapter_prop)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) #define bfa_ioc_stats(_ioc, _stats)	((_ioc)->stats._stats++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) #define BFA_IOC_FWIMG_MINSZ	(16 * 1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) #define BFA_IOC_FW_SMEM_SIZE(__ioc)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 	((bfa_ioc_asic_gen(__ioc) == BFI_ASIC_GEN_CB)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	 ? BFI_SMEM_CB_SIZE : BFI_SMEM_CT_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) #define BFA_IOC_FLASH_CHUNK_NO(off)		(off / BFI_FLASH_CHUNK_SZ_WORDS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) #define BFA_IOC_FLASH_OFFSET_IN_CHUNK(off)	(off % BFI_FLASH_CHUNK_SZ_WORDS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) #define BFA_IOC_FLASH_CHUNK_ADDR(chunkno)  (chunkno * BFI_FLASH_CHUNK_SZ_WORDS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837)  * IOC mailbox interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) void bfa_ioc_mbox_queue(struct bfa_ioc_s *ioc, struct bfa_mbox_cmd_s *cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) void bfa_ioc_mbox_register(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 		bfa_ioc_mbox_mcfunc_t *mcfuncs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) void bfa_ioc_mbox_isr(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) void bfa_ioc_mbox_send(struct bfa_ioc_s *ioc, void *ioc_msg, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) bfa_boolean_t bfa_ioc_msgget(struct bfa_ioc_s *ioc, void *mbmsg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) void bfa_ioc_mbox_regisr(struct bfa_ioc_s *ioc, enum bfi_mclass mc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 		bfa_ioc_mbox_mcfunc_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849)  * IOC interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) #define bfa_ioc_pll_init_asic(__ioc) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 	((__ioc)->ioc_hwif->ioc_pll_init((__ioc)->pcidev.pci_bar_kva, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 			   (__ioc)->asic_mode))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) bfa_status_t bfa_ioc_pll_init(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) bfa_status_t bfa_ioc_cb_pll_init(void __iomem *rb, enum bfi_asic_mode mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) bfa_status_t bfa_ioc_ct_pll_init(void __iomem *rb, enum bfi_asic_mode mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) bfa_status_t bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) #define bfa_ioc_isr_mode_set(__ioc, __msix) do {			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 	if ((__ioc)->ioc_hwif->ioc_isr_mode_set)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 		((__ioc)->ioc_hwif->ioc_isr_mode_set(__ioc, __msix));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) #define	bfa_ioc_ownership_reset(__ioc)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 			((__ioc)->ioc_hwif->ioc_ownership_reset(__ioc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) #define bfa_ioc_get_fcmode(__ioc)	((__ioc)->fcmode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) #define bfa_ioc_lpu_read_stat(__ioc) do {			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) 	if ((__ioc)->ioc_hwif->ioc_lpu_read_stat)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 		((__ioc)->ioc_hwif->ioc_lpu_read_stat(__ioc));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) void bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) void bfa_ioc_set_ct_hwif(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) void bfa_ioc_set_ct2_hwif(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) void bfa_ioc_ct2_poweron(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) void bfa_ioc_attach(struct bfa_ioc_s *ioc, void *bfa,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) 		struct bfa_ioc_cbfn_s *cbfn, struct bfa_timer_mod_s *timer_mod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) void bfa_ioc_auto_recover(bfa_boolean_t auto_recover);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) void bfa_ioc_detach(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) void bfa_ioc_suspend(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) void bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 		enum bfi_pcifn_class clscode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) void bfa_ioc_mem_claim(struct bfa_ioc_s *ioc,  u8 *dm_kva, u64 dm_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) void bfa_ioc_enable(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) void bfa_ioc_disable(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) bfa_boolean_t bfa_ioc_intx_claim(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) bfa_status_t bfa_ioc_boot(struct bfa_ioc_s *ioc, u32 boot_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) 		u32 boot_env);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) void bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) void bfa_ioc_error_isr(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) bfa_boolean_t bfa_ioc_is_operational(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) bfa_boolean_t bfa_ioc_is_initialized(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) bfa_boolean_t bfa_ioc_is_disabled(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) bfa_boolean_t bfa_ioc_is_acq_addr(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) bfa_boolean_t bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) bfa_boolean_t bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) void bfa_ioc_reset_fwstate(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) enum bfa_ioc_type_e bfa_ioc_get_type(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) void bfa_ioc_get_adapter_serial_num(struct bfa_ioc_s *ioc, char *serial_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) void bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc_s *ioc, char *optrom_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) void bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 		char *manufacturer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) void bfa_ioc_get_pci_chip_rev(struct bfa_ioc_s *ioc, char *chip_rev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) enum bfa_ioc_state bfa_ioc_get_state(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) void bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 		struct bfa_adapter_attr_s *ad_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 		int *trclen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 				 int *trclen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) bfa_status_t bfa_ioc_debug_fwcore(struct bfa_ioc_s *ioc, void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 	u32 *offset, int *buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) bfa_status_t bfa_ioc_fwsig_invalidate(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) bfa_boolean_t bfa_ioc_sem_get(void __iomem *sem_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 			struct bfi_ioc_image_hdr_s *fwhdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 			struct bfi_ioc_image_hdr_s *fwhdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) void bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) bfa_status_t bfa_ioc_fw_stats_get(struct bfa_ioc_s *ioc, void *stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) void bfa_ioc_debug_save_ftrc(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933)  * asic block configuration related APIs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) u32	bfa_ablk_meminfo(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) void bfa_ablk_memclaim(struct bfa_ablk_s *ablk, u8 *dma_kva, u64 dma_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) void bfa_ablk_attach(struct bfa_ablk_s *ablk, struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) bfa_status_t bfa_ablk_query(struct bfa_ablk_s *ablk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 		struct bfa_ablk_cfg_s *ablk_cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 		bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) bfa_status_t bfa_ablk_adapter_config(struct bfa_ablk_s *ablk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) 		enum bfa_mode_s mode, int max_pf, int max_vf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 		bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) bfa_status_t bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 		enum bfa_mode_s mode, int max_pf, int max_vf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 		bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) bfa_status_t bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 		u8 port, enum bfi_pcifn_class personality,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 		u16 bw_min, u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) bfa_status_t bfa_ablk_pf_delete(struct bfa_ablk_s *ablk, int pcifn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 		bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) bfa_status_t bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 		u16 bw_min, u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) bfa_status_t bfa_ablk_optrom_en(struct bfa_ablk_s *ablk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 		bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) bfa_status_t bfa_ablk_optrom_dis(struct bfa_ablk_s *ablk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 		bfa_ablk_cbfn_t cbfn, void *cbarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) bfa_status_t bfa_ioc_flash_img_get_chnk(struct bfa_ioc_s *ioc, u32 off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) 				u32 *fwimg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962)  * bfa mfg wwn API functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968)  * F/W Image Size & Chunk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) extern u32 bfi_image_cb_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) extern u32 bfi_image_ct_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) extern u32 bfi_image_ct2_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) extern u32 *bfi_image_cb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) extern u32 *bfi_image_ct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) extern u32 *bfi_image_ct2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) static inline u32 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) bfi_image_cb_get_chunk(u32 off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) 	return (u32 *)(bfi_image_cb + off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) static inline u32 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) bfi_image_ct_get_chunk(u32 off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 	return (u32 *)(bfi_image_ct + off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) static inline u32 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) bfi_image_ct2_get_chunk(u32 off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 	return (u32 *)(bfi_image_ct2 + off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) static inline u32*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) bfa_cb_image_get_chunk(enum bfi_asic_gen asic_gen, u32 off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 	switch (asic_gen) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 	case BFI_ASIC_GEN_CB:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 		return bfi_image_cb_get_chunk(off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 	case BFI_ASIC_GEN_CT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) 		return bfi_image_ct_get_chunk(off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 	case BFI_ASIC_GEN_CT2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 		return bfi_image_ct2_get_chunk(off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) static inline u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) bfa_cb_image_get_size(enum bfi_asic_gen asic_gen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 	switch (asic_gen) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	case BFI_ASIC_GEN_CB:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 		return bfi_image_cb_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 	case BFI_ASIC_GEN_CT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 		return bfi_image_ct_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 	case BFI_ASIC_GEN_CT2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 		return bfi_image_ct2_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032)  * CNA TRCMOD declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035)  * !!! Only append to the enums defined here to avoid any versioning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036)  * !!! needed between trace utility and driver version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 	BFA_TRC_CNA_PORT	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 	BFA_TRC_CNA_IOC		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) 	BFA_TRC_CNA_IOC_CB	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) 	BFA_TRC_CNA_IOC_CT	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) #endif /* __BFA_IOC_H__ */