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