dbglog_host.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /*
  2. * Copyright (c) 2011, 2014-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _DBGLOG_HOST_H_
  19. #define _DBGLOG_HOST_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #include "dbglog_common.h"
  24. #include "wmi_unified_param.h"
  25. #define DIAG_FWID_OFFSET 24
  26. #define DIAG_FWID_MASK 0xFF000000 /* Bit 24-31 */
  27. #define DIAG_TIMESTAMP_OFFSET 0
  28. #define DIAG_TIMESTAMP_MASK 0x00FFFFFF /* Bit 0-23 */
  29. #define DIAG_ID_OFFSET 16
  30. #define DIAG_ID_MASK 0xFFFF0000 /* Bit 16-31 */
  31. #define DIAG_VDEVID_OFFSET 11
  32. #define DIAG_VDEVID_MASK 0x0000F800 /* Bit 11-15 */
  33. #define DIAG_VDEVID_NUM_MAX 16
  34. #define DIAG_VDEVLEVEL_OFFSET 8
  35. #define DIAG_VDEVLEVEL_MASK 0x00000700 /* Bit 8-10 */
  36. #define DIAG_PAYLEN_OFFSET 0
  37. #define DIAG_PAYLEN_MASK 0x000000FF /* Bit 0-7 */
  38. #define DIAG_PAYLEN_OFFSET16 0
  39. #define DIAG_PAYLEN_MASK16 0x0000FFFF /* Bit 0-16 */
  40. #define DIAG_GET_TYPE(arg) \
  41. ((arg & DIAG_FWID_MASK) >> DIAG_FWID_OFFSET)
  42. #define DIAG_GET_TIME_STAMP(arg) \
  43. ((arg & DIAG_TIMESTAMP_MASK) >> DIAG_TIMESTAMP_OFFSET)
  44. #define DIAG_GET_ID(arg) \
  45. ((arg & DIAG_ID_MASK) >> DIAG_ID_OFFSET)
  46. #define DIAG_GET_VDEVID(arg) \
  47. ((arg & DIAG_VDEVID_MASK) >> DIAG_VDEVID_OFFSET)
  48. #define DIAG_GET_VDEVLEVEL(arg) \
  49. ((arg & DIAG_VDEVLEVEL_MASK) >> DIAG_VDEVLEVEL_OFFSET)
  50. #define DIAG_GET_PAYLEN(arg) \
  51. ((arg & DIAG_PAYLEN_MASK) >> DIAG_PAYLEN_OFFSET)
  52. #define DIAG_GET_PAYLEN16(arg) \
  53. ((arg & DIAG_PAYLEN_MASK16) >> DIAG_PAYLEN_OFFSET16)
  54. #ifdef FEATURE_FW_LOG_PARSING
  55. /*
  56. * set the dbglog parser type
  57. */int
  58. dbglog_parser_type_init(wmi_unified_t wmi_handle, int type);
  59. /** dbglog_int - Registers a WMI event handle for WMI_DBGMSG_EVENT
  60. * @brief wmi_handle - handle to wmi module
  61. */
  62. int
  63. dbglog_init(wmi_unified_t wmi_handle);
  64. /** dbglog_deinit - UnRegisters a WMI event handle for WMI_DBGMSG_EVENT
  65. * @brief wmi_handle - handle to wmi module
  66. */
  67. int
  68. dbglog_deinit(wmi_unified_t wmi_handle);
  69. /** set the size of the report size
  70. * @brief wmi_handle - handle to Wmi module
  71. * @brief size - Report size
  72. */
  73. int
  74. dbglog_set_report_size(wmi_unified_t wmi_handle, uint16_t size);
  75. /** Set the resolution for time stamp
  76. * @brief wmi_handle - handle to Wmi module
  77. * @ brief tsr - time stamp resolution
  78. */
  79. int
  80. dbglog_set_timestamp_resolution(wmi_unified_t wmi_handle,
  81. uint16_t tsr);
  82. /** Enable reporting. If it is set to false then Traget wont deliver
  83. * any debug information
  84. */
  85. int
  86. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable);
  87. #ifdef CONFIG_MCL
  88. /*
  89. * enum DBGLOG_LOG_LVL is not converged between WIN and MCL.
  90. * So this function declaration needs to be disabled from WIN side.
  91. */
  92. /** Set the log level
  93. * @brief DBGLOG_INFO - Information lowest log level
  94. * @brief DBGLOG_WARNING
  95. * @brief DBGLOG_ERROR - default log level
  96. */
  97. int
  98. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl);
  99. #endif
  100. /*
  101. * set the debug log level for a given module
  102. * mod_id_lvl : the format is more user friendly.
  103. * module_id = mod_id_lvl/10;
  104. * log_level = mod_id_lvl%10;
  105. * example : mod_id_lvl is 153. then module id is 15 and log level is 3.
  106. * this format allows user to pass a sinlge value
  107. * (which is the most convenient way for most of the OSs)
  108. * to be passed from user to the driver.
  109. */
  110. int
  111. dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl);
  112. /** Enable/Disable the logging for VAP */
  113. int
  114. dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
  115. A_BOOL isenable);
  116. /** Enable/Disable logging for Module */
  117. int
  118. dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
  119. A_BOOL isenable);
  120. /** set vap enablie bitmap */
  121. void
  122. dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,
  123. uint32_t vap_enable_bitmap);
  124. /** set log level for all the modules specified in the bitmap.
  125. * for all other modules with 0 in the bitmap (or) outside the bitmap,
  126. * the log level be reset to DBGLOG_ERR.
  127. */
  128. void
  129. dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle,
  130. uint32_t log_level,
  131. uint32_t *mod_enable_bitmap,
  132. uint32_t bitmap_len);
  133. int
  134. dbglog_parse_debug_logs(ol_scn_t scn, u_int8_t *datap,
  135. u_int32_t len);
  136. /** Register the cnss_diag activate with the wlan driver */
  137. int cnss_diag_activate_service(void);
  138. #else
  139. static inline int
  140. dbglog_parser_type_init(wmi_unified_t wmi_handle, int type)
  141. {
  142. return A_OK;
  143. }
  144. static inline int
  145. dbglog_init(wmi_unified_t wmi_handle)
  146. {
  147. return A_OK;
  148. }
  149. static inline int
  150. dbglog_deinit(wmi_unified_t wmi_handle)
  151. {
  152. return A_OK;
  153. }
  154. static inline int
  155. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable)
  156. {
  157. return A_OK;
  158. }
  159. #ifdef CONFIG_MCL
  160. static inline int
  161. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl)
  162. {
  163. return A_OK;
  164. }
  165. #endif
  166. static inline int cnss_diag_activate_service(void)
  167. {
  168. return A_OK;
  169. }
  170. static inline int
  171. dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
  172. A_BOOL isenable)
  173. {
  174. return A_OK;
  175. }
  176. static inline int
  177. dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
  178. A_BOOL isenable)
  179. {
  180. return A_OK;
  181. }
  182. static inline int
  183. dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl)
  184. {
  185. return A_OK;
  186. }
  187. #endif /* FEATURE_FW_LOG_PARSING */
  188. #ifdef __cplusplus
  189. }
  190. #endif
  191. #endif /* _DBGLOG_HOST_H_ */