xref: /openbmc/linux/drivers/net/wireless/ath/ath10k/wmi.h (revision 5f32c314)
1 /*
2  * Copyright (c) 2005-2011 Atheros Communications Inc.
3  * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef _WMI_H_
19 #define _WMI_H_
20 
21 #include <linux/types.h>
22 #include <net/mac80211.h>
23 
24 /*
25  * This file specifies the WMI interface for the Unified Software
26  * Architecture.
27  *
28  * It includes definitions of all the commands and events. Commands are
29  * messages from the host to the target. Events and Replies are messages
30  * from the target to the host.
31  *
32  * Ownership of correctness in regards to WMI commands belongs to the host
33  * driver and the target is not required to validate parameters for value,
34  * proper range, or any other checking.
35  *
36  * Guidelines for extending this interface are below.
37  *
38  * 1. Add new WMI commands ONLY within the specified range - 0x9000 - 0x9fff
39  *
40  * 2. Use ONLY u32 type for defining member variables within WMI
41  *    command/event structures. Do not use u8, u16, bool or
42  *    enum types within these structures.
43  *
44  * 3. DO NOT define bit fields within structures. Implement bit fields
45  *    using masks if necessary. Do not use the programming language's bit
46  *    field definition.
47  *
48  * 4. Define macros for encode/decode of u8, u16 fields within
49  *    the u32 variables. Use these macros for set/get of these fields.
50  *    Try to use this to optimize the structure without bloating it with
51  *    u32 variables for every lower sized field.
52  *
53  * 5. Do not use PACK/UNPACK attributes for the structures as each member
54  *    variable is already 4-byte aligned by virtue of being a u32
55  *    type.
56  *
57  * 6. Comment each parameter part of the WMI command/event structure by
58  *    using the 2 stars at the begining of C comment instead of one star to
59  *    enable HTML document generation using Doxygen.
60  *
61  */
62 
63 /* Control Path */
64 struct wmi_cmd_hdr {
65 	__le32 cmd_id;
66 } __packed;
67 
68 #define WMI_CMD_HDR_CMD_ID_MASK   0x00FFFFFF
69 #define WMI_CMD_HDR_CMD_ID_LSB    0
70 #define WMI_CMD_HDR_PLT_PRIV_MASK 0xFF000000
71 #define WMI_CMD_HDR_PLT_PRIV_LSB  24
72 
73 #define HTC_PROTOCOL_VERSION    0x0002
74 #define WMI_PROTOCOL_VERSION    0x0002
75 
76 enum wmi_service_id {
77 	WMI_SERVICE_BEACON_OFFLOAD = 0,   /* beacon offload */
78 	WMI_SERVICE_SCAN_OFFLOAD,	  /* scan offload */
79 	WMI_SERVICE_ROAM_OFFLOAD,	  /* roam offload */
80 	WMI_SERVICE_BCN_MISS_OFFLOAD,     /* beacon miss offload */
81 	WMI_SERVICE_STA_PWRSAVE,	  /* fake sleep + basic power save */
82 	WMI_SERVICE_STA_ADVANCED_PWRSAVE, /* uapsd, pspoll, force sleep */
83 	WMI_SERVICE_AP_UAPSD,		  /* uapsd on AP */
84 	WMI_SERVICE_AP_DFS,		  /* DFS on AP */
85 	WMI_SERVICE_11AC,		  /* supports 11ac */
86 	WMI_SERVICE_BLOCKACK,	/* Supports triggering ADDBA/DELBA from host*/
87 	WMI_SERVICE_PHYERR,		  /* PHY error */
88 	WMI_SERVICE_BCN_FILTER,		  /* Beacon filter support */
89 	WMI_SERVICE_RTT,		  /* RTT (round trip time) support */
90 	WMI_SERVICE_RATECTRL,		  /* Rate-control */
91 	WMI_SERVICE_WOW,		  /* WOW Support */
92 	WMI_SERVICE_RATECTRL_CACHE,       /* Rate-control caching */
93 	WMI_SERVICE_IRAM_TIDS,            /* TIDs in IRAM */
94 	WMI_SERVICE_ARPNS_OFFLOAD,	  /* ARP NS Offload support */
95 	WMI_SERVICE_NLO,		  /* Network list offload service */
96 	WMI_SERVICE_GTK_OFFLOAD,	  /* GTK offload */
97 	WMI_SERVICE_SCAN_SCH,		  /* Scan Scheduler Service */
98 	WMI_SERVICE_CSA_OFFLOAD,	  /* CSA offload service */
99 	WMI_SERVICE_CHATTER,		  /* Chatter service */
100 	WMI_SERVICE_COEX_FREQAVOID,	  /* FW report freq range to avoid */
101 	WMI_SERVICE_PACKET_POWER_SAVE,	  /* packet power save service */
102 	WMI_SERVICE_FORCE_FW_HANG,        /* To test fw recovery mechanism */
103 	WMI_SERVICE_GPIO,                 /* GPIO service */
104 	WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM, /* Modulated DTIM support */
105 	WMI_STA_UAPSD_BASIC_AUTO_TRIG,    /* UAPSD AC Trigger Generation  */
106 	WMI_STA_UAPSD_VAR_AUTO_TRIG,      /* -do- */
107 	WMI_SERVICE_STA_KEEP_ALIVE,       /* STA keep alive mechanism support */
108 	WMI_SERVICE_TX_ENCAP,             /* Packet type for TX encapsulation */
109 
110 	WMI_SERVICE_LAST,
111 	WMI_MAX_SERVICE = 64		  /* max service */
112 };
113 
114 static inline char *wmi_service_name(int service_id)
115 {
116 	switch (service_id) {
117 	case WMI_SERVICE_BEACON_OFFLOAD:
118 		return "BEACON_OFFLOAD";
119 	case WMI_SERVICE_SCAN_OFFLOAD:
120 		return "SCAN_OFFLOAD";
121 	case WMI_SERVICE_ROAM_OFFLOAD:
122 		return "ROAM_OFFLOAD";
123 	case WMI_SERVICE_BCN_MISS_OFFLOAD:
124 		return "BCN_MISS_OFFLOAD";
125 	case WMI_SERVICE_STA_PWRSAVE:
126 		return "STA_PWRSAVE";
127 	case WMI_SERVICE_STA_ADVANCED_PWRSAVE:
128 		return "STA_ADVANCED_PWRSAVE";
129 	case WMI_SERVICE_AP_UAPSD:
130 		return "AP_UAPSD";
131 	case WMI_SERVICE_AP_DFS:
132 		return "AP_DFS";
133 	case WMI_SERVICE_11AC:
134 		return "11AC";
135 	case WMI_SERVICE_BLOCKACK:
136 		return "BLOCKACK";
137 	case WMI_SERVICE_PHYERR:
138 		return "PHYERR";
139 	case WMI_SERVICE_BCN_FILTER:
140 		return "BCN_FILTER";
141 	case WMI_SERVICE_RTT:
142 		return "RTT";
143 	case WMI_SERVICE_RATECTRL:
144 		return "RATECTRL";
145 	case WMI_SERVICE_WOW:
146 		return "WOW";
147 	case WMI_SERVICE_RATECTRL_CACHE:
148 		return "RATECTRL CACHE";
149 	case WMI_SERVICE_IRAM_TIDS:
150 		return "IRAM TIDS";
151 	case WMI_SERVICE_ARPNS_OFFLOAD:
152 		return "ARPNS_OFFLOAD";
153 	case WMI_SERVICE_NLO:
154 		return "NLO";
155 	case WMI_SERVICE_GTK_OFFLOAD:
156 		return "GTK_OFFLOAD";
157 	case WMI_SERVICE_SCAN_SCH:
158 		return "SCAN_SCH";
159 	case WMI_SERVICE_CSA_OFFLOAD:
160 		return "CSA_OFFLOAD";
161 	case WMI_SERVICE_CHATTER:
162 		return "CHATTER";
163 	case WMI_SERVICE_COEX_FREQAVOID:
164 		return "COEX_FREQAVOID";
165 	case WMI_SERVICE_PACKET_POWER_SAVE:
166 		return "PACKET_POWER_SAVE";
167 	case WMI_SERVICE_FORCE_FW_HANG:
168 		return "FORCE FW HANG";
169 	case WMI_SERVICE_GPIO:
170 		return "GPIO";
171 	case WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM:
172 		return "MODULATED DTIM";
173 	case WMI_STA_UAPSD_BASIC_AUTO_TRIG:
174 		return "BASIC UAPSD";
175 	case WMI_STA_UAPSD_VAR_AUTO_TRIG:
176 		return "VAR UAPSD";
177 	case WMI_SERVICE_STA_KEEP_ALIVE:
178 		return "STA KEEP ALIVE";
179 	case WMI_SERVICE_TX_ENCAP:
180 		return "TX ENCAP";
181 	default:
182 		return "UNKNOWN SERVICE\n";
183 	}
184 }
185 
186 
187 #define WMI_SERVICE_BM_SIZE \
188 	((WMI_MAX_SERVICE + sizeof(u32) - 1)/sizeof(u32))
189 
190 /* 2 word representation of MAC addr */
191 struct wmi_mac_addr {
192 	union {
193 		u8 addr[6];
194 		struct {
195 			u32 word0;
196 			u32 word1;
197 		} __packed;
198 	} __packed;
199 } __packed;
200 
201 /* macro to convert MAC address from WMI word format to char array */
202 #define WMI_MAC_ADDR_TO_CHAR_ARRAY(pwmi_mac_addr, c_macaddr) do { \
203 	(c_macaddr)[0] =  ((pwmi_mac_addr)->word0) & 0xff; \
204 	(c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
205 	(c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
206 	(c_macaddr)[3] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
207 	(c_macaddr)[4] =  ((pwmi_mac_addr)->word1) & 0xff; \
208 	(c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \
209 	} while (0)
210 
211 struct wmi_cmd_map {
212 	u32 init_cmdid;
213 	u32 start_scan_cmdid;
214 	u32 stop_scan_cmdid;
215 	u32 scan_chan_list_cmdid;
216 	u32 scan_sch_prio_tbl_cmdid;
217 	u32 pdev_set_regdomain_cmdid;
218 	u32 pdev_set_channel_cmdid;
219 	u32 pdev_set_param_cmdid;
220 	u32 pdev_pktlog_enable_cmdid;
221 	u32 pdev_pktlog_disable_cmdid;
222 	u32 pdev_set_wmm_params_cmdid;
223 	u32 pdev_set_ht_cap_ie_cmdid;
224 	u32 pdev_set_vht_cap_ie_cmdid;
225 	u32 pdev_set_dscp_tid_map_cmdid;
226 	u32 pdev_set_quiet_mode_cmdid;
227 	u32 pdev_green_ap_ps_enable_cmdid;
228 	u32 pdev_get_tpc_config_cmdid;
229 	u32 pdev_set_base_macaddr_cmdid;
230 	u32 vdev_create_cmdid;
231 	u32 vdev_delete_cmdid;
232 	u32 vdev_start_request_cmdid;
233 	u32 vdev_restart_request_cmdid;
234 	u32 vdev_up_cmdid;
235 	u32 vdev_stop_cmdid;
236 	u32 vdev_down_cmdid;
237 	u32 vdev_set_param_cmdid;
238 	u32 vdev_install_key_cmdid;
239 	u32 peer_create_cmdid;
240 	u32 peer_delete_cmdid;
241 	u32 peer_flush_tids_cmdid;
242 	u32 peer_set_param_cmdid;
243 	u32 peer_assoc_cmdid;
244 	u32 peer_add_wds_entry_cmdid;
245 	u32 peer_remove_wds_entry_cmdid;
246 	u32 peer_mcast_group_cmdid;
247 	u32 bcn_tx_cmdid;
248 	u32 pdev_send_bcn_cmdid;
249 	u32 bcn_tmpl_cmdid;
250 	u32 bcn_filter_rx_cmdid;
251 	u32 prb_req_filter_rx_cmdid;
252 	u32 mgmt_tx_cmdid;
253 	u32 prb_tmpl_cmdid;
254 	u32 addba_clear_resp_cmdid;
255 	u32 addba_send_cmdid;
256 	u32 addba_status_cmdid;
257 	u32 delba_send_cmdid;
258 	u32 addba_set_resp_cmdid;
259 	u32 send_singleamsdu_cmdid;
260 	u32 sta_powersave_mode_cmdid;
261 	u32 sta_powersave_param_cmdid;
262 	u32 sta_mimo_ps_mode_cmdid;
263 	u32 pdev_dfs_enable_cmdid;
264 	u32 pdev_dfs_disable_cmdid;
265 	u32 roam_scan_mode;
266 	u32 roam_scan_rssi_threshold;
267 	u32 roam_scan_period;
268 	u32 roam_scan_rssi_change_threshold;
269 	u32 roam_ap_profile;
270 	u32 ofl_scan_add_ap_profile;
271 	u32 ofl_scan_remove_ap_profile;
272 	u32 ofl_scan_period;
273 	u32 p2p_dev_set_device_info;
274 	u32 p2p_dev_set_discoverability;
275 	u32 p2p_go_set_beacon_ie;
276 	u32 p2p_go_set_probe_resp_ie;
277 	u32 p2p_set_vendor_ie_data_cmdid;
278 	u32 ap_ps_peer_param_cmdid;
279 	u32 ap_ps_peer_uapsd_coex_cmdid;
280 	u32 peer_rate_retry_sched_cmdid;
281 	u32 wlan_profile_trigger_cmdid;
282 	u32 wlan_profile_set_hist_intvl_cmdid;
283 	u32 wlan_profile_get_profile_data_cmdid;
284 	u32 wlan_profile_enable_profile_id_cmdid;
285 	u32 wlan_profile_list_profile_id_cmdid;
286 	u32 pdev_suspend_cmdid;
287 	u32 pdev_resume_cmdid;
288 	u32 add_bcn_filter_cmdid;
289 	u32 rmv_bcn_filter_cmdid;
290 	u32 wow_add_wake_pattern_cmdid;
291 	u32 wow_del_wake_pattern_cmdid;
292 	u32 wow_enable_disable_wake_event_cmdid;
293 	u32 wow_enable_cmdid;
294 	u32 wow_hostwakeup_from_sleep_cmdid;
295 	u32 rtt_measreq_cmdid;
296 	u32 rtt_tsf_cmdid;
297 	u32 vdev_spectral_scan_configure_cmdid;
298 	u32 vdev_spectral_scan_enable_cmdid;
299 	u32 request_stats_cmdid;
300 	u32 set_arp_ns_offload_cmdid;
301 	u32 network_list_offload_config_cmdid;
302 	u32 gtk_offload_cmdid;
303 	u32 csa_offload_enable_cmdid;
304 	u32 csa_offload_chanswitch_cmdid;
305 	u32 chatter_set_mode_cmdid;
306 	u32 peer_tid_addba_cmdid;
307 	u32 peer_tid_delba_cmdid;
308 	u32 sta_dtim_ps_method_cmdid;
309 	u32 sta_uapsd_auto_trig_cmdid;
310 	u32 sta_keepalive_cmd;
311 	u32 echo_cmdid;
312 	u32 pdev_utf_cmdid;
313 	u32 dbglog_cfg_cmdid;
314 	u32 pdev_qvit_cmdid;
315 	u32 pdev_ftm_intg_cmdid;
316 	u32 vdev_set_keepalive_cmdid;
317 	u32 vdev_get_keepalive_cmdid;
318 	u32 force_fw_hang_cmdid;
319 	u32 gpio_config_cmdid;
320 	u32 gpio_output_cmdid;
321 };
322 
323 /*
324  * wmi command groups.
325  */
326 enum wmi_cmd_group {
327 	/* 0 to 2 are reserved */
328 	WMI_GRP_START = 0x3,
329 	WMI_GRP_SCAN = WMI_GRP_START,
330 	WMI_GRP_PDEV,
331 	WMI_GRP_VDEV,
332 	WMI_GRP_PEER,
333 	WMI_GRP_MGMT,
334 	WMI_GRP_BA_NEG,
335 	WMI_GRP_STA_PS,
336 	WMI_GRP_DFS,
337 	WMI_GRP_ROAM,
338 	WMI_GRP_OFL_SCAN,
339 	WMI_GRP_P2P,
340 	WMI_GRP_AP_PS,
341 	WMI_GRP_RATE_CTRL,
342 	WMI_GRP_PROFILE,
343 	WMI_GRP_SUSPEND,
344 	WMI_GRP_BCN_FILTER,
345 	WMI_GRP_WOW,
346 	WMI_GRP_RTT,
347 	WMI_GRP_SPECTRAL,
348 	WMI_GRP_STATS,
349 	WMI_GRP_ARP_NS_OFL,
350 	WMI_GRP_NLO_OFL,
351 	WMI_GRP_GTK_OFL,
352 	WMI_GRP_CSA_OFL,
353 	WMI_GRP_CHATTER,
354 	WMI_GRP_TID_ADDBA,
355 	WMI_GRP_MISC,
356 	WMI_GRP_GPIO,
357 };
358 
359 #define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
360 #define WMI_EVT_GRP_START_ID(grp_id) (((grp_id) << 12) | 0x1)
361 
362 #define WMI_CMD_UNSUPPORTED 0
363 
364 /* Command IDs and command events for MAIN FW. */
365 enum wmi_cmd_id {
366 	WMI_INIT_CMDID = 0x1,
367 
368 	/* Scan specific commands */
369 	WMI_START_SCAN_CMDID = WMI_CMD_GRP(WMI_GRP_SCAN),
370 	WMI_STOP_SCAN_CMDID,
371 	WMI_SCAN_CHAN_LIST_CMDID,
372 	WMI_SCAN_SCH_PRIO_TBL_CMDID,
373 
374 	/* PDEV (physical device) specific commands */
375 	WMI_PDEV_SET_REGDOMAIN_CMDID = WMI_CMD_GRP(WMI_GRP_PDEV),
376 	WMI_PDEV_SET_CHANNEL_CMDID,
377 	WMI_PDEV_SET_PARAM_CMDID,
378 	WMI_PDEV_PKTLOG_ENABLE_CMDID,
379 	WMI_PDEV_PKTLOG_DISABLE_CMDID,
380 	WMI_PDEV_SET_WMM_PARAMS_CMDID,
381 	WMI_PDEV_SET_HT_CAP_IE_CMDID,
382 	WMI_PDEV_SET_VHT_CAP_IE_CMDID,
383 	WMI_PDEV_SET_DSCP_TID_MAP_CMDID,
384 	WMI_PDEV_SET_QUIET_MODE_CMDID,
385 	WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID,
386 	WMI_PDEV_GET_TPC_CONFIG_CMDID,
387 	WMI_PDEV_SET_BASE_MACADDR_CMDID,
388 
389 	/* VDEV (virtual device) specific commands */
390 	WMI_VDEV_CREATE_CMDID = WMI_CMD_GRP(WMI_GRP_VDEV),
391 	WMI_VDEV_DELETE_CMDID,
392 	WMI_VDEV_START_REQUEST_CMDID,
393 	WMI_VDEV_RESTART_REQUEST_CMDID,
394 	WMI_VDEV_UP_CMDID,
395 	WMI_VDEV_STOP_CMDID,
396 	WMI_VDEV_DOWN_CMDID,
397 	WMI_VDEV_SET_PARAM_CMDID,
398 	WMI_VDEV_INSTALL_KEY_CMDID,
399 
400 	/* peer specific commands */
401 	WMI_PEER_CREATE_CMDID = WMI_CMD_GRP(WMI_GRP_PEER),
402 	WMI_PEER_DELETE_CMDID,
403 	WMI_PEER_FLUSH_TIDS_CMDID,
404 	WMI_PEER_SET_PARAM_CMDID,
405 	WMI_PEER_ASSOC_CMDID,
406 	WMI_PEER_ADD_WDS_ENTRY_CMDID,
407 	WMI_PEER_REMOVE_WDS_ENTRY_CMDID,
408 	WMI_PEER_MCAST_GROUP_CMDID,
409 
410 	/* beacon/management specific commands */
411 	WMI_BCN_TX_CMDID = WMI_CMD_GRP(WMI_GRP_MGMT),
412 	WMI_PDEV_SEND_BCN_CMDID,
413 	WMI_BCN_TMPL_CMDID,
414 	WMI_BCN_FILTER_RX_CMDID,
415 	WMI_PRB_REQ_FILTER_RX_CMDID,
416 	WMI_MGMT_TX_CMDID,
417 	WMI_PRB_TMPL_CMDID,
418 
419 	/* commands to directly control BA negotiation directly from host. */
420 	WMI_ADDBA_CLEAR_RESP_CMDID = WMI_CMD_GRP(WMI_GRP_BA_NEG),
421 	WMI_ADDBA_SEND_CMDID,
422 	WMI_ADDBA_STATUS_CMDID,
423 	WMI_DELBA_SEND_CMDID,
424 	WMI_ADDBA_SET_RESP_CMDID,
425 	WMI_SEND_SINGLEAMSDU_CMDID,
426 
427 	/* Station power save specific config */
428 	WMI_STA_POWERSAVE_MODE_CMDID = WMI_CMD_GRP(WMI_GRP_STA_PS),
429 	WMI_STA_POWERSAVE_PARAM_CMDID,
430 	WMI_STA_MIMO_PS_MODE_CMDID,
431 
432 	/** DFS-specific commands */
433 	WMI_PDEV_DFS_ENABLE_CMDID = WMI_CMD_GRP(WMI_GRP_DFS),
434 	WMI_PDEV_DFS_DISABLE_CMDID,
435 
436 	/* Roaming specific  commands */
437 	WMI_ROAM_SCAN_MODE = WMI_CMD_GRP(WMI_GRP_ROAM),
438 	WMI_ROAM_SCAN_RSSI_THRESHOLD,
439 	WMI_ROAM_SCAN_PERIOD,
440 	WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
441 	WMI_ROAM_AP_PROFILE,
442 
443 	/* offload scan specific commands */
444 	WMI_OFL_SCAN_ADD_AP_PROFILE = WMI_CMD_GRP(WMI_GRP_OFL_SCAN),
445 	WMI_OFL_SCAN_REMOVE_AP_PROFILE,
446 	WMI_OFL_SCAN_PERIOD,
447 
448 	/* P2P specific commands */
449 	WMI_P2P_DEV_SET_DEVICE_INFO = WMI_CMD_GRP(WMI_GRP_P2P),
450 	WMI_P2P_DEV_SET_DISCOVERABILITY,
451 	WMI_P2P_GO_SET_BEACON_IE,
452 	WMI_P2P_GO_SET_PROBE_RESP_IE,
453 	WMI_P2P_SET_VENDOR_IE_DATA_CMDID,
454 
455 	/* AP power save specific config */
456 	WMI_AP_PS_PEER_PARAM_CMDID = WMI_CMD_GRP(WMI_GRP_AP_PS),
457 	WMI_AP_PS_PEER_UAPSD_COEX_CMDID,
458 
459 	/* Rate-control specific commands */
460 	WMI_PEER_RATE_RETRY_SCHED_CMDID =
461 	WMI_CMD_GRP(WMI_GRP_RATE_CTRL),
462 
463 	/* WLAN Profiling commands. */
464 	WMI_WLAN_PROFILE_TRIGGER_CMDID = WMI_CMD_GRP(WMI_GRP_PROFILE),
465 	WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
466 	WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
467 	WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
468 	WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
469 
470 	/* Suspend resume command Ids */
471 	WMI_PDEV_SUSPEND_CMDID = WMI_CMD_GRP(WMI_GRP_SUSPEND),
472 	WMI_PDEV_RESUME_CMDID,
473 
474 	/* Beacon filter commands */
475 	WMI_ADD_BCN_FILTER_CMDID = WMI_CMD_GRP(WMI_GRP_BCN_FILTER),
476 	WMI_RMV_BCN_FILTER_CMDID,
477 
478 	/* WOW Specific WMI commands*/
479 	WMI_WOW_ADD_WAKE_PATTERN_CMDID = WMI_CMD_GRP(WMI_GRP_WOW),
480 	WMI_WOW_DEL_WAKE_PATTERN_CMDID,
481 	WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
482 	WMI_WOW_ENABLE_CMDID,
483 	WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
484 
485 	/* RTT measurement related cmd */
486 	WMI_RTT_MEASREQ_CMDID = WMI_CMD_GRP(WMI_GRP_RTT),
487 	WMI_RTT_TSF_CMDID,
488 
489 	/* spectral scan commands */
490 	WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID = WMI_CMD_GRP(WMI_GRP_SPECTRAL),
491 	WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
492 
493 	/* F/W stats */
494 	WMI_REQUEST_STATS_CMDID = WMI_CMD_GRP(WMI_GRP_STATS),
495 
496 	/* ARP OFFLOAD REQUEST*/
497 	WMI_SET_ARP_NS_OFFLOAD_CMDID = WMI_CMD_GRP(WMI_GRP_ARP_NS_OFL),
498 
499 	/* NS offload confid*/
500 	WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID = WMI_CMD_GRP(WMI_GRP_NLO_OFL),
501 
502 	/* GTK offload Specific WMI commands*/
503 	WMI_GTK_OFFLOAD_CMDID = WMI_CMD_GRP(WMI_GRP_GTK_OFL),
504 
505 	/* CSA offload Specific WMI commands*/
506 	WMI_CSA_OFFLOAD_ENABLE_CMDID = WMI_CMD_GRP(WMI_GRP_CSA_OFL),
507 	WMI_CSA_OFFLOAD_CHANSWITCH_CMDID,
508 
509 	/* Chatter commands*/
510 	WMI_CHATTER_SET_MODE_CMDID = WMI_CMD_GRP(WMI_GRP_CHATTER),
511 
512 	/* addba specific commands */
513 	WMI_PEER_TID_ADDBA_CMDID = WMI_CMD_GRP(WMI_GRP_TID_ADDBA),
514 	WMI_PEER_TID_DELBA_CMDID,
515 
516 	/* set station mimo powersave method */
517 	WMI_STA_DTIM_PS_METHOD_CMDID,
518 	/* Configure the Station UAPSD AC Auto Trigger Parameters */
519 	WMI_STA_UAPSD_AUTO_TRIG_CMDID,
520 
521 	/* STA Keep alive parameter configuration,
522 	   Requires WMI_SERVICE_STA_KEEP_ALIVE */
523 	WMI_STA_KEEPALIVE_CMD,
524 
525 	/* misc command group */
526 	WMI_ECHO_CMDID = WMI_CMD_GRP(WMI_GRP_MISC),
527 	WMI_PDEV_UTF_CMDID,
528 	WMI_DBGLOG_CFG_CMDID,
529 	WMI_PDEV_QVIT_CMDID,
530 	WMI_PDEV_FTM_INTG_CMDID,
531 	WMI_VDEV_SET_KEEPALIVE_CMDID,
532 	WMI_VDEV_GET_KEEPALIVE_CMDID,
533 	WMI_FORCE_FW_HANG_CMDID,
534 
535 	/* GPIO Configuration */
536 	WMI_GPIO_CONFIG_CMDID = WMI_CMD_GRP(WMI_GRP_GPIO),
537 	WMI_GPIO_OUTPUT_CMDID,
538 };
539 
540 enum wmi_event_id {
541 	WMI_SERVICE_READY_EVENTID = 0x1,
542 	WMI_READY_EVENTID,
543 
544 	/* Scan specific events */
545 	WMI_SCAN_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_SCAN),
546 
547 	/* PDEV specific events */
548 	WMI_PDEV_TPC_CONFIG_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_PDEV),
549 	WMI_CHAN_INFO_EVENTID,
550 	WMI_PHYERR_EVENTID,
551 
552 	/* VDEV specific events */
553 	WMI_VDEV_START_RESP_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_VDEV),
554 	WMI_VDEV_STOPPED_EVENTID,
555 	WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID,
556 
557 	/* peer specific events */
558 	WMI_PEER_STA_KICKOUT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_PEER),
559 
560 	/* beacon/mgmt specific events */
561 	WMI_MGMT_RX_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_MGMT),
562 	WMI_HOST_SWBA_EVENTID,
563 	WMI_TBTTOFFSET_UPDATE_EVENTID,
564 
565 	/* ADDBA Related WMI Events*/
566 	WMI_TX_DELBA_COMPLETE_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_BA_NEG),
567 	WMI_TX_ADDBA_COMPLETE_EVENTID,
568 
569 	/* Roam event to trigger roaming on host */
570 	WMI_ROAM_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_ROAM),
571 	WMI_PROFILE_MATCH,
572 
573 	/* WoW */
574 	WMI_WOW_WAKEUP_HOST_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_WOW),
575 
576 	/* RTT */
577 	WMI_RTT_MEASUREMENT_REPORT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_RTT),
578 	WMI_TSF_MEASUREMENT_REPORT_EVENTID,
579 	WMI_RTT_ERROR_REPORT_EVENTID,
580 
581 	/* GTK offload */
582 	WMI_GTK_OFFLOAD_STATUS_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_GTK_OFL),
583 	WMI_GTK_REKEY_FAIL_EVENTID,
584 
585 	/* CSA IE received event */
586 	WMI_CSA_HANDLING_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_CSA_OFL),
587 
588 	/* Misc events */
589 	WMI_ECHO_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_MISC),
590 	WMI_PDEV_UTF_EVENTID,
591 	WMI_DEBUG_MESG_EVENTID,
592 	WMI_UPDATE_STATS_EVENTID,
593 	WMI_DEBUG_PRINT_EVENTID,
594 	WMI_DCS_INTERFERENCE_EVENTID,
595 	WMI_PDEV_QVIT_EVENTID,
596 	WMI_WLAN_PROFILE_DATA_EVENTID,
597 	WMI_PDEV_FTM_INTG_EVENTID,
598 	WMI_WLAN_FREQ_AVOID_EVENTID,
599 	WMI_VDEV_GET_KEEPALIVE_EVENTID,
600 
601 	/* GPIO Event */
602 	WMI_GPIO_INPUT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_GPIO),
603 };
604 
605 /* Command IDs and command events for 10.X firmware */
606 enum wmi_10x_cmd_id {
607 	WMI_10X_START_CMDID = 0x9000,
608 	WMI_10X_END_CMDID = 0x9FFF,
609 
610 	/* initialize the wlan sub system */
611 	WMI_10X_INIT_CMDID,
612 
613 	/* Scan specific commands */
614 
615 	WMI_10X_START_SCAN_CMDID = WMI_10X_START_CMDID,
616 	WMI_10X_STOP_SCAN_CMDID,
617 	WMI_10X_SCAN_CHAN_LIST_CMDID,
618 	WMI_10X_ECHO_CMDID,
619 
620 	/* PDEV(physical device) specific commands */
621 	WMI_10X_PDEV_SET_REGDOMAIN_CMDID,
622 	WMI_10X_PDEV_SET_CHANNEL_CMDID,
623 	WMI_10X_PDEV_SET_PARAM_CMDID,
624 	WMI_10X_PDEV_PKTLOG_ENABLE_CMDID,
625 	WMI_10X_PDEV_PKTLOG_DISABLE_CMDID,
626 	WMI_10X_PDEV_SET_WMM_PARAMS_CMDID,
627 	WMI_10X_PDEV_SET_HT_CAP_IE_CMDID,
628 	WMI_10X_PDEV_SET_VHT_CAP_IE_CMDID,
629 	WMI_10X_PDEV_SET_BASE_MACADDR_CMDID,
630 	WMI_10X_PDEV_SET_DSCP_TID_MAP_CMDID,
631 	WMI_10X_PDEV_SET_QUIET_MODE_CMDID,
632 	WMI_10X_PDEV_GREEN_AP_PS_ENABLE_CMDID,
633 	WMI_10X_PDEV_GET_TPC_CONFIG_CMDID,
634 
635 	/* VDEV(virtual device) specific commands */
636 	WMI_10X_VDEV_CREATE_CMDID,
637 	WMI_10X_VDEV_DELETE_CMDID,
638 	WMI_10X_VDEV_START_REQUEST_CMDID,
639 	WMI_10X_VDEV_RESTART_REQUEST_CMDID,
640 	WMI_10X_VDEV_UP_CMDID,
641 	WMI_10X_VDEV_STOP_CMDID,
642 	WMI_10X_VDEV_DOWN_CMDID,
643 	WMI_10X_VDEV_STANDBY_RESPONSE_CMDID,
644 	WMI_10X_VDEV_RESUME_RESPONSE_CMDID,
645 	WMI_10X_VDEV_SET_PARAM_CMDID,
646 	WMI_10X_VDEV_INSTALL_KEY_CMDID,
647 
648 	/* peer specific commands */
649 	WMI_10X_PEER_CREATE_CMDID,
650 	WMI_10X_PEER_DELETE_CMDID,
651 	WMI_10X_PEER_FLUSH_TIDS_CMDID,
652 	WMI_10X_PEER_SET_PARAM_CMDID,
653 	WMI_10X_PEER_ASSOC_CMDID,
654 	WMI_10X_PEER_ADD_WDS_ENTRY_CMDID,
655 	WMI_10X_PEER_REMOVE_WDS_ENTRY_CMDID,
656 	WMI_10X_PEER_MCAST_GROUP_CMDID,
657 
658 	/* beacon/management specific commands */
659 
660 	WMI_10X_BCN_TX_CMDID,
661 	WMI_10X_BCN_PRB_TMPL_CMDID,
662 	WMI_10X_BCN_FILTER_RX_CMDID,
663 	WMI_10X_PRB_REQ_FILTER_RX_CMDID,
664 	WMI_10X_MGMT_TX_CMDID,
665 
666 	/* commands to directly control ba negotiation directly from host. */
667 	WMI_10X_ADDBA_CLEAR_RESP_CMDID,
668 	WMI_10X_ADDBA_SEND_CMDID,
669 	WMI_10X_ADDBA_STATUS_CMDID,
670 	WMI_10X_DELBA_SEND_CMDID,
671 	WMI_10X_ADDBA_SET_RESP_CMDID,
672 	WMI_10X_SEND_SINGLEAMSDU_CMDID,
673 
674 	/* Station power save specific config */
675 	WMI_10X_STA_POWERSAVE_MODE_CMDID,
676 	WMI_10X_STA_POWERSAVE_PARAM_CMDID,
677 	WMI_10X_STA_MIMO_PS_MODE_CMDID,
678 
679 	/* set debug log config */
680 	WMI_10X_DBGLOG_CFG_CMDID,
681 
682 	/* DFS-specific commands */
683 	WMI_10X_PDEV_DFS_ENABLE_CMDID,
684 	WMI_10X_PDEV_DFS_DISABLE_CMDID,
685 
686 	/* QVIT specific command id */
687 	WMI_10X_PDEV_QVIT_CMDID,
688 
689 	/* Offload Scan and Roaming related  commands */
690 	WMI_10X_ROAM_SCAN_MODE,
691 	WMI_10X_ROAM_SCAN_RSSI_THRESHOLD,
692 	WMI_10X_ROAM_SCAN_PERIOD,
693 	WMI_10X_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
694 	WMI_10X_ROAM_AP_PROFILE,
695 	WMI_10X_OFL_SCAN_ADD_AP_PROFILE,
696 	WMI_10X_OFL_SCAN_REMOVE_AP_PROFILE,
697 	WMI_10X_OFL_SCAN_PERIOD,
698 
699 	/* P2P specific commands */
700 	WMI_10X_P2P_DEV_SET_DEVICE_INFO,
701 	WMI_10X_P2P_DEV_SET_DISCOVERABILITY,
702 	WMI_10X_P2P_GO_SET_BEACON_IE,
703 	WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
704 
705 	/* AP power save specific config */
706 	WMI_10X_AP_PS_PEER_PARAM_CMDID,
707 	WMI_10X_AP_PS_PEER_UAPSD_COEX_CMDID,
708 
709 	/* Rate-control specific commands */
710 	WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
711 
712 	/* WLAN Profiling commands. */
713 	WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
714 	WMI_10X_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
715 	WMI_10X_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
716 	WMI_10X_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
717 	WMI_10X_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
718 
719 	/* Suspend resume command Ids */
720 	WMI_10X_PDEV_SUSPEND_CMDID,
721 	WMI_10X_PDEV_RESUME_CMDID,
722 
723 	/* Beacon filter commands */
724 	WMI_10X_ADD_BCN_FILTER_CMDID,
725 	WMI_10X_RMV_BCN_FILTER_CMDID,
726 
727 	/* WOW Specific WMI commands*/
728 	WMI_10X_WOW_ADD_WAKE_PATTERN_CMDID,
729 	WMI_10X_WOW_DEL_WAKE_PATTERN_CMDID,
730 	WMI_10X_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
731 	WMI_10X_WOW_ENABLE_CMDID,
732 	WMI_10X_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
733 
734 	/* RTT measurement related cmd */
735 	WMI_10X_RTT_MEASREQ_CMDID,
736 	WMI_10X_RTT_TSF_CMDID,
737 
738 	/* transmit beacon by value */
739 	WMI_10X_PDEV_SEND_BCN_CMDID,
740 
741 	/* F/W stats */
742 	WMI_10X_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
743 	WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
744 	WMI_10X_REQUEST_STATS_CMDID,
745 
746 	/* GPIO Configuration */
747 	WMI_10X_GPIO_CONFIG_CMDID,
748 	WMI_10X_GPIO_OUTPUT_CMDID,
749 
750 	WMI_10X_PDEV_UTF_CMDID = WMI_10X_END_CMDID - 1,
751 };
752 
753 enum wmi_10x_event_id {
754 	WMI_10X_SERVICE_READY_EVENTID = 0x8000,
755 	WMI_10X_READY_EVENTID,
756 	WMI_10X_START_EVENTID = 0x9000,
757 	WMI_10X_END_EVENTID = 0x9FFF,
758 
759 	/* Scan specific events */
760 	WMI_10X_SCAN_EVENTID = WMI_10X_START_EVENTID,
761 	WMI_10X_ECHO_EVENTID,
762 	WMI_10X_DEBUG_MESG_EVENTID,
763 	WMI_10X_UPDATE_STATS_EVENTID,
764 
765 	/* Instantaneous RSSI event */
766 	WMI_10X_INST_RSSI_STATS_EVENTID,
767 
768 	/* VDEV specific events */
769 	WMI_10X_VDEV_START_RESP_EVENTID,
770 	WMI_10X_VDEV_STANDBY_REQ_EVENTID,
771 	WMI_10X_VDEV_RESUME_REQ_EVENTID,
772 	WMI_10X_VDEV_STOPPED_EVENTID,
773 
774 	/* peer  specific events */
775 	WMI_10X_PEER_STA_KICKOUT_EVENTID,
776 
777 	/* beacon/mgmt specific events */
778 	WMI_10X_HOST_SWBA_EVENTID,
779 	WMI_10X_TBTTOFFSET_UPDATE_EVENTID,
780 	WMI_10X_MGMT_RX_EVENTID,
781 
782 	/* Channel stats event */
783 	WMI_10X_CHAN_INFO_EVENTID,
784 
785 	/* PHY Error specific WMI event */
786 	WMI_10X_PHYERR_EVENTID,
787 
788 	/* Roam event to trigger roaming on host */
789 	WMI_10X_ROAM_EVENTID,
790 
791 	/* matching AP found from list of profiles */
792 	WMI_10X_PROFILE_MATCH,
793 
794 	/* debug print message used for tracing FW code while debugging */
795 	WMI_10X_DEBUG_PRINT_EVENTID,
796 	/* VI spoecific event */
797 	WMI_10X_PDEV_QVIT_EVENTID,
798 	/* FW code profile data in response to profile request */
799 	WMI_10X_WLAN_PROFILE_DATA_EVENTID,
800 
801 	/*RTT related event ID*/
802 	WMI_10X_RTT_MEASUREMENT_REPORT_EVENTID,
803 	WMI_10X_TSF_MEASUREMENT_REPORT_EVENTID,
804 	WMI_10X_RTT_ERROR_REPORT_EVENTID,
805 
806 	WMI_10X_WOW_WAKEUP_HOST_EVENTID,
807 	WMI_10X_DCS_INTERFERENCE_EVENTID,
808 
809 	/* TPC config for the current operating channel */
810 	WMI_10X_PDEV_TPC_CONFIG_EVENTID,
811 
812 	WMI_10X_GPIO_INPUT_EVENTID,
813 	WMI_10X_PDEV_UTF_EVENTID = WMI_10X_END_EVENTID-1,
814 };
815 
816 enum wmi_phy_mode {
817 	MODE_11A        = 0,   /* 11a Mode */
818 	MODE_11G        = 1,   /* 11b/g Mode */
819 	MODE_11B        = 2,   /* 11b Mode */
820 	MODE_11GONLY    = 3,   /* 11g only Mode */
821 	MODE_11NA_HT20   = 4,  /* 11a HT20 mode */
822 	MODE_11NG_HT20   = 5,  /* 11g HT20 mode */
823 	MODE_11NA_HT40   = 6,  /* 11a HT40 mode */
824 	MODE_11NG_HT40   = 7,  /* 11g HT40 mode */
825 	MODE_11AC_VHT20 = 8,
826 	MODE_11AC_VHT40 = 9,
827 	MODE_11AC_VHT80 = 10,
828 	/*    MODE_11AC_VHT160 = 11, */
829 	MODE_11AC_VHT20_2G = 11,
830 	MODE_11AC_VHT40_2G = 12,
831 	MODE_11AC_VHT80_2G = 13,
832 	MODE_UNKNOWN    = 14,
833 	MODE_MAX        = 14
834 };
835 
836 static inline const char *ath10k_wmi_phymode_str(enum wmi_phy_mode mode)
837 {
838 	switch (mode) {
839 	case MODE_11A:
840 		return "11a";
841 	case MODE_11G:
842 		return "11g";
843 	case MODE_11B:
844 		return "11b";
845 	case MODE_11GONLY:
846 		return "11gonly";
847 	case MODE_11NA_HT20:
848 		return "11na-ht20";
849 	case MODE_11NG_HT20:
850 		return "11ng-ht20";
851 	case MODE_11NA_HT40:
852 		return "11na-ht40";
853 	case MODE_11NG_HT40:
854 		return "11ng-ht40";
855 	case MODE_11AC_VHT20:
856 		return "11ac-vht20";
857 	case MODE_11AC_VHT40:
858 		return "11ac-vht40";
859 	case MODE_11AC_VHT80:
860 		return "11ac-vht80";
861 	case MODE_11AC_VHT20_2G:
862 		return "11ac-vht20-2g";
863 	case MODE_11AC_VHT40_2G:
864 		return "11ac-vht40-2g";
865 	case MODE_11AC_VHT80_2G:
866 		return "11ac-vht80-2g";
867 	case MODE_UNKNOWN:
868 		/* skip */
869 		break;
870 
871 		/* no default handler to allow compiler to check that the
872 		 * enum is fully handled */
873 	};
874 
875 	return "<unknown>";
876 }
877 
878 #define WMI_CHAN_LIST_TAG	0x1
879 #define WMI_SSID_LIST_TAG	0x2
880 #define WMI_BSSID_LIST_TAG	0x3
881 #define WMI_IE_TAG		0x4
882 
883 struct wmi_channel {
884 	__le32 mhz;
885 	__le32 band_center_freq1;
886 	__le32 band_center_freq2; /* valid for 11ac, 80plus80 */
887 	union {
888 		__le32 flags; /* WMI_CHAN_FLAG_ */
889 		struct {
890 			u8 mode; /* only 6 LSBs */
891 		} __packed;
892 	} __packed;
893 	union {
894 		__le32 reginfo0;
895 		struct {
896 			/* note: power unit is 0.5 dBm */
897 			u8 min_power;
898 			u8 max_power;
899 			u8 reg_power;
900 			u8 reg_classid;
901 		} __packed;
902 	} __packed;
903 	union {
904 		__le32 reginfo1;
905 		struct {
906 			u8 antenna_max;
907 		} __packed;
908 	} __packed;
909 } __packed;
910 
911 struct wmi_channel_arg {
912 	u32 freq;
913 	u32 band_center_freq1;
914 	bool passive;
915 	bool allow_ibss;
916 	bool allow_ht;
917 	bool allow_vht;
918 	bool ht40plus;
919 	bool chan_radar;
920 	/* note: power unit is 0.5 dBm */
921 	u32 min_power;
922 	u32 max_power;
923 	u32 max_reg_power;
924 	u32 max_antenna_gain;
925 	u32 reg_class_id;
926 	enum wmi_phy_mode mode;
927 };
928 
929 enum wmi_channel_change_cause {
930 	WMI_CHANNEL_CHANGE_CAUSE_NONE = 0,
931 	WMI_CHANNEL_CHANGE_CAUSE_CSA,
932 };
933 
934 #define WMI_CHAN_FLAG_HT40_PLUS      (1 << 6)
935 #define WMI_CHAN_FLAG_PASSIVE        (1 << 7)
936 #define WMI_CHAN_FLAG_ADHOC_ALLOWED  (1 << 8)
937 #define WMI_CHAN_FLAG_AP_DISABLED    (1 << 9)
938 #define WMI_CHAN_FLAG_DFS            (1 << 10)
939 #define WMI_CHAN_FLAG_ALLOW_HT       (1 << 11)
940 #define WMI_CHAN_FLAG_ALLOW_VHT      (1 << 12)
941 
942 /* Indicate reason for channel switch */
943 #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1 << 13)
944 
945 #define WMI_MAX_SPATIAL_STREAM   3
946 
947 /* HT Capabilities*/
948 #define WMI_HT_CAP_ENABLED                0x0001   /* HT Enabled/ disabled */
949 #define WMI_HT_CAP_HT20_SGI       0x0002   /* Short Guard Interval with HT20 */
950 #define WMI_HT_CAP_DYNAMIC_SMPS           0x0004   /* Dynamic MIMO powersave */
951 #define WMI_HT_CAP_TX_STBC                0x0008   /* B3 TX STBC */
952 #define WMI_HT_CAP_TX_STBC_MASK_SHIFT     3
953 #define WMI_HT_CAP_RX_STBC                0x0030   /* B4-B5 RX STBC */
954 #define WMI_HT_CAP_RX_STBC_MASK_SHIFT     4
955 #define WMI_HT_CAP_LDPC                   0x0040   /* LDPC supported */
956 #define WMI_HT_CAP_L_SIG_TXOP_PROT        0x0080   /* L-SIG TXOP Protection */
957 #define WMI_HT_CAP_MPDU_DENSITY           0x0700   /* MPDU Density */
958 #define WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT 8
959 #define WMI_HT_CAP_HT40_SGI               0x0800
960 
961 #define WMI_HT_CAP_DEFAULT_ALL (WMI_HT_CAP_ENABLED       | \
962 				WMI_HT_CAP_HT20_SGI      | \
963 				WMI_HT_CAP_HT40_SGI      | \
964 				WMI_HT_CAP_TX_STBC       | \
965 				WMI_HT_CAP_RX_STBC       | \
966 				WMI_HT_CAP_LDPC)
967 
968 
969 /*
970  * WMI_VHT_CAP_* these maps to ieee 802.11ac vht capability information
971  * field. The fields not defined here are not supported, or reserved.
972  * Do not change these masks and if you have to add new one follow the
973  * bitmask as specified by 802.11ac draft.
974  */
975 
976 #define WMI_VHT_CAP_MAX_MPDU_LEN_MASK            0x00000003
977 #define WMI_VHT_CAP_RX_LDPC                      0x00000010
978 #define WMI_VHT_CAP_SGI_80MHZ                    0x00000020
979 #define WMI_VHT_CAP_TX_STBC                      0x00000080
980 #define WMI_VHT_CAP_RX_STBC_MASK                 0x00000300
981 #define WMI_VHT_CAP_RX_STBC_MASK_SHIFT           8
982 #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP            0x03800000
983 #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT      23
984 #define WMI_VHT_CAP_RX_FIXED_ANT                 0x10000000
985 #define WMI_VHT_CAP_TX_FIXED_ANT                 0x20000000
986 
987 /* The following also refer for max HT AMSDU */
988 #define WMI_VHT_CAP_MAX_MPDU_LEN_3839            0x00000000
989 #define WMI_VHT_CAP_MAX_MPDU_LEN_7935            0x00000001
990 #define WMI_VHT_CAP_MAX_MPDU_LEN_11454           0x00000002
991 
992 #define WMI_VHT_CAP_DEFAULT_ALL (WMI_VHT_CAP_MAX_MPDU_LEN_11454  | \
993 				 WMI_VHT_CAP_RX_LDPC             | \
994 				 WMI_VHT_CAP_SGI_80MHZ           | \
995 				 WMI_VHT_CAP_TX_STBC             | \
996 				 WMI_VHT_CAP_RX_STBC_MASK        | \
997 				 WMI_VHT_CAP_MAX_AMPDU_LEN_EXP   | \
998 				 WMI_VHT_CAP_RX_FIXED_ANT        | \
999 				 WMI_VHT_CAP_TX_FIXED_ANT)
1000 
1001 /*
1002  * Interested readers refer to Rx/Tx MCS Map definition as defined in
1003  * 802.11ac
1004  */
1005 #define WMI_VHT_MAX_MCS_4_SS_MASK(r, ss)      ((3 & (r)) << (((ss) - 1) << 1))
1006 #define WMI_VHT_MAX_SUPP_RATE_MASK           0x1fff0000
1007 #define WMI_VHT_MAX_SUPP_RATE_MASK_SHIFT     16
1008 
1009 enum {
1010 	REGDMN_MODE_11A              = 0x00001, /* 11a channels */
1011 	REGDMN_MODE_TURBO            = 0x00002, /* 11a turbo-only channels */
1012 	REGDMN_MODE_11B              = 0x00004, /* 11b channels */
1013 	REGDMN_MODE_PUREG            = 0x00008, /* 11g channels (OFDM only) */
1014 	REGDMN_MODE_11G              = 0x00008, /* XXX historical */
1015 	REGDMN_MODE_108G             = 0x00020, /* 11a+Turbo channels */
1016 	REGDMN_MODE_108A             = 0x00040, /* 11g+Turbo channels */
1017 	REGDMN_MODE_XR               = 0x00100, /* XR channels */
1018 	REGDMN_MODE_11A_HALF_RATE    = 0x00200, /* 11A half rate channels */
1019 	REGDMN_MODE_11A_QUARTER_RATE = 0x00400, /* 11A quarter rate channels */
1020 	REGDMN_MODE_11NG_HT20        = 0x00800, /* 11N-G HT20 channels */
1021 	REGDMN_MODE_11NA_HT20        = 0x01000, /* 11N-A HT20 channels */
1022 	REGDMN_MODE_11NG_HT40PLUS    = 0x02000, /* 11N-G HT40 + channels */
1023 	REGDMN_MODE_11NG_HT40MINUS   = 0x04000, /* 11N-G HT40 - channels */
1024 	REGDMN_MODE_11NA_HT40PLUS    = 0x08000, /* 11N-A HT40 + channels */
1025 	REGDMN_MODE_11NA_HT40MINUS   = 0x10000, /* 11N-A HT40 - channels */
1026 	REGDMN_MODE_11AC_VHT20       = 0x20000, /* 5Ghz, VHT20 */
1027 	REGDMN_MODE_11AC_VHT40PLUS   = 0x40000, /* 5Ghz, VHT40 + channels */
1028 	REGDMN_MODE_11AC_VHT40MINUS  = 0x80000, /* 5Ghz  VHT40 - channels */
1029 	REGDMN_MODE_11AC_VHT80       = 0x100000, /* 5Ghz, VHT80 channels */
1030 	REGDMN_MODE_ALL              = 0xffffffff
1031 };
1032 
1033 #define REGDMN_CAP1_CHAN_HALF_RATE        0x00000001
1034 #define REGDMN_CAP1_CHAN_QUARTER_RATE     0x00000002
1035 #define REGDMN_CAP1_CHAN_HAL49GHZ         0x00000004
1036 
1037 /* regulatory capabilities */
1038 #define REGDMN_EEPROM_EEREGCAP_EN_FCC_MIDBAND   0x0040
1039 #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_EVEN    0x0080
1040 #define REGDMN_EEPROM_EEREGCAP_EN_KK_U2         0x0100
1041 #define REGDMN_EEPROM_EEREGCAP_EN_KK_MIDBAND    0x0200
1042 #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_ODD     0x0400
1043 #define REGDMN_EEPROM_EEREGCAP_EN_KK_NEW_11A    0x0800
1044 
1045 struct hal_reg_capabilities {
1046 	/* regdomain value specified in EEPROM */
1047 	__le32 eeprom_rd;
1048 	/*regdomain */
1049 	__le32 eeprom_rd_ext;
1050 	/* CAP1 capabilities bit map. */
1051 	__le32 regcap1;
1052 	/* REGDMN EEPROM CAP. */
1053 	__le32 regcap2;
1054 	/* REGDMN MODE */
1055 	__le32 wireless_modes;
1056 	__le32 low_2ghz_chan;
1057 	__le32 high_2ghz_chan;
1058 	__le32 low_5ghz_chan;
1059 	__le32 high_5ghz_chan;
1060 } __packed;
1061 
1062 enum wlan_mode_capability {
1063 	WHAL_WLAN_11A_CAPABILITY   = 0x1,
1064 	WHAL_WLAN_11G_CAPABILITY   = 0x2,
1065 	WHAL_WLAN_11AG_CAPABILITY  = 0x3,
1066 };
1067 
1068 /* structure used by FW for requesting host memory */
1069 struct wlan_host_mem_req {
1070 	/* ID of the request */
1071 	__le32 req_id;
1072 	/* size of the  of each unit */
1073 	__le32 unit_size;
1074 	/* flags to  indicate that
1075 	 * the number units is dependent
1076 	 * on number of resources(num vdevs num peers .. etc)
1077 	 */
1078 	__le32 num_unit_info;
1079 	/*
1080 	 * actual number of units to allocate . if flags in the num_unit_info
1081 	 * indicate that number of units is tied to number of a particular
1082 	 * resource to allocate then  num_units filed is set to 0 and host
1083 	 * will derive the number units from number of the resources it is
1084 	 * requesting.
1085 	 */
1086 	__le32 num_units;
1087 } __packed;
1088 
1089 #define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id) \
1090 	((((wmi_svc_bmap)[(svc_id)/(sizeof(u32))]) & \
1091 	(1 << ((svc_id)%(sizeof(u32))))) != 0)
1092 
1093 /*
1094  * The following struct holds optional payload for
1095  * wmi_service_ready_event,e.g., 11ac pass some of the
1096  * device capability to the host.
1097  */
1098 struct wmi_service_ready_event {
1099 	__le32 sw_version;
1100 	__le32 sw_version_1;
1101 	__le32 abi_version;
1102 	/* WMI_PHY_CAPABILITY */
1103 	__le32 phy_capability;
1104 	/* Maximum number of frag table entries that SW will populate less 1 */
1105 	__le32 max_frag_entry;
1106 	__le32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
1107 	__le32 num_rf_chains;
1108 	/*
1109 	 * The following field is only valid for service type
1110 	 * WMI_SERVICE_11AC
1111 	 */
1112 	__le32 ht_cap_info; /* WMI HT Capability */
1113 	__le32 vht_cap_info; /* VHT capability info field of 802.11ac */
1114 	__le32 vht_supp_mcs; /* VHT Supported MCS Set field Rx/Tx same */
1115 	__le32 hw_min_tx_power;
1116 	__le32 hw_max_tx_power;
1117 	struct hal_reg_capabilities hal_reg_capabilities;
1118 	__le32 sys_cap_info;
1119 	__le32 min_pkt_size_enable; /* Enterprise mode short pkt enable */
1120 	/*
1121 	 * Max beacon and Probe Response IE offload size
1122 	 * (includes optional P2P IEs)
1123 	 */
1124 	__le32 max_bcn_ie_size;
1125 	/*
1126 	 * request to host to allocate a chuck of memory and pss it down to FW
1127 	 * via WM_INIT. FW uses this as FW extesnsion memory for saving its
1128 	 * data structures. Only valid for low latency interfaces like PCIE
1129 	 * where FW can access this memory directly (or) by DMA.
1130 	 */
1131 	__le32 num_mem_reqs;
1132 	struct wlan_host_mem_req mem_reqs[1];
1133 } __packed;
1134 
1135 /* This is the definition from 10.X firmware branch */
1136 struct wmi_service_ready_event_10x {
1137 	__le32 sw_version;
1138 	__le32 abi_version;
1139 
1140 	/* WMI_PHY_CAPABILITY */
1141 	__le32 phy_capability;
1142 
1143 	/* Maximum number of frag table entries that SW will populate less 1 */
1144 	__le32 max_frag_entry;
1145 	__le32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
1146 	__le32 num_rf_chains;
1147 
1148 	/*
1149 	 * The following field is only valid for service type
1150 	 * WMI_SERVICE_11AC
1151 	 */
1152 	__le32 ht_cap_info; /* WMI HT Capability */
1153 	__le32 vht_cap_info; /* VHT capability info field of 802.11ac */
1154 	__le32 vht_supp_mcs; /* VHT Supported MCS Set field Rx/Tx same */
1155 	__le32 hw_min_tx_power;
1156 	__le32 hw_max_tx_power;
1157 
1158 	struct hal_reg_capabilities hal_reg_capabilities;
1159 
1160 	__le32 sys_cap_info;
1161 	__le32 min_pkt_size_enable; /* Enterprise mode short pkt enable */
1162 
1163 	/*
1164 	 * request to host to allocate a chuck of memory and pss it down to FW
1165 	 * via WM_INIT. FW uses this as FW extesnsion memory for saving its
1166 	 * data structures. Only valid for low latency interfaces like PCIE
1167 	 * where FW can access this memory directly (or) by DMA.
1168 	 */
1169 	__le32 num_mem_reqs;
1170 
1171 	struct wlan_host_mem_req mem_reqs[1];
1172 } __packed;
1173 
1174 
1175 #define WMI_SERVICE_READY_TIMEOUT_HZ (5*HZ)
1176 #define WMI_UNIFIED_READY_TIMEOUT_HZ (5*HZ)
1177 
1178 struct wmi_ready_event {
1179 	__le32 sw_version;
1180 	__le32 abi_version;
1181 	struct wmi_mac_addr mac_addr;
1182 	__le32 status;
1183 } __packed;
1184 
1185 struct wmi_resource_config {
1186 	/* number of virtual devices (VAPs) to support */
1187 	__le32 num_vdevs;
1188 
1189 	/* number of peer nodes to support */
1190 	__le32 num_peers;
1191 
1192 	/*
1193 	 * In offload mode target supports features like WOW, chatter and
1194 	 * other protocol offloads. In order to support them some
1195 	 * functionalities like reorder buffering, PN checking need to be
1196 	 * done in target. This determines maximum number of peers suported
1197 	 * by target in offload mode
1198 	 */
1199 	__le32 num_offload_peers;
1200 
1201 	/* For target-based RX reordering */
1202 	__le32 num_offload_reorder_bufs;
1203 
1204 	/* number of keys per peer */
1205 	__le32 num_peer_keys;
1206 
1207 	/* total number of TX/RX data TIDs */
1208 	__le32 num_tids;
1209 
1210 	/*
1211 	 * max skid for resolving hash collisions
1212 	 *
1213 	 *   The address search table is sparse, so that if two MAC addresses
1214 	 *   result in the same hash value, the second of these conflicting
1215 	 *   entries can slide to the next index in the address search table,
1216 	 *   and use it, if it is unoccupied.  This ast_skid_limit parameter
1217 	 *   specifies the upper bound on how many subsequent indices to search
1218 	 *   over to find an unoccupied space.
1219 	 */
1220 	__le32 ast_skid_limit;
1221 
1222 	/*
1223 	 * the nominal chain mask for transmit
1224 	 *
1225 	 *   The chain mask may be modified dynamically, e.g. to operate AP
1226 	 *   tx with a reduced number of chains if no clients are associated.
1227 	 *   This configuration parameter specifies the nominal chain-mask that
1228 	 *   should be used when not operating with a reduced set of tx chains.
1229 	 */
1230 	__le32 tx_chain_mask;
1231 
1232 	/*
1233 	 * the nominal chain mask for receive
1234 	 *
1235 	 *   The chain mask may be modified dynamically, e.g. for a client
1236 	 *   to use a reduced number of chains for receive if the traffic to
1237 	 *   the client is low enough that it doesn't require downlink MIMO
1238 	 *   or antenna diversity.
1239 	 *   This configuration parameter specifies the nominal chain-mask that
1240 	 *   should be used when not operating with a reduced set of rx chains.
1241 	 */
1242 	__le32 rx_chain_mask;
1243 
1244 	/*
1245 	 * what rx reorder timeout (ms) to use for the AC
1246 	 *
1247 	 *   Each WMM access class (voice, video, best-effort, background) will
1248 	 *   have its own timeout value to dictate how long to wait for missing
1249 	 *   rx MPDUs to arrive before flushing subsequent MPDUs that have
1250 	 *   already been received.
1251 	 *   This parameter specifies the timeout in milliseconds for each
1252 	 *   class.
1253 	 */
1254 	__le32 rx_timeout_pri_vi;
1255 	__le32 rx_timeout_pri_vo;
1256 	__le32 rx_timeout_pri_be;
1257 	__le32 rx_timeout_pri_bk;
1258 
1259 	/*
1260 	 * what mode the rx should decap packets to
1261 	 *
1262 	 *   MAC can decap to RAW (no decap), native wifi or Ethernet types
1263 	 *   THis setting also determines the default TX behavior, however TX
1264 	 *   behavior can be modified on a per VAP basis during VAP init
1265 	 */
1266 	__le32 rx_decap_mode;
1267 
1268 	/* what is the maximum scan requests than can be queued */
1269 	__le32 scan_max_pending_reqs;
1270 
1271 	/* maximum VDEV that could use BMISS offload */
1272 	__le32 bmiss_offload_max_vdev;
1273 
1274 	/* maximum VDEV that could use offload roaming */
1275 	__le32 roam_offload_max_vdev;
1276 
1277 	/* maximum AP profiles that would push to offload roaming */
1278 	__le32 roam_offload_max_ap_profiles;
1279 
1280 	/*
1281 	 * how many groups to use for mcast->ucast conversion
1282 	 *
1283 	 *   The target's WAL maintains a table to hold information regarding
1284 	 *   which peers belong to a given multicast group, so that if
1285 	 *   multicast->unicast conversion is enabled, the target can convert
1286 	 *   multicast tx frames to a series of unicast tx frames, to each
1287 	 *   peer within the multicast group.
1288 	     This num_mcast_groups configuration parameter tells the target how
1289 	 *   many multicast groups to provide storage for within its multicast
1290 	 *   group membership table.
1291 	 */
1292 	__le32 num_mcast_groups;
1293 
1294 	/*
1295 	 * size to alloc for the mcast membership table
1296 	 *
1297 	 *   This num_mcast_table_elems configuration parameter tells the
1298 	 *   target how many peer elements it needs to provide storage for in
1299 	 *   its multicast group membership table.
1300 	 *   These multicast group membership table elements are shared by the
1301 	 *   multicast groups stored within the table.
1302 	 */
1303 	__le32 num_mcast_table_elems;
1304 
1305 	/*
1306 	 * whether/how to do multicast->unicast conversion
1307 	 *
1308 	 *   This configuration parameter specifies whether the target should
1309 	 *   perform multicast --> unicast conversion on transmit, and if so,
1310 	 *   what to do if it finds no entries in its multicast group
1311 	 *   membership table for the multicast IP address in the tx frame.
1312 	 *   Configuration value:
1313 	 *   0 -> Do not perform multicast to unicast conversion.
1314 	 *   1 -> Convert multicast frames to unicast, if the IP multicast
1315 	 *        address from the tx frame is found in the multicast group
1316 	 *        membership table.  If the IP multicast address is not found,
1317 	 *        drop the frame.
1318 	 *   2 -> Convert multicast frames to unicast, if the IP multicast
1319 	 *        address from the tx frame is found in the multicast group
1320 	 *        membership table.  If the IP multicast address is not found,
1321 	 *        transmit the frame as multicast.
1322 	 */
1323 	__le32 mcast2ucast_mode;
1324 
1325 	/*
1326 	 * how much memory to allocate for a tx PPDU dbg log
1327 	 *
1328 	 *   This parameter controls how much memory the target will allocate
1329 	 *   to store a log of tx PPDU meta-information (how large the PPDU
1330 	 *   was, when it was sent, whether it was successful, etc.)
1331 	 */
1332 	__le32 tx_dbg_log_size;
1333 
1334 	/* how many AST entries to be allocated for WDS */
1335 	__le32 num_wds_entries;
1336 
1337 	/*
1338 	 * MAC DMA burst size, e.g., For target PCI limit can be
1339 	 * 0 -default, 1 256B
1340 	 */
1341 	__le32 dma_burst_size;
1342 
1343 	/*
1344 	 * Fixed delimiters to be inserted after every MPDU to
1345 	 * account for interface latency to avoid underrun.
1346 	 */
1347 	__le32 mac_aggr_delim;
1348 
1349 	/*
1350 	 *   determine whether target is responsible for detecting duplicate
1351 	 *   non-aggregate MPDU and timing out stale fragments.
1352 	 *
1353 	 *   A-MPDU reordering is always performed on the target.
1354 	 *
1355 	 *   0: target responsible for frag timeout and dup checking
1356 	 *   1: host responsible for frag timeout and dup checking
1357 	 */
1358 	__le32 rx_skip_defrag_timeout_dup_detection_check;
1359 
1360 	/*
1361 	 * Configuration for VoW :
1362 	 * No of Video Nodes to be supported
1363 	 * and Max no of descriptors for each Video link (node).
1364 	 */
1365 	__le32 vow_config;
1366 
1367 	/* maximum VDEV that could use GTK offload */
1368 	__le32 gtk_offload_max_vdev;
1369 
1370 	/* Number of msdu descriptors target should use */
1371 	__le32 num_msdu_desc;
1372 
1373 	/*
1374 	 * Max. number of Tx fragments per MSDU
1375 	 *  This parameter controls the max number of Tx fragments per MSDU.
1376 	 *  This is sent by the target as part of the WMI_SERVICE_READY event
1377 	 *  and is overriden by the OS shim as required.
1378 	 */
1379 	__le32 max_frag_entries;
1380 } __packed;
1381 
1382 struct wmi_resource_config_10x {
1383 	/* number of virtual devices (VAPs) to support */
1384 	__le32 num_vdevs;
1385 
1386 	/* number of peer nodes to support */
1387 	__le32 num_peers;
1388 
1389 	/* number of keys per peer */
1390 	__le32 num_peer_keys;
1391 
1392 	/* total number of TX/RX data TIDs */
1393 	__le32 num_tids;
1394 
1395 	/*
1396 	 * max skid for resolving hash collisions
1397 	 *
1398 	 *   The address search table is sparse, so that if two MAC addresses
1399 	 *   result in the same hash value, the second of these conflicting
1400 	 *   entries can slide to the next index in the address search table,
1401 	 *   and use it, if it is unoccupied.  This ast_skid_limit parameter
1402 	 *   specifies the upper bound on how many subsequent indices to search
1403 	 *   over to find an unoccupied space.
1404 	 */
1405 	__le32 ast_skid_limit;
1406 
1407 	/*
1408 	 * the nominal chain mask for transmit
1409 	 *
1410 	 *   The chain mask may be modified dynamically, e.g. to operate AP
1411 	 *   tx with a reduced number of chains if no clients are associated.
1412 	 *   This configuration parameter specifies the nominal chain-mask that
1413 	 *   should be used when not operating with a reduced set of tx chains.
1414 	 */
1415 	__le32 tx_chain_mask;
1416 
1417 	/*
1418 	 * the nominal chain mask for receive
1419 	 *
1420 	 *   The chain mask may be modified dynamically, e.g. for a client
1421 	 *   to use a reduced number of chains for receive if the traffic to
1422 	 *   the client is low enough that it doesn't require downlink MIMO
1423 	 *   or antenna diversity.
1424 	 *   This configuration parameter specifies the nominal chain-mask that
1425 	 *   should be used when not operating with a reduced set of rx chains.
1426 	 */
1427 	__le32 rx_chain_mask;
1428 
1429 	/*
1430 	 * what rx reorder timeout (ms) to use for the AC
1431 	 *
1432 	 *   Each WMM access class (voice, video, best-effort, background) will
1433 	 *   have its own timeout value to dictate how long to wait for missing
1434 	 *   rx MPDUs to arrive before flushing subsequent MPDUs that have
1435 	 *   already been received.
1436 	 *   This parameter specifies the timeout in milliseconds for each
1437 	 *   class.
1438 	 */
1439 	__le32 rx_timeout_pri_vi;
1440 	__le32 rx_timeout_pri_vo;
1441 	__le32 rx_timeout_pri_be;
1442 	__le32 rx_timeout_pri_bk;
1443 
1444 	/*
1445 	 * what mode the rx should decap packets to
1446 	 *
1447 	 *   MAC can decap to RAW (no decap), native wifi or Ethernet types
1448 	 *   THis setting also determines the default TX behavior, however TX
1449 	 *   behavior can be modified on a per VAP basis during VAP init
1450 	 */
1451 	__le32 rx_decap_mode;
1452 
1453 	/* what is the maximum scan requests than can be queued */
1454 	__le32 scan_max_pending_reqs;
1455 
1456 	/* maximum VDEV that could use BMISS offload */
1457 	__le32 bmiss_offload_max_vdev;
1458 
1459 	/* maximum VDEV that could use offload roaming */
1460 	__le32 roam_offload_max_vdev;
1461 
1462 	/* maximum AP profiles that would push to offload roaming */
1463 	__le32 roam_offload_max_ap_profiles;
1464 
1465 	/*
1466 	 * how many groups to use for mcast->ucast conversion
1467 	 *
1468 	 *   The target's WAL maintains a table to hold information regarding
1469 	 *   which peers belong to a given multicast group, so that if
1470 	 *   multicast->unicast conversion is enabled, the target can convert
1471 	 *   multicast tx frames to a series of unicast tx frames, to each
1472 	 *   peer within the multicast group.
1473 	     This num_mcast_groups configuration parameter tells the target how
1474 	 *   many multicast groups to provide storage for within its multicast
1475 	 *   group membership table.
1476 	 */
1477 	__le32 num_mcast_groups;
1478 
1479 	/*
1480 	 * size to alloc for the mcast membership table
1481 	 *
1482 	 *   This num_mcast_table_elems configuration parameter tells the
1483 	 *   target how many peer elements it needs to provide storage for in
1484 	 *   its multicast group membership table.
1485 	 *   These multicast group membership table elements are shared by the
1486 	 *   multicast groups stored within the table.
1487 	 */
1488 	__le32 num_mcast_table_elems;
1489 
1490 	/*
1491 	 * whether/how to do multicast->unicast conversion
1492 	 *
1493 	 *   This configuration parameter specifies whether the target should
1494 	 *   perform multicast --> unicast conversion on transmit, and if so,
1495 	 *   what to do if it finds no entries in its multicast group
1496 	 *   membership table for the multicast IP address in the tx frame.
1497 	 *   Configuration value:
1498 	 *   0 -> Do not perform multicast to unicast conversion.
1499 	 *   1 -> Convert multicast frames to unicast, if the IP multicast
1500 	 *        address from the tx frame is found in the multicast group
1501 	 *        membership table.  If the IP multicast address is not found,
1502 	 *        drop the frame.
1503 	 *   2 -> Convert multicast frames to unicast, if the IP multicast
1504 	 *        address from the tx frame is found in the multicast group
1505 	 *        membership table.  If the IP multicast address is not found,
1506 	 *        transmit the frame as multicast.
1507 	 */
1508 	__le32 mcast2ucast_mode;
1509 
1510 	/*
1511 	 * how much memory to allocate for a tx PPDU dbg log
1512 	 *
1513 	 *   This parameter controls how much memory the target will allocate
1514 	 *   to store a log of tx PPDU meta-information (how large the PPDU
1515 	 *   was, when it was sent, whether it was successful, etc.)
1516 	 */
1517 	__le32 tx_dbg_log_size;
1518 
1519 	/* how many AST entries to be allocated for WDS */
1520 	__le32 num_wds_entries;
1521 
1522 	/*
1523 	 * MAC DMA burst size, e.g., For target PCI limit can be
1524 	 * 0 -default, 1 256B
1525 	 */
1526 	__le32 dma_burst_size;
1527 
1528 	/*
1529 	 * Fixed delimiters to be inserted after every MPDU to
1530 	 * account for interface latency to avoid underrun.
1531 	 */
1532 	__le32 mac_aggr_delim;
1533 
1534 	/*
1535 	 *   determine whether target is responsible for detecting duplicate
1536 	 *   non-aggregate MPDU and timing out stale fragments.
1537 	 *
1538 	 *   A-MPDU reordering is always performed on the target.
1539 	 *
1540 	 *   0: target responsible for frag timeout and dup checking
1541 	 *   1: host responsible for frag timeout and dup checking
1542 	 */
1543 	__le32 rx_skip_defrag_timeout_dup_detection_check;
1544 
1545 	/*
1546 	 * Configuration for VoW :
1547 	 * No of Video Nodes to be supported
1548 	 * and Max no of descriptors for each Video link (node).
1549 	 */
1550 	__le32 vow_config;
1551 
1552 	/* Number of msdu descriptors target should use */
1553 	__le32 num_msdu_desc;
1554 
1555 	/*
1556 	 * Max. number of Tx fragments per MSDU
1557 	 *  This parameter controls the max number of Tx fragments per MSDU.
1558 	 *  This is sent by the target as part of the WMI_SERVICE_READY event
1559 	 *  and is overriden by the OS shim as required.
1560 	 */
1561 	__le32 max_frag_entries;
1562 } __packed;
1563 
1564 
1565 #define NUM_UNITS_IS_NUM_VDEVS   0x1
1566 #define NUM_UNITS_IS_NUM_PEERS   0x2
1567 
1568 /* strucutre describing host memory chunk. */
1569 struct host_memory_chunk {
1570 	/* id of the request that is passed up in service ready */
1571 	__le32 req_id;
1572 	/* the physical address the memory chunk */
1573 	__le32 ptr;
1574 	/* size of the chunk */
1575 	__le32 size;
1576 } __packed;
1577 
1578 struct wmi_init_cmd {
1579 	struct wmi_resource_config resource_config;
1580 	__le32 num_host_mem_chunks;
1581 
1582 	/*
1583 	 * variable number of host memory chunks.
1584 	 * This should be the last element in the structure
1585 	 */
1586 	struct host_memory_chunk host_mem_chunks[1];
1587 } __packed;
1588 
1589 /* _10x stucture is from 10.X FW API */
1590 struct wmi_init_cmd_10x {
1591 	struct wmi_resource_config_10x resource_config;
1592 	__le32 num_host_mem_chunks;
1593 
1594 	/*
1595 	 * variable number of host memory chunks.
1596 	 * This should be the last element in the structure
1597 	 */
1598 	struct host_memory_chunk host_mem_chunks[1];
1599 } __packed;
1600 
1601 /* TLV for channel list */
1602 struct wmi_chan_list {
1603 	__le32 tag; /* WMI_CHAN_LIST_TAG */
1604 	__le32 num_chan;
1605 	__le32 channel_list[0];
1606 } __packed;
1607 
1608 struct wmi_bssid_list {
1609 	__le32 tag; /* WMI_BSSID_LIST_TAG */
1610 	__le32 num_bssid;
1611 	struct wmi_mac_addr bssid_list[0];
1612 } __packed;
1613 
1614 struct wmi_ie_data {
1615 	__le32 tag; /* WMI_IE_TAG */
1616 	__le32 ie_len;
1617 	u8 ie_data[0];
1618 } __packed;
1619 
1620 struct wmi_ssid {
1621 	__le32 ssid_len;
1622 	u8 ssid[32];
1623 } __packed;
1624 
1625 struct wmi_ssid_list {
1626 	__le32 tag; /* WMI_SSID_LIST_TAG */
1627 	__le32 num_ssids;
1628 	struct wmi_ssid ssids[0];
1629 } __packed;
1630 
1631 /* prefix used by scan requestor ids on the host */
1632 #define WMI_HOST_SCAN_REQUESTOR_ID_PREFIX 0xA000
1633 
1634 /* prefix used by scan request ids generated on the host */
1635 /* host cycles through the lower 12 bits to generate ids */
1636 #define WMI_HOST_SCAN_REQ_ID_PREFIX 0xA000
1637 
1638 #define WLAN_SCAN_PARAMS_MAX_SSID    16
1639 #define WLAN_SCAN_PARAMS_MAX_BSSID   4
1640 #define WLAN_SCAN_PARAMS_MAX_IE_LEN  256
1641 
1642 /* Scan priority numbers must be sequential, starting with 0 */
1643 enum wmi_scan_priority {
1644 	WMI_SCAN_PRIORITY_VERY_LOW = 0,
1645 	WMI_SCAN_PRIORITY_LOW,
1646 	WMI_SCAN_PRIORITY_MEDIUM,
1647 	WMI_SCAN_PRIORITY_HIGH,
1648 	WMI_SCAN_PRIORITY_VERY_HIGH,
1649 	WMI_SCAN_PRIORITY_COUNT   /* number of priorities supported */
1650 };
1651 
1652 struct wmi_start_scan_cmd {
1653 	/* Scan ID */
1654 	__le32 scan_id;
1655 	/* Scan requestor ID */
1656 	__le32 scan_req_id;
1657 	/* VDEV id(interface) that is requesting scan */
1658 	__le32 vdev_id;
1659 	/* Scan Priority, input to scan scheduler */
1660 	__le32 scan_priority;
1661 	/* Scan events subscription */
1662 	__le32 notify_scan_events;
1663 	/* dwell time in msec on active channels */
1664 	__le32 dwell_time_active;
1665 	/* dwell time in msec on passive channels */
1666 	__le32 dwell_time_passive;
1667 	/*
1668 	 * min time in msec on the BSS channel,only valid if atleast one
1669 	 * VDEV is active
1670 	 */
1671 	__le32 min_rest_time;
1672 	/*
1673 	 * max rest time in msec on the BSS channel,only valid if at least
1674 	 * one VDEV is active
1675 	 */
1676 	/*
1677 	 * the scanner will rest on the bss channel at least min_rest_time
1678 	 * after min_rest_time the scanner will start checking for tx/rx
1679 	 * activity on all VDEVs. if there is no activity the scanner will
1680 	 * switch to off channel. if there is activity the scanner will let
1681 	 * the radio on the bss channel until max_rest_time expires.at
1682 	 * max_rest_time scanner will switch to off channel irrespective of
1683 	 * activity. activity is determined by the idle_time parameter.
1684 	 */
1685 	__le32 max_rest_time;
1686 	/*
1687 	 * time before sending next set of probe requests.
1688 	 * The scanner keeps repeating probe requests transmission with
1689 	 * period specified by repeat_probe_time.
1690 	 * The number of probe requests specified depends on the ssid_list
1691 	 * and bssid_list
1692 	 */
1693 	__le32 repeat_probe_time;
1694 	/* time in msec between 2 consequetive probe requests with in a set. */
1695 	__le32 probe_spacing_time;
1696 	/*
1697 	 * data inactivity time in msec on bss channel that will be used by
1698 	 * scanner for measuring the inactivity.
1699 	 */
1700 	__le32 idle_time;
1701 	/* maximum time in msec allowed for scan  */
1702 	__le32 max_scan_time;
1703 	/*
1704 	 * delay in msec before sending first probe request after switching
1705 	 * to a channel
1706 	 */
1707 	__le32 probe_delay;
1708 	/* Scan control flags */
1709 	__le32 scan_ctrl_flags;
1710 
1711 	/* Burst duration time in msecs */
1712 	__le32 burst_duration;
1713 	/*
1714 	 * TLV (tag length value )  paramerters follow the scan_cmd structure.
1715 	 * TLV can contain channel list, bssid list, ssid list and
1716 	 * ie. the TLV tags are defined above;
1717 	 */
1718 } __packed;
1719 
1720 /* This is the definition from 10.X firmware branch */
1721 struct wmi_start_scan_cmd_10x {
1722 	/* Scan ID */
1723 	__le32 scan_id;
1724 
1725 	/* Scan requestor ID */
1726 	__le32 scan_req_id;
1727 
1728 	/* VDEV id(interface) that is requesting scan */
1729 	__le32 vdev_id;
1730 
1731 	/* Scan Priority, input to scan scheduler */
1732 	__le32 scan_priority;
1733 
1734 	/* Scan events subscription */
1735 	__le32 notify_scan_events;
1736 
1737 	/* dwell time in msec on active channels */
1738 	__le32 dwell_time_active;
1739 
1740 	/* dwell time in msec on passive channels */
1741 	__le32 dwell_time_passive;
1742 
1743 	/*
1744 	 * min time in msec on the BSS channel,only valid if atleast one
1745 	 * VDEV is active
1746 	 */
1747 	__le32 min_rest_time;
1748 
1749 	/*
1750 	 * max rest time in msec on the BSS channel,only valid if at least
1751 	 * one VDEV is active
1752 	 */
1753 	/*
1754 	 * the scanner will rest on the bss channel at least min_rest_time
1755 	 * after min_rest_time the scanner will start checking for tx/rx
1756 	 * activity on all VDEVs. if there is no activity the scanner will
1757 	 * switch to off channel. if there is activity the scanner will let
1758 	 * the radio on the bss channel until max_rest_time expires.at
1759 	 * max_rest_time scanner will switch to off channel irrespective of
1760 	 * activity. activity is determined by the idle_time parameter.
1761 	 */
1762 	__le32 max_rest_time;
1763 
1764 	/*
1765 	 * time before sending next set of probe requests.
1766 	 * The scanner keeps repeating probe requests transmission with
1767 	 * period specified by repeat_probe_time.
1768 	 * The number of probe requests specified depends on the ssid_list
1769 	 * and bssid_list
1770 	 */
1771 	__le32 repeat_probe_time;
1772 
1773 	/* time in msec between 2 consequetive probe requests with in a set. */
1774 	__le32 probe_spacing_time;
1775 
1776 	/*
1777 	 * data inactivity time in msec on bss channel that will be used by
1778 	 * scanner for measuring the inactivity.
1779 	 */
1780 	__le32 idle_time;
1781 
1782 	/* maximum time in msec allowed for scan  */
1783 	__le32 max_scan_time;
1784 
1785 	/*
1786 	 * delay in msec before sending first probe request after switching
1787 	 * to a channel
1788 	 */
1789 	__le32 probe_delay;
1790 
1791 	/* Scan control flags */
1792 	__le32 scan_ctrl_flags;
1793 
1794 	/*
1795 	 * TLV (tag length value )  paramerters follow the scan_cmd structure.
1796 	 * TLV can contain channel list, bssid list, ssid list and
1797 	 * ie. the TLV tags are defined above;
1798 	 */
1799 } __packed;
1800 
1801 
1802 struct wmi_ssid_arg {
1803 	int len;
1804 	const u8 *ssid;
1805 };
1806 
1807 struct wmi_bssid_arg {
1808 	const u8 *bssid;
1809 };
1810 
1811 struct wmi_start_scan_arg {
1812 	u32 scan_id;
1813 	u32 scan_req_id;
1814 	u32 vdev_id;
1815 	u32 scan_priority;
1816 	u32 notify_scan_events;
1817 	u32 dwell_time_active;
1818 	u32 dwell_time_passive;
1819 	u32 min_rest_time;
1820 	u32 max_rest_time;
1821 	u32 repeat_probe_time;
1822 	u32 probe_spacing_time;
1823 	u32 idle_time;
1824 	u32 max_scan_time;
1825 	u32 probe_delay;
1826 	u32 scan_ctrl_flags;
1827 
1828 	u32 ie_len;
1829 	u32 n_channels;
1830 	u32 n_ssids;
1831 	u32 n_bssids;
1832 
1833 	u8 ie[WLAN_SCAN_PARAMS_MAX_IE_LEN];
1834 	u32 channels[64];
1835 	struct wmi_ssid_arg ssids[WLAN_SCAN_PARAMS_MAX_SSID];
1836 	struct wmi_bssid_arg bssids[WLAN_SCAN_PARAMS_MAX_BSSID];
1837 };
1838 
1839 /* scan control flags */
1840 
1841 /* passively scan all channels including active channels */
1842 #define WMI_SCAN_FLAG_PASSIVE        0x1
1843 /* add wild card ssid probe request even though ssid_list is specified. */
1844 #define WMI_SCAN_ADD_BCAST_PROBE_REQ 0x2
1845 /* add cck rates to rates/xrate ie for the generated probe request */
1846 #define WMI_SCAN_ADD_CCK_RATES 0x4
1847 /* add ofdm rates to rates/xrate ie for the generated probe request */
1848 #define WMI_SCAN_ADD_OFDM_RATES 0x8
1849 /* To enable indication of Chan load and Noise floor to host */
1850 #define WMI_SCAN_CHAN_STAT_EVENT 0x10
1851 /* Filter Probe request frames  */
1852 #define WMI_SCAN_FILTER_PROBE_REQ 0x20
1853 /* When set, DFS channels will not be scanned */
1854 #define WMI_SCAN_BYPASS_DFS_CHN 0x40
1855 /* Different FW scan engine may choose to bail out on errors.
1856  * Allow the driver to have influence over that. */
1857 #define WMI_SCAN_CONTINUE_ON_ERROR 0x80
1858 
1859 /* WMI_SCAN_CLASS_MASK must be the same value as IEEE80211_SCAN_CLASS_MASK */
1860 #define WMI_SCAN_CLASS_MASK 0xFF000000
1861 
1862 
1863 enum wmi_stop_scan_type {
1864 	WMI_SCAN_STOP_ONE	= 0x00000000, /* stop by scan_id */
1865 	WMI_SCAN_STOP_VDEV_ALL	= 0x01000000, /* stop by vdev_id */
1866 	WMI_SCAN_STOP_ALL	= 0x04000000, /* stop all scans */
1867 };
1868 
1869 struct wmi_stop_scan_cmd {
1870 	__le32 scan_req_id;
1871 	__le32 scan_id;
1872 	__le32 req_type;
1873 	__le32 vdev_id;
1874 } __packed;
1875 
1876 struct wmi_stop_scan_arg {
1877 	u32 req_id;
1878 	enum wmi_stop_scan_type req_type;
1879 	union {
1880 		u32 scan_id;
1881 		u32 vdev_id;
1882 	} u;
1883 };
1884 
1885 struct wmi_scan_chan_list_cmd {
1886 	__le32 num_scan_chans;
1887 	struct wmi_channel chan_info[0];
1888 } __packed;
1889 
1890 struct wmi_scan_chan_list_arg {
1891 	u32 n_channels;
1892 	struct wmi_channel_arg *channels;
1893 };
1894 
1895 enum wmi_bss_filter {
1896 	WMI_BSS_FILTER_NONE = 0,        /* no beacons forwarded */
1897 	WMI_BSS_FILTER_ALL,             /* all beacons forwarded */
1898 	WMI_BSS_FILTER_PROFILE,         /* only beacons matching profile */
1899 	WMI_BSS_FILTER_ALL_BUT_PROFILE, /* all but beacons matching profile */
1900 	WMI_BSS_FILTER_CURRENT_BSS,     /* only beacons matching current BSS */
1901 	WMI_BSS_FILTER_ALL_BUT_BSS,     /* all but beacons matching BSS */
1902 	WMI_BSS_FILTER_PROBED_SSID,     /* beacons matching probed ssid */
1903 	WMI_BSS_FILTER_LAST_BSS,        /* marker only */
1904 };
1905 
1906 enum wmi_scan_event_type {
1907 	WMI_SCAN_EVENT_STARTED         = 0x1,
1908 	WMI_SCAN_EVENT_COMPLETED       = 0x2,
1909 	WMI_SCAN_EVENT_BSS_CHANNEL     = 0x4,
1910 	WMI_SCAN_EVENT_FOREIGN_CHANNEL = 0x8,
1911 	WMI_SCAN_EVENT_DEQUEUED        = 0x10,
1912 	WMI_SCAN_EVENT_PREEMPTED       = 0x20, /* possibly by high-prio scan */
1913 	WMI_SCAN_EVENT_START_FAILED    = 0x40,
1914 	WMI_SCAN_EVENT_RESTARTED       = 0x80,
1915 	WMI_SCAN_EVENT_MAX             = 0x8000
1916 };
1917 
1918 enum wmi_scan_completion_reason {
1919 	WMI_SCAN_REASON_COMPLETED,
1920 	WMI_SCAN_REASON_CANCELLED,
1921 	WMI_SCAN_REASON_PREEMPTED,
1922 	WMI_SCAN_REASON_TIMEDOUT,
1923 	WMI_SCAN_REASON_MAX,
1924 };
1925 
1926 struct wmi_scan_event {
1927 	__le32 event_type; /* %WMI_SCAN_EVENT_ */
1928 	__le32 reason; /* %WMI_SCAN_REASON_ */
1929 	__le32 channel_freq; /* only valid for WMI_SCAN_EVENT_FOREIGN_CHANNEL */
1930 	__le32 scan_req_id;
1931 	__le32 scan_id;
1932 	__le32 vdev_id;
1933 } __packed;
1934 
1935 /*
1936  * This defines how much headroom is kept in the
1937  * receive frame between the descriptor and the
1938  * payload, in order for the WMI PHY error and
1939  * management handler to insert header contents.
1940  *
1941  * This is in bytes.
1942  */
1943 #define WMI_MGMT_RX_HDR_HEADROOM    52
1944 
1945 /*
1946  * This event will be used for sending scan results
1947  * as well as rx mgmt frames to the host. The rx buffer
1948  * will be sent as part of this WMI event. It would be a
1949  * good idea to pass all the fields in the RX status
1950  * descriptor up to the host.
1951  */
1952 struct wmi_mgmt_rx_hdr_v1 {
1953 	__le32 channel;
1954 	__le32 snr;
1955 	__le32 rate;
1956 	__le32 phy_mode;
1957 	__le32 buf_len;
1958 	__le32 status; /* %WMI_RX_STATUS_ */
1959 } __packed;
1960 
1961 struct wmi_mgmt_rx_hdr_v2 {
1962 	struct wmi_mgmt_rx_hdr_v1 v1;
1963 	__le32 rssi_ctl[4];
1964 } __packed;
1965 
1966 struct wmi_mgmt_rx_event_v1 {
1967 	struct wmi_mgmt_rx_hdr_v1 hdr;
1968 	u8 buf[0];
1969 } __packed;
1970 
1971 struct wmi_mgmt_rx_event_v2 {
1972 	struct wmi_mgmt_rx_hdr_v2 hdr;
1973 	u8 buf[0];
1974 } __packed;
1975 
1976 #define WMI_RX_STATUS_OK			0x00
1977 #define WMI_RX_STATUS_ERR_CRC			0x01
1978 #define WMI_RX_STATUS_ERR_DECRYPT		0x08
1979 #define WMI_RX_STATUS_ERR_MIC			0x10
1980 #define WMI_RX_STATUS_ERR_KEY_CACHE_MISS	0x20
1981 
1982 #define PHY_ERROR_SPECTRAL_SCAN		0x26
1983 #define PHY_ERROR_FALSE_RADAR_EXT		0x24
1984 #define PHY_ERROR_RADAR				0x05
1985 
1986 struct wmi_single_phyerr_rx_hdr {
1987 	/* TSF timestamp */
1988 	__le32 tsf_timestamp;
1989 
1990 	/*
1991 	 * Current freq1, freq2
1992 	 *
1993 	 * [7:0]:    freq1[lo]
1994 	 * [15:8] :   freq1[hi]
1995 	 * [23:16]:   freq2[lo]
1996 	 * [31:24]:   freq2[hi]
1997 	 */
1998 	__le16 freq1;
1999 	__le16 freq2;
2000 
2001 	/*
2002 	 * Combined RSSI over all chains and channel width for this PHY error
2003 	 *
2004 	 * [7:0]: RSSI combined
2005 	 * [15:8]: Channel width (MHz)
2006 	 * [23:16]: PHY error code
2007 	 * [24:16]: reserved (future use)
2008 	 */
2009 	u8 rssi_combined;
2010 	u8 chan_width_mhz;
2011 	u8 phy_err_code;
2012 	u8 rsvd0;
2013 
2014 	/*
2015 	 * RSSI on chain 0 through 3
2016 	 *
2017 	 * This is formatted the same as the PPDU_START RX descriptor
2018 	 * field:
2019 	 *
2020 	 * [7:0]:   pri20
2021 	 * [15:8]:  sec20
2022 	 * [23:16]: sec40
2023 	 * [31:24]: sec80
2024 	 */
2025 
2026 	__le32 rssi_chain0;
2027 	__le32 rssi_chain1;
2028 	__le32 rssi_chain2;
2029 	__le32 rssi_chain3;
2030 
2031 	/*
2032 	 * Last calibrated NF value for chain 0 through 3
2033 	 *
2034 	 * nf_list_1:
2035 	 *
2036 	 * + [15:0] - chain 0
2037 	 * + [31:16] - chain 1
2038 	 *
2039 	 * nf_list_2:
2040 	 *
2041 	 * + [15:0] - chain 2
2042 	 * + [31:16] - chain 3
2043 	 */
2044 	__le32 nf_list_1;
2045 	__le32 nf_list_2;
2046 
2047 
2048 	/* Length of the frame */
2049 	__le32 buf_len;
2050 } __packed;
2051 
2052 struct wmi_single_phyerr_rx_event {
2053 	/* Phy error event header */
2054 	struct wmi_single_phyerr_rx_hdr hdr;
2055 	/* frame buffer */
2056 	u8 bufp[0];
2057 } __packed;
2058 
2059 struct wmi_comb_phyerr_rx_hdr {
2060 	/* Phy error phy error count */
2061 	__le32 num_phyerr_events;
2062 	__le32 tsf_l32;
2063 	__le32 tsf_u32;
2064 } __packed;
2065 
2066 struct wmi_comb_phyerr_rx_event {
2067 	/* Phy error phy error count */
2068 	struct wmi_comb_phyerr_rx_hdr hdr;
2069 	/*
2070 	 * frame buffer - contains multiple payloads in the order:
2071 	 *                    header - payload, header - payload...
2072 	 *  (The header is of type: wmi_single_phyerr_rx_hdr)
2073 	 */
2074 	u8 bufp[0];
2075 } __packed;
2076 
2077 #define PHYERR_TLV_SIG				0xBB
2078 #define PHYERR_TLV_TAG_SEARCH_FFT_REPORT	0xFB
2079 #define PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY	0xF8
2080 
2081 struct phyerr_radar_report {
2082 	__le32 reg0; /* RADAR_REPORT_REG0_* */
2083 	__le32 reg1; /* REDAR_REPORT_REG1_* */
2084 } __packed;
2085 
2086 #define RADAR_REPORT_REG0_PULSE_IS_CHIRP_MASK		0x80000000
2087 #define RADAR_REPORT_REG0_PULSE_IS_CHIRP_LSB		31
2088 
2089 #define RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH_MASK	0x40000000
2090 #define RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH_LSB	30
2091 
2092 #define RADAR_REPORT_REG0_AGC_TOTAL_GAIN_MASK		0x3FF00000
2093 #define RADAR_REPORT_REG0_AGC_TOTAL_GAIN_LSB		20
2094 
2095 #define RADAR_REPORT_REG0_PULSE_DELTA_DIFF_MASK		0x000F0000
2096 #define RADAR_REPORT_REG0_PULSE_DELTA_DIFF_LSB		16
2097 
2098 #define RADAR_REPORT_REG0_PULSE_DELTA_PEAK_MASK		0x0000FC00
2099 #define RADAR_REPORT_REG0_PULSE_DELTA_PEAK_LSB		10
2100 
2101 #define RADAR_REPORT_REG0_PULSE_SIDX_MASK		0x000003FF
2102 #define RADAR_REPORT_REG0_PULSE_SIDX_LSB		0
2103 
2104 #define RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID_MASK	0x80000000
2105 #define RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID_LSB	31
2106 
2107 #define RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN_MASK	0x7F000000
2108 #define RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN_LSB		24
2109 
2110 #define RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK_MASK	0x00FF0000
2111 #define RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK_LSB	16
2112 
2113 #define RADAR_REPORT_REG1_PULSE_TSF_OFFSET_MASK		0x0000FF00
2114 #define RADAR_REPORT_REG1_PULSE_TSF_OFFSET_LSB		8
2115 
2116 #define RADAR_REPORT_REG1_PULSE_DUR_MASK		0x000000FF
2117 #define RADAR_REPORT_REG1_PULSE_DUR_LSB			0
2118 
2119 struct phyerr_fft_report {
2120 	__le32 reg0; /* SEARCH_FFT_REPORT_REG0_ * */
2121 	__le32 reg1; /* SEARCH_FFT_REPORT_REG1_ * */
2122 } __packed;
2123 
2124 #define SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB_MASK	0xFF800000
2125 #define SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB_LSB	23
2126 
2127 #define SEARCH_FFT_REPORT_REG0_BASE_PWR_DB_MASK		0x007FC000
2128 #define SEARCH_FFT_REPORT_REG0_BASE_PWR_DB_LSB		14
2129 
2130 #define SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX_MASK		0x00003000
2131 #define SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX_LSB		12
2132 
2133 #define SEARCH_FFT_REPORT_REG0_PEAK_SIDX_MASK		0x00000FFF
2134 #define SEARCH_FFT_REPORT_REG0_PEAK_SIDX_LSB		0
2135 
2136 #define SEARCH_FFT_REPORT_REG1_RELPWR_DB_MASK		0xFC000000
2137 #define SEARCH_FFT_REPORT_REG1_RELPWR_DB_LSB		26
2138 
2139 #define SEARCH_FFT_REPORT_REG1_AVGPWR_DB_MASK		0x03FC0000
2140 #define SEARCH_FFT_REPORT_REG1_AVGPWR_DB_LSB		18
2141 
2142 #define SEARCH_FFT_REPORT_REG1_PEAK_MAG_MASK		0x0003FF00
2143 #define SEARCH_FFT_REPORT_REG1_PEAK_MAG_LSB		8
2144 
2145 #define SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB_MASK	0x000000FF
2146 #define SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB_LSB	0
2147 
2148 
2149 struct phyerr_tlv {
2150 	__le16 len;
2151 	u8 tag;
2152 	u8 sig;
2153 } __packed;
2154 
2155 #define DFS_RSSI_POSSIBLY_FALSE			50
2156 #define DFS_PEAK_MAG_THOLD_POSSIBLY_FALSE	40
2157 
2158 struct wmi_mgmt_tx_hdr {
2159 	__le32 vdev_id;
2160 	struct wmi_mac_addr peer_macaddr;
2161 	__le32 tx_rate;
2162 	__le32 tx_power;
2163 	__le32 buf_len;
2164 } __packed;
2165 
2166 struct wmi_mgmt_tx_cmd {
2167 	struct wmi_mgmt_tx_hdr hdr;
2168 	u8 buf[0];
2169 } __packed;
2170 
2171 struct wmi_echo_event {
2172 	__le32 value;
2173 } __packed;
2174 
2175 struct wmi_echo_cmd {
2176 	__le32 value;
2177 } __packed;
2178 
2179 
2180 struct wmi_pdev_set_regdomain_cmd {
2181 	__le32 reg_domain;
2182 	__le32 reg_domain_2G;
2183 	__le32 reg_domain_5G;
2184 	__le32 conformance_test_limit_2G;
2185 	__le32 conformance_test_limit_5G;
2186 } __packed;
2187 
2188 /* Command to set/unset chip in quiet mode */
2189 struct wmi_pdev_set_quiet_cmd {
2190 	/* period in TUs */
2191 	__le32 period;
2192 
2193 	/* duration in TUs */
2194 	__le32 duration;
2195 
2196 	/* offset in TUs */
2197 	__le32 next_start;
2198 
2199 	/* enable/disable */
2200 	__le32 enabled;
2201 } __packed;
2202 
2203 
2204 /*
2205  * 802.11g protection mode.
2206  */
2207 enum ath10k_protmode {
2208 	ATH10K_PROT_NONE     = 0,    /* no protection */
2209 	ATH10K_PROT_CTSONLY  = 1,    /* CTS to self */
2210 	ATH10K_PROT_RTSCTS   = 2,    /* RTS-CTS */
2211 };
2212 
2213 enum wmi_beacon_gen_mode {
2214 	WMI_BEACON_STAGGERED_MODE = 0,
2215 	WMI_BEACON_BURST_MODE = 1
2216 };
2217 
2218 enum wmi_csa_event_ies_present_flag {
2219 	WMI_CSA_IE_PRESENT = 0x00000001,
2220 	WMI_XCSA_IE_PRESENT = 0x00000002,
2221 	WMI_WBW_IE_PRESENT = 0x00000004,
2222 	WMI_CSWARP_IE_PRESENT = 0x00000008,
2223 };
2224 
2225 /* wmi CSA receive event from beacon frame */
2226 struct wmi_csa_event {
2227 	__le32 i_fc_dur;
2228 	/* Bit 0-15: FC */
2229 	/* Bit 16-31: DUR */
2230 	struct wmi_mac_addr i_addr1;
2231 	struct wmi_mac_addr i_addr2;
2232 	__le32 csa_ie[2];
2233 	__le32 xcsa_ie[2];
2234 	__le32 wb_ie[2];
2235 	__le32 cswarp_ie;
2236 	__le32 ies_present_flag; /* wmi_csa_event_ies_present_flag */
2237 } __packed;
2238 
2239 /* the definition of different PDEV parameters */
2240 #define PDEV_DEFAULT_STATS_UPDATE_PERIOD    500
2241 #define VDEV_DEFAULT_STATS_UPDATE_PERIOD    500
2242 #define PEER_DEFAULT_STATS_UPDATE_PERIOD    500
2243 
2244 struct wmi_pdev_param_map {
2245 	u32 tx_chain_mask;
2246 	u32 rx_chain_mask;
2247 	u32 txpower_limit2g;
2248 	u32 txpower_limit5g;
2249 	u32 txpower_scale;
2250 	u32 beacon_gen_mode;
2251 	u32 beacon_tx_mode;
2252 	u32 resmgr_offchan_mode;
2253 	u32 protection_mode;
2254 	u32 dynamic_bw;
2255 	u32 non_agg_sw_retry_th;
2256 	u32 agg_sw_retry_th;
2257 	u32 sta_kickout_th;
2258 	u32 ac_aggrsize_scaling;
2259 	u32 ltr_enable;
2260 	u32 ltr_ac_latency_be;
2261 	u32 ltr_ac_latency_bk;
2262 	u32 ltr_ac_latency_vi;
2263 	u32 ltr_ac_latency_vo;
2264 	u32 ltr_ac_latency_timeout;
2265 	u32 ltr_sleep_override;
2266 	u32 ltr_rx_override;
2267 	u32 ltr_tx_activity_timeout;
2268 	u32 l1ss_enable;
2269 	u32 dsleep_enable;
2270 	u32 pcielp_txbuf_flush;
2271 	u32 pcielp_txbuf_watermark;
2272 	u32 pcielp_txbuf_tmo_en;
2273 	u32 pcielp_txbuf_tmo_value;
2274 	u32 pdev_stats_update_period;
2275 	u32 vdev_stats_update_period;
2276 	u32 peer_stats_update_period;
2277 	u32 bcnflt_stats_update_period;
2278 	u32 pmf_qos;
2279 	u32 arp_ac_override;
2280 	u32 arpdhcp_ac_override;
2281 	u32 dcs;
2282 	u32 ani_enable;
2283 	u32 ani_poll_period;
2284 	u32 ani_listen_period;
2285 	u32 ani_ofdm_level;
2286 	u32 ani_cck_level;
2287 	u32 dyntxchain;
2288 	u32 proxy_sta;
2289 	u32 idle_ps_config;
2290 	u32 power_gating_sleep;
2291 	u32 fast_channel_reset;
2292 	u32 burst_dur;
2293 	u32 burst_enable;
2294 };
2295 
2296 #define WMI_PDEV_PARAM_UNSUPPORTED 0
2297 
2298 enum wmi_pdev_param {
2299 	/* TX chian mask */
2300 	WMI_PDEV_PARAM_TX_CHAIN_MASK = 0x1,
2301 	/* RX chian mask */
2302 	WMI_PDEV_PARAM_RX_CHAIN_MASK,
2303 	/* TX power limit for 2G Radio */
2304 	WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
2305 	/* TX power limit for 5G Radio */
2306 	WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
2307 	/* TX power scale */
2308 	WMI_PDEV_PARAM_TXPOWER_SCALE,
2309 	/* Beacon generation mode . 0: host, 1: target   */
2310 	WMI_PDEV_PARAM_BEACON_GEN_MODE,
2311 	/* Beacon generation mode . 0: staggered 1: bursted   */
2312 	WMI_PDEV_PARAM_BEACON_TX_MODE,
2313 	/*
2314 	 * Resource manager off chan mode .
2315 	 * 0: turn off off chan mode. 1: turn on offchan mode
2316 	 */
2317 	WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
2318 	/*
2319 	 * Protection mode:
2320 	 * 0: no protection 1:use CTS-to-self 2: use RTS/CTS
2321 	 */
2322 	WMI_PDEV_PARAM_PROTECTION_MODE,
2323 	/*
2324 	 * Dynamic bandwidth - 0: disable, 1: enable
2325 	 *
2326 	 * When enabled HW rate control tries different bandwidths when
2327 	 * retransmitting frames.
2328 	 */
2329 	WMI_PDEV_PARAM_DYNAMIC_BW,
2330 	/* Non aggregrate/ 11g sw retry threshold.0-disable */
2331 	WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
2332 	/* aggregrate sw retry threshold. 0-disable*/
2333 	WMI_PDEV_PARAM_AGG_SW_RETRY_TH,
2334 	/* Station kickout threshold (non of consecutive failures).0-disable */
2335 	WMI_PDEV_PARAM_STA_KICKOUT_TH,
2336 	/* Aggerate size scaling configuration per AC */
2337 	WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING,
2338 	/* LTR enable */
2339 	WMI_PDEV_PARAM_LTR_ENABLE,
2340 	/* LTR latency for BE, in us */
2341 	WMI_PDEV_PARAM_LTR_AC_LATENCY_BE,
2342 	/* LTR latency for BK, in us */
2343 	WMI_PDEV_PARAM_LTR_AC_LATENCY_BK,
2344 	/* LTR latency for VI, in us */
2345 	WMI_PDEV_PARAM_LTR_AC_LATENCY_VI,
2346 	/* LTR latency for VO, in us  */
2347 	WMI_PDEV_PARAM_LTR_AC_LATENCY_VO,
2348 	/* LTR AC latency timeout, in ms */
2349 	WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
2350 	/* LTR platform latency override, in us */
2351 	WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
2352 	/* LTR-RX override, in us */
2353 	WMI_PDEV_PARAM_LTR_RX_OVERRIDE,
2354 	/* Tx activity timeout for LTR, in us */
2355 	WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
2356 	/* L1SS state machine enable */
2357 	WMI_PDEV_PARAM_L1SS_ENABLE,
2358 	/* Deep sleep state machine enable */
2359 	WMI_PDEV_PARAM_DSLEEP_ENABLE,
2360 	/* RX buffering flush enable */
2361 	WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH,
2362 	/* RX buffering matermark */
2363 	WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK,
2364 	/* RX buffering timeout enable */
2365 	WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN,
2366 	/* RX buffering timeout value */
2367 	WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE,
2368 	/* pdev level stats update period in ms */
2369 	WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
2370 	/* vdev level stats update period in ms */
2371 	WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
2372 	/* peer level stats update period in ms */
2373 	WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
2374 	/* beacon filter status update period */
2375 	WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
2376 	/* QOS Mgmt frame protection MFP/PMF 0: disable, 1: enable */
2377 	WMI_PDEV_PARAM_PMF_QOS,
2378 	/* Access category on which ARP frames are sent */
2379 	WMI_PDEV_PARAM_ARP_AC_OVERRIDE,
2380 	/* DCS configuration */
2381 	WMI_PDEV_PARAM_DCS,
2382 	/* Enable/Disable ANI on target */
2383 	WMI_PDEV_PARAM_ANI_ENABLE,
2384 	/* configure the ANI polling period */
2385 	WMI_PDEV_PARAM_ANI_POLL_PERIOD,
2386 	/* configure the ANI listening period */
2387 	WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
2388 	/* configure OFDM immunity level */
2389 	WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
2390 	/* configure CCK immunity level */
2391 	WMI_PDEV_PARAM_ANI_CCK_LEVEL,
2392 	/* Enable/Disable CDD for 1x1 STAs in rate control module */
2393 	WMI_PDEV_PARAM_DYNTXCHAIN,
2394 	/* Enable/Disable proxy STA */
2395 	WMI_PDEV_PARAM_PROXY_STA,
2396 	/* Enable/Disable low power state when all VDEVs are inactive/idle. */
2397 	WMI_PDEV_PARAM_IDLE_PS_CONFIG,
2398 	/* Enable/Disable power gating sleep */
2399 	WMI_PDEV_PARAM_POWER_GATING_SLEEP,
2400 };
2401 
2402 enum wmi_10x_pdev_param {
2403 	/* TX chian mask */
2404 	WMI_10X_PDEV_PARAM_TX_CHAIN_MASK = 0x1,
2405 	/* RX chian mask */
2406 	WMI_10X_PDEV_PARAM_RX_CHAIN_MASK,
2407 	/* TX power limit for 2G Radio */
2408 	WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G,
2409 	/* TX power limit for 5G Radio */
2410 	WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G,
2411 	/* TX power scale */
2412 	WMI_10X_PDEV_PARAM_TXPOWER_SCALE,
2413 	/* Beacon generation mode . 0: host, 1: target   */
2414 	WMI_10X_PDEV_PARAM_BEACON_GEN_MODE,
2415 	/* Beacon generation mode . 0: staggered 1: bursted   */
2416 	WMI_10X_PDEV_PARAM_BEACON_TX_MODE,
2417 	/*
2418 	 * Resource manager off chan mode .
2419 	 * 0: turn off off chan mode. 1: turn on offchan mode
2420 	 */
2421 	WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
2422 	/*
2423 	 * Protection mode:
2424 	 * 0: no protection 1:use CTS-to-self 2: use RTS/CTS
2425 	 */
2426 	WMI_10X_PDEV_PARAM_PROTECTION_MODE,
2427 	/* Dynamic bandwidth 0: disable 1: enable */
2428 	WMI_10X_PDEV_PARAM_DYNAMIC_BW,
2429 	/* Non aggregrate/ 11g sw retry threshold.0-disable */
2430 	WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
2431 	/* aggregrate sw retry threshold. 0-disable*/
2432 	WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH,
2433 	/* Station kickout threshold (non of consecutive failures).0-disable */
2434 	WMI_10X_PDEV_PARAM_STA_KICKOUT_TH,
2435 	/* Aggerate size scaling configuration per AC */
2436 	WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING,
2437 	/* LTR enable */
2438 	WMI_10X_PDEV_PARAM_LTR_ENABLE,
2439 	/* LTR latency for BE, in us */
2440 	WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE,
2441 	/* LTR latency for BK, in us */
2442 	WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK,
2443 	/* LTR latency for VI, in us */
2444 	WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI,
2445 	/* LTR latency for VO, in us  */
2446 	WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO,
2447 	/* LTR AC latency timeout, in ms */
2448 	WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
2449 	/* LTR platform latency override, in us */
2450 	WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
2451 	/* LTR-RX override, in us */
2452 	WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE,
2453 	/* Tx activity timeout for LTR, in us */
2454 	WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
2455 	/* L1SS state machine enable */
2456 	WMI_10X_PDEV_PARAM_L1SS_ENABLE,
2457 	/* Deep sleep state machine enable */
2458 	WMI_10X_PDEV_PARAM_DSLEEP_ENABLE,
2459 	/* pdev level stats update period in ms */
2460 	WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
2461 	/* vdev level stats update period in ms */
2462 	WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
2463 	/* peer level stats update period in ms */
2464 	WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
2465 	/* beacon filter status update period */
2466 	WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
2467 	/* QOS Mgmt frame protection MFP/PMF 0: disable, 1: enable */
2468 	WMI_10X_PDEV_PARAM_PMF_QOS,
2469 	/* Access category on which ARP and DHCP frames are sent */
2470 	WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE,
2471 	/* DCS configuration */
2472 	WMI_10X_PDEV_PARAM_DCS,
2473 	/* Enable/Disable ANI on target */
2474 	WMI_10X_PDEV_PARAM_ANI_ENABLE,
2475 	/* configure the ANI polling period */
2476 	WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD,
2477 	/* configure the ANI listening period */
2478 	WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD,
2479 	/* configure OFDM immunity level */
2480 	WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL,
2481 	/* configure CCK immunity level */
2482 	WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL,
2483 	/* Enable/Disable CDD for 1x1 STAs in rate control module */
2484 	WMI_10X_PDEV_PARAM_DYNTXCHAIN,
2485 	/* Enable/Disable Fast channel reset*/
2486 	WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET,
2487 	/* Set Bursting DUR */
2488 	WMI_10X_PDEV_PARAM_BURST_DUR,
2489 	/* Set Bursting Enable*/
2490 	WMI_10X_PDEV_PARAM_BURST_ENABLE,
2491 };
2492 
2493 struct wmi_pdev_set_param_cmd {
2494 	__le32 param_id;
2495 	__le32 param_value;
2496 } __packed;
2497 
2498 struct wmi_pdev_get_tpc_config_cmd {
2499 	/* parameter   */
2500 	__le32 param;
2501 } __packed;
2502 
2503 #define WMI_TPC_RATE_MAX		160
2504 #define WMI_TPC_TX_N_CHAIN		4
2505 
2506 enum wmi_tpc_config_event_flag {
2507 	WMI_TPC_CONFIG_EVENT_FLAG_TABLE_CDD	= 0x1,
2508 	WMI_TPC_CONFIG_EVENT_FLAG_TABLE_STBC	= 0x2,
2509 	WMI_TPC_CONFIG_EVENT_FLAG_TABLE_TXBF	= 0x4,
2510 };
2511 
2512 struct wmi_pdev_tpc_config_event {
2513 	__le32 reg_domain;
2514 	__le32 chan_freq;
2515 	__le32 phy_mode;
2516 	__le32 twice_antenna_reduction;
2517 	__le32 twice_max_rd_power;
2518 	s32 twice_antenna_gain;
2519 	__le32 power_limit;
2520 	__le32 rate_max;
2521 	__le32 num_tx_chain;
2522 	__le32 ctl;
2523 	__le32 flags;
2524 	s8 max_reg_allow_pow[WMI_TPC_TX_N_CHAIN];
2525 	s8 max_reg_allow_pow_agcdd[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
2526 	s8 max_reg_allow_pow_agstbc[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
2527 	s8 max_reg_allow_pow_agtxbf[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
2528 	u8 rates_array[WMI_TPC_RATE_MAX];
2529 } __packed;
2530 
2531 /* Transmit power scale factor. */
2532 enum wmi_tp_scale {
2533 	WMI_TP_SCALE_MAX    = 0,	/* no scaling (default) */
2534 	WMI_TP_SCALE_50     = 1,	/* 50% of max (-3 dBm) */
2535 	WMI_TP_SCALE_25     = 2,	/* 25% of max (-6 dBm) */
2536 	WMI_TP_SCALE_12     = 3,	/* 12% of max (-9 dBm) */
2537 	WMI_TP_SCALE_MIN    = 4,	/* min, but still on   */
2538 	WMI_TP_SCALE_SIZE   = 5,	/* max num of enum     */
2539 };
2540 
2541 struct wmi_set_channel_cmd {
2542 	/* channel (only frequency and mode info are used) */
2543 	struct wmi_channel chan;
2544 } __packed;
2545 
2546 struct wmi_pdev_chanlist_update_event {
2547 	/* number of channels */
2548 	__le32 num_chan;
2549 	/* array of channels */
2550 	struct wmi_channel channel_list[1];
2551 } __packed;
2552 
2553 #define WMI_MAX_DEBUG_MESG (sizeof(u32) * 32)
2554 
2555 struct wmi_debug_mesg_event {
2556 	/* message buffer, NULL terminated */
2557 	char bufp[WMI_MAX_DEBUG_MESG];
2558 } __packed;
2559 
2560 enum {
2561 	/* P2P device */
2562 	VDEV_SUBTYPE_P2PDEV = 0,
2563 	/* P2P client */
2564 	VDEV_SUBTYPE_P2PCLI,
2565 	/* P2P GO */
2566 	VDEV_SUBTYPE_P2PGO,
2567 	/* BT3.0 HS */
2568 	VDEV_SUBTYPE_BT,
2569 };
2570 
2571 struct wmi_pdev_set_channel_cmd {
2572 	/* idnore power , only use flags , mode and freq */
2573 	struct wmi_channel chan;
2574 } __packed;
2575 
2576 /* Customize the DSCP (bit) to TID (0-7) mapping for QOS */
2577 #define WMI_DSCP_MAP_MAX    (64)
2578 struct wmi_pdev_set_dscp_tid_map_cmd {
2579 	/* map indicating DSCP to TID conversion */
2580 	__le32 dscp_to_tid_map[WMI_DSCP_MAP_MAX];
2581 } __packed;
2582 
2583 enum mcast_bcast_rate_id {
2584 	WMI_SET_MCAST_RATE,
2585 	WMI_SET_BCAST_RATE
2586 };
2587 
2588 struct mcast_bcast_rate {
2589 	enum mcast_bcast_rate_id rate_id;
2590 	__le32 rate;
2591 } __packed;
2592 
2593 struct wmi_wmm_params {
2594 	__le32 cwmin;
2595 	__le32 cwmax;
2596 	__le32 aifs;
2597 	__le32 txop;
2598 	__le32 acm;
2599 	__le32 no_ack;
2600 } __packed;
2601 
2602 struct wmi_pdev_set_wmm_params {
2603 	struct wmi_wmm_params ac_be;
2604 	struct wmi_wmm_params ac_bk;
2605 	struct wmi_wmm_params ac_vi;
2606 	struct wmi_wmm_params ac_vo;
2607 } __packed;
2608 
2609 struct wmi_wmm_params_arg {
2610 	u32 cwmin;
2611 	u32 cwmax;
2612 	u32 aifs;
2613 	u32 txop;
2614 	u32 acm;
2615 	u32 no_ack;
2616 };
2617 
2618 struct wmi_pdev_set_wmm_params_arg {
2619 	struct wmi_wmm_params_arg ac_be;
2620 	struct wmi_wmm_params_arg ac_bk;
2621 	struct wmi_wmm_params_arg ac_vi;
2622 	struct wmi_wmm_params_arg ac_vo;
2623 };
2624 
2625 struct wal_dbg_tx_stats {
2626 	/* Num HTT cookies queued to dispatch list */
2627 	__le32 comp_queued;
2628 
2629 	/* Num HTT cookies dispatched */
2630 	__le32 comp_delivered;
2631 
2632 	/* Num MSDU queued to WAL */
2633 	__le32 msdu_enqued;
2634 
2635 	/* Num MPDU queue to WAL */
2636 	__le32 mpdu_enqued;
2637 
2638 	/* Num MSDUs dropped by WMM limit */
2639 	__le32 wmm_drop;
2640 
2641 	/* Num Local frames queued */
2642 	__le32 local_enqued;
2643 
2644 	/* Num Local frames done */
2645 	__le32 local_freed;
2646 
2647 	/* Num queued to HW */
2648 	__le32 hw_queued;
2649 
2650 	/* Num PPDU reaped from HW */
2651 	__le32 hw_reaped;
2652 
2653 	/* Num underruns */
2654 	__le32 underrun;
2655 
2656 	/* Num PPDUs cleaned up in TX abort */
2657 	__le32 tx_abort;
2658 
2659 	/* Num MPDUs requed by SW */
2660 	__le32 mpdus_requed;
2661 
2662 	/* excessive retries */
2663 	__le32 tx_ko;
2664 
2665 	/* data hw rate code */
2666 	__le32 data_rc;
2667 
2668 	/* Scheduler self triggers */
2669 	__le32 self_triggers;
2670 
2671 	/* frames dropped due to excessive sw retries */
2672 	__le32 sw_retry_failure;
2673 
2674 	/* illegal rate phy errors  */
2675 	__le32 illgl_rate_phy_err;
2676 
2677 	/* wal pdev continous xretry */
2678 	__le32 pdev_cont_xretry;
2679 
2680 	/* wal pdev continous xretry */
2681 	__le32 pdev_tx_timeout;
2682 
2683 	/* wal pdev resets  */
2684 	__le32 pdev_resets;
2685 
2686 	__le32 phy_underrun;
2687 
2688 	/* MPDU is more than txop limit */
2689 	__le32 txop_ovf;
2690 } __packed;
2691 
2692 struct wal_dbg_rx_stats {
2693 	/* Cnts any change in ring routing mid-ppdu */
2694 	__le32 mid_ppdu_route_change;
2695 
2696 	/* Total number of statuses processed */
2697 	__le32 status_rcvd;
2698 
2699 	/* Extra frags on rings 0-3 */
2700 	__le32 r0_frags;
2701 	__le32 r1_frags;
2702 	__le32 r2_frags;
2703 	__le32 r3_frags;
2704 
2705 	/* MSDUs / MPDUs delivered to HTT */
2706 	__le32 htt_msdus;
2707 	__le32 htt_mpdus;
2708 
2709 	/* MSDUs / MPDUs delivered to local stack */
2710 	__le32 loc_msdus;
2711 	__le32 loc_mpdus;
2712 
2713 	/* AMSDUs that have more MSDUs than the status ring size */
2714 	__le32 oversize_amsdu;
2715 
2716 	/* Number of PHY errors */
2717 	__le32 phy_errs;
2718 
2719 	/* Number of PHY errors drops */
2720 	__le32 phy_err_drop;
2721 
2722 	/* Number of mpdu errors - FCS, MIC, ENC etc. */
2723 	__le32 mpdu_errs;
2724 } __packed;
2725 
2726 struct wal_dbg_peer_stats {
2727 	/* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
2728 	__le32 dummy;
2729 } __packed;
2730 
2731 struct wal_dbg_stats {
2732 	struct wal_dbg_tx_stats tx;
2733 	struct wal_dbg_rx_stats rx;
2734 	struct wal_dbg_peer_stats peer;
2735 } __packed;
2736 
2737 enum wmi_stats_id {
2738 	WMI_REQUEST_PEER_STAT	= 0x01,
2739 	WMI_REQUEST_AP_STAT	= 0x02
2740 };
2741 
2742 struct wmi_request_stats_cmd {
2743 	__le32 stats_id;
2744 
2745 	/*
2746 	 * Space to add parameters like
2747 	 * peer mac addr
2748 	 */
2749 } __packed;
2750 
2751 /* Suspend option */
2752 enum {
2753 	/* suspend */
2754 	WMI_PDEV_SUSPEND,
2755 
2756 	/* suspend and disable all interrupts */
2757 	WMI_PDEV_SUSPEND_AND_DISABLE_INTR,
2758 };
2759 
2760 struct wmi_pdev_suspend_cmd {
2761 	/* suspend option sent to target */
2762 	__le32 suspend_opt;
2763 } __packed;
2764 
2765 struct wmi_stats_event {
2766 	__le32 stats_id; /* %WMI_REQUEST_ */
2767 	/*
2768 	 * number of pdev stats event structures
2769 	 * (wmi_pdev_stats) 0 or 1
2770 	 */
2771 	__le32 num_pdev_stats;
2772 	/*
2773 	 * number of vdev stats event structures
2774 	 * (wmi_vdev_stats) 0 or max vdevs
2775 	 */
2776 	__le32 num_vdev_stats;
2777 	/*
2778 	 * number of peer stats event structures
2779 	 * (wmi_peer_stats) 0 or max peers
2780 	 */
2781 	__le32 num_peer_stats;
2782 	__le32 num_bcnflt_stats;
2783 	/*
2784 	 * followed by
2785 	 *   num_pdev_stats * size of(struct wmi_pdev_stats)
2786 	 *   num_vdev_stats * size of(struct wmi_vdev_stats)
2787 	 *   num_peer_stats * size of(struct wmi_peer_stats)
2788 	 *
2789 	 *  By having a zero sized array, the pointer to data area
2790 	 *  becomes available without increasing the struct size
2791 	 */
2792 	u8 data[0];
2793 } __packed;
2794 
2795 /*
2796  * PDEV statistics
2797  * TODO: add all PDEV stats here
2798  */
2799 struct wmi_pdev_stats {
2800 	__le32 chan_nf;        /* Channel noise floor */
2801 	__le32 tx_frame_count; /* TX frame count */
2802 	__le32 rx_frame_count; /* RX frame count */
2803 	__le32 rx_clear_count; /* rx clear count */
2804 	__le32 cycle_count;    /* cycle count */
2805 	__le32 phy_err_count;  /* Phy error count */
2806 	__le32 chan_tx_pwr;    /* channel tx power */
2807 	struct wal_dbg_stats wal; /* WAL dbg stats */
2808 } __packed;
2809 
2810 /*
2811  * VDEV statistics
2812  * TODO: add all VDEV stats here
2813  */
2814 struct wmi_vdev_stats {
2815 	__le32 vdev_id;
2816 } __packed;
2817 
2818 /*
2819  * peer statistics.
2820  * TODO: add more stats
2821  */
2822 struct wmi_peer_stats {
2823 	struct wmi_mac_addr peer_macaddr;
2824 	__le32 peer_rssi;
2825 	__le32 peer_tx_rate;
2826 } __packed;
2827 
2828 struct wmi_vdev_create_cmd {
2829 	__le32 vdev_id;
2830 	__le32 vdev_type;
2831 	__le32 vdev_subtype;
2832 	struct wmi_mac_addr vdev_macaddr;
2833 } __packed;
2834 
2835 enum wmi_vdev_type {
2836 	WMI_VDEV_TYPE_AP      = 1,
2837 	WMI_VDEV_TYPE_STA     = 2,
2838 	WMI_VDEV_TYPE_IBSS    = 3,
2839 	WMI_VDEV_TYPE_MONITOR = 4,
2840 };
2841 
2842 enum wmi_vdev_subtype {
2843 	WMI_VDEV_SUBTYPE_NONE       = 0,
2844 	WMI_VDEV_SUBTYPE_P2P_DEVICE = 1,
2845 	WMI_VDEV_SUBTYPE_P2P_CLIENT = 2,
2846 	WMI_VDEV_SUBTYPE_P2P_GO     = 3,
2847 };
2848 
2849 /* values for vdev_subtype */
2850 
2851 /* values for vdev_start_request flags */
2852 /*
2853  * Indicates that AP VDEV uses hidden ssid. only valid for
2854  *  AP/GO */
2855 #define WMI_VDEV_START_HIDDEN_SSID  (1<<0)
2856 /*
2857  * Indicates if robust management frame/management frame
2858  *  protection is enabled. For GO/AP vdevs, it indicates that
2859  *  it may support station/client associations with RMF enabled.
2860  *  For STA/client vdevs, it indicates that sta will
2861  *  associate with AP with RMF enabled. */
2862 #define WMI_VDEV_START_PMF_ENABLED  (1<<1)
2863 
2864 struct wmi_p2p_noa_descriptor {
2865 	__le32 type_count; /* 255: continuous schedule, 0: reserved */
2866 	__le32 duration;  /* Absent period duration in micro seconds */
2867 	__le32 interval;   /* Absent period interval in micro seconds */
2868 	__le32 start_time; /* 32 bit tsf time when in starts */
2869 } __packed;
2870 
2871 struct wmi_vdev_start_request_cmd {
2872 	/* WMI channel */
2873 	struct wmi_channel chan;
2874 	/* unique id identifying the VDEV, generated by the caller */
2875 	__le32 vdev_id;
2876 	/* requestor id identifying the caller module */
2877 	__le32 requestor_id;
2878 	/* beacon interval from received beacon */
2879 	__le32 beacon_interval;
2880 	/* DTIM Period from the received beacon */
2881 	__le32 dtim_period;
2882 	/* Flags */
2883 	__le32 flags;
2884 	/* ssid field. Only valid for AP/GO/IBSS/BTAmp VDEV type. */
2885 	struct wmi_ssid ssid;
2886 	/* beacon/probe reponse xmit rate. Applicable for SoftAP. */
2887 	__le32 bcn_tx_rate;
2888 	/* beacon/probe reponse xmit power. Applicable for SoftAP. */
2889 	__le32 bcn_tx_power;
2890 	/* number of p2p NOA descriptor(s) from scan entry */
2891 	__le32 num_noa_descriptors;
2892 	/*
2893 	 * Disable H/W ack. This used by WMI_VDEV_RESTART_REQUEST_CMDID.
2894 	 * During CAC, Our HW shouldn't ack ditected frames
2895 	 */
2896 	__le32 disable_hw_ack;
2897 	/* actual p2p NOA descriptor from scan entry */
2898 	struct wmi_p2p_noa_descriptor noa_descriptors[2];
2899 } __packed;
2900 
2901 struct wmi_vdev_restart_request_cmd {
2902 	struct wmi_vdev_start_request_cmd vdev_start_request_cmd;
2903 } __packed;
2904 
2905 struct wmi_vdev_start_request_arg {
2906 	u32 vdev_id;
2907 	struct wmi_channel_arg channel;
2908 	u32 bcn_intval;
2909 	u32 dtim_period;
2910 	u8 *ssid;
2911 	u32 ssid_len;
2912 	u32 bcn_tx_rate;
2913 	u32 bcn_tx_power;
2914 	bool disable_hw_ack;
2915 	bool hidden_ssid;
2916 	bool pmf_enabled;
2917 };
2918 
2919 struct wmi_vdev_delete_cmd {
2920 	/* unique id identifying the VDEV, generated by the caller */
2921 	__le32 vdev_id;
2922 } __packed;
2923 
2924 struct wmi_vdev_up_cmd {
2925 	__le32 vdev_id;
2926 	__le32 vdev_assoc_id;
2927 	struct wmi_mac_addr vdev_bssid;
2928 } __packed;
2929 
2930 struct wmi_vdev_stop_cmd {
2931 	__le32 vdev_id;
2932 } __packed;
2933 
2934 struct wmi_vdev_down_cmd {
2935 	__le32 vdev_id;
2936 } __packed;
2937 
2938 struct wmi_vdev_standby_response_cmd {
2939 	/* unique id identifying the VDEV, generated by the caller */
2940 	__le32 vdev_id;
2941 } __packed;
2942 
2943 struct wmi_vdev_resume_response_cmd {
2944 	/* unique id identifying the VDEV, generated by the caller */
2945 	__le32 vdev_id;
2946 } __packed;
2947 
2948 struct wmi_vdev_set_param_cmd {
2949 	__le32 vdev_id;
2950 	__le32 param_id;
2951 	__le32 param_value;
2952 } __packed;
2953 
2954 #define WMI_MAX_KEY_INDEX   3
2955 #define WMI_MAX_KEY_LEN     32
2956 
2957 #define WMI_KEY_PAIRWISE 0x00
2958 #define WMI_KEY_GROUP    0x01
2959 #define WMI_KEY_TX_USAGE 0x02 /* default tx key - static wep */
2960 
2961 struct wmi_key_seq_counter {
2962 	__le32 key_seq_counter_l;
2963 	__le32 key_seq_counter_h;
2964 } __packed;
2965 
2966 #define WMI_CIPHER_NONE     0x0 /* clear key */
2967 #define WMI_CIPHER_WEP      0x1
2968 #define WMI_CIPHER_TKIP     0x2
2969 #define WMI_CIPHER_AES_OCB  0x3
2970 #define WMI_CIPHER_AES_CCM  0x4
2971 #define WMI_CIPHER_WAPI     0x5
2972 #define WMI_CIPHER_CKIP     0x6
2973 #define WMI_CIPHER_AES_CMAC 0x7
2974 
2975 struct wmi_vdev_install_key_cmd {
2976 	__le32 vdev_id;
2977 	struct wmi_mac_addr peer_macaddr;
2978 	__le32 key_idx;
2979 	__le32 key_flags;
2980 	__le32 key_cipher; /* %WMI_CIPHER_ */
2981 	struct wmi_key_seq_counter key_rsc_counter;
2982 	struct wmi_key_seq_counter key_global_rsc_counter;
2983 	struct wmi_key_seq_counter key_tsc_counter;
2984 	u8 wpi_key_rsc_counter[16];
2985 	u8 wpi_key_tsc_counter[16];
2986 	__le32 key_len;
2987 	__le32 key_txmic_len;
2988 	__le32 key_rxmic_len;
2989 
2990 	/* contains key followed by tx mic followed by rx mic */
2991 	u8 key_data[0];
2992 } __packed;
2993 
2994 struct wmi_vdev_install_key_arg {
2995 	u32 vdev_id;
2996 	const u8 *macaddr;
2997 	u32 key_idx;
2998 	u32 key_flags;
2999 	u32 key_cipher;
3000 	u32 key_len;
3001 	u32 key_txmic_len;
3002 	u32 key_rxmic_len;
3003 	const void *key_data;
3004 };
3005 
3006 /*
3007  * vdev fixed rate format:
3008  * - preamble - b7:b6 - see WMI_RATE_PREMABLE_
3009  * - nss      - b5:b4 - ss number (0 mean 1ss)
3010  * - rate_mcs - b3:b0 - as below
3011  *    CCK:  0 - 11Mbps, 1 - 5,5Mbps, 2 - 2Mbps, 3 - 1Mbps,
3012  *          4 - 11Mbps (s), 5 - 5,5Mbps (s), 6 - 2Mbps (s)
3013  *    OFDM: 0 - 48Mbps, 1 - 24Mbps, 2 - 12Mbps, 3 - 6Mbps,
3014  *          4 - 54Mbps, 5 - 36Mbps, 6 - 18Mbps, 7 - 9Mbps
3015  *    HT/VHT: MCS index
3016  */
3017 
3018 /* Preamble types to be used with VDEV fixed rate configuration */
3019 enum wmi_rate_preamble {
3020 	WMI_RATE_PREAMBLE_OFDM,
3021 	WMI_RATE_PREAMBLE_CCK,
3022 	WMI_RATE_PREAMBLE_HT,
3023 	WMI_RATE_PREAMBLE_VHT,
3024 };
3025 
3026 /* Value to disable fixed rate setting */
3027 #define WMI_FIXED_RATE_NONE    (0xff)
3028 
3029 struct wmi_vdev_param_map {
3030 	u32 rts_threshold;
3031 	u32 fragmentation_threshold;
3032 	u32 beacon_interval;
3033 	u32 listen_interval;
3034 	u32 multicast_rate;
3035 	u32 mgmt_tx_rate;
3036 	u32 slot_time;
3037 	u32 preamble;
3038 	u32 swba_time;
3039 	u32 wmi_vdev_stats_update_period;
3040 	u32 wmi_vdev_pwrsave_ageout_time;
3041 	u32 wmi_vdev_host_swba_interval;
3042 	u32 dtim_period;
3043 	u32 wmi_vdev_oc_scheduler_air_time_limit;
3044 	u32 wds;
3045 	u32 atim_window;
3046 	u32 bmiss_count_max;
3047 	u32 bmiss_first_bcnt;
3048 	u32 bmiss_final_bcnt;
3049 	u32 feature_wmm;
3050 	u32 chwidth;
3051 	u32 chextoffset;
3052 	u32 disable_htprotection;
3053 	u32 sta_quickkickout;
3054 	u32 mgmt_rate;
3055 	u32 protection_mode;
3056 	u32 fixed_rate;
3057 	u32 sgi;
3058 	u32 ldpc;
3059 	u32 tx_stbc;
3060 	u32 rx_stbc;
3061 	u32 intra_bss_fwd;
3062 	u32 def_keyid;
3063 	u32 nss;
3064 	u32 bcast_data_rate;
3065 	u32 mcast_data_rate;
3066 	u32 mcast_indicate;
3067 	u32 dhcp_indicate;
3068 	u32 unknown_dest_indicate;
3069 	u32 ap_keepalive_min_idle_inactive_time_secs;
3070 	u32 ap_keepalive_max_idle_inactive_time_secs;
3071 	u32 ap_keepalive_max_unresponsive_time_secs;
3072 	u32 ap_enable_nawds;
3073 	u32 mcast2ucast_set;
3074 	u32 enable_rtscts;
3075 	u32 txbf;
3076 	u32 packet_powersave;
3077 	u32 drop_unencry;
3078 	u32 tx_encap_type;
3079 	u32 ap_detect_out_of_sync_sleeping_sta_time_secs;
3080 };
3081 
3082 #define WMI_VDEV_PARAM_UNSUPPORTED 0
3083 
3084 /* the definition of different VDEV parameters */
3085 enum wmi_vdev_param {
3086 	/* RTS Threshold */
3087 	WMI_VDEV_PARAM_RTS_THRESHOLD = 0x1,
3088 	/* Fragmentation threshold */
3089 	WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
3090 	/* beacon interval in TUs */
3091 	WMI_VDEV_PARAM_BEACON_INTERVAL,
3092 	/* Listen interval in TUs */
3093 	WMI_VDEV_PARAM_LISTEN_INTERVAL,
3094 	/* muticast rate in Mbps */
3095 	WMI_VDEV_PARAM_MULTICAST_RATE,
3096 	/* management frame rate in Mbps */
3097 	WMI_VDEV_PARAM_MGMT_TX_RATE,
3098 	/* slot time (long vs short) */
3099 	WMI_VDEV_PARAM_SLOT_TIME,
3100 	/* preamble (long vs short) */
3101 	WMI_VDEV_PARAM_PREAMBLE,
3102 	/* SWBA time (time before tbtt in msec) */
3103 	WMI_VDEV_PARAM_SWBA_TIME,
3104 	/* time period for updating VDEV stats */
3105 	WMI_VDEV_STATS_UPDATE_PERIOD,
3106 	/* age out time in msec for frames queued for station in power save */
3107 	WMI_VDEV_PWRSAVE_AGEOUT_TIME,
3108 	/*
3109 	 * Host SWBA interval (time in msec before tbtt for SWBA event
3110 	 * generation).
3111 	 */
3112 	WMI_VDEV_HOST_SWBA_INTERVAL,
3113 	/* DTIM period (specified in units of num beacon intervals) */
3114 	WMI_VDEV_PARAM_DTIM_PERIOD,
3115 	/*
3116 	 * scheduler air time limit for this VDEV. used by off chan
3117 	 * scheduler.
3118 	 */
3119 	WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
3120 	/* enable/dsiable WDS for this VDEV  */
3121 	WMI_VDEV_PARAM_WDS,
3122 	/* ATIM Window */
3123 	WMI_VDEV_PARAM_ATIM_WINDOW,
3124 	/* BMISS max */
3125 	WMI_VDEV_PARAM_BMISS_COUNT_MAX,
3126 	/* BMISS first time */
3127 	WMI_VDEV_PARAM_BMISS_FIRST_BCNT,
3128 	/* BMISS final time */
3129 	WMI_VDEV_PARAM_BMISS_FINAL_BCNT,
3130 	/* WMM enables/disabled */
3131 	WMI_VDEV_PARAM_FEATURE_WMM,
3132 	/* Channel width */
3133 	WMI_VDEV_PARAM_CHWIDTH,
3134 	/* Channel Offset */
3135 	WMI_VDEV_PARAM_CHEXTOFFSET,
3136 	/* Disable HT Protection */
3137 	WMI_VDEV_PARAM_DISABLE_HTPROTECTION,
3138 	/* Quick STA Kickout */
3139 	WMI_VDEV_PARAM_STA_QUICKKICKOUT,
3140 	/* Rate to be used with Management frames */
3141 	WMI_VDEV_PARAM_MGMT_RATE,
3142 	/* Protection Mode */
3143 	WMI_VDEV_PARAM_PROTECTION_MODE,
3144 	/* Fixed rate setting */
3145 	WMI_VDEV_PARAM_FIXED_RATE,
3146 	/* Short GI Enable/Disable */
3147 	WMI_VDEV_PARAM_SGI,
3148 	/* Enable LDPC */
3149 	WMI_VDEV_PARAM_LDPC,
3150 	/* Enable Tx STBC */
3151 	WMI_VDEV_PARAM_TX_STBC,
3152 	/* Enable Rx STBC */
3153 	WMI_VDEV_PARAM_RX_STBC,
3154 	/* Intra BSS forwarding  */
3155 	WMI_VDEV_PARAM_INTRA_BSS_FWD,
3156 	/* Setting Default xmit key for Vdev */
3157 	WMI_VDEV_PARAM_DEF_KEYID,
3158 	/* NSS width */
3159 	WMI_VDEV_PARAM_NSS,
3160 	/* Set the custom rate for the broadcast data frames */
3161 	WMI_VDEV_PARAM_BCAST_DATA_RATE,
3162 	/* Set the custom rate (rate-code) for multicast data frames */
3163 	WMI_VDEV_PARAM_MCAST_DATA_RATE,
3164 	/* Tx multicast packet indicate Enable/Disable */
3165 	WMI_VDEV_PARAM_MCAST_INDICATE,
3166 	/* Tx DHCP packet indicate Enable/Disable */
3167 	WMI_VDEV_PARAM_DHCP_INDICATE,
3168 	/* Enable host inspection of Tx unicast packet to unknown destination */
3169 	WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
3170 
3171 	/* The minimum amount of time AP begins to consider STA inactive */
3172 	WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
3173 
3174 	/*
3175 	 * An associated STA is considered inactive when there is no recent
3176 	 * TX/RX activity and no downlink frames are buffered for it. Once a
3177 	 * STA exceeds the maximum idle inactive time, the AP will send an
3178 	 * 802.11 data-null as a keep alive to verify the STA is still
3179 	 * associated. If the STA does ACK the data-null, or if the data-null
3180 	 * is buffered and the STA does not retrieve it, the STA will be
3181 	 * considered unresponsive
3182 	 * (see WMI_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS).
3183 	 */
3184 	WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
3185 
3186 	/*
3187 	 * An associated STA is considered unresponsive if there is no recent
3188 	 * TX/RX activity and downlink frames are buffered for it. Once a STA
3189 	 * exceeds the maximum unresponsive time, the AP will send a
3190 	 * WMI_STA_KICKOUT event to the host so the STA can be deleted. */
3191 	WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
3192 
3193 	/* Enable NAWDS : MCAST INSPECT Enable, NAWDS Flag set */
3194 	WMI_VDEV_PARAM_AP_ENABLE_NAWDS,
3195 	/* Enable/Disable RTS-CTS */
3196 	WMI_VDEV_PARAM_ENABLE_RTSCTS,
3197 	/* Enable TXBFee/er */
3198 	WMI_VDEV_PARAM_TXBF,
3199 
3200 	/* Set packet power save */
3201 	WMI_VDEV_PARAM_PACKET_POWERSAVE,
3202 
3203 	/*
3204 	 * Drops un-encrypted packets if eceived in an encrypted connection
3205 	 * otherwise forwards to host.
3206 	 */
3207 	WMI_VDEV_PARAM_DROP_UNENCRY,
3208 
3209 	/*
3210 	 * Set the encapsulation type for frames.
3211 	 */
3212 	WMI_VDEV_PARAM_TX_ENCAP_TYPE,
3213 };
3214 
3215 /* the definition of different VDEV parameters */
3216 enum wmi_10x_vdev_param {
3217 	/* RTS Threshold */
3218 	WMI_10X_VDEV_PARAM_RTS_THRESHOLD = 0x1,
3219 	/* Fragmentation threshold */
3220 	WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
3221 	/* beacon interval in TUs */
3222 	WMI_10X_VDEV_PARAM_BEACON_INTERVAL,
3223 	/* Listen interval in TUs */
3224 	WMI_10X_VDEV_PARAM_LISTEN_INTERVAL,
3225 	/* muticast rate in Mbps */
3226 	WMI_10X_VDEV_PARAM_MULTICAST_RATE,
3227 	/* management frame rate in Mbps */
3228 	WMI_10X_VDEV_PARAM_MGMT_TX_RATE,
3229 	/* slot time (long vs short) */
3230 	WMI_10X_VDEV_PARAM_SLOT_TIME,
3231 	/* preamble (long vs short) */
3232 	WMI_10X_VDEV_PARAM_PREAMBLE,
3233 	/* SWBA time (time before tbtt in msec) */
3234 	WMI_10X_VDEV_PARAM_SWBA_TIME,
3235 	/* time period for updating VDEV stats */
3236 	WMI_10X_VDEV_STATS_UPDATE_PERIOD,
3237 	/* age out time in msec for frames queued for station in power save */
3238 	WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME,
3239 	/*
3240 	 * Host SWBA interval (time in msec before tbtt for SWBA event
3241 	 * generation).
3242 	 */
3243 	WMI_10X_VDEV_HOST_SWBA_INTERVAL,
3244 	/* DTIM period (specified in units of num beacon intervals) */
3245 	WMI_10X_VDEV_PARAM_DTIM_PERIOD,
3246 	/*
3247 	 * scheduler air time limit for this VDEV. used by off chan
3248 	 * scheduler.
3249 	 */
3250 	WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
3251 	/* enable/dsiable WDS for this VDEV  */
3252 	WMI_10X_VDEV_PARAM_WDS,
3253 	/* ATIM Window */
3254 	WMI_10X_VDEV_PARAM_ATIM_WINDOW,
3255 	/* BMISS max */
3256 	WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX,
3257 	/* WMM enables/disabled */
3258 	WMI_10X_VDEV_PARAM_FEATURE_WMM,
3259 	/* Channel width */
3260 	WMI_10X_VDEV_PARAM_CHWIDTH,
3261 	/* Channel Offset */
3262 	WMI_10X_VDEV_PARAM_CHEXTOFFSET,
3263 	/* Disable HT Protection */
3264 	WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
3265 	/* Quick STA Kickout */
3266 	WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT,
3267 	/* Rate to be used with Management frames */
3268 	WMI_10X_VDEV_PARAM_MGMT_RATE,
3269 	/* Protection Mode */
3270 	WMI_10X_VDEV_PARAM_PROTECTION_MODE,
3271 	/* Fixed rate setting */
3272 	WMI_10X_VDEV_PARAM_FIXED_RATE,
3273 	/* Short GI Enable/Disable */
3274 	WMI_10X_VDEV_PARAM_SGI,
3275 	/* Enable LDPC */
3276 	WMI_10X_VDEV_PARAM_LDPC,
3277 	/* Enable Tx STBC */
3278 	WMI_10X_VDEV_PARAM_TX_STBC,
3279 	/* Enable Rx STBC */
3280 	WMI_10X_VDEV_PARAM_RX_STBC,
3281 	/* Intra BSS forwarding  */
3282 	WMI_10X_VDEV_PARAM_INTRA_BSS_FWD,
3283 	/* Setting Default xmit key for Vdev */
3284 	WMI_10X_VDEV_PARAM_DEF_KEYID,
3285 	/* NSS width */
3286 	WMI_10X_VDEV_PARAM_NSS,
3287 	/* Set the custom rate for the broadcast data frames */
3288 	WMI_10X_VDEV_PARAM_BCAST_DATA_RATE,
3289 	/* Set the custom rate (rate-code) for multicast data frames */
3290 	WMI_10X_VDEV_PARAM_MCAST_DATA_RATE,
3291 	/* Tx multicast packet indicate Enable/Disable */
3292 	WMI_10X_VDEV_PARAM_MCAST_INDICATE,
3293 	/* Tx DHCP packet indicate Enable/Disable */
3294 	WMI_10X_VDEV_PARAM_DHCP_INDICATE,
3295 	/* Enable host inspection of Tx unicast packet to unknown destination */
3296 	WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
3297 
3298 	/* The minimum amount of time AP begins to consider STA inactive */
3299 	WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
3300 
3301 	/*
3302 	 * An associated STA is considered inactive when there is no recent
3303 	 * TX/RX activity and no downlink frames are buffered for it. Once a
3304 	 * STA exceeds the maximum idle inactive time, the AP will send an
3305 	 * 802.11 data-null as a keep alive to verify the STA is still
3306 	 * associated. If the STA does ACK the data-null, or if the data-null
3307 	 * is buffered and the STA does not retrieve it, the STA will be
3308 	 * considered unresponsive
3309 	 * (see WMI_10X_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS).
3310 	 */
3311 	WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
3312 
3313 	/*
3314 	 * An associated STA is considered unresponsive if there is no recent
3315 	 * TX/RX activity and downlink frames are buffered for it. Once a STA
3316 	 * exceeds the maximum unresponsive time, the AP will send a
3317 	 * WMI_10X_STA_KICKOUT event to the host so the STA can be deleted. */
3318 	WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
3319 
3320 	/* Enable NAWDS : MCAST INSPECT Enable, NAWDS Flag set */
3321 	WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS,
3322 
3323 	WMI_10X_VDEV_PARAM_MCAST2UCAST_SET,
3324 	/* Enable/Disable RTS-CTS */
3325 	WMI_10X_VDEV_PARAM_ENABLE_RTSCTS,
3326 
3327 	WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
3328 };
3329 
3330 /* slot time long */
3331 #define WMI_VDEV_SLOT_TIME_LONG		0x1
3332 /* slot time short */
3333 #define WMI_VDEV_SLOT_TIME_SHORT	0x2
3334 /* preablbe long */
3335 #define WMI_VDEV_PREAMBLE_LONG		0x1
3336 /* preablbe short */
3337 #define WMI_VDEV_PREAMBLE_SHORT		0x2
3338 
3339 enum wmi_start_event_param {
3340 	WMI_VDEV_RESP_START_EVENT = 0,
3341 	WMI_VDEV_RESP_RESTART_EVENT,
3342 };
3343 
3344 struct wmi_vdev_start_response_event {
3345 	__le32 vdev_id;
3346 	__le32 req_id;
3347 	__le32 resp_type; /* %WMI_VDEV_RESP_ */
3348 	__le32 status;
3349 } __packed;
3350 
3351 struct wmi_vdev_standby_req_event {
3352 	/* unique id identifying the VDEV, generated by the caller */
3353 	__le32 vdev_id;
3354 } __packed;
3355 
3356 struct wmi_vdev_resume_req_event {
3357 	/* unique id identifying the VDEV, generated by the caller */
3358 	__le32 vdev_id;
3359 } __packed;
3360 
3361 struct wmi_vdev_stopped_event {
3362 	/* unique id identifying the VDEV, generated by the caller */
3363 	__le32 vdev_id;
3364 } __packed;
3365 
3366 /*
3367  * common structure used for simple events
3368  * (stopped, resume_req, standby response)
3369  */
3370 struct wmi_vdev_simple_event {
3371 	/* unique id identifying the VDEV, generated by the caller */
3372 	__le32 vdev_id;
3373 } __packed;
3374 
3375 /* VDEV start response status codes */
3376 /* VDEV succesfully started */
3377 #define WMI_INIFIED_VDEV_START_RESPONSE_STATUS_SUCCESS	0x0
3378 
3379 /* requested VDEV not found */
3380 #define WMI_INIFIED_VDEV_START_RESPONSE_INVALID_VDEVID	0x1
3381 
3382 /* unsupported VDEV combination */
3383 #define WMI_INIFIED_VDEV_START_RESPONSE_NOT_SUPPORTED	0x2
3384 
3385 /* Beacon processing related command and event structures */
3386 struct wmi_bcn_tx_hdr {
3387 	__le32 vdev_id;
3388 	__le32 tx_rate;
3389 	__le32 tx_power;
3390 	__le32 bcn_len;
3391 } __packed;
3392 
3393 struct wmi_bcn_tx_cmd {
3394 	struct wmi_bcn_tx_hdr hdr;
3395 	u8 *bcn[0];
3396 } __packed;
3397 
3398 struct wmi_bcn_tx_arg {
3399 	u32 vdev_id;
3400 	u32 tx_rate;
3401 	u32 tx_power;
3402 	u32 bcn_len;
3403 	const void *bcn;
3404 };
3405 
3406 /* Beacon filter */
3407 #define WMI_BCN_FILTER_ALL   0 /* Filter all beacons */
3408 #define WMI_BCN_FILTER_NONE  1 /* Pass all beacons */
3409 #define WMI_BCN_FILTER_RSSI  2 /* Pass Beacons RSSI >= RSSI threshold */
3410 #define WMI_BCN_FILTER_BSSID 3 /* Pass Beacons with matching BSSID */
3411 #define WMI_BCN_FILTER_SSID  4 /* Pass Beacons with matching SSID */
3412 
3413 struct wmi_bcn_filter_rx_cmd {
3414 	/* Filter ID */
3415 	__le32 bcn_filter_id;
3416 	/* Filter type - wmi_bcn_filter */
3417 	__le32 bcn_filter;
3418 	/* Buffer len */
3419 	__le32 bcn_filter_len;
3420 	/* Filter info (threshold, BSSID, RSSI) */
3421 	u8 *bcn_filter_buf;
3422 } __packed;
3423 
3424 /* Capabilities and IEs to be passed to firmware */
3425 struct wmi_bcn_prb_info {
3426 	/* Capabilities */
3427 	__le32 caps;
3428 	/* ERP info */
3429 	__le32 erp;
3430 	/* Advanced capabilities */
3431 	/* HT capabilities */
3432 	/* HT Info */
3433 	/* ibss_dfs */
3434 	/* wpa Info */
3435 	/* rsn Info */
3436 	/* rrm info */
3437 	/* ath_ext */
3438 	/* app IE */
3439 } __packed;
3440 
3441 struct wmi_bcn_tmpl_cmd {
3442 	/* unique id identifying the VDEV, generated by the caller */
3443 	__le32 vdev_id;
3444 	/* TIM IE offset from the beginning of the template. */
3445 	__le32 tim_ie_offset;
3446 	/* beacon probe capabilities and IEs */
3447 	struct wmi_bcn_prb_info bcn_prb_info;
3448 	/* beacon buffer length */
3449 	__le32 buf_len;
3450 	/* variable length data */
3451 	u8 data[1];
3452 } __packed;
3453 
3454 struct wmi_prb_tmpl_cmd {
3455 	/* unique id identifying the VDEV, generated by the caller */
3456 	__le32 vdev_id;
3457 	/* beacon probe capabilities and IEs */
3458 	struct wmi_bcn_prb_info bcn_prb_info;
3459 	/* beacon buffer length */
3460 	__le32 buf_len;
3461 	/* Variable length data */
3462 	u8 data[1];
3463 } __packed;
3464 
3465 enum wmi_sta_ps_mode {
3466 	/* enable power save for the given STA VDEV */
3467 	WMI_STA_PS_MODE_DISABLED = 0,
3468 	/* disable power save  for a given STA VDEV */
3469 	WMI_STA_PS_MODE_ENABLED = 1,
3470 };
3471 
3472 struct wmi_sta_powersave_mode_cmd {
3473 	/* unique id identifying the VDEV, generated by the caller */
3474 	__le32 vdev_id;
3475 
3476 	/*
3477 	 * Power save mode
3478 	 * (see enum wmi_sta_ps_mode)
3479 	 */
3480 	__le32 sta_ps_mode;
3481 } __packed;
3482 
3483 enum wmi_csa_offload_en {
3484 	WMI_CSA_OFFLOAD_DISABLE = 0,
3485 	WMI_CSA_OFFLOAD_ENABLE = 1,
3486 };
3487 
3488 struct wmi_csa_offload_enable_cmd {
3489 	__le32 vdev_id;
3490 	__le32 csa_offload_enable;
3491 } __packed;
3492 
3493 struct wmi_csa_offload_chanswitch_cmd {
3494 	__le32 vdev_id;
3495 	struct wmi_channel chan;
3496 } __packed;
3497 
3498 /*
3499  * This parameter controls the policy for retrieving frames from AP while the
3500  * STA is in sleep state.
3501  *
3502  * Only takes affect if the sta_ps_mode is enabled
3503  */
3504 enum wmi_sta_ps_param_rx_wake_policy {
3505 	/*
3506 	 * Wake up when ever there is an  RX activity on the VDEV. In this mode
3507 	 * the Power save SM(state machine) will come out of sleep by either
3508 	 * sending null frame (or) a data frame (with PS==0) in response to TIM
3509 	 * bit set in the received beacon frame from AP.
3510 	 */
3511 	WMI_STA_PS_RX_WAKE_POLICY_WAKE = 0,
3512 
3513 	/*
3514 	 * Here the power save state machine will not wakeup in response to TIM
3515 	 * bit, instead it will send a PSPOLL (or) UASPD trigger based on UAPSD
3516 	 * configuration setup by WMISET_PS_SET_UAPSD  WMI command.  When all
3517 	 * access categories are delivery-enabled, the station will send a
3518 	 * UAPSD trigger frame, otherwise it will send a PS-Poll.
3519 	 */
3520 	WMI_STA_PS_RX_WAKE_POLICY_POLL_UAPSD = 1,
3521 };
3522 
3523 /*
3524  * Number of tx frames/beacon  that cause the power save SM to wake up.
3525  *
3526  * Value 1 causes the SM to wake up for every TX. Value 0 has a special
3527  * meaning, It will cause the SM to never wake up. This is useful if you want
3528  * to keep the system to sleep all the time for some kind of test mode . host
3529  * can change this parameter any time.  It will affect at the next tx frame.
3530  */
3531 enum wmi_sta_ps_param_tx_wake_threshold {
3532 	WMI_STA_PS_TX_WAKE_THRESHOLD_NEVER = 0,
3533 	WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS = 1,
3534 
3535 	/*
3536 	 * Values greater than one indicate that many TX attempts per beacon
3537 	 * interval before the STA will wake up
3538 	 */
3539 };
3540 
3541 /*
3542  * The maximum number of PS-Poll frames the FW will send in response to
3543  * traffic advertised in TIM before waking up (by sending a null frame with PS
3544  * = 0). Value 0 has a special meaning: there is no maximum count and the FW
3545  * will send as many PS-Poll as are necessary to retrieve buffered BU. This
3546  * parameter is used when the RX wake policy is
3547  * WMI_STA_PS_RX_WAKE_POLICY_POLL_UAPSD and ignored when the RX wake
3548  * policy is WMI_STA_PS_RX_WAKE_POLICY_WAKE.
3549  */
3550 enum wmi_sta_ps_param_pspoll_count {
3551 	WMI_STA_PS_PSPOLL_COUNT_NO_MAX = 0,
3552 	/*
3553 	 * Values greater than 0 indicate the maximum numer of PS-Poll frames
3554 	 * FW will send before waking up.
3555 	 */
3556 };
3557 
3558 /*
3559  * This will include the delivery and trigger enabled state for every AC.
3560  * This is the negotiated state with AP. The host MLME needs to set this based
3561  * on AP capability and the state Set in the association request by the
3562  * station MLME.Lower 8 bits of the value specify the UAPSD configuration.
3563  */
3564 #define WMI_UAPSD_AC_TYPE_DELI 0
3565 #define WMI_UAPSD_AC_TYPE_TRIG 1
3566 
3567 #define WMI_UAPSD_AC_BIT_MASK(ac, type) \
3568 	((type ==  WMI_UAPSD_AC_TYPE_DELI) ? (1<<(ac<<1)) : (1<<((ac<<1)+1)))
3569 
3570 enum wmi_sta_ps_param_uapsd {
3571 	WMI_STA_PS_UAPSD_AC0_DELIVERY_EN = (1 << 0),
3572 	WMI_STA_PS_UAPSD_AC0_TRIGGER_EN  = (1 << 1),
3573 	WMI_STA_PS_UAPSD_AC1_DELIVERY_EN = (1 << 2),
3574 	WMI_STA_PS_UAPSD_AC1_TRIGGER_EN  = (1 << 3),
3575 	WMI_STA_PS_UAPSD_AC2_DELIVERY_EN = (1 << 4),
3576 	WMI_STA_PS_UAPSD_AC2_TRIGGER_EN  = (1 << 5),
3577 	WMI_STA_PS_UAPSD_AC3_DELIVERY_EN = (1 << 6),
3578 	WMI_STA_PS_UAPSD_AC3_TRIGGER_EN  = (1 << 7),
3579 };
3580 
3581 enum wmi_sta_powersave_param {
3582 	/*
3583 	 * Controls how frames are retrievd from AP while STA is sleeping
3584 	 *
3585 	 * (see enum wmi_sta_ps_param_rx_wake_policy)
3586 	 */
3587 	WMI_STA_PS_PARAM_RX_WAKE_POLICY = 0,
3588 
3589 	/*
3590 	 * The STA will go active after this many TX
3591 	 *
3592 	 * (see enum wmi_sta_ps_param_tx_wake_threshold)
3593 	 */
3594 	WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD = 1,
3595 
3596 	/*
3597 	 * Number of PS-Poll to send before STA wakes up
3598 	 *
3599 	 * (see enum wmi_sta_ps_param_pspoll_count)
3600 	 *
3601 	 */
3602 	WMI_STA_PS_PARAM_PSPOLL_COUNT = 2,
3603 
3604 	/*
3605 	 * TX/RX inactivity time in msec before going to sleep.
3606 	 *
3607 	 * The power save SM will monitor tx/rx activity on the VDEV, if no
3608 	 * activity for the specified msec of the parameter the Power save
3609 	 * SM will go to sleep.
3610 	 */
3611 	WMI_STA_PS_PARAM_INACTIVITY_TIME = 3,
3612 
3613 	/*
3614 	 * Set uapsd configuration.
3615 	 *
3616 	 * (see enum wmi_sta_ps_param_uapsd)
3617 	 */
3618 	WMI_STA_PS_PARAM_UAPSD = 4,
3619 };
3620 
3621 struct wmi_sta_powersave_param_cmd {
3622 	__le32 vdev_id;
3623 	__le32 param_id; /* %WMI_STA_PS_PARAM_ */
3624 	__le32 param_value;
3625 } __packed;
3626 
3627 /* No MIMO power save */
3628 #define WMI_STA_MIMO_PS_MODE_DISABLE
3629 /* mimo powersave mode static*/
3630 #define WMI_STA_MIMO_PS_MODE_STATIC
3631 /* mimo powersave mode dynamic */
3632 #define WMI_STA_MIMO_PS_MODE_DYNAMIC
3633 
3634 struct wmi_sta_mimo_ps_mode_cmd {
3635 	/* unique id identifying the VDEV, generated by the caller */
3636 	__le32 vdev_id;
3637 	/* mimo powersave mode as defined above */
3638 	__le32 mimo_pwrsave_mode;
3639 } __packed;
3640 
3641 /* U-APSD configuration of peer station from (re)assoc request and TSPECs */
3642 enum wmi_ap_ps_param_uapsd {
3643 	WMI_AP_PS_UAPSD_AC0_DELIVERY_EN = (1 << 0),
3644 	WMI_AP_PS_UAPSD_AC0_TRIGGER_EN  = (1 << 1),
3645 	WMI_AP_PS_UAPSD_AC1_DELIVERY_EN = (1 << 2),
3646 	WMI_AP_PS_UAPSD_AC1_TRIGGER_EN  = (1 << 3),
3647 	WMI_AP_PS_UAPSD_AC2_DELIVERY_EN = (1 << 4),
3648 	WMI_AP_PS_UAPSD_AC2_TRIGGER_EN  = (1 << 5),
3649 	WMI_AP_PS_UAPSD_AC3_DELIVERY_EN = (1 << 6),
3650 	WMI_AP_PS_UAPSD_AC3_TRIGGER_EN  = (1 << 7),
3651 };
3652 
3653 /* U-APSD maximum service period of peer station */
3654 enum wmi_ap_ps_peer_param_max_sp {
3655 	WMI_AP_PS_PEER_PARAM_MAX_SP_UNLIMITED = 0,
3656 	WMI_AP_PS_PEER_PARAM_MAX_SP_2 = 1,
3657 	WMI_AP_PS_PEER_PARAM_MAX_SP_4 = 2,
3658 	WMI_AP_PS_PEER_PARAM_MAX_SP_6 = 3,
3659 	MAX_WMI_AP_PS_PEER_PARAM_MAX_SP,
3660 };
3661 
3662 /*
3663  * AP power save parameter
3664  * Set a power save specific parameter for a peer station
3665  */
3666 enum wmi_ap_ps_peer_param {
3667 	/* Set uapsd configuration for a given peer.
3668 	 *
3669 	 * Include the delivery and trigger enabled state for every AC.
3670 	 * The host  MLME needs to set this based on AP capability and stations
3671 	 * request Set in the association request  received from the station.
3672 	 *
3673 	 * Lower 8 bits of the value specify the UAPSD configuration.
3674 	 *
3675 	 * (see enum wmi_ap_ps_param_uapsd)
3676 	 * The default value is 0.
3677 	 */
3678 	WMI_AP_PS_PEER_PARAM_UAPSD = 0,
3679 
3680 	/*
3681 	 * Set the service period for a UAPSD capable station
3682 	 *
3683 	 * The service period from wme ie in the (re)assoc request frame.
3684 	 *
3685 	 * (see enum wmi_ap_ps_peer_param_max_sp)
3686 	 */
3687 	WMI_AP_PS_PEER_PARAM_MAX_SP = 1,
3688 
3689 	/* Time in seconds for aging out buffered frames for STA in PS */
3690 	WMI_AP_PS_PEER_PARAM_AGEOUT_TIME = 2,
3691 };
3692 
3693 struct wmi_ap_ps_peer_cmd {
3694 	/* unique id identifying the VDEV, generated by the caller */
3695 	__le32 vdev_id;
3696 
3697 	/* peer MAC address */
3698 	struct wmi_mac_addr peer_macaddr;
3699 
3700 	/* AP powersave param (see enum wmi_ap_ps_peer_param) */
3701 	__le32 param_id;
3702 
3703 	/* AP powersave param value */
3704 	__le32 param_value;
3705 } __packed;
3706 
3707 /* 128 clients = 4 words */
3708 #define WMI_TIM_BITMAP_ARRAY_SIZE 4
3709 
3710 struct wmi_tim_info {
3711 	__le32 tim_len;
3712 	__le32 tim_mcast;
3713 	__le32 tim_bitmap[WMI_TIM_BITMAP_ARRAY_SIZE];
3714 	__le32 tim_changed;
3715 	__le32 tim_num_ps_pending;
3716 } __packed;
3717 
3718 /* Maximum number of NOA Descriptors supported */
3719 #define WMI_P2P_MAX_NOA_DESCRIPTORS 4
3720 #define WMI_P2P_OPPPS_ENABLE_BIT	BIT(0)
3721 #define WMI_P2P_OPPPS_CTWINDOW_OFFSET	1
3722 #define WMI_P2P_NOA_CHANGED_BIT	BIT(0)
3723 
3724 struct wmi_p2p_noa_info {
3725 	/* Bit 0 - Flag to indicate an update in NOA schedule
3726 	   Bits 7-1 - Reserved */
3727 	u8 changed;
3728 	/* NOA index */
3729 	u8 index;
3730 	/* Bit 0 - Opp PS state of the AP
3731 	   Bits 1-7 - Ctwindow in TUs */
3732 	u8 ctwindow_oppps;
3733 	/* Number of NOA descriptors */
3734 	u8 num_descriptors;
3735 
3736 	struct wmi_p2p_noa_descriptor descriptors[WMI_P2P_MAX_NOA_DESCRIPTORS];
3737 } __packed;
3738 
3739 struct wmi_bcn_info {
3740 	struct wmi_tim_info tim_info;
3741 	struct wmi_p2p_noa_info p2p_noa_info;
3742 } __packed;
3743 
3744 struct wmi_host_swba_event {
3745 	__le32 vdev_map;
3746 	struct wmi_bcn_info bcn_info[1];
3747 } __packed;
3748 
3749 #define WMI_MAX_AP_VDEV 16
3750 
3751 struct wmi_tbtt_offset_event {
3752 	__le32 vdev_map;
3753 	__le32 tbttoffset_list[WMI_MAX_AP_VDEV];
3754 } __packed;
3755 
3756 
3757 struct wmi_peer_create_cmd {
3758 	__le32 vdev_id;
3759 	struct wmi_mac_addr peer_macaddr;
3760 } __packed;
3761 
3762 struct wmi_peer_delete_cmd {
3763 	__le32 vdev_id;
3764 	struct wmi_mac_addr peer_macaddr;
3765 } __packed;
3766 
3767 struct wmi_peer_flush_tids_cmd {
3768 	__le32 vdev_id;
3769 	struct wmi_mac_addr peer_macaddr;
3770 	__le32 peer_tid_bitmap;
3771 } __packed;
3772 
3773 struct wmi_fixed_rate {
3774 	/*
3775 	 * rate mode . 0: disable fixed rate (auto rate)
3776 	 *   1: legacy (non 11n) rate  specified as ieee rate 2*Mbps
3777 	 *   2: ht20 11n rate  specified as mcs index
3778 	 *   3: ht40 11n rate  specified as mcs index
3779 	 */
3780 	__le32  rate_mode;
3781 	/*
3782 	 * 4 rate values for 4 rate series. series 0 is stored in byte 0 (LSB)
3783 	 * and series 3 is stored at byte 3 (MSB)
3784 	 */
3785 	__le32  rate_series;
3786 	/*
3787 	 * 4 retry counts for 4 rate series. retry count for rate 0 is stored
3788 	 * in byte 0 (LSB) and retry count for rate 3 is stored at byte 3
3789 	 * (MSB)
3790 	 */
3791 	__le32  rate_retries;
3792 } __packed;
3793 
3794 struct wmi_peer_fixed_rate_cmd {
3795 	/* unique id identifying the VDEV, generated by the caller */
3796 	__le32 vdev_id;
3797 	/* peer MAC address */
3798 	struct wmi_mac_addr peer_macaddr;
3799 	/* fixed rate */
3800 	struct wmi_fixed_rate peer_fixed_rate;
3801 } __packed;
3802 
3803 #define WMI_MGMT_TID    17
3804 
3805 struct wmi_addba_clear_resp_cmd {
3806 	/* unique id identifying the VDEV, generated by the caller */
3807 	__le32 vdev_id;
3808 	/* peer MAC address */
3809 	struct wmi_mac_addr peer_macaddr;
3810 } __packed;
3811 
3812 struct wmi_addba_send_cmd {
3813 	/* unique id identifying the VDEV, generated by the caller */
3814 	__le32 vdev_id;
3815 	/* peer MAC address */
3816 	struct wmi_mac_addr peer_macaddr;
3817 	/* Tid number */
3818 	__le32 tid;
3819 	/* Buffer/Window size*/
3820 	__le32 buffersize;
3821 } __packed;
3822 
3823 struct wmi_delba_send_cmd {
3824 	/* unique id identifying the VDEV, generated by the caller */
3825 	__le32 vdev_id;
3826 	/* peer MAC address */
3827 	struct wmi_mac_addr peer_macaddr;
3828 	/* Tid number */
3829 	__le32 tid;
3830 	/* Is Initiator */
3831 	__le32 initiator;
3832 	/* Reason code */
3833 	__le32 reasoncode;
3834 } __packed;
3835 
3836 struct wmi_addba_setresponse_cmd {
3837 	/* unique id identifying the vdev, generated by the caller */
3838 	__le32 vdev_id;
3839 	/* peer mac address */
3840 	struct wmi_mac_addr peer_macaddr;
3841 	/* Tid number */
3842 	__le32 tid;
3843 	/* status code */
3844 	__le32 statuscode;
3845 } __packed;
3846 
3847 struct wmi_send_singleamsdu_cmd {
3848 	/* unique id identifying the vdev, generated by the caller */
3849 	__le32 vdev_id;
3850 	/* peer mac address */
3851 	struct wmi_mac_addr peer_macaddr;
3852 	/* Tid number */
3853 	__le32 tid;
3854 } __packed;
3855 
3856 enum wmi_peer_smps_state {
3857 	WMI_PEER_SMPS_PS_NONE = 0x0,
3858 	WMI_PEER_SMPS_STATIC  = 0x1,
3859 	WMI_PEER_SMPS_DYNAMIC = 0x2
3860 };
3861 
3862 enum wmi_peer_param {
3863 	WMI_PEER_SMPS_STATE = 0x1, /* see %wmi_peer_smps_state */
3864 	WMI_PEER_AMPDU      = 0x2,
3865 	WMI_PEER_AUTHORIZE  = 0x3,
3866 	WMI_PEER_CHAN_WIDTH = 0x4,
3867 	WMI_PEER_NSS        = 0x5,
3868 	WMI_PEER_USE_4ADDR  = 0x6
3869 };
3870 
3871 struct wmi_peer_set_param_cmd {
3872 	__le32 vdev_id;
3873 	struct wmi_mac_addr peer_macaddr;
3874 	__le32 param_id;
3875 	__le32 param_value;
3876 } __packed;
3877 
3878 #define MAX_SUPPORTED_RATES 128
3879 
3880 struct wmi_rate_set {
3881 	/* total number of rates */
3882 	__le32 num_rates;
3883 	/*
3884 	 * rates (each 8bit value) packed into a 32 bit word.
3885 	 * the rates are filled from least significant byte to most
3886 	 * significant byte.
3887 	 */
3888 	__le32 rates[(MAX_SUPPORTED_RATES/4)+1];
3889 } __packed;
3890 
3891 struct wmi_rate_set_arg {
3892 	unsigned int num_rates;
3893 	u8 rates[MAX_SUPPORTED_RATES];
3894 };
3895 
3896 /*
3897  * NOTE: It would bea good idea to represent the Tx MCS
3898  * info in one word and Rx in another word. This is split
3899  * into multiple words for convenience
3900  */
3901 struct wmi_vht_rate_set {
3902 	__le32 rx_max_rate; /* Max Rx data rate */
3903 	__le32 rx_mcs_set;  /* Negotiated RX VHT rates */
3904 	__le32 tx_max_rate; /* Max Tx data rate */
3905 	__le32 tx_mcs_set;  /* Negotiated TX VHT rates */
3906 } __packed;
3907 
3908 struct wmi_vht_rate_set_arg {
3909 	u32 rx_max_rate;
3910 	u32 rx_mcs_set;
3911 	u32 tx_max_rate;
3912 	u32 tx_mcs_set;
3913 };
3914 
3915 struct wmi_peer_set_rates_cmd {
3916 	/* peer MAC address */
3917 	struct wmi_mac_addr peer_macaddr;
3918 	/* legacy rate set */
3919 	struct wmi_rate_set peer_legacy_rates;
3920 	/* ht rate set */
3921 	struct wmi_rate_set peer_ht_rates;
3922 } __packed;
3923 
3924 struct wmi_peer_set_q_empty_callback_cmd {
3925 	/* unique id identifying the VDEV, generated by the caller */
3926 	__le32 vdev_id;
3927 	/* peer MAC address */
3928 	struct wmi_mac_addr peer_macaddr;
3929 	__le32 callback_enable;
3930 } __packed;
3931 
3932 #define WMI_PEER_AUTH           0x00000001
3933 #define WMI_PEER_QOS            0x00000002
3934 #define WMI_PEER_NEED_PTK_4_WAY 0x00000004
3935 #define WMI_PEER_NEED_GTK_2_WAY 0x00000010
3936 #define WMI_PEER_APSD           0x00000800
3937 #define WMI_PEER_HT             0x00001000
3938 #define WMI_PEER_40MHZ          0x00002000
3939 #define WMI_PEER_STBC           0x00008000
3940 #define WMI_PEER_LDPC           0x00010000
3941 #define WMI_PEER_DYN_MIMOPS     0x00020000
3942 #define WMI_PEER_STATIC_MIMOPS  0x00040000
3943 #define WMI_PEER_SPATIAL_MUX    0x00200000
3944 #define WMI_PEER_VHT            0x02000000
3945 #define WMI_PEER_80MHZ          0x04000000
3946 #define WMI_PEER_PMF            0x08000000
3947 
3948 /*
3949  * Peer rate capabilities.
3950  *
3951  * This is of interest to the ratecontrol
3952  * module which resides in the firmware. The bit definitions are
3953  * consistent with that defined in if_athrate.c.
3954  */
3955 #define WMI_RC_DS_FLAG          0x01
3956 #define WMI_RC_CW40_FLAG        0x02
3957 #define WMI_RC_SGI_FLAG         0x04
3958 #define WMI_RC_HT_FLAG          0x08
3959 #define WMI_RC_RTSCTS_FLAG      0x10
3960 #define WMI_RC_TX_STBC_FLAG     0x20
3961 #define WMI_RC_RX_STBC_FLAG     0xC0
3962 #define WMI_RC_RX_STBC_FLAG_S   6
3963 #define WMI_RC_WEP_TKIP_FLAG    0x100
3964 #define WMI_RC_TS_FLAG          0x200
3965 #define WMI_RC_UAPSD_FLAG       0x400
3966 
3967 /* Maximum listen interval supported by hw in units of beacon interval */
3968 #define ATH10K_MAX_HW_LISTEN_INTERVAL 5
3969 
3970 struct wmi_peer_assoc_complete_cmd {
3971 	struct wmi_mac_addr peer_macaddr;
3972 	__le32 vdev_id;
3973 	__le32 peer_new_assoc; /* 1=assoc, 0=reassoc */
3974 	__le32 peer_associd; /* 16 LSBs */
3975 	__le32 peer_flags;
3976 	__le32 peer_caps; /* 16 LSBs */
3977 	__le32 peer_listen_intval;
3978 	__le32 peer_ht_caps;
3979 	__le32 peer_max_mpdu;
3980 	__le32 peer_mpdu_density; /* 0..16 */
3981 	__le32 peer_rate_caps;
3982 	struct wmi_rate_set peer_legacy_rates;
3983 	struct wmi_rate_set peer_ht_rates;
3984 	__le32 peer_nss; /* num of spatial streams */
3985 	__le32 peer_vht_caps;
3986 	__le32 peer_phymode;
3987 	struct wmi_vht_rate_set peer_vht_rates;
3988 	/* HT Operation Element of the peer. Five bytes packed in 2
3989 	 *  INT32 array and filled from lsb to msb. */
3990 	__le32 peer_ht_info[2];
3991 } __packed;
3992 
3993 struct wmi_peer_assoc_complete_arg {
3994 	u8 addr[ETH_ALEN];
3995 	u32 vdev_id;
3996 	bool peer_reassoc;
3997 	u16 peer_aid;
3998 	u32 peer_flags; /* see %WMI_PEER_ */
3999 	u16 peer_caps;
4000 	u32 peer_listen_intval;
4001 	u32 peer_ht_caps;
4002 	u32 peer_max_mpdu;
4003 	u32 peer_mpdu_density; /* 0..16 */
4004 	u32 peer_rate_caps; /* see %WMI_RC_ */
4005 	struct wmi_rate_set_arg peer_legacy_rates;
4006 	struct wmi_rate_set_arg peer_ht_rates;
4007 	u32 peer_num_spatial_streams;
4008 	u32 peer_vht_caps;
4009 	enum wmi_phy_mode peer_phymode;
4010 	struct wmi_vht_rate_set_arg peer_vht_rates;
4011 };
4012 
4013 struct wmi_peer_add_wds_entry_cmd {
4014 	/* peer MAC address */
4015 	struct wmi_mac_addr peer_macaddr;
4016 	/* wds MAC addr */
4017 	struct wmi_mac_addr wds_macaddr;
4018 } __packed;
4019 
4020 struct wmi_peer_remove_wds_entry_cmd {
4021 	/* wds MAC addr */
4022 	struct wmi_mac_addr wds_macaddr;
4023 } __packed;
4024 
4025 struct wmi_peer_q_empty_callback_event {
4026 	/* peer MAC address */
4027 	struct wmi_mac_addr peer_macaddr;
4028 } __packed;
4029 
4030 /*
4031  * Channel info WMI event
4032  */
4033 struct wmi_chan_info_event {
4034 	__le32 err_code;
4035 	__le32 freq;
4036 	__le32 cmd_flags;
4037 	__le32 noise_floor;
4038 	__le32 rx_clear_count;
4039 	__le32 cycle_count;
4040 } __packed;
4041 
4042 #define WMI_CHAN_INFO_FLAG_COMPLETE BIT(0)
4043 
4044 /* FIXME: empirically extrapolated */
4045 #define WMI_CHAN_INFO_MSEC(x) ((x) / 76595)
4046 
4047 /* Beacon filter wmi command info */
4048 #define BCN_FLT_MAX_SUPPORTED_IES	256
4049 #define BCN_FLT_MAX_ELEMS_IE_LIST	(BCN_FLT_MAX_SUPPORTED_IES / 32)
4050 
4051 struct bss_bcn_stats {
4052 	__le32 vdev_id;
4053 	__le32 bss_bcnsdropped;
4054 	__le32 bss_bcnsdelivered;
4055 } __packed;
4056 
4057 struct bcn_filter_stats {
4058 	__le32 bcns_dropped;
4059 	__le32 bcns_delivered;
4060 	__le32 activefilters;
4061 	struct bss_bcn_stats bss_stats;
4062 } __packed;
4063 
4064 struct wmi_add_bcn_filter_cmd {
4065 	u32 vdev_id;
4066 	u32 ie_map[BCN_FLT_MAX_ELEMS_IE_LIST];
4067 } __packed;
4068 
4069 enum wmi_sta_keepalive_method {
4070 	WMI_STA_KEEPALIVE_METHOD_NULL_FRAME = 1,
4071 	WMI_STA_KEEPALIVE_METHOD_UNSOLICITATED_ARP_RESPONSE = 2,
4072 };
4073 
4074 /* note: ip4 addresses are in network byte order, i.e. big endian */
4075 struct wmi_sta_keepalive_arp_resp {
4076 	__be32 src_ip4_addr;
4077 	__be32 dest_ip4_addr;
4078 	struct wmi_mac_addr dest_mac_addr;
4079 } __packed;
4080 
4081 struct wmi_sta_keepalive_cmd {
4082 	__le32 vdev_id;
4083 	__le32 enabled;
4084 	__le32 method; /* WMI_STA_KEEPALIVE_METHOD_ */
4085 	__le32 interval; /* in seconds */
4086 	struct wmi_sta_keepalive_arp_resp arp_resp;
4087 } __packed;
4088 
4089 enum wmi_force_fw_hang_type {
4090 	WMI_FORCE_FW_HANG_ASSERT = 1,
4091 	WMI_FORCE_FW_HANG_NO_DETECT,
4092 	WMI_FORCE_FW_HANG_CTRL_EP_FULL,
4093 	WMI_FORCE_FW_HANG_EMPTY_POINT,
4094 	WMI_FORCE_FW_HANG_STACK_OVERFLOW,
4095 	WMI_FORCE_FW_HANG_INFINITE_LOOP,
4096 };
4097 
4098 #define WMI_FORCE_FW_HANG_RANDOM_TIME 0xFFFFFFFF
4099 
4100 struct wmi_force_fw_hang_cmd {
4101 	__le32 type;
4102 	__le32 delay_ms;
4103 } __packed;
4104 
4105 enum ath10k_dbglog_level {
4106 	ATH10K_DBGLOG_LEVEL_VERBOSE = 0,
4107 	ATH10K_DBGLOG_LEVEL_INFO = 1,
4108 	ATH10K_DBGLOG_LEVEL_WARN = 2,
4109 	ATH10K_DBGLOG_LEVEL_ERR = 3,
4110 };
4111 
4112 /* VAP ids to enable dbglog */
4113 #define ATH10K_DBGLOG_CFG_VAP_LOG_LSB		0
4114 #define ATH10K_DBGLOG_CFG_VAP_LOG_MASK		0x0000ffff
4115 
4116 /* to enable dbglog in the firmware */
4117 #define ATH10K_DBGLOG_CFG_REPORTING_ENABLE_LSB	16
4118 #define ATH10K_DBGLOG_CFG_REPORTING_ENABLE_MASK	0x00010000
4119 
4120 /* timestamp resolution */
4121 #define ATH10K_DBGLOG_CFG_RESOLUTION_LSB	17
4122 #define ATH10K_DBGLOG_CFG_RESOLUTION_MASK	0x000E0000
4123 
4124 /* number of queued messages before sending them to the host */
4125 #define ATH10K_DBGLOG_CFG_REPORT_SIZE_LSB	20
4126 #define ATH10K_DBGLOG_CFG_REPORT_SIZE_MASK	0x0ff00000
4127 
4128 /*
4129  * Log levels to enable. This defines the minimum level to enable, this is
4130  * not a bitmask. See enum ath10k_dbglog_level for the values.
4131  */
4132 #define ATH10K_DBGLOG_CFG_LOG_LVL_LSB		28
4133 #define ATH10K_DBGLOG_CFG_LOG_LVL_MASK		0x70000000
4134 
4135 /*
4136  * Note: this is a cleaned up version of a struct firmware uses. For
4137  * example, config_valid was hidden inside an array.
4138  */
4139 struct wmi_dbglog_cfg_cmd {
4140 	/* bitmask to hold mod id config*/
4141 	__le32 module_enable;
4142 
4143 	/* see ATH10K_DBGLOG_CFG_ */
4144 	__le32 config_enable;
4145 
4146 	/* mask of module id bits to be changed */
4147 	__le32 module_valid;
4148 
4149 	/* mask of config bits to be changed, see ATH10K_DBGLOG_CFG_ */
4150 	__le32 config_valid;
4151 } __packed;
4152 
4153 #define ATH10K_RTS_MAX		2347
4154 #define ATH10K_FRAGMT_THRESHOLD_MIN	540
4155 #define ATH10K_FRAGMT_THRESHOLD_MAX	2346
4156 
4157 #define WMI_MAX_EVENT 0x1000
4158 /* Maximum number of pending TXed WMI packets */
4159 #define WMI_SKB_HEADROOM sizeof(struct wmi_cmd_hdr)
4160 
4161 /* By default disable power save for IBSS */
4162 #define ATH10K_DEFAULT_ATIM 0
4163 
4164 struct ath10k;
4165 struct ath10k_vif;
4166 
4167 int ath10k_wmi_attach(struct ath10k *ar);
4168 void ath10k_wmi_detach(struct ath10k *ar);
4169 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar);
4170 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar);
4171 
4172 int ath10k_wmi_connect_htc_service(struct ath10k *ar);
4173 int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
4174 				const struct wmi_channel_arg *);
4175 int ath10k_wmi_pdev_suspend_target(struct ath10k *ar);
4176 int ath10k_wmi_pdev_resume_target(struct ath10k *ar);
4177 int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g,
4178 				  u16 rd5g, u16 ctl2g, u16 ctl5g);
4179 int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value);
4180 int ath10k_wmi_cmd_init(struct ath10k *ar);
4181 int ath10k_wmi_start_scan(struct ath10k *ar, const struct wmi_start_scan_arg *);
4182 void ath10k_wmi_start_scan_init(struct ath10k *ar, struct wmi_start_scan_arg *);
4183 int ath10k_wmi_stop_scan(struct ath10k *ar,
4184 			 const struct wmi_stop_scan_arg *arg);
4185 int ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id,
4186 			   enum wmi_vdev_type type,
4187 			   enum wmi_vdev_subtype subtype,
4188 			   const u8 macaddr[ETH_ALEN]);
4189 int ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id);
4190 int ath10k_wmi_vdev_start(struct ath10k *ar,
4191 			  const struct wmi_vdev_start_request_arg *);
4192 int ath10k_wmi_vdev_restart(struct ath10k *ar,
4193 			    const struct wmi_vdev_start_request_arg *);
4194 int ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id);
4195 int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid,
4196 		       const u8 *bssid);
4197 int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id);
4198 int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id,
4199 			      u32 param_id, u32 param_value);
4200 int ath10k_wmi_vdev_install_key(struct ath10k *ar,
4201 				const struct wmi_vdev_install_key_arg *arg);
4202 int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id,
4203 		    const u8 peer_addr[ETH_ALEN]);
4204 int ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id,
4205 		    const u8 peer_addr[ETH_ALEN]);
4206 int ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id,
4207 		   const u8 peer_addr[ETH_ALEN], u32 tid_bitmap);
4208 int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id,
4209 			      const u8 *peer_addr,
4210 			      enum wmi_peer_param param_id, u32 param_value);
4211 int ath10k_wmi_peer_assoc(struct ath10k *ar,
4212 			  const struct wmi_peer_assoc_complete_arg *arg);
4213 int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id,
4214 			  enum wmi_sta_ps_mode psmode);
4215 int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id,
4216 				enum wmi_sta_powersave_param param_id,
4217 				u32 value);
4218 int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
4219 			       enum wmi_ap_ps_peer_param param_id, u32 value);
4220 int ath10k_wmi_scan_chan_list(struct ath10k *ar,
4221 			      const struct wmi_scan_chan_list_arg *arg);
4222 int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
4223 				  const struct wmi_bcn_tx_arg *arg);
4224 int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar,
4225 			const struct wmi_pdev_set_wmm_params_arg *arg);
4226 int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id);
4227 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
4228 			     enum wmi_force_fw_hang_type type, u32 delay_ms);
4229 int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb);
4230 int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable);
4231 
4232 #endif /* _WMI_H_ */
4233