fw_dbglog_api.h 5.7 KB

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