1 /* 2 * Generic functions for d11 access 3 * 4 * Broadcom Proprietary and Confidential. Copyright (C) 2020, 5 * All Rights Reserved. 6 * 7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom; 8 * the contents of this file may not be disclosed to third parties, 9 * copied or duplicated in any form, in whole or in part, without 10 * the prior written permission of Broadcom. 11 * 12 * 13 * <<Broadcom-WL-IPTag/Proprietary:>> 14 */ 15 16 #ifndef _hndd11_h_ 17 #define _hndd11_h_ 18 19 #include <typedefs.h> 20 #include <osl_decl.h> 21 #include <bcmutils.h> 22 #include <siutils.h> 23 #include <d11.h> 24 25 /* This marks the start of a packed structure section. */ 26 #include <packed_section_start.h> 27 28 #ifndef WL_RSSI_ANT_MAX 29 #define WL_RSSI_ANT_MAX 4 /**< max possible rx antennas */ 30 #elif WL_RSSI_ANT_MAX != 4 31 #error "WL_RSSI_ANT_MAX does not match" 32 #endif 33 34 BWL_PRE_PACKED_STRUCT struct wl_d11rxrssi { 35 int8 dBm; /* number of full dBms */ 36 /* sub-dbm resolution */ 37 int8 decidBm; /* sub dBms : value after the decimal point */ 38 } BWL_POST_PACKED_STRUCT; 39 40 typedef struct wl_d11rxrssi wlc_d11rxrssi_t; 41 42 BWL_PRE_PACKED_STRUCT struct wlc_d11rxhdr { 43 /* SW header */ 44 uint32 tsf_l; /**< TSF_L reading */ 45 int8 rssi; /**< computed instantaneous rssi */ 46 int8 rssi_qdb; /**< qdB portion of the computed rssi */ 47 int16 snr; /**< computed snginal-to-noise instantaneous snr */ 48 int8 rxpwr[ROUNDUP(WL_RSSI_ANT_MAX,2)]; /**< rssi for supported antennas */ 49 /** 50 * Even though rxhdr can be in short or long format, always declare it here 51 * to be in long format. So the offsets for the other fields are always the same. 52 */ 53 d11rxhdr_t rxhdr; 54 } BWL_POST_PACKED_STRUCT; 55 56 /* SW RXHDR + HW RXHDR */ 57 typedef struct wlc_d11rxhdr wlc_d11rxhdr_t; 58 59 /* extension of wlc_d11rxhdr.. 60 * This extra block can be used to store extra internal information that cannot fit into 61 * wlc_d11rxhdr. 62 * At the moment, it is only used to store and possibly transmit the per-core quater dbm rssi 63 * information produced by the phy. 64 * NOTE: To avoid header overhead and amsdu handling complexities this usage is limited to 65 * only in case that host need to get the extra info. e.g., monitoring mode packet. 66 */ 67 68 BWL_PRE_PACKED_STRUCT struct wlc_d11rxhdr_ext { 69 #ifdef BCM_MON_QDBM_RSSI 70 wlc_d11rxrssi_t rxpwr[WL_RSSI_ANT_MAX]; 71 #endif 72 wlc_d11rxhdr_t wlc_d11rx; 73 } BWL_POST_PACKED_STRUCT; 74 75 typedef struct wlc_d11rxhdr_ext wlc_d11rxhdr_ext_t; 76 77 /* Length of software rx header extension */ 78 #define WLC_SWRXHDR_EXT_LEN (OFFSETOF(wlc_d11rxhdr_ext_t, wlc_d11rx)) 79 80 /* Length of SW header (12 bytes) */ 81 #define WLC_RXHDR_LEN (OFFSETOF(wlc_d11rxhdr_t, rxhdr)) 82 /* Length of RX headers - SW header + HW/ucode/PHY RX status */ 83 #define WL_RXHDR_LEN(corerev, corerev_minor) \ 84 (WLC_RXHDR_LEN + D11_RXHDR_LEN(corerev, corerev_minor)) 85 #define WL_RXHDR_LEN_TMP(corerev, corerev_minor) \ 86 (WLC_RXHDR_LEN + D11_RXHDR_LEN_TMP(corerev, corerev_minor)) 87 88 /* This marks the end of a packed structure section. */ 89 #include <packed_section_end.h> 90 91 /* Structure to hold d11 corerev information */ 92 typedef struct d11_info d11_info_t; 93 struct d11_info { 94 uint major_revid; 95 uint minor_revid; 96 }; 97 98 /* ulp dbg macro */ 99 #define HNDD11_DBG(x) 100 #define HNDD11_ERR(x) printf x 101 102 /* d11 slice index */ 103 #define DUALMAC_MAIN 0 104 #define DUALMAC_AUX 1 105 #define DUALMAC_SCAN 2 106 107 extern void hndd11_read_shm(si_t *sih, uint coreunit, uint offset, void* buf); 108 extern void hndd11_write_shm(si_t *sih, uint coreunit, uint offset, const void* buf); 109 110 extern void hndd11_copyfrom_shm(si_t *sih, uint coreunit, uint offset, void* buf, int len); 111 extern void hndd11_copyto_shm(si_t *sih, uint coreunit, uint offset, const void* buf, int len); 112 113 extern uint32 hndd11_bm_read(osl_t *osh, d11regs_info_t *regsinfo, uint32 offset, uint32 len, 114 uint32 *buf); 115 extern uint32 hndd11_bm_write(osl_t *osh, d11regs_info_t *regsinfo, uint32 offset, uint32 len, 116 const uint32 *buf); 117 extern void hndd11_bm_dump(osl_t *osh, d11regs_info_t *regsinfo, uint32 offset, uint32 len); 118 119 extern int hndd11_get_reginfo(si_t *sih, d11regs_info_t *regsinfo, uint coreunit); 120 121 #endif /* _hndd11_h_ */ 122