fw_dbglog_api.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * Copyright (c) 2018-2019 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 _FW_DBGLOG_API_H_
  20. #define _FW_DBGLOG_API_H_
  21. #include "target_if.h"
  22. /**
  23. * fwdbg_set_log_lvl() - API to set debug log level
  24. * @dbg_handle: Debug module handle
  25. * @scn: scn handle
  26. * @log_lvl: value of log level
  27. *
  28. * Send wmi configuration command to set debug log level.
  29. *
  30. * Return: None
  31. */
  32. void fwdbg_set_log_lvl(struct common_dbglog_handle *dbg_handle, ol_scn_t scn,
  33. uint32_t log_lvl);
  34. /**
  35. * fwdbg_fw_handler() - Firmware handler interface
  36. * @dbg_handle: Debug module handle
  37. * @sc: soc handle
  38. * @data: Reference to command data
  39. * @datalen: length of data
  40. *
  41. * Return: 0 success
  42. */
  43. int fwdbg_fw_handler(struct common_dbglog_handle *dbg_handle, ol_scn_t sc,
  44. uint8_t *data, uint32_t datalen);
  45. /**
  46. * fwdbg_parse_debug_logs() - API to parse firmware debug logs
  47. * @dbg_handle: Debug module handle
  48. * @soc: soc handle
  49. * @datap: Reference to log data
  50. * @len: length of data
  51. * @context: log context
  52. *
  53. * API parse firmware debug log messages and prints to console.
  54. *
  55. * Return: 0 success
  56. */
  57. int fwdbg_parse_debug_logs(struct common_dbglog_handle *dbg_handle,
  58. ol_scn_t soc, uint8_t *datap,
  59. uint16_t len, void *context);
  60. /**
  61. * fwdbg_ratelimit_set() - API to set rate limit
  62. * @dbg_handle: Debug module handle
  63. * @burst_limit: burst limit
  64. *
  65. * Return: None
  66. */
  67. void fwdbg_ratelimit_set(struct common_dbglog_handle *dbg_handle,
  68. uint32_t burst_limit);
  69. /**
  70. * fwdbg_vap_log_enable() - API to Enable/Disable the logging for VAP
  71. * @dbg_handle: Debug module handle
  72. * @scn: scn handle
  73. * @vap_id: VAP id
  74. * @isenable: Enable/disable
  75. *
  76. * API allows to enable or disable debuglogs at VAP level. It encodes wmi
  77. * config command based on VAP id and sends wmi command to firmware to
  78. * enable/disable debuglog.
  79. *
  80. * Return: None
  81. */
  82. void fwdbg_vap_log_enable(struct common_dbglog_handle *dbg_handle, ol_scn_t scn,
  83. uint16_t vap_id, bool isenable);
  84. /**
  85. * fwdbg_set_timestamp_resolution - Set the resolution for time stamp
  86. * @dbg_handle: Debug module handle
  87. * @scn: scn handle
  88. * @tsr: time stamp resolution
  89. *
  90. * Set the resolution for time stamp in debug logs. It encodes wmi
  91. * config command to desired timestamp resolution and sends wmi command to
  92. * firmware.
  93. *
  94. * Return: None
  95. */
  96. void fwdbg_set_timestamp_resolution(struct common_dbglog_handle *dbg_handle,
  97. ol_scn_t scn, uint16_t tsr);
  98. /**
  99. * fwdbg_reporting_enable() - Enable reporting.
  100. * @dbg_handle: Debug module handle
  101. * @scn: scn handle
  102. * @isenable: Enable/disable
  103. *
  104. * API to enable debug information reporting. It encodes wmi config command
  105. * to enable reporting. If set to false then Target won't deliver any debug
  106. * information.
  107. *
  108. * Return: None
  109. */
  110. void fwdbg_reporting_enable(struct common_dbglog_handle *dbg_handle,
  111. ol_scn_t scn, bool isenable);
  112. /**
  113. * fwdbg_module_log_enable() - Enable/Disable logging for Module.
  114. * @dbg_handle: Debug module handle
  115. * @scn: scn handle
  116. * @mod_id: Module id
  117. * @isenable: Enable/disable
  118. *
  119. * API allows to enable or disable debuglogs per module. It encodes wmi
  120. * config command based on module id and sends wmi command to firmware to
  121. * enable/disable debuglog for that module.
  122. *
  123. * Return: None
  124. */
  125. void fwdbg_module_log_enable(struct common_dbglog_handle *dbg_handle,
  126. ol_scn_t scn, uint32_t mod_id, bool isenable);
  127. /**
  128. * fwdbg_init() - Initialize debuglog.
  129. * @dbg_handle: Debug module handle
  130. * @soc: soc handle
  131. *
  132. * It initializes debuglog print function for set of modules and
  133. * initializes WMI event handler for debuglog message event.
  134. *
  135. * Return: None
  136. */
  137. void fwdbg_init(struct common_dbglog_handle *dbg_handle, void *soc);
  138. /**
  139. * fwdbg_free() - Free debug handler.
  140. * @dbg_handle: Debug module handle
  141. * @soc: soc handle
  142. *
  143. * Return: None
  144. */
  145. void fwdbg_free(struct common_dbglog_handle *dbg_handle, void *soc);
  146. /**
  147. * fwdbg_set_report_size() - set the size of the report size
  148. * @dbg_handle: Debug module handle
  149. * @scn: soc handler
  150. * @size: Report size
  151. *
  152. * Set the debug log report size. It encodes wmi config command to
  153. * desired report size and sends wmi command to firmware.
  154. *
  155. * Return: None
  156. */
  157. void fwdbg_set_report_size(struct common_dbglog_handle *dbg_handle,
  158. ol_scn_t scn, uint16_t size);
  159. /**
  160. * fwdbg_smartlog_init() - initialize smart logging feature
  161. * @dbg_handle: Debug module handle
  162. * @ic: ic handler
  163. *
  164. * Return: 0 Success
  165. */
  166. int fwdbg_smartlog_init(struct common_dbglog_handle *dbg_handle, void *icp);
  167. /**
  168. * fwdbg_smartlog_deinit() - uninitializes smart logging feature
  169. * @dbg_handle: Debug module handle
  170. * @sc: sc handler
  171. *
  172. * Return: None
  173. */
  174. void fwdbg_smartlog_deinit(struct common_dbglog_handle *dbg_handle, void *sc);
  175. /**
  176. * fwdbg_smartlog_dump() - dumps smart logs
  177. * @dev: dev handler
  178. * @dbg_handle: Debug module handle
  179. * @attr: dev handler attributes
  180. * @buf: destination buffer to dump smart logs
  181. *
  182. * Return: 0 success
  183. */
  184. ssize_t fwdbg_smartlog_dump(struct common_dbglog_handle *dbg_handle,
  185. struct device *dev,
  186. struct device_attribute *attr, char *buf);
  187. #endif /* _FW_DBGLOG_API_H_ */