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