xref: /freebsd/sys/contrib/dev/broadcom/brcm80211/brcmsmac/debug.h (revision b4c3e9b5b09c829b4135aff738bd2893ed052377)
1*b4c3e9b5SBjoern A. Zeeb /*
2*b4c3e9b5SBjoern A. Zeeb  * Copyright (c) 2012 Broadcom Corporation
3*b4c3e9b5SBjoern A. Zeeb  * Copyright (c) 2012 Canonical Ltd.
4*b4c3e9b5SBjoern A. Zeeb  *
5*b4c3e9b5SBjoern A. Zeeb  * Permission to use, copy, modify, and/or distribute this software for any
6*b4c3e9b5SBjoern A. Zeeb  * purpose with or without fee is hereby granted, provided that the above
7*b4c3e9b5SBjoern A. Zeeb  * copyright notice and this permission notice appear in all copies.
8*b4c3e9b5SBjoern A. Zeeb  *
9*b4c3e9b5SBjoern A. Zeeb  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*b4c3e9b5SBjoern A. Zeeb  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*b4c3e9b5SBjoern A. Zeeb  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12*b4c3e9b5SBjoern A. Zeeb  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*b4c3e9b5SBjoern A. Zeeb  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14*b4c3e9b5SBjoern A. Zeeb  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15*b4c3e9b5SBjoern A. Zeeb  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*b4c3e9b5SBjoern A. Zeeb  */
17*b4c3e9b5SBjoern A. Zeeb #ifndef _BRCMS_DEBUG_H_
18*b4c3e9b5SBjoern A. Zeeb #define _BRCMS_DEBUG_H_
19*b4c3e9b5SBjoern A. Zeeb 
20*b4c3e9b5SBjoern A. Zeeb #include <linux/device.h>
21*b4c3e9b5SBjoern A. Zeeb #include <linux/bcma/bcma.h>
22*b4c3e9b5SBjoern A. Zeeb #include <net/cfg80211.h>
23*b4c3e9b5SBjoern A. Zeeb #include <net/mac80211.h>
24*b4c3e9b5SBjoern A. Zeeb #include "main.h"
25*b4c3e9b5SBjoern A. Zeeb #include "mac80211_if.h"
26*b4c3e9b5SBjoern A. Zeeb 
27*b4c3e9b5SBjoern A. Zeeb __printf(2, 3)
28*b4c3e9b5SBjoern A. Zeeb void __brcms_info(struct device *dev, const char *fmt, ...);
29*b4c3e9b5SBjoern A. Zeeb __printf(2, 3)
30*b4c3e9b5SBjoern A. Zeeb void __brcms_warn(struct device *dev, const char *fmt, ...);
31*b4c3e9b5SBjoern A. Zeeb __printf(2, 3)
32*b4c3e9b5SBjoern A. Zeeb void __brcms_err(struct device *dev, const char *fmt, ...);
33*b4c3e9b5SBjoern A. Zeeb __printf(2, 3)
34*b4c3e9b5SBjoern A. Zeeb void __brcms_crit(struct device *dev, const char *fmt, ...);
35*b4c3e9b5SBjoern A. Zeeb 
36*b4c3e9b5SBjoern A. Zeeb #if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING)
37*b4c3e9b5SBjoern A. Zeeb __printf(4, 5)
38*b4c3e9b5SBjoern A. Zeeb void __brcms_dbg(struct device *dev, u32 level, const char *func,
39*b4c3e9b5SBjoern A. Zeeb 		 const char *fmt, ...);
40*b4c3e9b5SBjoern A. Zeeb #else
41*b4c3e9b5SBjoern A. Zeeb static inline __printf(4, 5)
__brcms_dbg(struct device * dev,u32 level,const char * func,const char * fmt,...)42*b4c3e9b5SBjoern A. Zeeb void __brcms_dbg(struct device *dev, u32 level, const char *func,
43*b4c3e9b5SBjoern A. Zeeb 		 const char *fmt, ...)
44*b4c3e9b5SBjoern A. Zeeb {
45*b4c3e9b5SBjoern A. Zeeb }
46*b4c3e9b5SBjoern A. Zeeb #endif
47*b4c3e9b5SBjoern A. Zeeb 
48*b4c3e9b5SBjoern A. Zeeb /*
49*b4c3e9b5SBjoern A. Zeeb  * Debug macros cannot be used when wlc is uninitialized. Generally
50*b4c3e9b5SBjoern A. Zeeb  * this means any code that could run before brcms_c_attach() has
51*b4c3e9b5SBjoern A. Zeeb  * returned successfully probably shouldn't use the following macros.
52*b4c3e9b5SBjoern A. Zeeb  */
53*b4c3e9b5SBjoern A. Zeeb 
54*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg(core, l, f, a...)	__brcms_dbg(&(core)->dev, l, __func__, f, ##a)
55*b4c3e9b5SBjoern A. Zeeb #define brcms_info(core, f, a...)	__brcms_info(&(core)->dev, f, ##a)
56*b4c3e9b5SBjoern A. Zeeb #define brcms_warn(core, f, a...)	__brcms_warn(&(core)->dev, f, ##a)
57*b4c3e9b5SBjoern A. Zeeb #define brcms_err(core, f, a...)	__brcms_err(&(core)->dev, f, ##a)
58*b4c3e9b5SBjoern A. Zeeb #define brcms_crit(core, f, a...)	__brcms_crit(&(core)->dev, f, ##a)
59*b4c3e9b5SBjoern A. Zeeb 
60*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_info(core, f, a...)		brcms_dbg(core, BRCM_DL_INFO, f, ##a)
61*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_mac80211(core, f, a...)	brcms_dbg(core, BRCM_DL_MAC80211, f, ##a)
62*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_rx(core, f, a...)		brcms_dbg(core, BRCM_DL_RX, f, ##a)
63*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_tx(core, f, a...)		brcms_dbg(core, BRCM_DL_TX, f, ##a)
64*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_int(core, f, a...)		brcms_dbg(core, BRCM_DL_INT, f, ##a)
65*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_dma(core, f, a...)		brcms_dbg(core, BRCM_DL_DMA, f, ##a)
66*b4c3e9b5SBjoern A. Zeeb #define brcms_dbg_ht(core, f, a...)		brcms_dbg(core, BRCM_DL_HT, f, ##a)
67*b4c3e9b5SBjoern A. Zeeb 
68*b4c3e9b5SBjoern A. Zeeb struct brcms_pub;
69*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_init(void);
70*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_exit(void);
71*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_attach(struct brcms_pub *drvr);
72*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_detach(struct brcms_pub *drvr);
73*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_create_files(struct brcms_pub *drvr);
74*b4c3e9b5SBjoern A. Zeeb 
75*b4c3e9b5SBjoern A. Zeeb #endif /* _BRCMS_DEBUG_H_ */
76