debugfs.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef B43_DEBUGFS_H_
  3. #define B43_DEBUGFS_H_
  4. struct b43_wldev;
  5. struct b43_txstatus;
  6. enum b43_dyndbg { /* Dynamic debugging features */
  7. B43_DBG_XMITPOWER,
  8. B43_DBG_DMAOVERFLOW,
  9. B43_DBG_DMAVERBOSE,
  10. B43_DBG_PWORK_FAST,
  11. B43_DBG_PWORK_STOP,
  12. B43_DBG_LO,
  13. B43_DBG_FIRMWARE,
  14. B43_DBG_KEYS,
  15. B43_DBG_VERBOSESTATS,
  16. __B43_NR_DYNDBG,
  17. };
  18. #ifdef CONFIG_B43_DEBUG
  19. struct dentry;
  20. #define B43_NR_LOGGED_TXSTATUS 100
  21. struct b43_txstatus_log {
  22. /* This structure is protected by wl->mutex */
  23. struct b43_txstatus *log;
  24. int end;
  25. };
  26. struct b43_dfs_file {
  27. struct dentry *dentry;
  28. char *buffer;
  29. size_t data_len;
  30. };
  31. struct b43_dfsentry {
  32. struct b43_wldev *dev;
  33. struct dentry *subdir;
  34. struct b43_dfs_file file_shm16read;
  35. struct b43_dfs_file file_shm16write;
  36. struct b43_dfs_file file_shm32read;
  37. struct b43_dfs_file file_shm32write;
  38. struct b43_dfs_file file_mmio16read;
  39. struct b43_dfs_file file_mmio16write;
  40. struct b43_dfs_file file_mmio32read;
  41. struct b43_dfs_file file_mmio32write;
  42. struct b43_dfs_file file_txstat;
  43. struct b43_dfs_file file_txpower_g;
  44. struct b43_dfs_file file_restart;
  45. struct b43_dfs_file file_loctls;
  46. struct b43_txstatus_log txstatlog;
  47. /* The cached address for the next mmio16read file read */
  48. u16 mmio16read_next;
  49. /* The cached address for the next mmio32read file read */
  50. u16 mmio32read_next;
  51. /* The cached address for the next shm16read file read */
  52. u32 shm16read_routing_next;
  53. u32 shm16read_addr_next;
  54. /* The cached address for the next shm32read file read */
  55. u32 shm32read_routing_next;
  56. u32 shm32read_addr_next;
  57. /* Enabled/Disabled list for the dynamic debugging features. */
  58. bool dyn_debug[__B43_NR_DYNDBG];
  59. /* Dentries for the dynamic debugging entries. */
  60. struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
  61. };
  62. bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
  63. void b43_debugfs_init(void);
  64. void b43_debugfs_exit(void);
  65. void b43_debugfs_add_device(struct b43_wldev *dev);
  66. void b43_debugfs_remove_device(struct b43_wldev *dev);
  67. void b43_debugfs_log_txstat(struct b43_wldev *dev,
  68. const struct b43_txstatus *status);
  69. #else /* CONFIG_B43_DEBUG */
  70. static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
  71. {
  72. return false;
  73. }
  74. static inline void b43_debugfs_init(void)
  75. {
  76. }
  77. static inline void b43_debugfs_exit(void)
  78. {
  79. }
  80. static inline void b43_debugfs_add_device(struct b43_wldev *dev)
  81. {
  82. }
  83. static inline void b43_debugfs_remove_device(struct b43_wldev *dev)
  84. {
  85. }
  86. static inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
  87. const struct b43_txstatus *status)
  88. {
  89. }
  90. #endif /* CONFIG_B43_DEBUG */
  91. #endif /* B43_DEBUGFS_H_ */