blob: 0bf437c86c67ea214712015f968b7800063e6447 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Michael Buesche4d6b792007-09-18 15:39:42 -04002#ifndef B43_DEBUGFS_H_
3#define B43_DEBUGFS_H_
4
5struct b43_wldev;
6struct b43_txstatus;
7
8enum b43_dyndbg { /* Dynamic debugging features */
9 B43_DBG_XMITPOWER,
10 B43_DBG_DMAOVERFLOW,
11 B43_DBG_DMAVERBOSE,
12 B43_DBG_PWORK_FAST,
13 B43_DBG_PWORK_STOP,
Michael Bueschf5eda472008-04-20 16:03:32 +020014 B43_DBG_LO,
Michael Buesch923fd702008-06-20 18:02:08 +020015 B43_DBG_FIRMWARE,
Michael Buesch9cf7f242008-12-19 20:24:30 +010016 B43_DBG_KEYS,
Michael Buesch990b86f2009-09-12 00:48:03 +020017 B43_DBG_VERBOSESTATS,
Michael Buesche4d6b792007-09-18 15:39:42 -040018 __B43_NR_DYNDBG,
19};
20
21#ifdef CONFIG_B43_DEBUG
22
23struct dentry;
24
25#define B43_NR_LOGGED_TXSTATUS 100
26
27struct b43_txstatus_log {
Michael Buesch36dbd952009-09-04 22:51:29 +020028 /* This structure is protected by wl->mutex */
29
Michael Buesche4d6b792007-09-18 15:39:42 -040030 struct b43_txstatus *log;
31 int end;
Michael Buesche4d6b792007-09-18 15:39:42 -040032};
33
34struct b43_dfs_file {
35 struct dentry *dentry;
36 char *buffer;
37 size_t data_len;
38};
39
40struct b43_dfsentry {
41 struct b43_wldev *dev;
42 struct dentry *subdir;
43
Michael Buesch6bbc3212008-06-19 19:33:51 +020044 struct b43_dfs_file file_shm16read;
45 struct b43_dfs_file file_shm16write;
46 struct b43_dfs_file file_shm32read;
47 struct b43_dfs_file file_shm32write;
Michael Buesch8bd463f2008-06-19 00:35:49 +020048 struct b43_dfs_file file_mmio16read;
49 struct b43_dfs_file file_mmio16write;
50 struct b43_dfs_file file_mmio32read;
51 struct b43_dfs_file file_mmio32write;
Michael Buesche4d6b792007-09-18 15:39:42 -040052 struct b43_dfs_file file_txstat;
53 struct b43_dfs_file file_txpower_g;
54 struct b43_dfs_file file_restart;
55 struct b43_dfs_file file_loctls;
56
57 struct b43_txstatus_log txstatlog;
58
Michael Buesch8bd463f2008-06-19 00:35:49 +020059 /* The cached address for the next mmio16read file read */
60 u16 mmio16read_next;
61 /* The cached address for the next mmio32read file read */
62 u16 mmio32read_next;
63
Michael Buesch6bbc3212008-06-19 19:33:51 +020064 /* The cached address for the next shm16read file read */
65 u32 shm16read_routing_next;
66 u32 shm16read_addr_next;
67 /* The cached address for the next shm32read file read */
68 u32 shm32read_routing_next;
69 u32 shm32read_addr_next;
70
Michael Buesche4d6b792007-09-18 15:39:42 -040071 /* Enabled/Disabled list for the dynamic debugging features. */
Viresh Kumar621a5f72015-09-26 15:04:07 -070072 bool dyn_debug[__B43_NR_DYNDBG];
Michael Buesche4d6b792007-09-18 15:39:42 -040073 /* Dentries for the dynamic debugging entries. */
74 struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
75};
76
Michael Buesch060210f2009-01-25 15:49:59 +010077bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
Michael Buesche4d6b792007-09-18 15:39:42 -040078
79void b43_debugfs_init(void);
80void b43_debugfs_exit(void);
81void b43_debugfs_add_device(struct b43_wldev *dev);
82void b43_debugfs_remove_device(struct b43_wldev *dev);
83void b43_debugfs_log_txstat(struct b43_wldev *dev,
84 const struct b43_txstatus *status);
85
86#else /* CONFIG_B43_DEBUG */
87
Michael Buesch060210f2009-01-25 15:49:59 +010088static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
Michael Buesche4d6b792007-09-18 15:39:42 -040089{
Zhao, Gang1a2b2502014-02-16 22:31:38 +080090 return false;
Michael Buesche4d6b792007-09-18 15:39:42 -040091}
92
93static inline void b43_debugfs_init(void)
94{
95}
96static inline void b43_debugfs_exit(void)
97{
98}
99static inline void b43_debugfs_add_device(struct b43_wldev *dev)
100{
101}
102static inline void b43_debugfs_remove_device(struct b43_wldev *dev)
103{
104}
105static inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
106 const struct b43_txstatus *status)
107{
108}
109
110#endif /* CONFIG_B43_DEBUG */
111
112#endif /* B43_DEBUGFS_H_ */