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