debug.h 1.9 KB

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