18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef B43legacy_DEBUGFS_H_
38c2ecf20Sopenharmony_ci#define B43legacy_DEBUGFS_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cistruct b43legacy_wldev;
68c2ecf20Sopenharmony_cistruct b43legacy_txstatus;
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cienum b43legacy_dyndbg { /* Dynamic debugging features */
98c2ecf20Sopenharmony_ci	B43legacy_DBG_XMITPOWER,
108c2ecf20Sopenharmony_ci	B43legacy_DBG_DMAOVERFLOW,
118c2ecf20Sopenharmony_ci	B43legacy_DBG_DMAVERBOSE,
128c2ecf20Sopenharmony_ci	B43legacy_DBG_PWORK_FAST,
138c2ecf20Sopenharmony_ci	B43legacy_DBG_PWORK_STOP,
148c2ecf20Sopenharmony_ci	__B43legacy_NR_DYNDBG,
158c2ecf20Sopenharmony_ci};
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#ifdef CONFIG_B43LEGACY_DEBUG
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct dentry;
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define B43legacy_NR_LOGGED_TXSTATUS	100
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct b43legacy_txstatus_log {
258c2ecf20Sopenharmony_ci	struct b43legacy_txstatus *log;
268c2ecf20Sopenharmony_ci	int end;
278c2ecf20Sopenharmony_ci	spinlock_t lock;	/* lock for debugging */
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct b43legacy_dfs_file {
318c2ecf20Sopenharmony_ci	struct dentry *dentry;
328c2ecf20Sopenharmony_ci	char *buffer;
338c2ecf20Sopenharmony_ci	size_t data_len;
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistruct b43legacy_dfsentry {
378c2ecf20Sopenharmony_ci	struct b43legacy_wldev *dev;
388c2ecf20Sopenharmony_ci	struct dentry *subdir;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_tsf;
418c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_ucode_regs;
428c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_shm;
438c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_txstat;
448c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_txpower_g;
458c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_restart;
468c2ecf20Sopenharmony_ci	struct b43legacy_dfs_file file_loctls;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	struct b43legacy_txstatus_log txstatlog;
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	/* Enabled/Disabled list for the dynamic debugging features. */
518c2ecf20Sopenharmony_ci	bool dyn_debug[__B43legacy_NR_DYNDBG];
528c2ecf20Sopenharmony_ci	/* Dentries for the dynamic debugging entries. */
538c2ecf20Sopenharmony_ci	struct dentry *dyn_debug_dentries[__B43legacy_NR_DYNDBG];
548c2ecf20Sopenharmony_ci};
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciint b43legacy_debug(struct b43legacy_wldev *dev,
578c2ecf20Sopenharmony_ci		    enum b43legacy_dyndbg feature);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_civoid b43legacy_debugfs_init(void);
608c2ecf20Sopenharmony_civoid b43legacy_debugfs_exit(void);
618c2ecf20Sopenharmony_civoid b43legacy_debugfs_add_device(struct b43legacy_wldev *dev);
628c2ecf20Sopenharmony_civoid b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev);
638c2ecf20Sopenharmony_civoid b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev,
648c2ecf20Sopenharmony_ci				  const struct b43legacy_txstatus *status);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#else /* CONFIG_B43LEGACY_DEBUG*/
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistatic inline
698c2ecf20Sopenharmony_ciint b43legacy_debug(struct b43legacy_wldev *dev,
708c2ecf20Sopenharmony_ci		    enum b43legacy_dyndbg feature)
718c2ecf20Sopenharmony_ci{
728c2ecf20Sopenharmony_ci	return 0;
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic inline
768c2ecf20Sopenharmony_civoid b43legacy_debugfs_init(void) { }
778c2ecf20Sopenharmony_cistatic inline
788c2ecf20Sopenharmony_civoid b43legacy_debugfs_exit(void) { }
798c2ecf20Sopenharmony_cistatic inline
808c2ecf20Sopenharmony_civoid b43legacy_debugfs_add_device(struct b43legacy_wldev *dev) { }
818c2ecf20Sopenharmony_cistatic inline
828c2ecf20Sopenharmony_civoid b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev) { }
838c2ecf20Sopenharmony_cistatic inline
848c2ecf20Sopenharmony_civoid b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev,
858c2ecf20Sopenharmony_ci				  const struct b43legacy_txstatus *status)
868c2ecf20Sopenharmony_ci				  { }
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#endif /* CONFIG_B43LEGACY_DEBUG*/
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#endif /* B43legacy_DEBUGFS_H_ */
91