18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef B43_DEBUGFS_H_
38c2ecf20Sopenharmony_ci#define B43_DEBUGFS_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cistruct b43_wldev;
68c2ecf20Sopenharmony_cistruct b43_txstatus;
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cienum b43_dyndbg {		/* Dynamic debugging features */
98c2ecf20Sopenharmony_ci	B43_DBG_XMITPOWER,
108c2ecf20Sopenharmony_ci	B43_DBG_DMAOVERFLOW,
118c2ecf20Sopenharmony_ci	B43_DBG_DMAVERBOSE,
128c2ecf20Sopenharmony_ci	B43_DBG_PWORK_FAST,
138c2ecf20Sopenharmony_ci	B43_DBG_PWORK_STOP,
148c2ecf20Sopenharmony_ci	B43_DBG_LO,
158c2ecf20Sopenharmony_ci	B43_DBG_FIRMWARE,
168c2ecf20Sopenharmony_ci	B43_DBG_KEYS,
178c2ecf20Sopenharmony_ci	B43_DBG_VERBOSESTATS,
188c2ecf20Sopenharmony_ci	__B43_NR_DYNDBG,
198c2ecf20Sopenharmony_ci};
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#ifdef CONFIG_B43_DEBUG
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct dentry;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define B43_NR_LOGGED_TXSTATUS	100
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct b43_txstatus_log {
288c2ecf20Sopenharmony_ci	/* This structure is protected by wl->mutex */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	struct b43_txstatus *log;
318c2ecf20Sopenharmony_ci	int end;
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct b43_dfs_file {
358c2ecf20Sopenharmony_ci	struct dentry *dentry;
368c2ecf20Sopenharmony_ci	char *buffer;
378c2ecf20Sopenharmony_ci	size_t data_len;
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cistruct b43_dfsentry {
418c2ecf20Sopenharmony_ci	struct b43_wldev *dev;
428c2ecf20Sopenharmony_ci	struct dentry *subdir;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	struct b43_dfs_file file_shm16read;
458c2ecf20Sopenharmony_ci	struct b43_dfs_file file_shm16write;
468c2ecf20Sopenharmony_ci	struct b43_dfs_file file_shm32read;
478c2ecf20Sopenharmony_ci	struct b43_dfs_file file_shm32write;
488c2ecf20Sopenharmony_ci	struct b43_dfs_file file_mmio16read;
498c2ecf20Sopenharmony_ci	struct b43_dfs_file file_mmio16write;
508c2ecf20Sopenharmony_ci	struct b43_dfs_file file_mmio32read;
518c2ecf20Sopenharmony_ci	struct b43_dfs_file file_mmio32write;
528c2ecf20Sopenharmony_ci	struct b43_dfs_file file_txstat;
538c2ecf20Sopenharmony_ci	struct b43_dfs_file file_txpower_g;
548c2ecf20Sopenharmony_ci	struct b43_dfs_file file_restart;
558c2ecf20Sopenharmony_ci	struct b43_dfs_file file_loctls;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	struct b43_txstatus_log txstatlog;
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	/* The cached address for the next mmio16read file read */
608c2ecf20Sopenharmony_ci	u16 mmio16read_next;
618c2ecf20Sopenharmony_ci	/* The cached address for the next mmio32read file read */
628c2ecf20Sopenharmony_ci	u16 mmio32read_next;
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	/* The cached address for the next shm16read file read */
658c2ecf20Sopenharmony_ci	u32 shm16read_routing_next;
668c2ecf20Sopenharmony_ci	u32 shm16read_addr_next;
678c2ecf20Sopenharmony_ci	/* The cached address for the next shm32read file read */
688c2ecf20Sopenharmony_ci	u32 shm32read_routing_next;
698c2ecf20Sopenharmony_ci	u32 shm32read_addr_next;
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci	/* Enabled/Disabled list for the dynamic debugging features. */
728c2ecf20Sopenharmony_ci	bool dyn_debug[__B43_NR_DYNDBG];
738c2ecf20Sopenharmony_ci	/* Dentries for the dynamic debugging entries. */
748c2ecf20Sopenharmony_ci	struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_cibool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_civoid b43_debugfs_init(void);
808c2ecf20Sopenharmony_civoid b43_debugfs_exit(void);
818c2ecf20Sopenharmony_civoid b43_debugfs_add_device(struct b43_wldev *dev);
828c2ecf20Sopenharmony_civoid b43_debugfs_remove_device(struct b43_wldev *dev);
838c2ecf20Sopenharmony_civoid b43_debugfs_log_txstat(struct b43_wldev *dev,
848c2ecf20Sopenharmony_ci			    const struct b43_txstatus *status);
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#else /* CONFIG_B43_DEBUG */
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_cistatic inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
898c2ecf20Sopenharmony_ci{
908c2ecf20Sopenharmony_ci	return false;
918c2ecf20Sopenharmony_ci}
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cistatic inline void b43_debugfs_init(void)
948c2ecf20Sopenharmony_ci{
958c2ecf20Sopenharmony_ci}
968c2ecf20Sopenharmony_cistatic inline void b43_debugfs_exit(void)
978c2ecf20Sopenharmony_ci{
988c2ecf20Sopenharmony_ci}
998c2ecf20Sopenharmony_cistatic inline void b43_debugfs_add_device(struct b43_wldev *dev)
1008c2ecf20Sopenharmony_ci{
1018c2ecf20Sopenharmony_ci}
1028c2ecf20Sopenharmony_cistatic inline void b43_debugfs_remove_device(struct b43_wldev *dev)
1038c2ecf20Sopenharmony_ci{
1048c2ecf20Sopenharmony_ci}
1058c2ecf20Sopenharmony_cistatic inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
1068c2ecf20Sopenharmony_ci					  const struct b43_txstatus *status)
1078c2ecf20Sopenharmony_ci{
1088c2ecf20Sopenharmony_ci}
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#endif /* CONFIG_B43_DEBUG */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#endif /* B43_DEBUGFS_H_ */
113