1 /* 2 * Minimal debug/trace/assert driver definitions for 3 * Broadcom 802.11 Networking Adapter. 4 * 5 * Copyright (C) 1999-2017, Broadcom Corporation 6 * 7 * Unless you and Broadcom execute a separate written software license 8 * agreement governing use of this software, this software is licensed to you 9 * under the terms of the GNU General Public License version 2 (the "GPL"), 10 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 * following added to such license: 12 * 13 * As a special exception, the copyright holders of this software give you 14 * permission to link this software with independent modules, and to copy and 15 * distribute the resulting executable under terms of your choice, provided that 16 * you also meet, for each linked independent module, the terms and conditions of 17 * the license of that module. An independent module is a module which is not 18 * derived from this software. The special exception does not apply to any 19 * modifications of the software. 20 * 21 * Notwithstanding the above, under no circumstances may you combine this 22 * software in any way with any other Broadcom software provided under a license 23 * other than the GPL, without Broadcom's express prior written consent. 24 * 25 * 26 * <<Broadcom-WL-IPTag/Open:>> 27 * 28 * $Id: wl_dbg.h 664795 2016-10-13 20:13:32Z $ 29 */ 30 31 32 #ifndef _wl_dbg_h_ 33 #define _wl_dbg_h_ 34 35 #if defined(EVENT_LOG_COMPILE) 36 #include <event_log.h> 37 #endif 38 39 /* wl_msg_level is a bit vector with defs in wlioctl.h */ 40 extern uint32 wl_msg_level; 41 extern uint32 wl_msg_level2; 42 43 #define WL_TIMESTAMP() 44 45 #ifdef ENABLE_CORECAPTURE 46 #define MAX_BACKTRACE_DEPTH 32 47 extern int wl_print_backtrace(const char *prefix, void *i_backtrace, int i_backtrace_depth); 48 #else 49 #define wl_print_backtrace(a, b, c) 50 #endif /* ENABLE_CORECAPTURE */ 51 52 53 #define WIFICC_CAPTURE(_reason) 54 #define WIFICC_LOGDEBUGIF(_flags, _args) 55 #define WIFICC_LOGDEBUG(_args) 56 57 #define WL_PRINT(args) do { WL_TIMESTAMP(); printf args; } while (0) 58 59 #if defined(EVENT_LOG_COMPILE) && defined(WLMSG_SRSCAN) 60 #define _WL_SRSCAN(fmt, ...) EVENT_LOG(EVENT_LOG_TAG_SRSCAN, fmt, ##__VA_ARGS__) 61 #define WL_SRSCAN(args) _WL_SRSCAN args 62 #else 63 #define WL_SRSCAN(args) 64 #endif 65 66 #if defined(BCMCONDITIONAL_LOGGING) 67 68 /* Ideally this should be some include file that vendors can include to conditionalize logging */ 69 70 /* DBGONLY() macro to reduce ifdefs in code for statements that are only needed when 71 * BCMDBG is defined. 72 */ 73 #define DBGONLY(x) x 74 75 /* To disable a message completely ... until you need it again */ 76 #define WL_NONE(args) 77 #define WL_ERROR(args) do {if (wl_msg_level & WL_ERROR_VAL) WL_PRINT(args); \ 78 else WIFICC_LOGDEBUG(args); } while (0) 79 #define WL_TRACE(args) 80 #define WL_PRHDRS_MSG(args) 81 #define WL_PRHDRS(i, p, f, t, r, l) 82 #define WL_PRPKT(m, b, n) 83 #define WL_INFORM(args) 84 #define WL_TMP(args) 85 #define WL_OID(args) 86 #define WL_RATE(args) do {if (wl_msg_level & WL_RATE_VAL) WL_PRINT(args);} while (0) 87 #define WL_ASSOC(args) do {if (wl_msg_level & WL_ASSOC_VAL) WL_PRINT(args); \ 88 else WIFICC_LOGDEBUG(args);} while (0) 89 #define WL_PRUSR(m, b, n) 90 #define WL_PS(args) do {if (wl_msg_level & WL_PS_VAL) WL_PRINT(args);} while (0) 91 92 #define WL_PORT(args) 93 #define WL_DUAL(args) 94 #define WL_REGULATORY(args) do {if (wl_msg_level & WL_REGULATORY_VAL) WL_PRINT(args); \ 95 else WIFICC_LOGDEBUG(args);} while (0) 96 97 #define WL_MPC(args) 98 #define WL_APSTA(args) 99 #define WL_APSTA_BCN(args) 100 #define WL_APSTA_TX(args) 101 #define WL_APSTA_TSF(args) 102 #define WL_APSTA_BSSID(args) 103 #define WL_BA(args) 104 #define WL_MBSS(args) 105 #define WL_PROTO(args) 106 107 #define WL_CAC(args) do {if (wl_msg_level & WL_CAC_VAL) WL_PRINT(args);} while (0) 108 #define WL_AMSDU(args) 109 #define WL_AMPDU(args) 110 #define WL_FFPLD(args) 111 #define WL_MCHAN(args) 112 113 #define WL_DFS(args) 114 #define WL_WOWL(args) 115 #define WL_DPT(args) 116 #define WL_ASSOC_OR_DPT(args) 117 #define WL_SCAN(args) do {if (wl_msg_level2 & WL_SCAN_VAL) WL_PRINT(args);} while (0) 118 #define WL_COEX(args) 119 #define WL_RTDC(w, s, i, j) 120 #define WL_RTDC2(w, s, i, j) 121 #define WL_CHANINT(args) 122 #define WL_P2P(args) 123 #define WL_ITFR(args) 124 #define WL_TDLS(args) 125 #define WL_MCNX(args) 126 #define WL_PROT(args) 127 #define WL_PSTA(args) 128 #define WL_WFDS(m, b, n) 129 #define WL_TRF_MGMT(args) 130 #define WL_L2FILTER(args) 131 #define WL_MQ(args) 132 #define WL_TXBF(args) 133 #define WL_MUMIMO(args) 134 #define WL_P2PO(args) 135 #define WL_ROAM(args) 136 #define WL_WNM(args) 137 138 #ifdef WLMSG_MESH 139 #define WL_MESH(args) WL_PRINT(args) 140 #define WL_MESH_AMPE(args) WL_PRINT(args) 141 #define WL_MESH_ROUTE(args) WL_PRINT(args) 142 #define WL_MESH_BCN(args) 143 #else 144 #define WL_MESH(args) 145 #define WL_MESH_AMPE(args) 146 #define WL_MESH_ROUTE(args) 147 #define WL_MESH_BCN(args) 148 #endif 149 150 151 #define WL_AMPDU_UPDN(args) 152 #define WL_AMPDU_RX(args) 153 #define WL_AMPDU_ERR(args) 154 #define WL_AMPDU_TX(args) 155 #define WL_AMPDU_CTL(args) 156 #define WL_AMPDU_HW(args) 157 #define WL_AMPDU_HWTXS(args) 158 #define WL_AMPDU_HWDBG(args) 159 #define WL_AMPDU_STAT(args) 160 #define WL_AMPDU_ERR_ON() 0 161 #define WL_AMPDU_HW_ON() 0 162 #define WL_AMPDU_HWTXS_ON() 0 163 164 #define WL_APSTA_UPDN(args) 165 #define WL_APSTA_RX(args) 166 #define WL_WSEC(args) 167 #define WL_WSEC_DUMP(args) 168 #define WL_PCIE(args) 169 #define WL_TSLOG(w, s, i, j) 170 #define WL_FBT(args) 171 172 #define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL) 173 #define WL_TRACE_ON() 0 174 #define WL_PRHDRS_ON() 0 175 #define WL_PRPKT_ON() 0 176 #define WL_INFORM_ON() 0 177 #define WL_TMP_ON() 0 178 #define WL_OID_ON() 0 179 #define WL_RATE_ON() (wl_msg_level & WL_RATE_VAL) 180 #define WL_ASSOC_ON() (wl_msg_level & WL_ASSOC_VAL) 181 #define WL_PRUSR_ON() 0 182 #define WL_PS_ON() (wl_msg_level & WL_PS_VAL) 183 #define WL_PORT_ON() 0 184 #define WL_WSEC_ON() 0 185 #define WL_WSEC_DUMP_ON() 0 186 #define WL_MPC_ON() 0 187 #define WL_REGULATORY_ON() (wl_msg_level & WL_REGULATORY_VAL) 188 #define WL_APSTA_ON() 0 189 #define WL_DFS_ON() 0 190 #define WL_MBSS_ON() 0 191 #define WL_CAC_ON() (wl_msg_level & WL_CAC_VAL) 192 #define WL_AMPDU_ON() 0 193 #define WL_DPT_ON() 0 194 #define WL_WOWL_ON() 0 195 #define WL_SCAN_ON() (wl_msg_level2 & WL_SCAN_VAL) 196 #define WL_P2P_ON() 0 197 #define WL_ITFR_ON() 0 198 #define WL_MCHAN_ON() 0 199 #define WL_TDLS_ON() 0 200 #define WL_MCNX_ON() 0 201 #define WL_PROT_ON() 0 202 #define WL_PSTA_ON() 0 203 #define WL_TRF_MGMT_ON() 0 204 #define WL_LPC_ON() 0 205 #define WL_L2FILTER_ON() 0 206 #define WL_TXBF_ON() 0 207 #define WL_P2PO_ON() 0 208 #define WL_TSLOG_ON() 0 209 #define WL_WNM_ON() 0 210 #define WL_PCIE_ON() 0 211 #define WL_MUMIMO_ON() 0 212 #define WL_MESH_ON() 0 213 214 #else /* !BCMDBG */ 215 216 /* DBGONLY() macro to reduce ifdefs in code for statements that are only needed when 217 * BCMDBG is defined. 218 */ 219 #define DBGONLY(x) 220 221 /* To disable a message completely ... until you need it again */ 222 #define WL_NONE(args) 223 224 #define WL_ERROR(args) 225 226 #define WL_TRACE(args) 227 #define WL_APSTA_UPDN(args) 228 #define WL_APSTA_RX(args) 229 #ifdef WLMSG_WSEC 230 #define WL_WSEC(args) WL_PRINT(args) 231 #define WL_WSEC_DUMP(args) WL_PRINT(args) 232 #else 233 #define WL_WSEC(args) 234 #define WL_WSEC_DUMP(args) 235 #endif 236 #define WL_PCIE(args) do {if (wl_msg_level2 & WL_PCIE_VAL) WL_PRINT(args);} while (0) 237 #define WL_PCIE_ON() (wl_msg_level2 & WL_PCIE_VAL) 238 #define WL_PFN(args) do {if (wl_msg_level & WL_PFN_VAL) WL_PRINT(args);} while (0) 239 #define WL_PFN_ON() (wl_msg_level & WL_PFN_VAL) 240 #endif 241 242 #define DBGERRONLY(x) 243 244 extern uint32 wl_msg_level; 245 extern uint32 wl_msg_level2; 246 #endif /* _wl_dbg_h_ */ 247