xref: /freebsd/sys/contrib/dev/athk/ath11k/debug.h (revision d0b2dbfa)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _ATH11K_DEBUG_H_
7 #define _ATH11K_DEBUG_H_
8 
9 #include "trace.h"
10 #include "debugfs.h"
11 
12 enum ath11k_debug_mask {
13 	ATH11K_DBG_AHB		= 0x00000001,
14 	ATH11K_DBG_WMI		= 0x00000002,
15 	ATH11K_DBG_HTC		= 0x00000004,
16 	ATH11K_DBG_DP_HTT	= 0x00000008,
17 	ATH11K_DBG_MAC		= 0x00000010,
18 	ATH11K_DBG_BOOT		= 0x00000020,
19 	ATH11K_DBG_QMI		= 0x00000040,
20 	ATH11K_DBG_DATA		= 0x00000080,
21 	ATH11K_DBG_MGMT		= 0x00000100,
22 	ATH11K_DBG_REG		= 0x00000200,
23 	ATH11K_DBG_TESTMODE	= 0x00000400,
24 	ATH11k_DBG_HAL		= 0x00000800,
25 	ATH11K_DBG_PCI		= 0x00001000,
26 	ATH11K_DBG_DP_TX	= 0x00001000,
27 	ATH11K_DBG_DP_RX	= 0x00002000,
28 	ATH11K_DBG_ANY		= 0xffffffff,
29 };
30 
31 __printf(2, 3) void ath11k_info(struct ath11k_base *ab, const char *fmt, ...);
32 __printf(2, 3) void ath11k_err(struct ath11k_base *ab, const char *fmt, ...);
33 __printf(2, 3) void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...);
34 
35 extern unsigned int ath11k_debug_mask;
36 
37 #ifdef CONFIG_ATH11K_DEBUG
38 __printf(3, 4) void __ath11k_dbg(struct ath11k_base *ab,
39 				 enum ath11k_debug_mask mask,
40 				 const char *fmt, ...);
41 void ath11k_dbg_dump(struct ath11k_base *ab,
42 		     enum ath11k_debug_mask mask,
43 		     const char *msg, const char *prefix,
44 		     const void *buf, size_t len);
45 #else /* CONFIG_ATH11K_DEBUG */
46 static inline int __ath11k_dbg(struct ath11k_base *ab,
47 			       enum ath11k_debug_mask dbg_mask,
48 			       const char *fmt, ...)
49 {
50 	return 0;
51 }
52 
53 static inline void ath11k_dbg_dump(struct ath11k_base *ab,
54 				   enum ath11k_debug_mask mask,
55 				   const char *msg, const char *prefix,
56 				   const void *buf, size_t len)
57 {
58 }
59 #endif /* CONFIG_ATH11K_DEBUG */
60 
61 #define ath11k_dbg(ar, dbg_mask, fmt, ...)			\
62 do {								\
63 	if ((ath11k_debug_mask & dbg_mask) ||			\
64 	    trace_ath11k_log_dbg_enabled())			\
65 		__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__);	\
66 } while (0)
67 
68 #endif /* _ATH11K_DEBUG_H_ */
69