dbglog_host.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. * Copyright (c) 2011, 2014-2020 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 Target wont deliver
  83. * any debug information
  84. */
  85. int
  86. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable);
  87. /** Set the log level
  88. * @brief DBGLOG_INFO - Information lowest log level
  89. * @brief DBGLOG_WARNING
  90. * @brief DBGLOG_ERROR - default log level
  91. */
  92. int
  93. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl);
  94. /*
  95. * set the debug log level for a given module
  96. * mod_id_lvl : the format is more user friendly.
  97. * module_id = mod_id_lvl/10;
  98. * log_level = mod_id_lvl%10;
  99. * example : mod_id_lvl is 153. then module id is 15 and log level is 3.
  100. * this format allows user to pass a sinlge value
  101. * (which is the most convenient way for most of the OSs)
  102. * to be passed from user to the driver.
  103. */
  104. int
  105. dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl);
  106. /*
  107. * set the debug log level for wow module
  108. * mod_id_lvl : the format is more user friendly.
  109. * module_id = mod_id_lvl/10;
  110. * log_level = mod_id_lvl%10;
  111. * example : mod_id_lvl is 153. then module id is 15 and log level is 3.
  112. * this format allows user to pass a sinlge value
  113. * (which is the most convenient way for most of the OSs)
  114. * to be passed from user to the driver.
  115. */
  116. int
  117. dbglog_set_mod_wow_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl);
  118. /** Enable/Disable the logging for VAP */
  119. int
  120. dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
  121. A_BOOL isenable);
  122. /** Enable/Disable logging for Module */
  123. int
  124. dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
  125. A_BOOL isenable);
  126. /** set vap enablie bitmap */
  127. void
  128. dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,
  129. uint32_t vap_enable_bitmap);
  130. /** set log level for all the modules specified in the bitmap.
  131. * for all other modules with 0 in the bitmap (or) outside the bitmap,
  132. * the log level be reset to DBGLOG_ERR.
  133. */
  134. void
  135. dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle,
  136. uint32_t log_level,
  137. uint32_t *mod_enable_bitmap,
  138. uint32_t bitmap_len);
  139. int
  140. dbglog_parse_debug_logs(ol_scn_t scn, u_int8_t *datap,
  141. u_int32_t len);
  142. /**
  143. * cnss_diag_activate_service() - API to register CNSS diag cmd handler
  144. *
  145. * API to register the handler for the NL message received from cnss_diag
  146. * application.
  147. *
  148. * Return: 0
  149. */
  150. int cnss_diag_activate_service(void);
  151. /**
  152. * cnss_diag_deactivate_service() - API to deregister CNSS diag cmd handler
  153. *
  154. * API to deregister the handler for the NL message received from cnss_diag
  155. * application.
  156. *
  157. * Return: 0
  158. */
  159. int cnss_diag_deactivate_service(void);
  160. #else
  161. static inline int
  162. dbglog_parser_type_init(wmi_unified_t wmi_handle, int type)
  163. {
  164. return A_OK;
  165. }
  166. static inline int
  167. dbglog_init(wmi_unified_t wmi_handle)
  168. {
  169. return A_OK;
  170. }
  171. static inline int
  172. dbglog_deinit(wmi_unified_t wmi_handle)
  173. {
  174. return A_OK;
  175. }
  176. static inline int
  177. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable)
  178. {
  179. return A_OK;
  180. }
  181. static inline int
  182. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl)
  183. {
  184. return A_OK;
  185. }
  186. static inline int cnss_diag_activate_service(void)
  187. {
  188. return A_OK;
  189. }
  190. static inline int cnss_diag_deactivate_service(void)
  191. {
  192. return A_OK;
  193. }
  194. static inline int
  195. dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
  196. A_BOOL isenable)
  197. {
  198. return A_OK;
  199. }
  200. static inline int
  201. dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
  202. A_BOOL isenable)
  203. {
  204. return A_OK;
  205. }
  206. static inline int
  207. dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl)
  208. {
  209. return A_OK;
  210. }
  211. static inline int
  212. dbglog_set_mod_wow_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl)
  213. {
  214. return A_OK;
  215. }
  216. #endif /* FEATURE_FW_LOG_PARSING */
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220. #endif /* _DBGLOG_HOST_H_ */