1 /* 2 * Copyright (c) 2011, 2014-2018 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 _DBGLOG_HOST_H_ 20 #define _DBGLOG_HOST_H_ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #include "dbglog_common.h" 27 #include "wmi_unified_param.h" 28 29 #define DIAG_FWID_OFFSET 24 30 #define DIAG_FWID_MASK 0xFF000000 /* Bit 24-31 */ 31 32 #define DIAG_TIMESTAMP_OFFSET 0 33 #define DIAG_TIMESTAMP_MASK 0x00FFFFFF /* Bit 0-23 */ 34 35 #define DIAG_ID_OFFSET 16 36 #define DIAG_ID_MASK 0xFFFF0000 /* Bit 16-31 */ 37 38 #define DIAG_VDEVID_OFFSET 11 39 #define DIAG_VDEVID_MASK 0x0000F800 /* Bit 11-15 */ 40 #define DIAG_VDEVID_NUM_MAX 16 41 42 #define DIAG_VDEVLEVEL_OFFSET 8 43 #define DIAG_VDEVLEVEL_MASK 0x00000700 /* Bit 8-10 */ 44 45 #define DIAG_PAYLEN_OFFSET 0 46 #define DIAG_PAYLEN_MASK 0x000000FF /* Bit 0-7 */ 47 48 #define DIAG_PAYLEN_OFFSET16 0 49 #define DIAG_PAYLEN_MASK16 0x0000FFFF /* Bit 0-16 */ 50 51 #define DIAG_GET_TYPE(arg) \ 52 ((arg & DIAG_FWID_MASK) >> DIAG_FWID_OFFSET) 53 54 #define DIAG_GET_TIME_STAMP(arg) \ 55 ((arg & DIAG_TIMESTAMP_MASK) >> DIAG_TIMESTAMP_OFFSET) 56 57 #define DIAG_GET_ID(arg) \ 58 ((arg & DIAG_ID_MASK) >> DIAG_ID_OFFSET) 59 60 #define DIAG_GET_VDEVID(arg) \ 61 ((arg & DIAG_VDEVID_MASK) >> DIAG_VDEVID_OFFSET) 62 63 #define DIAG_GET_VDEVLEVEL(arg) \ 64 ((arg & DIAG_VDEVLEVEL_MASK) >> DIAG_VDEVLEVEL_OFFSET) 65 66 #define DIAG_GET_PAYLEN(arg) \ 67 ((arg & DIAG_PAYLEN_MASK) >> DIAG_PAYLEN_OFFSET) 68 69 #define DIAG_GET_PAYLEN16(arg) \ 70 ((arg & DIAG_PAYLEN_MASK16) >> DIAG_PAYLEN_OFFSET16) 71 72 #ifdef FEATURE_FW_LOG_PARSING 73 /* 74 * set the dbglog parser type 75 */int 76 dbglog_parser_type_init(wmi_unified_t wmi_handle, int type); 77 78 /** dbglog_int - Registers a WMI event handle for WMI_DBGMSG_EVENT 79 * @brief wmi_handle - handle to wmi module 80 */ 81 int 82 dbglog_init(wmi_unified_t wmi_handle); 83 84 /** dbglog_deinit - UnRegisters a WMI event handle for WMI_DBGMSG_EVENT 85 * @brief wmi_handle - handle to wmi module 86 */ 87 int 88 dbglog_deinit(wmi_unified_t wmi_handle); 89 90 /** set the size of the report size 91 * @brief wmi_handle - handle to Wmi module 92 * @brief size - Report size 93 */ 94 int 95 dbglog_set_report_size(wmi_unified_t wmi_handle, uint16_t size); 96 97 /** Set the resolution for time stamp 98 * @brief wmi_handle - handle to Wmi module 99 * @ brief tsr - time stamp resolution 100 */ 101 int 102 dbglog_set_timestamp_resolution(wmi_unified_t wmi_handle, 103 uint16_t tsr); 104 105 /** Enable reporting. If it is set to false then Traget wont deliver 106 * any debug information 107 */ 108 int 109 dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable); 110 111 #ifdef CONFIG_MCL 112 /* 113 * enum DBGLOG_LOG_LVL is not converged between WIN and MCL. 114 * So this function declaration needs to be disabled from WIN side. 115 */ 116 117 /** Set the log level 118 * @brief DBGLOG_INFO - Information lowest log level 119 * @brief DBGLOG_WARNING 120 * @brief DBGLOG_ERROR - default log level 121 */ 122 int 123 dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl); 124 #endif 125 126 /* 127 * set the debug log level for a given module 128 * mod_id_lvl : the format is more user friendly. 129 * module_id = mod_id_lvl/10; 130 * log_level = mod_id_lvl%10; 131 * example : mod_id_lvl is 153. then module id is 15 and log level is 3. 132 * this format allows user to pass a sinlge value 133 * (which is the most convenient way for most of the OSs) 134 * to be passed from user to the driver. 135 */ 136 int 137 dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl); 138 139 /** Enable/Disable the logging for VAP */ 140 int 141 dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id, 142 A_BOOL isenable); 143 /** Enable/Disable logging for Module */ 144 int 145 dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id, 146 A_BOOL isenable); 147 148 /** set vap enablie bitmap */ 149 void 150 dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle, 151 uint32_t vap_enable_bitmap); 152 153 /** set log level for all the modules specified in the bitmap. 154 * for all other modules with 0 in the bitmap (or) outside the bitmap, 155 * the log level be reset to DBGLOG_ERR. 156 */ 157 void 158 dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle, 159 uint32_t log_level, 160 uint32_t *mod_enable_bitmap, 161 uint32_t bitmap_len); 162 163 int 164 dbglog_parse_debug_logs(ol_scn_t scn, u_int8_t *datap, 165 u_int32_t len); 166 167 168 /** Register the cnss_diag activate with the wlan driver */ 169 int cnss_diag_activate_service(void); 170 #else 171 static inline int 172 dbglog_parser_type_init(wmi_unified_t wmi_handle, int type) 173 { 174 return A_OK; 175 } 176 177 static inline int 178 dbglog_init(wmi_unified_t wmi_handle) 179 { 180 return A_OK; 181 } 182 183 static inline int 184 dbglog_deinit(wmi_unified_t wmi_handle) 185 { 186 return A_OK; 187 } 188 189 static inline int 190 dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable) 191 { 192 return A_OK; 193 } 194 195 #ifdef CONFIG_MCL 196 static inline int 197 dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl) 198 { 199 return A_OK; 200 } 201 #endif 202 203 static inline int cnss_diag_activate_service(void) 204 { 205 return A_OK; 206 } 207 208 static inline int 209 dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id, 210 A_BOOL isenable) 211 { 212 return A_OK; 213 } 214 215 static inline int 216 dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id, 217 A_BOOL isenable) 218 { 219 return A_OK; 220 } 221 222 static inline int 223 dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_id_lvl) 224 { 225 return A_OK; 226 } 227 #endif /* FEATURE_FW_LOG_PARSING */ 228 229 #ifdef __cplusplus 230 } 231 #endif 232 233 #endif /* _DBGLOG_HOST_H_ */ 234