Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1 | /* |
Paul Zhang | d19abd8 | 2017-01-04 16:45:42 +0800 | [diff] [blame] | 2 | * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * Host WMI unified implementation |
| 30 | */ |
| 31 | #include "athdefs.h" |
| 32 | #include "osapi_linux.h" |
| 33 | #include "a_types.h" |
| 34 | #include "a_debug.h" |
| 35 | #include "ol_if_athvar.h" |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 36 | #include "htc_api.h" |
| 37 | #include "htc_api.h" |
| 38 | #include "dbglog_host.h" |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 39 | #include "wmi_unified_priv.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 40 | #include "wmi_unified_param.h" |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 41 | |
Kiran Venkatappa | 23e6e08 | 2016-11-11 16:49:40 +0530 | [diff] [blame] | 42 | #ifndef WMI_NON_TLV_SUPPORT |
| 43 | #include "wmi_tlv_helper.h" |
| 44 | #endif |
| 45 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 46 | #include <linux/debugfs.h> |
| 47 | |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 48 | /* This check for CONFIG_WIN temporary added due to redeclaration compilation |
| 49 | error in MCL. Error is caused due to inclusion of wmi.h in wmi_unified_api.h |
| 50 | which gets included here through ol_if_athvar.h. Eventually it is expected that |
| 51 | wmi.h will be removed from wmi_unified_api.h after cleanup, which will need |
| 52 | WMI_CMD_HDR to be defined here. */ |
| 53 | #ifdef CONFIG_WIN |
| 54 | /* Copied from wmi.h */ |
| 55 | #undef MS |
| 56 | #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) |
| 57 | #undef SM |
| 58 | #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) |
| 59 | #undef WO |
| 60 | #define WO(_f) ((_f##_OFFSET) >> 2) |
| 61 | |
| 62 | #undef GET_FIELD |
| 63 | #define GET_FIELD(_addr, _f) MS(*((A_UINT32 *)(_addr) + WO(_f)), _f) |
| 64 | #undef SET_FIELD |
| 65 | #define SET_FIELD(_addr, _f, _val) \ |
| 66 | (*((A_UINT32 *)(_addr) + WO(_f)) = \ |
| 67 | (*((A_UINT32 *)(_addr) + WO(_f)) & ~_f##_MASK) | SM(_val, _f)) |
| 68 | |
| 69 | #define WMI_GET_FIELD(_msg_buf, _msg_type, _f) \ |
| 70 | GET_FIELD(_msg_buf, _msg_type ## _ ## _f) |
| 71 | |
| 72 | #define WMI_SET_FIELD(_msg_buf, _msg_type, _f, _val) \ |
| 73 | SET_FIELD(_msg_buf, _msg_type ## _ ## _f, _val) |
| 74 | |
| 75 | #define WMI_EP_APASS 0x0 |
| 76 | #define WMI_EP_LPASS 0x1 |
| 77 | #define WMI_EP_SENSOR 0x2 |
| 78 | |
| 79 | /* |
| 80 | * * Control Path |
| 81 | * */ |
| 82 | typedef PREPACK struct { |
| 83 | A_UINT32 commandId:24, |
| 84 | reserved:2, /* used for WMI endpoint ID */ |
| 85 | plt_priv:6; /* platform private */ |
| 86 | } POSTPACK WMI_CMD_HDR; /* used for commands and events */ |
| 87 | |
| 88 | #define WMI_CMD_HDR_COMMANDID_LSB 0 |
| 89 | #define WMI_CMD_HDR_COMMANDID_MASK 0x00ffffff |
| 90 | #define WMI_CMD_HDR_COMMANDID_OFFSET 0x00000000 |
| 91 | #define WMI_CMD_HDR_WMI_ENDPOINTID_MASK 0x03000000 |
| 92 | #define WMI_CMD_HDR_WMI_ENDPOINTID_OFFSET 24 |
| 93 | #define WMI_CMD_HDR_PLT_PRIV_LSB 24 |
| 94 | #define WMI_CMD_HDR_PLT_PRIV_MASK 0xff000000 |
| 95 | #define WMI_CMD_HDR_PLT_PRIV_OFFSET 0x00000000 |
| 96 | /* end of copy wmi.h */ |
| 97 | #endif /* CONFIG_WIN */ |
| 98 | |
Manikandan Mohan | 5826ae9 | 2016-06-08 16:29:39 -0700 | [diff] [blame] | 99 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)) |
| 100 | /* TODO Cleanup this backported function */ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 101 | static int wmi_bp_seq_printf(struct seq_file *m, const char *f, ...) |
Manikandan Mohan | 5826ae9 | 2016-06-08 16:29:39 -0700 | [diff] [blame] | 102 | { |
| 103 | va_list args; |
| 104 | |
| 105 | va_start(args, f); |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 106 | seq_vprintf(m, f, args); |
Manikandan Mohan | 5826ae9 | 2016-06-08 16:29:39 -0700 | [diff] [blame] | 107 | va_end(args); |
| 108 | |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 109 | return 0; |
Manikandan Mohan | 5826ae9 | 2016-06-08 16:29:39 -0700 | [diff] [blame] | 110 | } |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 111 | #else |
| 112 | #define wmi_bp_seq_printf(m, fmt, ...) seq_printf((m), fmt, ##__VA_ARGS__) |
Manikandan Mohan | 5826ae9 | 2016-06-08 16:29:39 -0700 | [diff] [blame] | 113 | #endif |
| 114 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 115 | #define WMI_MIN_HEAD_ROOM 64 |
| 116 | |
| 117 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 118 | #ifndef MAX_WMI_INSTANCES |
| 119 | #ifdef CONFIG_MCL |
| 120 | #define MAX_WMI_INSTANCES 1 |
| 121 | #else |
| 122 | #define MAX_WMI_INSTANCES 3 |
| 123 | #endif |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 124 | #define CUSTOM_MGMT_CMD_DATA_SIZE 4 |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 125 | #endif |
| 126 | |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 127 | #ifdef CONFIG_MCL |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 128 | /* WMI commands */ |
| 129 | uint32_t g_wmi_command_buf_idx = 0; |
| 130 | struct wmi_command_debug wmi_command_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; |
| 131 | |
| 132 | /* WMI commands TX completed */ |
| 133 | uint32_t g_wmi_command_tx_cmp_buf_idx = 0; |
| 134 | struct wmi_command_debug |
| 135 | wmi_command_tx_cmp_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; |
| 136 | |
| 137 | /* WMI events when processed */ |
| 138 | uint32_t g_wmi_event_buf_idx = 0; |
| 139 | struct wmi_event_debug wmi_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; |
| 140 | |
| 141 | /* WMI events when queued */ |
| 142 | uint32_t g_wmi_rx_event_buf_idx = 0; |
| 143 | struct wmi_event_debug wmi_rx_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 144 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 145 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 146 | #define WMI_COMMAND_RECORD(h, a, b) { \ |
| 147 | if (wmi_log_max_entry <= \ |
| 148 | *(h->log_info.wmi_command_log_buf_info.p_buf_tail_idx)) \ |
| 149 | *(h->log_info.wmi_command_log_buf_info.p_buf_tail_idx) = 0;\ |
| 150 | ((struct wmi_command_debug *)h->log_info.wmi_command_log_buf_info.buf)\ |
| 151 | [*(h->log_info.wmi_command_log_buf_info.p_buf_tail_idx)]\ |
| 152 | .command = a; \ |
| 153 | qdf_mem_copy(((struct wmi_command_debug *)h->log_info. \ |
| 154 | wmi_command_log_buf_info.buf) \ |
| 155 | [*(h->log_info.wmi_command_log_buf_info.p_buf_tail_idx)].data,\ |
| 156 | b, wmi_record_max_length); \ |
| 157 | ((struct wmi_command_debug *)h->log_info.wmi_command_log_buf_info.buf)\ |
| 158 | [*(h->log_info.wmi_command_log_buf_info.p_buf_tail_idx)].\ |
| 159 | time = qdf_get_log_timestamp(); \ |
| 160 | (*(h->log_info.wmi_command_log_buf_info.p_buf_tail_idx))++; \ |
| 161 | h->log_info.wmi_command_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 162 | } |
| 163 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 164 | #define WMI_COMMAND_TX_CMP_RECORD(h, a, b) { \ |
| 165 | if (wmi_log_max_entry <= \ |
| 166 | *(h->log_info.wmi_command_tx_cmp_log_buf_info.p_buf_tail_idx))\ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 167 | *(h->log_info.wmi_command_tx_cmp_log_buf_info. \ |
| 168 | p_buf_tail_idx) = 0; \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 169 | ((struct wmi_command_debug *)h->log_info. \ |
| 170 | wmi_command_tx_cmp_log_buf_info.buf) \ |
| 171 | [*(h->log_info.wmi_command_tx_cmp_log_buf_info. \ |
| 172 | p_buf_tail_idx)]. \ |
| 173 | command = a; \ |
| 174 | qdf_mem_copy(((struct wmi_command_debug *)h->log_info. \ |
| 175 | wmi_command_tx_cmp_log_buf_info.buf) \ |
| 176 | [*(h->log_info.wmi_command_tx_cmp_log_buf_info. \ |
| 177 | p_buf_tail_idx)]. \ |
| 178 | data, b, wmi_record_max_length); \ |
| 179 | ((struct wmi_command_debug *)h->log_info. \ |
| 180 | wmi_command_tx_cmp_log_buf_info.buf) \ |
| 181 | [*(h->log_info.wmi_command_tx_cmp_log_buf_info. \ |
| 182 | p_buf_tail_idx)]. \ |
| 183 | time = qdf_get_log_timestamp(); \ |
| 184 | (*(h->log_info.wmi_command_tx_cmp_log_buf_info.p_buf_tail_idx))++;\ |
| 185 | h->log_info.wmi_command_tx_cmp_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 186 | } |
| 187 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 188 | #define WMI_EVENT_RECORD(h, a, b) { \ |
| 189 | if (wmi_log_max_entry <= \ |
| 190 | *(h->log_info.wmi_event_log_buf_info.p_buf_tail_idx)) \ |
| 191 | *(h->log_info.wmi_event_log_buf_info.p_buf_tail_idx) = 0;\ |
| 192 | ((struct wmi_event_debug *)h->log_info.wmi_event_log_buf_info.buf)\ |
| 193 | [*(h->log_info.wmi_event_log_buf_info.p_buf_tail_idx)]. \ |
| 194 | event = a; \ |
| 195 | qdf_mem_copy(((struct wmi_event_debug *)h->log_info. \ |
| 196 | wmi_event_log_buf_info.buf) \ |
| 197 | [*(h->log_info.wmi_event_log_buf_info.p_buf_tail_idx)].data, b,\ |
| 198 | wmi_record_max_length); \ |
| 199 | ((struct wmi_event_debug *)h->log_info.wmi_event_log_buf_info.buf)\ |
| 200 | [*(h->log_info.wmi_event_log_buf_info.p_buf_tail_idx)].time =\ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 201 | qdf_get_log_timestamp(); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 202 | (*(h->log_info.wmi_event_log_buf_info.p_buf_tail_idx))++; \ |
| 203 | h->log_info.wmi_event_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 204 | } |
| 205 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 206 | #define WMI_RX_EVENT_RECORD(h, a, b) { \ |
| 207 | if (wmi_log_max_entry <= \ |
| 208 | *(h->log_info.wmi_rx_event_log_buf_info.p_buf_tail_idx))\ |
| 209 | *(h->log_info.wmi_rx_event_log_buf_info.p_buf_tail_idx) = 0;\ |
| 210 | ((struct wmi_event_debug *)h->log_info.wmi_rx_event_log_buf_info.buf)\ |
| 211 | [*(h->log_info.wmi_rx_event_log_buf_info.p_buf_tail_idx)].\ |
| 212 | event = a; \ |
| 213 | qdf_mem_copy(((struct wmi_event_debug *)h->log_info. \ |
| 214 | wmi_rx_event_log_buf_info.buf) \ |
| 215 | [*(h->log_info.wmi_rx_event_log_buf_info.p_buf_tail_idx)].\ |
| 216 | data, b, wmi_record_max_length); \ |
| 217 | ((struct wmi_event_debug *)h->log_info.wmi_rx_event_log_buf_info.buf)\ |
| 218 | [*(h->log_info.wmi_rx_event_log_buf_info.p_buf_tail_idx)].\ |
| 219 | time = qdf_get_log_timestamp(); \ |
| 220 | (*(h->log_info.wmi_rx_event_log_buf_info.p_buf_tail_idx))++; \ |
| 221 | h->log_info.wmi_rx_event_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 222 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 223 | |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 224 | #ifdef CONFIG_MCL |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 225 | uint32_t g_wmi_mgmt_command_buf_idx = 0; |
| 226 | struct |
| 227 | wmi_command_debug wmi_mgmt_command_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; |
| 228 | |
| 229 | /* wmi_mgmt commands TX completed */ |
| 230 | uint32_t g_wmi_mgmt_command_tx_cmp_buf_idx = 0; |
| 231 | struct wmi_command_debug |
| 232 | wmi_mgmt_command_tx_cmp_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; |
| 233 | |
| 234 | /* wmi_mgmt events when processed */ |
| 235 | uint32_t g_wmi_mgmt_event_buf_idx = 0; |
| 236 | struct wmi_event_debug |
| 237 | wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 238 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 239 | |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 240 | #define WMI_MGMT_COMMAND_RECORD(h, a, b) { \ |
| 241 | if (wmi_mgmt_log_max_entry <= \ |
| 242 | *(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)) \ |
| 243 | *(h->log_info.wmi_mgmt_command_log_buf_info. \ |
| 244 | p_buf_tail_idx) = 0; \ |
| 245 | ((struct wmi_command_debug *)h->log_info. \ |
| 246 | wmi_mgmt_command_log_buf_info.buf) \ |
| 247 | [*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\ |
| 248 | command = a; \ |
| 249 | qdf_mem_copy(((struct wmi_command_debug *)h->log_info. \ |
| 250 | wmi_mgmt_command_log_buf_info.buf) \ |
| 251 | [*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\ |
| 252 | data, b, \ |
| 253 | wmi_record_max_length); \ |
| 254 | ((struct wmi_command_debug *)h->log_info. \ |
| 255 | wmi_mgmt_command_log_buf_info.buf) \ |
| 256 | [*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\ |
| 257 | time = qdf_get_log_timestamp(); \ |
| 258 | (*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx))++;\ |
| 259 | h->log_info.wmi_mgmt_command_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 260 | } |
| 261 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 262 | #define WMI_MGMT_COMMAND_TX_CMP_RECORD(h, a, b) { \ |
| 263 | if (wmi_mgmt_log_max_entry <= \ |
| 264 | *(h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info. \ |
| 265 | p_buf_tail_idx)) \ |
| 266 | *(h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info. \ |
| 267 | p_buf_tail_idx) = 0; \ |
| 268 | ((struct wmi_command_debug *)h->log_info. \ |
| 269 | wmi_mgmt_command_tx_cmp_log_buf_info.buf) \ |
| 270 | [*(h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info. \ |
| 271 | p_buf_tail_idx)].command = a; \ |
| 272 | qdf_mem_copy(((struct wmi_command_debug *)h->log_info. \ |
| 273 | wmi_mgmt_command_tx_cmp_log_buf_info.buf)\ |
| 274 | [*(h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info. \ |
| 275 | p_buf_tail_idx)].data, b, \ |
| 276 | wmi_record_max_length); \ |
| 277 | ((struct wmi_command_debug *)h->log_info. \ |
| 278 | wmi_mgmt_command_tx_cmp_log_buf_info.buf) \ |
| 279 | [*(h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info. \ |
| 280 | p_buf_tail_idx)].time = \ |
| 281 | qdf_get_log_timestamp(); \ |
| 282 | (*(h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info. \ |
| 283 | p_buf_tail_idx))++; \ |
| 284 | h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 285 | } |
| 286 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 287 | #define WMI_MGMT_EVENT_RECORD(h, a, b) { \ |
| 288 | if (wmi_mgmt_log_max_entry <= \ |
| 289 | *(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx))\ |
| 290 | *(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx) = 0;\ |
| 291 | ((struct wmi_event_debug *)h->log_info.wmi_mgmt_event_log_buf_info.buf)\ |
| 292 | [*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx)]\ |
| 293 | .event = a; \ |
| 294 | qdf_mem_copy(((struct wmi_event_debug *)h->log_info. \ |
| 295 | wmi_mgmt_event_log_buf_info.buf) \ |
| 296 | [*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx)].\ |
| 297 | data, b, wmi_record_max_length); \ |
| 298 | ((struct wmi_event_debug *)h->log_info.wmi_mgmt_event_log_buf_info.buf)\ |
| 299 | [*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx)].\ |
| 300 | time = qdf_get_log_timestamp(); \ |
| 301 | (*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx))++; \ |
| 302 | h->log_info.wmi_mgmt_event_log_buf_info.length++; \ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 303 | } |
| 304 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 305 | /* These are defined to made it as module param, which can be configured */ |
| 306 | uint32_t wmi_log_max_entry = WMI_EVENT_DEBUG_MAX_ENTRY; |
| 307 | uint32_t wmi_mgmt_log_max_entry = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY; |
| 308 | uint32_t wmi_record_max_length = WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH; |
| 309 | uint32_t wmi_display_size = 100; |
| 310 | |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 311 | static uint8_t *wmi_id_to_name(uint32_t wmi_command); |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 312 | |
| 313 | /** |
| 314 | * wmi_log_init() - Initialize WMI event logging |
| 315 | * @wmi_handle: WMI handle. |
| 316 | * |
| 317 | * Return: Initialization status |
| 318 | */ |
| 319 | #ifdef CONFIG_MCL |
| 320 | static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle) |
| 321 | { |
| 322 | struct wmi_log_buf_t *cmd_log_buf = |
| 323 | &wmi_handle->log_info.wmi_command_log_buf_info; |
| 324 | struct wmi_log_buf_t *cmd_tx_cmpl_log_buf = |
| 325 | &wmi_handle->log_info.wmi_command_tx_cmp_log_buf_info; |
| 326 | |
| 327 | struct wmi_log_buf_t *event_log_buf = |
| 328 | &wmi_handle->log_info.wmi_event_log_buf_info; |
| 329 | struct wmi_log_buf_t *rx_event_log_buf = |
| 330 | &wmi_handle->log_info.wmi_rx_event_log_buf_info; |
| 331 | |
| 332 | struct wmi_log_buf_t *mgmt_cmd_log_buf = |
| 333 | &wmi_handle->log_info.wmi_mgmt_command_log_buf_info; |
| 334 | struct wmi_log_buf_t *mgmt_cmd_tx_cmp_log_buf = |
| 335 | &wmi_handle->log_info.wmi_mgmt_command_tx_cmp_log_buf_info; |
| 336 | struct wmi_log_buf_t *mgmt_event_log_buf = |
| 337 | &wmi_handle->log_info.wmi_mgmt_event_log_buf_info; |
| 338 | |
| 339 | /* WMI commands */ |
| 340 | cmd_log_buf->length = 0; |
| 341 | cmd_log_buf->buf_tail_idx = 0; |
| 342 | cmd_log_buf->buf = wmi_command_log_buffer; |
| 343 | cmd_log_buf->p_buf_tail_idx = &g_wmi_command_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 344 | cmd_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 345 | |
| 346 | /* WMI commands TX completed */ |
| 347 | cmd_tx_cmpl_log_buf->length = 0; |
| 348 | cmd_tx_cmpl_log_buf->buf_tail_idx = 0; |
| 349 | cmd_tx_cmpl_log_buf->buf = wmi_command_tx_cmp_log_buffer; |
| 350 | cmd_tx_cmpl_log_buf->p_buf_tail_idx = &g_wmi_command_tx_cmp_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 351 | cmd_tx_cmpl_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 352 | |
| 353 | /* WMI events when processed */ |
| 354 | event_log_buf->length = 0; |
| 355 | event_log_buf->buf_tail_idx = 0; |
| 356 | event_log_buf->buf = wmi_event_log_buffer; |
| 357 | event_log_buf->p_buf_tail_idx = &g_wmi_event_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 358 | event_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 359 | |
| 360 | /* WMI events when queued */ |
| 361 | rx_event_log_buf->length = 0; |
| 362 | rx_event_log_buf->buf_tail_idx = 0; |
| 363 | rx_event_log_buf->buf = wmi_rx_event_log_buffer; |
| 364 | rx_event_log_buf->p_buf_tail_idx = &g_wmi_rx_event_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 365 | rx_event_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 366 | |
| 367 | /* WMI Management commands */ |
| 368 | mgmt_cmd_log_buf->length = 0; |
| 369 | mgmt_cmd_log_buf->buf_tail_idx = 0; |
| 370 | mgmt_cmd_log_buf->buf = wmi_mgmt_command_log_buffer; |
| 371 | mgmt_cmd_log_buf->p_buf_tail_idx = &g_wmi_mgmt_command_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 372 | mgmt_cmd_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 373 | |
| 374 | /* WMI Management commands Tx completed*/ |
| 375 | mgmt_cmd_tx_cmp_log_buf->length = 0; |
| 376 | mgmt_cmd_tx_cmp_log_buf->buf_tail_idx = 0; |
| 377 | mgmt_cmd_tx_cmp_log_buf->buf = wmi_mgmt_command_tx_cmp_log_buffer; |
| 378 | mgmt_cmd_tx_cmp_log_buf->p_buf_tail_idx = |
| 379 | &g_wmi_mgmt_command_tx_cmp_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 380 | mgmt_cmd_tx_cmp_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 381 | |
| 382 | /* WMI Management events when processed*/ |
| 383 | mgmt_event_log_buf->length = 0; |
| 384 | mgmt_event_log_buf->buf_tail_idx = 0; |
| 385 | mgmt_event_log_buf->buf = wmi_mgmt_event_log_buffer; |
| 386 | mgmt_event_log_buf->p_buf_tail_idx = &g_wmi_mgmt_event_buf_idx; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 387 | mgmt_event_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 388 | |
| 389 | qdf_spinlock_create(&wmi_handle->log_info.wmi_record_lock); |
| 390 | wmi_handle->log_info.wmi_logging_enable = 1; |
| 391 | |
| 392 | return QDF_STATUS_SUCCESS; |
| 393 | } |
| 394 | #else |
| 395 | static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle) |
| 396 | { |
| 397 | struct wmi_log_buf_t *cmd_log_buf = |
| 398 | &wmi_handle->log_info.wmi_command_log_buf_info; |
| 399 | struct wmi_log_buf_t *cmd_tx_cmpl_log_buf = |
| 400 | &wmi_handle->log_info.wmi_command_tx_cmp_log_buf_info; |
| 401 | |
| 402 | struct wmi_log_buf_t *event_log_buf = |
| 403 | &wmi_handle->log_info.wmi_event_log_buf_info; |
| 404 | struct wmi_log_buf_t *rx_event_log_buf = |
| 405 | &wmi_handle->log_info.wmi_rx_event_log_buf_info; |
| 406 | |
| 407 | struct wmi_log_buf_t *mgmt_cmd_log_buf = |
| 408 | &wmi_handle->log_info.wmi_mgmt_command_log_buf_info; |
| 409 | struct wmi_log_buf_t *mgmt_cmd_tx_cmp_log_buf = |
| 410 | &wmi_handle->log_info.wmi_mgmt_command_tx_cmp_log_buf_info; |
| 411 | struct wmi_log_buf_t *mgmt_event_log_buf = |
| 412 | &wmi_handle->log_info.wmi_mgmt_event_log_buf_info; |
| 413 | |
| 414 | wmi_handle->log_info.wmi_logging_enable = 0; |
| 415 | |
| 416 | /* WMI commands */ |
| 417 | cmd_log_buf->length = 0; |
| 418 | cmd_log_buf->buf_tail_idx = 0; |
| 419 | cmd_log_buf->buf = (struct wmi_command_debug *) qdf_mem_malloc( |
| 420 | wmi_log_max_entry * sizeof(struct wmi_command_debug)); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 421 | cmd_log_buf->size = wmi_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 422 | |
| 423 | if (!cmd_log_buf->buf) { |
| 424 | qdf_print("no memory for WMI command log buffer..\n"); |
| 425 | return QDF_STATUS_E_NOMEM; |
| 426 | } |
| 427 | cmd_log_buf->p_buf_tail_idx = &cmd_log_buf->buf_tail_idx; |
| 428 | |
| 429 | /* WMI commands TX completed */ |
| 430 | cmd_tx_cmpl_log_buf->length = 0; |
| 431 | cmd_tx_cmpl_log_buf->buf_tail_idx = 0; |
| 432 | cmd_tx_cmpl_log_buf->buf = (struct wmi_command_debug *) qdf_mem_malloc( |
| 433 | wmi_log_max_entry * sizeof(struct wmi_command_debug)); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 434 | cmd_tx_cmpl_log_buf->size = wmi_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 435 | |
| 436 | if (!cmd_tx_cmpl_log_buf->buf) { |
| 437 | qdf_print("no memory for WMI Command Tx Complete log buffer..\n"); |
| 438 | return QDF_STATUS_E_NOMEM; |
| 439 | } |
| 440 | cmd_tx_cmpl_log_buf->p_buf_tail_idx = |
| 441 | &cmd_tx_cmpl_log_buf->buf_tail_idx; |
| 442 | |
| 443 | /* WMI events when processed */ |
| 444 | event_log_buf->length = 0; |
| 445 | event_log_buf->buf_tail_idx = 0; |
| 446 | event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc( |
| 447 | wmi_log_max_entry * sizeof(struct wmi_event_debug)); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 448 | event_log_buf->size = wmi_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 449 | |
| 450 | if (!event_log_buf->buf) { |
| 451 | qdf_print("no memory for WMI Event log buffer..\n"); |
| 452 | return QDF_STATUS_E_NOMEM; |
| 453 | } |
| 454 | event_log_buf->p_buf_tail_idx = &event_log_buf->buf_tail_idx; |
| 455 | |
| 456 | /* WMI events when queued */ |
| 457 | rx_event_log_buf->length = 0; |
| 458 | rx_event_log_buf->buf_tail_idx = 0; |
| 459 | rx_event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc( |
| 460 | wmi_log_max_entry * sizeof(struct wmi_event_debug)); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 461 | rx_event_log_buf->size = wmi_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 462 | |
| 463 | if (!rx_event_log_buf->buf) { |
| 464 | qdf_print("no memory for WMI Event Rx log buffer..\n"); |
| 465 | return QDF_STATUS_E_NOMEM; |
| 466 | } |
| 467 | rx_event_log_buf->p_buf_tail_idx = &rx_event_log_buf->buf_tail_idx; |
| 468 | |
| 469 | /* WMI Management commands */ |
| 470 | mgmt_cmd_log_buf->length = 0; |
| 471 | mgmt_cmd_log_buf->buf_tail_idx = 0; |
| 472 | mgmt_cmd_log_buf->buf = (struct wmi_command_debug *) qdf_mem_malloc( |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 473 | wmi_mgmt_log_max_entry * sizeof(struct wmi_command_debug)); |
| 474 | mgmt_cmd_log_buf->size = wmi_mgmt_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 475 | |
| 476 | if (!mgmt_cmd_log_buf->buf) { |
| 477 | qdf_print("no memory for WMI Management Command log buffer..\n"); |
| 478 | return QDF_STATUS_E_NOMEM; |
| 479 | } |
| 480 | mgmt_cmd_log_buf->p_buf_tail_idx = &mgmt_cmd_log_buf->buf_tail_idx; |
| 481 | |
| 482 | /* WMI Management commands Tx completed*/ |
| 483 | mgmt_cmd_tx_cmp_log_buf->length = 0; |
| 484 | mgmt_cmd_tx_cmp_log_buf->buf_tail_idx = 0; |
| 485 | mgmt_cmd_tx_cmp_log_buf->buf = (struct wmi_command_debug *) |
| 486 | qdf_mem_malloc( |
| 487 | wmi_mgmt_log_max_entry * |
| 488 | sizeof(struct wmi_command_debug)); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 489 | mgmt_cmd_tx_cmp_log_buf->size = wmi_mgmt_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 490 | |
| 491 | if (!mgmt_cmd_tx_cmp_log_buf->buf) { |
| 492 | qdf_print("no memory for WMI Management Command Tx complete log buffer..\n"); |
| 493 | return QDF_STATUS_E_NOMEM; |
| 494 | } |
| 495 | mgmt_cmd_tx_cmp_log_buf->p_buf_tail_idx = |
| 496 | &mgmt_cmd_tx_cmp_log_buf->buf_tail_idx; |
| 497 | |
| 498 | /* WMI Management events when processed*/ |
| 499 | mgmt_event_log_buf->length = 0; |
| 500 | mgmt_event_log_buf->buf_tail_idx = 0; |
| 501 | |
| 502 | mgmt_event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc( |
| 503 | wmi_mgmt_log_max_entry * |
| 504 | sizeof(struct wmi_event_debug)); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 505 | mgmt_event_log_buf->size = wmi_mgmt_log_max_entry; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 506 | |
| 507 | if (!mgmt_event_log_buf->buf) { |
| 508 | qdf_print("no memory for WMI Management Event log buffer..\n"); |
| 509 | return QDF_STATUS_E_NOMEM; |
| 510 | } |
| 511 | mgmt_event_log_buf->p_buf_tail_idx = &mgmt_event_log_buf->buf_tail_idx; |
| 512 | |
| 513 | qdf_spinlock_create(&wmi_handle->log_info.wmi_record_lock); |
| 514 | wmi_handle->log_info.wmi_logging_enable = 1; |
| 515 | |
| 516 | return QDF_STATUS_SUCCESS; |
| 517 | } |
| 518 | #endif |
| 519 | |
| 520 | /** |
| 521 | * wmi_log_buffer_free() - Free all dynamic allocated buffer memory for |
| 522 | * event logging |
| 523 | * @wmi_handle: WMI handle. |
| 524 | * |
| 525 | * Return: None |
| 526 | */ |
| 527 | #ifndef CONFIG_MCL |
| 528 | static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle) |
| 529 | { |
| 530 | if (wmi_handle->log_info.wmi_command_log_buf_info.buf) |
| 531 | qdf_mem_free(wmi_handle->log_info.wmi_command_log_buf_info.buf); |
| 532 | if (wmi_handle->log_info.wmi_command_tx_cmp_log_buf_info.buf) |
| 533 | qdf_mem_free( |
| 534 | wmi_handle->log_info.wmi_command_tx_cmp_log_buf_info.buf); |
| 535 | if (wmi_handle->log_info.wmi_event_log_buf_info.buf) |
| 536 | qdf_mem_free(wmi_handle->log_info.wmi_event_log_buf_info.buf); |
| 537 | if (wmi_handle->log_info.wmi_rx_event_log_buf_info.buf) |
| 538 | qdf_mem_free( |
| 539 | wmi_handle->log_info.wmi_rx_event_log_buf_info.buf); |
| 540 | if (wmi_handle->log_info.wmi_mgmt_command_log_buf_info.buf) |
| 541 | qdf_mem_free( |
| 542 | wmi_handle->log_info.wmi_mgmt_command_log_buf_info.buf); |
| 543 | if (wmi_handle->log_info.wmi_mgmt_command_tx_cmp_log_buf_info.buf) |
| 544 | qdf_mem_free( |
| 545 | wmi_handle->log_info.wmi_mgmt_command_tx_cmp_log_buf_info.buf); |
| 546 | if (wmi_handle->log_info.wmi_mgmt_event_log_buf_info.buf) |
| 547 | qdf_mem_free( |
| 548 | wmi_handle->log_info.wmi_mgmt_event_log_buf_info.buf); |
| 549 | wmi_handle->log_info.wmi_logging_enable = 0; |
| 550 | qdf_spinlock_destroy(&wmi_handle->log_info.wmi_record_lock); |
| 551 | } |
| 552 | #else |
| 553 | static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle) |
| 554 | { |
| 555 | /* Do Nothing */ |
| 556 | } |
| 557 | #endif |
| 558 | |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 559 | /** |
| 560 | * wmi_print_cmd_log_buffer() - an output agnostic wmi command log printer |
| 561 | * @log_buffer: the command log buffer metadata of the buffer to print |
| 562 | * @count: the maximum number of entries to print |
| 563 | * @print: an abstract print method, e.g. a qdf_print() or seq_printf() wrapper |
| 564 | * @print_priv: any data required by the print method, e.g. a file handle |
| 565 | * |
| 566 | * Return: None |
| 567 | */ |
| 568 | static void |
| 569 | wmi_print_cmd_log_buffer(struct wmi_log_buf_t *log_buffer, uint32_t count, |
| 570 | qdf_abstract_print *print, void *print_priv) |
| 571 | { |
| 572 | static const int data_len = |
| 573 | WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH / sizeof(uint32_t); |
| 574 | char str[128]; |
| 575 | uint32_t idx; |
| 576 | |
| 577 | if (count > log_buffer->size) |
| 578 | count = log_buffer->size; |
| 579 | if (count > log_buffer->length) |
| 580 | count = log_buffer->length; |
| 581 | |
| 582 | /* subtract count from index, and wrap if necessary */ |
| 583 | idx = log_buffer->size + *log_buffer->p_buf_tail_idx - count; |
| 584 | idx %= log_buffer->size; |
| 585 | |
| 586 | print(print_priv, "Time (seconds) Cmd Id Payload"); |
| 587 | while (count) { |
| 588 | struct wmi_command_debug *cmd_log = (struct wmi_command_debug *) |
| 589 | &((struct wmi_command_debug *)log_buffer->buf)[idx]; |
Dustin Brown | 8ea3912 | 2017-04-10 13:26:56 -0700 | [diff] [blame] | 590 | uint64_t secs, usecs; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 591 | int len = 0; |
| 592 | int i; |
| 593 | |
Dustin Brown | 8ea3912 | 2017-04-10 13:26:56 -0700 | [diff] [blame] | 594 | qdf_log_timestamp_to_secs(cmd_log->time, &secs, &usecs); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 595 | len += scnprintf(str + len, sizeof(str) - len, |
| 596 | "% 8lld.%06lld %6u (0x%06x) ", |
Dustin Brown | 8ea3912 | 2017-04-10 13:26:56 -0700 | [diff] [blame] | 597 | secs, usecs, |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 598 | cmd_log->command, cmd_log->command); |
| 599 | for (i = 0; i < data_len; ++i) { |
| 600 | len += scnprintf(str + len, sizeof(str) - len, |
| 601 | "0x%08x ", cmd_log->data[i]); |
| 602 | } |
| 603 | |
| 604 | print(print_priv, str); |
| 605 | |
| 606 | --count; |
| 607 | ++idx; |
| 608 | if (idx >= log_buffer->size) |
| 609 | idx = 0; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | /** |
| 614 | * wmi_print_event_log_buffer() - an output agnostic wmi event log printer |
| 615 | * @log_buffer: the event log buffer metadata of the buffer to print |
| 616 | * @count: the maximum number of entries to print |
| 617 | * @print: an abstract print method, e.g. a qdf_print() or seq_printf() wrapper |
| 618 | * @print_priv: any data required by the print method, e.g. a file handle |
| 619 | * |
| 620 | * Return: None |
| 621 | */ |
| 622 | static void |
| 623 | wmi_print_event_log_buffer(struct wmi_log_buf_t *log_buffer, uint32_t count, |
| 624 | qdf_abstract_print *print, void *print_priv) |
| 625 | { |
| 626 | static const int data_len = |
| 627 | WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH / sizeof(uint32_t); |
| 628 | char str[128]; |
| 629 | uint32_t idx; |
| 630 | |
| 631 | if (count > log_buffer->size) |
| 632 | count = log_buffer->size; |
| 633 | if (count > log_buffer->length) |
| 634 | count = log_buffer->length; |
| 635 | |
| 636 | /* subtract count from index, and wrap if necessary */ |
| 637 | idx = log_buffer->size + *log_buffer->p_buf_tail_idx - count; |
| 638 | idx %= log_buffer->size; |
| 639 | |
| 640 | print(print_priv, "Time (seconds) Event Id Payload"); |
| 641 | while (count) { |
| 642 | struct wmi_event_debug *event_log = (struct wmi_event_debug *) |
| 643 | &((struct wmi_event_debug *)log_buffer->buf)[idx]; |
Dustin Brown | 8ea3912 | 2017-04-10 13:26:56 -0700 | [diff] [blame] | 644 | uint64_t secs, usecs; |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 645 | int len = 0; |
| 646 | int i; |
| 647 | |
Dustin Brown | 8ea3912 | 2017-04-10 13:26:56 -0700 | [diff] [blame] | 648 | qdf_log_timestamp_to_secs(event_log->time, &secs, &usecs); |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 649 | len += scnprintf(str + len, sizeof(str) - len, |
| 650 | "% 8lld.%06lld %6u (0x%06x) ", |
Dustin Brown | 8ea3912 | 2017-04-10 13:26:56 -0700 | [diff] [blame] | 651 | secs, usecs, |
Dustin Brown | f24bf9b | 2017-04-03 17:00:07 -0700 | [diff] [blame] | 652 | event_log->event, event_log->event); |
| 653 | for (i = 0; i < data_len; ++i) { |
| 654 | len += scnprintf(str + len, sizeof(str) - len, |
| 655 | "0x%08x ", event_log->data[i]); |
| 656 | } |
| 657 | |
| 658 | print(print_priv, str); |
| 659 | |
| 660 | --count; |
| 661 | ++idx; |
| 662 | if (idx >= log_buffer->size) |
| 663 | idx = 0; |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | inline void |
| 668 | wmi_print_cmd_log(wmi_unified_t wmi, uint32_t count, |
| 669 | qdf_abstract_print *print, void *print_priv) |
| 670 | { |
| 671 | wmi_print_cmd_log_buffer( |
| 672 | &wmi->log_info.wmi_command_log_buf_info, |
| 673 | count, print, print_priv); |
| 674 | } |
| 675 | |
| 676 | inline void |
| 677 | wmi_print_cmd_tx_cmp_log(wmi_unified_t wmi, uint32_t count, |
| 678 | qdf_abstract_print *print, void *print_priv) |
| 679 | { |
| 680 | wmi_print_cmd_log_buffer( |
| 681 | &wmi->log_info.wmi_command_tx_cmp_log_buf_info, |
| 682 | count, print, print_priv); |
| 683 | } |
| 684 | |
| 685 | inline void |
| 686 | wmi_print_mgmt_cmd_log(wmi_unified_t wmi, uint32_t count, |
| 687 | qdf_abstract_print *print, void *print_priv) |
| 688 | { |
| 689 | wmi_print_cmd_log_buffer( |
| 690 | &wmi->log_info.wmi_mgmt_command_log_buf_info, |
| 691 | count, print, print_priv); |
| 692 | } |
| 693 | |
| 694 | inline void |
| 695 | wmi_print_mgmt_cmd_tx_cmp_log(wmi_unified_t wmi, uint32_t count, |
| 696 | qdf_abstract_print *print, void *print_priv) |
| 697 | { |
| 698 | wmi_print_cmd_log_buffer( |
| 699 | &wmi->log_info.wmi_mgmt_command_tx_cmp_log_buf_info, |
| 700 | count, print, print_priv); |
| 701 | } |
| 702 | |
| 703 | inline void |
| 704 | wmi_print_event_log(wmi_unified_t wmi, uint32_t count, |
| 705 | qdf_abstract_print *print, void *print_priv) |
| 706 | { |
| 707 | wmi_print_event_log_buffer( |
| 708 | &wmi->log_info.wmi_event_log_buf_info, |
| 709 | count, print, print_priv); |
| 710 | } |
| 711 | |
| 712 | inline void |
| 713 | wmi_print_rx_event_log(wmi_unified_t wmi, uint32_t count, |
| 714 | qdf_abstract_print *print, void *print_priv) |
| 715 | { |
| 716 | wmi_print_event_log_buffer( |
| 717 | &wmi->log_info.wmi_rx_event_log_buf_info, |
| 718 | count, print, print_priv); |
| 719 | } |
| 720 | |
| 721 | inline void |
| 722 | wmi_print_mgmt_event_log(wmi_unified_t wmi, uint32_t count, |
| 723 | qdf_abstract_print *print, void *print_priv) |
| 724 | { |
| 725 | wmi_print_event_log_buffer( |
| 726 | &wmi->log_info.wmi_mgmt_event_log_buf_info, |
| 727 | count, print, print_priv); |
| 728 | } |
| 729 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 730 | #ifdef CONFIG_MCL |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 731 | const int8_t * const debugfs_dir[MAX_WMI_INSTANCES] = {"WMI0"}; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 732 | #else |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 733 | const int8_t * const debugfs_dir[MAX_WMI_INSTANCES] = {"WMI0", "WMI1", "WMI2"}; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 734 | #endif |
| 735 | |
| 736 | /* debugfs routines*/ |
| 737 | |
| 738 | /** |
| 739 | * debug_wmi_##func_base##_show() - debugfs functions to display content of |
| 740 | * command and event buffers. Macro uses max buffer length to display |
| 741 | * buffer when it is wraparound. |
| 742 | * |
| 743 | * @m: debugfs handler to access wmi_handle |
| 744 | * @v: Variable arguments (not used) |
| 745 | * |
| 746 | * Return: Length of characters printed |
| 747 | */ |
| 748 | #define GENERATE_COMMAND_DEBUG_SHOW_FUNCS(func_base, wmi_ring_size) \ |
| 749 | static int debug_wmi_##func_base##_show(struct seq_file *m, \ |
| 750 | void *v) \ |
| 751 | { \ |
| 752 | wmi_unified_t wmi_handle = (wmi_unified_t) m->private; \ |
| 753 | struct wmi_log_buf_t *wmi_log = \ |
| 754 | &wmi_handle->log_info.wmi_##func_base##_buf_info;\ |
| 755 | int pos, nread, outlen; \ |
| 756 | int i; \ |
| 757 | \ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 758 | qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \ |
| 759 | if (!wmi_log->length) { \ |
| 760 | qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock);\ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 761 | return wmi_bp_seq_printf(m, \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 762 | "no elements to read from ring buffer!\n"); \ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 763 | } \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 764 | \ |
| 765 | if (wmi_log->length <= wmi_ring_size) \ |
| 766 | nread = wmi_log->length; \ |
| 767 | else \ |
| 768 | nread = wmi_ring_size; \ |
| 769 | \ |
| 770 | if (*(wmi_log->p_buf_tail_idx) == 0) \ |
| 771 | /* tail can be 0 after wrap-around */ \ |
| 772 | pos = wmi_ring_size - 1; \ |
| 773 | else \ |
| 774 | pos = *(wmi_log->p_buf_tail_idx) - 1; \ |
| 775 | \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 776 | outlen = wmi_bp_seq_printf(m, "Length = %d\n", wmi_log->length);\ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 777 | qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 778 | while (nread--) { \ |
| 779 | struct wmi_command_debug *wmi_record; \ |
| 780 | \ |
| 781 | wmi_record = (struct wmi_command_debug *) \ |
| 782 | &(((struct wmi_command_debug *)wmi_log->buf)[pos]);\ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 783 | outlen += wmi_bp_seq_printf(m, "CMD ID = %x\n", \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 784 | (wmi_record->command)); \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 785 | outlen += wmi_bp_seq_printf(m, "CMD = "); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 786 | for (i = 0; i < (wmi_record_max_length/ \ |
| 787 | sizeof(uint32_t)); i++) \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 788 | outlen += wmi_bp_seq_printf(m, "%x ", \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 789 | wmi_record->data[i]); \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 790 | outlen += wmi_bp_seq_printf(m, "\n"); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 791 | \ |
| 792 | if (pos == 0) \ |
| 793 | pos = wmi_ring_size - 1; \ |
| 794 | else \ |
| 795 | pos--; \ |
| 796 | } \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 797 | return outlen; \ |
| 798 | } \ |
| 799 | |
| 800 | #define GENERATE_EVENT_DEBUG_SHOW_FUNCS(func_base, wmi_ring_size) \ |
| 801 | static int debug_wmi_##func_base##_show(struct seq_file *m, \ |
| 802 | void *v) \ |
| 803 | { \ |
| 804 | wmi_unified_t wmi_handle = (wmi_unified_t) m->private; \ |
| 805 | struct wmi_log_buf_t *wmi_log = \ |
| 806 | &wmi_handle->log_info.wmi_##func_base##_buf_info;\ |
| 807 | int pos, nread, outlen; \ |
| 808 | int i; \ |
| 809 | \ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 810 | qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \ |
| 811 | if (!wmi_log->length) { \ |
| 812 | qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock);\ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 813 | return wmi_bp_seq_printf(m, \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 814 | "no elements to read from ring buffer!\n"); \ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 815 | } \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 816 | \ |
| 817 | if (wmi_log->length <= wmi_ring_size) \ |
| 818 | nread = wmi_log->length; \ |
| 819 | else \ |
| 820 | nread = wmi_ring_size; \ |
| 821 | \ |
| 822 | if (*(wmi_log->p_buf_tail_idx) == 0) \ |
| 823 | /* tail can be 0 after wrap-around */ \ |
| 824 | pos = wmi_ring_size - 1; \ |
| 825 | else \ |
| 826 | pos = *(wmi_log->p_buf_tail_idx) - 1; \ |
| 827 | \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 828 | outlen = wmi_bp_seq_printf(m, "Length = %d\n", wmi_log->length);\ |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 829 | qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 830 | while (nread--) { \ |
| 831 | struct wmi_event_debug *wmi_record; \ |
| 832 | \ |
| 833 | wmi_record = (struct wmi_event_debug *) \ |
| 834 | &(((struct wmi_event_debug *)wmi_log->buf)[pos]);\ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 835 | outlen += wmi_bp_seq_printf(m, "Event ID = %x\n",\ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 836 | (wmi_record->event)); \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 837 | outlen += wmi_bp_seq_printf(m, "CMD = "); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 838 | for (i = 0; i < (wmi_record_max_length/ \ |
| 839 | sizeof(uint32_t)); i++) \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 840 | outlen += wmi_bp_seq_printf(m, "%x ", \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 841 | wmi_record->data[i]); \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 842 | outlen += wmi_bp_seq_printf(m, "\n"); \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 843 | \ |
| 844 | if (pos == 0) \ |
| 845 | pos = wmi_ring_size - 1; \ |
| 846 | else \ |
| 847 | pos--; \ |
| 848 | } \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 849 | return outlen; \ |
| 850 | } |
| 851 | |
| 852 | GENERATE_COMMAND_DEBUG_SHOW_FUNCS(command_log, wmi_display_size); |
| 853 | GENERATE_COMMAND_DEBUG_SHOW_FUNCS(command_tx_cmp_log, wmi_display_size); |
| 854 | GENERATE_EVENT_DEBUG_SHOW_FUNCS(event_log, wmi_display_size); |
| 855 | GENERATE_EVENT_DEBUG_SHOW_FUNCS(rx_event_log, wmi_display_size); |
| 856 | GENERATE_COMMAND_DEBUG_SHOW_FUNCS(mgmt_command_log, wmi_display_size); |
| 857 | GENERATE_COMMAND_DEBUG_SHOW_FUNCS(mgmt_command_tx_cmp_log, |
| 858 | wmi_display_size); |
| 859 | GENERATE_EVENT_DEBUG_SHOW_FUNCS(mgmt_event_log, wmi_display_size); |
| 860 | |
| 861 | /** |
| 862 | * debug_wmi_enable_show() - debugfs functions to display enable state of |
| 863 | * wmi logging feature. |
| 864 | * |
| 865 | * @m: debugfs handler to access wmi_handle |
| 866 | * @v: Variable arguments (not used) |
| 867 | * |
| 868 | * Return: always 1 |
| 869 | */ |
| 870 | static int debug_wmi_enable_show(struct seq_file *m, void *v) |
| 871 | { |
| 872 | wmi_unified_t wmi_handle = (wmi_unified_t) m->private; |
| 873 | |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 874 | return wmi_bp_seq_printf(m, "%d\n", |
| 875 | wmi_handle->log_info.wmi_logging_enable); |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 876 | } |
| 877 | |
| 878 | /** |
| 879 | * debug_wmi_log_size_show() - debugfs functions to display configured size of |
| 880 | * wmi logging command/event buffer and management command/event buffer. |
| 881 | * |
| 882 | * @m: debugfs handler to access wmi_handle |
| 883 | * @v: Variable arguments (not used) |
| 884 | * |
| 885 | * Return: Length of characters printed |
| 886 | */ |
| 887 | static int debug_wmi_log_size_show(struct seq_file *m, void *v) |
| 888 | { |
| 889 | |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 890 | wmi_bp_seq_printf(m, "WMI command/event log max size:%d\n", |
| 891 | wmi_log_max_entry); |
| 892 | return wmi_bp_seq_printf(m, |
| 893 | "WMI management command/events log max size:%d\n", |
| 894 | wmi_mgmt_log_max_entry); |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 895 | } |
| 896 | |
| 897 | /** |
| 898 | * debug_wmi_##func_base##_write() - debugfs functions to clear |
| 899 | * wmi logging command/event buffer and management command/event buffer. |
| 900 | * |
| 901 | * @file: file handler to access wmi_handle |
| 902 | * @buf: received data buffer |
| 903 | * @count: length of received buffer |
| 904 | * @ppos: Not used |
| 905 | * |
| 906 | * Return: count |
| 907 | */ |
| 908 | #define GENERATE_DEBUG_WRITE_FUNCS(func_base, wmi_ring_size, wmi_record_type)\ |
| 909 | static ssize_t debug_wmi_##func_base##_write(struct file *file, \ |
| 910 | const char __user *buf, \ |
| 911 | size_t count, loff_t *ppos) \ |
| 912 | { \ |
| 913 | int k, ret; \ |
Pratik Gandhi | dad75ff | 2017-01-16 12:50:27 +0530 | [diff] [blame] | 914 | wmi_unified_t wmi_handle = \ |
| 915 | ((struct seq_file *)file->private_data)->private;\ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 916 | struct wmi_log_buf_t *wmi_log = &wmi_handle->log_info. \ |
| 917 | wmi_##func_base##_buf_info; \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 918 | char locbuf[50]; \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 919 | \ |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 920 | if ((!buf) || (count > 50)) \ |
| 921 | return -EFAULT; \ |
| 922 | \ |
| 923 | if (copy_from_user(locbuf, buf, count)) \ |
| 924 | return -EFAULT; \ |
| 925 | \ |
| 926 | ret = sscanf(locbuf, "%d", &k); \ |
| 927 | if ((ret != 1) || (k != 0)) { \ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 928 | qdf_print("Wrong input, echo 0 to clear the wmi buffer\n");\ |
| 929 | return -EINVAL; \ |
| 930 | } \ |
| 931 | \ |
| 932 | qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \ |
| 933 | qdf_mem_zero(wmi_log->buf, wmi_ring_size * \ |
| 934 | sizeof(struct wmi_record_type)); \ |
| 935 | wmi_log->length = 0; \ |
| 936 | *(wmi_log->p_buf_tail_idx) = 0; \ |
| 937 | qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \ |
| 938 | \ |
| 939 | return count; \ |
| 940 | } |
| 941 | |
| 942 | GENERATE_DEBUG_WRITE_FUNCS(command_log, wmi_log_max_entry, |
| 943 | wmi_command_debug); |
| 944 | GENERATE_DEBUG_WRITE_FUNCS(command_tx_cmp_log, wmi_log_max_entry, |
| 945 | wmi_command_debug); |
| 946 | GENERATE_DEBUG_WRITE_FUNCS(event_log, wmi_log_max_entry, |
| 947 | wmi_event_debug); |
| 948 | GENERATE_DEBUG_WRITE_FUNCS(rx_event_log, wmi_log_max_entry, |
| 949 | wmi_event_debug); |
| 950 | GENERATE_DEBUG_WRITE_FUNCS(mgmt_command_log, wmi_mgmt_log_max_entry, |
| 951 | wmi_command_debug); |
| 952 | GENERATE_DEBUG_WRITE_FUNCS(mgmt_command_tx_cmp_log, |
| 953 | wmi_mgmt_log_max_entry, wmi_command_debug); |
| 954 | GENERATE_DEBUG_WRITE_FUNCS(mgmt_event_log, wmi_mgmt_log_max_entry, |
| 955 | wmi_event_debug); |
| 956 | |
| 957 | /** |
| 958 | * debug_wmi_enable_write() - debugfs functions to enable/disable |
| 959 | * wmi logging feature. |
| 960 | * |
| 961 | * @file: file handler to access wmi_handle |
| 962 | * @buf: received data buffer |
| 963 | * @count: length of received buffer |
| 964 | * @ppos: Not used |
| 965 | * |
| 966 | * Return: count |
| 967 | */ |
| 968 | static ssize_t debug_wmi_enable_write(struct file *file, const char __user *buf, |
| 969 | size_t count, loff_t *ppos) |
| 970 | { |
Pratik Gandhi | dad75ff | 2017-01-16 12:50:27 +0530 | [diff] [blame] | 971 | wmi_unified_t wmi_handle = |
| 972 | ((struct seq_file *)file->private_data)->private; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 973 | int k, ret; |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 974 | char locbuf[50]; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 975 | |
Pratik Gandhi | 795ab91 | 2017-05-03 20:15:50 +0530 | [diff] [blame] | 976 | if ((!buf) || (count > 50)) |
| 977 | return -EFAULT; |
| 978 | |
| 979 | if (copy_from_user(locbuf, buf, count)) |
| 980 | return -EFAULT; |
| 981 | |
| 982 | ret = sscanf(locbuf, "%d", &k); |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 983 | if ((ret != 1) || ((k != 0) && (k != 1))) |
| 984 | return -EINVAL; |
| 985 | |
| 986 | wmi_handle->log_info.wmi_logging_enable = k; |
| 987 | return count; |
| 988 | } |
| 989 | |
| 990 | /** |
| 991 | * debug_wmi_log_size_write() - reserved. |
| 992 | * |
| 993 | * @file: file handler to access wmi_handle |
| 994 | * @buf: received data buffer |
| 995 | * @count: length of received buffer |
| 996 | * @ppos: Not used |
| 997 | * |
| 998 | * Return: count |
| 999 | */ |
| 1000 | static ssize_t debug_wmi_log_size_write(struct file *file, |
| 1001 | const char __user *buf, size_t count, loff_t *ppos) |
| 1002 | { |
| 1003 | return -EINVAL; |
| 1004 | } |
| 1005 | |
| 1006 | /* Structure to maintain debug information */ |
| 1007 | struct wmi_debugfs_info { |
| 1008 | const char *name; |
| 1009 | struct dentry *de[MAX_WMI_INSTANCES]; |
| 1010 | const struct file_operations *ops; |
| 1011 | }; |
| 1012 | |
| 1013 | #define DEBUG_FOO(func_base) { .name = #func_base, \ |
| 1014 | .ops = &debug_##func_base##_ops } |
| 1015 | |
| 1016 | /** |
| 1017 | * debug_##func_base##_open() - Open debugfs entry for respective command |
| 1018 | * and event buffer. |
| 1019 | * |
| 1020 | * @inode: node for debug dir entry |
| 1021 | * @file: file handler |
| 1022 | * |
| 1023 | * Return: open status |
| 1024 | */ |
| 1025 | #define GENERATE_DEBUG_STRUCTS(func_base) \ |
| 1026 | static int debug_##func_base##_open(struct inode *inode, \ |
| 1027 | struct file *file) \ |
| 1028 | { \ |
| 1029 | return single_open(file, debug_##func_base##_show, \ |
| 1030 | inode->i_private); \ |
| 1031 | } \ |
| 1032 | \ |
| 1033 | \ |
| 1034 | static struct file_operations debug_##func_base##_ops = { \ |
| 1035 | .open = debug_##func_base##_open, \ |
| 1036 | .read = seq_read, \ |
| 1037 | .llseek = seq_lseek, \ |
| 1038 | .write = debug_##func_base##_write, \ |
| 1039 | .release = single_release, \ |
| 1040 | }; |
| 1041 | |
| 1042 | GENERATE_DEBUG_STRUCTS(wmi_command_log); |
| 1043 | GENERATE_DEBUG_STRUCTS(wmi_command_tx_cmp_log); |
| 1044 | GENERATE_DEBUG_STRUCTS(wmi_event_log); |
| 1045 | GENERATE_DEBUG_STRUCTS(wmi_rx_event_log); |
| 1046 | GENERATE_DEBUG_STRUCTS(wmi_mgmt_command_log); |
| 1047 | GENERATE_DEBUG_STRUCTS(wmi_mgmt_command_tx_cmp_log); |
| 1048 | GENERATE_DEBUG_STRUCTS(wmi_mgmt_event_log); |
| 1049 | GENERATE_DEBUG_STRUCTS(wmi_enable); |
| 1050 | GENERATE_DEBUG_STRUCTS(wmi_log_size); |
| 1051 | |
| 1052 | struct wmi_debugfs_info wmi_debugfs_infos[] = { |
| 1053 | DEBUG_FOO(wmi_command_log), |
| 1054 | DEBUG_FOO(wmi_command_tx_cmp_log), |
| 1055 | DEBUG_FOO(wmi_event_log), |
| 1056 | DEBUG_FOO(wmi_rx_event_log), |
| 1057 | DEBUG_FOO(wmi_mgmt_command_log), |
| 1058 | DEBUG_FOO(wmi_mgmt_command_tx_cmp_log), |
| 1059 | DEBUG_FOO(wmi_mgmt_event_log), |
| 1060 | DEBUG_FOO(wmi_enable), |
| 1061 | DEBUG_FOO(wmi_log_size), |
| 1062 | }; |
| 1063 | |
| 1064 | #define NUM_DEBUG_INFOS (sizeof(wmi_debugfs_infos) / \ |
| 1065 | sizeof(wmi_debugfs_infos[0])) |
| 1066 | |
| 1067 | /** |
| 1068 | * wmi_debugfs_create() - Create debug_fs entry for wmi logging. |
| 1069 | * |
| 1070 | * @wmi_handle: wmi handle |
| 1071 | * @par_entry: debug directory entry |
| 1072 | * @id: Index to debug info data array |
| 1073 | * |
| 1074 | * Return: none |
| 1075 | */ |
| 1076 | static void wmi_debugfs_create(wmi_unified_t wmi_handle, |
| 1077 | struct dentry *par_entry, int id) |
| 1078 | { |
| 1079 | int i; |
| 1080 | |
| 1081 | if (par_entry == NULL || (id < 0) || (id >= MAX_WMI_INSTANCES)) |
| 1082 | goto out; |
| 1083 | |
| 1084 | for (i = 0; i < NUM_DEBUG_INFOS; ++i) { |
| 1085 | |
| 1086 | wmi_debugfs_infos[i].de[id] = debugfs_create_file( |
| 1087 | wmi_debugfs_infos[i].name, 0644, par_entry, |
| 1088 | wmi_handle, wmi_debugfs_infos[i].ops); |
| 1089 | |
| 1090 | if (wmi_debugfs_infos[i].de[id] == NULL) { |
| 1091 | qdf_print("%s: debug Entry creation failed!\n", |
| 1092 | __func__); |
| 1093 | goto out; |
| 1094 | } |
| 1095 | } |
| 1096 | |
| 1097 | return; |
| 1098 | |
| 1099 | out: |
| 1100 | qdf_print("%s: debug Entry creation failed!\n", __func__); |
| 1101 | wmi_log_buffer_free(wmi_handle); |
| 1102 | return; |
| 1103 | } |
| 1104 | |
| 1105 | /** |
| 1106 | * wmi_debugfs_remove() - Remove debugfs entry for wmi logging. |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1107 | * @wmi_handle: wmi handle |
| 1108 | * @dentry: debugfs directory entry |
| 1109 | * @id: Index to debug info data array |
| 1110 | * |
| 1111 | * Return: none |
| 1112 | */ |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 1113 | static void wmi_debugfs_remove(wmi_unified_t wmi_handle) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1114 | { |
| 1115 | int i; |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 1116 | struct dentry *dentry = wmi_handle->log_info.wmi_log_debugfs_dir; |
| 1117 | int id = wmi_handle->log_info.wmi_instance_id; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1118 | |
| 1119 | if (dentry && (!(id < 0) || (id >= MAX_WMI_INSTANCES))) { |
| 1120 | for (i = 0; i < NUM_DEBUG_INFOS; ++i) { |
| 1121 | if (wmi_debugfs_infos[i].de[id]) |
| 1122 | wmi_debugfs_infos[i].de[id] = NULL; |
| 1123 | } |
| 1124 | } |
| 1125 | |
| 1126 | if (dentry) |
| 1127 | debugfs_remove_recursive(dentry); |
| 1128 | } |
| 1129 | |
| 1130 | /** |
| 1131 | * wmi_debugfs_init() - debugfs functions to create debugfs directory and to |
| 1132 | * create debugfs enteries. |
| 1133 | * |
| 1134 | * @h: wmi handler |
| 1135 | * |
| 1136 | * Return: init status |
| 1137 | */ |
| 1138 | static QDF_STATUS wmi_debugfs_init(wmi_unified_t wmi_handle) |
| 1139 | { |
| 1140 | static int wmi_index; |
| 1141 | |
| 1142 | if (wmi_index < MAX_WMI_INSTANCES) |
| 1143 | wmi_handle->log_info.wmi_log_debugfs_dir = |
| 1144 | debugfs_create_dir(debugfs_dir[wmi_index], NULL); |
| 1145 | |
| 1146 | if (wmi_handle->log_info.wmi_log_debugfs_dir == NULL) { |
| 1147 | qdf_print("error while creating debugfs dir for %s\n", |
| 1148 | debugfs_dir[wmi_index]); |
| 1149 | return QDF_STATUS_E_FAILURE; |
| 1150 | } |
| 1151 | |
| 1152 | wmi_debugfs_create(wmi_handle, wmi_handle->log_info.wmi_log_debugfs_dir, |
| 1153 | wmi_index); |
| 1154 | wmi_handle->log_info.wmi_instance_id = wmi_index++; |
| 1155 | |
| 1156 | return QDF_STATUS_SUCCESS; |
| 1157 | } |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 1158 | |
| 1159 | /** |
| 1160 | * wmi_mgmt_cmd_record() - Wrapper function for mgmt command logging macro |
| 1161 | * |
| 1162 | * @wmi_handle: wmi handle |
| 1163 | * @cmd: mgmt command |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 1164 | * @header: pointer to 802.11 header |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 1165 | * @vdev_id: vdev id |
| 1166 | * @chanfreq: channel frequency |
| 1167 | * |
| 1168 | * Return: none |
| 1169 | */ |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1170 | void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 1171 | void *header, uint32_t vdev_id, uint32_t chanfreq) |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 1172 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 1173 | |
| 1174 | uint32_t data[CUSTOM_MGMT_CMD_DATA_SIZE]; |
| 1175 | |
| 1176 | data[0] = ((struct wmi_command_header *)header)->type; |
| 1177 | data[1] = ((struct wmi_command_header *)header)->sub_type; |
| 1178 | data[2] = vdev_id; |
| 1179 | data[3] = chanfreq; |
| 1180 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 1181 | qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 1182 | |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 1183 | WMI_MGMT_COMMAND_RECORD(wmi_handle, cmd, data); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 1184 | |
| 1185 | qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 1186 | } |
Rajeev Kumar | ae91c40 | 2016-05-25 16:07:23 -0700 | [diff] [blame] | 1187 | #else |
| 1188 | /** |
| 1189 | * wmi_debugfs_remove() - Remove debugfs entry for wmi logging. |
| 1190 | * @wmi_handle: wmi handle |
| 1191 | * @dentry: debugfs directory entry |
| 1192 | * @id: Index to debug info data array |
| 1193 | * |
| 1194 | * Return: none |
| 1195 | */ |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 1196 | static void wmi_debugfs_remove(wmi_unified_t wmi_handle) { } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1197 | void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 1198 | void *header, uint32_t vdev_id, uint32_t chanfreq) { } |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 1199 | static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle) { } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1200 | #endif /*WMI_INTERFACE_EVENT_LOGGING */ |
| 1201 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1202 | int wmi_get_host_credits(wmi_unified_t wmi_handle); |
| 1203 | /* WMI buffer APIs */ |
| 1204 | |
| 1205 | #ifdef MEMORY_DEBUG |
| 1206 | wmi_buf_t |
| 1207 | wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint16_t len, uint8_t *file_name, |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1208 | uint32_t line_num) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1209 | { |
| 1210 | wmi_buf_t wmi_buf; |
| 1211 | |
| 1212 | if (roundup(len + WMI_MIN_HEAD_ROOM, 4) > wmi_handle->max_msg_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1213 | QDF_ASSERT(0); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1214 | return NULL; |
| 1215 | } |
| 1216 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1217 | wmi_buf = qdf_nbuf_alloc_debug(NULL, |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1218 | roundup(len + WMI_MIN_HEAD_ROOM, 4), |
| 1219 | WMI_MIN_HEAD_ROOM, 4, false, file_name, |
| 1220 | line_num); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1221 | |
| 1222 | if (!wmi_buf) |
| 1223 | return NULL; |
| 1224 | |
| 1225 | /* Clear the wmi buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1226 | OS_MEMZERO(qdf_nbuf_data(wmi_buf), len); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1227 | |
| 1228 | /* |
| 1229 | * Set the length of the buffer to match the allocation size. |
| 1230 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1231 | qdf_nbuf_set_pktlen(wmi_buf, len); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1232 | |
| 1233 | return wmi_buf; |
| 1234 | } |
| 1235 | |
| 1236 | void wmi_buf_free(wmi_buf_t net_buf) |
| 1237 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1238 | qdf_nbuf_free(net_buf); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1239 | } |
| 1240 | #else |
| 1241 | wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint16_t len) |
| 1242 | { |
| 1243 | wmi_buf_t wmi_buf; |
| 1244 | |
| 1245 | if (roundup(len + WMI_MIN_HEAD_ROOM, 4) > wmi_handle->max_msg_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1246 | QDF_ASSERT(0); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1247 | return NULL; |
| 1248 | } |
| 1249 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1250 | wmi_buf = qdf_nbuf_alloc(NULL, roundup(len + WMI_MIN_HEAD_ROOM, 4), |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1251 | WMI_MIN_HEAD_ROOM, 4, false); |
| 1252 | if (!wmi_buf) |
| 1253 | return NULL; |
| 1254 | |
| 1255 | /* Clear the wmi buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1256 | OS_MEMZERO(qdf_nbuf_data(wmi_buf), len); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1257 | |
| 1258 | /* |
| 1259 | * Set the length of the buffer to match the allocation size. |
| 1260 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1261 | qdf_nbuf_set_pktlen(wmi_buf, len); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1262 | return wmi_buf; |
| 1263 | } |
| 1264 | |
| 1265 | void wmi_buf_free(wmi_buf_t net_buf) |
| 1266 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1267 | qdf_nbuf_free(net_buf); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1268 | } |
| 1269 | #endif |
| 1270 | |
| 1271 | /** |
| 1272 | * wmi_get_max_msg_len() - get maximum WMI message length |
| 1273 | * @wmi_handle: WMI handle. |
| 1274 | * |
| 1275 | * This function returns the maximum WMI message length |
| 1276 | * |
| 1277 | * Return: maximum WMI message length |
| 1278 | */ |
| 1279 | uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle) |
| 1280 | { |
| 1281 | return wmi_handle->max_msg_len - WMI_MIN_HEAD_ROOM; |
| 1282 | } |
| 1283 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1284 | #ifdef CONFIG_MCL |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1285 | static uint8_t *wmi_id_to_name(uint32_t wmi_command) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1286 | { |
| 1287 | switch (wmi_command) { |
| 1288 | /* initialize the wlan sub system */ |
| 1289 | CASE_RETURN_STRING(WMI_INIT_CMDID); |
| 1290 | |
| 1291 | /* Scan specific commands */ |
| 1292 | |
| 1293 | /* start scan request to FW */ |
| 1294 | CASE_RETURN_STRING(WMI_START_SCAN_CMDID); |
| 1295 | /* stop scan request to FW */ |
| 1296 | CASE_RETURN_STRING(WMI_STOP_SCAN_CMDID); |
| 1297 | /* full list of channels as defined by the regulatory |
| 1298 | * that will be used by scanner */ |
| 1299 | CASE_RETURN_STRING(WMI_SCAN_CHAN_LIST_CMDID); |
| 1300 | /* overwrite default priority table in scan scheduler */ |
| 1301 | CASE_RETURN_STRING(WMI_SCAN_SCH_PRIO_TBL_CMDID); |
| 1302 | /* This command to adjust the priority and min.max_rest_time |
| 1303 | * of an on ongoing scan request. |
| 1304 | */ |
| 1305 | CASE_RETURN_STRING(WMI_SCAN_UPDATE_REQUEST_CMDID); |
| 1306 | |
| 1307 | /* PDEV(physical device) specific commands */ |
| 1308 | /* set regulatorty ctl id used by FW to determine the exact |
| 1309 | * ctl power limits */ |
| 1310 | CASE_RETURN_STRING(WMI_PDEV_SET_REGDOMAIN_CMDID); |
| 1311 | /* set channel. mainly used for supporting monitor mode */ |
| 1312 | CASE_RETURN_STRING(WMI_PDEV_SET_CHANNEL_CMDID); |
| 1313 | /* set pdev specific parameters */ |
| 1314 | CASE_RETURN_STRING(WMI_PDEV_SET_PARAM_CMDID); |
| 1315 | /* enable packet log */ |
| 1316 | CASE_RETURN_STRING(WMI_PDEV_PKTLOG_ENABLE_CMDID); |
| 1317 | /* disable packet log*/ |
| 1318 | CASE_RETURN_STRING(WMI_PDEV_PKTLOG_DISABLE_CMDID); |
| 1319 | /* set wmm parameters */ |
| 1320 | CASE_RETURN_STRING(WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 1321 | /* set HT cap ie that needs to be carried probe requests |
| 1322 | * HT/VHT channels */ |
| 1323 | CASE_RETURN_STRING(WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 1324 | /* set VHT cap ie that needs to be carried on probe |
| 1325 | * requests on VHT channels */ |
| 1326 | CASE_RETURN_STRING(WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 1327 | |
| 1328 | /* Command to send the DSCP-to-TID map to the target */ |
| 1329 | CASE_RETURN_STRING(WMI_PDEV_SET_DSCP_TID_MAP_CMDID); |
| 1330 | /* set quiet ie parameters. primarily used in AP mode */ |
| 1331 | CASE_RETURN_STRING(WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 1332 | /* Enable/Disable Green AP Power Save */ |
| 1333 | CASE_RETURN_STRING(WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID); |
| 1334 | /* get TPC config for the current operating channel */ |
| 1335 | CASE_RETURN_STRING(WMI_PDEV_GET_TPC_CONFIG_CMDID); |
| 1336 | |
| 1337 | /* set the base MAC address for the physical device before |
| 1338 | * a VDEV is created. For firmware that does not support |
| 1339 | * this feature and this command, the pdev MAC address will |
| 1340 | * not be changed. */ |
| 1341 | CASE_RETURN_STRING(WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 1342 | |
| 1343 | /* eeprom content dump , the same to bdboard data */ |
| 1344 | CASE_RETURN_STRING(WMI_PDEV_DUMP_CMDID); |
| 1345 | |
| 1346 | /* VDEV(virtual device) specific commands */ |
| 1347 | /* vdev create */ |
| 1348 | CASE_RETURN_STRING(WMI_VDEV_CREATE_CMDID); |
| 1349 | /* vdev delete */ |
| 1350 | CASE_RETURN_STRING(WMI_VDEV_DELETE_CMDID); |
| 1351 | /* vdev start request */ |
| 1352 | CASE_RETURN_STRING(WMI_VDEV_START_REQUEST_CMDID); |
| 1353 | /* vdev restart request (RX only, NO TX, used for CAC period)*/ |
| 1354 | CASE_RETURN_STRING(WMI_VDEV_RESTART_REQUEST_CMDID); |
| 1355 | /* vdev up request */ |
| 1356 | CASE_RETURN_STRING(WMI_VDEV_UP_CMDID); |
| 1357 | /* vdev stop request */ |
| 1358 | CASE_RETURN_STRING(WMI_VDEV_STOP_CMDID); |
| 1359 | /* vdev down request */ |
| 1360 | CASE_RETURN_STRING(WMI_VDEV_DOWN_CMDID); |
| 1361 | /* set a vdev param */ |
| 1362 | CASE_RETURN_STRING(WMI_VDEV_SET_PARAM_CMDID); |
| 1363 | /* set a key (used for setting per peer unicast |
| 1364 | * and per vdev multicast) */ |
| 1365 | CASE_RETURN_STRING(WMI_VDEV_INSTALL_KEY_CMDID); |
| 1366 | |
| 1367 | /* wnm sleep mode command */ |
| 1368 | CASE_RETURN_STRING(WMI_VDEV_WNM_SLEEPMODE_CMDID); |
| 1369 | CASE_RETURN_STRING(WMI_VDEV_WMM_ADDTS_CMDID); |
| 1370 | CASE_RETURN_STRING(WMI_VDEV_WMM_DELTS_CMDID); |
| 1371 | CASE_RETURN_STRING(WMI_VDEV_SET_WMM_PARAMS_CMDID); |
| 1372 | CASE_RETURN_STRING(WMI_VDEV_SET_GTX_PARAMS_CMDID); |
| 1373 | CASE_RETURN_STRING(WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID); |
| 1374 | |
| 1375 | CASE_RETURN_STRING(WMI_VDEV_PLMREQ_START_CMDID); |
| 1376 | CASE_RETURN_STRING(WMI_VDEV_PLMREQ_STOP_CMDID); |
| 1377 | CASE_RETURN_STRING(WMI_VDEV_TSF_TSTAMP_ACTION_CMDID); |
| 1378 | CASE_RETURN_STRING(WMI_VDEV_SET_IE_CMDID); |
| 1379 | |
| 1380 | /* peer specific commands */ |
| 1381 | |
| 1382 | /** create a peer */ |
| 1383 | CASE_RETURN_STRING(WMI_PEER_CREATE_CMDID); |
| 1384 | /** delete a peer */ |
| 1385 | CASE_RETURN_STRING(WMI_PEER_DELETE_CMDID); |
| 1386 | /** flush specific tid queues of a peer */ |
| 1387 | CASE_RETURN_STRING(WMI_PEER_FLUSH_TIDS_CMDID); |
| 1388 | /** set a parameter of a peer */ |
| 1389 | CASE_RETURN_STRING(WMI_PEER_SET_PARAM_CMDID); |
| 1390 | /* set peer to associated state. will cary all parameters |
| 1391 | * determined during assocication time */ |
| 1392 | CASE_RETURN_STRING(WMI_PEER_ASSOC_CMDID); |
| 1393 | /* add a wds (4 address ) entry. used only for testing |
| 1394 | * WDS feature on AP products */ |
| 1395 | CASE_RETURN_STRING(WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 1396 | /* remove wds (4 address ) entry. used only for testing WDS |
| 1397 | * feature on AP products */ |
| 1398 | CASE_RETURN_STRING(WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 1399 | /* set up mcast info for multicast to unicast conversion */ |
| 1400 | CASE_RETURN_STRING(WMI_PEER_MCAST_GROUP_CMDID); |
| 1401 | /* request peer info from FW to get PEER_INFO_EVENTID */ |
| 1402 | CASE_RETURN_STRING(WMI_PEER_INFO_REQ_CMDID); |
| 1403 | |
| 1404 | /* beacon/management specific commands */ |
| 1405 | |
| 1406 | /* transmit beacon by reference. used for transmitting beacon |
| 1407 | * on low latency interface like pcie */ |
| 1408 | CASE_RETURN_STRING(WMI_BCN_TX_CMDID); |
| 1409 | /* transmit beacon by value */ |
| 1410 | CASE_RETURN_STRING(WMI_PDEV_SEND_BCN_CMDID); |
| 1411 | /* set the beacon template. used in beacon offload mode to setup |
| 1412 | * the common beacon template with the FW to be used by FW to |
| 1413 | * generate beacons */ |
| 1414 | CASE_RETURN_STRING(WMI_BCN_TMPL_CMDID); |
| 1415 | /* set beacon filter with FW */ |
| 1416 | CASE_RETURN_STRING(WMI_BCN_FILTER_RX_CMDID); |
| 1417 | /* enable/disable filtering of probe requests in the firmware */ |
| 1418 | CASE_RETURN_STRING(WMI_PRB_REQ_FILTER_RX_CMDID); |
| 1419 | /* transmit management frame by value. will be deprecated */ |
| 1420 | CASE_RETURN_STRING(WMI_MGMT_TX_CMDID); |
| 1421 | /* set the probe response template. used in beacon offload mode |
| 1422 | * to setup the common probe response template with the FW to |
| 1423 | * be used by FW to generate probe responses */ |
| 1424 | CASE_RETURN_STRING(WMI_PRB_TMPL_CMDID); |
| 1425 | |
| 1426 | /* commands to directly control ba negotiation directly from |
| 1427 | * host. only used in test mode */ |
| 1428 | |
| 1429 | /* turn off FW Auto addba mode and let host control addba */ |
| 1430 | CASE_RETURN_STRING(WMI_ADDBA_CLEAR_RESP_CMDID); |
| 1431 | /* send add ba request */ |
| 1432 | CASE_RETURN_STRING(WMI_ADDBA_SEND_CMDID); |
| 1433 | CASE_RETURN_STRING(WMI_ADDBA_STATUS_CMDID); |
| 1434 | /* send del ba */ |
| 1435 | CASE_RETURN_STRING(WMI_DELBA_SEND_CMDID); |
| 1436 | /* set add ba response will be used by FW to generate |
| 1437 | * addba response*/ |
| 1438 | CASE_RETURN_STRING(WMI_ADDBA_SET_RESP_CMDID); |
| 1439 | /* send single VHT MPDU with AMSDU */ |
| 1440 | CASE_RETURN_STRING(WMI_SEND_SINGLEAMSDU_CMDID); |
| 1441 | |
| 1442 | /* Station power save specific config */ |
| 1443 | /* enable/disable station powersave */ |
| 1444 | CASE_RETURN_STRING(WMI_STA_POWERSAVE_MODE_CMDID); |
| 1445 | /* set station power save specific parameter */ |
| 1446 | CASE_RETURN_STRING(WMI_STA_POWERSAVE_PARAM_CMDID); |
| 1447 | /* set station mimo powersave mode */ |
| 1448 | CASE_RETURN_STRING(WMI_STA_MIMO_PS_MODE_CMDID); |
| 1449 | |
| 1450 | /* DFS-specific commands */ |
| 1451 | /* enable DFS (radar detection)*/ |
| 1452 | CASE_RETURN_STRING(WMI_PDEV_DFS_ENABLE_CMDID); |
| 1453 | /* disable DFS (radar detection)*/ |
| 1454 | CASE_RETURN_STRING(WMI_PDEV_DFS_DISABLE_CMDID); |
| 1455 | /* enable DFS phyerr/parse filter offload */ |
| 1456 | CASE_RETURN_STRING(WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 1457 | /* enable DFS phyerr/parse filter offload */ |
| 1458 | CASE_RETURN_STRING(WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
| 1459 | |
| 1460 | /* Roaming specific commands */ |
| 1461 | /* set roam scan mode */ |
| 1462 | CASE_RETURN_STRING(WMI_ROAM_SCAN_MODE); |
| 1463 | /* set roam scan rssi threshold below which roam |
| 1464 | * scan is enabled */ |
| 1465 | CASE_RETURN_STRING(WMI_ROAM_SCAN_RSSI_THRESHOLD); |
| 1466 | /* set roam scan period for periodic roam scan mode */ |
| 1467 | CASE_RETURN_STRING(WMI_ROAM_SCAN_PERIOD); |
| 1468 | /* set roam scan trigger rssi change threshold */ |
| 1469 | CASE_RETURN_STRING(WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
| 1470 | /* set roam AP profile */ |
| 1471 | CASE_RETURN_STRING(WMI_ROAM_AP_PROFILE); |
| 1472 | /* set channel list for roam scans */ |
| 1473 | CASE_RETURN_STRING(WMI_ROAM_CHAN_LIST); |
| 1474 | /* offload scan specific commands */ |
| 1475 | /* set offload scan AP profile */ |
| 1476 | CASE_RETURN_STRING(WMI_OFL_SCAN_ADD_AP_PROFILE); |
| 1477 | /* remove offload scan AP profile */ |
| 1478 | CASE_RETURN_STRING(WMI_OFL_SCAN_REMOVE_AP_PROFILE); |
| 1479 | /* set offload scan period */ |
| 1480 | CASE_RETURN_STRING(WMI_OFL_SCAN_PERIOD); |
| 1481 | |
| 1482 | /* P2P specific commands */ |
| 1483 | /* set P2P device info. FW will used by FW to create P2P IE |
| 1484 | * to be carried in probe response generated during p2p listen |
| 1485 | * and for p2p discoverability */ |
| 1486 | CASE_RETURN_STRING(WMI_P2P_DEV_SET_DEVICE_INFO); |
| 1487 | /* enable/disable p2p discoverability on STA/AP VDEVs */ |
| 1488 | CASE_RETURN_STRING(WMI_P2P_DEV_SET_DISCOVERABILITY); |
| 1489 | /* set p2p ie to be carried in beacons generated by FW for GO */ |
| 1490 | CASE_RETURN_STRING(WMI_P2P_GO_SET_BEACON_IE); |
| 1491 | /* set p2p ie to be carried in probe response frames generated |
| 1492 | * by FW for GO */ |
| 1493 | CASE_RETURN_STRING(WMI_P2P_GO_SET_PROBE_RESP_IE); |
| 1494 | /* set the vendor specific p2p ie data. |
| 1495 | * FW will use this to parse the P2P NoA |
| 1496 | * attribute in the beacons/probe responses received. |
| 1497 | */ |
| 1498 | CASE_RETURN_STRING(WMI_P2P_SET_VENDOR_IE_DATA_CMDID); |
| 1499 | /* set the configure of p2p find offload */ |
| 1500 | CASE_RETURN_STRING(WMI_P2P_DISC_OFFLOAD_CONFIG_CMDID); |
| 1501 | /* set the vendor specific p2p ie data for p2p find offload */ |
| 1502 | CASE_RETURN_STRING(WMI_P2P_DISC_OFFLOAD_APPIE_CMDID); |
| 1503 | /* set the BSSID/device name pattern of p2p find offload */ |
| 1504 | CASE_RETURN_STRING(WMI_P2P_DISC_OFFLOAD_PATTERN_CMDID); |
| 1505 | /* set OppPS related parameters **/ |
| 1506 | CASE_RETURN_STRING(WMI_P2P_SET_OPPPS_PARAM_CMDID); |
| 1507 | |
| 1508 | /* AP power save specific config |
| 1509 | * set AP power save specific param */ |
| 1510 | CASE_RETURN_STRING(WMI_AP_PS_PEER_PARAM_CMDID); |
| 1511 | /* set AP UAPSD coex pecific param */ |
| 1512 | CASE_RETURN_STRING(WMI_AP_PS_PEER_UAPSD_COEX_CMDID); |
| 1513 | |
| 1514 | /* Rate-control specific commands */ |
| 1515 | CASE_RETURN_STRING(WMI_PEER_RATE_RETRY_SCHED_CMDID); |
| 1516 | |
| 1517 | /* WLAN Profiling commands. */ |
| 1518 | CASE_RETURN_STRING(WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 1519 | CASE_RETURN_STRING(WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 1520 | CASE_RETURN_STRING(WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 1521 | CASE_RETURN_STRING(WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 1522 | CASE_RETURN_STRING(WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID); |
| 1523 | |
| 1524 | /* Suspend resume command Ids */ |
| 1525 | CASE_RETURN_STRING(WMI_PDEV_SUSPEND_CMDID); |
| 1526 | CASE_RETURN_STRING(WMI_PDEV_RESUME_CMDID); |
| 1527 | |
| 1528 | /* Beacon filter commands */ |
| 1529 | /* add a beacon filter */ |
| 1530 | CASE_RETURN_STRING(WMI_ADD_BCN_FILTER_CMDID); |
| 1531 | /* remove a beacon filter */ |
| 1532 | CASE_RETURN_STRING(WMI_RMV_BCN_FILTER_CMDID); |
| 1533 | |
| 1534 | /* WOW Specific WMI commands */ |
| 1535 | /* add pattern for awake */ |
| 1536 | CASE_RETURN_STRING(WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 1537 | /* deleta a wake pattern */ |
| 1538 | CASE_RETURN_STRING(WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 1539 | /* enable/deisable wake event */ |
| 1540 | CASE_RETURN_STRING(WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 1541 | /* enable WOW */ |
| 1542 | CASE_RETURN_STRING(WMI_WOW_ENABLE_CMDID); |
| 1543 | /* host woke up from sleep event to FW. Generated in response |
| 1544 | * to WOW Hardware event */ |
| 1545 | CASE_RETURN_STRING(WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 1546 | |
| 1547 | /* RTT measurement related cmd */ |
| 1548 | /* reques to make an RTT measurement */ |
| 1549 | CASE_RETURN_STRING(WMI_RTT_MEASREQ_CMDID); |
| 1550 | /* reques to report a tsf measurement */ |
| 1551 | CASE_RETURN_STRING(WMI_RTT_TSF_CMDID); |
| 1552 | |
| 1553 | /* spectral scan command */ |
| 1554 | /* configure spectral scan */ |
| 1555 | CASE_RETURN_STRING(WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 1556 | /* enable/disable spectral scan and trigger */ |
| 1557 | CASE_RETURN_STRING(WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 1558 | |
| 1559 | /* F/W stats */ |
| 1560 | /* one time request for stats */ |
| 1561 | CASE_RETURN_STRING(WMI_REQUEST_STATS_CMDID); |
| 1562 | /* Push MCC Adaptive Scheduler Stats to Firmware */ |
| 1563 | CASE_RETURN_STRING(WMI_MCC_SCHED_TRAFFIC_STATS_CMDID); |
| 1564 | |
| 1565 | /* ARP OFFLOAD REQUEST*/ |
| 1566 | CASE_RETURN_STRING(WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 1567 | |
| 1568 | /* Proactive ARP Response Add Pattern Command*/ |
| 1569 | CASE_RETURN_STRING(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID); |
| 1570 | |
| 1571 | /* Proactive ARP Response Del Pattern Command*/ |
| 1572 | CASE_RETURN_STRING(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID); |
| 1573 | |
| 1574 | /* NS offload confid*/ |
| 1575 | CASE_RETURN_STRING(WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 1576 | |
| 1577 | /* GTK offload Specific WMI commands */ |
| 1578 | CASE_RETURN_STRING(WMI_GTK_OFFLOAD_CMDID); |
| 1579 | |
| 1580 | /* CSA offload Specific WMI commands */ |
| 1581 | /* csa offload enable */ |
| 1582 | CASE_RETURN_STRING(WMI_CSA_OFFLOAD_ENABLE_CMDID); |
| 1583 | /* chan switch command */ |
| 1584 | CASE_RETURN_STRING(WMI_CSA_OFFLOAD_CHANSWITCH_CMDID); |
| 1585 | |
| 1586 | /* Chatter commands */ |
| 1587 | /* Change chatter mode of operation */ |
| 1588 | CASE_RETURN_STRING(WMI_CHATTER_SET_MODE_CMDID); |
| 1589 | /* chatter add coalescing filter command */ |
| 1590 | CASE_RETURN_STRING(WMI_CHATTER_ADD_COALESCING_FILTER_CMDID); |
| 1591 | /* chatter delete coalescing filter command */ |
| 1592 | CASE_RETURN_STRING(WMI_CHATTER_DELETE_COALESCING_FILTER_CMDID); |
| 1593 | /* chatter coalecing query command */ |
| 1594 | CASE_RETURN_STRING(WMI_CHATTER_COALESCING_QUERY_CMDID); |
| 1595 | |
| 1596 | /* addba specific commands */ |
| 1597 | /* start the aggregation on this TID */ |
| 1598 | CASE_RETURN_STRING(WMI_PEER_TID_ADDBA_CMDID); |
| 1599 | /* stop the aggregation on this TID */ |
| 1600 | CASE_RETURN_STRING(WMI_PEER_TID_DELBA_CMDID); |
| 1601 | |
| 1602 | /* set station mimo powersave method */ |
| 1603 | CASE_RETURN_STRING(WMI_STA_DTIM_PS_METHOD_CMDID); |
| 1604 | /* Configure the Station UAPSD AC Auto Trigger Parameters */ |
| 1605 | CASE_RETURN_STRING(WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
| 1606 | /* Configure the Keep Alive Parameters */ |
| 1607 | CASE_RETURN_STRING(WMI_STA_KEEPALIVE_CMDID); |
| 1608 | |
| 1609 | /* Request ssn from target for a sta/tid pair */ |
| 1610 | CASE_RETURN_STRING(WMI_BA_REQ_SSN_CMDID); |
| 1611 | /* misc command group */ |
| 1612 | /* echo command mainly used for testing */ |
| 1613 | CASE_RETURN_STRING(WMI_ECHO_CMDID); |
| 1614 | |
| 1615 | /* !!IMPORTANT!! |
| 1616 | * If you need to add a new WMI command to the CASE_RETURN_STRING(WMI_GRP_MISC sub-group, |
| 1617 | * please make sure you add it BEHIND CASE_RETURN_STRING(WMI_PDEV_UTF_CMDID); |
| 1618 | * as we MUST have a fixed value here to maintain compatibility between |
| 1619 | * UTF and the ART2 driver |
| 1620 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1621 | /* UTF WMI commands */ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1622 | CASE_RETURN_STRING(WMI_PDEV_UTF_CMDID); |
| 1623 | |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1624 | /* set debug log config */ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1625 | CASE_RETURN_STRING(WMI_DBGLOG_CFG_CMDID); |
| 1626 | /* QVIT specific command id */ |
| 1627 | CASE_RETURN_STRING(WMI_PDEV_QVIT_CMDID); |
| 1628 | /* Factory Testing Mode request command |
| 1629 | * used for integrated chipsets */ |
| 1630 | CASE_RETURN_STRING(WMI_PDEV_FTM_INTG_CMDID); |
| 1631 | /* set and get keepalive parameters command */ |
| 1632 | CASE_RETURN_STRING(WMI_VDEV_SET_KEEPALIVE_CMDID); |
| 1633 | CASE_RETURN_STRING(WMI_VDEV_GET_KEEPALIVE_CMDID); |
| 1634 | /* For fw recovery test command */ |
| 1635 | CASE_RETURN_STRING(WMI_FORCE_FW_HANG_CMDID); |
| 1636 | /* Set Mcast/Bdcast filter */ |
| 1637 | CASE_RETURN_STRING(WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 1638 | /* set thermal management params */ |
| 1639 | CASE_RETURN_STRING(WMI_THERMAL_MGMT_CMDID); |
| 1640 | CASE_RETURN_STRING(WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
| 1641 | CASE_RETURN_STRING(WMI_LRO_CONFIG_CMDID); |
| 1642 | CASE_RETURN_STRING(WMI_TRANSFER_DATA_TO_FLASH_CMDID); |
Sreelakshmi Konamki | 57a2c04 | 2016-04-14 18:04:17 +0530 | [diff] [blame] | 1643 | CASE_RETURN_STRING(WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
Anurag Chouhan | 2568939 | 2016-04-18 17:10:41 +0530 | [diff] [blame] | 1644 | CASE_RETURN_STRING(WMI_VDEV_WISA_CMDID); |
Anurag Chouhan | 7dd6554 | 2016-04-18 17:27:12 +0530 | [diff] [blame] | 1645 | CASE_RETURN_STRING(WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
Anurag Chouhan | b4a65bc | 2016-04-21 16:26:34 +0530 | [diff] [blame] | 1646 | CASE_RETURN_STRING(WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1647 | CASE_RETURN_STRING(WMI_MAWC_SENSOR_REPORT_IND_CMDID); |
| 1648 | CASE_RETURN_STRING(WMI_ROAM_CONFIGURE_MAWC_CMDID); |
| 1649 | CASE_RETURN_STRING(WMI_NLO_CONFIGURE_MAWC_CMDID); |
| 1650 | CASE_RETURN_STRING(WMI_EXTSCAN_CONFIGURE_MAWC_CMDID); |
| 1651 | /* GPIO Configuration */ |
| 1652 | CASE_RETURN_STRING(WMI_GPIO_CONFIG_CMDID); |
| 1653 | CASE_RETURN_STRING(WMI_GPIO_OUTPUT_CMDID); |
| 1654 | |
| 1655 | /* Txbf configuration command */ |
| 1656 | CASE_RETURN_STRING(WMI_TXBF_CMDID); |
| 1657 | |
| 1658 | /* FWTEST Commands */ |
| 1659 | CASE_RETURN_STRING(WMI_FWTEST_VDEV_MCC_SET_TBTT_MODE_CMDID); |
| 1660 | /* set NoA descs */ |
| 1661 | CASE_RETURN_STRING(WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
| 1662 | |
| 1663 | /* TDLS Configuration */ |
| 1664 | /* enable/disable TDLS */ |
| 1665 | CASE_RETURN_STRING(WMI_TDLS_SET_STATE_CMDID); |
| 1666 | /* set tdls peer state */ |
| 1667 | CASE_RETURN_STRING(WMI_TDLS_PEER_UPDATE_CMDID); |
| 1668 | |
| 1669 | /* Resmgr Configuration */ |
| 1670 | /* Adaptive OCS is enabled by default in the FW. |
| 1671 | * This command is used to disable FW based adaptive OCS. |
| 1672 | */ |
| 1673 | CASE_RETURN_STRING |
| 1674 | (WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
| 1675 | /* set the requested channel time quota for the home channels */ |
| 1676 | CASE_RETURN_STRING(WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
| 1677 | /* set the requested latency for the home channels */ |
| 1678 | CASE_RETURN_STRING(WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
| 1679 | |
| 1680 | /* STA SMPS Configuration */ |
| 1681 | /* force SMPS mode */ |
| 1682 | CASE_RETURN_STRING(WMI_STA_SMPS_FORCE_MODE_CMDID); |
| 1683 | /* set SMPS parameters */ |
| 1684 | CASE_RETURN_STRING(WMI_STA_SMPS_PARAM_CMDID); |
| 1685 | |
| 1686 | /* Wlan HB commands */ |
| 1687 | /* enalbe/disable wlan HB */ |
| 1688 | CASE_RETURN_STRING(WMI_HB_SET_ENABLE_CMDID); |
| 1689 | /* set tcp parameters for wlan HB */ |
| 1690 | CASE_RETURN_STRING(WMI_HB_SET_TCP_PARAMS_CMDID); |
| 1691 | /* set tcp pkt filter for wlan HB */ |
| 1692 | CASE_RETURN_STRING(WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 1693 | /* set udp parameters for wlan HB */ |
| 1694 | CASE_RETURN_STRING(WMI_HB_SET_UDP_PARAMS_CMDID); |
| 1695 | /* set udp pkt filter for wlan HB */ |
| 1696 | CASE_RETURN_STRING(WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 1697 | |
| 1698 | /* Wlan RMC commands*/ |
| 1699 | /* enable/disable RMC */ |
| 1700 | CASE_RETURN_STRING(WMI_RMC_SET_MODE_CMDID); |
| 1701 | /* configure action frame period */ |
| 1702 | CASE_RETURN_STRING(WMI_RMC_SET_ACTION_PERIOD_CMDID); |
| 1703 | /* For debug/future enhancement purposes only, |
| 1704 | * configures/finetunes RMC algorithms */ |
| 1705 | CASE_RETURN_STRING(WMI_RMC_CONFIG_CMDID); |
| 1706 | |
| 1707 | /* WLAN MHF offload commands */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1708 | /* enable/disable MHF offload */ |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1709 | CASE_RETURN_STRING(WMI_MHF_OFFLOAD_SET_MODE_CMDID); |
| 1710 | /* Plumb routing table for MHF offload */ |
| 1711 | CASE_RETURN_STRING(WMI_MHF_OFFLOAD_PLUMB_ROUTING_TBL_CMDID); |
| 1712 | |
| 1713 | /* location scan commands */ |
| 1714 | /* start batch scan */ |
| 1715 | CASE_RETURN_STRING(WMI_BATCH_SCAN_ENABLE_CMDID); |
| 1716 | /* stop batch scan */ |
| 1717 | CASE_RETURN_STRING(WMI_BATCH_SCAN_DISABLE_CMDID); |
| 1718 | /* get batch scan result */ |
| 1719 | CASE_RETURN_STRING(WMI_BATCH_SCAN_TRIGGER_RESULT_CMDID); |
| 1720 | /* OEM related cmd */ |
| 1721 | CASE_RETURN_STRING(WMI_OEM_REQ_CMDID); |
| 1722 | CASE_RETURN_STRING(WMI_OEM_REQUEST_CMDID); |
| 1723 | /* NAN request cmd */ |
| 1724 | CASE_RETURN_STRING(WMI_NAN_CMDID); |
| 1725 | /* Modem power state cmd */ |
| 1726 | CASE_RETURN_STRING(WMI_MODEM_POWER_STATE_CMDID); |
| 1727 | CASE_RETURN_STRING(WMI_REQUEST_STATS_EXT_CMDID); |
| 1728 | CASE_RETURN_STRING(WMI_OBSS_SCAN_ENABLE_CMDID); |
| 1729 | CASE_RETURN_STRING(WMI_OBSS_SCAN_DISABLE_CMDID); |
| 1730 | CASE_RETURN_STRING(WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID); |
| 1731 | CASE_RETURN_STRING(WMI_ROAM_SCAN_CMD); |
| 1732 | CASE_RETURN_STRING(WMI_PDEV_SET_LED_CONFIG_CMDID); |
| 1733 | CASE_RETURN_STRING(WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
| 1734 | CASE_RETURN_STRING(WMI_CHAN_AVOID_UPDATE_CMDID); |
Sreelakshmi Konamki | 084f3d3 | 2016-04-14 17:46:26 +0530 | [diff] [blame] | 1735 | CASE_RETURN_STRING(WMI_COEX_CONFIG_CMDID); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1736 | CASE_RETURN_STRING(WMI_WOW_IOAC_ADD_KEEPALIVE_CMDID); |
| 1737 | CASE_RETURN_STRING(WMI_WOW_IOAC_DEL_KEEPALIVE_CMDID); |
| 1738 | CASE_RETURN_STRING(WMI_WOW_IOAC_ADD_WAKE_PATTERN_CMDID); |
| 1739 | CASE_RETURN_STRING(WMI_WOW_IOAC_DEL_WAKE_PATTERN_CMDID); |
| 1740 | CASE_RETURN_STRING(WMI_REQUEST_LINK_STATS_CMDID); |
| 1741 | CASE_RETURN_STRING(WMI_START_LINK_STATS_CMDID); |
| 1742 | CASE_RETURN_STRING(WMI_CLEAR_LINK_STATS_CMDID); |
| 1743 | CASE_RETURN_STRING(WMI_GET_FW_MEM_DUMP_CMDID); |
| 1744 | CASE_RETURN_STRING(WMI_LPI_MGMT_SNOOPING_CONFIG_CMDID); |
| 1745 | CASE_RETURN_STRING(WMI_LPI_START_SCAN_CMDID); |
| 1746 | CASE_RETURN_STRING(WMI_LPI_STOP_SCAN_CMDID); |
| 1747 | CASE_RETURN_STRING(WMI_EXTSCAN_START_CMDID); |
| 1748 | CASE_RETURN_STRING(WMI_EXTSCAN_STOP_CMDID); |
| 1749 | CASE_RETURN_STRING |
| 1750 | (WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID); |
| 1751 | CASE_RETURN_STRING(WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID); |
| 1752 | CASE_RETURN_STRING(WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID); |
| 1753 | CASE_RETURN_STRING(WMI_EXTSCAN_GET_WLAN_CHANGE_RESULTS_CMDID); |
| 1754 | CASE_RETURN_STRING(WMI_EXTSCAN_SET_CAPABILITIES_CMDID); |
| 1755 | CASE_RETURN_STRING(WMI_EXTSCAN_GET_CAPABILITIES_CMDID); |
| 1756 | CASE_RETURN_STRING(WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID); |
| 1757 | CASE_RETURN_STRING(WMI_ROAM_SYNCH_COMPLETE); |
| 1758 | CASE_RETURN_STRING(WMI_D0_WOW_ENABLE_DISABLE_CMDID); |
| 1759 | CASE_RETURN_STRING(WMI_EXTWOW_ENABLE_CMDID); |
| 1760 | CASE_RETURN_STRING(WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 1761 | CASE_RETURN_STRING(WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 1762 | CASE_RETURN_STRING(WMI_UNIT_TEST_CMDID); |
| 1763 | CASE_RETURN_STRING(WMI_ROAM_SET_RIC_REQUEST_CMDID); |
| 1764 | CASE_RETURN_STRING(WMI_PDEV_GET_TEMPERATURE_CMDID); |
| 1765 | CASE_RETURN_STRING(WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
| 1766 | CASE_RETURN_STRING(WMI_TPC_CHAINMASK_CONFIG_CMDID); |
| 1767 | CASE_RETURN_STRING(WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID); |
| 1768 | CASE_RETURN_STRING(WMI_SCAN_PROB_REQ_OUI_CMDID); |
| 1769 | CASE_RETURN_STRING(WMI_TDLS_SET_OFFCHAN_MODE_CMDID); |
| 1770 | CASE_RETURN_STRING(WMI_PDEV_SET_LED_FLASHING_CMDID); |
| 1771 | CASE_RETURN_STRING(WMI_MDNS_OFFLOAD_ENABLE_CMDID); |
| 1772 | CASE_RETURN_STRING(WMI_MDNS_SET_FQDN_CMDID); |
| 1773 | CASE_RETURN_STRING(WMI_MDNS_SET_RESPONSE_CMDID); |
| 1774 | CASE_RETURN_STRING(WMI_MDNS_GET_STATS_CMDID); |
| 1775 | CASE_RETURN_STRING(WMI_ROAM_INVOKE_CMDID); |
| 1776 | CASE_RETURN_STRING(WMI_SET_ANTENNA_DIVERSITY_CMDID); |
| 1777 | CASE_RETURN_STRING(WMI_SAP_OFL_ENABLE_CMDID); |
| 1778 | CASE_RETURN_STRING(WMI_APFIND_CMDID); |
| 1779 | CASE_RETURN_STRING(WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 1780 | CASE_RETURN_STRING(WMI_OCB_SET_SCHED_CMDID); |
| 1781 | CASE_RETURN_STRING(WMI_OCB_SET_CONFIG_CMDID); |
| 1782 | CASE_RETURN_STRING(WMI_OCB_SET_UTC_TIME_CMDID); |
| 1783 | CASE_RETURN_STRING(WMI_OCB_START_TIMING_ADVERT_CMDID); |
| 1784 | CASE_RETURN_STRING(WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
| 1785 | CASE_RETURN_STRING(WMI_OCB_GET_TSF_TIMER_CMDID); |
| 1786 | CASE_RETURN_STRING(WMI_DCC_GET_STATS_CMDID); |
| 1787 | CASE_RETURN_STRING(WMI_DCC_CLEAR_STATS_CMDID); |
| 1788 | CASE_RETURN_STRING(WMI_DCC_UPDATE_NDL_CMDID); |
| 1789 | CASE_RETURN_STRING(WMI_ROAM_FILTER_CMDID); |
| 1790 | CASE_RETURN_STRING(WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
| 1791 | CASE_RETURN_STRING(WMI_DEBUG_MESG_FLUSH_CMDID); |
| 1792 | CASE_RETURN_STRING(WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 1793 | CASE_RETURN_STRING(WMI_SOC_SET_PCL_CMDID); |
| 1794 | CASE_RETURN_STRING(WMI_SOC_SET_HW_MODE_CMDID); |
| 1795 | CASE_RETURN_STRING(WMI_SOC_SET_DUAL_MAC_CONFIG_CMDID); |
| 1796 | CASE_RETURN_STRING(WMI_WOW_ENABLE_ICMPV6_NA_FLT_CMDID); |
| 1797 | CASE_RETURN_STRING(WMI_DIAG_EVENT_LOG_CONFIG_CMDID); |
| 1798 | CASE_RETURN_STRING(WMI_PACKET_FILTER_CONFIG_CMDID); |
| 1799 | CASE_RETURN_STRING(WMI_PACKET_FILTER_ENABLE_CMDID); |
| 1800 | CASE_RETURN_STRING(WMI_SAP_SET_BLACKLIST_PARAM_CMDID); |
| 1801 | CASE_RETURN_STRING(WMI_WOW_UDP_SVC_OFLD_CMDID); |
| 1802 | CASE_RETURN_STRING(WMI_MGMT_TX_SEND_CMDID); |
| 1803 | CASE_RETURN_STRING(WMI_SOC_SET_ANTENNA_MODE_CMDID); |
| 1804 | CASE_RETURN_STRING(WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMDID); |
| 1805 | CASE_RETURN_STRING(WMI_AP_PS_EGAP_PARAM_CMDID); |
| 1806 | CASE_RETURN_STRING(WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID); |
| 1807 | CASE_RETURN_STRING(WMI_BPF_GET_CAPABILITY_CMDID); |
| 1808 | CASE_RETURN_STRING(WMI_BPF_GET_VDEV_STATS_CMDID); |
| 1809 | CASE_RETURN_STRING(WMI_BPF_SET_VDEV_INSTRUCTIONS_CMDID); |
| 1810 | CASE_RETURN_STRING(WMI_BPF_DEL_VDEV_INSTRUCTIONS_CMDID); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 1811 | CASE_RETURN_STRING(WMI_NDI_GET_CAP_REQ_CMDID); |
| 1812 | CASE_RETURN_STRING(WMI_NDP_INITIATOR_REQ_CMDID); |
| 1813 | CASE_RETURN_STRING(WMI_NDP_RESPONDER_REQ_CMDID); |
| 1814 | CASE_RETURN_STRING(WMI_NDP_END_REQ_CMDID); |
| 1815 | CASE_RETURN_STRING(WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 1816 | CASE_RETURN_STRING(WMI_PEER_ADD_PROXY_STA_ENTRY_CMDID); |
| 1817 | CASE_RETURN_STRING(WMI_PDEV_FIPS_CMDID); |
| 1818 | CASE_RETURN_STRING(WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 1819 | CASE_RETURN_STRING(WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 1820 | CASE_RETURN_STRING(WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID); |
| 1821 | CASE_RETURN_STRING(WMI_PDEV_SET_CTL_TABLE_CMDID); |
| 1822 | CASE_RETURN_STRING(WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID); |
| 1823 | CASE_RETURN_STRING(WMI_PDEV_GET_TPC_CMDID); |
| 1824 | CASE_RETURN_STRING(WMI_MIB_STATS_ENABLE_CMDID); |
| 1825 | CASE_RETURN_STRING(WMI_PDEV_GET_ANI_CCK_CONFIG_CMDID); |
| 1826 | CASE_RETURN_STRING(WMI_PDEV_GET_ANI_OFDM_CONFIG_CMDID); |
| 1827 | CASE_RETURN_STRING(WMI_VDEV_RATEMASK_CMDID); |
| 1828 | CASE_RETURN_STRING(WMI_VDEV_ATF_REQUEST_CMDID); |
| 1829 | CASE_RETURN_STRING(WMI_VDEV_SET_DSCP_TID_MAP_CMDID); |
| 1830 | CASE_RETURN_STRING(WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID); |
| 1831 | CASE_RETURN_STRING(WMI_VDEV_SET_QUIET_MODE_CMDID); |
| 1832 | CASE_RETURN_STRING(WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 1833 | CASE_RETURN_STRING(WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 1834 | CASE_RETURN_STRING(WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 1835 | CASE_RETURN_STRING(WMI_PEER_ATF_REQUEST_CMDID); |
| 1836 | CASE_RETURN_STRING(WMI_FWTEST_CMDID); |
| 1837 | CASE_RETURN_STRING(WMI_QBOOST_CFG_CMDID); |
| 1838 | CASE_RETURN_STRING(WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 1839 | CASE_RETURN_STRING(WMI_PDEV_SET_PCL_CMDID); |
| 1840 | CASE_RETURN_STRING(WMI_PDEV_SET_HW_MODE_CMDID); |
| 1841 | CASE_RETURN_STRING(WMI_PDEV_SET_MAC_CONFIG_CMDID); |
| 1842 | CASE_RETURN_STRING(WMI_PDEV_SET_ANTENNA_MODE_CMDID); |
| 1843 | CASE_RETURN_STRING(WMI_ROAM_SET_MBO_PARAM_CMDID); |
Naveen Rawat | 8cf610b | 2016-04-14 20:10:15 -0700 | [diff] [blame] | 1844 | CASE_RETURN_STRING(WMI_CHAN_AVOID_RPT_ALLOW_CMDID); |
Sandeep Puligilla | cc28f4e | 2016-04-16 13:35:09 +0530 | [diff] [blame] | 1845 | CASE_RETURN_STRING(WMI_SET_PERIODIC_CHANNEL_STATS_CONFIG_CMDID); |
Krishna Kumaar Natarajan | c285c10 | 2016-04-16 14:09:58 +0530 | [diff] [blame] | 1846 | CASE_RETURN_STRING(WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID); |
Krishna Kumaar Natarajan | 0d2a1bd | 2016-04-16 16:47:07 +0530 | [diff] [blame] | 1847 | CASE_RETURN_STRING(WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
Himanshu Agarwal | de99272 | 2016-05-13 20:31:57 +0530 | [diff] [blame] | 1848 | CASE_RETURN_STRING(WMI_PEER_BWF_REQUEST_CMDID); |
Himanshu Agarwal | dc8d1ae | 2016-05-13 21:04:17 +0530 | [diff] [blame] | 1849 | CASE_RETURN_STRING(WMI_DBGLOG_TIME_STAMP_SYNC_CMDID); |
Himanshu Agarwal | fc302f9 | 2016-05-30 21:06:16 +0530 | [diff] [blame] | 1850 | CASE_RETURN_STRING(WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 1851 | CASE_RETURN_STRING(WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
Pradeep Reddy POTTETI | 18f8fbb | 2016-06-13 17:59:38 +0530 | [diff] [blame] | 1852 | CASE_RETURN_STRING(WMI_PEER_REORDER_QUEUE_SETUP_CMDID); |
| 1853 | CASE_RETURN_STRING(WMI_PEER_REORDER_QUEUE_REMOVE_CMDID); |
Pradeep Reddy POTTETI | 4b997fd | 2016-06-20 13:25:31 +0530 | [diff] [blame] | 1854 | CASE_RETURN_STRING(WMI_SET_MULTIPLE_MCAST_FILTER_CMDID); |
Pradeep Reddy POTTETI | 10ca69d | 2016-06-20 14:50:42 +0530 | [diff] [blame] | 1855 | CASE_RETURN_STRING(WMI_READ_DATA_FROM_FLASH_CMDID); |
Nitesh Shah | 70e1104 | 2016-06-29 20:16:16 +0530 | [diff] [blame] | 1856 | CASE_RETURN_STRING(WMI_PDEV_SET_REORDER_TIMEOUT_VAL_CMDID); |
| 1857 | CASE_RETURN_STRING(WMI_PEER_SET_RX_BLOCKSIZE_CMDID); |
Nitesh Shah | c048265 | 2016-07-08 11:45:33 +0530 | [diff] [blame] | 1858 | CASE_RETURN_STRING(WMI_PDEV_SET_WAKEUP_CONFIG_CMDID); |
Nitesh Shah | 33b9540 | 2016-07-21 17:25:55 +0530 | [diff] [blame] | 1859 | CASE_RETURN_STRING(WMI_PDEV_GET_ANTDIV_STATUS_CMDID); |
| 1860 | CASE_RETURN_STRING(WMI_PEER_ANTDIV_INFO_REQ_CMDID); |
Anurag Chouhan | 40865b4 | 2016-08-01 14:01:54 +0530 | [diff] [blame] | 1861 | CASE_RETURN_STRING(WMI_MNT_FILTER_CMDID); |
Anurag Chouhan | 7f6f1d5 | 2016-08-04 18:46:29 +0530 | [diff] [blame] | 1862 | CASE_RETURN_STRING(WMI_PDEV_GET_CHIP_POWER_STATS_CMDID); |
Manjeet Singh | c026bde | 2016-09-01 16:42:29 +0530 | [diff] [blame] | 1863 | CASE_RETURN_STRING(WMI_COEX_GET_ANTENNA_ISOLATION_CMDID); |
Manjeet Singh | bea1671 | 2016-08-18 15:50:30 +0530 | [diff] [blame] | 1864 | CASE_RETURN_STRING(WMI_PDEV_SET_STATS_THRESHOLD_CMDID); |
| 1865 | CASE_RETURN_STRING(WMI_REQUEST_WLAN_STATS_CMDID); |
Himanshu Agarwal | 91c9d67 | 2016-09-14 20:43:24 +0530 | [diff] [blame] | 1866 | CASE_RETURN_STRING(WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
Sandeep Puligilla | abcd0f5 | 2016-11-03 12:38:45 -0700 | [diff] [blame] | 1867 | CASE_RETURN_STRING(WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 1868 | CASE_RETURN_STRING(WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 1869 | CASE_RETURN_STRING(WMI_VDEV_ADFS_CH_CFG_CMDID); |
| 1870 | CASE_RETURN_STRING(WMI_VDEV_ADFS_OCAC_ABORT_CMDID); |
Nishank Aggarwal | e6994d2 | 2016-11-08 13:34:12 +0530 | [diff] [blame] | 1871 | CASE_RETURN_STRING(WMI_SAR_LIMITS_CMDID); |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame^] | 1872 | CASE_RETURN_STRING(WMI_SET_CURRENT_COUNTRY_CMDID); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1873 | } |
| 1874 | |
| 1875 | return "Invalid WMI cmd"; |
| 1876 | } |
| 1877 | |
Sarada Prasanna Garnayak | f1cf0a6 | 2016-10-18 15:20:22 +0530 | [diff] [blame] | 1878 | static inline void wma_log_cmd_id(uint32_t cmd_id, uint32_t tag) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1879 | { |
Sarada Prasanna Garnayak | f1cf0a6 | 2016-10-18 15:20:22 +0530 | [diff] [blame] | 1880 | WMI_LOGD("Send WMI command:%s command_id:%d htc_tag:%d\n", |
| 1881 | wmi_id_to_name(cmd_id), cmd_id, tag); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1882 | } |
Houston Hoffman | 0a0b2d0 | 2016-06-08 20:00:03 -0700 | [diff] [blame] | 1883 | #else |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1884 | static uint8_t *wmi_id_to_name(uint32_t wmi_command) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1885 | { |
| 1886 | return "Invalid WMI cmd"; |
| 1887 | } |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1888 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1889 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1890 | #ifdef CONFIG_MCL |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1891 | /** |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1892 | * wmi_is_pm_resume_cmd() - check if a cmd is part of the resume sequence |
| 1893 | * @cmd_id: command to check |
| 1894 | * |
| 1895 | * Return: true if the command is part of the resume sequence. |
| 1896 | */ |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1897 | static bool wmi_is_pm_resume_cmd(uint32_t cmd_id) |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1898 | { |
| 1899 | switch (cmd_id) { |
| 1900 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 1901 | case WMI_PDEV_RESUME_CMDID: |
| 1902 | return true; |
| 1903 | |
| 1904 | default: |
| 1905 | return false; |
| 1906 | } |
| 1907 | } |
| 1908 | #else |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1909 | static bool wmi_is_pm_resume_cmd(uint32_t cmd_id) |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1910 | { |
| 1911 | return false; |
| 1912 | } |
| 1913 | #endif |
| 1914 | |
| 1915 | /** |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1916 | * wmi_unified_cmd_send() - WMI command API |
| 1917 | * @wmi_handle: handle to wmi |
| 1918 | * @buf: wmi buf |
| 1919 | * @len: wmi buffer length |
| 1920 | * @cmd_id: wmi command id |
| 1921 | * |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 1922 | * Note, it is NOT safe to access buf after calling this function! |
| 1923 | * |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1924 | * Return: 0 on success |
| 1925 | */ |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1926 | QDF_STATUS wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, |
| 1927 | uint32_t len, uint32_t cmd_id) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1928 | { |
| 1929 | HTC_PACKET *pkt; |
| 1930 | A_STATUS status; |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 1931 | uint16_t htc_tag = 0; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1932 | |
| 1933 | if (wmi_get_runtime_pm_inprogress(wmi_handle)) { |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 1934 | htc_tag = |
| 1935 | (A_UINT16)wmi_handle->ops->wmi_set_htc_tx_tag( |
| 1936 | wmi_handle, buf, cmd_id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1937 | } else if (qdf_atomic_read(&wmi_handle->is_target_suspended) && |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1938 | (!wmi_is_pm_resume_cmd(cmd_id))) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1939 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 1940 | "%s: Target is suspended", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1941 | QDF_ASSERT(0); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1942 | return QDF_STATUS_E_BUSY; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1943 | } |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1944 | if (wmi_handle->wmi_stopinprogress) { |
| 1945 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
| 1946 | "WMI stop in progress\n"); |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1947 | return QDF_STATUS_E_INVAL; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1948 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1949 | |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1950 | #ifndef WMI_NON_TLV_SUPPORT |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1951 | /* Do sanity check on the TLV parameter structure */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1952 | if (wmi_handle->target_type == WMI_TLV_TARGET) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1953 | void *buf_ptr = (void *)qdf_nbuf_data(buf); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1954 | |
| 1955 | if (wmitlv_check_command_tlv_params(NULL, buf_ptr, len, cmd_id) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 1956 | != 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1957 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 1958 | "\nERROR: %s: Invalid WMI Param Buffer for Cmd:%d", |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1959 | __func__, cmd_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1960 | return QDF_STATUS_E_INVAL; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1961 | } |
| 1962 | } |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1963 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1964 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1965 | if (qdf_nbuf_push_head(buf, sizeof(WMI_CMD_HDR)) == NULL) { |
| 1966 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 1967 | "%s, Failed to send cmd %x, no memory", |
| 1968 | __func__, cmd_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1969 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1970 | } |
| 1971 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1972 | WMI_SET_FIELD(qdf_nbuf_data(buf), WMI_CMD_HDR, COMMANDID, cmd_id); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1973 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1974 | qdf_atomic_inc(&wmi_handle->pending_cmds); |
| 1975 | if (qdf_atomic_read(&wmi_handle->pending_cmds) >= WMI_MAX_CMDS) { |
| 1976 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 1977 | "\n%s: hostcredits = %d", __func__, |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 1978 | wmi_get_host_credits(wmi_handle)); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1979 | htc_dump_counter_info(wmi_handle->htc_handle); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1980 | qdf_atomic_dec(&wmi_handle->pending_cmds); |
| 1981 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Mukul Sharma | 7da24ca | 2016-10-12 23:50:13 +0530 | [diff] [blame] | 1982 | "%s: MAX %d WMI Pending cmds reached.", __func__, |
| 1983 | WMI_MAX_CMDS); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1984 | QDF_BUG(0); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1985 | return QDF_STATUS_E_BUSY; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1986 | } |
| 1987 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1988 | pkt = qdf_mem_malloc(sizeof(*pkt)); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1989 | if (!pkt) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1990 | qdf_atomic_dec(&wmi_handle->pending_cmds); |
| 1991 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 1992 | "%s, Failed to alloc htc packet %x, no memory", |
| 1993 | __func__, cmd_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1994 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1995 | } |
| 1996 | |
| 1997 | SET_HTC_PACKET_INFO_TX(pkt, |
| 1998 | NULL, |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1999 | qdf_nbuf_data(buf), len + sizeof(WMI_CMD_HDR), |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2000 | wmi_handle->wmi_endpoint_id, htc_tag); |
| 2001 | |
| 2002 | SET_HTC_PACKET_NET_BUF_CONTEXT(pkt, buf); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2003 | #ifdef CONFIG_MCL |
Sarada Prasanna Garnayak | f1cf0a6 | 2016-10-18 15:20:22 +0530 | [diff] [blame] | 2004 | wma_log_cmd_id(cmd_id, htc_tag); |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2005 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2006 | |
| 2007 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2008 | if (wmi_handle->log_info.wmi_logging_enable) { |
| 2009 | qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 2010 | /*Record 16 bytes of WMI cmd data - |
| 2011 | * * exclude TLV and WMI headers */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2012 | if (wmi_handle->ops->is_management_record(cmd_id)) { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 2013 | WMI_MGMT_COMMAND_RECORD(wmi_handle, cmd_id, |
| 2014 | ((uint32_t *) qdf_nbuf_data(buf) + |
| 2015 | wmi_handle->log_info.buf_offset_command)); |
| 2016 | } else { |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2017 | WMI_COMMAND_RECORD(wmi_handle, cmd_id, |
| 2018 | ((uint32_t *) qdf_nbuf_data(buf) + |
| 2019 | wmi_handle->log_info.buf_offset_command)); |
| 2020 | } |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2021 | qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 2022 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2023 | #endif |
| 2024 | |
| 2025 | status = htc_send_pkt(wmi_handle->htc_handle, pkt); |
| 2026 | |
| 2027 | if (A_OK != status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2028 | qdf_atomic_dec(&wmi_handle->pending_cmds); |
| 2029 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2030 | "%s %d, htc_send_pkt failed", __func__, __LINE__); |
Houston Hoffman | 40805b8 | 2016-10-13 15:30:52 -0700 | [diff] [blame] | 2031 | qdf_mem_free(pkt); |
| 2032 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2033 | } |
| 2034 | if (status) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2035 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2036 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2037 | return QDF_STATUS_SUCCESS; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2038 | } |
| 2039 | |
| 2040 | /** |
| 2041 | * wmi_unified_get_event_handler_ix() - gives event handler's index |
| 2042 | * @wmi_handle: handle to wmi |
| 2043 | * @event_id: wmi event id |
| 2044 | * |
| 2045 | * Return: event handler's index |
| 2046 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 2047 | static int wmi_unified_get_event_handler_ix(wmi_unified_t wmi_handle, |
| 2048 | uint32_t event_id) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2049 | { |
| 2050 | uint32_t idx = 0; |
| 2051 | int32_t invalid_idx = -1; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2052 | struct wmi_soc *soc = wmi_handle->soc; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2053 | |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2054 | for (idx = 0; (idx < soc->max_event_idx && |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2055 | idx < WMI_UNIFIED_MAX_EVENT); ++idx) { |
| 2056 | if (wmi_handle->event_id[idx] == event_id && |
| 2057 | wmi_handle->event_handler[idx] != NULL) { |
| 2058 | return idx; |
| 2059 | } |
| 2060 | } |
| 2061 | |
| 2062 | return invalid_idx; |
| 2063 | } |
| 2064 | |
| 2065 | /** |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 2066 | * wmi_unified_register_event() - register wmi event handler |
| 2067 | * @wmi_handle: handle to wmi |
| 2068 | * @event_id: wmi event id |
| 2069 | * @handler_func: wmi event handler function |
| 2070 | * |
| 2071 | * Return: 0 on success |
| 2072 | */ |
| 2073 | int wmi_unified_register_event(wmi_unified_t wmi_handle, |
| 2074 | uint32_t event_id, |
| 2075 | wmi_unified_event_handler handler_func) |
| 2076 | { |
| 2077 | uint32_t idx = 0; |
| 2078 | uint32_t evt_id; |
| 2079 | struct wmi_soc *soc = wmi_handle->soc; |
| 2080 | |
| 2081 | if (event_id >= wmi_events_max || |
| 2082 | wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) { |
| 2083 | qdf_print("%s: Event id %d is unavailable\n", |
| 2084 | __func__, event_id); |
| 2085 | return QDF_STATUS_E_FAILURE; |
| 2086 | } |
| 2087 | evt_id = wmi_handle->wmi_events[event_id]; |
| 2088 | if (wmi_unified_get_event_handler_ix(wmi_handle, evt_id) != -1) { |
| 2089 | qdf_print("%s : event handler already registered 0x%x\n", |
| 2090 | __func__, evt_id); |
| 2091 | return QDF_STATUS_E_FAILURE; |
| 2092 | } |
| 2093 | if (soc->max_event_idx == WMI_UNIFIED_MAX_EVENT) { |
| 2094 | qdf_print("%s : no more event handlers 0x%x\n", |
| 2095 | __func__, evt_id); |
| 2096 | return QDF_STATUS_E_FAILURE; |
| 2097 | } |
| 2098 | idx = soc->max_event_idx; |
| 2099 | wmi_handle->event_handler[idx] = handler_func; |
| 2100 | wmi_handle->event_id[idx] = evt_id; |
| 2101 | qdf_spin_lock_bh(&soc->ctx_lock); |
| 2102 | wmi_handle->ctx[idx] = WMI_RX_UMAC_CTX; |
| 2103 | qdf_spin_unlock_bh(&soc->ctx_lock); |
| 2104 | soc->max_event_idx++; |
| 2105 | |
| 2106 | return 0; |
| 2107 | } |
| 2108 | |
| 2109 | /** |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2110 | * wmi_unified_register_event_handler() - register wmi event handler |
| 2111 | * @wmi_handle: handle to wmi |
| 2112 | * @event_id: wmi event id |
| 2113 | * @handler_func: wmi event handler function |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2114 | * @rx_ctx: rx execution context for wmi rx events |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2115 | * |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 2116 | * This API is to support legacy requirements. Will be deprecated in future. |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2117 | * Return: 0 on success |
| 2118 | */ |
| 2119 | int wmi_unified_register_event_handler(wmi_unified_t wmi_handle, |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2120 | uint32_t event_id, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2121 | wmi_unified_event_handler handler_func, |
| 2122 | uint8_t rx_ctx) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2123 | { |
| 2124 | uint32_t idx = 0; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2125 | uint32_t evt_id; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2126 | struct wmi_soc *soc = wmi_handle->soc; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2127 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2128 | #ifndef CONFIG_MCL |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2129 | if (event_id >= wmi_events_max || |
| 2130 | wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) { |
| 2131 | qdf_print("%s: Event id %d is unavailable\n", |
| 2132 | __func__, event_id); |
| 2133 | return QDF_STATUS_E_FAILURE; |
| 2134 | } |
| 2135 | evt_id = wmi_handle->wmi_events[event_id]; |
| 2136 | #else |
| 2137 | evt_id = event_id; |
| 2138 | #endif |
| 2139 | if (wmi_unified_get_event_handler_ix(wmi_handle, evt_id) != -1) { |
| 2140 | qdf_print("%s : event handler already registered 0x%x\n", |
| 2141 | __func__, evt_id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2142 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2143 | } |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2144 | if (soc->max_event_idx == WMI_UNIFIED_MAX_EVENT) { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2145 | qdf_print("%s : no more event handlers 0x%x\n", |
| 2146 | __func__, evt_id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2147 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2148 | } |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2149 | idx = soc->max_event_idx; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2150 | wmi_handle->event_handler[idx] = handler_func; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2151 | wmi_handle->event_id[idx] = evt_id; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2152 | qdf_spin_lock_bh(&soc->ctx_lock); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2153 | wmi_handle->ctx[idx] = rx_ctx; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2154 | qdf_spin_unlock_bh(&soc->ctx_lock); |
| 2155 | soc->max_event_idx++; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2156 | |
| 2157 | return 0; |
| 2158 | } |
| 2159 | |
| 2160 | /** |
Soumya Bhat | 8eb0b93 | 2017-03-27 12:26:56 +0530 | [diff] [blame] | 2161 | * wmi_unified_unregister_event() - unregister wmi event handler |
| 2162 | * @wmi_handle: handle to wmi |
| 2163 | * @event_id: wmi event id |
| 2164 | * |
| 2165 | * Return: 0 on success |
| 2166 | */ |
| 2167 | int wmi_unified_unregister_event(wmi_unified_t wmi_handle, |
| 2168 | uint32_t event_id) |
| 2169 | { |
| 2170 | uint32_t idx = 0; |
| 2171 | uint32_t evt_id; |
| 2172 | struct wmi_soc *soc = wmi_handle->soc; |
| 2173 | |
| 2174 | if (event_id >= wmi_events_max || |
| 2175 | wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) { |
| 2176 | qdf_print("%s: Event id %d is unavailable\n", |
| 2177 | __func__, event_id); |
| 2178 | return QDF_STATUS_E_FAILURE; |
| 2179 | } |
| 2180 | evt_id = wmi_handle->wmi_events[event_id]; |
| 2181 | |
| 2182 | idx = wmi_unified_get_event_handler_ix(wmi_handle, evt_id); |
| 2183 | if (idx == -1) { |
| 2184 | qdf_print("%s : event handler is not registered: evt id 0x%x\n", |
| 2185 | __func__, evt_id); |
| 2186 | return QDF_STATUS_E_FAILURE; |
| 2187 | } |
| 2188 | wmi_handle->event_handler[idx] = NULL; |
| 2189 | wmi_handle->event_id[idx] = 0; |
| 2190 | --soc->max_event_idx; |
| 2191 | wmi_handle->event_handler[idx] = |
| 2192 | wmi_handle->event_handler[soc->max_event_idx]; |
| 2193 | wmi_handle->event_id[idx] = |
| 2194 | wmi_handle->event_id[soc->max_event_idx]; |
| 2195 | |
| 2196 | return 0; |
| 2197 | } |
| 2198 | |
| 2199 | /** |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2200 | * wmi_unified_unregister_event_handler() - unregister wmi event handler |
| 2201 | * @wmi_handle: handle to wmi |
| 2202 | * @event_id: wmi event id |
| 2203 | * |
| 2204 | * Return: 0 on success |
| 2205 | */ |
| 2206 | int wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle, |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2207 | uint32_t event_id) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2208 | { |
| 2209 | uint32_t idx = 0; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2210 | uint32_t evt_id; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2211 | struct wmi_soc *soc = wmi_handle->soc; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2212 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2213 | #ifndef CONFIG_MCL |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2214 | if (event_id >= wmi_events_max || |
| 2215 | wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) { |
| 2216 | qdf_print("%s: Event id %d is unavailable\n", |
| 2217 | __func__, event_id); |
| 2218 | return QDF_STATUS_E_FAILURE; |
| 2219 | } |
| 2220 | evt_id = wmi_handle->wmi_events[event_id]; |
| 2221 | #else |
| 2222 | evt_id = event_id; |
| 2223 | #endif |
| 2224 | |
| 2225 | idx = wmi_unified_get_event_handler_ix(wmi_handle, evt_id); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2226 | if (idx == -1) { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2227 | qdf_print("%s : event handler is not registered: evt id 0x%x\n", |
| 2228 | __func__, evt_id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2229 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2230 | } |
| 2231 | wmi_handle->event_handler[idx] = NULL; |
| 2232 | wmi_handle->event_id[idx] = 0; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2233 | --soc->max_event_idx; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2234 | wmi_handle->event_handler[idx] = |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2235 | wmi_handle->event_handler[soc->max_event_idx]; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2236 | wmi_handle->event_id[idx] = |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2237 | wmi_handle->event_id[soc->max_event_idx]; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2238 | |
| 2239 | return 0; |
| 2240 | } |
| 2241 | |
| 2242 | /** |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2243 | * wmi_process_fw_event_default_ctx() - process in default caller context |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2244 | * @wmi_handle: handle to wmi |
| 2245 | * @htc_packet: pointer to htc packet |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2246 | * @exec_ctx: execution context for wmi fw event |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2247 | * |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2248 | * Event process by below function will be in default caller context. |
| 2249 | * wmi internally provides rx work thread processing context. |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2250 | * |
| 2251 | * Return: none |
| 2252 | */ |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2253 | static void wmi_process_fw_event_default_ctx(struct wmi_unified *wmi_handle, |
| 2254 | HTC_PACKET *htc_packet, uint8_t exec_ctx) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2255 | { |
| 2256 | wmi_buf_t evt_buf; |
| 2257 | evt_buf = (wmi_buf_t) htc_packet->pPktContext; |
| 2258 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2259 | #ifndef CONFIG_MCL |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2260 | wmi_handle->rx_ops.wma_process_fw_event_handler_cbk |
| 2261 | (wmi_handle->scn_handle, evt_buf, exec_ctx); |
| 2262 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2263 | wmi_handle->rx_ops.wma_process_fw_event_handler_cbk(wmi_handle, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2264 | evt_buf, exec_ctx); |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2265 | #endif |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2266 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2267 | return; |
| 2268 | } |
| 2269 | |
| 2270 | /** |
| 2271 | * wmi_process_fw_event_worker_thread_ctx() - process in worker thread context |
| 2272 | * @wmi_handle: handle to wmi |
| 2273 | * @htc_packet: pointer to htc packet |
| 2274 | * |
| 2275 | * Event process by below function will be in worker thread context. |
| 2276 | * Use this method for events which are not critical and not |
| 2277 | * handled in protocol stack. |
| 2278 | * |
| 2279 | * Return: none |
| 2280 | */ |
| 2281 | static void wmi_process_fw_event_worker_thread_ctx |
| 2282 | (struct wmi_unified *wmi_handle, HTC_PACKET *htc_packet) |
| 2283 | { |
| 2284 | wmi_buf_t evt_buf; |
| 2285 | uint32_t id; |
| 2286 | uint8_t *data; |
| 2287 | |
| 2288 | evt_buf = (wmi_buf_t) htc_packet->pPktContext; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2289 | id = WMI_GET_FIELD(qdf_nbuf_data(evt_buf), WMI_CMD_HDR, COMMANDID); |
| 2290 | data = qdf_nbuf_data(evt_buf); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2291 | |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2292 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2293 | if (wmi_handle->log_info.wmi_logging_enable) { |
| 2294 | qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 2295 | /* Exclude 4 bytes of TLV header */ |
| 2296 | WMI_RX_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data + |
| 2297 | wmi_handle->log_info.buf_offset_event)); |
| 2298 | qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 2299 | } |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2300 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2301 | qdf_spin_lock_bh(&wmi_handle->eventq_lock); |
| 2302 | qdf_nbuf_queue_add(&wmi_handle->event_queue, evt_buf); |
| 2303 | qdf_spin_unlock_bh(&wmi_handle->eventq_lock); |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2304 | qdf_queue_work(0, wmi_handle->wmi_rx_work_queue, |
| 2305 | &wmi_handle->rx_event_work); |
| 2306 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2307 | return; |
| 2308 | } |
| 2309 | |
| 2310 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2311 | * wmi_get_pdev_ep: Get wmi handle based on endpoint |
| 2312 | * @soc: handle to wmi soc |
| 2313 | * @ep: endpoint id |
| 2314 | * |
| 2315 | * Return: none |
| 2316 | */ |
| 2317 | static struct wmi_unified *wmi_get_pdev_ep(struct wmi_soc *soc, |
| 2318 | HTC_ENDPOINT_ID ep) |
| 2319 | { |
| 2320 | uint32_t i; |
| 2321 | |
| 2322 | for (i = 0; i < WMI_MAX_RADIOS; i++) |
| 2323 | if (soc->wmi_endpoint_id[i] == ep) |
| 2324 | break; |
| 2325 | |
| 2326 | if (i == WMI_MAX_RADIOS) |
| 2327 | return NULL; |
| 2328 | |
| 2329 | return soc->wmi_pdev[i]; |
| 2330 | } |
| 2331 | |
| 2332 | /** |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2333 | * wmi_control_rx() - process fw events callbacks |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2334 | * @ctx: handle to wmi |
| 2335 | * @htc_packet: pointer to htc packet |
| 2336 | * |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2337 | * Return: none |
| 2338 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 2339 | static void wmi_control_rx(void *ctx, HTC_PACKET *htc_packet) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2340 | { |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2341 | struct wmi_soc *soc = (struct wmi_soc *) ctx; |
| 2342 | struct wmi_unified *wmi_handle; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2343 | wmi_buf_t evt_buf; |
| 2344 | uint32_t id; |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2345 | uint32_t idx = 0; |
| 2346 | enum wmi_rx_exec_ctx exec_ctx; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2347 | |
| 2348 | evt_buf = (wmi_buf_t) htc_packet->pPktContext; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2349 | |
| 2350 | wmi_handle = wmi_get_pdev_ep(soc, htc_packet->Endpoint); |
| 2351 | if (wmi_handle == NULL) { |
| 2352 | qdf_print |
| 2353 | ("%s :unable to get wmi_handle to Endpoint %d\n", |
| 2354 | __func__, htc_packet->Endpoint); |
| 2355 | qdf_nbuf_free(evt_buf); |
| 2356 | return; |
| 2357 | } |
| 2358 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2359 | id = WMI_GET_FIELD(qdf_nbuf_data(evt_buf), WMI_CMD_HDR, COMMANDID); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2360 | idx = wmi_unified_get_event_handler_ix(wmi_handle, id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2361 | if (qdf_unlikely(idx == A_ERROR)) { |
| 2362 | qdf_print |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2363 | ("%s :event handler is not registered: event id 0x%x\n", |
| 2364 | __func__, id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2365 | qdf_nbuf_free(evt_buf); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2366 | return; |
| 2367 | } |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2368 | qdf_spin_lock_bh(&soc->ctx_lock); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2369 | exec_ctx = wmi_handle->ctx[idx]; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2370 | qdf_spin_unlock_bh(&soc->ctx_lock); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2371 | |
| 2372 | if (exec_ctx == WMI_RX_WORK_CTX) { |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2373 | wmi_process_fw_event_worker_thread_ctx |
| 2374 | (wmi_handle, htc_packet); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2375 | } else if (exec_ctx > WMI_RX_WORK_CTX) { |
| 2376 | wmi_process_fw_event_default_ctx |
| 2377 | (wmi_handle, htc_packet, exec_ctx); |
| 2378 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2379 | qdf_print("%s :Invalid event context %d\n", __func__, exec_ctx); |
| 2380 | qdf_nbuf_free(evt_buf); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2381 | } |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2382 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2383 | } |
| 2384 | |
| 2385 | /** |
| 2386 | * wmi_process_fw_event() - process any fw event |
| 2387 | * @wmi_handle: wmi handle |
| 2388 | * @evt_buf: fw event buffer |
| 2389 | * |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2390 | * This function process fw event in caller context |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2391 | * |
| 2392 | * Return: none |
| 2393 | */ |
| 2394 | void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf) |
| 2395 | { |
| 2396 | __wmi_control_rx(wmi_handle, evt_buf); |
| 2397 | } |
| 2398 | |
| 2399 | /** |
| 2400 | * __wmi_control_rx() - process serialize wmi event callback |
| 2401 | * @wmi_handle: wmi handle |
| 2402 | * @evt_buf: fw event buffer |
| 2403 | * |
| 2404 | * Return: none |
| 2405 | */ |
| 2406 | void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf) |
| 2407 | { |
| 2408 | uint32_t id; |
| 2409 | uint8_t *data; |
| 2410 | uint32_t len; |
| 2411 | void *wmi_cmd_struct_ptr = NULL; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2412 | #ifndef WMI_NON_TLV_SUPPORT |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2413 | int tlv_ok_status = 0; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2414 | #endif |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2415 | uint32_t idx = 0; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2416 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2417 | id = WMI_GET_FIELD(qdf_nbuf_data(evt_buf), WMI_CMD_HDR, COMMANDID); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2418 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2419 | if (qdf_nbuf_pull_head(evt_buf, sizeof(WMI_CMD_HDR)) == NULL) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2420 | goto end; |
| 2421 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2422 | data = qdf_nbuf_data(evt_buf); |
| 2423 | len = qdf_nbuf_len(evt_buf); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2424 | |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2425 | #ifndef WMI_NON_TLV_SUPPORT |
| 2426 | if (wmi_handle->target_type == WMI_TLV_TARGET) { |
| 2427 | /* Validate and pad(if necessary) the TLVs */ |
| 2428 | tlv_ok_status = |
| 2429 | wmitlv_check_and_pad_event_tlvs(wmi_handle->scn_handle, |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2430 | data, len, id, |
| 2431 | &wmi_cmd_struct_ptr); |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2432 | if (tlv_ok_status != 0) { |
| 2433 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
| 2434 | "%s: Error: id=0x%d, wmitlv check status=%d\n", |
| 2435 | __func__, id, tlv_ok_status); |
| 2436 | goto end; |
| 2437 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2438 | } |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2439 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2440 | |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2441 | idx = wmi_unified_get_event_handler_ix(wmi_handle, id); |
| 2442 | if (idx == A_ERROR) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2443 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2444 | "%s : event handler is not registered: event id 0x%x\n", |
| 2445 | __func__, id); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2446 | goto end; |
| 2447 | } |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2448 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2449 | if (wmi_handle->log_info.wmi_logging_enable) { |
| 2450 | qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 2451 | /* Exclude 4 bytes of TLV header */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2452 | if (wmi_handle->ops->is_management_record(id)) { |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2453 | WMI_MGMT_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data |
| 2454 | + wmi_handle->log_info.buf_offset_event)); |
| 2455 | } else { |
| 2456 | WMI_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data + |
| 2457 | wmi_handle->log_info.buf_offset_event)); |
| 2458 | } |
| 2459 | qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2460 | } |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2461 | #endif |
| 2462 | /* Call the WMI registered event handler */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2463 | if (wmi_handle->target_type == WMI_TLV_TARGET) |
| 2464 | wmi_handle->event_handler[idx] (wmi_handle->scn_handle, |
| 2465 | wmi_cmd_struct_ptr, len); |
| 2466 | else |
| 2467 | wmi_handle->event_handler[idx] (wmi_handle->scn_handle, |
| 2468 | data, len); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2469 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2470 | end: |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2471 | /* Free event buffer and allocated event tlv */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2472 | #ifndef WMI_NON_TLV_SUPPORT |
| 2473 | if (wmi_handle->target_type == WMI_TLV_TARGET) |
| 2474 | wmitlv_free_allocated_event_tlvs(id, &wmi_cmd_struct_ptr); |
| 2475 | #endif |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2476 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2477 | qdf_nbuf_free(evt_buf); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2478 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2479 | } |
| 2480 | |
| 2481 | /** |
| 2482 | * wmi_rx_event_work() - process rx event in rx work queue context |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2483 | * @arg: opaque pointer to wmi handle |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2484 | * |
| 2485 | * This function process any fw event to serialize it through rx worker thread. |
| 2486 | * |
| 2487 | * Return: none |
| 2488 | */ |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2489 | static void wmi_rx_event_work(void *arg) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2490 | { |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2491 | wmi_buf_t buf; |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2492 | struct wmi_unified *wmi = arg; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2493 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2494 | qdf_spin_lock_bh(&wmi->eventq_lock); |
| 2495 | buf = qdf_nbuf_queue_remove(&wmi->event_queue); |
| 2496 | qdf_spin_unlock_bh(&wmi->eventq_lock); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2497 | while (buf) { |
| 2498 | __wmi_control_rx(wmi, buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2499 | qdf_spin_lock_bh(&wmi->eventq_lock); |
| 2500 | buf = qdf_nbuf_queue_remove(&wmi->event_queue); |
| 2501 | qdf_spin_unlock_bh(&wmi->eventq_lock); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2502 | } |
| 2503 | } |
| 2504 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2505 | #ifdef FEATURE_RUNTIME_PM |
| 2506 | /** |
| 2507 | * wmi_runtime_pm_init() - initialize runtime pm wmi variables |
| 2508 | * @wmi_handle: wmi context |
| 2509 | */ |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2510 | static void wmi_runtime_pm_init(struct wmi_unified *wmi_handle) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2511 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2512 | qdf_atomic_init(&wmi_handle->runtime_pm_inprogress); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2513 | } |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2514 | |
| 2515 | /** |
| 2516 | * wmi_set_runtime_pm_inprogress() - set runtime pm progress flag |
| 2517 | * @wmi_handle: wmi context |
| 2518 | * @val: runtime pm progress flag |
| 2519 | */ |
| 2520 | void wmi_set_runtime_pm_inprogress(wmi_unified_t wmi_handle, A_BOOL val) |
| 2521 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2522 | qdf_atomic_set(&wmi_handle->runtime_pm_inprogress, val); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2523 | } |
| 2524 | |
| 2525 | /** |
| 2526 | * wmi_get_runtime_pm_inprogress() - get runtime pm progress flag |
| 2527 | * @wmi_handle: wmi context |
| 2528 | */ |
| 2529 | inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle) |
| 2530 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2531 | return qdf_atomic_read(&wmi_handle->runtime_pm_inprogress); |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2532 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2533 | #else |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2534 | static void wmi_runtime_pm_init(struct wmi_unified *wmi_handle) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2535 | { |
| 2536 | } |
| 2537 | #endif |
| 2538 | |
| 2539 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2540 | * wmi_unified_get_soc_handle: Get WMI SoC handle |
| 2541 | * @param wmi_handle: WMI context got from wmi_attach |
| 2542 | * |
| 2543 | * return: Pointer to Soc handle |
| 2544 | */ |
| 2545 | void *wmi_unified_get_soc_handle(struct wmi_unified *wmi_handle) |
| 2546 | { |
| 2547 | return wmi_handle->soc; |
| 2548 | } |
| 2549 | |
| 2550 | /** |
| 2551 | * wmi_interface_logging_init: Interface looging init |
| 2552 | * @param wmi_handle: Pointer to wmi handle object |
| 2553 | * |
| 2554 | * return: None |
| 2555 | */ |
| 2556 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 2557 | static inline void wmi_interface_logging_init(struct wmi_unified *wmi_handle) |
| 2558 | { |
| 2559 | if (QDF_STATUS_SUCCESS == wmi_log_init(wmi_handle)) { |
| 2560 | qdf_spinlock_create(&wmi_handle->log_info.wmi_record_lock); |
| 2561 | wmi_debugfs_init(wmi_handle); |
| 2562 | } |
| 2563 | } |
| 2564 | #else |
| 2565 | void wmi_interface_logging_init(struct wmi_unified *wmi_handle) |
| 2566 | { |
| 2567 | } |
| 2568 | #endif |
| 2569 | |
| 2570 | /** |
| 2571 | * wmi_target_params_init: Target specific params init |
| 2572 | * @param wmi_soc: Pointer to wmi soc object |
| 2573 | * @param wmi_handle: Pointer to wmi handle object |
| 2574 | * |
| 2575 | * return: None |
| 2576 | */ |
| 2577 | #ifndef CONFIG_MCL |
| 2578 | static inline void wmi_target_params_init(struct wmi_soc *soc, |
| 2579 | struct wmi_unified *wmi_handle) |
| 2580 | { |
| 2581 | /* WMI service bitmap recieved from target */ |
| 2582 | wmi_handle->wmi_service_bitmap = soc->wmi_service_bitmap; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2583 | wmi_handle->pdev_param = soc->pdev_param; |
| 2584 | wmi_handle->vdev_param = soc->vdev_param; |
| 2585 | wmi_handle->services = soc->services; |
| 2586 | } |
| 2587 | #else |
| 2588 | static inline void wmi_target_params_init(struct wmi_soc *soc, |
| 2589 | struct wmi_unified *wmi_handle) |
| 2590 | { |
| 2591 | } |
| 2592 | #endif |
| 2593 | |
| 2594 | /** |
| 2595 | * wmi_unified_get_pdev_handle: Get WMI SoC handle |
| 2596 | * @param wmi_soc: Pointer to wmi soc object |
| 2597 | * @param pdev_idx: pdev index |
| 2598 | * |
| 2599 | * return: Pointer to wmi handle or NULL on failure |
| 2600 | */ |
| 2601 | void *wmi_unified_get_pdev_handle(struct wmi_soc *soc, uint32_t pdev_idx) |
| 2602 | { |
| 2603 | struct wmi_unified *wmi_handle; |
| 2604 | |
| 2605 | if (pdev_idx >= WMI_MAX_RADIOS) |
| 2606 | return NULL; |
| 2607 | |
| 2608 | /* If wmi pdev is already allocated, just return the handle */ |
| 2609 | if (soc->wmi_pdev[pdev_idx] != NULL) |
| 2610 | return soc->wmi_pdev[pdev_idx]; |
| 2611 | |
| 2612 | wmi_handle = |
| 2613 | (struct wmi_unified *) qdf_mem_malloc( |
| 2614 | sizeof(struct wmi_unified)); |
| 2615 | if (wmi_handle == NULL) { |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2616 | qdf_print("allocation of wmi handle failed %zu\n", |
| 2617 | sizeof(struct wmi_unified)); |
| 2618 | return NULL; |
| 2619 | } |
| 2620 | wmi_handle->scn_handle = soc->scn_handle; |
| 2621 | wmi_handle->event_id = soc->event_id; |
| 2622 | wmi_handle->event_handler = soc->event_handler; |
| 2623 | wmi_handle->ctx = soc->ctx; |
| 2624 | wmi_handle->ops = soc->ops; |
| 2625 | qdf_spinlock_create(&wmi_handle->eventq_lock); |
| 2626 | qdf_nbuf_queue_init(&wmi_handle->event_queue); |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2627 | |
| 2628 | qdf_create_work(0, &wmi_handle->rx_event_work, |
| 2629 | wmi_rx_event_work, wmi_handle); |
| 2630 | wmi_handle->wmi_rx_work_queue = |
| 2631 | qdf_create_workqueue("wmi_rx_event_work_queue"); |
| 2632 | if (NULL == wmi_handle->wmi_rx_work_queue) { |
| 2633 | WMI_LOGE("failed to create wmi_rx_event_work_queue"); |
| 2634 | goto error; |
| 2635 | } |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 2636 | wmi_handle->wmi_events = soc->wmi_events; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2637 | wmi_target_params_init(soc, wmi_handle); |
| 2638 | wmi_interface_logging_init(wmi_handle); |
| 2639 | qdf_atomic_init(&wmi_handle->pending_cmds); |
| 2640 | qdf_atomic_init(&wmi_handle->is_target_suspended); |
| 2641 | wmi_handle->target_type = soc->target_type; |
| 2642 | wmi_handle->wmi_stopinprogress = 0; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2643 | wmi_handle->wmi_endpoint_id = soc->wmi_endpoint_id[pdev_idx]; |
| 2644 | wmi_handle->htc_handle = soc->htc_handle; |
| 2645 | wmi_handle->max_msg_len = soc->max_msg_len[pdev_idx]; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2646 | wmi_handle->soc = soc; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2647 | |
| 2648 | soc->wmi_pdev[pdev_idx] = wmi_handle; |
| 2649 | |
| 2650 | return wmi_handle; |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2651 | |
| 2652 | error: |
| 2653 | qdf_mem_free(wmi_handle); |
| 2654 | |
| 2655 | return NULL; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2656 | } |
| 2657 | |
| 2658 | /** |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2659 | * wmi_unified_attach() - attach for unified WMI |
Govind Singh | c458f38 | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 2660 | * @scn_handle: handle to SCN |
| 2661 | * @osdev: OS device context |
| 2662 | * @target_type: TLV or not-TLV based target |
| 2663 | * @use_cookie: cookie based allocation enabled/disabled |
| 2664 | * @ops: umac rx callbacks |
Mukul Sharma | f8a1708 | 2017-01-30 19:55:40 +0530 | [diff] [blame] | 2665 | * @psoc: objmgr psoc |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2666 | * |
| 2667 | * @Return: wmi handle. |
| 2668 | */ |
Govind Singh | c458f38 | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 2669 | void *wmi_unified_attach(void *scn_handle, |
| 2670 | osdev_t osdev, enum wmi_target_type target_type, |
Mukul Sharma | f8a1708 | 2017-01-30 19:55:40 +0530 | [diff] [blame] | 2671 | bool use_cookie, struct wmi_rx_ops *rx_ops, |
| 2672 | struct wlan_objmgr_psoc *psoc) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2673 | { |
| 2674 | struct wmi_unified *wmi_handle; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2675 | struct wmi_soc *soc; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2676 | |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2677 | soc = (struct wmi_soc *) qdf_mem_malloc(sizeof(struct wmi_soc)); |
| 2678 | if (soc == NULL) { |
| 2679 | qdf_print("Allocation of wmi_soc failed %zu\n", |
| 2680 | sizeof(struct wmi_soc)); |
| 2681 | return NULL; |
| 2682 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2683 | #ifdef CONFIG_MCL |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2684 | wmi_handle = |
| 2685 | (struct wmi_unified *)os_malloc(NULL, |
| 2686 | sizeof(struct wmi_unified), |
| 2687 | GFP_ATOMIC); |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2688 | #else |
| 2689 | wmi_handle = |
| 2690 | (struct wmi_unified *) qdf_mem_malloc( |
| 2691 | sizeof(struct wmi_unified)); |
| 2692 | #endif |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2693 | if (wmi_handle == NULL) { |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2694 | qdf_mem_free(soc); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2695 | qdf_print("allocation of wmi handle failed %zu\n", |
Govind Singh | d52faac | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 2696 | sizeof(struct wmi_unified)); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2697 | return NULL; |
| 2698 | } |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2699 | wmi_handle->soc = soc; |
| 2700 | wmi_handle->event_id = soc->event_id; |
| 2701 | wmi_handle->event_handler = soc->event_handler; |
| 2702 | wmi_handle->ctx = soc->ctx; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 2703 | wmi_handle->wmi_events = soc->wmi_events; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2704 | wmi_target_params_init(soc, wmi_handle); |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2705 | wmi_handle->scn_handle = scn_handle; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2706 | soc->scn_handle = scn_handle; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2707 | qdf_atomic_init(&wmi_handle->pending_cmds); |
| 2708 | qdf_atomic_init(&wmi_handle->is_target_suspended); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2709 | wmi_runtime_pm_init(wmi_handle); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2710 | qdf_spinlock_create(&wmi_handle->eventq_lock); |
| 2711 | qdf_nbuf_queue_init(&wmi_handle->event_queue); |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2712 | qdf_create_work(0, &wmi_handle->rx_event_work, |
| 2713 | wmi_rx_event_work, wmi_handle); |
| 2714 | wmi_handle->wmi_rx_work_queue = |
| 2715 | qdf_create_workqueue("wmi_rx_event_work_queue"); |
| 2716 | if (NULL == wmi_handle->wmi_rx_work_queue) { |
| 2717 | WMI_LOGE("failed to create wmi_rx_event_work_queue"); |
| 2718 | goto error; |
| 2719 | } |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2720 | wmi_interface_logging_init(wmi_handle); |
Govind Singh | c458f38 | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 2721 | /* Attach mc_thread context processing function */ |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2722 | wmi_handle->rx_ops.wma_process_fw_event_handler_cbk = |
| 2723 | rx_ops->wma_process_fw_event_handler_cbk; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2724 | wmi_handle->target_type = target_type; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2725 | soc->target_type = target_type; |
Govind Singh | c458f38 | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 2726 | if (target_type == WMI_TLV_TARGET) |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2727 | wmi_tlv_attach(wmi_handle); |
Govind Singh | c458f38 | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 2728 | else |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2729 | wmi_non_tlv_attach(wmi_handle); |
Govind Singh | c458f38 | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 2730 | /* Assign target cookie capablity */ |
| 2731 | wmi_handle->use_cookie = use_cookie; |
| 2732 | wmi_handle->osdev = osdev; |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2733 | wmi_handle->wmi_stopinprogress = 0; |
Mukul Sharma | f8a1708 | 2017-01-30 19:55:40 +0530 | [diff] [blame] | 2734 | /* Increase the ref count once refcount infra is present */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2735 | soc->wmi_psoc = psoc; |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2736 | qdf_spinlock_create(&soc->ctx_lock); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2737 | |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2738 | soc->ops = wmi_handle->ops; |
| 2739 | soc->wmi_pdev[0] = wmi_handle; |
| 2740 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2741 | return wmi_handle; |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2742 | |
| 2743 | error: |
| 2744 | qdf_mem_free(soc); |
| 2745 | qdf_mem_free(wmi_handle); |
| 2746 | |
| 2747 | return NULL; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2748 | } |
| 2749 | |
| 2750 | /** |
| 2751 | * wmi_unified_detach() - detach for unified WMI |
| 2752 | * |
| 2753 | * @wmi_handle : handle to wmi. |
| 2754 | * |
| 2755 | * @Return: none. |
| 2756 | */ |
| 2757 | void wmi_unified_detach(struct wmi_unified *wmi_handle) |
| 2758 | { |
| 2759 | wmi_buf_t buf; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2760 | struct wmi_soc *soc; |
| 2761 | uint8_t i; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2762 | |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2763 | soc = wmi_handle->soc; |
| 2764 | for (i = 0; i < WMI_MAX_RADIOS; i++) { |
| 2765 | if (soc->wmi_pdev[i]) { |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2766 | qdf_flush_workqueue(0, |
| 2767 | soc->wmi_pdev[i]->wmi_rx_work_queue); |
| 2768 | qdf_destroy_workqueue(0, |
| 2769 | soc->wmi_pdev[i]->wmi_rx_work_queue); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2770 | wmi_debugfs_remove(soc->wmi_pdev[i]); |
| 2771 | buf = qdf_nbuf_queue_remove( |
| 2772 | &soc->wmi_pdev[i]->event_queue); |
| 2773 | while (buf) { |
| 2774 | qdf_nbuf_free(buf); |
| 2775 | buf = qdf_nbuf_queue_remove( |
| 2776 | &soc->wmi_pdev[i]->event_queue); |
| 2777 | } |
Rajeev Kumar | ae91c40 | 2016-05-25 16:07:23 -0700 | [diff] [blame] | 2778 | |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2779 | wmi_log_buffer_free(soc->wmi_pdev[i]); |
| 2780 | qdf_spinlock_destroy(&soc->wmi_pdev[i]->eventq_lock); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2781 | qdf_mem_free(soc->wmi_pdev[i]); |
| 2782 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2783 | } |
Kiran Venkatappa | f285aba | 2017-03-20 20:38:44 +0530 | [diff] [blame] | 2784 | qdf_spinlock_destroy(&soc->ctx_lock); |
Mukul Sharma | f8a1708 | 2017-01-30 19:55:40 +0530 | [diff] [blame] | 2785 | /* Decrease the ref count once refcount infra is present */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2786 | soc->wmi_psoc = NULL; |
| 2787 | qdf_mem_free(soc); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2788 | } |
| 2789 | |
| 2790 | /** |
| 2791 | * wmi_unified_remove_work() - detach for WMI work |
| 2792 | * @wmi_handle: handle to WMI |
| 2793 | * |
| 2794 | * A function that does not fully detach WMI, but just remove work |
| 2795 | * queue items associated with it. This is used to make sure that |
| 2796 | * before any other processing code that may destroy related contexts |
| 2797 | * (HTC, etc), work queue processing on WMI has already been stopped. |
| 2798 | * |
| 2799 | * Return: None |
| 2800 | */ |
| 2801 | void |
| 2802 | wmi_unified_remove_work(struct wmi_unified *wmi_handle) |
| 2803 | { |
| 2804 | wmi_buf_t buf; |
| 2805 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2806 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2807 | "Enter: %s", __func__); |
Rajeev Kumar | 2ec8d47 | 2017-03-29 17:14:14 -0700 | [diff] [blame] | 2808 | qdf_flush_workqueue(0, wmi_handle->wmi_rx_work_queue); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2809 | qdf_spin_lock_bh(&wmi_handle->eventq_lock); |
| 2810 | buf = qdf_nbuf_queue_remove(&wmi_handle->event_queue); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2811 | while (buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2812 | qdf_nbuf_free(buf); |
| 2813 | buf = qdf_nbuf_queue_remove(&wmi_handle->event_queue); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2814 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2815 | qdf_spin_unlock_bh(&wmi_handle->eventq_lock); |
| 2816 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2817 | "Done: %s", __func__); |
| 2818 | } |
| 2819 | |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2820 | /** |
| 2821 | * wmi_htc_tx_complete() - Process htc tx completion |
| 2822 | * |
| 2823 | * @ctx: handle to wmi |
| 2824 | * @htc_packet: pointer to htc packet |
| 2825 | * |
| 2826 | * @Return: none. |
| 2827 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 2828 | static void wmi_htc_tx_complete(void *ctx, HTC_PACKET *htc_pkt) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2829 | { |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2830 | struct wmi_soc *soc = (struct wmi_soc *) ctx; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2831 | wmi_buf_t wmi_cmd_buf = GET_HTC_PACKET_NET_BUF_CONTEXT(htc_pkt); |
Govind Singh | 82ea326 | 2016-09-02 15:24:25 +0530 | [diff] [blame] | 2832 | u_int8_t *buf_ptr; |
| 2833 | u_int32_t len; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2834 | struct wmi_unified *wmi_handle; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2835 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 2836 | uint32_t cmd_id; |
| 2837 | #endif |
| 2838 | |
| 2839 | ASSERT(wmi_cmd_buf); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2840 | wmi_handle = wmi_get_pdev_ep(soc, htc_pkt->Endpoint); |
| 2841 | if (wmi_handle == NULL) { |
| 2842 | WMI_LOGE("%s: Unable to get wmi handle\n", __func__); |
| 2843 | QDF_ASSERT(0); |
| 2844 | return; |
| 2845 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2846 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2847 | if (wmi_handle && wmi_handle->log_info.wmi_logging_enable) { |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2848 | cmd_id = WMI_GET_FIELD(qdf_nbuf_data(wmi_cmd_buf), |
| 2849 | WMI_CMD_HDR, COMMANDID); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2850 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2851 | qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2852 | /* Record 16 bytes of WMI cmd tx complete data |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2853 | - exclude TLV and WMI headers */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2854 | if (wmi_handle->ops->is_management_record(cmd_id)) { |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2855 | WMI_MGMT_COMMAND_TX_CMP_RECORD(wmi_handle, cmd_id, |
| 2856 | ((uint32_t *) qdf_nbuf_data(wmi_cmd_buf) + |
| 2857 | wmi_handle->log_info.buf_offset_command)); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2858 | } else { |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2859 | WMI_COMMAND_TX_CMP_RECORD(wmi_handle, cmd_id, |
| 2860 | ((uint32_t *) qdf_nbuf_data(wmi_cmd_buf) + |
| 2861 | wmi_handle->log_info.buf_offset_command)); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2862 | } |
| 2863 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 2864 | qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock); |
| 2865 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2866 | #endif |
Govind Singh | 82ea326 | 2016-09-02 15:24:25 +0530 | [diff] [blame] | 2867 | buf_ptr = (u_int8_t *) wmi_buf_data(wmi_cmd_buf); |
| 2868 | len = qdf_nbuf_len(wmi_cmd_buf); |
| 2869 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2870 | qdf_nbuf_free(wmi_cmd_buf); |
| 2871 | qdf_mem_free(htc_pkt); |
| 2872 | qdf_atomic_dec(&wmi_handle->pending_cmds); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2873 | } |
| 2874 | |
| 2875 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2876 | * wmi_connect_pdev_htc_service() - WMI API to get connect to HTC service |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2877 | * |
| 2878 | * @wmi_handle: handle to WMI. |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2879 | * @pdev_idx: Pdev index |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2880 | * |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2881 | * @Return: status. |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2882 | */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2883 | static int wmi_connect_pdev_htc_service(struct wmi_soc *soc, |
| 2884 | uint32_t pdev_idx) |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2885 | { |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2886 | int status; |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2887 | uint32_t svc_id[] = {WMI_CONTROL_SVC, WMI_CONTROL_SVC_WMAC1, |
| 2888 | WMI_CONTROL_SVC_WMAC2}; |
Manikandan Mohan | f940db8 | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 2889 | struct htc_service_connect_resp response; |
| 2890 | struct htc_service_connect_req connect; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2891 | |
| 2892 | OS_MEMZERO(&connect, sizeof(connect)); |
| 2893 | OS_MEMZERO(&response, sizeof(response)); |
| 2894 | |
| 2895 | /* meta data is unused for now */ |
| 2896 | connect.pMetaData = NULL; |
| 2897 | connect.MetaDataLength = 0; |
| 2898 | /* these fields are the same for all service endpoints */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2899 | connect.EpCallbacks.pContext = soc; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2900 | connect.EpCallbacks.EpTxCompleteMultiple = |
| 2901 | NULL /* Control path completion ar6000_tx_complete */; |
| 2902 | connect.EpCallbacks.EpRecv = wmi_control_rx /* Control path rx */; |
| 2903 | connect.EpCallbacks.EpRecvRefill = NULL /* ar6000_rx_refill */; |
| 2904 | connect.EpCallbacks.EpSendFull = NULL /* ar6000_tx_queue_full */; |
| 2905 | connect.EpCallbacks.EpTxComplete = |
| 2906 | wmi_htc_tx_complete /* ar6000_tx_queue_full */; |
| 2907 | |
| 2908 | /* connect to control service */ |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2909 | connect.service_id = svc_id[pdev_idx]; |
| 2910 | status = htc_connect_service(soc->htc_handle, &connect, |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2911 | &response); |
| 2912 | |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2913 | |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2914 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2915 | qdf_print |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2916 | ("Failed to connect to WMI CONTROL service status:%d\n", |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2917 | status); |
| 2918 | return status; |
| 2919 | } |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2920 | |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 2921 | soc->wmi_endpoint_id[pdev_idx] = response.Endpoint; |
| 2922 | soc->max_msg_len[pdev_idx] = response.MaxMsgLength; |
| 2923 | |
| 2924 | return 0; |
| 2925 | } |
| 2926 | |
| 2927 | /** |
| 2928 | * wmi_unified_connect_htc_service() - WMI API to get connect to HTC service |
| 2929 | * |
| 2930 | * @wmi_handle: handle to WMI. |
| 2931 | * |
| 2932 | * @Return: status. |
| 2933 | */ |
| 2934 | QDF_STATUS |
| 2935 | wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle, |
| 2936 | void *htc_handle) |
| 2937 | { |
| 2938 | uint32_t i; |
| 2939 | uint8_t wmi_ep_count; |
| 2940 | |
| 2941 | wmi_handle->soc->htc_handle = htc_handle; |
| 2942 | |
| 2943 | wmi_ep_count = htc_get_wmi_endpoint_count(htc_handle); |
| 2944 | if (wmi_ep_count > WMI_MAX_RADIOS) |
| 2945 | return QDF_STATUS_E_FAULT; |
| 2946 | |
| 2947 | for (i = 0; i < wmi_ep_count; i++) |
| 2948 | wmi_connect_pdev_htc_service(wmi_handle->soc, i); |
| 2949 | |
| 2950 | wmi_handle->htc_handle = htc_handle; |
| 2951 | wmi_handle->wmi_endpoint_id = wmi_handle->soc->wmi_endpoint_id[0]; |
| 2952 | wmi_handle->max_msg_len = wmi_handle->soc->max_msg_len[0]; |
| 2953 | |
| 2954 | return QDF_STATUS_SUCCESS; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2955 | } |
| 2956 | |
| 2957 | /** |
| 2958 | * wmi_get_host_credits() - WMI API to get updated host_credits |
| 2959 | * |
| 2960 | * @wmi_handle: handle to WMI. |
| 2961 | * |
| 2962 | * @Return: updated host_credits. |
| 2963 | */ |
| 2964 | int wmi_get_host_credits(wmi_unified_t wmi_handle) |
| 2965 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2966 | int host_credits = 0; |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2967 | |
| 2968 | htc_get_control_endpoint_tx_host_credits(wmi_handle->htc_handle, |
| 2969 | &host_credits); |
| 2970 | return host_credits; |
| 2971 | } |
| 2972 | |
| 2973 | /** |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 2974 | * wmi_get_pending_cmds() - WMI API to get WMI Pending Commands in the HTC |
| 2975 | * queue |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2976 | * |
| 2977 | * @wmi_handle: handle to WMI. |
| 2978 | * |
| 2979 | * @Return: Pending Commands in the HTC queue. |
| 2980 | */ |
| 2981 | int wmi_get_pending_cmds(wmi_unified_t wmi_handle) |
| 2982 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2983 | return qdf_atomic_read(&wmi_handle->pending_cmds); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2984 | } |
| 2985 | |
| 2986 | /** |
| 2987 | * wmi_set_target_suspend() - WMI API to set target suspend state |
| 2988 | * |
| 2989 | * @wmi_handle: handle to WMI. |
| 2990 | * @val: suspend state boolean. |
| 2991 | * |
| 2992 | * @Return: none. |
| 2993 | */ |
| 2994 | void wmi_set_target_suspend(wmi_unified_t wmi_handle, A_BOOL val) |
| 2995 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2996 | qdf_atomic_set(&wmi_handle->is_target_suspended, val); |
Govind Singh | 6b411b5 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 2997 | } |
| 2998 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 2999 | /** |
| 3000 | * WMI API to set crash injection state |
| 3001 | * @param wmi_handle: handle to WMI. |
| 3002 | * @param val: crash injection state boolean. |
| 3003 | */ |
| 3004 | void wmi_tag_crash_inject(wmi_unified_t wmi_handle, A_BOOL flag) |
| 3005 | { |
| 3006 | wmi_handle->tag_crash_inject = flag; |
| 3007 | } |
| 3008 | |
| 3009 | /** |
| 3010 | * WMI API to set bus suspend state |
| 3011 | * @param wmi_handle: handle to WMI. |
| 3012 | * @param val: suspend state boolean. |
| 3013 | */ |
| 3014 | void wmi_set_is_wow_bus_suspended(wmi_unified_t wmi_handle, A_BOOL val) |
| 3015 | { |
| 3016 | qdf_atomic_set(&wmi_handle->is_wow_bus_suspended, val); |
| 3017 | } |
| 3018 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 3019 | #ifndef CONFIG_MCL |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 3020 | /** |
| 3021 | * API to flush all the previous packets associated with the wmi endpoint |
| 3022 | * |
| 3023 | * @param wmi_handle : handle to WMI. |
| 3024 | */ |
| 3025 | void |
| 3026 | wmi_flush_endpoint(wmi_unified_t wmi_handle) |
| 3027 | { |
| 3028 | htc_flush_endpoint(wmi_handle->htc_handle, |
| 3029 | wmi_handle->wmi_endpoint_id, 0); |
| 3030 | } |
| 3031 | |
| 3032 | /** |
| 3033 | * generic function to block unified WMI command |
| 3034 | * @param wmi_handle : handle to WMI. |
| 3035 | * @return 0 on success and -ve on failure. |
| 3036 | */ |
| 3037 | int |
| 3038 | wmi_stop(wmi_unified_t wmi_handle) |
| 3039 | { |
| 3040 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 3041 | "WMI Stop\n"); |
| 3042 | wmi_handle->wmi_stopinprogress = 1; |
| 3043 | return 0; |
| 3044 | } |
| 3045 | #endif |