1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Minimal debug/trace/assert driver definitions for 4 * Broadcom 802.11 Networking Adapter. 5 * 6 * Copyright (C) 1999-2019, Broadcom. 7 * 8 * Unless you and Broadcom execute a separate written software license 9 * agreement governing use of this software, this software is licensed to you 10 * under the terms of the GNU General Public License version 2 (the "GPL"), 11 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12 * following added to such license: 13 * 14 * As a special exception, the copyright holders of this software give you 15 * permission to link this software with independent modules, and to copy and 16 * distribute the resulting executable under terms of your choice, provided that 17 * you also meet, for each linked independent module, the terms and conditions of 18 * the license of that module. An independent module is a module which is not 19 * derived from this software. The special exception does not apply to any 20 * modifications of the software. 21 * 22 * Notwithstanding the above, under no circumstances may you combine this 23 * software in any way with any other Broadcom software provided under a license 24 * other than the GPL, without Broadcom's express prior written consent. 25 * 26 * 27 * <<Broadcom-WL-IPTag/Open:>> 28 * 29 * $Id: wl_dbg.h 697380 2017-05-03 11:34:25Z $ 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 // 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 #define WIFICC_CAPTURE(_reason) 53 #define WIFICC_LOGDEBUGIF(_flags, _args) 54 #define WIFICC_LOGDEBUG(_args) 55 56 #define WL_PRINT(args) do { WL_TIMESTAMP(); printf args; } while (0) 57 58 #if defined(EVENT_LOG_COMPILE) && defined(WLMSG_SRSCAN) 59 #define _WL_SRSCAN(fmt, ...) EVENT_LOG(EVENT_LOG_TAG_SRSCAN, fmt, ##__VA_ARGS__) 60 #define WL_SRSCAN(args) _WL_SRSCAN args 61 #else 62 #define WL_SRSCAN(args) 63 #endif // endif 64 65 #if defined(BCMCONDITIONAL_LOGGING) 66 67 /* Ideally this should be some include file that vendors can include to conditionalize logging */ 68 69 /* DBGONLY() macro to reduce ifdefs in code for statements that are only needed when 70 * BCMDBG is defined. 71 */ 72 #define DBGONLY(x) x 73 74 /* To disable a message completely ... until you need it again */ 75 #define WL_NONE(args) 76 #define WL_ERROR(args) do {if (wl_msg_level & WL_ERROR_VAL) WL_PRINT(args); \ 77 else WIFICC_LOGDEBUG(args); } while (0) 78 #define WL_SCAN_ERROR(args) 79 #define WL_IE_ERROR(args) 80 #define WL_AMSDU_ERROR(args) 81 #define WL_ASSOC_ERROR(args) 82 #define KM_ERR(args) 83 84 #define WL_TRACE(args) 85 #define WL_PRHDRS_MSG(args) 86 #define WL_PRHDRS(i, p, f, t, r, l) 87 #define WL_PRPKT(m, b, n) 88 #define WL_INFORM(args) 89 #define WL_TMP(args) 90 #define WL_OID(args) 91 #define WL_RATE(args) do {if (wl_msg_level & WL_RATE_VAL) WL_PRINT(args);} while (0) 92 #define WL_ASSOC(args) do {if (wl_msg_level & WL_ASSOC_VAL) WL_PRINT(args); \ 93 else WIFICC_LOGDEBUG(args);} while (0) 94 #define WL_PRUSR(m, b, n) 95 #define WL_PS(args) do {if (wl_msg_level & WL_PS_VAL) WL_PRINT(args);} while (0) 96 97 #define WL_PORT(args) 98 #define WL_DUAL(args) 99 #define WL_REGULATORY(args) do {if (wl_msg_level & WL_REGULATORY_VAL) WL_PRINT(args); \ 100 else WIFICC_LOGDEBUG(args);} while (0) 101 102 #define WL_MPC(args) 103 #define WL_APSTA(args) 104 #define WL_APSTA_BCN(args) 105 #define WL_APSTA_TX(args) 106 #define WL_APSTA_TSF(args) 107 #define WL_APSTA_BSSID(args) 108 #define WL_BA(args) 109 #define WL_MBSS(args) 110 #define WL_MODE_SWITCH(args) 111 #define WL_PROTO(args) 112 113 #define WL_CAC(args) do {if (wl_msg_level & WL_CAC_VAL) WL_PRINT(args);} while (0) 114 #define WL_AMSDU(args) 115 #define WL_AMPDU(args) 116 #define WL_FFPLD(args) 117 #define WL_MCHAN(args) 118 119 #define WL_DFS(args) 120 #define WL_WOWL(args) 121 #define WL_DPT(args) 122 #define WL_ASSOC_OR_DPT(args) 123 #define WL_SCAN(args) do {if (wl_msg_level2 & WL_SCAN_VAL) WL_PRINT(args);} while (0) 124 #define WL_COEX(args) 125 #define WL_RTDC(w, s, i, j) 126 #define WL_RTDC2(w, s, i, j) 127 #define WL_CHANINT(args) 128 #define WL_BTA(args) 129 #define WL_P2P(args) 130 #define WL_ITFR(args) 131 #define WL_TDLS(args) 132 #define WL_MCNX(args) 133 #define WL_PROT(args) 134 #define WL_PSTA(args) 135 #define WL_WFDS(m, b, n) 136 #define WL_TRF_MGMT(args) 137 #define WL_L2FILTER(args) 138 #define WL_MQ(args) 139 #define WL_TXBF(args) 140 #define WL_MUMIMO(args) 141 #define WL_P2PO(args) 142 #define WL_ROAM(args) 143 #define WL_WNM(args) 144 #define WL_NAT(args) 145 146 #ifdef WLMSG_MESH 147 #define WL_MESH(args) WL_PRINT(args) 148 #define WL_MESH_AMPE(args) WL_PRINT(args) 149 #define WL_MESH_ROUTE(args) WL_PRINT(args) 150 #define WL_MESH_BCN(args) 151 #else 152 #define WL_MESH(args) 153 #define WL_MESH_AMPE(args) 154 #define WL_MESH_ROUTE(args) 155 #define WL_MESH_BCN(args) 156 #endif // endif 157 #ifdef WLMSG_NATOE 158 #define WL_NAT(args) do {if (wl_msg_level2 & WL_NATOE_VAL) WL_PRINT(args);} while (0) 159 #else 160 #define WL_NAT(args) 161 #endif // endif 162 163 #define WL_PFN_ERROR(args) 164 165 #define WL_AMPDU_UPDN(args) 166 #define WL_AMPDU_RX(args) 167 #define WL_AMPDU_ERR(args) 168 #define WL_AMPDU_TX(args) 169 #define WL_AMPDU_CTL(args) 170 #define WL_AMPDU_HW(args) 171 #define WL_AMPDU_HWTXS(args) 172 #define WL_AMPDU_HWDBG(args) 173 #define WL_AMPDU_STAT(args) 174 #define WL_AMPDU_ERR_ON() 0 175 #define WL_AMPDU_HW_ON() 0 176 #define WL_AMPDU_HWTXS_ON() 0 177 178 #define WL_APSTA_UPDN(args) 179 #define WL_APSTA_RX(args) 180 #define WL_WSEC(args) 181 #define WL_WSEC_DUMP(args) 182 #define WL_PCIE(args) 183 #define WL_TSLOG(w, s, i, j) 184 #define WL_FBT(args) 185 #define WL_MBO_DBG(args) 186 #define WL_RANDMAC_DBG(args) 187 #define WL_BAM_ERR(args) 188 #define WL_ADPS(args) 189 #define WL_OCE_DBG(args) 190 191 #define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL) 192 #define WL_TRACE_ON() 0 193 #define WL_PRHDRS_ON() 0 194 #define WL_PRPKT_ON() 0 195 #define WL_INFORM_ON() 0 196 #define WL_TMP_ON() 0 197 #define WL_OID_ON() 0 198 #define WL_RATE_ON() (wl_msg_level & WL_RATE_VAL) 199 #define WL_ASSOC_ON() (wl_msg_level & WL_ASSOC_VAL) 200 #define WL_PRUSR_ON() 0 201 #define WL_PS_ON() (wl_msg_level & WL_PS_VAL) 202 #define WL_PORT_ON() 0 203 #define WL_WSEC_ON() 0 204 #define WL_WSEC_DUMP_ON() 0 205 #define WL_MPC_ON() 0 206 #define WL_REGULATORY_ON() (wl_msg_level & WL_REGULATORY_VAL) 207 #define WL_APSTA_ON() 0 208 #define WL_DFS_ON() 0 209 #define WL_MBSS_ON() 0 210 #define WL_CAC_ON() (wl_msg_level & WL_CAC_VAL) 211 #define WL_AMPDU_ON() 0 212 #define WL_DPT_ON() 0 213 #define WL_WOWL_ON() 0 214 #define WL_SCAN_ON() (wl_msg_level2 & WL_SCAN_VAL) 215 #define WL_BTA_ON() 0 216 #define WL_P2P_ON() 0 217 #define WL_ITFR_ON() 0 218 #define WL_MCHAN_ON() 0 219 #define WL_TDLS_ON() 0 220 #define WL_MCNX_ON() 0 221 #define WL_PROT_ON() 0 222 #define WL_PSTA_ON() 0 223 #define WL_TRF_MGMT_ON() 0 224 #define WL_LPC_ON() 0 225 #define WL_L2FILTER_ON() 0 226 #define WL_TXBF_ON() 0 227 #define WL_P2PO_ON() 0 228 #define WL_TSLOG_ON() 0 229 #define WL_WNM_ON() 0 230 #define WL_PCIE_ON() 0 231 #define WL_MUMIMO_ON() 0 232 #define WL_MESH_ON() 0 233 #define WL_MBO_DBG_ON() 0 234 #define WL_RANDMAC_DBG_ON() 0 235 #define WL_ADPS_ON() 0 236 #define WL_OCE_DBG_ON() 0 237 238 #else /* !BCMDBG */ 239 240 /* DBGONLY() macro to reduce ifdefs in code for statements that are only needed when 241 * BCMDBG is defined. 242 */ 243 #define DBGONLY(x) 244 245 /* To disable a message completely ... until you need it again */ 246 #define WL_NONE(args) 247 248 #define WL_ERROR(args) 249 250 #define KM_ERR(args) 251 252 #define WL_AMPDU_ERR(args) 253 254 #define WL_TRACE(args) 255 #define WL_APSTA_UPDN(args) 256 #define WL_APSTA_RX(args) 257 258 #ifdef WLMSG_WSEC 259 #if defined(EVENT_LOG_COMPILE) && defined(EVENT_LOG_COMPILE) 260 #if defined(USE_EVENT_LOG_RA) 261 #define WL_WSEC(args) EVENT_LOG_RA(EVENT_LOG_TAG_WL_WSEC_LOG, args) 262 #define WL_WSEC_DUMP(args) EVENT_LOG_RA(EVENT_LOG_TAG_WL_WSEC_DUMP, args) 263 #else 264 #define WL_WSEC(args) EVENT_LOG_FAST_CAST_PAREN_ARGS(EVENT_LOG_TAG_WL_WSEC_LOG, args) 265 #define WL_WSEC_DUMP(args) EVENT_LOG_FAST_CAST_PAREN_ARGS(EVENT_LOG_TAG_WL_WSEC_DUMP, args) 266 #endif /* USE_EVENT_LOG_RA */ 267 #else 268 #define WL_WSEC(args) WL_PRINT(args) 269 #define WL_WSEC_DUMP(args) WL_PRINT(args) 270 #endif /* EVENT_LOG_COMPILE */ 271 #else 272 #define WL_WSEC(args) 273 #define WL_WSEC_DUMP(args) 274 #endif /* WLMSG_WSEC */ 275 276 #ifdef WLMSG_MBO 277 #if defined(EVENT_LOG_COMPILE) && defined(EVENT_LOG_COMPILE) 278 #if defined(USE_EVENT_LOG_RA) 279 #define WL_MBO_DBG(args) EVENT_LOG_RA(EVENT_LOG_TAG_MBO_DBG, args) 280 #define WL_MBO_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_MBO_INFO, args) 281 #else 282 #define WL_MBO_DBG(args) \ 283 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_MBO_DBG, args) 284 #define WL_MBO_INFO(args) \ 285 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_MBO_INFO, args) 286 #endif /* USE_EVENT_LOG_RA */ 287 #else 288 #define WL_MBO_DBG(args) WL_PRINT(args) 289 #define WL_MBO_INFO(args) WL_PRINT(args) 290 #endif /* EVENT_LOG_COMPILE */ 291 #else 292 #define WL_MBO_DBG(args) 293 #define WL_MBO_INFO(args) 294 #endif /* WLMSG_MBO */ 295 296 #define WL_MBO_ERR(args) WL_PRINT(args) 297 298 #ifdef WLMSG_RANDMAC 299 #if defined(EVENT_LOG_COMPILE) && defined(EVENT_LOG_COMPILE) 300 #if defined(USE_EVENT_LOG_RA) 301 #define WL_RANDMAC_DBG(args) EVENT_LOG_RA(EVENT_LOG_TAG_RANDMAC_DBG, args) 302 #define WL_RANDMAC_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_RANDMAC_INFO, args) 303 #else 304 #define WL_RANDMAC_DBG(args) \ 305 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_RANDMAC_DBG, args) 306 #define WL_RANDMAC_INFO(args) \ 307 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_RANDMAC_INFO, args) 308 #endif /* USE_EVENT_LOG_RA */ 309 #else 310 #define WL_RANDMAC_DBG(args) WL_PRINT(args) 311 #define WL_RANDMAC_INFO(args) WL_PRINT(args) 312 #endif /* EVENT_LOG_COMPILE */ 313 #else 314 #define WL_RANDMAC_DBG(args) 315 #define WL_RANDMAC_INFO(args) 316 #endif /* WLMSG_RANDMAC */ 317 318 #define WL_RANDMAC_ERR(args) WL_PRINT(args) 319 320 #ifdef WLMSG_OCE 321 #if defined(EVENT_LOG_COMPILE) 322 #if defined(USE_EVENT_LOG_RA) 323 #define WL_OCE_DBG(args) EVENT_LOG_RA(EVENT_LOG_TAG_OCE_DBG, args) 324 #define WL_OCE_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_OCE_INFO, args) 325 #else 326 #define WL_OCE_DBG(args) \ 327 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_OCE_DBG, args) 328 #define WL_OCE_INFO(args) \ 329 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_OCE_INFO, args) 330 #endif /* USE_EVENT_LOG_RA */ 331 #else 332 #define WL_OCE_DBG(args) WL_PRINT(args) 333 #define WL_OCE_INFO(args) WL_PRINT(args) 334 #endif /* EVENT_LOG_COMPILE */ 335 #else 336 #define WL_OCE_DBG(args) 337 #define WL_OCE_INFO(args) 338 #endif /* WLMSG_OCE */ 339 340 #define WL_OCE_ERR(args) WL_PRINT(args) 341 342 #define WL_PCIE(args) do {if (wl_msg_level2 & WL_PCIE_VAL) WL_PRINT(args);} while (0) 343 #define WL_PCIE_ON() (wl_msg_level2 & WL_PCIE_VAL) 344 #define WL_PFN(args) do {if (wl_msg_level & WL_PFN_VAL) WL_PRINT(args);} while (0) 345 #define WL_PFN_ON() (wl_msg_level & WL_PFN_VAL) 346 #endif // endif 347 348 #ifdef WLMSG_BAM 349 #if defined(EVENT_LOG_COMPILE) 350 #ifdef USE_EVENT_LOG_RA 351 #define WL_BAM_ERR(args) EVENT_LOG_RA(EVENT_LOG_TAG_BAM, args) 352 #else 353 #define WL_BAM_ERR(args) EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_BAM, args) 354 #endif /* USE_EVENT_LOG_RA */ 355 #else 356 #define WL_BAM_ERR(args) WL_PRINT(args) 357 #endif /* EVENT_LOG_COMPILE */ 358 #endif /* WLMSG_BAM */ 359 360 #ifdef WLMSG_WNM_BSSTRANS 361 #if defined(EVENT_LOG_COMPILE) 362 #if defined(USE_EVENT_LOG_RA) 363 #define WL_BSSTRANS_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_WNM_BSSTRANS_INFO, args) 364 #else 365 #define WL_BSSTRANS_INFO(args) \ 366 EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_WNM_BSSTRANS_INFO, args) 367 #endif /* USE_EVENT_LOG_RA */ 368 #else 369 #define WL_BSSTRANS_INFO(args) WL_PRINT(args) 370 #endif /* EVENT_LOG_COMPILE */ 371 #else 372 #define WL_BSSTRANS_INFO(args) 373 #endif /* WLMSG_WNM_BSSTRANS */ 374 375 #define WL_BSSTRANS_ERR(args) WL_PRINT(args) 376 377 #define DBGERRONLY(x) 378 379 extern uint32 wl_msg_level; 380 extern uint32 wl_msg_level2; 381 #endif /* _wl_dbg_h_ */ 382