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