dbglog_host.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. #define diag_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DIAG, params)
  55. #define diag_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DIAG, params)
  56. #define diag_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DIAG, params)
  57. #define diag_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_DIAG, params)
  58. #define diag_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DIAG, params)
  59. #define diag_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DIAG, params)
  60. #ifdef FEATURE_FW_LOG_PARSING
  61. /*
  62. * set the dbglog parser type
  63. */int
  64. dbglog_parser_type_init(wmi_unified_t wmi_handle, int type);
  65. /** dbglog_int - Registers a WMI event handle for WMI_DBGMSG_EVENT
  66. * @brief wmi_handle - handle to wmi module
  67. */
  68. int
  69. dbglog_init(wmi_unified_t wmi_handle);
  70. /** dbglog_deinit - UnRegisters a WMI event handle for WMI_DBGMSG_EVENT
  71. * @brief wmi_handle - handle to wmi module
  72. */
  73. int
  74. dbglog_deinit(wmi_unified_t wmi_handle);
  75. /** set the size of the report size
  76. * @brief wmi_handle - handle to Wmi module
  77. * @brief size - Report size
  78. */
  79. int
  80. dbglog_set_report_size(wmi_unified_t wmi_handle, uint16_t size);
  81. /** Set the resolution for time stamp
  82. * @brief wmi_handle - handle to Wmi module
  83. * @ brief tsr - time stamp resolution
  84. */
  85. int
  86. dbglog_set_timestamp_resolution(wmi_unified_t wmi_handle,
  87. uint16_t tsr);
  88. /** Enable reporting. If it is set to false then Target wont deliver
  89. * any debug information
  90. */
  91. int
  92. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable);
  93. /** Set the log level
  94. * @brief DBGLOG_INFO - Information lowest log level
  95. * @brief DBGLOG_WARNING
  96. * @brief DBGLOG_ERROR - default log level
  97. */
  98. int
  99. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl);
  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. /*
  113. * set the debug log level for wow module
  114. * mod_id_lvl : the format is more user friendly.
  115. * module_id = mod_id_lvl/10;
  116. * log_level = mod_id_lvl%10;
  117. * example : mod_id_lvl is 153. then module id is 15 and log level is 3.
  118. * this format allows user to pass a sinlge value
  119. * (which is the most convenient way for most of the OSs)
  120. * to be passed from user to the driver.
  121. */
  122. int
  123. dbglog_set_mod_wow_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl);
  124. /** Enable/Disable the logging for VAP */
  125. int
  126. dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
  127. A_BOOL isenable);
  128. /** Enable/Disable logging for Module */
  129. int
  130. dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
  131. A_BOOL isenable);
  132. /** set vap enablie bitmap */
  133. void
  134. dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,
  135. uint32_t vap_enable_bitmap);
  136. /** set log level for all the modules specified in the bitmap.
  137. * for all other modules with 0 in the bitmap (or) outside the bitmap,
  138. * the log level be reset to DBGLOG_ERR.
  139. */
  140. void
  141. dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle,
  142. uint32_t log_level,
  143. uint32_t *mod_enable_bitmap,
  144. uint32_t bitmap_len);
  145. int
  146. dbglog_parse_debug_logs(ol_scn_t scn, u_int8_t *datap,
  147. u_int32_t len);
  148. /**
  149. * cnss_diag_activate_service() - API to register CNSS diag cmd handler
  150. *
  151. * API to register the handler for the NL message received from cnss_diag
  152. * application.
  153. *
  154. * Return: 0
  155. */
  156. int cnss_diag_activate_service(void);
  157. /**
  158. * cnss_diag_deactivate_service() - API to deregister CNSS diag cmd handler
  159. *
  160. * API to deregister the handler for the NL message received from cnss_diag
  161. * application.
  162. *
  163. * Return: 0
  164. */
  165. int cnss_diag_deactivate_service(void);
  166. #else
  167. static inline int
  168. dbglog_parser_type_init(wmi_unified_t wmi_handle, int type)
  169. {
  170. return A_OK;
  171. }
  172. static inline int
  173. dbglog_init(wmi_unified_t wmi_handle)
  174. {
  175. return A_OK;
  176. }
  177. static inline int
  178. dbglog_deinit(wmi_unified_t wmi_handle)
  179. {
  180. return A_OK;
  181. }
  182. static inline int
  183. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable)
  184. {
  185. return A_OK;
  186. }
  187. static inline int
  188. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl)
  189. {
  190. return A_OK;
  191. }
  192. static inline int cnss_diag_activate_service(void)
  193. {
  194. return A_OK;
  195. }
  196. static inline int cnss_diag_deactivate_service(void)
  197. {
  198. return A_OK;
  199. }
  200. static inline int
  201. dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
  202. A_BOOL isenable)
  203. {
  204. return A_OK;
  205. }
  206. static inline int
  207. dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
  208. A_BOOL isenable)
  209. {
  210. return A_OK;
  211. }
  212. static inline int
  213. dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl)
  214. {
  215. return A_OK;
  216. }
  217. static inline int
  218. dbglog_set_mod_wow_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl)
  219. {
  220. return A_OK;
  221. }
  222. #endif /* FEATURE_FW_LOG_PARSING */
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226. #endif /* _DBGLOG_HOST_H_ */