wl_dbg.h 12 KB

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