• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Minimal debug/trace/assert driver definitions for
3  * Broadcom 802.11 Networking Adapter.
4  *
5  * Copyright (C) 1999-2019, Broadcom.
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
17  * of the license of that module.  An independent module is a module which is
18  * not 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 697380 2017-05-03 11:34:25Z $
29  */
30 
31 #ifndef _wl_dbg_h_
32 #define _wl_dbg_h_
33 
34 #if defined(EVENT_LOG_COMPILE)
35 #include <event_log.h>
36 #endif // endif
37 
38 /* wl_msg_level is a bit vector with defs in wlioctl.h */
39 extern uint32 wl_msg_level;
40 extern uint32 wl_msg_level2;
41 
42 #define WL_TIMESTAMP()
43 
44 #ifdef ENABLE_CORECAPTURE
45 #define MAX_BACKTRACE_DEPTH 32
46 extern int wl_print_backtrace(const char *prefix, void *i_backtrace,
47                               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)                                                         \
57     do {                                                                       \
58         WL_TIMESTAMP();                                                        \
59         printf args;                                                           \
60     } while (0)
61 
62 #if defined(EVENT_LOG_COMPILE) && defined(WLMSG_SRSCAN)
63 #define _WL_SRSCAN(fmt, ...) EVENT_LOG(EVENT_LOG_TAG_SRSCAN, fmt, ##__VA_ARGS__)
64 #define WL_SRSCAN(args) _WL_SRSCAN args
65 #else
66 #define WL_SRSCAN(args)
67 #endif // endif
68 
69 #if defined(BCMCONDITIONAL_LOGGING)
70 
71 /* Ideally this should be some include file that vendors can include to
72  * conditionalize logging */
73 
74 /* DBGONLY() macro to reduce ifdefs in code for statements that are only needed
75  * when BCMDBG is defined.
76  */
77 #define DBGONLY(x) x
78 
79 /* To disable a message completely ... until you need it again */
80 #define WL_NONE(args)
81 #define WL_ERROR(args)                                                         \
82     do {                                                                       \
83         if (wl_msg_level & WL_ERROR_VAL)                                       \
84             WL_PRINT(args);                                                    \
85         else                                                                   \
86             WIFICC_LOGDEBUG(args);                                             \
87     } while (0)
88 #define WL_SCAN_ERROR(args)
89 #define WL_IE_ERROR(args)
90 #define WL_AMSDU_ERROR(args)
91 #define WL_ASSOC_ERROR(args)
92 #define KM_ERR(args)
93 
94 #define WL_TRACE(args)
95 #define WL_PRHDRS_MSG(args)
96 #define WL_PRHDRS(i, p, f, t, r, l)
97 #define WL_PRPKT(m, b, n)
98 #define WL_INFORM(args)
99 #define WL_TMP(args)
100 #define WL_OID(args)
101 #define WL_RATE(args)                                                          \
102     do {                                                                       \
103         if (wl_msg_level & WL_RATE_VAL)                                        \
104             WL_PRINT(args);                                                    \
105     } while (0)
106 #define WL_ASSOC(args)                                                         \
107     do {                                                                       \
108         if (wl_msg_level & WL_ASSOC_VAL)                                       \
109             WL_PRINT(args);                                                    \
110         else                                                                   \
111             WIFICC_LOGDEBUG(args);                                             \
112     } while (0)
113 #define WL_PRUSR(m, b, n)
114 #define WL_PS(args)                                                            \
115     do {                                                                       \
116         if (wl_msg_level & WL_PS_VAL)                                          \
117             WL_PRINT(args);                                                    \
118     } while (0)
119 
120 #define WL_PORT(args)
121 #define WL_DUAL(args)
122 #define WL_REGULATORY(args)                                                    \
123     do {                                                                       \
124         if (wl_msg_level & WL_REGULATORY_VAL)                                  \
125             WL_PRINT(args);                                                    \
126         else                                                                   \
127             WIFICC_LOGDEBUG(args);                                             \
128     } while (0)
129 
130 #define WL_MPC(args)
131 #define WL_APSTA(args)
132 #define WL_APSTA_BCN(args)
133 #define WL_APSTA_TX(args)
134 #define WL_APSTA_TSF(args)
135 #define WL_APSTA_BSSID(args)
136 #define WL_BA(args)
137 #define WL_MBSS(args)
138 #define WL_MODE_SWITCH(args)
139 #define WL_PROTO(args)
140 
141 #define WL_CAC(args)                                                           \
142     do {                                                                       \
143         if (wl_msg_level & WL_CAC_VAL)                                         \
144             WL_PRINT(args);                                                    \
145     } while (0)
146 #define WL_AMSDU(args)
147 #define WL_AMPDU(args)
148 #define WL_FFPLD(args)
149 #define WL_MCHAN(args)
150 
151 #define WL_DFS(args)
152 #define WL_WOWL(args)
153 #define WL_DPT(args)
154 #define WL_ASSOC_OR_DPT(args)
155 #define WL_SCAN(args)                                                          \
156     do {                                                                       \
157         if (wl_msg_level2 & WL_SCAN_VAL)                                       \
158             WL_PRINT(args);                                                    \
159     } while (0)
160 #define WL_COEX(args)
161 #define WL_RTDC(w, s, i, j)
162 #define WL_RTDC2(w, s, i, j)
163 #define WL_CHANINT(args)
164 #define WL_BTA(args)
165 #define WL_P2P(args)
166 #define WL_ITFR(args)
167 #define WL_TDLS(args)
168 #define WL_MCNX(args)
169 #define WL_PROT(args)
170 #define WL_PSTA(args)
171 #define WL_WFDS(m, b, n)
172 #define WL_TRF_MGMT(args)
173 #define WL_L2FILTER(args)
174 #define WL_MQ(args)
175 #define WL_TXBF(args)
176 #define WL_MUMIMO(args)
177 #define WL_P2PO(args)
178 #define WL_ROAM(args)
179 #define WL_WNM(args)
180 #define WL_NAT(args)
181 
182 #ifdef WLMSG_MESH
183 #define WL_MESH(args) WL_PRINT(args)
184 #define WL_MESH_AMPE(args) WL_PRINT(args)
185 #define WL_MESH_ROUTE(args) WL_PRINT(args)
186 #define WL_MESH_BCN(args)
187 #else
188 #define WL_MESH(args)
189 #define WL_MESH_AMPE(args)
190 #define WL_MESH_ROUTE(args)
191 #define WL_MESH_BCN(args)
192 #endif // endif
193 #ifdef WLMSG_NATOE
194 #define WL_NAT(args)                                                           \
195     do {                                                                       \
196         if (wl_msg_level2 & WL_NATOE_VAL)                                      \
197             WL_PRINT(args);                                                    \
198     } while (0)
199 #else
200 #define WL_NAT(args)
201 #endif // endif
202 
203 #define WL_PFN_ERROR(args)
204 
205 #define WL_AMPDU_UPDN(args)
206 #define WL_AMPDU_RX(args)
207 #define WL_AMPDU_ERR(args)
208 #define WL_AMPDU_TX(args)
209 #define WL_AMPDU_CTL(args)
210 #define WL_AMPDU_HW(args)
211 #define WL_AMPDU_HWTXS(args)
212 #define WL_AMPDU_HWDBG(args)
213 #define WL_AMPDU_STAT(args)
214 #define WL_AMPDU_ERR_ON() 0
215 #define WL_AMPDU_HW_ON() 0
216 #define WL_AMPDU_HWTXS_ON() 0
217 
218 #define WL_APSTA_UPDN(args)
219 #define WL_APSTA_RX(args)
220 #define WL_WSEC(args)
221 #define WL_WSEC_DUMP(args)
222 #define WL_PCIE(args)
223 #define WL_TSLOG(w, s, i, j)
224 #define WL_FBT(args)
225 #define WL_MBO_DBG(args)
226 #define WL_RANDMAC_DBG(args)
227 #define WL_BAM_ERR(args)
228 #define WL_ADPS(args)
229 #define WL_OCE_DBG(args)
230 
231 #define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL)
232 #define WL_TRACE_ON() 0
233 #define WL_PRHDRS_ON() 0
234 #define WL_PRPKT_ON() 0
235 #define WL_INFORM_ON() 0
236 #define WL_TMP_ON() 0
237 #define WL_OID_ON() 0
238 #define WL_RATE_ON() (wl_msg_level & WL_RATE_VAL)
239 #define WL_ASSOC_ON() (wl_msg_level & WL_ASSOC_VAL)
240 #define WL_PRUSR_ON() 0
241 #define WL_PS_ON() (wl_msg_level & WL_PS_VAL)
242 #define WL_PORT_ON() 0
243 #define WL_WSEC_ON() 0
244 #define WL_WSEC_DUMP_ON() 0
245 #define WL_MPC_ON() 0
246 #define WL_REGULATORY_ON() (wl_msg_level & WL_REGULATORY_VAL)
247 #define WL_APSTA_ON() 0
248 #define WL_DFS_ON() 0
249 #define WL_MBSS_ON() 0
250 #define WL_CAC_ON() (wl_msg_level & WL_CAC_VAL)
251 #define WL_AMPDU_ON() 0
252 #define WL_DPT_ON() 0
253 #define WL_WOWL_ON() 0
254 #define WL_SCAN_ON() (wl_msg_level2 & WL_SCAN_VAL)
255 #define WL_BTA_ON() 0
256 #define WL_P2P_ON() 0
257 #define WL_ITFR_ON() 0
258 #define WL_MCHAN_ON() 0
259 #define WL_TDLS_ON() 0
260 #define WL_MCNX_ON() 0
261 #define WL_PROT_ON() 0
262 #define WL_PSTA_ON() 0
263 #define WL_TRF_MGMT_ON() 0
264 #define WL_LPC_ON() 0
265 #define WL_L2FILTER_ON() 0
266 #define WL_TXBF_ON() 0
267 #define WL_P2PO_ON() 0
268 #define WL_TSLOG_ON() 0
269 #define WL_WNM_ON() 0
270 #define WL_PCIE_ON() 0
271 #define WL_MUMIMO_ON() 0
272 #define WL_MESH_ON() 0
273 #define WL_MBO_DBG_ON() 0
274 #define WL_RANDMAC_DBG_ON() 0
275 #define WL_ADPS_ON() 0
276 #define WL_OCE_DBG_ON() 0
277 
278 #else /* !BCMDBG */
279 
280 /* DBGONLY() macro to reduce ifdefs in code for statements that are only needed
281  * when BCMDBG is defined.
282  */
283 #define DBGONLY(x)
284 
285 /* To disable a message completely ... until you need it again */
286 #define WL_NONE(args)
287 
288 #define WL_ERROR(args)
289 
290 #define KM_ERR(args)
291 
292 #define WL_AMPDU_ERR(args)
293 
294 #define WL_TRACE(args)
295 #define WL_APSTA_UPDN(args)
296 #define WL_APSTA_RX(args)
297 
298 #ifdef WLMSG_WSEC
299 #if defined(EVENT_LOG_COMPILE) && defined(EVENT_LOG_COMPILE)
300 #if defined(USE_EVENT_LOG_RA)
301 #define WL_WSEC(args) EVENT_LOG_RA(EVENT_LOG_TAG_WL_WSEC_LOG, args)
302 #define WL_WSEC_DUMP(args) EVENT_LOG_RA(EVENT_LOG_TAG_WL_WSEC_DUMP, args)
303 #else
304 #define WL_WSEC(args)                                                          \
305     EVENT_LOG_FAST_CAST_PAREN_ARGS(EVENT_LOG_TAG_WL_WSEC_LOG, args)
306 #define WL_WSEC_DUMP(args)                                                     \
307     EVENT_LOG_FAST_CAST_PAREN_ARGS(EVENT_LOG_TAG_WL_WSEC_DUMP, args)
308 #endif /* USE_EVENT_LOG_RA */
309 #else
310 #define WL_WSEC(args) WL_PRINT(args)
311 #define WL_WSEC_DUMP(args) WL_PRINT(args)
312 #endif /* EVENT_LOG_COMPILE */
313 #else
314 #define WL_WSEC(args)
315 #define WL_WSEC_DUMP(args)
316 #endif /* WLMSG_WSEC */
317 
318 #ifdef WLMSG_MBO
319 #if defined(EVENT_LOG_COMPILE) && defined(EVENT_LOG_COMPILE)
320 #if defined(USE_EVENT_LOG_RA)
321 #define WL_MBO_DBG(args) EVENT_LOG_RA(EVENT_LOG_TAG_MBO_DBG, args)
322 #define WL_MBO_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_MBO_INFO, args)
323 #else
324 #define WL_MBO_DBG(args)                                                       \
325     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_MBO_DBG, args)
326 #define WL_MBO_INFO(args)                                                      \
327     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_MBO_INFO, args)
328 #endif /* USE_EVENT_LOG_RA */
329 #else
330 #define WL_MBO_DBG(args) WL_PRINT(args)
331 #define WL_MBO_INFO(args) WL_PRINT(args)
332 #endif /* EVENT_LOG_COMPILE */
333 #else
334 #define WL_MBO_DBG(args)
335 #define WL_MBO_INFO(args)
336 #endif /* WLMSG_MBO */
337 
338 #define WL_MBO_ERR(args) WL_PRINT(args)
339 
340 #ifdef WLMSG_RANDMAC
341 #if defined(EVENT_LOG_COMPILE) && defined(EVENT_LOG_COMPILE)
342 #if defined(USE_EVENT_LOG_RA)
343 #define WL_RANDMAC_DBG(args) EVENT_LOG_RA(EVENT_LOG_TAG_RANDMAC_DBG, args)
344 #define WL_RANDMAC_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_RANDMAC_INFO, args)
345 #else
346 #define WL_RANDMAC_DBG(args)                                                   \
347     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_RANDMAC_DBG, args)
348 #define WL_RANDMAC_INFO(args)                                                  \
349     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_RANDMAC_INFO, args)
350 #endif /* USE_EVENT_LOG_RA */
351 #else
352 #define WL_RANDMAC_DBG(args) WL_PRINT(args)
353 #define WL_RANDMAC_INFO(args) WL_PRINT(args)
354 #endif /* EVENT_LOG_COMPILE */
355 #else
356 #define WL_RANDMAC_DBG(args)
357 #define WL_RANDMAC_INFO(args)
358 #endif /* WLMSG_RANDMAC */
359 
360 #define WL_RANDMAC_ERR(args) WL_PRINT(args)
361 
362 #ifdef WLMSG_OCE
363 #if defined(EVENT_LOG_COMPILE)
364 #if defined(USE_EVENT_LOG_RA)
365 #define WL_OCE_DBG(args) EVENT_LOG_RA(EVENT_LOG_TAG_OCE_DBG, args)
366 #define WL_OCE_INFO(args) EVENT_LOG_RA(EVENT_LOG_TAG_OCE_INFO, args)
367 #else
368 #define WL_OCE_DBG(args)                                                       \
369     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_OCE_DBG, args)
370 #define WL_OCE_INFO(args)                                                      \
371     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_OCE_INFO, args)
372 #endif /* USE_EVENT_LOG_RA */
373 #else
374 #define WL_OCE_DBG(args) WL_PRINT(args)
375 #define WL_OCE_INFO(args) WL_PRINT(args)
376 #endif /* EVENT_LOG_COMPILE */
377 #else
378 #define WL_OCE_DBG(args)
379 #define WL_OCE_INFO(args)
380 #endif /* WLMSG_OCE */
381 
382 #define WL_OCE_ERR(args) WL_PRINT(args)
383 
384 #define WL_PCIE(args)                                                          \
385     do {                                                                       \
386         if (wl_msg_level2 & WL_PCIE_VAL)                                       \
387             WL_PRINT(args);                                                    \
388     } while (0)
389 #define WL_PCIE_ON() (wl_msg_level2 & WL_PCIE_VAL)
390 #define WL_PFN(args)                                                           \
391     do {                                                                       \
392         if (wl_msg_level & WL_PFN_VAL)                                         \
393             WL_PRINT(args);                                                    \
394     } while (0)
395 #define WL_PFN_ON() (wl_msg_level & WL_PFN_VAL)
396 #endif // endif
397 
398 #ifdef WLMSG_BAM
399 #if defined(EVENT_LOG_COMPILE)
400 #ifdef USE_EVENT_LOG_RA
401 #define WL_BAM_ERR(args) EVENT_LOG_RA(EVENT_LOG_TAG_BAM, args)
402 #else
403 #define WL_BAM_ERR(args)                                                       \
404     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_BAM, args)
405 #endif /* USE_EVENT_LOG_RA */
406 #else
407 #define WL_BAM_ERR(args) WL_PRINT(args)
408 #endif /* EVENT_LOG_COMPILE */
409 #endif /* WLMSG_BAM */
410 
411 #ifdef WLMSG_WNM_BSSTRANS
412 #if defined(EVENT_LOG_COMPILE)
413 #if defined(USE_EVENT_LOG_RA)
414 #define WL_BSSTRANS_INFO(args)                                                 \
415     EVENT_LOG_RA(EVENT_LOG_TAG_WNM_BSSTRANS_INFO, args)
416 #else
417 #define WL_BSSTRANS_INFO(args)                                                 \
418     EVENT_LOG_COMPACT_CAST_PAREN_ARGS(EVENT_LOG_TAG_WNM_BSSTRANS_INFO, args)
419 #endif /* USE_EVENT_LOG_RA */
420 #else
421 #define WL_BSSTRANS_INFO(args) WL_PRINT(args)
422 #endif /* EVENT_LOG_COMPILE */
423 #else
424 #define WL_BSSTRANS_INFO(args)
425 #endif /* WLMSG_WNM_BSSTRANS */
426 
427 #define WL_BSSTRANS_ERR(args) WL_PRINT(args)
428 
429 #define DBGERRONLY(x)
430 
431 extern uint32 wl_msg_level;
432 extern uint32 wl_msg_level2;
433 #endif /* _wl_dbg_h_ */
434