dbglog_host.h 7.3 KB

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