ath10k: make wmi_service_name() warn about missing service ids
[sfrench/cifs-2.6.git] / drivers / net / wireless / ath / ath10k / wmi.h
1 /*
2  * Copyright (c) 2005-2011 Atheros Communications Inc.
3  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18
19 #ifndef _WMI_H_
20 #define _WMI_H_
21
22 #include <linux/types.h>
23 #include <net/mac80211.h>
24
25 /*
26  * This file specifies the WMI interface for the Unified Software
27  * Architecture.
28  *
29  * It includes definitions of all the commands and events. Commands are
30  * messages from the host to the target. Events and Replies are messages
31  * from the target to the host.
32  *
33  * Ownership of correctness in regards to WMI commands belongs to the host
34  * driver and the target is not required to validate parameters for value,
35  * proper range, or any other checking.
36  *
37  * Guidelines for extending this interface are below.
38  *
39  * 1. Add new WMI commands ONLY within the specified range - 0x9000 - 0x9fff
40  *
41  * 2. Use ONLY u32 type for defining member variables within WMI
42  *    command/event structures. Do not use u8, u16, bool or
43  *    enum types within these structures.
44  *
45  * 3. DO NOT define bit fields within structures. Implement bit fields
46  *    using masks if necessary. Do not use the programming language's bit
47  *    field definition.
48  *
49  * 4. Define macros for encode/decode of u8, u16 fields within
50  *    the u32 variables. Use these macros for set/get of these fields.
51  *    Try to use this to optimize the structure without bloating it with
52  *    u32 variables for every lower sized field.
53  *
54  * 5. Do not use PACK/UNPACK attributes for the structures as each member
55  *    variable is already 4-byte aligned by virtue of being a u32
56  *    type.
57  *
58  * 6. Comment each parameter part of the WMI command/event structure by
59  *    using the 2 stars at the beginning of C comment instead of one star to
60  *    enable HTML document generation using Doxygen.
61  *
62  */
63
64 /* Control Path */
65 struct wmi_cmd_hdr {
66         __le32 cmd_id;
67 } __packed;
68
69 #define WMI_CMD_HDR_CMD_ID_MASK   0x00FFFFFF
70 #define WMI_CMD_HDR_CMD_ID_LSB    0
71 #define WMI_CMD_HDR_PLT_PRIV_MASK 0xFF000000
72 #define WMI_CMD_HDR_PLT_PRIV_LSB  24
73
74 #define HTC_PROTOCOL_VERSION    0x0002
75 #define WMI_PROTOCOL_VERSION    0x0002
76
77 /*
78  * There is no signed version of __le32, so for a temporary solution come
79  * up with our own version. The idea is from fs/ntfs/endian.h.
80  *
81  * Use a_ prefix so that it doesn't conflict if we get proper support to
82  * linux/types.h.
83  */
84 typedef __s32 __bitwise a_sle32;
85
86 static inline a_sle32 a_cpu_to_sle32(s32 val)
87 {
88         return (__force a_sle32)cpu_to_le32(val);
89 }
90
91 static inline s32 a_sle32_to_cpu(a_sle32 val)
92 {
93         return le32_to_cpu((__force __le32)val);
94 }
95
96 enum wmi_service {
97         WMI_SERVICE_BEACON_OFFLOAD = 0,
98         WMI_SERVICE_SCAN_OFFLOAD,
99         WMI_SERVICE_ROAM_OFFLOAD,
100         WMI_SERVICE_BCN_MISS_OFFLOAD,
101         WMI_SERVICE_STA_PWRSAVE,
102         WMI_SERVICE_STA_ADVANCED_PWRSAVE,
103         WMI_SERVICE_AP_UAPSD,
104         WMI_SERVICE_AP_DFS,
105         WMI_SERVICE_11AC,
106         WMI_SERVICE_BLOCKACK,
107         WMI_SERVICE_PHYERR,
108         WMI_SERVICE_BCN_FILTER,
109         WMI_SERVICE_RTT,
110         WMI_SERVICE_RATECTRL,
111         WMI_SERVICE_WOW,
112         WMI_SERVICE_RATECTRL_CACHE,
113         WMI_SERVICE_IRAM_TIDS,
114         WMI_SERVICE_ARPNS_OFFLOAD,
115         WMI_SERVICE_NLO,
116         WMI_SERVICE_GTK_OFFLOAD,
117         WMI_SERVICE_SCAN_SCH,
118         WMI_SERVICE_CSA_OFFLOAD,
119         WMI_SERVICE_CHATTER,
120         WMI_SERVICE_COEX_FREQAVOID,
121         WMI_SERVICE_PACKET_POWER_SAVE,
122         WMI_SERVICE_FORCE_FW_HANG,
123         WMI_SERVICE_GPIO,
124         WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM,
125         WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
126         WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
127         WMI_SERVICE_STA_KEEP_ALIVE,
128         WMI_SERVICE_TX_ENCAP,
129         WMI_SERVICE_BURST,
130         WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT,
131         WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT,
132         WMI_SERVICE_ROAM_SCAN_OFFLOAD,
133         WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC,
134         WMI_SERVICE_EARLY_RX,
135         WMI_SERVICE_STA_SMPS,
136         WMI_SERVICE_FWTEST,
137         WMI_SERVICE_STA_WMMAC,
138         WMI_SERVICE_TDLS,
139         WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE,
140         WMI_SERVICE_ADAPTIVE_OCS,
141         WMI_SERVICE_BA_SSN_SUPPORT,
142         WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE,
143         WMI_SERVICE_WLAN_HB,
144         WMI_SERVICE_LTE_ANT_SHARE_SUPPORT,
145         WMI_SERVICE_BATCH_SCAN,
146         WMI_SERVICE_QPOWER,
147         WMI_SERVICE_PLMREQ,
148         WMI_SERVICE_THERMAL_MGMT,
149         WMI_SERVICE_RMC,
150         WMI_SERVICE_MHF_OFFLOAD,
151         WMI_SERVICE_COEX_SAR,
152         WMI_SERVICE_BCN_TXRATE_OVERRIDE,
153         WMI_SERVICE_NAN,
154         WMI_SERVICE_L1SS_STAT,
155         WMI_SERVICE_ESTIMATE_LINKSPEED,
156         WMI_SERVICE_OBSS_SCAN,
157         WMI_SERVICE_TDLS_OFFCHAN,
158         WMI_SERVICE_TDLS_UAPSD_BUFFER_STA,
159         WMI_SERVICE_TDLS_UAPSD_SLEEP_STA,
160         WMI_SERVICE_IBSS_PWRSAVE,
161         WMI_SERVICE_LPASS,
162         WMI_SERVICE_EXTSCAN,
163         WMI_SERVICE_D0WOW,
164         WMI_SERVICE_HSOFFLOAD,
165         WMI_SERVICE_ROAM_HO_OFFLOAD,
166         WMI_SERVICE_RX_FULL_REORDER,
167         WMI_SERVICE_DHCP_OFFLOAD,
168         WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT,
169         WMI_SERVICE_MDNS_OFFLOAD,
170         WMI_SERVICE_SAP_AUTH_OFFLOAD,
171         WMI_SERVICE_ATF,
172         WMI_SERVICE_COEX_GPIO,
173         WMI_SERVICE_ENHANCED_PROXY_STA,
174         WMI_SERVICE_TT,
175         WMI_SERVICE_PEER_CACHING,
176         WMI_SERVICE_AUX_SPECTRAL_INTF,
177         WMI_SERVICE_AUX_CHAN_LOAD_INTF,
178         WMI_SERVICE_BSS_CHANNEL_INFO_64,
179         WMI_SERVICE_EXT_RES_CFG_SUPPORT,
180         WMI_SERVICE_MESH_11S,
181         WMI_SERVICE_MESH_NON_11S,
182         WMI_SERVICE_PEER_STATS,
183         WMI_SERVICE_RESTRT_CHNL_SUPPORT,
184         WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT,
185         WMI_SERVICE_TX_MODE_PUSH_ONLY,
186         WMI_SERVICE_TX_MODE_PUSH_PULL,
187         WMI_SERVICE_TX_MODE_DYNAMIC,
188         WMI_SERVICE_VDEV_RX_FILTER,
189         WMI_SERVICE_BTCOEX,
190         WMI_SERVICE_CHECK_CAL_VERSION,
191         WMI_SERVICE_DBGLOG_WARN2,
192         WMI_SERVICE_BTCOEX_DUTY_CYCLE,
193         WMI_SERVICE_4_WIRE_COEX_SUPPORT,
194         WMI_SERVICE_EXTENDED_NSS_SUPPORT,
195         WMI_SERVICE_PROG_GPIO_BAND_SELECT,
196         WMI_SERVICE_SMART_LOGGING_SUPPORT,
197         WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE,
198         WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY,
199         WMI_SERVICE_MGMT_TX_WMI,
200         WMI_SERVICE_TDLS_WIDER_BANDWIDTH,
201         WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
202         WMI_SERVICE_HOST_DFS_CHECK_SUPPORT,
203         WMI_SERVICE_TPC_STATS_FINAL,
204         WMI_SERVICE_RESET_CHIP,
205         WMI_SERVICE_SPOOF_MAC_SUPPORT,
206         WMI_SERVICE_TX_DATA_ACK_RSSI,
207         WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
208         WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
209         WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT,
210         WMI_SERVICE_THERM_THROT,
211         WMI_SERVICE_RTT_RESPONDER_ROLE,
212         WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
213         WMI_SERVICE_REPORT_AIRTIME,
214
215         /* Remember to add the new value to wmi_service_name()! */
216
217         /* keep last */
218         WMI_SERVICE_MAX,
219 };
220
221 enum wmi_10x_service {
222         WMI_10X_SERVICE_BEACON_OFFLOAD = 0,
223         WMI_10X_SERVICE_SCAN_OFFLOAD,
224         WMI_10X_SERVICE_ROAM_OFFLOAD,
225         WMI_10X_SERVICE_BCN_MISS_OFFLOAD,
226         WMI_10X_SERVICE_STA_PWRSAVE,
227         WMI_10X_SERVICE_STA_ADVANCED_PWRSAVE,
228         WMI_10X_SERVICE_AP_UAPSD,
229         WMI_10X_SERVICE_AP_DFS,
230         WMI_10X_SERVICE_11AC,
231         WMI_10X_SERVICE_BLOCKACK,
232         WMI_10X_SERVICE_PHYERR,
233         WMI_10X_SERVICE_BCN_FILTER,
234         WMI_10X_SERVICE_RTT,
235         WMI_10X_SERVICE_RATECTRL,
236         WMI_10X_SERVICE_WOW,
237         WMI_10X_SERVICE_RATECTRL_CACHE,
238         WMI_10X_SERVICE_IRAM_TIDS,
239         WMI_10X_SERVICE_BURST,
240
241         /* introduced in 10.2 */
242         WMI_10X_SERVICE_SMART_ANTENNA_SW_SUPPORT,
243         WMI_10X_SERVICE_FORCE_FW_HANG,
244         WMI_10X_SERVICE_SMART_ANTENNA_HW_SUPPORT,
245         WMI_10X_SERVICE_ATF,
246         WMI_10X_SERVICE_COEX_GPIO,
247         WMI_10X_SERVICE_AUX_SPECTRAL_INTF,
248         WMI_10X_SERVICE_AUX_CHAN_LOAD_INTF,
249         WMI_10X_SERVICE_BSS_CHANNEL_INFO_64,
250         WMI_10X_SERVICE_MESH,
251         WMI_10X_SERVICE_EXT_RES_CFG_SUPPORT,
252         WMI_10X_SERVICE_PEER_STATS,
253         WMI_10X_SERVICE_RESET_CHIP,
254         WMI_10X_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
255         WMI_10X_SERVICE_VDEV_BCN_RATE_CONTROL,
256         WMI_10X_SERVICE_PER_PACKET_SW_ENCRYPT,
257         WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT,
258 };
259
260 enum wmi_main_service {
261         WMI_MAIN_SERVICE_BEACON_OFFLOAD = 0,
262         WMI_MAIN_SERVICE_SCAN_OFFLOAD,
263         WMI_MAIN_SERVICE_ROAM_OFFLOAD,
264         WMI_MAIN_SERVICE_BCN_MISS_OFFLOAD,
265         WMI_MAIN_SERVICE_STA_PWRSAVE,
266         WMI_MAIN_SERVICE_STA_ADVANCED_PWRSAVE,
267         WMI_MAIN_SERVICE_AP_UAPSD,
268         WMI_MAIN_SERVICE_AP_DFS,
269         WMI_MAIN_SERVICE_11AC,
270         WMI_MAIN_SERVICE_BLOCKACK,
271         WMI_MAIN_SERVICE_PHYERR,
272         WMI_MAIN_SERVICE_BCN_FILTER,
273         WMI_MAIN_SERVICE_RTT,
274         WMI_MAIN_SERVICE_RATECTRL,
275         WMI_MAIN_SERVICE_WOW,
276         WMI_MAIN_SERVICE_RATECTRL_CACHE,
277         WMI_MAIN_SERVICE_IRAM_TIDS,
278         WMI_MAIN_SERVICE_ARPNS_OFFLOAD,
279         WMI_MAIN_SERVICE_NLO,
280         WMI_MAIN_SERVICE_GTK_OFFLOAD,
281         WMI_MAIN_SERVICE_SCAN_SCH,
282         WMI_MAIN_SERVICE_CSA_OFFLOAD,
283         WMI_MAIN_SERVICE_CHATTER,
284         WMI_MAIN_SERVICE_COEX_FREQAVOID,
285         WMI_MAIN_SERVICE_PACKET_POWER_SAVE,
286         WMI_MAIN_SERVICE_FORCE_FW_HANG,
287         WMI_MAIN_SERVICE_GPIO,
288         WMI_MAIN_SERVICE_STA_DTIM_PS_MODULATED_DTIM,
289         WMI_MAIN_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
290         WMI_MAIN_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
291         WMI_MAIN_SERVICE_STA_KEEP_ALIVE,
292         WMI_MAIN_SERVICE_TX_ENCAP,
293 };
294
295 enum wmi_10_4_service {
296         WMI_10_4_SERVICE_BEACON_OFFLOAD = 0,
297         WMI_10_4_SERVICE_SCAN_OFFLOAD,
298         WMI_10_4_SERVICE_ROAM_OFFLOAD,
299         WMI_10_4_SERVICE_BCN_MISS_OFFLOAD,
300         WMI_10_4_SERVICE_STA_PWRSAVE,
301         WMI_10_4_SERVICE_STA_ADVANCED_PWRSAVE,
302         WMI_10_4_SERVICE_AP_UAPSD,
303         WMI_10_4_SERVICE_AP_DFS,
304         WMI_10_4_SERVICE_11AC,
305         WMI_10_4_SERVICE_BLOCKACK,
306         WMI_10_4_SERVICE_PHYERR,
307         WMI_10_4_SERVICE_BCN_FILTER,
308         WMI_10_4_SERVICE_RTT,
309         WMI_10_4_SERVICE_RATECTRL,
310         WMI_10_4_SERVICE_WOW,
311         WMI_10_4_SERVICE_RATECTRL_CACHE,
312         WMI_10_4_SERVICE_IRAM_TIDS,
313         WMI_10_4_SERVICE_BURST,
314         WMI_10_4_SERVICE_SMART_ANTENNA_SW_SUPPORT,
315         WMI_10_4_SERVICE_GTK_OFFLOAD,
316         WMI_10_4_SERVICE_SCAN_SCH,
317         WMI_10_4_SERVICE_CSA_OFFLOAD,
318         WMI_10_4_SERVICE_CHATTER,
319         WMI_10_4_SERVICE_COEX_FREQAVOID,
320         WMI_10_4_SERVICE_PACKET_POWER_SAVE,
321         WMI_10_4_SERVICE_FORCE_FW_HANG,
322         WMI_10_4_SERVICE_SMART_ANTENNA_HW_SUPPORT,
323         WMI_10_4_SERVICE_GPIO,
324         WMI_10_4_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
325         WMI_10_4_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
326         WMI_10_4_SERVICE_STA_KEEP_ALIVE,
327         WMI_10_4_SERVICE_TX_ENCAP,
328         WMI_10_4_SERVICE_AP_PS_DETECT_OUT_OF_SYNC,
329         WMI_10_4_SERVICE_EARLY_RX,
330         WMI_10_4_SERVICE_ENHANCED_PROXY_STA,
331         WMI_10_4_SERVICE_TT,
332         WMI_10_4_SERVICE_ATF,
333         WMI_10_4_SERVICE_PEER_CACHING,
334         WMI_10_4_SERVICE_COEX_GPIO,
335         WMI_10_4_SERVICE_AUX_SPECTRAL_INTF,
336         WMI_10_4_SERVICE_AUX_CHAN_LOAD_INTF,
337         WMI_10_4_SERVICE_BSS_CHANNEL_INFO_64,
338         WMI_10_4_SERVICE_EXT_RES_CFG_SUPPORT,
339         WMI_10_4_SERVICE_MESH_NON_11S,
340         WMI_10_4_SERVICE_RESTRT_CHNL_SUPPORT,
341         WMI_10_4_SERVICE_PEER_STATS,
342         WMI_10_4_SERVICE_MESH_11S,
343         WMI_10_4_SERVICE_PERIODIC_CHAN_STAT_SUPPORT,
344         WMI_10_4_SERVICE_TX_MODE_PUSH_ONLY,
345         WMI_10_4_SERVICE_TX_MODE_PUSH_PULL,
346         WMI_10_4_SERVICE_TX_MODE_DYNAMIC,
347         WMI_10_4_SERVICE_VDEV_RX_FILTER,
348         WMI_10_4_SERVICE_BTCOEX,
349         WMI_10_4_SERVICE_CHECK_CAL_VERSION,
350         WMI_10_4_SERVICE_DBGLOG_WARN2,
351         WMI_10_4_SERVICE_BTCOEX_DUTY_CYCLE,
352         WMI_10_4_SERVICE_4_WIRE_COEX_SUPPORT,
353         WMI_10_4_SERVICE_EXTENDED_NSS_SUPPORT,
354         WMI_10_4_SERVICE_PROG_GPIO_BAND_SELECT,
355         WMI_10_4_SERVICE_SMART_LOGGING_SUPPORT,
356         WMI_10_4_SERVICE_TDLS,
357         WMI_10_4_SERVICE_TDLS_OFFCHAN,
358         WMI_10_4_SERVICE_TDLS_UAPSD_BUFFER_STA,
359         WMI_10_4_SERVICE_TDLS_UAPSD_SLEEP_STA,
360         WMI_10_4_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE,
361         WMI_10_4_SERVICE_TDLS_EXPLICIT_MODE_ONLY,
362         WMI_10_4_SERVICE_TDLS_WIDER_BANDWIDTH,
363         WMI_10_4_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
364         WMI_10_4_SERVICE_HOST_DFS_CHECK_SUPPORT,
365         WMI_10_4_SERVICE_TPC_STATS_FINAL,
366         WMI_10_4_SERVICE_CFR_CAPTURE_SUPPORT,
367         WMI_10_4_SERVICE_TX_DATA_ACK_RSSI,
368         WMI_10_4_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_LEGACY,
369         WMI_10_4_SERVICE_PER_PACKET_SW_ENCRYPT,
370         WMI_10_4_SERVICE_PEER_TID_CONFIGS_SUPPORT,
371         WMI_10_4_SERVICE_VDEV_BCN_RATE_CONTROL,
372         WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
373         WMI_10_4_SERVICE_HTT_ASSERT_TRIGGER_SUPPORT,
374         WMI_10_4_SERVICE_VDEV_FILTER_NEIGHBOR_RX_PACKETS,
375         WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
376         WMI_10_4_SERVICE_PEER_CHWIDTH_CHANGE,
377         WMI_10_4_SERVICE_RX_FILTER_OUT_COUNT,
378         WMI_10_4_SERVICE_RTT_RESPONDER_ROLE,
379         WMI_10_4_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT,
380         WMI_10_4_SERVICE_REPORT_AIRTIME,
381 };
382
383 static inline char *wmi_service_name(enum wmi_service service_id)
384 {
385 #define SVCSTR(x) case x: return #x
386
387         switch (service_id) {
388         SVCSTR(WMI_SERVICE_BEACON_OFFLOAD);
389         SVCSTR(WMI_SERVICE_SCAN_OFFLOAD);
390         SVCSTR(WMI_SERVICE_ROAM_OFFLOAD);
391         SVCSTR(WMI_SERVICE_BCN_MISS_OFFLOAD);
392         SVCSTR(WMI_SERVICE_STA_PWRSAVE);
393         SVCSTR(WMI_SERVICE_STA_ADVANCED_PWRSAVE);
394         SVCSTR(WMI_SERVICE_AP_UAPSD);
395         SVCSTR(WMI_SERVICE_AP_DFS);
396         SVCSTR(WMI_SERVICE_11AC);
397         SVCSTR(WMI_SERVICE_BLOCKACK);
398         SVCSTR(WMI_SERVICE_PHYERR);
399         SVCSTR(WMI_SERVICE_BCN_FILTER);
400         SVCSTR(WMI_SERVICE_RTT);
401         SVCSTR(WMI_SERVICE_RATECTRL);
402         SVCSTR(WMI_SERVICE_WOW);
403         SVCSTR(WMI_SERVICE_RATECTRL_CACHE);
404         SVCSTR(WMI_SERVICE_IRAM_TIDS);
405         SVCSTR(WMI_SERVICE_ARPNS_OFFLOAD);
406         SVCSTR(WMI_SERVICE_NLO);
407         SVCSTR(WMI_SERVICE_GTK_OFFLOAD);
408         SVCSTR(WMI_SERVICE_SCAN_SCH);
409         SVCSTR(WMI_SERVICE_CSA_OFFLOAD);
410         SVCSTR(WMI_SERVICE_CHATTER);
411         SVCSTR(WMI_SERVICE_COEX_FREQAVOID);
412         SVCSTR(WMI_SERVICE_PACKET_POWER_SAVE);
413         SVCSTR(WMI_SERVICE_FORCE_FW_HANG);
414         SVCSTR(WMI_SERVICE_GPIO);
415         SVCSTR(WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM);
416         SVCSTR(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG);
417         SVCSTR(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG);
418         SVCSTR(WMI_SERVICE_STA_KEEP_ALIVE);
419         SVCSTR(WMI_SERVICE_TX_ENCAP);
420         SVCSTR(WMI_SERVICE_BURST);
421         SVCSTR(WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT);
422         SVCSTR(WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT);
423         SVCSTR(WMI_SERVICE_ROAM_SCAN_OFFLOAD);
424         SVCSTR(WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC);
425         SVCSTR(WMI_SERVICE_EARLY_RX);
426         SVCSTR(WMI_SERVICE_STA_SMPS);
427         SVCSTR(WMI_SERVICE_FWTEST);
428         SVCSTR(WMI_SERVICE_STA_WMMAC);
429         SVCSTR(WMI_SERVICE_TDLS);
430         SVCSTR(WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE);
431         SVCSTR(WMI_SERVICE_ADAPTIVE_OCS);
432         SVCSTR(WMI_SERVICE_BA_SSN_SUPPORT);
433         SVCSTR(WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE);
434         SVCSTR(WMI_SERVICE_WLAN_HB);
435         SVCSTR(WMI_SERVICE_LTE_ANT_SHARE_SUPPORT);
436         SVCSTR(WMI_SERVICE_BATCH_SCAN);
437         SVCSTR(WMI_SERVICE_QPOWER);
438         SVCSTR(WMI_SERVICE_PLMREQ);
439         SVCSTR(WMI_SERVICE_THERMAL_MGMT);
440         SVCSTR(WMI_SERVICE_RMC);
441         SVCSTR(WMI_SERVICE_MHF_OFFLOAD);
442         SVCSTR(WMI_SERVICE_COEX_SAR);
443         SVCSTR(WMI_SERVICE_BCN_TXRATE_OVERRIDE);
444         SVCSTR(WMI_SERVICE_NAN);
445         SVCSTR(WMI_SERVICE_L1SS_STAT);
446         SVCSTR(WMI_SERVICE_ESTIMATE_LINKSPEED);
447         SVCSTR(WMI_SERVICE_OBSS_SCAN);
448         SVCSTR(WMI_SERVICE_TDLS_OFFCHAN);
449         SVCSTR(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA);
450         SVCSTR(WMI_SERVICE_TDLS_UAPSD_SLEEP_STA);
451         SVCSTR(WMI_SERVICE_IBSS_PWRSAVE);
452         SVCSTR(WMI_SERVICE_LPASS);
453         SVCSTR(WMI_SERVICE_EXTSCAN);
454         SVCSTR(WMI_SERVICE_D0WOW);
455         SVCSTR(WMI_SERVICE_HSOFFLOAD);
456         SVCSTR(WMI_SERVICE_ROAM_HO_OFFLOAD);
457         SVCSTR(WMI_SERVICE_RX_FULL_REORDER);
458         SVCSTR(WMI_SERVICE_DHCP_OFFLOAD);
459         SVCSTR(WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT);
460         SVCSTR(WMI_SERVICE_MDNS_OFFLOAD);
461         SVCSTR(WMI_SERVICE_SAP_AUTH_OFFLOAD);
462         SVCSTR(WMI_SERVICE_ATF);
463         SVCSTR(WMI_SERVICE_COEX_GPIO);
464         SVCSTR(WMI_SERVICE_ENHANCED_PROXY_STA);
465         SVCSTR(WMI_SERVICE_TT);
466         SVCSTR(WMI_SERVICE_PEER_CACHING);
467         SVCSTR(WMI_SERVICE_AUX_SPECTRAL_INTF);
468         SVCSTR(WMI_SERVICE_AUX_CHAN_LOAD_INTF);
469         SVCSTR(WMI_SERVICE_BSS_CHANNEL_INFO_64);
470         SVCSTR(WMI_SERVICE_EXT_RES_CFG_SUPPORT);
471         SVCSTR(WMI_SERVICE_MESH_11S);
472         SVCSTR(WMI_SERVICE_MESH_NON_11S);
473         SVCSTR(WMI_SERVICE_PEER_STATS);
474         SVCSTR(WMI_SERVICE_RESTRT_CHNL_SUPPORT);
475         SVCSTR(WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT);
476         SVCSTR(WMI_SERVICE_TX_MODE_PUSH_ONLY);
477         SVCSTR(WMI_SERVICE_TX_MODE_PUSH_PULL);
478         SVCSTR(WMI_SERVICE_TX_MODE_DYNAMIC);
479         SVCSTR(WMI_SERVICE_VDEV_RX_FILTER);
480         SVCSTR(WMI_SERVICE_BTCOEX);
481         SVCSTR(WMI_SERVICE_CHECK_CAL_VERSION);
482         SVCSTR(WMI_SERVICE_DBGLOG_WARN2);
483         SVCSTR(WMI_SERVICE_BTCOEX_DUTY_CYCLE);
484         SVCSTR(WMI_SERVICE_4_WIRE_COEX_SUPPORT);
485         SVCSTR(WMI_SERVICE_EXTENDED_NSS_SUPPORT);
486         SVCSTR(WMI_SERVICE_PROG_GPIO_BAND_SELECT);
487         SVCSTR(WMI_SERVICE_SMART_LOGGING_SUPPORT);
488         SVCSTR(WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE);
489         SVCSTR(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY);
490         SVCSTR(WMI_SERVICE_MGMT_TX_WMI);
491         SVCSTR(WMI_SERVICE_TDLS_WIDER_BANDWIDTH);
492         SVCSTR(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS);
493         SVCSTR(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT);
494         SVCSTR(WMI_SERVICE_TPC_STATS_FINAL);
495         SVCSTR(WMI_SERVICE_RESET_CHIP);
496         SVCSTR(WMI_SERVICE_SPOOF_MAC_SUPPORT);
497         SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI);
498         SVCSTR(WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT);
499         SVCSTR(WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT);
500         SVCSTR(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT);
501         SVCSTR(WMI_SERVICE_THERM_THROT);
502         SVCSTR(WMI_SERVICE_RTT_RESPONDER_ROLE);
503         SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT);
504         SVCSTR(WMI_SERVICE_REPORT_AIRTIME);
505
506         case WMI_SERVICE_MAX:
507                 return NULL;
508         }
509
510 #undef SVCSTR
511
512         return NULL;
513 }
514
515 #define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \
516         ((svc_id) < (len) && \
517          __le32_to_cpu((wmi_svc_bmap)[(svc_id) / (sizeof(u32))]) & \
518          BIT((svc_id) % (sizeof(u32))))
519
520 /* This extension is required to accommodate new services, current limit
521  * for wmi_services is 64 as target is using only 4-bits of each 32-bit
522  * wmi_service word. Extending this to make use of remaining unused bits
523  * for new services.
524  */
525 #define WMI_EXT_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \
526         ((svc_id) >= (len) && \
527         __le32_to_cpu((wmi_svc_bmap)[((svc_id) - (len)) / 28]) & \
528         BIT(((((svc_id) - (len)) % 28) & 0x1f) + 4))
529
530 #define SVCMAP(x, y, len) \
531         do { \
532                 if ((WMI_SERVICE_IS_ENABLED((in), (x), (len))) || \
533                     (WMI_EXT_SERVICE_IS_ENABLED((in), (x), (len)))) \
534                         __set_bit(y, out); \
535         } while (0)
536
537 static inline void wmi_10x_svc_map(const __le32 *in, unsigned long *out,
538                                    size_t len)
539 {
540         SVCMAP(WMI_10X_SERVICE_BEACON_OFFLOAD,
541                WMI_SERVICE_BEACON_OFFLOAD, len);
542         SVCMAP(WMI_10X_SERVICE_SCAN_OFFLOAD,
543                WMI_SERVICE_SCAN_OFFLOAD, len);
544         SVCMAP(WMI_10X_SERVICE_ROAM_OFFLOAD,
545                WMI_SERVICE_ROAM_OFFLOAD, len);
546         SVCMAP(WMI_10X_SERVICE_BCN_MISS_OFFLOAD,
547                WMI_SERVICE_BCN_MISS_OFFLOAD, len);
548         SVCMAP(WMI_10X_SERVICE_STA_PWRSAVE,
549                WMI_SERVICE_STA_PWRSAVE, len);
550         SVCMAP(WMI_10X_SERVICE_STA_ADVANCED_PWRSAVE,
551                WMI_SERVICE_STA_ADVANCED_PWRSAVE, len);
552         SVCMAP(WMI_10X_SERVICE_AP_UAPSD,
553                WMI_SERVICE_AP_UAPSD, len);
554         SVCMAP(WMI_10X_SERVICE_AP_DFS,
555                WMI_SERVICE_AP_DFS, len);
556         SVCMAP(WMI_10X_SERVICE_11AC,
557                WMI_SERVICE_11AC, len);
558         SVCMAP(WMI_10X_SERVICE_BLOCKACK,
559                WMI_SERVICE_BLOCKACK, len);
560         SVCMAP(WMI_10X_SERVICE_PHYERR,
561                WMI_SERVICE_PHYERR, len);
562         SVCMAP(WMI_10X_SERVICE_BCN_FILTER,
563                WMI_SERVICE_BCN_FILTER, len);
564         SVCMAP(WMI_10X_SERVICE_RTT,
565                WMI_SERVICE_RTT, len);
566         SVCMAP(WMI_10X_SERVICE_RATECTRL,
567                WMI_SERVICE_RATECTRL, len);
568         SVCMAP(WMI_10X_SERVICE_WOW,
569                WMI_SERVICE_WOW, len);
570         SVCMAP(WMI_10X_SERVICE_RATECTRL_CACHE,
571                WMI_SERVICE_RATECTRL_CACHE, len);
572         SVCMAP(WMI_10X_SERVICE_IRAM_TIDS,
573                WMI_SERVICE_IRAM_TIDS, len);
574         SVCMAP(WMI_10X_SERVICE_BURST,
575                WMI_SERVICE_BURST, len);
576         SVCMAP(WMI_10X_SERVICE_SMART_ANTENNA_SW_SUPPORT,
577                WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, len);
578         SVCMAP(WMI_10X_SERVICE_FORCE_FW_HANG,
579                WMI_SERVICE_FORCE_FW_HANG, len);
580         SVCMAP(WMI_10X_SERVICE_SMART_ANTENNA_HW_SUPPORT,
581                WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT, len);
582         SVCMAP(WMI_10X_SERVICE_ATF,
583                WMI_SERVICE_ATF, len);
584         SVCMAP(WMI_10X_SERVICE_COEX_GPIO,
585                WMI_SERVICE_COEX_GPIO, len);
586         SVCMAP(WMI_10X_SERVICE_AUX_SPECTRAL_INTF,
587                WMI_SERVICE_AUX_SPECTRAL_INTF, len);
588         SVCMAP(WMI_10X_SERVICE_AUX_CHAN_LOAD_INTF,
589                WMI_SERVICE_AUX_CHAN_LOAD_INTF, len);
590         SVCMAP(WMI_10X_SERVICE_BSS_CHANNEL_INFO_64,
591                WMI_SERVICE_BSS_CHANNEL_INFO_64, len);
592         SVCMAP(WMI_10X_SERVICE_MESH,
593                WMI_SERVICE_MESH_11S, len);
594         SVCMAP(WMI_10X_SERVICE_EXT_RES_CFG_SUPPORT,
595                WMI_SERVICE_EXT_RES_CFG_SUPPORT, len);
596         SVCMAP(WMI_10X_SERVICE_PEER_STATS,
597                WMI_SERVICE_PEER_STATS, len);
598         SVCMAP(WMI_10X_SERVICE_RESET_CHIP,
599                WMI_SERVICE_RESET_CHIP, len);
600         SVCMAP(WMI_10X_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
601                WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len);
602         SVCMAP(WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT,
603                WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, len);
604         SVCMAP(WMI_10X_SERVICE_PER_PACKET_SW_ENCRYPT,
605                WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len);
606 }
607
608 static inline void wmi_main_svc_map(const __le32 *in, unsigned long *out,
609                                     size_t len)
610 {
611         SVCMAP(WMI_MAIN_SERVICE_BEACON_OFFLOAD,
612                WMI_SERVICE_BEACON_OFFLOAD, len);
613         SVCMAP(WMI_MAIN_SERVICE_SCAN_OFFLOAD,
614                WMI_SERVICE_SCAN_OFFLOAD, len);
615         SVCMAP(WMI_MAIN_SERVICE_ROAM_OFFLOAD,
616                WMI_SERVICE_ROAM_OFFLOAD, len);
617         SVCMAP(WMI_MAIN_SERVICE_BCN_MISS_OFFLOAD,
618                WMI_SERVICE_BCN_MISS_OFFLOAD, len);
619         SVCMAP(WMI_MAIN_SERVICE_STA_PWRSAVE,
620                WMI_SERVICE_STA_PWRSAVE, len);
621         SVCMAP(WMI_MAIN_SERVICE_STA_ADVANCED_PWRSAVE,
622                WMI_SERVICE_STA_ADVANCED_PWRSAVE, len);
623         SVCMAP(WMI_MAIN_SERVICE_AP_UAPSD,
624                WMI_SERVICE_AP_UAPSD, len);
625         SVCMAP(WMI_MAIN_SERVICE_AP_DFS,
626                WMI_SERVICE_AP_DFS, len);
627         SVCMAP(WMI_MAIN_SERVICE_11AC,
628                WMI_SERVICE_11AC, len);
629         SVCMAP(WMI_MAIN_SERVICE_BLOCKACK,
630                WMI_SERVICE_BLOCKACK, len);
631         SVCMAP(WMI_MAIN_SERVICE_PHYERR,
632                WMI_SERVICE_PHYERR, len);
633         SVCMAP(WMI_MAIN_SERVICE_BCN_FILTER,
634                WMI_SERVICE_BCN_FILTER, len);
635         SVCMAP(WMI_MAIN_SERVICE_RTT,
636                WMI_SERVICE_RTT, len);
637         SVCMAP(WMI_MAIN_SERVICE_RATECTRL,
638                WMI_SERVICE_RATECTRL, len);
639         SVCMAP(WMI_MAIN_SERVICE_WOW,
640                WMI_SERVICE_WOW, len);
641         SVCMAP(WMI_MAIN_SERVICE_RATECTRL_CACHE,
642                WMI_SERVICE_RATECTRL_CACHE, len);
643         SVCMAP(WMI_MAIN_SERVICE_IRAM_TIDS,
644                WMI_SERVICE_IRAM_TIDS, len);
645         SVCMAP(WMI_MAIN_SERVICE_ARPNS_OFFLOAD,
646                WMI_SERVICE_ARPNS_OFFLOAD, len);
647         SVCMAP(WMI_MAIN_SERVICE_NLO,
648                WMI_SERVICE_NLO, len);
649         SVCMAP(WMI_MAIN_SERVICE_GTK_OFFLOAD,
650                WMI_SERVICE_GTK_OFFLOAD, len);
651         SVCMAP(WMI_MAIN_SERVICE_SCAN_SCH,
652                WMI_SERVICE_SCAN_SCH, len);
653         SVCMAP(WMI_MAIN_SERVICE_CSA_OFFLOAD,
654                WMI_SERVICE_CSA_OFFLOAD, len);
655         SVCMAP(WMI_MAIN_SERVICE_CHATTER,
656                WMI_SERVICE_CHATTER, len);
657         SVCMAP(WMI_MAIN_SERVICE_COEX_FREQAVOID,
658                WMI_SERVICE_COEX_FREQAVOID, len);
659         SVCMAP(WMI_MAIN_SERVICE_PACKET_POWER_SAVE,
660                WMI_SERVICE_PACKET_POWER_SAVE, len);
661         SVCMAP(WMI_MAIN_SERVICE_FORCE_FW_HANG,
662                WMI_SERVICE_FORCE_FW_HANG, len);
663         SVCMAP(WMI_MAIN_SERVICE_GPIO,
664                WMI_SERVICE_GPIO, len);
665         SVCMAP(WMI_MAIN_SERVICE_STA_DTIM_PS_MODULATED_DTIM,
666                WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM, len);
667         SVCMAP(WMI_MAIN_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
668                WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, len);
669         SVCMAP(WMI_MAIN_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
670                WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, len);
671         SVCMAP(WMI_MAIN_SERVICE_STA_KEEP_ALIVE,
672                WMI_SERVICE_STA_KEEP_ALIVE, len);
673         SVCMAP(WMI_MAIN_SERVICE_TX_ENCAP,
674                WMI_SERVICE_TX_ENCAP, len);
675 }
676
677 static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
678                                     size_t len)
679 {
680         SVCMAP(WMI_10_4_SERVICE_BEACON_OFFLOAD,
681                WMI_SERVICE_BEACON_OFFLOAD, len);
682         SVCMAP(WMI_10_4_SERVICE_SCAN_OFFLOAD,
683                WMI_SERVICE_SCAN_OFFLOAD, len);
684         SVCMAP(WMI_10_4_SERVICE_ROAM_OFFLOAD,
685                WMI_SERVICE_ROAM_OFFLOAD, len);
686         SVCMAP(WMI_10_4_SERVICE_BCN_MISS_OFFLOAD,
687                WMI_SERVICE_BCN_MISS_OFFLOAD, len);
688         SVCMAP(WMI_10_4_SERVICE_STA_PWRSAVE,
689                WMI_SERVICE_STA_PWRSAVE, len);
690         SVCMAP(WMI_10_4_SERVICE_STA_ADVANCED_PWRSAVE,
691                WMI_SERVICE_STA_ADVANCED_PWRSAVE, len);
692         SVCMAP(WMI_10_4_SERVICE_AP_UAPSD,
693                WMI_SERVICE_AP_UAPSD, len);
694         SVCMAP(WMI_10_4_SERVICE_AP_DFS,
695                WMI_SERVICE_AP_DFS, len);
696         SVCMAP(WMI_10_4_SERVICE_11AC,
697                WMI_SERVICE_11AC, len);
698         SVCMAP(WMI_10_4_SERVICE_BLOCKACK,
699                WMI_SERVICE_BLOCKACK, len);
700         SVCMAP(WMI_10_4_SERVICE_PHYERR,
701                WMI_SERVICE_PHYERR, len);
702         SVCMAP(WMI_10_4_SERVICE_BCN_FILTER,
703                WMI_SERVICE_BCN_FILTER, len);
704         SVCMAP(WMI_10_4_SERVICE_RTT,
705                WMI_SERVICE_RTT, len);
706         SVCMAP(WMI_10_4_SERVICE_RATECTRL,
707                WMI_SERVICE_RATECTRL, len);
708         SVCMAP(WMI_10_4_SERVICE_WOW,
709                WMI_SERVICE_WOW, len);
710         SVCMAP(WMI_10_4_SERVICE_RATECTRL_CACHE,
711                WMI_SERVICE_RATECTRL_CACHE, len);
712         SVCMAP(WMI_10_4_SERVICE_IRAM_TIDS,
713                WMI_SERVICE_IRAM_TIDS, len);
714         SVCMAP(WMI_10_4_SERVICE_BURST,
715                WMI_SERVICE_BURST, len);
716         SVCMAP(WMI_10_4_SERVICE_SMART_ANTENNA_SW_SUPPORT,
717                WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, len);
718         SVCMAP(WMI_10_4_SERVICE_GTK_OFFLOAD,
719                WMI_SERVICE_GTK_OFFLOAD, len);
720         SVCMAP(WMI_10_4_SERVICE_SCAN_SCH,
721                WMI_SERVICE_SCAN_SCH, len);
722         SVCMAP(WMI_10_4_SERVICE_CSA_OFFLOAD,
723                WMI_SERVICE_CSA_OFFLOAD, len);
724         SVCMAP(WMI_10_4_SERVICE_CHATTER,
725                WMI_SERVICE_CHATTER, len);
726         SVCMAP(WMI_10_4_SERVICE_COEX_FREQAVOID,
727                WMI_SERVICE_COEX_FREQAVOID, len);
728         SVCMAP(WMI_10_4_SERVICE_PACKET_POWER_SAVE,
729                WMI_SERVICE_PACKET_POWER_SAVE, len);
730         SVCMAP(WMI_10_4_SERVICE_FORCE_FW_HANG,
731                WMI_SERVICE_FORCE_FW_HANG, len);
732         SVCMAP(WMI_10_4_SERVICE_SMART_ANTENNA_HW_SUPPORT,
733                WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT, len);
734         SVCMAP(WMI_10_4_SERVICE_GPIO,
735                WMI_SERVICE_GPIO, len);
736         SVCMAP(WMI_10_4_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
737                WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, len);
738         SVCMAP(WMI_10_4_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
739                WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, len);
740         SVCMAP(WMI_10_4_SERVICE_STA_KEEP_ALIVE,
741                WMI_SERVICE_STA_KEEP_ALIVE, len);
742         SVCMAP(WMI_10_4_SERVICE_TX_ENCAP,
743                WMI_SERVICE_TX_ENCAP, len);
744         SVCMAP(WMI_10_4_SERVICE_AP_PS_DETECT_OUT_OF_SYNC,
745                WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC, len);
746         SVCMAP(WMI_10_4_SERVICE_EARLY_RX,
747                WMI_SERVICE_EARLY_RX, len);
748         SVCMAP(WMI_10_4_SERVICE_ENHANCED_PROXY_STA,
749                WMI_SERVICE_ENHANCED_PROXY_STA, len);
750         SVCMAP(WMI_10_4_SERVICE_TT,
751                WMI_SERVICE_TT, len);
752         SVCMAP(WMI_10_4_SERVICE_ATF,
753                WMI_SERVICE_ATF, len);
754         SVCMAP(WMI_10_4_SERVICE_PEER_CACHING,
755                WMI_SERVICE_PEER_CACHING, len);
756         SVCMAP(WMI_10_4_SERVICE_COEX_GPIO,
757                WMI_SERVICE_COEX_GPIO, len);
758         SVCMAP(WMI_10_4_SERVICE_AUX_SPECTRAL_INTF,
759                WMI_SERVICE_AUX_SPECTRAL_INTF, len);
760         SVCMAP(WMI_10_4_SERVICE_AUX_CHAN_LOAD_INTF,
761                WMI_SERVICE_AUX_CHAN_LOAD_INTF, len);
762         SVCMAP(WMI_10_4_SERVICE_BSS_CHANNEL_INFO_64,
763                WMI_SERVICE_BSS_CHANNEL_INFO_64, len);
764         SVCMAP(WMI_10_4_SERVICE_EXT_RES_CFG_SUPPORT,
765                WMI_SERVICE_EXT_RES_CFG_SUPPORT, len);
766         SVCMAP(WMI_10_4_SERVICE_MESH_NON_11S,
767                WMI_SERVICE_MESH_NON_11S, len);
768         SVCMAP(WMI_10_4_SERVICE_RESTRT_CHNL_SUPPORT,
769                WMI_SERVICE_RESTRT_CHNL_SUPPORT, len);
770         SVCMAP(WMI_10_4_SERVICE_PEER_STATS,
771                WMI_SERVICE_PEER_STATS, len);
772         SVCMAP(WMI_10_4_SERVICE_MESH_11S,
773                WMI_SERVICE_MESH_11S, len);
774         SVCMAP(WMI_10_4_SERVICE_PERIODIC_CHAN_STAT_SUPPORT,
775                WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT, len);
776         SVCMAP(WMI_10_4_SERVICE_TX_MODE_PUSH_ONLY,
777                WMI_SERVICE_TX_MODE_PUSH_ONLY, len);
778         SVCMAP(WMI_10_4_SERVICE_TX_MODE_PUSH_PULL,
779                WMI_SERVICE_TX_MODE_PUSH_PULL, len);
780         SVCMAP(WMI_10_4_SERVICE_TX_MODE_DYNAMIC,
781                WMI_SERVICE_TX_MODE_DYNAMIC, len);
782         SVCMAP(WMI_10_4_SERVICE_VDEV_RX_FILTER,
783                WMI_SERVICE_VDEV_RX_FILTER, len);
784         SVCMAP(WMI_10_4_SERVICE_BTCOEX,
785                WMI_SERVICE_BTCOEX, len);
786         SVCMAP(WMI_10_4_SERVICE_CHECK_CAL_VERSION,
787                WMI_SERVICE_CHECK_CAL_VERSION, len);
788         SVCMAP(WMI_10_4_SERVICE_DBGLOG_WARN2,
789                WMI_SERVICE_DBGLOG_WARN2, len);
790         SVCMAP(WMI_10_4_SERVICE_BTCOEX_DUTY_CYCLE,
791                WMI_SERVICE_BTCOEX_DUTY_CYCLE, len);
792         SVCMAP(WMI_10_4_SERVICE_4_WIRE_COEX_SUPPORT,
793                WMI_SERVICE_4_WIRE_COEX_SUPPORT, len);
794         SVCMAP(WMI_10_4_SERVICE_EXTENDED_NSS_SUPPORT,
795                WMI_SERVICE_EXTENDED_NSS_SUPPORT, len);
796         SVCMAP(WMI_10_4_SERVICE_PROG_GPIO_BAND_SELECT,
797                WMI_SERVICE_PROG_GPIO_BAND_SELECT, len);
798         SVCMAP(WMI_10_4_SERVICE_SMART_LOGGING_SUPPORT,
799                WMI_SERVICE_SMART_LOGGING_SUPPORT, len);
800         SVCMAP(WMI_10_4_SERVICE_TDLS,
801                WMI_SERVICE_TDLS, len);
802         SVCMAP(WMI_10_4_SERVICE_TDLS_OFFCHAN,
803                WMI_SERVICE_TDLS_OFFCHAN, len);
804         SVCMAP(WMI_10_4_SERVICE_TDLS_UAPSD_BUFFER_STA,
805                WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, len);
806         SVCMAP(WMI_10_4_SERVICE_TDLS_UAPSD_SLEEP_STA,
807                WMI_SERVICE_TDLS_UAPSD_SLEEP_STA, len);
808         SVCMAP(WMI_10_4_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE,
809                WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, len);
810         SVCMAP(WMI_10_4_SERVICE_TDLS_EXPLICIT_MODE_ONLY,
811                WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, len);
812         SVCMAP(WMI_10_4_SERVICE_TDLS_WIDER_BANDWIDTH,
813                WMI_SERVICE_TDLS_WIDER_BANDWIDTH, len);
814         SVCMAP(WMI_10_4_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
815                WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len);
816         SVCMAP(WMI_10_4_SERVICE_HOST_DFS_CHECK_SUPPORT,
817                WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, len);
818         SVCMAP(WMI_10_4_SERVICE_TPC_STATS_FINAL,
819                WMI_SERVICE_TPC_STATS_FINAL, len);
820         SVCMAP(WMI_10_4_SERVICE_TX_DATA_ACK_RSSI,
821                WMI_SERVICE_TX_DATA_ACK_RSSI, len);
822         SVCMAP(WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
823                WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, len);
824         SVCMAP(WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
825                WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, len);
826         SVCMAP(WMI_10_4_SERVICE_RTT_RESPONDER_ROLE,
827                WMI_SERVICE_RTT_RESPONDER_ROLE, len);
828         SVCMAP(WMI_10_4_SERVICE_PER_PACKET_SW_ENCRYPT,
829                WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len);
830         SVCMAP(WMI_10_4_SERVICE_REPORT_AIRTIME,
831                WMI_SERVICE_REPORT_AIRTIME, len);
832 }
833
834 #undef SVCMAP
835
836 /* 2 word representation of MAC addr */
837 struct wmi_mac_addr {
838         union {
839                 u8 addr[6];
840                 struct {
841                         u32 word0;
842                         u32 word1;
843                 } __packed;
844         } __packed;
845 } __packed;
846
847 struct wmi_cmd_map {
848         u32 init_cmdid;
849         u32 start_scan_cmdid;
850         u32 stop_scan_cmdid;
851         u32 scan_chan_list_cmdid;
852         u32 scan_sch_prio_tbl_cmdid;
853         u32 scan_prob_req_oui_cmdid;
854         u32 pdev_set_regdomain_cmdid;
855         u32 pdev_set_channel_cmdid;
856         u32 pdev_set_param_cmdid;
857         u32 pdev_pktlog_enable_cmdid;
858         u32 pdev_pktlog_disable_cmdid;
859         u32 pdev_set_wmm_params_cmdid;
860         u32 pdev_set_ht_cap_ie_cmdid;
861         u32 pdev_set_vht_cap_ie_cmdid;
862         u32 pdev_set_dscp_tid_map_cmdid;
863         u32 pdev_set_quiet_mode_cmdid;
864         u32 pdev_green_ap_ps_enable_cmdid;
865         u32 pdev_get_tpc_config_cmdid;
866         u32 pdev_set_base_macaddr_cmdid;
867         u32 vdev_create_cmdid;
868         u32 vdev_delete_cmdid;
869         u32 vdev_start_request_cmdid;
870         u32 vdev_restart_request_cmdid;
871         u32 vdev_up_cmdid;
872         u32 vdev_stop_cmdid;
873         u32 vdev_down_cmdid;
874         u32 vdev_set_param_cmdid;
875         u32 vdev_install_key_cmdid;
876         u32 peer_create_cmdid;
877         u32 peer_delete_cmdid;
878         u32 peer_flush_tids_cmdid;
879         u32 peer_set_param_cmdid;
880         u32 peer_assoc_cmdid;
881         u32 peer_add_wds_entry_cmdid;
882         u32 peer_remove_wds_entry_cmdid;
883         u32 peer_mcast_group_cmdid;
884         u32 bcn_tx_cmdid;
885         u32 pdev_send_bcn_cmdid;
886         u32 bcn_tmpl_cmdid;
887         u32 bcn_filter_rx_cmdid;
888         u32 prb_req_filter_rx_cmdid;
889         u32 mgmt_tx_cmdid;
890         u32 mgmt_tx_send_cmdid;
891         u32 prb_tmpl_cmdid;
892         u32 addba_clear_resp_cmdid;
893         u32 addba_send_cmdid;
894         u32 addba_status_cmdid;
895         u32 delba_send_cmdid;
896         u32 addba_set_resp_cmdid;
897         u32 send_singleamsdu_cmdid;
898         u32 sta_powersave_mode_cmdid;
899         u32 sta_powersave_param_cmdid;
900         u32 sta_mimo_ps_mode_cmdid;
901         u32 pdev_dfs_enable_cmdid;
902         u32 pdev_dfs_disable_cmdid;
903         u32 roam_scan_mode;
904         u32 roam_scan_rssi_threshold;
905         u32 roam_scan_period;
906         u32 roam_scan_rssi_change_threshold;
907         u32 roam_ap_profile;
908         u32 ofl_scan_add_ap_profile;
909         u32 ofl_scan_remove_ap_profile;
910         u32 ofl_scan_period;
911         u32 p2p_dev_set_device_info;
912         u32 p2p_dev_set_discoverability;
913         u32 p2p_go_set_beacon_ie;
914         u32 p2p_go_set_probe_resp_ie;
915         u32 p2p_set_vendor_ie_data_cmdid;
916         u32 ap_ps_peer_param_cmdid;
917         u32 ap_ps_peer_uapsd_coex_cmdid;
918         u32 peer_rate_retry_sched_cmdid;
919         u32 wlan_profile_trigger_cmdid;
920         u32 wlan_profile_set_hist_intvl_cmdid;
921         u32 wlan_profile_get_profile_data_cmdid;
922         u32 wlan_profile_enable_profile_id_cmdid;
923         u32 wlan_profile_list_profile_id_cmdid;
924         u32 pdev_suspend_cmdid;
925         u32 pdev_resume_cmdid;
926         u32 add_bcn_filter_cmdid;
927         u32 rmv_bcn_filter_cmdid;
928         u32 wow_add_wake_pattern_cmdid;
929         u32 wow_del_wake_pattern_cmdid;
930         u32 wow_enable_disable_wake_event_cmdid;
931         u32 wow_enable_cmdid;
932         u32 wow_hostwakeup_from_sleep_cmdid;
933         u32 rtt_measreq_cmdid;
934         u32 rtt_tsf_cmdid;
935         u32 vdev_spectral_scan_configure_cmdid;
936         u32 vdev_spectral_scan_enable_cmdid;
937         u32 request_stats_cmdid;
938         u32 set_arp_ns_offload_cmdid;
939         u32 network_list_offload_config_cmdid;
940         u32 gtk_offload_cmdid;
941         u32 csa_offload_enable_cmdid;
942         u32 csa_offload_chanswitch_cmdid;
943         u32 chatter_set_mode_cmdid;
944         u32 peer_tid_addba_cmdid;
945         u32 peer_tid_delba_cmdid;
946         u32 sta_dtim_ps_method_cmdid;
947         u32 sta_uapsd_auto_trig_cmdid;
948         u32 sta_keepalive_cmd;
949         u32 echo_cmdid;
950         u32 pdev_utf_cmdid;
951         u32 dbglog_cfg_cmdid;
952         u32 pdev_qvit_cmdid;
953         u32 pdev_ftm_intg_cmdid;
954         u32 vdev_set_keepalive_cmdid;
955         u32 vdev_get_keepalive_cmdid;
956         u32 force_fw_hang_cmdid;
957         u32 gpio_config_cmdid;
958         u32 gpio_output_cmdid;
959         u32 pdev_get_temperature_cmdid;
960         u32 vdev_set_wmm_params_cmdid;
961         u32 tdls_set_state_cmdid;
962         u32 tdls_peer_update_cmdid;
963         u32 adaptive_qcs_cmdid;
964         u32 scan_update_request_cmdid;
965         u32 vdev_standby_response_cmdid;
966         u32 vdev_resume_response_cmdid;
967         u32 wlan_peer_caching_add_peer_cmdid;
968         u32 wlan_peer_caching_evict_peer_cmdid;
969         u32 wlan_peer_caching_restore_peer_cmdid;
970         u32 wlan_peer_caching_print_all_peers_info_cmdid;
971         u32 peer_update_wds_entry_cmdid;
972         u32 peer_add_proxy_sta_entry_cmdid;
973         u32 rtt_keepalive_cmdid;
974         u32 oem_req_cmdid;
975         u32 nan_cmdid;
976         u32 vdev_ratemask_cmdid;
977         u32 qboost_cfg_cmdid;
978         u32 pdev_smart_ant_enable_cmdid;
979         u32 pdev_smart_ant_set_rx_antenna_cmdid;
980         u32 peer_smart_ant_set_tx_antenna_cmdid;
981         u32 peer_smart_ant_set_train_info_cmdid;
982         u32 peer_smart_ant_set_node_config_ops_cmdid;
983         u32 pdev_set_antenna_switch_table_cmdid;
984         u32 pdev_set_ctl_table_cmdid;
985         u32 pdev_set_mimogain_table_cmdid;
986         u32 pdev_ratepwr_table_cmdid;
987         u32 pdev_ratepwr_chainmsk_table_cmdid;
988         u32 pdev_fips_cmdid;
989         u32 tt_set_conf_cmdid;
990         u32 fwtest_cmdid;
991         u32 vdev_atf_request_cmdid;
992         u32 peer_atf_request_cmdid;
993         u32 pdev_get_ani_cck_config_cmdid;
994         u32 pdev_get_ani_ofdm_config_cmdid;
995         u32 pdev_reserve_ast_entry_cmdid;
996         u32 pdev_get_nfcal_power_cmdid;
997         u32 pdev_get_tpc_cmdid;
998         u32 pdev_get_ast_info_cmdid;
999         u32 vdev_set_dscp_tid_map_cmdid;
1000         u32 pdev_get_info_cmdid;
1001         u32 vdev_get_info_cmdid;
1002         u32 vdev_filter_neighbor_rx_packets_cmdid;
1003         u32 mu_cal_start_cmdid;
1004         u32 set_cca_params_cmdid;
1005         u32 pdev_bss_chan_info_request_cmdid;
1006         u32 pdev_enable_adaptive_cca_cmdid;
1007         u32 ext_resource_cfg_cmdid;
1008         u32 vdev_set_ie_cmdid;
1009         u32 set_lteu_config_cmdid;
1010         u32 atf_ssid_grouping_request_cmdid;
1011         u32 peer_atf_ext_request_cmdid;
1012         u32 set_periodic_channel_stats_cfg_cmdid;
1013         u32 peer_bwf_request_cmdid;
1014         u32 btcoex_cfg_cmdid;
1015         u32 peer_tx_mu_txmit_count_cmdid;
1016         u32 peer_tx_mu_txmit_rstcnt_cmdid;
1017         u32 peer_gid_userpos_list_cmdid;
1018         u32 pdev_check_cal_version_cmdid;
1019         u32 coex_version_cfg_cmid;
1020         u32 pdev_get_rx_filter_cmdid;
1021         u32 pdev_extended_nss_cfg_cmdid;
1022         u32 vdev_set_scan_nac_rssi_cmdid;
1023         u32 prog_gpio_band_select_cmdid;
1024         u32 config_smart_logging_cmdid;
1025         u32 debug_fatal_condition_cmdid;
1026         u32 get_tsf_timer_cmdid;
1027         u32 pdev_get_tpc_table_cmdid;
1028         u32 vdev_sifs_trigger_time_cmdid;
1029         u32 pdev_wds_entry_list_cmdid;
1030         u32 tdls_set_offchan_mode_cmdid;
1031         u32 radar_found_cmdid;
1032         u32 set_bb_timing_cmdid;
1033 };
1034
1035 /*
1036  * wmi command groups.
1037  */
1038 enum wmi_cmd_group {
1039         /* 0 to 2 are reserved */
1040         WMI_GRP_START = 0x3,
1041         WMI_GRP_SCAN = WMI_GRP_START,
1042         WMI_GRP_PDEV,
1043         WMI_GRP_VDEV,
1044         WMI_GRP_PEER,
1045         WMI_GRP_MGMT,
1046         WMI_GRP_BA_NEG,
1047         WMI_GRP_STA_PS,
1048         WMI_GRP_DFS,
1049         WMI_GRP_ROAM,
1050         WMI_GRP_OFL_SCAN,
1051         WMI_GRP_P2P,
1052         WMI_GRP_AP_PS,
1053         WMI_GRP_RATE_CTRL,
1054         WMI_GRP_PROFILE,
1055         WMI_GRP_SUSPEND,
1056         WMI_GRP_BCN_FILTER,
1057         WMI_GRP_WOW,
1058         WMI_GRP_RTT,
1059         WMI_GRP_SPECTRAL,
1060         WMI_GRP_STATS,
1061         WMI_GRP_ARP_NS_OFL,
1062         WMI_GRP_NLO_OFL,
1063         WMI_GRP_GTK_OFL,
1064         WMI_GRP_CSA_OFL,
1065         WMI_GRP_CHATTER,
1066         WMI_GRP_TID_ADDBA,
1067         WMI_GRP_MISC,
1068         WMI_GRP_GPIO,
1069 };
1070
1071 #define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
1072 #define WMI_EVT_GRP_START_ID(grp_id) (((grp_id) << 12) | 0x1)
1073
1074 #define WMI_CMD_UNSUPPORTED 0
1075
1076 /* Command IDs and command events for MAIN FW. */
1077 enum wmi_cmd_id {
1078         WMI_INIT_CMDID = 0x1,
1079
1080         /* Scan specific commands */
1081         WMI_START_SCAN_CMDID = WMI_CMD_GRP(WMI_GRP_SCAN),
1082         WMI_STOP_SCAN_CMDID,
1083         WMI_SCAN_CHAN_LIST_CMDID,
1084         WMI_SCAN_SCH_PRIO_TBL_CMDID,
1085
1086         /* PDEV (physical device) specific commands */
1087         WMI_PDEV_SET_REGDOMAIN_CMDID = WMI_CMD_GRP(WMI_GRP_PDEV),
1088         WMI_PDEV_SET_CHANNEL_CMDID,
1089         WMI_PDEV_SET_PARAM_CMDID,
1090         WMI_PDEV_PKTLOG_ENABLE_CMDID,
1091         WMI_PDEV_PKTLOG_DISABLE_CMDID,
1092         WMI_PDEV_SET_WMM_PARAMS_CMDID,
1093         WMI_PDEV_SET_HT_CAP_IE_CMDID,
1094         WMI_PDEV_SET_VHT_CAP_IE_CMDID,
1095         WMI_PDEV_SET_DSCP_TID_MAP_CMDID,
1096         WMI_PDEV_SET_QUIET_MODE_CMDID,
1097         WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID,
1098         WMI_PDEV_GET_TPC_CONFIG_CMDID,
1099         WMI_PDEV_SET_BASE_MACADDR_CMDID,
1100
1101         /* VDEV (virtual device) specific commands */
1102         WMI_VDEV_CREATE_CMDID = WMI_CMD_GRP(WMI_GRP_VDEV),
1103         WMI_VDEV_DELETE_CMDID,
1104         WMI_VDEV_START_REQUEST_CMDID,
1105         WMI_VDEV_RESTART_REQUEST_CMDID,
1106         WMI_VDEV_UP_CMDID,
1107         WMI_VDEV_STOP_CMDID,
1108         WMI_VDEV_DOWN_CMDID,
1109         WMI_VDEV_SET_PARAM_CMDID,
1110         WMI_VDEV_INSTALL_KEY_CMDID,
1111
1112         /* peer specific commands */
1113         WMI_PEER_CREATE_CMDID = WMI_CMD_GRP(WMI_GRP_PEER),
1114         WMI_PEER_DELETE_CMDID,
1115         WMI_PEER_FLUSH_TIDS_CMDID,
1116         WMI_PEER_SET_PARAM_CMDID,
1117         WMI_PEER_ASSOC_CMDID,
1118         WMI_PEER_ADD_WDS_ENTRY_CMDID,
1119         WMI_PEER_REMOVE_WDS_ENTRY_CMDID,
1120         WMI_PEER_MCAST_GROUP_CMDID,
1121
1122         /* beacon/management specific commands */
1123         WMI_BCN_TX_CMDID = WMI_CMD_GRP(WMI_GRP_MGMT),
1124         WMI_PDEV_SEND_BCN_CMDID,
1125         WMI_BCN_TMPL_CMDID,
1126         WMI_BCN_FILTER_RX_CMDID,
1127         WMI_PRB_REQ_FILTER_RX_CMDID,
1128         WMI_MGMT_TX_CMDID,
1129         WMI_PRB_TMPL_CMDID,
1130
1131         /* commands to directly control BA negotiation directly from host. */
1132         WMI_ADDBA_CLEAR_RESP_CMDID = WMI_CMD_GRP(WMI_GRP_BA_NEG),
1133         WMI_ADDBA_SEND_CMDID,
1134         WMI_ADDBA_STATUS_CMDID,
1135         WMI_DELBA_SEND_CMDID,
1136         WMI_ADDBA_SET_RESP_CMDID,
1137         WMI_SEND_SINGLEAMSDU_CMDID,
1138
1139         /* Station power save specific config */
1140         WMI_STA_POWERSAVE_MODE_CMDID = WMI_CMD_GRP(WMI_GRP_STA_PS),
1141         WMI_STA_POWERSAVE_PARAM_CMDID,
1142         WMI_STA_MIMO_PS_MODE_CMDID,
1143
1144         /** DFS-specific commands */
1145         WMI_PDEV_DFS_ENABLE_CMDID = WMI_CMD_GRP(WMI_GRP_DFS),
1146         WMI_PDEV_DFS_DISABLE_CMDID,
1147
1148         /* Roaming specific  commands */
1149         WMI_ROAM_SCAN_MODE = WMI_CMD_GRP(WMI_GRP_ROAM),
1150         WMI_ROAM_SCAN_RSSI_THRESHOLD,
1151         WMI_ROAM_SCAN_PERIOD,
1152         WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
1153         WMI_ROAM_AP_PROFILE,
1154
1155         /* offload scan specific commands */
1156         WMI_OFL_SCAN_ADD_AP_PROFILE = WMI_CMD_GRP(WMI_GRP_OFL_SCAN),
1157         WMI_OFL_SCAN_REMOVE_AP_PROFILE,
1158         WMI_OFL_SCAN_PERIOD,
1159
1160         /* P2P specific commands */
1161         WMI_P2P_DEV_SET_DEVICE_INFO = WMI_CMD_GRP(WMI_GRP_P2P),
1162         WMI_P2P_DEV_SET_DISCOVERABILITY,
1163         WMI_P2P_GO_SET_BEACON_IE,
1164         WMI_P2P_GO_SET_PROBE_RESP_IE,
1165         WMI_P2P_SET_VENDOR_IE_DATA_CMDID,
1166
1167         /* AP power save specific config */
1168         WMI_AP_PS_PEER_PARAM_CMDID = WMI_CMD_GRP(WMI_GRP_AP_PS),
1169         WMI_AP_PS_PEER_UAPSD_COEX_CMDID,
1170
1171         /* Rate-control specific commands */
1172         WMI_PEER_RATE_RETRY_SCHED_CMDID =
1173         WMI_CMD_GRP(WMI_GRP_RATE_CTRL),
1174
1175         /* WLAN Profiling commands. */
1176         WMI_WLAN_PROFILE_TRIGGER_CMDID = WMI_CMD_GRP(WMI_GRP_PROFILE),
1177         WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
1178         WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
1179         WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
1180         WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
1181
1182         /* Suspend resume command Ids */
1183         WMI_PDEV_SUSPEND_CMDID = WMI_CMD_GRP(WMI_GRP_SUSPEND),
1184         WMI_PDEV_RESUME_CMDID,
1185
1186         /* Beacon filter commands */
1187         WMI_ADD_BCN_FILTER_CMDID = WMI_CMD_GRP(WMI_GRP_BCN_FILTER),
1188         WMI_RMV_BCN_FILTER_CMDID,
1189
1190         /* WOW Specific WMI commands*/
1191         WMI_WOW_ADD_WAKE_PATTERN_CMDID = WMI_CMD_GRP(WMI_GRP_WOW),
1192         WMI_WOW_DEL_WAKE_PATTERN_CMDID,
1193         WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
1194         WMI_WOW_ENABLE_CMDID,
1195         WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
1196
1197         /* RTT measurement related cmd */
1198         WMI_RTT_MEASREQ_CMDID = WMI_CMD_GRP(WMI_GRP_RTT),
1199         WMI_RTT_TSF_CMDID,
1200
1201         /* spectral scan commands */
1202         WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID = WMI_CMD_GRP(WMI_GRP_SPECTRAL),
1203         WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
1204
1205         /* F/W stats */
1206         WMI_REQUEST_STATS_CMDID = WMI_CMD_GRP(WMI_GRP_STATS),
1207
1208         /* ARP OFFLOAD REQUEST*/
1209         WMI_SET_ARP_NS_OFFLOAD_CMDID = WMI_CMD_GRP(WMI_GRP_ARP_NS_OFL),
1210
1211         /* NS offload confid*/
1212         WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID = WMI_CMD_GRP(WMI_GRP_NLO_OFL),
1213
1214         /* GTK offload Specific WMI commands*/
1215         WMI_GTK_OFFLOAD_CMDID = WMI_CMD_GRP(WMI_GRP_GTK_OFL),
1216
1217         /* CSA offload Specific WMI commands*/
1218         WMI_CSA_OFFLOAD_ENABLE_CMDID = WMI_CMD_GRP(WMI_GRP_CSA_OFL),
1219         WMI_CSA_OFFLOAD_CHANSWITCH_CMDID,
1220
1221         /* Chatter commands*/
1222         WMI_CHATTER_SET_MODE_CMDID = WMI_CMD_GRP(WMI_GRP_CHATTER),
1223
1224         /* addba specific commands */
1225         WMI_PEER_TID_ADDBA_CMDID = WMI_CMD_GRP(WMI_GRP_TID_ADDBA),
1226         WMI_PEER_TID_DELBA_CMDID,
1227
1228         /* set station mimo powersave method */
1229         WMI_STA_DTIM_PS_METHOD_CMDID,
1230         /* Configure the Station UAPSD AC Auto Trigger Parameters */
1231         WMI_STA_UAPSD_AUTO_TRIG_CMDID,
1232
1233         /* STA Keep alive parameter configuration,
1234          * Requires WMI_SERVICE_STA_KEEP_ALIVE
1235          */
1236         WMI_STA_KEEPALIVE_CMD,
1237
1238         /* misc command group */
1239         WMI_ECHO_CMDID = WMI_CMD_GRP(WMI_GRP_MISC),
1240         WMI_PDEV_UTF_CMDID,
1241         WMI_DBGLOG_CFG_CMDID,
1242         WMI_PDEV_QVIT_CMDID,
1243         WMI_PDEV_FTM_INTG_CMDID,
1244         WMI_VDEV_SET_KEEPALIVE_CMDID,
1245         WMI_VDEV_GET_KEEPALIVE_CMDID,
1246         WMI_FORCE_FW_HANG_CMDID,
1247
1248         /* GPIO Configuration */
1249         WMI_GPIO_CONFIG_CMDID = WMI_CMD_GRP(WMI_GRP_GPIO),
1250         WMI_GPIO_OUTPUT_CMDID,
1251 };
1252
1253 enum wmi_event_id {
1254         WMI_SERVICE_READY_EVENTID = 0x1,
1255         WMI_READY_EVENTID,
1256         WMI_SERVICE_AVAILABLE_EVENTID,
1257
1258         /* Scan specific events */
1259         WMI_SCAN_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_SCAN),
1260
1261         /* PDEV specific events */
1262         WMI_PDEV_TPC_CONFIG_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_PDEV),
1263         WMI_CHAN_INFO_EVENTID,
1264         WMI_PHYERR_EVENTID,
1265
1266         /* VDEV specific events */
1267         WMI_VDEV_START_RESP_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_VDEV),
1268         WMI_VDEV_STOPPED_EVENTID,
1269         WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID,
1270
1271         /* peer specific events */
1272         WMI_PEER_STA_KICKOUT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_PEER),
1273
1274         /* beacon/mgmt specific events */
1275         WMI_MGMT_RX_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_MGMT),
1276         WMI_HOST_SWBA_EVENTID,
1277         WMI_TBTTOFFSET_UPDATE_EVENTID,
1278
1279         /* ADDBA Related WMI Events*/
1280         WMI_TX_DELBA_COMPLETE_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_BA_NEG),
1281         WMI_TX_ADDBA_COMPLETE_EVENTID,
1282
1283         /* Roam event to trigger roaming on host */
1284         WMI_ROAM_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_ROAM),
1285         WMI_PROFILE_MATCH,
1286
1287         /* WoW */
1288         WMI_WOW_WAKEUP_HOST_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_WOW),
1289
1290         /* RTT */
1291         WMI_RTT_MEASUREMENT_REPORT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_RTT),
1292         WMI_TSF_MEASUREMENT_REPORT_EVENTID,
1293         WMI_RTT_ERROR_REPORT_EVENTID,
1294
1295         /* GTK offload */
1296         WMI_GTK_OFFLOAD_STATUS_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_GTK_OFL),
1297         WMI_GTK_REKEY_FAIL_EVENTID,
1298
1299         /* CSA IE received event */
1300         WMI_CSA_HANDLING_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_CSA_OFL),
1301
1302         /* Misc events */
1303         WMI_ECHO_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_MISC),
1304         WMI_PDEV_UTF_EVENTID,
1305         WMI_DEBUG_MESG_EVENTID,
1306         WMI_UPDATE_STATS_EVENTID,
1307         WMI_DEBUG_PRINT_EVENTID,
1308         WMI_DCS_INTERFERENCE_EVENTID,
1309         WMI_PDEV_QVIT_EVENTID,
1310         WMI_WLAN_PROFILE_DATA_EVENTID,
1311         WMI_PDEV_FTM_INTG_EVENTID,
1312         WMI_WLAN_FREQ_AVOID_EVENTID,
1313         WMI_VDEV_GET_KEEPALIVE_EVENTID,
1314
1315         /* GPIO Event */
1316         WMI_GPIO_INPUT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_GPIO),
1317 };
1318
1319 /* Command IDs and command events for 10.X firmware */
1320 enum wmi_10x_cmd_id {
1321         WMI_10X_START_CMDID = 0x9000,
1322         WMI_10X_END_CMDID = 0x9FFF,
1323
1324         /* initialize the wlan sub system */
1325         WMI_10X_INIT_CMDID,
1326
1327         /* Scan specific commands */
1328
1329         WMI_10X_START_SCAN_CMDID = WMI_10X_START_CMDID,
1330         WMI_10X_STOP_SCAN_CMDID,
1331         WMI_10X_SCAN_CHAN_LIST_CMDID,
1332         WMI_10X_ECHO_CMDID,
1333
1334         /* PDEV(physical device) specific commands */
1335         WMI_10X_PDEV_SET_REGDOMAIN_CMDID,
1336         WMI_10X_PDEV_SET_CHANNEL_CMDID,
1337         WMI_10X_PDEV_SET_PARAM_CMDID,
1338         WMI_10X_PDEV_PKTLOG_ENABLE_CMDID,
1339         WMI_10X_PDEV_PKTLOG_DISABLE_CMDID,
1340         WMI_10X_PDEV_SET_WMM_PARAMS_CMDID,
1341         WMI_10X_PDEV_SET_HT_CAP_IE_CMDID,
1342         WMI_10X_PDEV_SET_VHT_CAP_IE_CMDID,
1343         WMI_10X_PDEV_SET_BASE_MACADDR_CMDID,
1344         WMI_10X_PDEV_SET_DSCP_TID_MAP_CMDID,
1345         WMI_10X_PDEV_SET_QUIET_MODE_CMDID,
1346         WMI_10X_PDEV_GREEN_AP_PS_ENABLE_CMDID,
1347         WMI_10X_PDEV_GET_TPC_CONFIG_CMDID,
1348
1349         /* VDEV(virtual device) specific commands */
1350         WMI_10X_VDEV_CREATE_CMDID,
1351         WMI_10X_VDEV_DELETE_CMDID,
1352         WMI_10X_VDEV_START_REQUEST_CMDID,
1353         WMI_10X_VDEV_RESTART_REQUEST_CMDID,
1354         WMI_10X_VDEV_UP_CMDID,
1355         WMI_10X_VDEV_STOP_CMDID,
1356         WMI_10X_VDEV_DOWN_CMDID,
1357         WMI_10X_VDEV_STANDBY_RESPONSE_CMDID,
1358         WMI_10X_VDEV_RESUME_RESPONSE_CMDID,
1359         WMI_10X_VDEV_SET_PARAM_CMDID,
1360         WMI_10X_VDEV_INSTALL_KEY_CMDID,
1361
1362         /* peer specific commands */
1363         WMI_10X_PEER_CREATE_CMDID,
1364         WMI_10X_PEER_DELETE_CMDID,
1365         WMI_10X_PEER_FLUSH_TIDS_CMDID,
1366         WMI_10X_PEER_SET_PARAM_CMDID,
1367         WMI_10X_PEER_ASSOC_CMDID,
1368         WMI_10X_PEER_ADD_WDS_ENTRY_CMDID,
1369         WMI_10X_PEER_REMOVE_WDS_ENTRY_CMDID,
1370         WMI_10X_PEER_MCAST_GROUP_CMDID,
1371
1372         /* beacon/management specific commands */
1373
1374         WMI_10X_BCN_TX_CMDID,
1375         WMI_10X_BCN_PRB_TMPL_CMDID,
1376         WMI_10X_BCN_FILTER_RX_CMDID,
1377         WMI_10X_PRB_REQ_FILTER_RX_CMDID,
1378         WMI_10X_MGMT_TX_CMDID,
1379
1380         /* commands to directly control ba negotiation directly from host. */
1381         WMI_10X_ADDBA_CLEAR_RESP_CMDID,
1382         WMI_10X_ADDBA_SEND_CMDID,
1383         WMI_10X_ADDBA_STATUS_CMDID,
1384         WMI_10X_DELBA_SEND_CMDID,
1385         WMI_10X_ADDBA_SET_RESP_CMDID,
1386         WMI_10X_SEND_SINGLEAMSDU_CMDID,
1387
1388         /* Station power save specific config */
1389         WMI_10X_STA_POWERSAVE_MODE_CMDID,
1390         WMI_10X_STA_POWERSAVE_PARAM_CMDID,
1391         WMI_10X_STA_MIMO_PS_MODE_CMDID,
1392
1393         /* set debug log config */
1394         WMI_10X_DBGLOG_CFG_CMDID,
1395
1396         /* DFS-specific commands */
1397         WMI_10X_PDEV_DFS_ENABLE_CMDID,
1398         WMI_10X_PDEV_DFS_DISABLE_CMDID,
1399
1400         /* QVIT specific command id */
1401         WMI_10X_PDEV_QVIT_CMDID,
1402
1403         /* Offload Scan and Roaming related  commands */
1404         WMI_10X_ROAM_SCAN_MODE,
1405         WMI_10X_ROAM_SCAN_RSSI_THRESHOLD,
1406         WMI_10X_ROAM_SCAN_PERIOD,
1407         WMI_10X_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
1408         WMI_10X_ROAM_AP_PROFILE,
1409         WMI_10X_OFL_SCAN_ADD_AP_PROFILE,
1410         WMI_10X_OFL_SCAN_REMOVE_AP_PROFILE,
1411         WMI_10X_OFL_SCAN_PERIOD,
1412
1413         /* P2P specific commands */
1414         WMI_10X_P2P_DEV_SET_DEVICE_INFO,
1415         WMI_10X_P2P_DEV_SET_DISCOVERABILITY,
1416         WMI_10X_P2P_GO_SET_BEACON_IE,
1417         WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
1418
1419         /* AP power save specific config */
1420         WMI_10X_AP_PS_PEER_PARAM_CMDID,
1421         WMI_10X_AP_PS_PEER_UAPSD_COEX_CMDID,
1422
1423         /* Rate-control specific commands */
1424         WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
1425
1426         /* WLAN Profiling commands. */
1427         WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
1428         WMI_10X_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
1429         WMI_10X_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
1430         WMI_10X_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
1431         WMI_10X_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
1432
1433         /* Suspend resume command Ids */
1434         WMI_10X_PDEV_SUSPEND_CMDID,
1435         WMI_10X_PDEV_RESUME_CMDID,
1436
1437         /* Beacon filter commands */
1438         WMI_10X_ADD_BCN_FILTER_CMDID,
1439         WMI_10X_RMV_BCN_FILTER_CMDID,
1440
1441         /* WOW Specific WMI commands*/
1442         WMI_10X_WOW_ADD_WAKE_PATTERN_CMDID,
1443         WMI_10X_WOW_DEL_WAKE_PATTERN_CMDID,
1444         WMI_10X_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
1445         WMI_10X_WOW_ENABLE_CMDID,
1446         WMI_10X_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
1447
1448         /* RTT measurement related cmd */
1449         WMI_10X_RTT_MEASREQ_CMDID,
1450         WMI_10X_RTT_TSF_CMDID,
1451
1452         /* transmit beacon by value */
1453         WMI_10X_PDEV_SEND_BCN_CMDID,
1454
1455         /* F/W stats */
1456         WMI_10X_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
1457         WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
1458         WMI_10X_REQUEST_STATS_CMDID,
1459
1460         /* GPIO Configuration */
1461         WMI_10X_GPIO_CONFIG_CMDID,
1462         WMI_10X_GPIO_OUTPUT_CMDID,
1463
1464         WMI_10X_PDEV_UTF_CMDID = WMI_10X_END_CMDID - 1,
1465 };
1466
1467 enum wmi_10x_event_id {
1468         WMI_10X_SERVICE_READY_EVENTID = 0x8000,
1469         WMI_10X_READY_EVENTID,
1470         WMI_10X_START_EVENTID = 0x9000,
1471         WMI_10X_END_EVENTID = 0x9FFF,
1472
1473         /* Scan specific events */
1474         WMI_10X_SCAN_EVENTID = WMI_10X_START_EVENTID,
1475         WMI_10X_ECHO_EVENTID,
1476         WMI_10X_DEBUG_MESG_EVENTID,
1477         WMI_10X_UPDATE_STATS_EVENTID,
1478
1479         /* Instantaneous RSSI event */
1480         WMI_10X_INST_RSSI_STATS_EVENTID,
1481
1482         /* VDEV specific events */
1483         WMI_10X_VDEV_START_RESP_EVENTID,
1484         WMI_10X_VDEV_STANDBY_REQ_EVENTID,
1485         WMI_10X_VDEV_RESUME_REQ_EVENTID,
1486         WMI_10X_VDEV_STOPPED_EVENTID,
1487
1488         /* peer  specific events */
1489         WMI_10X_PEER_STA_KICKOUT_EVENTID,
1490
1491         /* beacon/mgmt specific events */
1492         WMI_10X_HOST_SWBA_EVENTID,
1493         WMI_10X_TBTTOFFSET_UPDATE_EVENTID,
1494         WMI_10X_MGMT_RX_EVENTID,
1495
1496         /* Channel stats event */
1497         WMI_10X_CHAN_INFO_EVENTID,
1498
1499         /* PHY Error specific WMI event */
1500         WMI_10X_PHYERR_EVENTID,
1501
1502         /* Roam event to trigger roaming on host */
1503         WMI_10X_ROAM_EVENTID,
1504
1505         /* matching AP found from list of profiles */
1506         WMI_10X_PROFILE_MATCH,
1507
1508         /* debug print message used for tracing FW code while debugging */
1509         WMI_10X_DEBUG_PRINT_EVENTID,
1510         /* VI spoecific event */
1511         WMI_10X_PDEV_QVIT_EVENTID,
1512         /* FW code profile data in response to profile request */
1513         WMI_10X_WLAN_PROFILE_DATA_EVENTID,
1514
1515         /*RTT related event ID*/
1516         WMI_10X_RTT_MEASUREMENT_REPORT_EVENTID,
1517         WMI_10X_TSF_MEASUREMENT_REPORT_EVENTID,
1518         WMI_10X_RTT_ERROR_REPORT_EVENTID,
1519
1520         WMI_10X_WOW_WAKEUP_HOST_EVENTID,
1521         WMI_10X_DCS_INTERFERENCE_EVENTID,
1522
1523         /* TPC config for the current operating channel */
1524         WMI_10X_PDEV_TPC_CONFIG_EVENTID,
1525
1526         WMI_10X_GPIO_INPUT_EVENTID,
1527         WMI_10X_PDEV_UTF_EVENTID = WMI_10X_END_EVENTID - 1,
1528 };
1529
1530 enum wmi_10_2_cmd_id {
1531         WMI_10_2_START_CMDID = 0x9000,
1532         WMI_10_2_END_CMDID = 0x9FFF,
1533         WMI_10_2_INIT_CMDID,
1534         WMI_10_2_START_SCAN_CMDID = WMI_10_2_START_CMDID,
1535         WMI_10_2_STOP_SCAN_CMDID,
1536         WMI_10_2_SCAN_CHAN_LIST_CMDID,
1537         WMI_10_2_ECHO_CMDID,
1538         WMI_10_2_PDEV_SET_REGDOMAIN_CMDID,
1539         WMI_10_2_PDEV_SET_CHANNEL_CMDID,
1540         WMI_10_2_PDEV_SET_PARAM_CMDID,
1541         WMI_10_2_PDEV_PKTLOG_ENABLE_CMDID,
1542         WMI_10_2_PDEV_PKTLOG_DISABLE_CMDID,
1543         WMI_10_2_PDEV_SET_WMM_PARAMS_CMDID,
1544         WMI_10_2_PDEV_SET_HT_CAP_IE_CMDID,
1545         WMI_10_2_PDEV_SET_VHT_CAP_IE_CMDID,
1546         WMI_10_2_PDEV_SET_BASE_MACADDR_CMDID,
1547         WMI_10_2_PDEV_SET_QUIET_MODE_CMDID,
1548         WMI_10_2_PDEV_GREEN_AP_PS_ENABLE_CMDID,
1549         WMI_10_2_PDEV_GET_TPC_CONFIG_CMDID,
1550         WMI_10_2_VDEV_CREATE_CMDID,
1551         WMI_10_2_VDEV_DELETE_CMDID,
1552         WMI_10_2_VDEV_START_REQUEST_CMDID,
1553         WMI_10_2_VDEV_RESTART_REQUEST_CMDID,
1554         WMI_10_2_VDEV_UP_CMDID,
1555         WMI_10_2_VDEV_STOP_CMDID,
1556         WMI_10_2_VDEV_DOWN_CMDID,
1557         WMI_10_2_VDEV_STANDBY_RESPONSE_CMDID,
1558         WMI_10_2_VDEV_RESUME_RESPONSE_CMDID,
1559         WMI_10_2_VDEV_SET_PARAM_CMDID,
1560         WMI_10_2_VDEV_INSTALL_KEY_CMDID,
1561         WMI_10_2_VDEV_SET_DSCP_TID_MAP_CMDID,
1562         WMI_10_2_PEER_CREATE_CMDID,
1563         WMI_10_2_PEER_DELETE_CMDID,
1564         WMI_10_2_PEER_FLUSH_TIDS_CMDID,
1565         WMI_10_2_PEER_SET_PARAM_CMDID,
1566         WMI_10_2_PEER_ASSOC_CMDID,
1567         WMI_10_2_PEER_ADD_WDS_ENTRY_CMDID,
1568         WMI_10_2_PEER_UPDATE_WDS_ENTRY_CMDID,
1569         WMI_10_2_PEER_REMOVE_WDS_ENTRY_CMDID,
1570         WMI_10_2_PEER_MCAST_GROUP_CMDID,
1571         WMI_10_2_BCN_TX_CMDID,
1572         WMI_10_2_BCN_PRB_TMPL_CMDID,
1573         WMI_10_2_BCN_FILTER_RX_CMDID,
1574         WMI_10_2_PRB_REQ_FILTER_RX_CMDID,
1575         WMI_10_2_MGMT_TX_CMDID,
1576         WMI_10_2_ADDBA_CLEAR_RESP_CMDID,
1577         WMI_10_2_ADDBA_SEND_CMDID,
1578         WMI_10_2_ADDBA_STATUS_CMDID,
1579         WMI_10_2_DELBA_SEND_CMDID,
1580         WMI_10_2_ADDBA_SET_RESP_CMDID,
1581         WMI_10_2_SEND_SINGLEAMSDU_CMDID,
1582         WMI_10_2_STA_POWERSAVE_MODE_CMDID,
1583         WMI_10_2_STA_POWERSAVE_PARAM_CMDID,
1584         WMI_10_2_STA_MIMO_PS_MODE_CMDID,
1585         WMI_10_2_DBGLOG_CFG_CMDID,
1586         WMI_10_2_PDEV_DFS_ENABLE_CMDID,
1587         WMI_10_2_PDEV_DFS_DISABLE_CMDID,
1588         WMI_10_2_PDEV_QVIT_CMDID,
1589         WMI_10_2_ROAM_SCAN_MODE,
1590         WMI_10_2_ROAM_SCAN_RSSI_THRESHOLD,
1591         WMI_10_2_ROAM_SCAN_PERIOD,
1592         WMI_10_2_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
1593         WMI_10_2_ROAM_AP_PROFILE,
1594         WMI_10_2_OFL_SCAN_ADD_AP_PROFILE,
1595         WMI_10_2_OFL_SCAN_REMOVE_AP_PROFILE,
1596         WMI_10_2_OFL_SCAN_PERIOD,
1597         WMI_10_2_P2P_DEV_SET_DEVICE_INFO,
1598         WMI_10_2_P2P_DEV_SET_DISCOVERABILITY,
1599         WMI_10_2_P2P_GO_SET_BEACON_IE,
1600         WMI_10_2_P2P_GO_SET_PROBE_RESP_IE,
1601         WMI_10_2_AP_PS_PEER_PARAM_CMDID,
1602         WMI_10_2_AP_PS_PEER_UAPSD_COEX_CMDID,
1603         WMI_10_2_PEER_RATE_RETRY_SCHED_CMDID,
1604         WMI_10_2_WLAN_PROFILE_TRIGGER_CMDID,
1605         WMI_10_2_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
1606         WMI_10_2_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
1607         WMI_10_2_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
1608         WMI_10_2_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
1609         WMI_10_2_PDEV_SUSPEND_CMDID,
1610         WMI_10_2_PDEV_RESUME_CMDID,
1611         WMI_10_2_ADD_BCN_FILTER_CMDID,
1612         WMI_10_2_RMV_BCN_FILTER_CMDID,
1613         WMI_10_2_WOW_ADD_WAKE_PATTERN_CMDID,
1614         WMI_10_2_WOW_DEL_WAKE_PATTERN_CMDID,
1615         WMI_10_2_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
1616         WMI_10_2_WOW_ENABLE_CMDID,
1617         WMI_10_2_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
1618         WMI_10_2_RTT_MEASREQ_CMDID,
1619         WMI_10_2_RTT_TSF_CMDID,
1620         WMI_10_2_RTT_KEEPALIVE_CMDID,
1621         WMI_10_2_PDEV_SEND_BCN_CMDID,
1622         WMI_10_2_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
1623         WMI_10_2_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
1624         WMI_10_2_REQUEST_STATS_CMDID,
1625         WMI_10_2_GPIO_CONFIG_CMDID,
1626         WMI_10_2_GPIO_OUTPUT_CMDID,
1627         WMI_10_2_VDEV_RATEMASK_CMDID,
1628         WMI_10_2_PDEV_SMART_ANT_ENABLE_CMDID,
1629         WMI_10_2_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID,
1630         WMI_10_2_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID,
1631         WMI_10_2_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID,
1632         WMI_10_2_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID,
1633         WMI_10_2_FORCE_FW_HANG_CMDID,
1634         WMI_10_2_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID,
1635         WMI_10_2_PDEV_SET_CTL_TABLE_CMDID,
1636         WMI_10_2_PDEV_SET_MIMOGAIN_TABLE_CMDID,
1637         WMI_10_2_PDEV_RATEPWR_TABLE_CMDID,
1638         WMI_10_2_PDEV_RATEPWR_CHAINMSK_TABLE_CMDID,
1639         WMI_10_2_PDEV_GET_INFO,
1640         WMI_10_2_VDEV_GET_INFO,
1641         WMI_10_2_VDEV_ATF_REQUEST_CMDID,
1642         WMI_10_2_PEER_ATF_REQUEST_CMDID,
1643         WMI_10_2_PDEV_GET_TEMPERATURE_CMDID,
1644         WMI_10_2_MU_CAL_START_CMDID,
1645         WMI_10_2_SET_LTEU_CONFIG_CMDID,
1646         WMI_10_2_SET_CCA_PARAMS,
1647         WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
1648         WMI_10_2_FWTEST_CMDID,
1649         WMI_10_2_PDEV_SET_BB_TIMING_CONFIG_CMDID,
1650         WMI_10_2_PDEV_UTF_CMDID = WMI_10_2_END_CMDID - 1,
1651 };
1652
1653 enum wmi_10_2_event_id {
1654         WMI_10_2_SERVICE_READY_EVENTID = 0x8000,
1655         WMI_10_2_READY_EVENTID,
1656         WMI_10_2_DEBUG_MESG_EVENTID,
1657         WMI_10_2_START_EVENTID = 0x9000,
1658         WMI_10_2_END_EVENTID = 0x9FFF,
1659         WMI_10_2_SCAN_EVENTID = WMI_10_2_START_EVENTID,
1660         WMI_10_2_ECHO_EVENTID,
1661         WMI_10_2_UPDATE_STATS_EVENTID,
1662         WMI_10_2_INST_RSSI_STATS_EVENTID,
1663         WMI_10_2_VDEV_START_RESP_EVENTID,
1664         WMI_10_2_VDEV_STANDBY_REQ_EVENTID,
1665         WMI_10_2_VDEV_RESUME_REQ_EVENTID,
1666         WMI_10_2_VDEV_STOPPED_EVENTID,
1667         WMI_10_2_PEER_STA_KICKOUT_EVENTID,
1668         WMI_10_2_HOST_SWBA_EVENTID,
1669         WMI_10_2_TBTTOFFSET_UPDATE_EVENTID,
1670         WMI_10_2_MGMT_RX_EVENTID,
1671         WMI_10_2_CHAN_INFO_EVENTID,
1672         WMI_10_2_PHYERR_EVENTID,
1673         WMI_10_2_ROAM_EVENTID,
1674         WMI_10_2_PROFILE_MATCH,
1675         WMI_10_2_DEBUG_PRINT_EVENTID,
1676         WMI_10_2_PDEV_QVIT_EVENTID,
1677         WMI_10_2_WLAN_PROFILE_DATA_EVENTID,
1678         WMI_10_2_RTT_MEASUREMENT_REPORT_EVENTID,
1679         WMI_10_2_TSF_MEASUREMENT_REPORT_EVENTID,
1680         WMI_10_2_RTT_ERROR_REPORT_EVENTID,
1681         WMI_10_2_RTT_KEEPALIVE_EVENTID,
1682         WMI_10_2_WOW_WAKEUP_HOST_EVENTID,
1683         WMI_10_2_DCS_INTERFERENCE_EVENTID,
1684         WMI_10_2_PDEV_TPC_CONFIG_EVENTID,
1685         WMI_10_2_GPIO_INPUT_EVENTID,
1686         WMI_10_2_PEER_RATECODE_LIST_EVENTID,
1687         WMI_10_2_GENERIC_BUFFER_EVENTID,
1688         WMI_10_2_MCAST_BUF_RELEASE_EVENTID,
1689         WMI_10_2_MCAST_LIST_AGEOUT_EVENTID,
1690         WMI_10_2_WDS_PEER_EVENTID,
1691         WMI_10_2_PEER_STA_PS_STATECHG_EVENTID,
1692         WMI_10_2_PDEV_TEMPERATURE_EVENTID,
1693         WMI_10_2_MU_REPORT_EVENTID,
1694         WMI_10_2_PDEV_BSS_CHAN_INFO_EVENTID,
1695         WMI_10_2_PDEV_UTF_EVENTID = WMI_10_2_END_EVENTID - 1,
1696 };
1697
1698 enum wmi_10_4_cmd_id {
1699         WMI_10_4_START_CMDID = 0x9000,
1700         WMI_10_4_END_CMDID = 0x9FFF,
1701         WMI_10_4_INIT_CMDID,
1702         WMI_10_4_START_SCAN_CMDID = WMI_10_4_START_CMDID,
1703         WMI_10_4_STOP_SCAN_CMDID,
1704         WMI_10_4_SCAN_CHAN_LIST_CMDID,
1705         WMI_10_4_SCAN_SCH_PRIO_TBL_CMDID,
1706         WMI_10_4_SCAN_UPDATE_REQUEST_CMDID,
1707         WMI_10_4_ECHO_CMDID,
1708         WMI_10_4_PDEV_SET_REGDOMAIN_CMDID,
1709         WMI_10_4_PDEV_SET_CHANNEL_CMDID,
1710         WMI_10_4_PDEV_SET_PARAM_CMDID,
1711         WMI_10_4_PDEV_PKTLOG_ENABLE_CMDID,
1712         WMI_10_4_PDEV_PKTLOG_DISABLE_CMDID,
1713         WMI_10_4_PDEV_SET_WMM_PARAMS_CMDID,
1714         WMI_10_4_PDEV_SET_HT_CAP_IE_CMDID,
1715         WMI_10_4_PDEV_SET_VHT_CAP_IE_CMDID,
1716         WMI_10_4_PDEV_SET_BASE_MACADDR_CMDID,
1717         WMI_10_4_PDEV_SET_DSCP_TID_MAP_CMDID,
1718         WMI_10_4_PDEV_SET_QUIET_MODE_CMDID,
1719         WMI_10_4_PDEV_GREEN_AP_PS_ENABLE_CMDID,
1720         WMI_10_4_PDEV_GET_TPC_CONFIG_CMDID,
1721         WMI_10_4_VDEV_CREATE_CMDID,
1722         WMI_10_4_VDEV_DELETE_CMDID,
1723         WMI_10_4_VDEV_START_REQUEST_CMDID,
1724         WMI_10_4_VDEV_RESTART_REQUEST_CMDID,
1725         WMI_10_4_VDEV_UP_CMDID,
1726         WMI_10_4_VDEV_STOP_CMDID,
1727         WMI_10_4_VDEV_DOWN_CMDID,
1728         WMI_10_4_VDEV_STANDBY_RESPONSE_CMDID,
1729         WMI_10_4_VDEV_RESUME_RESPONSE_CMDID,
1730         WMI_10_4_VDEV_SET_PARAM_CMDID,
1731         WMI_10_4_VDEV_INSTALL_KEY_CMDID,
1732         WMI_10_4_WLAN_PEER_CACHING_ADD_PEER_CMDID,
1733         WMI_10_4_WLAN_PEER_CACHING_EVICT_PEER_CMDID,
1734         WMI_10_4_WLAN_PEER_CACHING_RESTORE_PEER_CMDID,
1735         WMI_10_4_WLAN_PEER_CACHING_PRINT_ALL_PEERS_INFO_CMDID,
1736         WMI_10_4_PEER_CREATE_CMDID,
1737         WMI_10_4_PEER_DELETE_CMDID,
1738         WMI_10_4_PEER_FLUSH_TIDS_CMDID,
1739         WMI_10_4_PEER_SET_PARAM_CMDID,
1740         WMI_10_4_PEER_ASSOC_CMDID,
1741         WMI_10_4_PEER_ADD_WDS_ENTRY_CMDID,
1742         WMI_10_4_PEER_UPDATE_WDS_ENTRY_CMDID,
1743         WMI_10_4_PEER_REMOVE_WDS_ENTRY_CMDID,
1744         WMI_10_4_PEER_ADD_PROXY_STA_ENTRY_CMDID,
1745         WMI_10_4_PEER_MCAST_GROUP_CMDID,
1746         WMI_10_4_BCN_TX_CMDID,
1747         WMI_10_4_PDEV_SEND_BCN_CMDID,
1748         WMI_10_4_BCN_PRB_TMPL_CMDID,
1749         WMI_10_4_BCN_FILTER_RX_CMDID,
1750         WMI_10_4_PRB_REQ_FILTER_RX_CMDID,
1751         WMI_10_4_MGMT_TX_CMDID,
1752         WMI_10_4_PRB_TMPL_CMDID,
1753         WMI_10_4_ADDBA_CLEAR_RESP_CMDID,
1754         WMI_10_4_ADDBA_SEND_CMDID,
1755         WMI_10_4_ADDBA_STATUS_CMDID,
1756         WMI_10_4_DELBA_SEND_CMDID,
1757         WMI_10_4_ADDBA_SET_RESP_CMDID,
1758         WMI_10_4_SEND_SINGLEAMSDU_CMDID,
1759         WMI_10_4_STA_POWERSAVE_MODE_CMDID,
1760         WMI_10_4_STA_POWERSAVE_PARAM_CMDID,
1761         WMI_10_4_STA_MIMO_PS_MODE_CMDID,
1762         WMI_10_4_DBGLOG_CFG_CMDID,
1763         WMI_10_4_PDEV_DFS_ENABLE_CMDID,
1764         WMI_10_4_PDEV_DFS_DISABLE_CMDID,
1765         WMI_10_4_PDEV_QVIT_CMDID,
1766         WMI_10_4_ROAM_SCAN_MODE,
1767         WMI_10_4_ROAM_SCAN_RSSI_THRESHOLD,
1768         WMI_10_4_ROAM_SCAN_PERIOD,
1769         WMI_10_4_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
1770         WMI_10_4_ROAM_AP_PROFILE,
1771         WMI_10_4_OFL_SCAN_ADD_AP_PROFILE,
1772         WMI_10_4_OFL_SCAN_REMOVE_AP_PROFILE,
1773         WMI_10_4_OFL_SCAN_PERIOD,
1774         WMI_10_4_P2P_DEV_SET_DEVICE_INFO,
1775         WMI_10_4_P2P_DEV_SET_DISCOVERABILITY,
1776         WMI_10_4_P2P_GO_SET_BEACON_IE,
1777         WMI_10_4_P2P_GO_SET_PROBE_RESP_IE,
1778         WMI_10_4_P2P_SET_VENDOR_IE_DATA_CMDID,
1779         WMI_10_4_AP_PS_PEER_PARAM_CMDID,
1780         WMI_10_4_AP_PS_PEER_UAPSD_COEX_CMDID,
1781         WMI_10_4_PEER_RATE_RETRY_SCHED_CMDID,
1782         WMI_10_4_WLAN_PROFILE_TRIGGER_CMDID,
1783         WMI_10_4_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
1784         WMI_10_4_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
1785         WMI_10_4_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
1786         WMI_10_4_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
1787         WMI_10_4_PDEV_SUSPEND_CMDID,
1788         WMI_10_4_PDEV_RESUME_CMDID,
1789         WMI_10_4_ADD_BCN_FILTER_CMDID,
1790         WMI_10_4_RMV_BCN_FILTER_CMDID,
1791         WMI_10_4_WOW_ADD_WAKE_PATTERN_CMDID,
1792         WMI_10_4_WOW_DEL_WAKE_PATTERN_CMDID,
1793         WMI_10_4_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
1794         WMI_10_4_WOW_ENABLE_CMDID,
1795         WMI_10_4_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
1796         WMI_10_4_RTT_MEASREQ_CMDID,
1797         WMI_10_4_RTT_TSF_CMDID,
1798         WMI_10_4_RTT_KEEPALIVE_CMDID,
1799         WMI_10_4_OEM_REQ_CMDID,
1800         WMI_10_4_NAN_CMDID,
1801         WMI_10_4_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
1802         WMI_10_4_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
1803         WMI_10_4_REQUEST_STATS_CMDID,
1804         WMI_10_4_GPIO_CONFIG_CMDID,
1805         WMI_10_4_GPIO_OUTPUT_CMDID,
1806         WMI_10_4_VDEV_RATEMASK_CMDID,
1807         WMI_10_4_CSA_OFFLOAD_ENABLE_CMDID,
1808         WMI_10_4_GTK_OFFLOAD_CMDID,
1809         WMI_10_4_QBOOST_CFG_CMDID,
1810         WMI_10_4_CSA_OFFLOAD_CHANSWITCH_CMDID,
1811         WMI_10_4_PDEV_SMART_ANT_ENABLE_CMDID,
1812         WMI_10_4_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID,
1813         WMI_10_4_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID,
1814         WMI_10_4_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID,
1815         WMI_10_4_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID,
1816         WMI_10_4_VDEV_SET_KEEPALIVE_CMDID,
1817         WMI_10_4_VDEV_GET_KEEPALIVE_CMDID,
1818         WMI_10_4_FORCE_FW_HANG_CMDID,
1819         WMI_10_4_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID,
1820         WMI_10_4_PDEV_SET_CTL_TABLE_CMDID,
1821         WMI_10_4_PDEV_SET_MIMOGAIN_TABLE_CMDID,
1822         WMI_10_4_PDEV_RATEPWR_TABLE_CMDID,
1823         WMI_10_4_PDEV_RATEPWR_CHAINMSK_TABLE_CMDID,
1824         WMI_10_4_PDEV_FIPS_CMDID,
1825         WMI_10_4_TT_SET_CONF_CMDID,
1826         WMI_10_4_FWTEST_CMDID,
1827         WMI_10_4_VDEV_ATF_REQUEST_CMDID,
1828         WMI_10_4_PEER_ATF_REQUEST_CMDID,
1829         WMI_10_4_PDEV_GET_ANI_CCK_CONFIG_CMDID,
1830         WMI_10_4_PDEV_GET_ANI_OFDM_CONFIG_CMDID,
1831         WMI_10_4_PDEV_RESERVE_AST_ENTRY_CMDID,
1832         WMI_10_4_PDEV_GET_NFCAL_POWER_CMDID,
1833         WMI_10_4_PDEV_GET_TPC_CMDID,
1834         WMI_10_4_PDEV_GET_AST_INFO_CMDID,
1835         WMI_10_4_VDEV_SET_DSCP_TID_MAP_CMDID,
1836         WMI_10_4_PDEV_GET_TEMPERATURE_CMDID,
1837         WMI_10_4_PDEV_GET_INFO_CMDID,
1838         WMI_10_4_VDEV_GET_INFO_CMDID,
1839         WMI_10_4_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID,
1840         WMI_10_4_MU_CAL_START_CMDID,
1841         WMI_10_4_SET_CCA_PARAMS_CMDID,
1842         WMI_10_4_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
1843         WMI_10_4_EXT_RESOURCE_CFG_CMDID,
1844         WMI_10_4_VDEV_SET_IE_CMDID,
1845         WMI_10_4_SET_LTEU_CONFIG_CMDID,
1846         WMI_10_4_ATF_SSID_GROUPING_REQUEST_CMDID,
1847         WMI_10_4_PEER_ATF_EXT_REQUEST_CMDID,
1848         WMI_10_4_SET_PERIODIC_CHANNEL_STATS_CONFIG,
1849         WMI_10_4_PEER_BWF_REQUEST_CMDID,
1850         WMI_10_4_BTCOEX_CFG_CMDID,
1851         WMI_10_4_PEER_TX_MU_TXMIT_COUNT_CMDID,
1852         WMI_10_4_PEER_TX_MU_TXMIT_RSTCNT_CMDID,
1853         WMI_10_4_PEER_GID_USERPOS_LIST_CMDID,
1854         WMI_10_4_PDEV_CHECK_CAL_VERSION_CMDID,
1855         WMI_10_4_COEX_VERSION_CFG_CMID,
1856         WMI_10_4_PDEV_GET_RX_FILTER_CMDID,
1857         WMI_10_4_PDEV_EXTENDED_NSS_CFG_CMDID,
1858         WMI_10_4_VDEV_SET_SCAN_NAC_RSSI_CMDID,
1859         WMI_10_4_PROG_GPIO_BAND_SELECT_CMDID,
1860         WMI_10_4_CONFIG_SMART_LOGGING_CMDID,
1861         WMI_10_4_DEBUG_FATAL_CONDITION_CMDID,
1862         WMI_10_4_GET_TSF_TIMER_CMDID,
1863         WMI_10_4_PDEV_GET_TPC_TABLE_CMDID,
1864         WMI_10_4_VDEV_SIFS_TRIGGER_TIME_CMDID,
1865         WMI_10_4_PDEV_WDS_ENTRY_LIST_CMDID,
1866         WMI_10_4_TDLS_SET_STATE_CMDID,
1867         WMI_10_4_TDLS_PEER_UPDATE_CMDID,
1868         WMI_10_4_TDLS_SET_OFFCHAN_MODE_CMDID,
1869         WMI_10_4_PDEV_SEND_FD_CMDID,
1870         WMI_10_4_ENABLE_FILS_CMDID,
1871         WMI_10_4_PDEV_SET_BRIDGE_MACADDR_CMDID,
1872         WMI_10_4_ATF_GROUP_WMM_AC_CONFIG_REQUEST_CMDID,
1873         WMI_10_4_RADAR_FOUND_CMDID,
1874         WMI_10_4_PDEV_UTF_CMDID = WMI_10_4_END_CMDID - 1,
1875 };
1876
1877 enum wmi_10_4_event_id {
1878         WMI_10_4_SERVICE_READY_EVENTID = 0x8000,
1879         WMI_10_4_READY_EVENTID,
1880         WMI_10_4_DEBUG_MESG_EVENTID,
1881         WMI_10_4_START_EVENTID = 0x9000,
1882         WMI_10_4_END_EVENTID = 0x9FFF,
1883         WMI_10_4_SCAN_EVENTID = WMI_10_4_START_EVENTID,
1884         WMI_10_4_ECHO_EVENTID,
1885         WMI_10_4_UPDATE_STATS_EVENTID,
1886         WMI_10_4_INST_RSSI_STATS_EVENTID,
1887         WMI_10_4_VDEV_START_RESP_EVENTID,
1888         WMI_10_4_VDEV_STANDBY_REQ_EVENTID,
1889         WMI_10_4_VDEV_RESUME_REQ_EVENTID,
1890         WMI_10_4_VDEV_STOPPED_EVENTID,
1891         WMI_10_4_PEER_STA_KICKOUT_EVENTID,
1892         WMI_10_4_HOST_SWBA_EVENTID,
1893         WMI_10_4_TBTTOFFSET_UPDATE_EVENTID,
1894         WMI_10_4_MGMT_RX_EVENTID,
1895         WMI_10_4_CHAN_INFO_EVENTID,
1896         WMI_10_4_PHYERR_EVENTID,
1897         WMI_10_4_ROAM_EVENTID,
1898         WMI_10_4_PROFILE_MATCH,
1899         WMI_10_4_DEBUG_PRINT_EVENTID,
1900         WMI_10_4_PDEV_QVIT_EVENTID,
1901         WMI_10_4_WLAN_PROFILE_DATA_EVENTID,
1902         WMI_10_4_RTT_MEASUREMENT_REPORT_EVENTID,
1903         WMI_10_4_TSF_MEASUREMENT_REPORT_EVENTID,
1904         WMI_10_4_RTT_ERROR_REPORT_EVENTID,
1905         WMI_10_4_RTT_KEEPALIVE_EVENTID,
1906         WMI_10_4_OEM_CAPABILITY_EVENTID,
1907         WMI_10_4_OEM_MEASUREMENT_REPORT_EVENTID,
1908         WMI_10_4_OEM_ERROR_REPORT_EVENTID,
1909         WMI_10_4_NAN_EVENTID,
1910         WMI_10_4_WOW_WAKEUP_HOST_EVENTID,
1911         WMI_10_4_GTK_OFFLOAD_STATUS_EVENTID,
1912         WMI_10_4_GTK_REKEY_FAIL_EVENTID,
1913         WMI_10_4_DCS_INTERFERENCE_EVENTID,
1914         WMI_10_4_PDEV_TPC_CONFIG_EVENTID,
1915         WMI_10_4_CSA_HANDLING_EVENTID,
1916         WMI_10_4_GPIO_INPUT_EVENTID,
1917         WMI_10_4_PEER_RATECODE_LIST_EVENTID,
1918         WMI_10_4_GENERIC_BUFFER_EVENTID,
1919         WMI_10_4_MCAST_BUF_RELEASE_EVENTID,
1920         WMI_10_4_MCAST_LIST_AGEOUT_EVENTID,
1921         WMI_10_4_VDEV_GET_KEEPALIVE_EVENTID,
1922         WMI_10_4_WDS_PEER_EVENTID,
1923         WMI_10_4_PEER_STA_PS_STATECHG_EVENTID,
1924         WMI_10_4_PDEV_FIPS_EVENTID,
1925         WMI_10_4_TT_STATS_EVENTID,
1926         WMI_10_4_PDEV_CHANNEL_HOPPING_EVENTID,
1927         WMI_10_4_PDEV_ANI_CCK_LEVEL_EVENTID,
1928         WMI_10_4_PDEV_ANI_OFDM_LEVEL_EVENTID,
1929         WMI_10_4_PDEV_RESERVE_AST_ENTRY_EVENTID,
1930         WMI_10_4_PDEV_NFCAL_POWER_EVENTID,
1931         WMI_10_4_PDEV_TPC_EVENTID,
1932         WMI_10_4_PDEV_GET_AST_INFO_EVENTID,
1933         WMI_10_4_PDEV_TEMPERATURE_EVENTID,
1934         WMI_10_4_PDEV_NFCAL_POWER_ALL_CHANNELS_EVENTID,
1935         WMI_10_4_PDEV_BSS_CHAN_INFO_EVENTID,
1936         WMI_10_4_MU_REPORT_EVENTID,
1937         WMI_10_4_TX_DATA_TRAFFIC_CTRL_EVENTID,
1938         WMI_10_4_PEER_TX_MU_TXMIT_COUNT_EVENTID,
1939         WMI_10_4_PEER_GID_USERPOS_LIST_EVENTID,
1940         WMI_10_4_PDEV_CHECK_CAL_VERSION_EVENTID,
1941         WMI_10_4_ATF_PEER_STATS_EVENTID,
1942         WMI_10_4_PDEV_GET_RX_FILTER_EVENTID,
1943         WMI_10_4_NAC_RSSI_EVENTID,
1944         WMI_10_4_DEBUG_FATAL_CONDITION_EVENTID,
1945         WMI_10_4_GET_TSF_TIMER_RESP_EVENTID,
1946         WMI_10_4_PDEV_TPC_TABLE_EVENTID,
1947         WMI_10_4_PDEV_WDS_ENTRY_LIST_EVENTID,
1948         WMI_10_4_TDLS_PEER_EVENTID,
1949         WMI_10_4_HOST_SWFDA_EVENTID,
1950         WMI_10_4_ESP_ESTIMATE_EVENTID,
1951         WMI_10_4_DFS_STATUS_CHECK_EVENTID,
1952         WMI_10_4_PDEV_UTF_EVENTID = WMI_10_4_END_EVENTID - 1,
1953 };
1954
1955 enum wmi_phy_mode {
1956         MODE_11A        = 0,   /* 11a Mode */
1957         MODE_11G        = 1,   /* 11b/g Mode */
1958         MODE_11B        = 2,   /* 11b Mode */
1959         MODE_11GONLY    = 3,   /* 11g only Mode */
1960         MODE_11NA_HT20   = 4,  /* 11a HT20 mode */
1961         MODE_11NG_HT20   = 5,  /* 11g HT20 mode */
1962         MODE_11NA_HT40   = 6,  /* 11a HT40 mode */
1963         MODE_11NG_HT40   = 7,  /* 11g HT40 mode */
1964         MODE_11AC_VHT20 = 8,
1965         MODE_11AC_VHT40 = 9,
1966         MODE_11AC_VHT80 = 10,
1967         /*    MODE_11AC_VHT160 = 11, */
1968         MODE_11AC_VHT20_2G = 11,
1969         MODE_11AC_VHT40_2G = 12,
1970         MODE_11AC_VHT80_2G = 13,
1971         MODE_11AC_VHT80_80 = 14,
1972         MODE_11AC_VHT160 = 15,
1973         MODE_UNKNOWN    = 16,
1974         MODE_MAX        = 16
1975 };
1976
1977 static inline const char *ath10k_wmi_phymode_str(enum wmi_phy_mode mode)
1978 {
1979         switch (mode) {
1980         case MODE_11A:
1981                 return "11a";
1982         case MODE_11G:
1983                 return "11g";
1984         case MODE_11B:
1985                 return "11b";
1986         case MODE_11GONLY:
1987                 return "11gonly";
1988         case MODE_11NA_HT20:
1989                 return "11na-ht20";
1990         case MODE_11NG_HT20:
1991                 return "11ng-ht20";
1992         case MODE_11NA_HT40:
1993                 return "11na-ht40";
1994         case MODE_11NG_HT40:
1995                 return "11ng-ht40";
1996         case MODE_11AC_VHT20:
1997                 return "11ac-vht20";
1998         case MODE_11AC_VHT40:
1999                 return "11ac-vht40";
2000         case MODE_11AC_VHT80:
2001                 return "11ac-vht80";
2002         case MODE_11AC_VHT160:
2003                 return "11ac-vht160";
2004         case MODE_11AC_VHT80_80:
2005                 return "11ac-vht80+80";
2006         case MODE_11AC_VHT20_2G:
2007                 return "11ac-vht20-2g";
2008         case MODE_11AC_VHT40_2G:
2009                 return "11ac-vht40-2g";
2010         case MODE_11AC_VHT80_2G:
2011                 return "11ac-vht80-2g";
2012         case MODE_UNKNOWN:
2013                 /* skip */
2014                 break;
2015
2016                 /* no default handler to allow compiler to check that the
2017                  * enum is fully handled
2018                  */
2019         }
2020
2021         return "<unknown>";
2022 }
2023
2024 #define WMI_CHAN_LIST_TAG       0x1
2025 #define WMI_SSID_LIST_TAG       0x2
2026 #define WMI_BSSID_LIST_TAG      0x3
2027 #define WMI_IE_TAG              0x4
2028
2029 struct wmi_channel {
2030         __le32 mhz;
2031         __le32 band_center_freq1;
2032         __le32 band_center_freq2; /* valid for 11ac, 80plus80 */
2033         union {
2034                 __le32 flags; /* WMI_CHAN_FLAG_ */
2035                 struct {
2036                         u8 mode; /* only 6 LSBs */
2037                 } __packed;
2038         } __packed;
2039         union {
2040                 __le32 reginfo0;
2041                 struct {
2042                         /* note: power unit is 0.5 dBm */
2043                         u8 min_power;
2044                         u8 max_power;
2045                         u8 reg_power;
2046                         u8 reg_classid;
2047                 } __packed;
2048         } __packed;
2049         union {
2050                 __le32 reginfo1;
2051                 struct {
2052                         u8 antenna_max;
2053                         u8 max_tx_power;
2054                 } __packed;
2055         } __packed;
2056 } __packed;
2057
2058 struct wmi_channel_arg {
2059         u32 freq;
2060         u32 band_center_freq1;
2061         u32 band_center_freq2;
2062         bool passive;
2063         bool allow_ibss;
2064         bool allow_ht;
2065         bool allow_vht;
2066         bool ht40plus;
2067         bool chan_radar;
2068         /* note: power unit is 0.5 dBm */
2069         u32 min_power;
2070         u32 max_power;
2071         u32 max_reg_power;
2072         u32 max_antenna_gain;
2073         u32 reg_class_id;
2074         enum wmi_phy_mode mode;
2075 };
2076
2077 enum wmi_channel_change_cause {
2078         WMI_CHANNEL_CHANGE_CAUSE_NONE = 0,
2079         WMI_CHANNEL_CHANGE_CAUSE_CSA,
2080 };
2081
2082 #define WMI_CHAN_FLAG_HT40_PLUS      (1 << 6)
2083 #define WMI_CHAN_FLAG_PASSIVE        (1 << 7)
2084 #define WMI_CHAN_FLAG_ADHOC_ALLOWED  (1 << 8)
2085 #define WMI_CHAN_FLAG_AP_DISABLED    (1 << 9)
2086 #define WMI_CHAN_FLAG_DFS            (1 << 10)
2087 #define WMI_CHAN_FLAG_ALLOW_HT       (1 << 11)
2088 #define WMI_CHAN_FLAG_ALLOW_VHT      (1 << 12)
2089
2090 /* Indicate reason for channel switch */
2091 #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1 << 13)
2092
2093 #define WMI_MAX_SPATIAL_STREAM        3 /* default max ss */
2094
2095 /* HT Capabilities*/
2096 #define WMI_HT_CAP_ENABLED                0x0001   /* HT Enabled/ disabled */
2097 #define WMI_HT_CAP_HT20_SGI       0x0002   /* Short Guard Interval with HT20 */
2098 #define WMI_HT_CAP_DYNAMIC_SMPS           0x0004   /* Dynamic MIMO powersave */
2099 #define WMI_HT_CAP_TX_STBC                0x0008   /* B3 TX STBC */
2100 #define WMI_HT_CAP_TX_STBC_MASK_SHIFT     3
2101 #define WMI_HT_CAP_RX_STBC                0x0030   /* B4-B5 RX STBC */
2102 #define WMI_HT_CAP_RX_STBC_MASK_SHIFT     4
2103 #define WMI_HT_CAP_LDPC                   0x0040   /* LDPC supported */
2104 #define WMI_HT_CAP_L_SIG_TXOP_PROT        0x0080   /* L-SIG TXOP Protection */
2105 #define WMI_HT_CAP_MPDU_DENSITY           0x0700   /* MPDU Density */
2106 #define WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT 8
2107 #define WMI_HT_CAP_HT40_SGI               0x0800
2108 #define WMI_HT_CAP_RX_LDPC                0x1000   /* LDPC RX support */
2109 #define WMI_HT_CAP_TX_LDPC                0x2000   /* LDPC TX support */
2110
2111 #define WMI_HT_CAP_DEFAULT_ALL (WMI_HT_CAP_ENABLED       | \
2112                                 WMI_HT_CAP_HT20_SGI      | \
2113                                 WMI_HT_CAP_HT40_SGI      | \
2114                                 WMI_HT_CAP_TX_STBC       | \
2115                                 WMI_HT_CAP_RX_STBC       | \
2116                                 WMI_HT_CAP_LDPC)
2117
2118 /*
2119  * WMI_VHT_CAP_* these maps to ieee 802.11ac vht capability information
2120  * field. The fields not defined here are not supported, or reserved.
2121  * Do not change these masks and if you have to add new one follow the
2122  * bitmask as specified by 802.11ac draft.
2123  */
2124
2125 #define WMI_VHT_CAP_MAX_MPDU_LEN_MASK            0x00000003
2126 #define WMI_VHT_CAP_RX_LDPC                      0x00000010
2127 #define WMI_VHT_CAP_SGI_80MHZ                    0x00000020
2128 #define WMI_VHT_CAP_SGI_160MHZ                   0x00000040
2129 #define WMI_VHT_CAP_TX_STBC                      0x00000080
2130 #define WMI_VHT_CAP_RX_STBC_MASK                 0x00000300
2131 #define WMI_VHT_CAP_RX_STBC_MASK_SHIFT           8
2132 #define WMI_VHT_CAP_SU_BFER                      0x00000800
2133 #define WMI_VHT_CAP_SU_BFEE                      0x00001000
2134 #define WMI_VHT_CAP_MAX_CS_ANT_MASK              0x0000E000
2135 #define WMI_VHT_CAP_MAX_CS_ANT_MASK_SHIFT        13
2136 #define WMI_VHT_CAP_MAX_SND_DIM_MASK             0x00070000
2137 #define WMI_VHT_CAP_MAX_SND_DIM_MASK_SHIFT       16
2138 #define WMI_VHT_CAP_MU_BFER                      0x00080000
2139 #define WMI_VHT_CAP_MU_BFEE                      0x00100000
2140 #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP            0x03800000
2141 #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT      23
2142 #define WMI_VHT_CAP_RX_FIXED_ANT                 0x10000000
2143 #define WMI_VHT_CAP_TX_FIXED_ANT                 0x20000000
2144
2145 /* The following also refer for max HT AMSDU */
2146 #define WMI_VHT_CAP_MAX_MPDU_LEN_3839            0x00000000
2147 #define WMI_VHT_CAP_MAX_MPDU_LEN_7935            0x00000001
2148 #define WMI_VHT_CAP_MAX_MPDU_LEN_11454           0x00000002
2149
2150 #define WMI_VHT_CAP_DEFAULT_ALL (WMI_VHT_CAP_MAX_MPDU_LEN_11454  | \
2151                                  WMI_VHT_CAP_RX_LDPC             | \
2152                                  WMI_VHT_CAP_SGI_80MHZ           | \
2153                                  WMI_VHT_CAP_TX_STBC             | \
2154                                  WMI_VHT_CAP_RX_STBC_MASK        | \
2155                                  WMI_VHT_CAP_MAX_AMPDU_LEN_EXP   | \
2156                                  WMI_VHT_CAP_RX_FIXED_ANT        | \
2157                                  WMI_VHT_CAP_TX_FIXED_ANT)
2158
2159 /*
2160  * Interested readers refer to Rx/Tx MCS Map definition as defined in
2161  * 802.11ac
2162  */
2163 #define WMI_VHT_MAX_MCS_4_SS_MASK(r, ss)      ((3 & (r)) << (((ss) - 1) << 1))
2164 #define WMI_VHT_MAX_SUPP_RATE_MASK           0x1fff0000
2165 #define WMI_VHT_MAX_SUPP_RATE_MASK_SHIFT     16
2166
2167 enum {
2168         REGDMN_MODE_11A              = 0x00001, /* 11a channels */
2169         REGDMN_MODE_TURBO            = 0x00002, /* 11a turbo-only channels */
2170         REGDMN_MODE_11B              = 0x00004, /* 11b channels */
2171         REGDMN_MODE_PUREG            = 0x00008, /* 11g channels (OFDM only) */
2172         REGDMN_MODE_11G              = 0x00008, /* XXX historical */
2173         REGDMN_MODE_108G             = 0x00020, /* 11a+Turbo channels */
2174         REGDMN_MODE_108A             = 0x00040, /* 11g+Turbo channels */
2175         REGDMN_MODE_XR               = 0x00100, /* XR channels */
2176         REGDMN_MODE_11A_HALF_RATE    = 0x00200, /* 11A half rate channels */
2177         REGDMN_MODE_11A_QUARTER_RATE = 0x00400, /* 11A quarter rate channels */
2178         REGDMN_MODE_11NG_HT20        = 0x00800, /* 11N-G HT20 channels */
2179         REGDMN_MODE_11NA_HT20        = 0x01000, /* 11N-A HT20 channels */
2180         REGDMN_MODE_11NG_HT40PLUS    = 0x02000, /* 11N-G HT40 + channels */
2181         REGDMN_MODE_11NG_HT40MINUS   = 0x04000, /* 11N-G HT40 - channels */
2182         REGDMN_MODE_11NA_HT40PLUS    = 0x08000, /* 11N-A HT40 + channels */
2183         REGDMN_MODE_11NA_HT40MINUS   = 0x10000, /* 11N-A HT40 - channels */
2184         REGDMN_MODE_11AC_VHT20       = 0x20000, /* 5Ghz, VHT20 */
2185         REGDMN_MODE_11AC_VHT40PLUS   = 0x40000, /* 5Ghz, VHT40 + channels */
2186         REGDMN_MODE_11AC_VHT40MINUS  = 0x80000, /* 5Ghz  VHT40 - channels */
2187         REGDMN_MODE_11AC_VHT80       = 0x100000, /* 5Ghz, VHT80 channels */
2188         REGDMN_MODE_11AC_VHT160      = 0x200000,     /* 5Ghz, VHT160 channels */
2189         REGDMN_MODE_11AC_VHT80_80    = 0x400000,     /* 5Ghz, VHT80+80 channels */
2190         REGDMN_MODE_ALL              = 0xffffffff
2191 };
2192
2193 #define REGDMN_CAP1_CHAN_HALF_RATE        0x00000001
2194 #define REGDMN_CAP1_CHAN_QUARTER_RATE     0x00000002
2195 #define REGDMN_CAP1_CHAN_HAL49GHZ         0x00000004
2196
2197 /* regulatory capabilities */
2198 #define REGDMN_EEPROM_EEREGCAP_EN_FCC_MIDBAND   0x0040
2199 #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_EVEN    0x0080
2200 #define REGDMN_EEPROM_EEREGCAP_EN_KK_U2         0x0100
2201 #define REGDMN_EEPROM_EEREGCAP_EN_KK_MIDBAND    0x0200
2202 #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_ODD     0x0400
2203 #define REGDMN_EEPROM_EEREGCAP_EN_KK_NEW_11A    0x0800
2204
2205 struct hal_reg_capabilities {
2206         /* regdomain value specified in EEPROM */
2207         __le32 eeprom_rd;
2208         /*regdomain */
2209         __le32 eeprom_rd_ext;
2210         /* CAP1 capabilities bit map. */
2211         __le32 regcap1;
2212         /* REGDMN EEPROM CAP. */
2213         __le32 regcap2;
2214         /* REGDMN MODE */
2215         __le32 wireless_modes;
2216         __le32 low_2ghz_chan;
2217         __le32 high_2ghz_chan;
2218         __le32 low_5ghz_chan;
2219         __le32 high_5ghz_chan;
2220 } __packed;
2221
2222 enum wlan_mode_capability {
2223         WHAL_WLAN_11A_CAPABILITY   = 0x1,
2224         WHAL_WLAN_11G_CAPABILITY   = 0x2,
2225         WHAL_WLAN_11AG_CAPABILITY  = 0x3,
2226 };
2227
2228 /* structure used by FW for requesting host memory */
2229 struct wlan_host_mem_req {
2230         /* ID of the request */
2231         __le32 req_id;
2232         /* size of the  of each unit */
2233         __le32 unit_size;
2234         /* flags to  indicate that
2235          * the number units is dependent
2236          * on number of resources(num vdevs num peers .. etc)
2237          */
2238         __le32 num_unit_info;
2239         /*
2240          * actual number of units to allocate . if flags in the num_unit_info
2241          * indicate that number of units is tied to number of a particular
2242          * resource to allocate then  num_units filed is set to 0 and host
2243          * will derive the number units from number of the resources it is
2244          * requesting.
2245          */
2246         __le32 num_units;
2247 } __packed;
2248
2249 /*
2250  * The following struct holds optional payload for
2251  * wmi_service_ready_event,e.g., 11ac pass some of the
2252  * device capability to the host.
2253  */
2254 struct wmi_service_ready_event {
2255         __le32 sw_version;
2256         __le32 sw_version_1;
2257         __le32 abi_version;
2258         /* WMI_PHY_CAPABILITY */
2259         __le32 phy_capability;
2260         /* Maximum number of frag table entries that SW will populate less 1 */
2261         __le32 max_frag_entry;
2262         __le32 wmi_service_bitmap[16];
2263         __le32 num_rf_chains;
2264         /*
2265          * The following field is only valid for service type
2266          * WMI_SERVICE_11AC
2267          */
2268         __le32 ht_cap_info; /* WMI HT Capability */
2269         __le32 vht_cap_info; /* VHT capability info field of 802.11ac */
2270         __le32 vht_supp_mcs; /* VHT Supported MCS Set field Rx/Tx same */
2271         __le32 hw_min_tx_power;
2272         __le32 hw_max_tx_power;
2273         struct hal_reg_capabilities hal_reg_capabilities;
2274         __le32 sys_cap_info;
2275         __le32 min_pkt_size_enable; /* Enterprise mode short pkt enable */
2276         /*
2277          * Max beacon and Probe Response IE offload size
2278          * (includes optional P2P IEs)
2279          */
2280         __le32 max_bcn_ie_size;
2281         /*
2282          * request to host to allocate a chuck of memory and pss it down to FW
2283          * via WM_INIT. FW uses this as FW extesnsion memory for saving its
2284          * data structures. Only valid for low latency interfaces like PCIE
2285          * where FW can access this memory directly (or) by DMA.
2286          */
2287         __le32 num_mem_reqs;
2288         struct wlan_host_mem_req mem_reqs[0];
2289 } __packed;
2290
2291 /* This is the definition from 10.X firmware branch */
2292 struct wmi_10x_service_ready_event {
2293         __le32 sw_version;
2294         __le32 abi_version;
2295
2296         /* WMI_PHY_CAPABILITY */
2297         __le32 phy_capability;
2298
2299         /* Maximum number of frag table entries that SW will populate less 1 */
2300         __le32 max_frag_entry;
2301         __le32 wmi_service_bitmap[16];
2302         __le32 num_rf_chains;
2303
2304         /*
2305          * The following field is only valid for service type
2306          * WMI_SERVICE_11AC
2307          */
2308         __le32 ht_cap_info; /* WMI HT Capability */
2309         __le32 vht_cap_info; /* VHT capability info field of 802.11ac */
2310         __le32 vht_supp_mcs; /* VHT Supported MCS Set field Rx/Tx same */
2311         __le32 hw_min_tx_power;
2312         __le32 hw_max_tx_power;
2313
2314         struct hal_reg_capabilities hal_reg_capabilities;
2315
2316         __le32 sys_cap_info;
2317         __le32 min_pkt_size_enable; /* Enterprise mode short pkt enable */
2318
2319         /*
2320          * request to host to allocate a chuck of memory and pss it down to FW
2321          * via WM_INIT. FW uses this as FW extesnsion memory for saving its
2322          * data structures. Only valid for low latency interfaces like PCIE
2323          * where FW can access this memory directly (or) by DMA.
2324          */
2325         __le32 num_mem_reqs;
2326
2327         struct wlan_host_mem_req mem_reqs[0];
2328 } __packed;
2329
2330 #define WMI_SERVICE_READY_TIMEOUT_HZ (5 * HZ)
2331 #define WMI_UNIFIED_READY_TIMEOUT_HZ (5 * HZ)
2332
2333 struct wmi_ready_event {
2334         __le32 sw_version;
2335         __le32 abi_version;
2336         struct wmi_mac_addr mac_addr;
2337         __le32 status;
2338 } __packed;
2339
2340 struct wmi_resource_config {
2341         /* number of virtual devices (VAPs) to support */
2342         __le32 num_vdevs;
2343
2344         /* number of peer nodes to support */
2345         __le32 num_peers;
2346
2347         /*
2348          * In offload mode target supports features like WOW, chatter and
2349          * other protocol offloads. In order to support them some
2350          * functionalities like reorder buffering, PN checking need to be
2351          * done in target. This determines maximum number of peers supported
2352          * by target in offload mode
2353          */
2354         __le32 num_offload_peers;
2355
2356         /* For target-based RX reordering */
2357         __le32 num_offload_reorder_bufs;
2358
2359         /* number of keys per peer */
2360         __le32 num_peer_keys;
2361
2362         /* total number of TX/RX data TIDs */
2363         __le32 num_tids;
2364
2365         /*
2366          * max skid for resolving hash collisions
2367          *
2368          *   The address search table is sparse, so that if two MAC addresses
2369          *   result in the same hash value, the second of these conflicting
2370          *   entries can slide to the next index in the address search table,
2371          *   and use it, if it is unoccupied.  This ast_skid_limit parameter
2372          *   specifies the upper bound on how many subsequent indices to search
2373          *   over to find an unoccupied space.
2374          */
2375         __le32 ast_skid_limit;
2376
2377         /*
2378          * the nominal chain mask for transmit
2379          *
2380          *   The chain mask may be modified dynamically, e.g. to operate AP
2381          *   tx with a reduced number of chains if no clients are associated.
2382          *   This configuration parameter specifies the nominal chain-mask that
2383          *   should be used when not operating with a reduced set of tx chains.
2384          */
2385         __le32 tx_chain_mask;
2386
2387         /*
2388          * the nominal chain mask for receive
2389          *
2390          *   The chain mask may be modified dynamically, e.g. for a client
2391          *   to use a reduced number of chains for receive if the traffic to
2392          *   the client is low enough that it doesn't require downlink MIMO
2393          *   or antenna diversity.
2394          *   This configuration parameter specifies the nominal chain-mask that
2395          *   should be used when not operating with a reduced set of rx chains.
2396          */
2397         __le32 rx_chain_mask;
2398
2399         /*
2400          * what rx reorder timeout (ms) to use for the AC
2401          *
2402          *   Each WMM access class (voice, video, best-effort, background) will
2403          *   have its own timeout value to dictate how long to wait for missing
2404          *   rx MPDUs to arrive before flushing subsequent MPDUs that have
2405          *   already been received.
2406          *   This parameter specifies the timeout in milliseconds for each
2407          *   class.
2408          */
2409         __le32 rx_timeout_pri_vi;
2410         __le32 rx_timeout_pri_vo;
2411         __le32 rx_timeout_pri_be;
2412         __le32 rx_timeout_pri_bk;
2413
2414         /*
2415          * what mode the rx should decap packets to
2416          *
2417          *   MAC can decap to RAW (no decap), native wifi or Ethernet types
2418          *   THis setting also determines the default TX behavior, however TX
2419          *   behavior can be modified on a per VAP basis during VAP init
2420          */
2421         __le32 rx_decap_mode;
2422
2423         /* what is the maximum number of scan requests that can be queued */
2424         __le32 scan_max_pending_reqs;
2425
2426         /* maximum VDEV that could use BMISS offload */
2427         __le32 bmiss_offload_max_vdev;
2428
2429         /* maximum VDEV that could use offload roaming */
2430         __le32 roam_offload_max_vdev;
2431
2432         /* maximum AP profiles that would push to offload roaming */
2433         __le32 roam_offload_max_ap_profiles;
2434
2435         /*
2436          * how many groups to use for mcast->ucast conversion
2437          *
2438          *   The target's WAL maintains a table to hold information regarding
2439          *   which peers belong to a given multicast group, so that if
2440          *   multicast->unicast conversion is enabled, the target can convert
2441          *   multicast tx frames to a series of unicast tx frames, to each
2442          *   peer within the multicast group.
2443              This num_mcast_groups configuration parameter tells the target how
2444          *   many multicast groups to provide storage for within its multicast
2445          *   group membership table.
2446          */
2447         __le32 num_mcast_groups;
2448
2449         /*
2450          * size to alloc for the mcast membership table
2451          *
2452          *   This num_mcast_table_elems configuration parameter tells the
2453          *   target how many peer elements it needs to provide storage for in
2454          *   its multicast group membership table.
2455          *   These multicast group membership table elements are shared by the
2456          *   multicast groups stored within the table.
2457          */
2458         __le32 num_mcast_table_elems;
2459
2460         /*
2461          * whether/how to do multicast->unicast conversion
2462          *
2463          *   This configuration parameter specifies whether the target should
2464          *   perform multicast --> unicast conversion on transmit, and if so,
2465          *   what to do if it finds no entries in its multicast group
2466          *   membership table for the multicast IP address in the tx frame.
2467          *   Configuration value:
2468          *   0 -> Do not perform multicast to unicast conversion.
2469          *   1 -> Convert multicast frames to unicast, if the IP multicast
2470          *        address from the tx frame is found in the multicast group
2471          *        membership table.  If the IP multicast address is not found,
2472          *        drop the frame.
2473          *   2 -> Convert multicast frames to unicast, if the IP multicast
2474          *        address from the tx frame is found in the multicast group
2475          *        membership table.  If the IP multicast address is not found,
2476          *        transmit the frame as multicast.
2477          */
2478         __le32 mcast2ucast_mode;
2479
2480         /*
2481          * how much memory to allocate for a tx PPDU dbg log
2482          *
2483          *   This parameter controls how much memory the target will allocate
2484          *   to store a log of tx PPDU meta-information (how large the PPDU
2485          *   was, when it was sent, whether it was successful, etc.)
2486          */
2487         __le32 tx_dbg_log_size;
2488
2489         /* how many AST entries to be allocated for WDS */
2490         __le32 num_wds_entries;
2491
2492         /*
2493          * MAC DMA burst size, e.g., For target PCI limit can be
2494          * 0 -default, 1 256B
2495          */
2496         __le32 dma_burst_size;
2497
2498         /*
2499          * Fixed delimiters to be inserted after every MPDU to
2500          * account for interface latency to avoid underrun.
2501          */
2502         __le32 mac_aggr_delim;
2503
2504         /*
2505          *   determine whether target is responsible for detecting duplicate
2506          *   non-aggregate MPDU and timing out stale fragments.
2507          *
2508          *   A-MPDU reordering is always performed on the target.
2509          *
2510          *   0: target responsible for frag timeout and dup checking
2511          *   1: host responsible for frag timeout and dup checking
2512          */
2513         __le32 rx_skip_defrag_timeout_dup_detection_check;
2514
2515         /*
2516          * Configuration for VoW :
2517          * No of Video Nodes to be supported
2518          * and Max no of descriptors for each Video link (node).
2519          */
2520         __le32 vow_config;
2521
2522         /* maximum VDEV that could use GTK offload */
2523         __le32 gtk_offload_max_vdev;
2524
2525         /* Number of msdu descriptors target should use */
2526         __le32 num_msdu_desc;
2527
2528         /*
2529          * Max. number of Tx fragments per MSDU
2530          *  This parameter controls the max number of Tx fragments per MSDU.
2531          *  This is sent by the target as part of the WMI_SERVICE_READY event
2532          *  and is overridden by the OS shim as required.
2533          */
2534         __le32 max_frag_entries;
2535 } __packed;
2536
2537 struct wmi_resource_config_10x {
2538         /* number of virtual devices (VAPs) to support */
2539         __le32 num_vdevs;
2540
2541         /* number of peer nodes to support */
2542         __le32 num_peers;
2543
2544         /* number of keys per peer */
2545         __le32 num_peer_keys;
2546
2547         /* total number of TX/RX data TIDs */
2548         __le32 num_tids;
2549
2550         /*
2551          * max skid for resolving hash collisions
2552          *
2553          *   The address search table is sparse, so that if two MAC addresses
2554          *   result in the same hash value, the second of these conflicting
2555          *   entries can slide to the next index in the address search table,
2556          *   and use it, if it is unoccupied.  This ast_skid_limit parameter
2557          *   specifies the upper bound on how many subsequent indices to search
2558          *   over to find an unoccupied space.
2559          */
2560         __le32 ast_skid_limit;
2561
2562         /*
2563          * the nominal chain mask for transmit
2564          *
2565          *   The chain mask may be modified dynamically, e.g. to operate AP
2566          *   tx with a reduced number of chains if no clients are associated.
2567          *   This configuration parameter specifies the nominal chain-mask that
2568          *   should be used when not operating with a reduced set of tx chains.
2569          */
2570         __le32 tx_chain_mask;
2571
2572         /*
2573          * the nominal chain mask for receive
2574          *
2575          *   The chain mask may be modified dynamically, e.g. for a client
2576          *   to use a reduced number of chains for receive if the traffic to
2577          *   the client is low enough that it doesn't require downlink MIMO
2578          *   or antenna diversity.
2579          *   This configuration parameter specifies the nominal chain-mask that
2580          *   should be used when not operating with a reduced set of rx chains.
2581          */
2582         __le32 rx_chain_mask;
2583
2584         /*
2585          * what rx reorder timeout (ms) to use for the AC
2586          *
2587          *   Each WMM access class (voice, video, best-effort, background) will
2588          *   have its own timeout value to dictate how long to wait for missing
2589          *   rx MPDUs to arrive before flushing subsequent MPDUs that have
2590          *   already been received.
2591          *   This parameter specifies the timeout in milliseconds for each
2592          *   class.
2593          */
2594         __le32 rx_timeout_pri_vi;
2595         __le32 rx_timeout_pri_vo;
2596         __le32 rx_timeout_pri_be;
2597         __le32 rx_timeout_pri_bk;
2598
2599         /*
2600          * what mode the rx should decap packets to
2601          *
2602          *   MAC can decap to RAW (no decap), native wifi or Ethernet types
2603          *   THis setting also determines the default TX behavior, however TX
2604          *   behavior can be modified on a per VAP basis during VAP init
2605          */
2606         __le32 rx_decap_mode;
2607
2608         /* what is the maximum number of scan requests that can be queued */
2609         __le32 scan_max_pending_reqs;
2610
2611         /* maximum VDEV that could use BMISS offload */
2612         __le32 bmiss_offload_max_vdev;
2613
2614         /* maximum VDEV that could use offload roaming */
2615         __le32 roam_offload_max_vdev;
2616
2617         /* maximum AP profiles that would push to offload roaming */
2618         __le32 roam_offload_max_ap_profiles;
2619
2620         /*
2621          * how many groups to use for mcast->ucast conversion
2622          *
2623          *   The target's WAL maintains a table to hold information regarding
2624          *   which peers belong to a given multicast group, so that if
2625          *   multicast->unicast conversion is enabled, the target can convert
2626          *   multicast tx frames to a series of unicast tx frames, to each
2627          *   peer within the multicast group.
2628              This num_mcast_groups configuration parameter tells the target how
2629          *   many multicast groups to provide storage for within its multicast
2630          *   group membership table.
2631          */
2632         __le32 num_mcast_groups;
2633
2634         /*
2635          * size to alloc for the mcast membership table
2636          *
2637          *   This num_mcast_table_elems configuration parameter tells the
2638          *   target how many peer elements it needs to provide storage for in
2639          *   its multicast group membership table.
2640          *   These multicast group membership table elements are shared by the
2641          *   multicast groups stored within the table.
2642          */
2643         __le32 num_mcast_table_elems;
2644
2645         /*
2646          * whether/how to do multicast->unicast conversion
2647          *
2648          *   This configuration parameter specifies whether the target should
2649          *   perform multicast --> unicast conversion on transmit, and if so,
2650          *   what to do if it finds no entries in its multicast group
2651          *   membership table for the multicast IP address in the tx frame.
2652          *   Configuration value:
2653          *   0 -> Do not perform multicast to unicast conversion.
2654          *   1 -> Convert multicast frames to unicast, if the IP multicast
2655          *        address from the tx frame is found in the multicast group
2656          *        membership table.  If the IP multicast address is not found,
2657          *        drop the frame.
2658          *   2 -> Convert multicast frames to unicast, if the IP multicast
2659          *        address from the tx frame is found in the multicast group
2660          *        membership table.  If the IP multicast address is not found,
2661          *        transmit the frame as multicast.
2662          */
2663         __le32 mcast2ucast_mode;
2664
2665         /*
2666          * how much memory to allocate for a tx PPDU dbg log
2667          *
2668          *   This parameter controls how much memory the target will allocate
2669          *   to store a log of tx PPDU meta-information (how large the PPDU
2670          *   was, when it was sent, whether it was successful, etc.)
2671          */
2672         __le32 tx_dbg_log_size;
2673
2674         /* how many AST entries to be allocated for WDS */
2675         __le32 num_wds_entries;
2676
2677         /*
2678          * MAC DMA burst size, e.g., For target PCI limit can be
2679          * 0 -default, 1 256B
2680          */
2681         __le32 dma_burst_size;
2682
2683         /*
2684          * Fixed delimiters to be inserted after every MPDU to
2685          * account for interface latency to avoid underrun.
2686          */
2687         __le32 mac_aggr_delim;
2688
2689         /*
2690          *   determine whether target is responsible for detecting duplicate
2691          *   non-aggregate MPDU and timing out stale fragments.
2692          *
2693          *   A-MPDU reordering is always performed on the target.
2694          *
2695          *   0: target responsible for frag timeout and dup checking
2696          *   1: host responsible for frag timeout and dup checking
2697          */
2698         __le32 rx_skip_defrag_timeout_dup_detection_check;
2699
2700         /*
2701          * Configuration for VoW :
2702          * No of Video Nodes to be supported
2703          * and Max no of descriptors for each Video link (node).
2704          */
2705         __le32 vow_config;
2706
2707         /* Number of msdu descriptors target should use */
2708         __le32 num_msdu_desc;
2709
2710         /*
2711          * Max. number of Tx fragments per MSDU
2712          *  This parameter controls the max number of Tx fragments per MSDU.
2713          *  This is sent by the target as part of the WMI_SERVICE_READY event
2714          *  and is overridden by the OS shim as required.
2715          */
2716         __le32 max_frag_entries;
2717 } __packed;
2718
2719 enum wmi_10_2_feature_mask {
2720         WMI_10_2_RX_BATCH_MODE = BIT(0),
2721         WMI_10_2_ATF_CONFIG    = BIT(1),
2722         WMI_10_2_COEX_GPIO     = BIT(3),
2723         WMI_10_2_BSS_CHAN_INFO = BIT(6),
2724         WMI_10_2_PEER_STATS    = BIT(7),
2725 };
2726
2727 struct wmi_resource_config_10_2 {
2728         struct wmi_resource_config_10x common;
2729         __le32 max_peer_ext_stats;
2730         __le32 smart_ant_cap; /* 0-disable, 1-enable */
2731         __le32 bk_min_free;
2732         __le32 be_min_free;
2733         __le32 vi_min_free;
2734         __le32 vo_min_free;
2735         __le32 feature_mask;
2736 } __packed;
2737
2738 #define NUM_UNITS_IS_NUM_VDEVS         BIT(0)
2739 #define NUM_UNITS_IS_NUM_PEERS         BIT(1)
2740 #define NUM_UNITS_IS_NUM_ACTIVE_PEERS  BIT(2)
2741
2742 struct wmi_resource_config_10_4 {
2743         /* Number of virtual devices (VAPs) to support */
2744         __le32 num_vdevs;
2745
2746         /* Number of peer nodes to support */
2747         __le32 num_peers;
2748
2749         /* Number of active peer nodes to support */
2750         __le32 num_active_peers;
2751
2752         /* In offload mode, target supports features like WOW, chatter and other
2753          * protocol offloads. In order to support them some functionalities like
2754          * reorder buffering, PN checking need to be done in target.
2755          * This determines maximum number of peers supported by target in
2756          * offload mode.
2757          */
2758         __le32 num_offload_peers;
2759
2760         /* Number of reorder buffers available for doing target based reorder
2761          * Rx reorder buffering
2762          */
2763         __le32 num_offload_reorder_buffs;
2764
2765         /* Number of keys per peer */
2766         __le32 num_peer_keys;
2767
2768         /* Total number of TX/RX data TIDs */
2769         __le32 num_tids;
2770
2771         /* Max skid for resolving hash collisions.
2772          * The address search table is sparse, so that if two MAC addresses
2773          * result in the same hash value, the second of these conflicting
2774          * entries can slide to the next index in the address search table,
2775          * and use it, if it is unoccupied.  This ast_skid_limit parameter
2776          * specifies the upper bound on how many subsequent indices to search
2777          * over to find an unoccupied space.
2778          */
2779         __le32 ast_skid_limit;
2780
2781         /* The nominal chain mask for transmit.
2782          * The chain mask may be modified dynamically, e.g. to operate AP tx
2783          * with a reduced number of chains if no clients are associated.
2784          * This configuration parameter specifies the nominal chain-mask that
2785          * should be used when not operating with a reduced set of tx chains.
2786          */
2787         __le32 tx_chain_mask;
2788
2789         /* The nominal chain mask for receive.
2790          * The chain mask may be modified dynamically, e.g. for a client to use
2791          * a reduced number of chains for receive if the traffic to the client
2792          * is low enough that it doesn't require downlink MIMO or antenna
2793          * diversity. This configuration parameter specifies the nominal
2794          * chain-mask that should be used when not operating with a reduced
2795          * set of rx chains.
2796          */
2797         __le32 rx_chain_mask;
2798
2799         /* What rx reorder timeout (ms) to use for the AC.
2800          * Each WMM access class (voice, video, best-effort, background) will
2801          * have its own timeout value to dictate how long to wait for missing
2802          * rx MPDUs to arrive before flushing subsequent MPDUs that have already
2803          * been received. This parameter specifies the timeout in milliseconds
2804          * for each class.
2805          */
2806         __le32 rx_timeout_pri[4];
2807
2808         /* What mode the rx should decap packets to.
2809          * MAC can decap to RAW (no decap), native wifi or Ethernet types.
2810          * This setting also determines the default TX behavior, however TX
2811          * behavior can be modified on a per VAP basis during VAP init
2812          */
2813         __le32 rx_decap_mode;
2814
2815         __le32 scan_max_pending_req;
2816
2817         __le32 bmiss_offload_max_vdev;
2818
2819         __le32 roam_offload_max_vdev;
2820
2821         __le32 roam_offload_max_ap_profiles;
2822
2823         /* How many groups to use for mcast->ucast conversion.
2824          * The target's WAL maintains a table to hold information regarding
2825          * which peers belong to a given multicast group, so that if
2826          * multicast->unicast conversion is enabled, the target can convert
2827          * multicast tx frames to a series of unicast tx frames, to each peer
2828          * within the multicast group. This num_mcast_groups configuration
2829          * parameter tells the target how many multicast groups to provide
2830          * storage for within its multicast group membership table.
2831          */
2832         __le32 num_mcast_groups;
2833
2834         /* Size to alloc for the mcast membership table.
2835          * This num_mcast_table_elems configuration parameter tells the target
2836          * how many peer elements it needs to provide storage for in its
2837          * multicast group membership table. These multicast group membership
2838          * table elements are shared by the multicast groups stored within
2839          * the table.
2840          */
2841         __le32 num_mcast_table_elems;
2842
2843         /* Whether/how to do multicast->unicast conversion.
2844          * This configuration parameter specifies whether the target should
2845          * perform multicast --> unicast conversion on transmit, and if so,
2846          * what to do if it finds no entries in its multicast group membership
2847          * table for the multicast IP address in the tx frame.
2848          * Configuration value:
2849          * 0 -> Do not perform multicast to unicast conversion.
2850          * 1 -> Convert multicast frames to unicast, if the IP multicast address
2851          *      from the tx frame is found in the multicast group membership
2852          *      table.  If the IP multicast address is not found, drop the frame
2853          * 2 -> Convert multicast frames to unicast, if the IP multicast address
2854          *      from the tx frame is found in the multicast group membership
2855          *      table.  If the IP multicast address is not found, transmit the
2856          *      frame as multicast.
2857          */
2858         __le32 mcast2ucast_mode;
2859
2860         /* How much memory to allocate for a tx PPDU dbg log.
2861          * This parameter controls how much memory the target will allocate to
2862          * store a log of tx PPDU meta-information (how large the PPDU was,
2863          * when it was sent, whether it was successful, etc.)
2864          */
2865         __le32 tx_dbg_log_size;
2866
2867         /* How many AST entries to be allocated for WDS */
2868         __le32 num_wds_entries;
2869
2870         /* MAC DMA burst size. 0 -default, 1 -256B */
2871         __le32 dma_burst_size;
2872
2873         /* Fixed delimiters to be inserted after every MPDU to account for
2874          * interface latency to avoid underrun.
2875          */
2876         __le32 mac_aggr_delim;
2877
2878         /* Determine whether target is responsible for detecting duplicate
2879          * non-aggregate MPDU and timing out stale fragments. A-MPDU reordering
2880          * is always performed on the target.
2881          *
2882          * 0: target responsible for frag timeout and dup checking
2883          * 1: host responsible for frag timeout and dup checking
2884          */
2885         __le32 rx_skip_defrag_timeout_dup_detection_check;
2886
2887         /* Configuration for VoW : No of Video nodes to be supported and max
2888          * no of descriptors for each video link (node).
2889          */
2890         __le32 vow_config;
2891
2892         /* Maximum vdev that could use gtk offload */
2893         __le32 gtk_offload_max_vdev;
2894
2895         /* Number of msdu descriptors target should use */
2896         __le32 num_msdu_desc;
2897
2898         /* Max number of tx fragments per MSDU.
2899          * This parameter controls the max number of tx fragments per MSDU.
2900          * This will passed by target as part of the WMI_SERVICE_READY event
2901          * and is overridden by the OS shim as required.
2902          */
2903         __le32 max_frag_entries;
2904
2905         /* Max number of extended peer stats.
2906          * This parameter controls the max number of peers for which extended
2907          * statistics are supported by target
2908          */
2909         __le32 max_peer_ext_stats;
2910
2911         /* Smart antenna capabilities information.
2912          * 1 - Smart antenna is enabled
2913          * 0 - Smart antenna is disabled
2914          * In future this can contain smart antenna specific capabilities.
2915          */
2916         __le32 smart_ant_cap;
2917
2918         /* User can configure the buffers allocated for each AC (BE, BK, VI, VO)
2919          * during init.
2920          */
2921         __le32 bk_minfree;
2922         __le32 be_minfree;
2923         __le32 vi_minfree;
2924         __le32 vo_minfree;
2925
2926         /* Rx batch mode capability.
2927          * 1 - Rx batch mode enabled
2928          * 0 - Rx batch mode disabled
2929          */
2930         __le32 rx_batchmode;
2931
2932         /* Thermal throttling capability.
2933          * 1 - Capable of thermal throttling
2934          * 0 - Not capable of thermal throttling
2935          */
2936         __le32 tt_support;
2937
2938         /* ATF configuration.
2939          * 1  - Enable ATF
2940          * 0  - Disable ATF
2941          */
2942         __le32 atf_config;
2943
2944         /* Configure padding to manage IP header un-alignment
2945          * 1  - Enable padding
2946          * 0  - Disable padding
2947          */
2948         __le32 iphdr_pad_config;
2949
2950         /* qwrap configuration (bits 15-0)
2951          * 1  - This is qwrap configuration
2952          * 0  - This is not qwrap
2953          *
2954          * Bits 31-16 is alloc_frag_desc_for_data_pkt (1 enables, 0 disables)
2955          * In order to get ack-RSSI reporting and to specify the tx-rate for
2956          * individual frames, this option must be enabled.  This uses an extra
2957          * 4 bytes per tx-msdu descriptor, so don't enable it unless you need it.
2958          */
2959         __le32 qwrap_config;
2960 } __packed;
2961
2962 enum wmi_coex_version {
2963         WMI_NO_COEX_VERSION_SUPPORT     = 0,
2964         /* 3 wire coex support*/
2965         WMI_COEX_VERSION_1              = 1,
2966         /* 2.5 wire coex support*/
2967         WMI_COEX_VERSION_2              = 2,
2968         /* 2.5 wire coex with duty cycle support */
2969         WMI_COEX_VERSION_3              = 3,
2970         /* 4 wire coex support*/
2971         WMI_COEX_VERSION_4              = 4,
2972 };
2973
2974 /**
2975  * enum wmi_10_4_feature_mask - WMI 10.4 feature enable/disable flags
2976  * @WMI_10_4_LTEU_SUPPORT: LTEU config
2977  * @WMI_10_4_COEX_GPIO_SUPPORT: COEX GPIO config
2978  * @WMI_10_4_AUX_RADIO_SPECTRAL_INTF: AUX Radio Enhancement for spectral scan
2979  * @WMI_10_4_AUX_RADIO_CHAN_LOAD_INTF: AUX Radio Enhancement for chan load scan
2980  * @WMI_10_4_BSS_CHANNEL_INFO_64: BSS channel info stats
2981  * @WMI_10_4_PEER_STATS: Per station stats
2982  * @WMI_10_4_VDEV_STATS: Per vdev stats
2983  * @WMI_10_4_TDLS: Implicit TDLS support in firmware enable/disable
2984  * @WMI_10_4_TDLS_OFFCHAN: TDLS offchannel support enable/disable
2985  * @WMI_10_4_TDLS_UAPSD_BUFFER_STA: TDLS buffer sta support enable/disable
2986  * @WMI_10_4_TDLS_UAPSD_SLEEP_STA: TDLS sleep sta support enable/disable
2987  * @WMI_10_4_TDLS_CONN_TRACKER_IN_HOST_MODE: TDLS connection tracker in host
2988  *      enable/disable
2989  * @WMI_10_4_TDLS_EXPLICIT_MODE_ONLY:Explicit TDLS mode enable/disable
2990  * @WMI_10_4_TX_DATA_ACK_RSSI: Enable DATA ACK RSSI if firmware is capable
2991  */
2992 enum wmi_10_4_feature_mask {
2993         WMI_10_4_LTEU_SUPPORT                   = BIT(0),
2994         WMI_10_4_COEX_GPIO_SUPPORT              = BIT(1),
2995         WMI_10_4_AUX_RADIO_SPECTRAL_INTF        = BIT(2),
2996         WMI_10_4_AUX_RADIO_CHAN_LOAD_INTF       = BIT(3),
2997         WMI_10_4_BSS_CHANNEL_INFO_64            = BIT(4),
2998         WMI_10_4_PEER_STATS                     = BIT(5),
2999         WMI_10_4_VDEV_STATS                     = BIT(6),
3000         WMI_10_4_TDLS                           = BIT(7),
3001         WMI_10_4_TDLS_OFFCHAN                   = BIT(8),
3002         WMI_10_4_TDLS_UAPSD_BUFFER_STA          = BIT(9),
3003         WMI_10_4_TDLS_UAPSD_SLEEP_STA           = BIT(10),
3004         WMI_10_4_TDLS_CONN_TRACKER_IN_HOST_MODE = BIT(11),
3005         WMI_10_4_TDLS_EXPLICIT_MODE_ONLY        = BIT(12),
3006         WMI_10_4_TX_DATA_ACK_RSSI               = BIT(16),
3007         WMI_10_4_EXT_PEER_TID_CONFIGS_SUPPORT   = BIT(17),
3008         WMI_10_4_REPORT_AIRTIME                 = BIT(18),
3009
3010 };
3011
3012 struct wmi_ext_resource_config_10_4_cmd {
3013         /* contains enum wmi_host_platform_type */
3014         __le32 host_platform_config;
3015         /* see enum wmi_10_4_feature_mask */
3016         __le32 fw_feature_bitmap;
3017         /* WLAN priority GPIO number */
3018         __le32 wlan_gpio_priority;
3019         /* see enum wmi_coex_version */
3020         __le32 coex_version;
3021         /* COEX GPIO config */
3022         __le32 coex_gpio_pin1;
3023         __le32 coex_gpio_pin2;
3024         __le32 coex_gpio_pin3;
3025         /* number of vdevs allowed to perform tdls */
3026         __le32 num_tdls_vdevs;
3027         /* number of peers to track per TDLS vdev */
3028         __le32 num_tdls_conn_table_entries;
3029         /* number of tdls sleep sta supported */
3030         __le32 max_tdls_concurrent_sleep_sta;
3031         /* number of tdls buffer sta supported */
3032         __le32 max_tdls_concurrent_buffer_sta;
3033 };
3034
3035 /* structure describing host memory chunk. */
3036 struct host_memory_chunk {
3037         /* id of the request that is passed up in service ready */
3038         __le32 req_id;
3039         /* the physical address the memory chunk */
3040         __le32 ptr;
3041         /* size of the chunk */
3042         __le32 size;
3043 } __packed;
3044
3045 struct wmi_host_mem_chunks {
3046         __le32 count;
3047         /* some fw revisions require at least 1 chunk regardless of count */
3048         struct host_memory_chunk items[1];
3049 } __packed;
3050
3051 struct wmi_init_cmd {
3052         struct wmi_resource_config resource_config;
3053         struct wmi_host_mem_chunks mem_chunks;
3054 } __packed;
3055
3056 /* _10x structure is from 10.X FW API */
3057 struct wmi_init_cmd_10x {
3058         struct wmi_resource_config_10x resource_config;
3059         struct wmi_host_mem_chunks mem_chunks;
3060 } __packed;
3061
3062 struct wmi_init_cmd_10_2 {
3063         struct wmi_resource_config_10_2 resource_config;
3064         struct wmi_host_mem_chunks mem_chunks;
3065 } __packed;
3066
3067 struct wmi_init_cmd_10_4 {
3068         struct wmi_resource_config_10_4 resource_config;
3069         struct wmi_host_mem_chunks mem_chunks;
3070 } __packed;
3071
3072 struct wmi_chan_list_entry {
3073         __le16 freq;
3074         u8 phy_mode; /* valid for 10.2 only */
3075         u8 reserved;
3076 } __packed;
3077
3078 /* TLV for channel list */
3079 struct wmi_chan_list {
3080         __le32 tag; /* WMI_CHAN_LIST_TAG */
3081         __le32 num_chan;
3082         struct wmi_chan_list_entry channel_list[0];
3083 } __packed;
3084
3085 struct wmi_bssid_list {
3086         __le32 tag; /* WMI_BSSID_LIST_TAG */
3087         __le32 num_bssid;
3088         struct wmi_mac_addr bssid_list[0];
3089 } __packed;
3090
3091 struct wmi_ie_data {
3092         __le32 tag; /* WMI_IE_TAG */
3093         __le32 ie_len;
3094         u8 ie_data[0];
3095 } __packed;
3096
3097 struct wmi_ssid {
3098         __le32 ssid_len;
3099         u8 ssid[32];
3100 } __packed;
3101
3102 struct wmi_ssid_list {
3103         __le32 tag; /* WMI_SSID_LIST_TAG */
3104         __le32 num_ssids;
3105         struct wmi_ssid ssids[0];
3106 } __packed;
3107
3108 /* prefix used by scan requestor ids on the host */
3109 #define WMI_HOST_SCAN_REQUESTOR_ID_PREFIX 0xA000
3110
3111 /* prefix used by scan request ids generated on the host */
3112 /* host cycles through the lower 12 bits to generate ids */
3113 #define WMI_HOST_SCAN_REQ_ID_PREFIX 0xA000
3114
3115 #define WLAN_SCAN_PARAMS_MAX_SSID    16
3116 #define WLAN_SCAN_PARAMS_MAX_BSSID   4
3117 #define WLAN_SCAN_PARAMS_MAX_IE_LEN  256
3118
3119 /* Values lower than this may be refused by some firmware revisions with a scan
3120  * completion with a timedout reason.
3121  */
3122 #define WMI_SCAN_CHAN_MIN_TIME_MSEC 40
3123
3124 /* Scan priority numbers must be sequential, starting with 0 */
3125 enum wmi_scan_priority {
3126         WMI_SCAN_PRIORITY_VERY_LOW = 0,
3127         WMI_SCAN_PRIORITY_LOW,
3128         WMI_SCAN_PRIORITY_MEDIUM,
3129         WMI_SCAN_PRIORITY_HIGH,
3130         WMI_SCAN_PRIORITY_VERY_HIGH,
3131         WMI_SCAN_PRIORITY_COUNT   /* number of priorities supported */
3132 };
3133
3134 struct wmi_start_scan_common {
3135         /* Scan ID */
3136         __le32 scan_id;
3137         /* Scan requestor ID */
3138         __le32 scan_req_id;
3139         /* VDEV id(interface) that is requesting scan */
3140         __le32 vdev_id;
3141         /* Scan Priority, input to scan scheduler */
3142         __le32 scan_priority;
3143         /* Scan events subscription */
3144         __le32 notify_scan_events;
3145         /* dwell time in msec on active channels */
3146         __le32 dwell_time_active;
3147         /* dwell time in msec on passive channels */
3148         __le32 dwell_time_passive;
3149         /*
3150          * min time in msec on the BSS channel,only valid if atleast one
3151          * VDEV is active
3152          */
3153         __le32 min_rest_time;
3154         /*
3155          * max rest time in msec on the BSS channel,only valid if at least
3156          * one VDEV is active
3157          */
3158         /*
3159          * the scanner will rest on the bss channel at least min_rest_time
3160          * after min_rest_time the scanner will start checking for tx/rx
3161          * activity on all VDEVs. if there is no activity the scanner will
3162          * switch to off channel. if there is activity the scanner will let
3163          * the radio on the bss channel until max_rest_time expires.at
3164          * max_rest_time scanner will switch to off channel irrespective of
3165          * activity. activity is determined by the idle_time parameter.
3166          */
3167         __le32 max_rest_time;
3168         /*
3169          * time before sending next set of probe requests.
3170          * The scanner keeps repeating probe requests transmission with
3171          * period specified by repeat_probe_time.
3172          * The number of probe requests specified depends on the ssid_list
3173          * and bssid_list
3174          */
3175         __le32 repeat_probe_time;
3176         /* time in msec between 2 consequetive probe requests with in a set. */
3177         __le32 probe_spacing_time;
3178         /*
3179          * data inactivity time in msec on bss channel that will be used by
3180          * scanner for measuring the inactivity.
3181          */
3182         __le32 idle_time;
3183         /* maximum time in msec allowed for scan  */
3184         __le32 max_scan_time;
3185         /*
3186          * delay in msec before sending first probe request after switching
3187          * to a channel
3188          */
3189         __le32 probe_delay;
3190         /* Scan control flags */
3191         __le32 scan_ctrl_flags;
3192 } __packed;
3193
3194 struct wmi_start_scan_tlvs {
3195         /* TLV parameters. These includes channel list, ssid list, bssid list,
3196          * extra ies.
3197          */
3198         u8 tlvs[0];
3199 } __packed;
3200
3201 struct wmi_start_scan_cmd {
3202         struct wmi_start_scan_common common;
3203         __le32 burst_duration_ms;
3204         struct wmi_start_scan_tlvs tlvs;
3205 } __packed;
3206
3207 /* This is the definition from 10.X firmware branch */
3208 struct wmi_10x_start_scan_cmd {
3209         struct wmi_start_scan_common common;
3210         struct wmi_start_scan_tlvs tlvs;
3211 } __packed;
3212
3213 struct wmi_ssid_arg {
3214         int len;
3215         const u8 *ssid;
3216 };
3217
3218 struct wmi_bssid_arg {
3219         const u8 *bssid;
3220 };
3221
3222 struct wmi_start_scan_arg {
3223         u32 scan_id;
3224         u32 scan_req_id;
3225         u32 vdev_id;
3226         u32 scan_priority;
3227         u32 notify_scan_events;
3228         u32 dwell_time_active;
3229         u32 dwell_time_passive;
3230         u32 min_rest_time;
3231         u32 max_rest_time;
3232         u32 repeat_probe_time;
3233         u32 probe_spacing_time;
3234         u32 idle_time;
3235         u32 max_scan_time;
3236         u32 probe_delay;
3237         u32 scan_ctrl_flags;
3238         u32 burst_duration_ms;
3239
3240         u32 ie_len;
3241         u32 n_channels;
3242         u32 n_ssids;
3243         u32 n_bssids;
3244
3245         u8 ie[WLAN_SCAN_PARAMS_MAX_IE_LEN];
3246         u16 channels[64];
3247         struct wmi_ssid_arg ssids[WLAN_SCAN_PARAMS_MAX_SSID];
3248         struct wmi_bssid_arg bssids[WLAN_SCAN_PARAMS_MAX_BSSID];
3249         struct wmi_mac_addr mac_addr;
3250         struct wmi_mac_addr mac_mask;
3251 };
3252
3253 /* scan control flags */
3254
3255 /* passively scan all channels including active channels */
3256 #define WMI_SCAN_FLAG_PASSIVE        0x1
3257 /* add wild card ssid probe request even though ssid_list is specified. */
3258 #define WMI_SCAN_ADD_BCAST_PROBE_REQ 0x2
3259 /* add cck rates to rates/xrate ie for the generated probe request */
3260 #define WMI_SCAN_ADD_CCK_RATES 0x4
3261 /* add ofdm rates to rates/xrate ie for the generated probe request */
3262 #define WMI_SCAN_ADD_OFDM_RATES 0x8
3263 /* To enable indication of Chan load and Noise floor to host */
3264 #define WMI_SCAN_CHAN_STAT_EVENT 0x10
3265 /* Filter Probe request frames  */
3266 #define WMI_SCAN_FILTER_PROBE_REQ 0x20
3267 /* When set, DFS channels will not be scanned */
3268 #define WMI_SCAN_BYPASS_DFS_CHN 0x40
3269 /* Different FW scan engine may choose to bail out on errors.
3270  * Allow the driver to have influence over that.
3271  */
3272 #define WMI_SCAN_CONTINUE_ON_ERROR 0x80
3273
3274 /* Use random MAC address for TA for Probe Request frame and add
3275  * OUI specified by WMI_SCAN_PROB_REQ_OUI_CMDID to the Probe Request frame.
3276  * if OUI is not set by WMI_SCAN_PROB_REQ_OUI_CMDID then the flag is ignored.
3277  */
3278 #define WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ   0x1000
3279
3280 /* WMI_SCAN_CLASS_MASK must be the same value as IEEE80211_SCAN_CLASS_MASK */
3281 #define WMI_SCAN_CLASS_MASK 0xFF000000
3282
3283 enum wmi_stop_scan_type {
3284         WMI_SCAN_STOP_ONE       = 0x00000000, /* stop by scan_id */
3285         WMI_SCAN_STOP_VDEV_ALL  = 0x01000000, /* stop by vdev_id */
3286         WMI_SCAN_STOP_ALL       = 0x04000000, /* stop all scans */
3287 };
3288
3289 struct wmi_stop_scan_cmd {
3290         __le32 scan_req_id;
3291         __le32 scan_id;
3292         __le32 req_type;
3293         __le32 vdev_id;
3294 } __packed;
3295
3296 struct wmi_stop_scan_arg {
3297         u32 req_id;
3298         enum wmi_stop_scan_type req_type;
3299         union {
3300                 u32 scan_id;
3301                 u32 vdev_id;
3302         } u;
3303 };
3304
3305 struct wmi_scan_chan_list_cmd {
3306         __le32 num_scan_chans;
3307         struct wmi_channel chan_info[0];
3308 } __packed;
3309
3310 struct wmi_scan_chan_list_arg {
3311         u32 n_channels;
3312         struct wmi_channel_arg *channels;
3313 };
3314
3315 enum wmi_bss_filter {
3316         WMI_BSS_FILTER_NONE = 0,        /* no beacons forwarded */
3317         WMI_BSS_FILTER_ALL,             /* all beacons forwarded */
3318         WMI_BSS_FILTER_PROFILE,         /* only beacons matching profile */
3319         WMI_BSS_FILTER_ALL_BUT_PROFILE, /* all but beacons matching profile */
3320         WMI_BSS_FILTER_CURRENT_BSS,     /* only beacons matching current BSS */
3321         WMI_BSS_FILTER_ALL_BUT_BSS,     /* all but beacons matching BSS */
3322         WMI_BSS_FILTER_PROBED_SSID,     /* beacons matching probed ssid */
3323         WMI_BSS_FILTER_LAST_BSS,        /* marker only */
3324 };
3325
3326 enum wmi_scan_event_type {
3327         WMI_SCAN_EVENT_STARTED              = BIT(0),
3328         WMI_SCAN_EVENT_COMPLETED            = BIT(1),
3329         WMI_SCAN_EVENT_BSS_CHANNEL          = BIT(2),
3330         WMI_SCAN_EVENT_FOREIGN_CHANNEL      = BIT(3),
3331         WMI_SCAN_EVENT_DEQUEUED             = BIT(4),
3332         /* possibly by high-prio scan */
3333         WMI_SCAN_EVENT_PREEMPTED            = BIT(5),
3334         WMI_SCAN_EVENT_START_FAILED         = BIT(6),
3335         WMI_SCAN_EVENT_RESTARTED            = BIT(7),
3336         WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT = BIT(8),
3337         WMI_SCAN_EVENT_MAX                  = BIT(15),
3338 };
3339
3340 enum wmi_scan_completion_reason {
3341         WMI_SCAN_REASON_COMPLETED,
3342         WMI_SCAN_REASON_CANCELLED,
3343         WMI_SCAN_REASON_PREEMPTED,
3344         WMI_SCAN_REASON_TIMEDOUT,
3345         WMI_SCAN_REASON_INTERNAL_FAILURE,
3346         WMI_SCAN_REASON_MAX,
3347 };
3348
3349 struct wmi_scan_event {
3350         __le32 event_type; /* %WMI_SCAN_EVENT_ */
3351         __le32 reason; /* %WMI_SCAN_REASON_ */
3352         __le32 channel_freq; /* only valid for WMI_SCAN_EVENT_FOREIGN_CHANNEL */
3353         __le32 scan_req_id;
3354         __le32 scan_id;
3355         __le32 vdev_id;
3356 } __packed;
3357
3358 /*
3359  * This defines how much headroom is kept in the
3360  * receive frame between the descriptor and the
3361  * payload, in order for the WMI PHY error and
3362  * management handler to insert header contents.
3363  *
3364  * This is in bytes.
3365  */
3366 #define WMI_MGMT_RX_HDR_HEADROOM    52
3367
3368 /*
3369  * This event will be used for sending scan results
3370  * as well as rx mgmt frames to the host. The rx buffer
3371  * will be sent as part of this WMI event. It would be a
3372  * good idea to pass all the fields in the RX status
3373  * descriptor up to the host.
3374  */
3375 struct wmi_mgmt_rx_hdr_v1 {
3376         __le32 channel;
3377         __le32 snr;
3378         __le32 rate;
3379         __le32 phy_mode;
3380         __le32 buf_len;
3381         __le32 status; /* %WMI_RX_STATUS_ */
3382 } __packed;
3383
3384 struct wmi_mgmt_rx_hdr_v2 {
3385         struct wmi_mgmt_rx_hdr_v1 v1;
3386         __le32 rssi_ctl[4];
3387 } __packed;
3388
3389 struct wmi_mgmt_rx_event_v1 {
3390         struct wmi_mgmt_rx_hdr_v1 hdr;
3391         u8 buf[0];
3392 } __packed;
3393
3394 struct wmi_mgmt_rx_event_v2 {
3395         struct wmi_mgmt_rx_hdr_v2 hdr;
3396         u8 buf[0];
3397 } __packed;
3398
3399 struct wmi_10_4_mgmt_rx_hdr {
3400         __le32 channel;
3401         __le32 snr;
3402             u8 rssi_ctl[4];
3403         __le32 rate;
3404         __le32 phy_mode;
3405         __le32 buf_len;
3406         __le32 status;
3407 } __packed;
3408
3409 struct wmi_10_4_mgmt_rx_event {
3410         struct wmi_10_4_mgmt_rx_hdr hdr;
3411         u8 buf[0];
3412 } __packed;
3413
3414 struct wmi_mgmt_rx_ext_info {
3415         __le64 rx_mac_timestamp;
3416 } __packed __aligned(4);
3417
3418 #define WMI_RX_STATUS_OK                        0x00
3419 #define WMI_RX_STATUS_ERR_CRC                   0x01
3420 #define WMI_RX_STATUS_ERR_DECRYPT               0x08
3421 #define WMI_RX_STATUS_ERR_MIC                   0x10
3422 #define WMI_RX_STATUS_ERR_KEY_CACHE_MISS        0x20
3423 /* Extension data at the end of mgmt frame */
3424 #define WMI_RX_STATUS_EXT_INFO          0x40
3425
3426 #define PHY_ERROR_GEN_SPECTRAL_SCAN             0x26
3427 #define PHY_ERROR_GEN_FALSE_RADAR_EXT           0x24
3428 #define PHY_ERROR_GEN_RADAR                     0x05
3429
3430 #define PHY_ERROR_10_4_RADAR_MASK               0x4
3431 #define PHY_ERROR_10_4_SPECTRAL_SCAN_MASK       0x4000000
3432
3433 enum phy_err_type {
3434         PHY_ERROR_UNKNOWN,
3435         PHY_ERROR_SPECTRAL_SCAN,
3436         PHY_ERROR_FALSE_RADAR_EXT,
3437         PHY_ERROR_RADAR
3438 };
3439
3440 struct wmi_phyerr {
3441         __le32 tsf_timestamp;
3442         __le16 freq1;
3443         __le16 freq2;
3444         u8 rssi_combined;
3445         u8 chan_width_mhz;
3446         u8 phy_err_code;
3447         u8 rsvd0;
3448         __le32 rssi_chains[4];
3449         __le16 nf_chains[4];
3450         __le32 buf_len;
3451         u8 buf[0];
3452 } __packed;
3453
3454 struct wmi_phyerr_event {
3455         __le32 num_phyerrs;
3456         __le32 tsf_l32;
3457         __le32 tsf_u32;
3458         struct wmi_phyerr phyerrs[0];
3459 } __packed;
3460
3461 struct wmi_10_4_phyerr_event {
3462         __le32 tsf_l32;
3463         __le32 tsf_u32;
3464         __le16 freq1;
3465         __le16 freq2;
3466         u8 rssi_combined;
3467         u8 chan_width_mhz;
3468         u8 phy_err_code;
3469         u8 rsvd0;
3470         __le32 rssi_chains[4];
3471         __le16 nf_chains[4];
3472         __le32 phy_err_mask[2];
3473         __le32 tsf_timestamp;
3474         __le32 buf_len;
3475         u8 buf[0];
3476 } __packed;
3477
3478 struct wmi_radar_found_info {
3479         __le32 pri_min;
3480         __le32 pri_max;
3481         __le32 width_min;
3482         __le32 width_max;
3483         __le32 sidx_min;
3484         __le32 sidx_max;
3485 } __packed;
3486
3487 enum wmi_radar_confirmation_status {
3488         /* Detected radar was due to SW pulses */
3489         WMI_SW_RADAR_DETECTED    = 0,
3490
3491         WMI_RADAR_DETECTION_FAIL = 1,
3492
3493         /* Real radar detected */
3494         WMI_HW_RADAR_DETECTED    = 2,
3495 };
3496
3497 #define PHYERR_TLV_SIG                          0xBB
3498 #define PHYERR_TLV_TAG_SEARCH_FFT_REPORT        0xFB
3499 #define PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY      0xF8
3500 #define PHYERR_TLV_TAG_SPECTRAL_SUMMARY_REPORT  0xF9
3501
3502 struct phyerr_radar_report {
3503         __le32 reg0; /* RADAR_REPORT_REG0_* */
3504         __le32 reg1; /* RADAR_REPORT_REG1_* */
3505 } __packed;
3506
3507 #define RADAR_REPORT_REG0_PULSE_IS_CHIRP_MASK           0x80000000
3508 #define RADAR_REPORT_REG0_PULSE_IS_CHIRP_LSB            31
3509
3510 #define RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH_MASK       0x40000000
3511 #define RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH_LSB        30
3512
3513 #define RADAR_REPORT_REG0_AGC_TOTAL_GAIN_MASK           0x3FF00000
3514 #define RADAR_REPORT_REG0_AGC_TOTAL_GAIN_LSB            20
3515
3516 #define RADAR_REPORT_REG0_PULSE_DELTA_DIFF_MASK         0x000F0000
3517 #define RADAR_REPORT_REG0_PULSE_DELTA_DIFF_LSB          16
3518
3519 #define RADAR_REPORT_REG0_PULSE_DELTA_PEAK_MASK         0x0000FC00
3520 #define RADAR_REPORT_REG0_PULSE_DELTA_PEAK_LSB          10
3521
3522 #define RADAR_REPORT_REG0_PULSE_SIDX_MASK               0x000003FF
3523 #define RADAR_REPORT_REG0_PULSE_SIDX_LSB                0
3524
3525 #define RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID_MASK     0x80000000
3526 #define RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID_LSB      31
3527
3528 #define RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN_MASK        0x7F000000
3529 #define RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN_LSB         24
3530
3531 #define RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK_MASK       0x00FF0000
3532 #define RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK_LSB        16
3533
3534 #define RADAR_REPORT_REG1_PULSE_TSF_OFFSET_MASK         0x0000FF00
3535 #define RADAR_REPORT_REG1_PULSE_TSF_OFFSET_LSB          8
3536
3537 #define RADAR_REPORT_REG1_PULSE_DUR_MASK                0x000000FF
3538 #define RADAR_REPORT_REG1_PULSE_DUR_LSB                 0
3539
3540 struct phyerr_fft_report {
3541         __le32 reg0; /* SEARCH_FFT_REPORT_REG0_ * */
3542         __le32 reg1; /* SEARCH_FFT_REPORT_REG1_ * */
3543 } __packed;
3544
3545 #define SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB_MASK       0xFF800000
3546 #define SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB_LSB        23
3547
3548 #define SEARCH_FFT_REPORT_REG0_BASE_PWR_DB_MASK         0x007FC000
3549 #define SEARCH_FFT_REPORT_REG0_BASE_PWR_DB_LSB          14
3550
3551 #define SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX_MASK         0x00003000
3552 #define SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX_LSB          12
3553
3554 #define SEARCH_FFT_REPORT_REG0_PEAK_SIDX_MASK           0x00000FFF
3555 #define SEARCH_FFT_REPORT_REG0_PEAK_SIDX_LSB            0
3556
3557 #define SEARCH_FFT_REPORT_REG1_RELPWR_DB_MASK           0xFC000000
3558 #define SEARCH_FFT_REPORT_REG1_RELPWR_DB_LSB            26
3559
3560 #define SEARCH_FFT_REPORT_REG1_AVGPWR_DB_MASK           0x03FC0000
3561 #define SEARCH_FFT_REPORT_REG1_AVGPWR_DB_LSB            18
3562
3563 #define SEARCH_FFT_REPORT_REG1_PEAK_MAG_MASK            0x0003FF00
3564 #define SEARCH_FFT_REPORT_REG1_PEAK_MAG_LSB             8
3565
3566 #define SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB_MASK     0x000000FF
3567 #define SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB_LSB      0
3568
3569 struct phyerr_tlv {
3570         __le16 len;
3571         u8 tag;
3572         u8 sig;
3573 } __packed;
3574
3575 #define DFS_RSSI_POSSIBLY_FALSE                 50
3576 #define DFS_PEAK_MAG_THOLD_POSSIBLY_FALSE       40
3577
3578 struct wmi_mgmt_tx_hdr {
3579         __le32 vdev_id;
3580         struct wmi_mac_addr peer_macaddr;
3581         __le32 tx_rate;
3582         __le32 tx_power;
3583         __le32 buf_len;
3584 } __packed;
3585
3586 struct wmi_mgmt_tx_cmd {
3587         struct wmi_mgmt_tx_hdr hdr;
3588         u8 buf[0];
3589 } __packed;
3590
3591 struct wmi_echo_event {
3592         __le32 value;
3593 } __packed;
3594
3595 struct wmi_echo_cmd {
3596         __le32 value;
3597 } __packed;
3598
3599 struct wmi_pdev_set_regdomain_cmd {
3600         __le32 reg_domain;
3601         __le32 reg_domain_2G;
3602         __le32 reg_domain_5G;
3603         __le32 conformance_test_limit_2G;
3604         __le32 conformance_test_limit_5G;
3605 } __packed;
3606
3607 enum wmi_dfs_region {
3608         /* Uninitialized dfs domain */
3609         WMI_UNINIT_DFS_DOMAIN = 0,
3610
3611         /* FCC3 dfs domain */
3612         WMI_FCC_DFS_DOMAIN = 1,
3613
3614         /* ETSI dfs domain */
3615         WMI_ETSI_DFS_DOMAIN = 2,
3616
3617         /*Japan dfs domain */
3618         WMI_MKK4_DFS_DOMAIN = 3,
3619 };
3620
3621 struct wmi_pdev_set_regdomain_cmd_10x {
3622         __le32 reg_domain;
3623         __le32 reg_domain_2G;
3624         __le32 reg_domain_5G;
3625         __le32 conformance_test_limit_2G;
3626         __le32 conformance_test_limit_5G;
3627
3628         /* dfs domain from wmi_dfs_region */
3629         __le32 dfs_domain;
3630 } __packed;
3631
3632 /* Command to set/unset chip in quiet mode */
3633 struct wmi_pdev_set_quiet_cmd {
3634         /* period in TUs */
3635         __le32 period;
3636
3637         /* duration in TUs */
3638         __le32 duration;
3639
3640         /* offset in TUs */
3641         __le32 next_start;
3642
3643         /* enable/disable */
3644         __le32 enabled;
3645 } __packed;
3646
3647 /*
3648  * 802.11g protection mode.
3649  */
3650 enum ath10k_protmode {
3651         ATH10K_PROT_NONE     = 0,    /* no protection */
3652         ATH10K_PROT_CTSONLY  = 1,    /* CTS to self */
3653         ATH10K_PROT_RTSCTS   = 2,    /* RTS-CTS */
3654 };
3655
3656 enum wmi_rtscts_profile {
3657         WMI_RTSCTS_FOR_NO_RATESERIES = 0,
3658         WMI_RTSCTS_FOR_SECOND_RATESERIES,
3659         WMI_RTSCTS_ACROSS_SW_RETRIES
3660 };
3661
3662 #define WMI_RTSCTS_ENABLED              1
3663 #define WMI_RTSCTS_SET_MASK             0x0f
3664 #define WMI_RTSCTS_SET_LSB              0
3665
3666 #define WMI_RTSCTS_PROFILE_MASK         0xf0
3667 #define WMI_RTSCTS_PROFILE_LSB          4
3668
3669 enum wmi_beacon_gen_mode {
3670         WMI_BEACON_STAGGERED_MODE = 0,
3671         WMI_BEACON_BURST_MODE = 1
3672 };
3673
3674 enum wmi_csa_event_ies_present_flag {
3675         WMI_CSA_IE_PRESENT = 0x00000001,
3676         WMI_XCSA_IE_PRESENT = 0x00000002,
3677         WMI_WBW_IE_PRESENT = 0x00000004,
3678         WMI_CSWARP_IE_PRESENT = 0x00000008,
3679 };
3680
3681 /* wmi CSA receive event from beacon frame */
3682 struct wmi_csa_event {
3683         __le32 i_fc_dur;
3684         /* Bit 0-15: FC */
3685         /* Bit 16-31: DUR */
3686         struct wmi_mac_addr i_addr1;
3687         struct wmi_mac_addr i_addr2;
3688         __le32 csa_ie[2];
3689         __le32 xcsa_ie[2];
3690         __le32 wb_ie[2];
3691         __le32 cswarp_ie;
3692         __le32 ies_present_flag; /* wmi_csa_event_ies_present_flag */
3693 } __packed;
3694
3695 /* the definition of different PDEV parameters */
3696 #define PDEV_DEFAULT_STATS_UPDATE_PERIOD    500
3697 #define VDEV_DEFAULT_STATS_UPDATE_PERIOD    500
3698 #define PEER_DEFAULT_STATS_UPDATE_PERIOD    500
3699
3700 struct wmi_pdev_param_map {
3701         u32 tx_chain_mask;
3702         u32 rx_chain_mask;
3703         u32 txpower_limit2g;
3704         u32 txpower_limit5g;
3705         u32 txpower_scale;
3706         u32 beacon_gen_mode;
3707         u32 beacon_tx_mode;
3708         u32 resmgr_offchan_mode;
3709         u32 protection_mode;
3710         u32 dynamic_bw;
3711         u32 non_agg_sw_retry_th;
3712         u32 agg_sw_retry_th;
3713         u32 sta_kickout_th;
3714         u32 ac_aggrsize_scaling;
3715         u32 ltr_enable;
3716         u32 ltr_ac_latency_be;
3717         u32 ltr_ac_latency_bk;
3718         u32 ltr_ac_latency_vi;
3719         u32 ltr_ac_latency_vo;
3720         u32 ltr_ac_latency_timeout;
3721         u32 ltr_sleep_override;
3722         u32 ltr_rx_override;
3723         u32 ltr_tx_activity_timeout;
3724         u32 l1ss_enable;
3725         u32 dsleep_enable;
3726         u32 pcielp_txbuf_flush;
3727         u32 pcielp_txbuf_watermark;
3728         u32 pcielp_txbuf_tmo_en;
3729         u32 pcielp_txbuf_tmo_value;
3730         u32 pdev_stats_update_period;
3731         u32 vdev_stats_update_period;
3732         u32 peer_stats_update_period;
3733         u32 bcnflt_stats_update_period;
3734         u32 pmf_qos;
3735         u32 arp_ac_override;
3736         u32 dcs;
3737         u32 ani_enable;
3738         u32 ani_poll_period;
3739         u32 ani_listen_period;
3740         u32 ani_ofdm_level;
3741         u32 ani_cck_level;
3742         u32 dyntxchain;
3743         u32 proxy_sta;
3744         u32 idle_ps_config;
3745         u32 power_gating_sleep;
3746         u32 fast_channel_reset;
3747         u32 burst_dur;
3748         u32 burst_enable;
3749         u32 cal_period;
3750         u32 aggr_burst;
3751         u32 rx_decap_mode;
3752         u32 smart_antenna_default_antenna;
3753         u32 igmpmld_override;
3754         u32 igmpmld_tid;
3755         u32 antenna_gain;
3756         u32 rx_filter;
3757         u32 set_mcast_to_ucast_tid;
3758         u32 proxy_sta_mode;
3759         u32 set_mcast2ucast_mode;
3760         u32 set_mcast2ucast_buffer;
3761         u32 remove_mcast2ucast_buffer;
3762         u32 peer_sta_ps_statechg_enable;
3763         u32 igmpmld_ac_override;
3764         u32 block_interbss;
3765         u32 set_disable_reset_cmdid;
3766         u32 set_msdu_ttl_cmdid;
3767         u32 set_ppdu_duration_cmdid;
3768         u32 txbf_sound_period_cmdid;
3769         u32 set_promisc_mode_cmdid;
3770         u32 set_burst_mode_cmdid;
3771         u32 en_stats;
3772         u32 mu_group_policy;
3773         u32 noise_detection;
3774         u32 noise_threshold;
3775         u32 dpd_enable;
3776         u32 set_mcast_bcast_echo;
3777         u32 atf_strict_sch;
3778         u32 atf_sched_duration;
3779         u32 ant_plzn;
3780         u32 mgmt_retry_limit;
3781         u32 sensitivity_level;
3782         u32 signed_txpower_2g;
3783         u32 signed_txpower_5g;
3784         u32 enable_per_tid_amsdu;
3785         u32 enable_per_tid_ampdu;
3786         u32 cca_threshold;
3787         u32 rts_fixed_rate;
3788         u32 pdev_reset;
3789         u32 wapi_mbssid_offset;
3790         u32 arp_srcaddr;
3791         u32 arp_dstaddr;
3792         u32 enable_btcoex;
3793 };
3794
3795 #define WMI_PDEV_PARAM_UNSUPPORTED 0
3796
3797 enum wmi_pdev_param {
3798         /* TX chain mask */
3799         WMI_PDEV_PARAM_TX_CHAIN_MASK = 0x1,
3800         /* RX chain mask */
3801         WMI_PDEV_PARAM_RX_CHAIN_MASK,
3802         /* TX power limit for 2G Radio */
3803         WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
3804         /* TX power limit for 5G Radio */
3805         WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
3806         /* TX power scale */
3807         WMI_PDEV_PARAM_TXPOWER_SCALE,
3808         /* Beacon generation mode . 0: host, 1: target   */
3809         WMI_PDEV_PARAM_BEACON_GEN_MODE,
3810         /* Beacon generation mode . 0: staggered 1: bursted   */
3811         WMI_PDEV_PARAM_BEACON_TX_MODE,
3812         /*
3813          * Resource manager off chan mode .
3814          * 0: turn off off chan mode. 1: turn on offchan mode
3815          */
3816         WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
3817         /*
3818          * Protection mode:
3819          * 0: no protection 1:use CTS-to-self 2: use RTS/CTS
3820          */
3821         WMI_PDEV_PARAM_PROTECTION_MODE,
3822         /*
3823          * Dynamic bandwidth - 0: disable, 1: enable
3824          *
3825          * When enabled HW rate control tries different bandwidths when
3826          * retransmitting frames.
3827          */
3828         WMI_PDEV_PARAM_DYNAMIC_BW,
3829         /* Non aggregrate/ 11g sw retry threshold.0-disable */
3830         WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
3831         /* aggregrate sw retry threshold. 0-disable*/
3832         WMI_PDEV_PARAM_AGG_SW_RETRY_TH,
3833         /* Station kickout threshold (non of consecutive failures).0-disable */
3834         WMI_PDEV_PARAM_STA_KICKOUT_TH,
3835         /* Aggerate size scaling configuration per AC */
3836         WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING,
3837         /* LTR enable */
3838         WMI_PDEV_PARAM_LTR_ENABLE,
3839         /* LTR latency for BE, in us */
3840         WMI_PDEV_PARAM_LTR_AC_LATENCY_BE,
3841         /* LTR latency for BK, in us */
3842         WMI_PDEV_PARAM_LTR_AC_LATENCY_BK,
3843         /* LTR latency for VI, in us */
3844         WMI_PDEV_PARAM_LTR_AC_LATENCY_VI,
3845         /* LTR latency for VO, in us  */
3846         WMI_PDEV_PARAM_LTR_AC_LATENCY_VO,
3847         /* LTR AC latency timeout, in ms */
3848         WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
3849         /* LTR platform latency override, in us */
3850         WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
3851         /* LTR-RX override, in us */
3852         WMI_PDEV_PARAM_LTR_RX_OVERRIDE,
3853         /* Tx activity timeout for LTR, in us */
3854         WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
3855         /* L1SS state machine enable */
3856         WMI_PDEV_PARAM_L1SS_ENABLE,
3857         /* Deep sleep state machine enable */
3858         WMI_PDEV_PARAM_DSLEEP_ENABLE,
3859         /* RX buffering flush enable */
3860         WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH,
3861         /* RX buffering matermark */
3862         WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK,
3863         /* RX buffering timeout enable */
3864         WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN,
3865         /* RX buffering timeout value */
3866         WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE,
3867         /* pdev level stats update period in ms */
3868         WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
3869         /* vdev level stats update period in ms */
3870         WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
3871         /* peer level stats update period in ms */
3872         WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
3873         /* beacon filter status update period */
3874         WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
3875         /* QOS Mgmt frame protection MFP/PMF 0: disable, 1: enable */
3876         WMI_PDEV_PARAM_PMF_QOS,
3877         /* Access category on which ARP frames are sent */
3878         WMI_PDEV_PARAM_ARP_AC_OVERRIDE,
3879         /* DCS configuration */
3880         WMI_PDEV_PARAM_DCS,
3881         /* Enable/Disable ANI on target */
3882         WMI_PDEV_PARAM_ANI_ENABLE,
3883         /* configure the ANI polling period */
3884         WMI_PDEV_PARAM_ANI_POLL_PERIOD,
3885         /* configure the ANI listening period */
3886         WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
3887         /* configure OFDM immunity level */
3888         WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
3889         /* configure CCK immunity level */
3890         WMI_PDEV_PARAM_ANI_CCK_LEVEL,
3891         /* Enable/Disable CDD for 1x1 STAs in rate control module */
3892         WMI_PDEV_PARAM_DYNTXCHAIN,
3893         /* Enable/Disable proxy STA */
3894         WMI_PDEV_PARAM_PROXY_STA,
3895         /* Enable/Disable low power state when all VDEVs are inactive/idle. */
3896         WMI_PDEV_PARAM_IDLE_PS_CONFIG,
3897         /* Enable/Disable power gating sleep */
3898         WMI_PDEV_PARAM_POWER_GATING_SLEEP,
3899 };
3900
3901 enum wmi_10x_pdev_param {
3902         /* TX chian mask */
3903         WMI_10X_PDEV_PARAM_TX_CHAIN_MASK = 0x1,
3904         /* RX chian mask */
3905         WMI_10X_PDEV_PARAM_RX_CHAIN_MASK,
3906         /* TX power limit for 2G Radio */
3907         WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G,
3908         /* TX power limit for 5G Radio */
3909         WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G,
3910         /* TX power scale */
3911         WMI_10X_PDEV_PARAM_TXPOWER_SCALE,
3912         /* Beacon generation mode . 0: host, 1: target   */
3913         WMI_10X_PDEV_PARAM_BEACON_GEN_MODE,
3914         /* Beacon generation mode . 0: staggered 1: bursted   */
3915         WMI_10X_PDEV_PARAM_BEACON_TX_MODE,
3916         /*
3917          * Resource manager off chan mode .
3918          * 0: turn off off chan mode. 1: turn on offchan mode
3919          */
3920         WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
3921         /*
3922          * Protection mode:
3923          * 0: no protection 1:use CTS-to-self 2: use RTS/CTS
3924          */
3925         WMI_10X_PDEV_PARAM_PROTECTION_MODE,
3926         /* Dynamic bandwidth 0: disable 1: enable */
3927         WMI_10X_PDEV_PARAM_DYNAMIC_BW,
3928         /* Non aggregrate/ 11g sw retry threshold.0-disable */
3929         WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
3930         /* aggregrate sw retry threshold. 0-disable*/
3931         WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH,
3932         /* Station kickout threshold (non of consecutive failures).0-disable */
3933         WMI_10X_PDEV_PARAM_STA_KICKOUT_TH,
3934         /* Aggerate size scaling configuration per AC */
3935         WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING,
3936         /* LTR enable */
3937         WMI_10X_PDEV_PARAM_LTR_ENABLE,
3938         /* LTR latency for BE, in us */
3939         WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE,
3940         /* LTR latency for BK, in us */
3941         WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK,
3942         /* LTR latency for VI, in us */
3943         WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI,
3944         /* LTR latency for VO, in us  */
3945         WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO,
3946         /* LTR AC latency timeout, in ms */
3947         WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
3948         /* LTR platform latency override, in us */
3949         WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
3950         /* LTR-RX override, in us */
3951         WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE,
3952         /* Tx activity timeout for LTR, in us */
3953         WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
3954         /* L1SS state machine enable */
3955         WMI_10X_PDEV_PARAM_L1SS_ENABLE,
3956         /* Deep sleep state machine enable */
3957         WMI_10X_PDEV_PARAM_DSLEEP_ENABLE,
3958         /* pdev level stats update period in ms */
3959         WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
3960         /* vdev level stats update period in ms */
3961         WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
3962         /* peer level stats update period in ms */
3963         WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
3964         /* beacon filter status update period */
3965         WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
3966         /* QOS Mgmt frame protection MFP/PMF 0: disable, 1: enable */
3967         WMI_10X_PDEV_PARAM_PMF_QOS,
3968         /* Access category on which ARP and DHCP frames are sent */
3969         WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE,
3970         /* DCS configuration */
3971         WMI_10X_PDEV_PARAM_DCS,
3972         /* Enable/Disable ANI on target */
3973         WMI_10X_PDEV_PARAM_ANI_ENABLE,
3974         /* configure the ANI polling period */
3975         WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD,
3976         /* configure the ANI listening period */
3977         WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD,
3978         /* configure OFDM immunity level */
3979         WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL,
3980         /* configure CCK immunity level */
3981         WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL,
3982         /* Enable/Disable CDD for 1x1 STAs in rate control module */
3983         WMI_10X_PDEV_PARAM_DYNTXCHAIN,
3984         /* Enable/Disable Fast channel reset*/
3985         WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET,
3986         /* Set Bursting DUR */
3987         WMI_10X_PDEV_PARAM_BURST_DUR,
3988         /* Set Bursting Enable*/
3989         WMI_10X_PDEV_PARAM_BURST_ENABLE,
3990
3991         /* following are available as of firmware 10.2 */
3992         WMI_10X_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA,
3993         WMI_10X_PDEV_PARAM_IGMPMLD_OVERRIDE,
3994         WMI_10X_PDEV_PARAM_IGMPMLD_TID,
3995         WMI_10X_PDEV_PARAM_ANTENNA_GAIN,
3996         WMI_10X_PDEV_PARAM_RX_DECAP_MODE,
3997         WMI_10X_PDEV_PARAM_RX_FILTER,
3998         WMI_10X_PDEV_PARAM_SET_MCAST_TO_UCAST_TID,
3999         WMI_10X_PDEV_PARAM_PROXY_STA_MODE,
4000         WMI_10X_PDEV_PARAM_SET_MCAST2UCAST_MODE,
4001         WMI_10X_PDEV_PARAM_SET_MCAST2UCAST_BUFFER,
4002         WMI_10X_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER,
4003         WMI_10X_PDEV_PARAM_PEER_STA_PS_STATECHG_ENABLE,
4004         WMI_10X_PDEV_PARAM_RTS_FIXED_RATE,
4005         WMI_10X_PDEV_PARAM_CAL_PERIOD,
4006         WMI_10X_PDEV_PARAM_ATF_STRICT_SCH,
4007         WMI_10X_PDEV_PARAM_ATF_SCHED_DURATION,
4008         WMI_10X_PDEV_PARAM_SET_PROMISC_MODE_CMDID,
4009         WMI_10X_PDEV_PARAM_PDEV_RESET
4010 };
4011
4012 enum wmi_10_4_pdev_param {
4013         WMI_10_4_PDEV_PARAM_TX_CHAIN_MASK = 0x1,
4014         WMI_10_4_PDEV_PARAM_RX_CHAIN_MASK,
4015         WMI_10_4_PDEV_PARAM_TXPOWER_LIMIT2G,
4016         WMI_10_4_PDEV_PARAM_TXPOWER_LIMIT5G,
4017         WMI_10_4_PDEV_PARAM_TXPOWER_SCALE,
4018         WMI_10_4_PDEV_PARAM_BEACON_GEN_MODE,
4019         WMI_10_4_PDEV_PARAM_BEACON_TX_MODE,
4020         WMI_10_4_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
4021         WMI_10_4_PDEV_PARAM_PROTECTION_MODE,
4022         WMI_10_4_PDEV_PARAM_DYNAMIC_BW,
4023         WMI_10_4_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
4024         WMI_10_4_PDEV_PARAM_AGG_SW_RETRY_TH,
4025         WMI_10_4_PDEV_PARAM_STA_KICKOUT_TH,
4026         WMI_10_4_PDEV_PARAM_AC_AGGRSIZE_SCALING,
4027         WMI_10_4_PDEV_PARAM_LTR_ENABLE,
4028         WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_BE,
4029         WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_BK,
4030         WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_VI,
4031         WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_VO,
4032         WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
4033         WMI_10_4_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
4034         WMI_10_4_PDEV_PARAM_LTR_RX_OVERRIDE,
4035         WMI_10_4_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
4036         WMI_10_4_PDEV_PARAM_L1SS_ENABLE,
4037         WMI_10_4_PDEV_PARAM_DSLEEP_ENABLE,
4038         WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_FLUSH,
4039         WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_WATERMARK,
4040         WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_TMO_EN,
4041         WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE,
4042         WMI_10_4_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
4043         WMI_10_4_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
4044         WMI_10_4_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
4045         WMI_10_4_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
4046         WMI_10_4_PDEV_PARAM_PMF_QOS,
4047         WMI_10_4_PDEV_PARAM_ARP_AC_OVERRIDE,
4048         WMI_10_4_PDEV_PARAM_DCS,
4049         WMI_10_4_PDEV_PARAM_ANI_ENABLE,
4050         WMI_10_4_PDEV_PARAM_ANI_POLL_PERIOD,
4051         WMI_10_4_PDEV_PARAM_ANI_LISTEN_PERIOD,
4052         WMI_10_4_PDEV_PARAM_ANI_OFDM_LEVEL,
4053         WMI_10_4_PDEV_PARAM_ANI_CCK_LEVEL,
4054         WMI_10_4_PDEV_PARAM_DYNTXCHAIN,
4055         WMI_10_4_PDEV_PARAM_PROXY_STA,
4056         WMI_10_4_PDEV_PARAM_IDLE_PS_CONFIG,
4057         WMI_10_4_PDEV_PARAM_POWER_GATING_SLEEP,
4058         WMI_10_4_PDEV_PARAM_AGGR_BURST,
4059         WMI_10_4_PDEV_PARAM_RX_DECAP_MODE,
4060         WMI_10_4_PDEV_PARAM_FAST_CHANNEL_RESET,
4061         WMI_10_4_PDEV_PARAM_BURST_DUR,
4062         WMI_10_4_PDEV_PARAM_BURST_ENABLE,
4063         WMI_10_4_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA,
4064         WMI_10_4_PDEV_PARAM_IGMPMLD_OVERRIDE,
4065         WMI_10_4_PDEV_PARAM_IGMPMLD_TID,
4066         WMI_10_4_PDEV_PARAM_ANTENNA_GAIN,
4067         WMI_10_4_PDEV_PARAM_RX_FILTER,
4068         WMI_10_4_PDEV_SET_MCAST_TO_UCAST_TID,
4069         WMI_10_4_PDEV_PARAM_PROXY_STA_MODE,
4070         WMI_10_4_PDEV_PARAM_SET_MCAST2UCAST_MODE,
4071         WMI_10_4_PDEV_PARAM_SET_MCAST2UCAST_BUFFER,
4072         WMI_10_4_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER,
4073         WMI_10_4_PDEV_PEER_STA_PS_STATECHG_ENABLE,
4074         WMI_10_4_PDEV_PARAM_IGMPMLD_AC_OVERRIDE,
4075         WMI_10_4_PDEV_PARAM_BLOCK_INTERBSS,
4076         WMI_10_4_PDEV_PARAM_SET_DISABLE_RESET_CMDID,
4077         WMI_10_4_PDEV_PARAM_SET_MSDU_TTL_CMDID,
4078         WMI_10_4_PDEV_PARAM_SET_PPDU_DURATION_CMDID,
4079         WMI_10_4_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID,
4080         WMI_10_4_PDEV_PARAM_SET_PROMISC_MODE_CMDID,
4081         WMI_10_4_PDEV_PARAM_SET_BURST_MODE_CMDID,
4082         WMI_10_4_PDEV_PARAM_EN_STATS,
4083         WMI_10_4_PDEV_PARAM_MU_GROUP_POLICY,
4084         WMI_10_4_PDEV_PARAM_NOISE_DETECTION,
4085         WMI_10_4_PDEV_PARAM_NOISE_THRESHOLD,
4086         WMI_10_4_PDEV_PARAM_DPD_ENABLE,
4087         WMI_10_4_PDEV_PARAM_SET_MCAST_BCAST_ECHO,
4088         WMI_10_4_PDEV_PARAM_ATF_STRICT_SCH,
4089         WMI_10_4_PDEV_PARAM_ATF_SCHED_DURATION,
4090         WMI_10_4_PDEV_PARAM_ANT_PLZN,
4091         WMI_10_4_PDEV_PARAM_MGMT_RETRY_LIMIT,
4092         WMI_10_4_PDEV_PARAM_SENSITIVITY_LEVEL,
4093         WMI_10_4_PDEV_PARAM_SIGNED_TXPOWER_2G,
4094         WMI_10_4_PDEV_PARAM_SIGNED_TXPOWER_5G,
4095         WMI_10_4_PDEV_PARAM_ENABLE_PER_TID_AMSDU,
4096         WMI_10_4_PDEV_PARAM_ENABLE_PER_TID_AMPDU,
4097         WMI_10_4_PDEV_PARAM_CCA_THRESHOLD,
4098         WMI_10_4_PDEV_PARAM_RTS_FIXED_RATE,
4099         WMI_10_4_PDEV_PARAM_CAL_PERIOD,
4100         WMI_10_4_PDEV_PARAM_PDEV_RESET,
4101         WMI_10_4_PDEV_PARAM_WAPI_MBSSID_OFFSET,
4102         WMI_10_4_PDEV_PARAM_ARP_SRCADDR,
4103         WMI_10_4_PDEV_PARAM_ARP_DSTADDR,
4104         WMI_10_4_PDEV_PARAM_TXPOWER_DECR_DB,
4105         WMI_10_4_PDEV_PARAM_RX_BATCHMODE,
4106         WMI_10_4_PDEV_PARAM_PACKET_AGGR_DELAY,
4107         WMI_10_4_PDEV_PARAM_ATF_OBSS_NOISE_SCH,
4108         WMI_10_4_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR,
4109         WMI_10_4_PDEV_PARAM_CUST_TXPOWER_SCALE,
4110         WMI_10_4_PDEV_PARAM_ATF_DYNAMIC_ENABLE,
4111         WMI_10_4_PDEV_PARAM_ATF_SSID_GROUP_POLICY,
4112         WMI_10_4_PDEV_PARAM_ENABLE_BTCOEX,
4113 };
4114
4115 struct wmi_pdev_set_param_cmd {
4116         __le32 param_id;
4117         __le32 param_value;
4118 } __packed;
4119
4120 struct wmi_pdev_set_base_macaddr_cmd {
4121         struct wmi_mac_addr mac_addr;
4122 } __packed;
4123
4124 /* valid period is 1 ~ 60000ms, unit in millisecond */
4125 #define WMI_PDEV_PARAM_CAL_PERIOD_MAX 60000
4126
4127 struct wmi_pdev_get_tpc_config_cmd {
4128         /* parameter   */
4129         __le32 param;
4130 } __packed;
4131
4132 #define WMI_TPC_CONFIG_PARAM            1
4133 #define WMI_TPC_FINAL_RATE_MAX          240
4134 #define WMI_TPC_TX_N_CHAIN              4
4135 #define WMI_TPC_RATE_MAX               (WMI_TPC_TX_N_CHAIN * 65)
4136 #define WMI_TPC_PREAM_TABLE_MAX         10
4137 #define WMI_TPC_FLAG                    3
4138 #define WMI_TPC_BUF_SIZE                10
4139 #define WMI_TPC_BEAMFORMING             2
4140
4141 enum wmi_tpc_table_type {
4142         WMI_TPC_TABLE_TYPE_CDD = 0,
4143         WMI_TPC_TABLE_TYPE_STBC = 1,
4144         WMI_TPC_TABLE_TYPE_TXBF = 2,
4145 };
4146
4147 enum wmi_tpc_config_event_flag {
4148         WMI_TPC_CONFIG_EVENT_FLAG_TABLE_CDD     = 0x1,
4149         WMI_TPC_CONFIG_EVENT_FLAG_TABLE_STBC    = 0x2,
4150         WMI_TPC_CONFIG_EVENT_FLAG_TABLE_TXBF    = 0x4,
4151 };
4152
4153 struct wmi_pdev_tpc_config_event {
4154         __le32 reg_domain;
4155         __le32 chan_freq;
4156         __le32 phy_mode;
4157         __le32 twice_antenna_reduction;
4158         __le32 twice_max_rd_power;
4159         a_sle32 twice_antenna_gain;
4160         __le32 power_limit;
4161         __le32 rate_max;
4162         __le32 num_tx_chain;
4163         __le32 ctl;
4164         __le32 flags;
4165         s8 max_reg_allow_pow[WMI_TPC_TX_N_CHAIN];
4166         s8 max_reg_allow_pow_agcdd[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
4167         s8 max_reg_allow_pow_agstbc[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
4168         s8 max_reg_allow_pow_agtxbf[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
4169         u8 rates_array[WMI_TPC_RATE_MAX];
4170 } __packed;
4171
4172 /* Transmit power scale factor. */
4173 enum wmi_tp_scale {
4174         WMI_TP_SCALE_MAX    = 0,        /* no scaling (default) */
4175         WMI_TP_SCALE_50     = 1,        /* 50% of max (-3 dBm) */
4176         WMI_TP_SCALE_25     = 2,        /* 25% of max (-6 dBm) */
4177         WMI_TP_SCALE_12     = 3,        /* 12% of max (-9 dBm) */
4178         WMI_TP_SCALE_MIN    = 4,        /* min, but still on   */
4179         WMI_TP_SCALE_SIZE   = 5,        /* max num of enum     */
4180 };
4181
4182 struct wmi_pdev_tpc_final_table_event {
4183         __le32 reg_domain;
4184         __le32 chan_freq;
4185         __le32 phy_mode;
4186         __le32 twice_antenna_reduction;
4187         __le32 twice_max_rd_power;
4188         a_sle32 twice_antenna_gain;
4189         __le32 power_limit;
4190         __le32 rate_max;
4191         __le32 num_tx_chain;
4192         __le32 ctl;
4193         __le32 flags;
4194         s8 max_reg_allow_pow[WMI_TPC_TX_N_CHAIN];
4195         s8 max_reg_allow_pow_agcdd[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
4196         s8 max_reg_allow_pow_agstbc[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
4197         s8 max_reg_allow_pow_agtxbf[WMI_TPC_TX_N_CHAIN][WMI_TPC_TX_N_CHAIN];
4198         u8 rates_array[WMI_TPC_FINAL_RATE_MAX];
4199         u8 ctl_power_table[WMI_TPC_BEAMFORMING][WMI_TPC_TX_N_CHAIN]
4200            [WMI_TPC_TX_N_CHAIN];
4201 } __packed;
4202
4203 struct wmi_pdev_get_tpc_table_cmd {
4204         __le32 param;
4205 } __packed;
4206
4207 enum wmi_tpc_pream_2ghz {
4208         WMI_TPC_PREAM_2GHZ_CCK = 0,
4209         WMI_TPC_PREAM_2GHZ_OFDM,
4210         WMI_TPC_PREAM_2GHZ_HT20,
4211         WMI_TPC_PREAM_2GHZ_HT40,
4212         WMI_TPC_PREAM_2GHZ_VHT20,
4213         WMI_TPC_PREAM_2GHZ_VHT40,
4214         WMI_TPC_PREAM_2GHZ_VHT80,
4215 };
4216
4217 enum wmi_tpc_pream_5ghz {
4218         WMI_TPC_PREAM_5GHZ_OFDM = 1,
4219         WMI_TPC_PREAM_5GHZ_HT20,
4220         WMI_TPC_PREAM_5GHZ_HT40,
4221         WMI_TPC_PREAM_5GHZ_VHT20,
4222         WMI_TPC_PREAM_5GHZ_VHT40,
4223         WMI_TPC_PREAM_5GHZ_VHT80,
4224         WMI_TPC_PREAM_5GHZ_HTCUP,
4225 };
4226
4227 #define WMI_PEER_PS_STATE_DISABLED      2
4228
4229 struct wmi_peer_sta_ps_state_chg_event {
4230         struct wmi_mac_addr peer_macaddr;
4231         __le32 peer_ps_state;
4232 } __packed;
4233
4234 struct wmi_pdev_chanlist_update_event {
4235         /* number of channels */
4236         __le32 num_chan;
4237         /* array of channels */
4238         struct wmi_channel channel_list[1];
4239 } __packed;
4240
4241 #define WMI_MAX_DEBUG_MESG (sizeof(u32) * 32)
4242
4243 struct wmi_debug_mesg_event {
4244         /* message buffer, NULL terminated */
4245         char bufp[WMI_MAX_DEBUG_MESG];
4246 } __packed;
4247
4248 enum {
4249         /* P2P device */
4250         VDEV_SUBTYPE_P2PDEV = 0,
4251         /* P2P client */
4252         VDEV_SUBTYPE_P2PCLI,
4253         /* P2P GO */
4254         VDEV_SUBTYPE_P2PGO,
4255         /* BT3.0 HS */
4256         VDEV_SUBTYPE_BT,
4257 };
4258
4259 struct wmi_pdev_set_channel_cmd {
4260         /* idnore power , only use flags , mode and freq */
4261         struct wmi_channel chan;
4262 } __packed;
4263
4264 struct wmi_pdev_pktlog_enable_cmd {
4265         __le32 ev_bitmap;
4266 } __packed;
4267
4268 /* Customize the DSCP (bit) to TID (0-7) mapping for QOS */
4269 #define WMI_DSCP_MAP_MAX    (64)
4270 struct wmi_pdev_set_dscp_tid_map_cmd {
4271         /* map indicating DSCP to TID conversion */
4272         __le32 dscp_to_tid_map[WMI_DSCP_MAP_MAX];
4273 } __packed;
4274
4275 enum mcast_bcast_rate_id {
4276         WMI_SET_MCAST_RATE,
4277         WMI_SET_BCAST_RATE
4278 };
4279
4280 struct mcast_bcast_rate {
4281         enum mcast_bcast_rate_id rate_id;
4282         __le32 rate;
4283 } __packed;
4284
4285 struct wmi_wmm_params {
4286         __le32 cwmin;
4287         __le32 cwmax;
4288         __le32 aifs;
4289         __le32 txop;
4290         __le32 acm;
4291         __le32 no_ack;
4292 } __packed;
4293
4294 struct wmi_pdev_set_wmm_params {
4295         struct wmi_wmm_params ac_be;
4296         struct wmi_wmm_params ac_bk;
4297         struct wmi_wmm_params ac_vi;
4298         struct wmi_wmm_params ac_vo;
4299 } __packed;
4300
4301 struct wmi_wmm_params_arg {
4302         u32 cwmin;
4303         u32 cwmax;
4304         u32 aifs;
4305         u32 txop;
4306         u32 acm;
4307         u32 no_ack;
4308 };
4309
4310 struct wmi_wmm_params_all_arg {
4311         struct wmi_wmm_params_arg ac_be;
4312         struct wmi_wmm_params_arg ac_bk;
4313         struct wmi_wmm_params_arg ac_vi;
4314         struct wmi_wmm_params_arg ac_vo;
4315 };
4316
4317 struct wmi_pdev_stats_tx {
4318         /* Num HTT cookies queued to dispatch list */
4319         __le32 comp_queued;
4320
4321         /* Num HTT cookies dispatched */
4322         __le32 comp_delivered;
4323
4324         /* Num MSDU queued to WAL */
4325         __le32 msdu_enqued;
4326
4327         /* Num MPDU queue to WAL */
4328         __le32 mpdu_enqued;
4329
4330         /* Num MSDUs dropped by WMM limit */
4331         __le32 wmm_drop;
4332
4333         /* Num Local frames queued */
4334         __le32 local_enqued;
4335
4336         /* Num Local frames done */
4337         __le32 local_freed;
4338
4339         /* Num queued to HW */
4340         __le32 hw_queued;
4341
4342         /* Num PPDU reaped from HW */
4343         __le32 hw_reaped;
4344
4345         /* Num underruns */
4346         __le32 underrun;
4347
4348         /* Num PPDUs cleaned up in TX abort */
4349         __le32 tx_abort;
4350
4351         /* Num MPDUs requed by SW */
4352         __le32 mpdus_requed;
4353
4354         /* excessive retries */
4355         __le32 tx_ko;
4356
4357         /* data hw rate code */
4358         __le32 data_rc;
4359
4360         /* Scheduler self triggers */
4361         __le32 self_triggers;
4362
4363         /* frames dropped due to excessive sw retries */
4364         __le32 sw_retry_failure;
4365
4366         /* illegal rate phy errors  */
4367         __le32 illgl_rate_phy_err;
4368
4369         /* wal pdev continuous xretry */
4370         __le32 pdev_cont_xretry;
4371
4372         /* wal pdev continous xretry */
4373         __le32 pdev_tx_timeout;
4374
4375         /* wal pdev resets  */
4376         __le32 pdev_resets;
4377
4378         /* frames dropped due to non-availability of stateless TIDs */
4379         __le32 stateless_tid_alloc_failure;
4380
4381         __le32 phy_underrun;
4382
4383         /* MPDU is more than txop limit */
4384         __le32 txop_ovf;
4385 } __packed;
4386
4387 struct wmi_10_4_pdev_stats_tx {
4388         /* Num HTT cookies queued to dispatch list */
4389         __le32 comp_queued;
4390
4391         /* Num HTT cookies dispatched */
4392         __le32 comp_delivered;
4393
4394         /* Num MSDU queued to WAL */
4395         __le32 msdu_enqued;
4396
4397         /* Num MPDU queue to WAL */
4398         __le32 mpdu_enqued;
4399
4400         /* Num MSDUs dropped by WMM limit */
4401         __le32 wmm_drop;
4402
4403         /* Num Local frames queued */
4404         __le32 local_enqued;
4405
4406         /* Num Local frames done */
4407         __le32 local_freed;
4408
4409         /* Num queued to HW */
4410         __le32 hw_queued;
4411
4412         /* Num PPDU reaped from HW */
4413         __le32 hw_reaped;
4414
4415         /* Num underruns */
4416         __le32 underrun;
4417
4418         /* HW Paused. */
4419         __le32  hw_paused;
4420
4421         /* Num PPDUs cleaned up in TX abort */
4422         __le32 tx_abort;
4423
4424         /* Num MPDUs requed by SW */
4425         __le32 mpdus_requed;
4426
4427         /* excessive retries */
4428         __le32 tx_ko;
4429
4430         /* data hw rate code */
4431         __le32 data_rc;
4432
4433         /* Scheduler self triggers */
4434         __le32 self_triggers;
4435
4436         /* frames dropped due to excessive sw retries */
4437         __le32 sw_retry_failure;
4438
4439         /* illegal rate phy errors  */
4440         __le32 illgl_rate_phy_err;
4441
4442         /* wal pdev continuous xretry */
4443         __le32 pdev_cont_xretry;
4444
4445         /* wal pdev tx timeouts */
4446         __le32 pdev_tx_timeout;
4447
4448         /* wal pdev resets  */
4449         __le32 pdev_resets;
4450
4451         /* frames dropped due to non-availability of stateless TIDs */
4452         __le32 stateless_tid_alloc_failure;
4453
4454         __le32 phy_underrun;
4455
4456         /* MPDU is more than txop limit */
4457         __le32 txop_ovf;
4458
4459         /* Number of Sequences posted */
4460         __le32 seq_posted;
4461
4462         /* Number of Sequences failed queueing */
4463         __le32 seq_failed_queueing;
4464
4465         /* Number of Sequences completed */
4466         __le32 seq_completed;
4467
4468         /* Number of Sequences restarted */
4469         __le32 seq_restarted;
4470
4471         /* Number of MU Sequences posted */
4472         __le32 mu_seq_posted;
4473
4474         /* Num MPDUs flushed by SW, HWPAUSED,SW TXABORT(Reset,channel change) */
4475         __le32 mpdus_sw_flush;
4476
4477         /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
4478         __le32 mpdus_hw_filter;
4479
4480         /* Num MPDUs truncated by PDG
4481          * (TXOP, TBTT, PPDU_duration based on rate, dyn_bw)
4482          */
4483         __le32 mpdus_truncated;
4484
4485         /* Num MPDUs that was tried but didn't receive ACK or BA */
4486         __le32 mpdus_ack_failed;
4487
4488         /* Num MPDUs that was dropped due to expiry. */
4489         __le32 mpdus_expired;
4490 } __packed;
4491
4492 struct wmi_pdev_stats_rx {
4493         /* Cnts any change in ring routing mid-ppdu */
4494         __le32 mid_ppdu_route_change;
4495
4496         /* Total number of statuses processed */
4497         __le32 status_rcvd;
4498
4499         /* Extra frags on rings 0-3 */
4500         __le32 r0_frags;
4501         __le32 r1_frags;
4502         __le32 r2_frags;
4503         __le32 r3_frags;
4504
4505         /* MSDUs / MPDUs delivered to HTT */
4506         __le32 htt_msdus;
4507         __le32 htt_mpdus;
4508
4509         /* MSDUs / MPDUs delivered to local stack */
4510         __le32 loc_msdus;
4511         __le32 loc_mpdus;
4512
4513         /* AMSDUs that have more MSDUs than the status ring size */
4514         __le32 oversize_amsdu;
4515
4516         /* Number of PHY errors */
4517         __le32 phy_errs;
4518
4519         /* Number of PHY errors drops */
4520         __le32 phy_err_drop;
4521
4522         /* Number of mpdu errors - FCS, MIC, ENC etc. */
4523         __le32 mpdu_errs;
4524 } __packed;
4525
4526 struct wmi_pdev_stats_peer {
4527         /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
4528         __le32 dummy;
4529 } __packed;
4530
4531 enum wmi_stats_id {
4532         WMI_STAT_PEER = BIT(0),
4533         WMI_STAT_AP = BIT(1),
4534         WMI_STAT_PDEV = BIT(2),
4535         WMI_STAT_VDEV = BIT(3),
4536         WMI_STAT_BCNFLT = BIT(4),
4537         WMI_STAT_VDEV_RATE = BIT(5),
4538 };
4539
4540 enum wmi_10_4_stats_id {
4541         WMI_10_4_STAT_PEER              = BIT(0),
4542         WMI_10_4_STAT_AP                = BIT(1),
4543         WMI_10_4_STAT_INST              = BIT(2),
4544         WMI_10_4_STAT_PEER_EXTD         = BIT(3),
4545         WMI_10_4_STAT_VDEV_EXTD         = BIT(4),
4546 };
4547
4548 struct wlan_inst_rssi_args {
4549         __le16 cfg_retry_count;
4550         __le16 retry_count;
4551 };
4552
4553 struct wmi_request_stats_cmd {
4554         __le32 stats_id;
4555
4556         __le32 vdev_id;
4557
4558         /* peer MAC address */
4559         struct wmi_mac_addr peer_macaddr;
4560
4561         /* Instantaneous RSSI arguments */
4562         struct wlan_inst_rssi_args inst_rssi_args;
4563 } __packed;
4564
4565 /* Suspend option */
4566 enum {
4567         /* suspend */
4568         WMI_PDEV_SUSPEND,
4569
4570         /* suspend and disable all interrupts */
4571         WMI_PDEV_SUSPEND_AND_DISABLE_INTR,
4572 };
4573
4574 struct wmi_pdev_suspend_cmd {
4575         /* suspend option sent to target */
4576         __le32 suspend_opt;
4577 } __packed;
4578
4579 struct wmi_stats_event {
4580         __le32 stats_id; /* WMI_STAT_ */
4581         /*
4582          * number of pdev stats event structures
4583          * (wmi_pdev_stats) 0 or 1
4584          */
4585         __le32 num_pdev_stats;
4586         /*
4587          * number of vdev stats event structures
4588          * (wmi_vdev_stats) 0 or max vdevs
4589          */
4590         __le32 num_vdev_stats;
4591         /*
4592          * number of peer stats event structures
4593          * (wmi_peer_stats) 0 or max peers
4594          */
4595         __le32 num_peer_stats;
4596         __le32 num_bcnflt_stats;
4597         /*
4598          * followed by
4599          *   num_pdev_stats * size of(struct wmi_pdev_stats)
4600          *   num_vdev_stats * size of(struct wmi_vdev_stats)
4601          *   num_peer_stats * size of(struct wmi_peer_stats)
4602          *
4603          *  By having a zero sized array, the pointer to data area
4604          *  becomes available without increasing the struct size
4605          */
4606         u8 data[0];
4607 } __packed;
4608
4609 struct wmi_10_2_stats_event {
4610         __le32 stats_id; /* %WMI_REQUEST_ */
4611         __le32 num_pdev_stats;
4612         __le32 num_pdev_ext_stats;
4613         __le32 num_vdev_stats;
4614         __le32 num_peer_stats;
4615         __le32 num_bcnflt_stats;
4616         u8 data[0];
4617 } __packed;
4618
4619 /*
4620  * PDEV statistics
4621  * TODO: add all PDEV stats here
4622  */
4623 struct wmi_pdev_stats_base {
4624         __le32 chan_nf;
4625         __le32 tx_frame_count; /* Cycles spent transmitting frames */
4626         __le32 rx_frame_count; /* Cycles spent receiving frames */
4627         __le32 rx_clear_count; /* Total channel busy time, evidently */
4628         __le32 cycle_count; /* Total on-channel time */
4629         __le32 phy_err_count;
4630         __le32 chan_tx_pwr;
4631 } __packed;
4632
4633 struct wmi_pdev_stats {
4634         struct wmi_pdev_stats_base base;
4635         struct wmi_pdev_stats_tx tx;
4636         struct wmi_pdev_stats_rx rx;
4637         struct wmi_pdev_stats_peer peer;
4638 } __packed;
4639
4640 struct wmi_pdev_stats_extra {
4641         __le32 ack_rx_bad;
4642         __le32 rts_bad;
4643         __le32 rts_good;
4644         __le32 fcs_bad;
4645         __le32 no_beacons;
4646         __le32 mib_int_count;
4647 } __packed;
4648
4649 struct wmi_10x_pdev_stats {
4650         struct wmi_pdev_stats_base base;
4651         struct wmi_pdev_stats_tx tx;
4652         struct wmi_pdev_stats_rx rx;
4653         struct wmi_pdev_stats_peer peer;
4654         struct wmi_pdev_stats_extra extra;
4655 } __packed;
4656
4657 struct wmi_pdev_stats_mem {
4658         __le32 dram_free;
4659         __le32 iram_free;
4660 } __packed;
4661
4662 struct wmi_10_2_pdev_stats {
4663         struct wmi_pdev_stats_base base;
4664         struct wmi_pdev_stats_tx tx;
4665         __le32 mc_drop;
4666         struct wmi_pdev_stats_rx rx;
4667         __le32 pdev_rx_timeout;
4668         struct wmi_pdev_stats_mem mem;
4669         struct wmi_pdev_stats_peer peer;
4670         struct wmi_pdev_stats_extra extra;
4671 } __packed;
4672
4673 struct wmi_10_4_pdev_stats {
4674         struct wmi_pdev_stats_base base;
4675         struct wmi_10_4_pdev_stats_tx tx;
4676         struct wmi_pdev_stats_rx rx;
4677         __le32 rx_ovfl_errs;
4678         struct wmi_pdev_stats_mem mem;
4679         __le32 sram_free_size;
4680         struct wmi_pdev_stats_extra extra;
4681 } __packed;
4682
4683 /*
4684  * VDEV statistics
4685  */
4686
4687 #define WMI_VDEV_STATS_FTM_COUNT_VALID  BIT(31)
4688 #define WMI_VDEV_STATS_FTM_COUNT_LSB    0
4689 #define WMI_VDEV_STATS_FTM_COUNT_MASK   0x7fffffff
4690
4691 struct wmi_vdev_stats {
4692         __le32 vdev_id;
4693 } __packed;
4694
4695 struct wmi_vdev_stats_extd {
4696         __le32 vdev_id;
4697         __le32 ppdu_aggr_cnt;
4698         __le32 ppdu_noack;
4699         __le32 mpdu_queued;
4700         __le32 ppdu_nonaggr_cnt;
4701         __le32 mpdu_sw_requeued;
4702         __le32 mpdu_suc_retry;
4703         __le32 mpdu_suc_multitry;
4704         __le32 mpdu_fail_retry;
4705         __le32 tx_ftm_suc;
4706         __le32 tx_ftm_suc_retry;
4707         __le32 tx_ftm_fail;
4708         __le32 rx_ftmr_cnt;
4709         __le32 rx_ftmr_dup_cnt;
4710         __le32 rx_iftmr_cnt;
4711         __le32 rx_iftmr_dup_cnt;
4712         __le32 reserved[6];
4713 } __packed;
4714
4715 /*
4716  * peer statistics.
4717  * TODO: add more stats
4718  */
4719 struct wmi_peer_stats {
4720         struct wmi_mac_addr peer_macaddr;
4721         __le32 peer_rssi;
4722         __le32 peer_tx_rate;
4723 } __packed;
4724
4725 struct wmi_10x_peer_stats {
4726         struct wmi_peer_stats old;
4727         __le32 peer_rx_rate;
4728 } __packed;
4729
4730 struct wmi_10_2_peer_stats {
4731         struct wmi_peer_stats old;
4732         __le32 peer_rx_rate;
4733         __le32 current_per;
4734         __le32 retries;
4735         __le32 tx_rate_count;
4736         __le32 max_4ms_frame_len;
4737         __le32 total_sub_frames;
4738         __le32 tx_bytes;
4739         __le32 num_pkt_loss_overflow[4];
4740         __le32 num_pkt_loss_excess_retry[4];
4741 } __packed;
4742
4743 struct wmi_10_2_4_peer_stats {
4744         struct wmi_10_2_peer_stats common;
4745         __le32 peer_rssi_changed;
4746 } __packed;
4747
4748 struct wmi_10_2_4_ext_peer_stats {
4749         struct wmi_10_2_peer_stats common;
4750         __le32 peer_rssi_changed;
4751         __le32 rx_duration;
4752 } __packed;
4753
4754 struct wmi_10_4_peer_stats {
4755         struct wmi_mac_addr peer_macaddr;
4756         __le32 peer_rssi;
4757         __le32 peer_rssi_seq_num;
4758         __le32 peer_tx_rate;
4759         __le32 peer_rx_rate;
4760         __le32 current_per;
4761         __le32 retries;
4762         __le32 tx_rate_count;
4763         __le32 max_4ms_frame_len;
4764         __le32 total_sub_frames;
4765         __le32 tx_bytes;
4766         __le32 num_pkt_loss_overflow[4];
4767         __le32 num_pkt_loss_excess_retry[4];
4768         __le32 peer_rssi_changed;
4769 } __packed;
4770
4771 struct wmi_10_4_peer_extd_stats {
4772         struct wmi_mac_addr peer_macaddr;
4773         __le32 inactive_time;
4774         __le32 peer_chain_rssi;
4775         __le32 rx_duration;
4776         __le32 reserved[10];
4777 } __packed;
4778
4779 struct wmi_10_4_bss_bcn_stats {
4780         __le32 vdev_id;
4781         __le32 bss_bcns_dropped;
4782         __le32 bss_bcn_delivered;
4783 } __packed;
4784
4785 struct wmi_10_4_bss_bcn_filter_stats {
4786         __le32 bcns_dropped;
4787         __le32 bcns_delivered;
4788         __le32 active_filters;
4789         struct wmi_10_4_bss_bcn_stats bss_stats;
4790 } __packed;
4791
4792 struct wmi_10_2_pdev_ext_stats {
4793         __le32 rx_rssi_comb;
4794         __le32 rx_rssi[4];
4795         __le32 rx_mcs[10];
4796         __le32 tx_mcs[10];
4797         __le32 ack_rssi;
4798 } __packed;
4799
4800 struct wmi_vdev_create_cmd {
4801         __le32 vdev_id;
4802         __le32 vdev_type;
4803         __le32 vdev_subtype;
4804         struct wmi_mac_addr vdev_macaddr;
4805 } __packed;
4806
4807 enum wmi_vdev_type {
4808         WMI_VDEV_TYPE_AP      = 1,
4809         WMI_VDEV_TYPE_STA     = 2,
4810         WMI_VDEV_TYPE_IBSS    = 3,
4811         WMI_VDEV_TYPE_MONITOR = 4,
4812 };
4813
4814 enum wmi_vdev_subtype {
4815         WMI_VDEV_SUBTYPE_NONE,
4816         WMI_VDEV_SUBTYPE_P2P_DEVICE,
4817         WMI_VDEV_SUBTYPE_P2P_CLIENT,
4818         WMI_VDEV_SUBTYPE_P2P_GO,
4819         WMI_VDEV_SUBTYPE_PROXY_STA,
4820         WMI_VDEV_SUBTYPE_MESH_11S,
4821         WMI_VDEV_SUBTYPE_MESH_NON_11S,
4822 };
4823
4824 enum wmi_vdev_subtype_legacy {
4825         WMI_VDEV_SUBTYPE_LEGACY_NONE      = 0,
4826         WMI_VDEV_SUBTYPE_LEGACY_P2P_DEV   = 1,
4827         WMI_VDEV_SUBTYPE_LEGACY_P2P_CLI   = 2,
4828         WMI_VDEV_SUBTYPE_LEGACY_P2P_GO    = 3,
4829         WMI_VDEV_SUBTYPE_LEGACY_PROXY_STA = 4,
4830 };
4831
4832 enum wmi_vdev_subtype_10_2_4 {
4833         WMI_VDEV_SUBTYPE_10_2_4_NONE      = 0,
4834         WMI_VDEV_SUBTYPE_10_2_4_P2P_DEV   = 1,
4835         WMI_VDEV_SUBTYPE_10_2_4_P2P_CLI   = 2,
4836         WMI_VDEV_SUBTYPE_10_2_4_P2P_GO    = 3,
4837         WMI_VDEV_SUBTYPE_10_2_4_PROXY_STA = 4,
4838         WMI_VDEV_SUBTYPE_10_2_4_MESH_11S  = 5,
4839 };
4840
4841 enum wmi_vdev_subtype_10_4 {
4842         WMI_VDEV_SUBTYPE_10_4_NONE         = 0,
4843         WMI_VDEV_SUBTYPE_10_4_P2P_DEV      = 1,
4844         WMI_VDEV_SUBTYPE_10_4_P2P_CLI      = 2,
4845         WMI_VDEV_SUBTYPE_10_4_P2P_GO       = 3,
4846         WMI_VDEV_SUBTYPE_10_4_PROXY_STA    = 4,
4847         WMI_VDEV_SUBTYPE_10_4_MESH_NON_11S = 5,
4848         WMI_VDEV_SUBTYPE_10_4_MESH_11S     = 6,
4849 };
4850
4851 /* values for vdev_subtype */
4852
4853 /* values for vdev_start_request flags */
4854 /*
4855  * Indicates that AP VDEV uses hidden ssid. only valid for
4856  *  AP/GO
4857  */
4858 #define WMI_VDEV_START_HIDDEN_SSID  (1 << 0)
4859 /*
4860  * Indicates if robust management frame/management frame
4861  *  protection is enabled. For GO/AP vdevs, it indicates that
4862  *  it may support station/client associations with RMF enabled.
4863  *  For STA/client vdevs, it indicates that sta will
4864  *  associate with AP with RMF enabled.
4865  */
4866 #define WMI_VDEV_START_PMF_ENABLED  (1 << 1)
4867
4868 struct wmi_p2p_noa_descriptor {
4869         __le32 type_count; /* 255: continuous schedule, 0: reserved */
4870         __le32 duration;  /* Absent period duration in micro seconds */
4871         __le32 interval;   /* Absent period interval in micro seconds */
4872         __le32 start_time; /* 32 bit tsf time when in starts */
4873 } __packed;
4874
4875 struct wmi_vdev_start_request_cmd {
4876         /* WMI channel */
4877         struct wmi_channel chan;
4878         /* unique id identifying the VDEV, generated by the caller */
4879         __le32 vdev_id;
4880         /* requestor id identifying the caller module */
4881         __le32 requestor_id;
4882         /* beacon interval from received beacon */
4883         __le32 beacon_interval;
4884         /* DTIM Period from the received beacon */
4885         __le32 dtim_period;
4886         /* Flags */
4887         __le32 flags;
4888         /* ssid field. Only valid for AP/GO/IBSS/BTAmp VDEV type. */
4889         struct wmi_ssid ssid;
4890         /* beacon/probe response xmit rate. Applicable for SoftAP. */
4891         __le32 bcn_tx_rate;
4892         /* beacon/probe response xmit power. Applicable for SoftAP. */
4893         __le32 bcn_tx_power;
4894         /* number of p2p NOA descriptor(s) from scan entry */
4895         __le32 num_noa_descriptors;
4896         /*
4897          * Disable H/W ack. This used by WMI_VDEV_RESTART_REQUEST_CMDID.
4898          * During CAC, Our HW shouldn't ack ditected frames
4899          */
4900         __le32 disable_hw_ack;
4901         /* actual p2p NOA descriptor from scan entry */
4902         struct wmi_p2p_noa_descriptor noa_descriptors[2];
4903 } __packed;
4904
4905 struct wmi_vdev_restart_request_cmd {
4906         struct wmi_vdev_start_request_cmd vdev_start_request_cmd;
4907 } __packed;
4908
4909 struct wmi_vdev_start_request_arg {
4910         u32 vdev_id;
4911         struct wmi_channel_arg channel;
4912         u32 bcn_intval;
4913         u32 dtim_period;
4914         u8 *ssid;
4915         u32 ssid_len;
4916         u32 bcn_tx_rate;
4917         u32 bcn_tx_power;
4918         bool disable_hw_ack;
4919         bool hidden_ssid;
4920         bool pmf_enabled;
4921 };
4922
4923 struct wmi_vdev_delete_cmd {
4924         /* unique id identifying the VDEV, generated by the caller */
4925         __le32 vdev_id;
4926 } __packed;
4927
4928 struct wmi_vdev_up_cmd {
4929         __le32 vdev_id;
4930         __le32 vdev_assoc_id;
4931         struct wmi_mac_addr vdev_bssid;
4932 } __packed;
4933
4934 struct wmi_vdev_stop_cmd {
4935         __le32 vdev_id;
4936 } __packed;
4937
4938 struct wmi_vdev_down_cmd {
4939         __le32 vdev_id;
4940 } __packed;
4941
4942 struct wmi_vdev_standby_response_cmd {
4943         /* unique id identifying the VDEV, generated by the caller */
4944         __le32 vdev_id;
4945 } __packed;
4946
4947 struct wmi_vdev_resume_response_cmd {
4948         /* unique id identifying the VDEV, generated by the caller */
4949         __le32 vdev_id;
4950 } __packed;
4951
4952 struct wmi_vdev_set_param_cmd {
4953         __le32 vdev_id;
4954         __le32 param_id;
4955         __le32 param_value;
4956 } __packed;
4957
4958 #define WMI_MAX_KEY_INDEX   3
4959 #define WMI_MAX_KEY_LEN     32
4960
4961 #define WMI_KEY_PAIRWISE 0x00
4962 #define WMI_KEY_GROUP    0x01
4963 #define WMI_KEY_TX_USAGE 0x02 /* default tx key - static wep */
4964
4965 struct wmi_key_seq_counter {
4966         __le32 key_seq_counter_l;
4967         __le32 key_seq_counter_h;
4968 } __packed;
4969
4970 enum wmi_cipher_suites {
4971         WMI_CIPHER_NONE,
4972         WMI_CIPHER_WEP,
4973         WMI_CIPHER_TKIP,
4974         WMI_CIPHER_AES_OCB,
4975         WMI_CIPHER_AES_CCM,
4976         WMI_CIPHER_WAPI,
4977         WMI_CIPHER_CKIP,
4978         WMI_CIPHER_AES_CMAC,
4979         WMI_CIPHER_AES_GCM,
4980 };
4981
4982 enum wmi_tlv_cipher_suites {
4983         WMI_TLV_CIPHER_NONE,
4984         WMI_TLV_CIPHER_WEP,
4985         WMI_TLV_CIPHER_TKIP,
4986         WMI_TLV_CIPHER_AES_OCB,
4987         WMI_TLV_CIPHER_AES_CCM,
4988         WMI_TLV_CIPHER_WAPI,
4989         WMI_TLV_CIPHER_CKIP,
4990         WMI_TLV_CIPHER_AES_CMAC,
4991         WMI_TLV_CIPHER_ANY,
4992         WMI_TLV_CIPHER_AES_GCM,
4993 };
4994
4995 struct wmi_vdev_install_key_cmd {
4996         __le32 vdev_id;
4997         struct wmi_mac_addr peer_macaddr;
4998         __le32 key_idx;
4999         __le32 key_flags;
5000         __le32 key_cipher; /* %WMI_CIPHER_ */
5001         struct wmi_key_seq_counter key_rsc_counter;
5002         struct wmi_key_seq_counter key_global_rsc_counter;
5003         struct wmi_key_seq_counter key_tsc_counter;
5004         u8 wpi_key_rsc_counter[16];
5005         u8 wpi_key_tsc_counter[16];
5006         __le32 key_len;
5007         __le32 key_txmic_len;
5008         __le32 key_rxmic_len;
5009
5010         /* contains key followed by tx mic followed by rx mic */
5011         u8 key_data[0];
5012 } __packed;
5013
5014 struct wmi_vdev_install_key_arg {
5015         u32 vdev_id;
5016         const u8 *macaddr;
5017         u32 key_idx;
5018         u32 key_flags;
5019         u32 key_cipher;
5020         u32 key_len;
5021         u32 key_txmic_len;
5022         u32 key_rxmic_len;
5023         const void *key_data;
5024 };
5025
5026 /*
5027  * vdev fixed rate format:
5028  * - preamble - b7:b6 - see WMI_RATE_PREMABLE_
5029  * - nss      - b5:b4 - ss number (0 mean 1ss)
5030  * - rate_mcs - b3:b0 - as below
5031  *    CCK:  0 - 11Mbps, 1 - 5,5Mbps, 2 - 2Mbps, 3 - 1Mbps,
5032  *          4 - 11Mbps (s), 5 - 5,5Mbps (s), 6 - 2Mbps (s)
5033  *    OFDM: 0 - 48Mbps, 1 - 24Mbps, 2 - 12Mbps, 3 - 6Mbps,
5034  *          4 - 54Mbps, 5 - 36Mbps, 6 - 18Mbps, 7 - 9Mbps
5035  *    HT/VHT: MCS index
5036  */
5037
5038 /* Preamble types to be used with VDEV fixed rate configuration */
5039 enum wmi_rate_preamble {
5040         WMI_RATE_PREAMBLE_OFDM,
5041         WMI_RATE_PREAMBLE_CCK,
5042         WMI_RATE_PREAMBLE_HT,
5043         WMI_RATE_PREAMBLE_VHT,
5044 };
5045
5046 #define ATH10K_HW_NSS(rate)             (1 + (((rate) >> 4) & 0x3))
5047 #define ATH10K_HW_PREAMBLE(rate)        (((rate) >> 6) & 0x3)
5048 #define ATH10K_HW_MCS_RATE(rate)        ((rate) & 0xf)
5049 #define ATH10K_HW_LEGACY_RATE(rate)     ((rate) & 0x3f)
5050 #define ATH10K_HW_BW(flags)             (((flags) >> 3) & 0x3)
5051 #define ATH10K_HW_GI(flags)             (((flags) >> 5) & 0x1)
5052 #define ATH10K_HW_RATECODE(rate, nss, preamble) \
5053         (((preamble) << 6) | ((nss) << 4) | (rate))
5054 #define ATH10K_HW_AMPDU(flags)          ((flags) & 0x1)
5055 #define ATH10K_HW_BA_FAIL(flags)        (((flags) >> 1) & 0x3)
5056 #define ATH10K_FW_SKIPPED_RATE_CTRL(flags)      (((flags) >> 6) & 0x1)
5057
5058 #define ATH10K_VHT_MCS_NUM      10
5059 #define ATH10K_BW_NUM           4
5060 #define ATH10K_NSS_NUM          4
5061 #define ATH10K_LEGACY_NUM       12
5062 #define ATH10K_GI_NUM           2
5063 #define ATH10K_HT_MCS_NUM       32
5064 #define ATH10K_RATE_TABLE_NUM   320
5065
5066 /* Value to disable fixed rate setting */
5067 #define WMI_FIXED_RATE_NONE    (0xff)
5068
5069 struct wmi_vdev_param_map {
5070         u32 rts_threshold;
5071         u32 fragmentation_threshold;
5072         u32 beacon_interval;
5073         u32 listen_interval;
5074         u32 multicast_rate;
5075         u32 mgmt_tx_rate;
5076         u32 slot_time;
5077         u32 preamble;
5078         u32 swba_time;
5079         u32 wmi_vdev_stats_update_period;
5080         u32 wmi_vdev_pwrsave_ageout_time;
5081         u32 wmi_vdev_host_swba_interval;
5082         u32 dtim_period;
5083         u32 wmi_vdev_oc_scheduler_air_time_limit;
5084         u32 wds;
5085         u32 atim_window;
5086         u32 bmiss_count_max;
5087         u32 bmiss_first_bcnt;
5088         u32 bmiss_final_bcnt;
5089         u32 feature_wmm;
5090         u32 chwidth;
5091         u32 chextoffset;
5092         u32 disable_htprotection;
5093         u32 sta_quickkickout;
5094         u32 mgmt_rate;
5095         u32 protection_mode;
5096         u32 fixed_rate;
5097         u32 sgi;
5098         u32 ldpc;
5099         u32 tx_stbc;
5100         u32 rx_stbc;
5101         u32 intra_bss_fwd;
5102         u32 def_keyid;
5103         u32 nss;
5104         u32 bcast_data_rate;
5105         u32 mcast_data_rate;
5106         u32 mcast_indicate;
5107         u32 dhcp_indicate;
5108         u32 unknown_dest_indicate;
5109         u32 ap_keepalive_min_idle_inactive_time_secs;
5110         u32 ap_keepalive_max_idle_inactive_time_secs;
5111         u32 ap_keepalive_max_unresponsive_time_secs;
5112         u32 ap_enable_nawds;
5113         u32 mcast2ucast_set;
5114         u32 enable_rtscts;
5115         u32 txbf;
5116         u32 packet_powersave;
5117         u32 drop_unencry;
5118         u32 tx_encap_type;
5119         u32 ap_detect_out_of_sync_sleeping_sta_time_secs;
5120         u32 rc_num_retries;
5121         u32 cabq_maxdur;
5122         u32 mfptest_set;
5123         u32 rts_fixed_rate;
5124         u32 vht_sgimask;
5125         u32 vht80_ratemask;
5126         u32 early_rx_adjust_enable;
5127         u32 early_rx_tgt_bmiss_num;
5128         u32 early_rx_bmiss_sample_cycle;
5129         u32 early_rx_slop_step;
5130         u32 early_rx_init_slop;
5131         u32 early_rx_adjust_pause;
5132         u32 proxy_sta;
5133         u32 meru_vc;
5134         u32 rx_decap_type;
5135         u32 bw_nss_ratemask;
5136         u32 inc_tsf;
5137         u32 dec_tsf;
5138         u32 disable_4addr_src_lrn;
5139         u32 rtt_responder_role;
5140 };
5141
5142 #define WMI_VDEV_PARAM_UNSUPPORTED 0
5143
5144 /* the definition of different VDEV parameters */
5145 enum wmi_vdev_param {
5146         /* RTS Threshold */
5147         WMI_VDEV_PARAM_RTS_THRESHOLD = 0x1,
5148         /* Fragmentation threshold */
5149         WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
5150         /* beacon interval in TUs */
5151         WMI_VDEV_PARAM_BEACON_INTERVAL,
5152         /* Listen interval in TUs */
5153         WMI_VDEV_PARAM_LISTEN_INTERVAL,
5154         /* multicast rate in Mbps */
5155         WMI_VDEV_PARAM_MULTICAST_RATE,
5156         /* management frame rate in Mbps */
5157         WMI_VDEV_PARAM_MGMT_TX_RATE,
5158         /* slot time (long vs short) */
5159         WMI_VDEV_PARAM_SLOT_TIME,
5160         /* preamble (long vs short) */
5161         WMI_VDEV_PARAM_PREAMBLE,
5162         /* SWBA time (time before tbtt in msec) */
5163         WMI_VDEV_PARAM_SWBA_TIME,
5164         /* time period for updating VDEV stats */
5165         WMI_VDEV_STATS_UPDATE_PERIOD,
5166         /* age out time in msec for frames queued for station in power save */
5167         WMI_VDEV_PWRSAVE_AGEOUT_TIME,
5168         /*
5169          * Host SWBA interval (time in msec before tbtt for SWBA event
5170          * generation).
5171          */
5172         WMI_VDEV_HOST_SWBA_INTERVAL,
5173         /* DTIM period (specified in units of num beacon intervals) */
5174         WMI_VDEV_PARAM_DTIM_PERIOD,
5175         /*
5176          * scheduler air time limit for this VDEV. used by off chan
5177          * scheduler.
5178          */
5179         WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
5180         /* enable/dsiable WDS for this VDEV  */
5181         WMI_VDEV_PARAM_WDS,
5182         /* ATIM Window */
5183         WMI_VDEV_PARAM_ATIM_WINDOW,
5184         /* BMISS max */
5185         WMI_VDEV_PARAM_BMISS_COUNT_MAX,
5186         /* BMISS first time */
5187         WMI_VDEV_PARAM_BMISS_FIRST_BCNT,
5188         /* BMISS final time */
5189         WMI_VDEV_PARAM_BMISS_FINAL_BCNT,
5190         /* WMM enables/disabled */
5191         WMI_VDEV_PARAM_FEATURE_WMM,
5192         /* Channel width */
5193         WMI_VDEV_PARAM_CHWIDTH,
5194         /* Channel Offset */
5195         WMI_VDEV_PARAM_CHEXTOFFSET,
5196         /* Disable HT Protection */
5197         WMI_VDEV_PARAM_DISABLE_HTPROTECTION,
5198         /* Quick STA Kickout */
5199         WMI_VDEV_PARAM_STA_QUICKKICKOUT,
5200         /* Rate to be used with Management frames */
5201         WMI_VDEV_PARAM_MGMT_RATE,
5202         /* Protection Mode */
5203         WMI_VDEV_PARAM_PROTECTION_MODE,
5204         /* Fixed rate setting */
5205         WMI_VDEV_PARAM_FIXED_RATE,
5206         /* Short GI Enable/Disable */
5207         WMI_VDEV_PARAM_SGI,
5208         /* Enable LDPC */
5209         WMI_VDEV_PARAM_LDPC,
5210         /* Enable Tx STBC */
5211         WMI_VDEV_PARAM_TX_STBC,
5212         /* Enable Rx STBC */
5213         WMI_VDEV_PARAM_RX_STBC,
5214         /* Intra BSS forwarding  */
5215         WMI_VDEV_PARAM_INTRA_BSS_FWD,
5216         /* Setting Default xmit key for Vdev */
5217         WMI_VDEV_PARAM_DEF_KEYID,
5218         /* NSS width */
5219         WMI_VDEV_PARAM_NSS,
5220         /* Set the custom rate for the broadcast data frames */
5221         WMI_VDEV_PARAM_BCAST_DATA_RATE,
5222         /* Set the custom rate (rate-code) for multicast data frames */
5223         WMI_VDEV_PARAM_MCAST_DATA_RATE,
5224         /* Tx multicast packet indicate Enable/Disable */
5225         WMI_VDEV_PARAM_MCAST_INDICATE,
5226         /* Tx DHCP packet indicate Enable/Disable */
5227         WMI_VDEV_PARAM_DHCP_INDICATE,
5228         /* Enable host inspection of Tx unicast packet to unknown destination */
5229         WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
5230
5231         /* The minimum amount of time AP begins to consider STA inactive */
5232         WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
5233
5234         /*
5235          * An associated STA is considered inactive when there is no recent
5236          * TX/RX activity and no downlink frames are buffered for it. Once a
5237          * STA exceeds the maximum idle inactive time, the AP will send an
5238          * 802.11 data-null as a keep alive to verify the STA is still
5239          * associated. If the STA does ACK the data-null, or if the data-null
5240          * is buffered and the STA does not retrieve it, the STA will be
5241          * considered unresponsive
5242          * (see WMI_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS).
5243          */
5244         WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
5245
5246         /*
5247          * An associated STA is considered unresponsive if there is no recent
5248          * TX/RX activity and downlink frames are buffered for it. Once a STA
5249          * exceeds the maximum unresponsive time, the AP will send a
5250          * WMI_STA_KICKOUT event to the host so the STA can be deleted.
5251          */
5252         WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
5253
5254         /* Enable NAWDS : MCAST INSPECT Enable, NAWDS Flag set */
5255         WMI_VDEV_PARAM_AP_ENABLE_NAWDS,
5256         /* Enable/Disable RTS-CTS */
5257         WMI_VDEV_PARAM_ENABLE_RTSCTS,
5258         /* Enable TXBFee/er */
5259         WMI_VDEV_PARAM_TXBF,
5260
5261         /* Set packet power save */
5262         WMI_VDEV_PARAM_PACKET_POWERSAVE,
5263
5264         /*
5265          * Drops un-encrypted packets if eceived in an encrypted connection
5266          * otherwise forwards to host.
5267          */
5268         WMI_VDEV_PARAM_DROP_UNENCRY,
5269
5270         /*
5271          * Set the encapsulation type for frames.
5272          */
5273         WMI_VDEV_PARAM_TX_ENCAP_TYPE,
5274 };
5275
5276 /* the definition of different VDEV parameters */
5277 enum wmi_10x_vdev_param {
5278         /* RTS Threshold */
5279         WMI_10X_VDEV_PARAM_RTS_THRESHOLD = 0x1,
5280         /* Fragmentation threshold */
5281         WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
5282         /* beacon interval in TUs */
5283         WMI_10X_VDEV_PARAM_BEACON_INTERVAL,
5284         /* Listen interval in TUs */
5285         WMI_10X_VDEV_PARAM_LISTEN_INTERVAL,
5286         /* multicast rate in Mbps */
5287         WMI_10X_VDEV_PARAM_MULTICAST_RATE,
5288         /* management frame rate in Mbps */
5289         WMI_10X_VDEV_PARAM_MGMT_TX_RATE,
5290         /* slot time (long vs short) */
5291         WMI_10X_VDEV_PARAM_SLOT_TIME,
5292         /* preamble (long vs short) */
5293         WMI_10X_VDEV_PARAM_PREAMBLE,
5294         /* SWBA time (time before tbtt in msec) */
5295         WMI_10X_VDEV_PARAM_SWBA_TIME,
5296         /* time period for updating VDEV stats */
5297         WMI_10X_VDEV_STATS_UPDATE_PERIOD,
5298         /* age out time in msec for frames queued for station in power save */
5299         WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME,
5300         /*
5301          * Host SWBA interval (time in msec before tbtt for SWBA event
5302          * generation).
5303          */
5304         WMI_10X_VDEV_HOST_SWBA_INTERVAL,
5305         /* DTIM period (specified in units of num beacon intervals) */
5306         WMI_10X_VDEV_PARAM_DTIM_PERIOD,
5307         /*
5308          * scheduler air time limit for this VDEV. used by off chan
5309          * scheduler.
5310          */
5311         WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
5312         /* enable/dsiable WDS for this VDEV  */
5313         WMI_10X_VDEV_PARAM_WDS,
5314         /* ATIM Window */
5315         WMI_10X_VDEV_PARAM_ATIM_WINDOW,
5316         /* BMISS max */
5317         WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX,
5318         /* WMM enables/disabled */
5319         WMI_10X_VDEV_PARAM_FEATURE_WMM,
5320         /* Channel width */
5321         WMI_10X_VDEV_PARAM_CHWIDTH,
5322         /* Channel Offset */
5323         WMI_10X_VDEV_PARAM_CHEXTOFFSET,
5324         /* Disable HT Protection */
5325         WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
5326         /* Quick STA Kickout */
5327         WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT,
5328         /* Rate to be used with Management frames */
5329         WMI_10X_VDEV_PARAM_MGMT_RATE,
5330         /* Protection Mode */
5331         WMI_10X_VDEV_PARAM_PROTECTION_MODE,
5332         /* Fixed rate setting */
5333         WMI_10X_VDEV_PARAM_FIXED_RATE,
5334         /* Short GI Enable/Disable */
5335         WMI_10X_VDEV_PARAM_SGI,
5336         /* Enable LDPC */
5337         WMI_10X_VDEV_PARAM_LDPC,
5338         /* Enable Tx STBC */
5339         WMI_10X_VDEV_PARAM_TX_STBC,
5340         /* Enable Rx STBC */
5341         WMI_10X_VDEV_PARAM_RX_STBC,
5342         /* Intra BSS forwarding  */
5343         WMI_10X_VDEV_PARAM_INTRA_BSS_FWD,
5344         /* Setting Default xmit key for Vdev */
5345         WMI_10X_VDEV_PARAM_DEF_KEYID,
5346         /* NSS width */
5347         WMI_10X_VDEV_PARAM_NSS,
5348         /* Set the custom rate for the broadcast data frames */
5349         WMI_10X_VDEV_PARAM_BCAST_DATA_RATE,
5350         /* Set the custom rate (rate-code) for multicast data frames */
5351         WMI_10X_VDEV_PARAM_MCAST_DATA_RATE,
5352         /* Tx multicast packet indicate Enable/Disable */
5353         WMI_10X_VDEV_PARAM_MCAST_INDICATE,
5354         /* Tx DHCP packet indicate Enable/Disable */
5355         WMI_10X_VDEV_PARAM_DHCP_INDICATE,
5356         /* Enable host inspection of Tx unicast packet to unknown destination */
5357         WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
5358
5359         /* The minimum amount of time AP begins to consider STA inactive */
5360         WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
5361
5362         /*
5363          * An associated STA is considered inactive when there is no recent
5364          * TX/RX activity and no downlink frames are buffered for it. Once a
5365          * STA exceeds the maximum idle inactive time, the AP will send an
5366          * 802.11 data-null as a keep alive to verify the STA is still
5367          * associated. If the STA does ACK the data-null, or if the data-null
5368          * is buffered and the STA does not retrieve it, the STA will be
5369          * considered unresponsive
5370          * (see WMI_10X_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS).
5371          */
5372         WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
5373
5374         /*
5375          * An associated STA is considered unresponsive if there is no recent
5376          * TX/RX activity and downlink frames are buffered for it. Once a STA
5377          * exceeds the maximum unresponsive time, the AP will send a
5378          * WMI_10X_STA_KICKOUT event to the host so the STA can be deleted.
5379          */
5380         WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
5381
5382         /* Enable NAWDS : MCAST INSPECT Enable, NAWDS Flag set */
5383         WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS,
5384
5385         WMI_10X_VDEV_PARAM_MCAST2UCAST_SET,
5386         /* Enable/Disable RTS-CTS */
5387         WMI_10X_VDEV_PARAM_ENABLE_RTSCTS,
5388
5389         WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
5390
5391         /* following are available as of firmware 10.2 */
5392         WMI_10X_VDEV_PARAM_TX_ENCAP_TYPE,
5393         WMI_10X_VDEV_PARAM_CABQ_MAXDUR,
5394         WMI_10X_VDEV_PARAM_MFPTEST_SET,
5395         WMI_10X_VDEV_PARAM_RTS_FIXED_RATE,
5396         WMI_10X_VDEV_PARAM_VHT_SGIMASK,
5397         WMI_10X_VDEV_PARAM_VHT80_RATEMASK,
5398         WMI_10X_VDEV_PARAM_TSF_INCREMENT,
5399 };
5400
5401 enum wmi_10_4_vdev_param {
5402         WMI_10_4_VDEV_PARAM_RTS_THRESHOLD = 0x1,
5403         WMI_10_4_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
5404         WMI_10_4_VDEV_PARAM_BEACON_INTERVAL,
5405         WMI_10_4_VDEV_PARAM_LISTEN_INTERVAL,
5406         WMI_10_4_VDEV_PARAM_MULTICAST_RATE,
5407         WMI_10_4_VDEV_PARAM_MGMT_TX_RATE,
5408         WMI_10_4_VDEV_PARAM_SLOT_TIME,
5409         WMI_10_4_VDEV_PARAM_PREAMBLE,
5410         WMI_10_4_VDEV_PARAM_SWBA_TIME,
5411         WMI_10_4_VDEV_STATS_UPDATE_PERIOD,
5412         WMI_10_4_VDEV_PWRSAVE_AGEOUT_TIME,
5413         WMI_10_4_VDEV_HOST_SWBA_INTERVAL,
5414         WMI_10_4_VDEV_PARAM_DTIM_PERIOD,
5415         WMI_10_4_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
5416         WMI_10_4_VDEV_PARAM_WDS,
5417         WMI_10_4_VDEV_PARAM_ATIM_WINDOW,
5418         WMI_10_4_VDEV_PARAM_BMISS_COUNT_MAX,
5419         WMI_10_4_VDEV_PARAM_BMISS_FIRST_BCNT,
5420         WMI_10_4_VDEV_PARAM_BMISS_FINAL_BCNT,
5421         WMI_10_4_VDEV_PARAM_FEATURE_WMM,
5422         WMI_10_4_VDEV_PARAM_CHWIDTH,
5423         WMI_10_4_VDEV_PARAM_CHEXTOFFSET,
5424         WMI_10_4_VDEV_PARAM_DISABLE_HTPROTECTION,
5425         WMI_10_4_VDEV_PARAM_STA_QUICKKICKOUT,
5426         WMI_10_4_VDEV_PARAM_MGMT_RATE,
5427         WMI_10_4_VDEV_PARAM_PROTECTION_MODE,
5428         WMI_10_4_VDEV_PARAM_FIXED_RATE,
5429         WMI_10_4_VDEV_PARAM_SGI,
5430         WMI_10_4_VDEV_PARAM_LDPC,
5431         WMI_10_4_VDEV_PARAM_TX_STBC,
5432         WMI_10_4_VDEV_PARAM_RX_STBC,
5433         WMI_10_4_VDEV_PARAM_INTRA_BSS_FWD,
5434         WMI_10_4_VDEV_PARAM_DEF_KEYID,
5435         WMI_10_4_VDEV_PARAM_NSS,
5436         WMI_10_4_VDEV_PARAM_BCAST_DATA_RATE,
5437         WMI_10_4_VDEV_PARAM_MCAST_DATA_RATE,
5438         WMI_10_4_VDEV_PARAM_MCAST_INDICATE,
5439         WMI_10_4_VDEV_PARAM_DHCP_INDICATE,
5440         WMI_10_4_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
5441         WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
5442         WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
5443         WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
5444         WMI_10_4_VDEV_PARAM_AP_ENABLE_NAWDS,
5445         WMI_10_4_VDEV_PARAM_MCAST2UCAST_SET,
5446         WMI_10_4_VDEV_PARAM_ENABLE_RTSCTS,
5447         WMI_10_4_VDEV_PARAM_RC_NUM_RETRIES,
5448         WMI_10_4_VDEV_PARAM_TXBF,
5449         WMI_10_4_VDEV_PARAM_PACKET_POWERSAVE,
5450         WMI_10_4_VDEV_PARAM_DROP_UNENCRY,
5451         WMI_10_4_VDEV_PARAM_TX_ENCAP_TYPE,
5452         WMI_10_4_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
5453         WMI_10_4_VDEV_PARAM_CABQ_MAXDUR,
5454         WMI_10_4_VDEV_PARAM_MFPTEST_SET,
5455         WMI_10_4_VDEV_PARAM_RTS_FIXED_RATE,
5456         WMI_10_4_VDEV_PARAM_VHT_SGIMASK,
5457         WMI_10_4_VDEV_PARAM_VHT80_RATEMASK,
5458         WMI_10_4_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5459         WMI_10_4_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5460         WMI_10_4_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5461         WMI_10_4_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5462         WMI_10_4_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5463         WMI_10_4_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5464         WMI_10_4_VDEV_PARAM_PROXY_STA,
5465         WMI_10_4_VDEV_PARAM_MERU_VC,
5466         WMI_10_4_VDEV_PARAM_RX_DECAP_TYPE,
5467         WMI_10_4_VDEV_PARAM_BW_NSS_RATEMASK,
5468         WMI_10_4_VDEV_PARAM_SENSOR_AP,
5469         WMI_10_4_VDEV_PARAM_BEACON_RATE,
5470         WMI_10_4_VDEV_PARAM_DTIM_ENABLE_CTS,
5471         WMI_10_4_VDEV_PARAM_STA_KICKOUT,
5472         WMI_10_4_VDEV_PARAM_CAPABILITIES,
5473         WMI_10_4_VDEV_PARAM_TSF_INCREMENT,
5474         WMI_10_4_VDEV_PARAM_RX_FILTER,
5475         WMI_10_4_VDEV_PARAM_MGMT_TX_POWER,
5476         WMI_10_4_VDEV_PARAM_ATF_SSID_SCHED_POLICY,
5477         WMI_10_4_VDEV_PARAM_DISABLE_DYN_BW_RTS,
5478         WMI_10_4_VDEV_PARAM_TSF_DECREMENT,
5479         WMI_10_4_VDEV_PARAM_SELFGEN_FIXED_RATE,
5480         WMI_10_4_VDEV_PARAM_AMPDU_SUBFRAME_SIZE_PER_AC,
5481         WMI_10_4_VDEV_PARAM_NSS_VHT160,
5482         WMI_10_4_VDEV_PARAM_NSS_VHT80_80,
5483         WMI_10_4_VDEV_PARAM_AMSDU_SUBFRAME_SIZE_PER_AC,
5484         WMI_10_4_VDEV_PARAM_DISABLE_CABQ,
5485         WMI_10_4_VDEV_PARAM_SIFS_TRIGGER_RATE,
5486         WMI_10_4_VDEV_PARAM_TX_POWER,
5487         WMI_10_4_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE,
5488         WMI_10_4_VDEV_PARAM_DISABLE_4_ADDR_SRC_LRN,
5489 };
5490
5491 #define WMI_VDEV_DISABLE_4_ADDR_SRC_LRN 1
5492
5493 #define WMI_VDEV_PARAM_TXBF_SU_TX_BFEE BIT(0)
5494 #define WMI_VDEV_PARAM_TXBF_MU_TX_BFEE BIT(1)
5495 #define WMI_VDEV_PARAM_TXBF_SU_TX_BFER BIT(2)
5496 #define WMI_VDEV_PARAM_TXBF_MU_TX_BFER BIT(3)
5497
5498 #define WMI_TXBF_STS_CAP_OFFSET_LSB     4
5499 #define WMI_TXBF_STS_CAP_OFFSET_MASK    0x70
5500 #define WMI_TXBF_CONF_IMPLICIT_BF       BIT(7)
5501 #define WMI_BF_SOUND_DIM_OFFSET_LSB     8
5502 #define WMI_BF_SOUND_DIM_OFFSET_MASK    0xf00
5503
5504 /* slot time long */
5505 #define WMI_VDEV_SLOT_TIME_LONG         0x1
5506 /* slot time short */
5507 #define WMI_VDEV_SLOT_TIME_SHORT        0x2
5508 /* preablbe long */
5509 #define WMI_VDEV_PREAMBLE_LONG          0x1
5510 /* preablbe short */
5511 #define WMI_VDEV_PREAMBLE_SHORT         0x2
5512
5513 enum wmi_start_event_param {
5514         WMI_VDEV_RESP_START_EVENT = 0,
5515         WMI_VDEV_RESP_RESTART_EVENT,
5516 };
5517
5518 struct wmi_vdev_start_response_event {
5519         __le32 vdev_id;
5520         __le32 req_id;
5521         __le32 resp_type; /* %WMI_VDEV_RESP_ */
5522         __le32 status;
5523 } __packed;
5524
5525 struct wmi_vdev_standby_req_event {
5526         /* unique id identifying the VDEV, generated by the caller */
5527         __le32 vdev_id;
5528 } __packed;
5529
5530 struct wmi_vdev_resume_req_event {
5531         /* unique id identifying the VDEV, generated by the caller */
5532         __le32 vdev_id;
5533 } __packed;
5534
5535 struct wmi_vdev_stopped_event {
5536         /* unique id identifying the VDEV, generated by the caller */
5537         __le32 vdev_id;
5538 } __packed;
5539
5540 /*
5541  * common structure used for simple events
5542  * (stopped, resume_req, standby response)
5543  */
5544 struct wmi_vdev_simple_event {
5545         /* unique id identifying the VDEV, generated by the caller */
5546         __le32 vdev_id;
5547 } __packed;
5548
5549 /* VDEV start response status codes */
5550 /* VDEV successfully started */
5551 #define WMI_INIFIED_VDEV_START_RESPONSE_STATUS_SUCCESS  0x0
5552
5553 /* requested VDEV not found */
5554 #define WMI_INIFIED_VDEV_START_RESPONSE_INVALID_VDEVID  0x1
5555
5556 /* unsupported VDEV combination */
5557 #define WMI_INIFIED_VDEV_START_RESPONSE_NOT_SUPPORTED   0x2
5558
5559 /* TODO: please add more comments if you have in-depth information */
5560 struct wmi_vdev_spectral_conf_cmd {
5561         __le32 vdev_id;
5562
5563         /* number of fft samples to send (0 for infinite) */
5564         __le32 scan_count;
5565         __le32 scan_period;
5566         __le32 scan_priority;
5567
5568         /* number of bins in the FFT: 2^(fft_size - bin_scale) */
5569         __le32 scan_fft_size;
5570         __le32 scan_gc_ena;
5571         __le32 scan_restart_ena;
5572         __le32 scan_noise_floor_ref;
5573         __le32 scan_init_delay;
5574         __le32 scan_nb_tone_thr;
5575         __le32 scan_str_bin_thr;
5576         __le32 scan_wb_rpt_mode;
5577         __le32 scan_rssi_rpt_mode;
5578         __le32 scan_rssi_thr;
5579         __le32 scan_pwr_format;
5580
5581         /* rpt_mode: Format of FFT report to software for spectral scan
5582          * triggered FFTs:
5583          *      0: No FFT report (only spectral scan summary report)
5584          *      1: 2-dword summary of metrics for each completed FFT + spectral
5585          *         scan summary report
5586          *      2: 2-dword summary of metrics for each completed FFT +
5587          *         1x- oversampled bins(in-band) per FFT + spectral scan summary
5588          *         report
5589          *      3: 2-dword summary of metrics for each completed FFT +
5590          *         2x- oversampled bins (all) per FFT + spectral scan summary
5591          */
5592         __le32 scan_rpt_mode;
5593         __le32 scan_bin_scale;
5594         __le32 scan_dbm_adj;
5595         __le32 scan_chn_mask;
5596 } __packed;
5597
5598 struct wmi_vdev_spectral_conf_arg {
5599         u32 vdev_id;
5600         u32 scan_count;
5601         u32 scan_period;
5602         u32 scan_priority;
5603         u32 scan_fft_size;
5604         u32 scan_gc_ena;
5605         u32 scan_restart_ena;
5606         u32 scan_noise_floor_ref;
5607         u32 scan_init_delay;
5608         u32 scan_nb_tone_thr;
5609         u32 scan_str_bin_thr;
5610         u32 scan_wb_rpt_mode;
5611         u32 scan_rssi_rpt_mode;
5612         u32 scan_rssi_thr;
5613         u32 scan_pwr_format;
5614         u32 scan_rpt_mode;
5615         u32 scan_bin_scale;
5616         u32 scan_dbm_adj;
5617         u32 scan_chn_mask;
5618 };
5619
5620 #define WMI_SPECTRAL_ENABLE_DEFAULT              0
5621 #define WMI_SPECTRAL_COUNT_DEFAULT               0
5622 #define WMI_SPECTRAL_PERIOD_DEFAULT             35
5623 #define WMI_SPECTRAL_PRIORITY_DEFAULT            1
5624 #define WMI_SPECTRAL_FFT_SIZE_DEFAULT            7
5625 #define WMI_SPECTRAL_GC_ENA_DEFAULT              1
5626 #define WMI_SPECTRAL_RESTART_ENA_DEFAULT         0
5627 #define WMI_SPECTRAL_NOISE_FLOOR_REF_DEFAULT   -96
5628 #define WMI_SPECTRAL_INIT_DELAY_DEFAULT         80
5629 #define WMI_SPECTRAL_NB_TONE_THR_DEFAULT        12
5630 #define WMI_SPECTRAL_STR_BIN_THR_DEFAULT         8
5631 #define WMI_SPECTRAL_WB_RPT_MODE_DEFAULT         0
5632 #define WMI_SPECTRAL_RSSI_RPT_MODE_DEFAULT       0
5633 #define WMI_SPECTRAL_RSSI_THR_DEFAULT         0xf0
5634 #define WMI_SPECTRAL_PWR_FORMAT_DEFAULT          0
5635 #define WMI_SPECTRAL_RPT_MODE_DEFAULT            2
5636 #define WMI_SPECTRAL_BIN_SCALE_DEFAULT           1
5637 #define WMI_SPECTRAL_DBM_ADJ_DEFAULT             1
5638 #define WMI_SPECTRAL_CHN_MASK_DEFAULT            1
5639
5640 struct wmi_vdev_spectral_enable_cmd {
5641         __le32 vdev_id;
5642         __le32 trigger_cmd;
5643         __le32 enable_cmd;
5644 } __packed;
5645
5646 #define WMI_SPECTRAL_TRIGGER_CMD_TRIGGER  1
5647 #define WMI_SPECTRAL_TRIGGER_CMD_CLEAR    2
5648 #define WMI_SPECTRAL_ENABLE_CMD_ENABLE    1
5649 #define WMI_SPECTRAL_ENABLE_CMD_DISABLE   2
5650
5651 /* Beacon processing related command and event structures */
5652 struct wmi_bcn_tx_hdr {
5653         __le32 vdev_id;
5654         __le32 tx_rate;
5655         __le32 tx_power;
5656         __le32 bcn_len;
5657 } __packed;
5658
5659 struct wmi_bcn_tx_cmd {
5660         struct wmi_bcn_tx_hdr hdr;
5661         u8 *bcn[0];
5662 } __packed;
5663
5664 struct wmi_bcn_tx_arg {
5665         u32 vdev_id;
5666         u32 tx_rate;
5667         u32 tx_power;
5668         u32 bcn_len;
5669         const void *bcn;
5670 };
5671
5672 enum wmi_bcn_tx_ref_flags {
5673         WMI_BCN_TX_REF_FLAG_DTIM_ZERO = 0x1,
5674         WMI_BCN_TX_REF_FLAG_DELIVER_CAB = 0x2,
5675 };
5676
5677 /* TODO: It is unclear why "no antenna" works while any other seemingly valid
5678  * chainmask yields no beacons on the air at all.
5679  */
5680 #define WMI_BCN_TX_REF_DEF_ANTENNA 0
5681
5682 struct wmi_bcn_tx_ref_cmd {
5683         __le32 vdev_id;
5684         __le32 data_len;
5685         /* physical address of the frame - dma pointer */
5686         __le32 data_ptr;
5687         /* id for host to track */
5688         __le32 msdu_id;
5689         /* frame ctrl to setup PPDU desc */
5690         __le32 frame_control;
5691         /* to control CABQ traffic: WMI_BCN_TX_REF_FLAG_ */
5692         __le32 flags;
5693         /* introduced in 10.2 */
5694         __le32 antenna_mask;
5695 } __packed;
5696
5697 /* Beacon filter */
5698 #define WMI_BCN_FILTER_ALL   0 /* Filter all beacons */
5699 #define WMI_BCN_FILTER_NONE  1 /* Pass all beacons */
5700 #define WMI_BCN_FILTER_RSSI  2 /* Pass Beacons RSSI >= RSSI threshold */
5701 #define WMI_BCN_FILTER_BSSID 3 /* Pass Beacons with matching BSSID */
5702 #define WMI_BCN_FILTER_SSID  4 /* Pass Beacons with matching SSID */
5703
5704 struct wmi_bcn_filter_rx_cmd {
5705         /* Filter ID */
5706         __le32 bcn_filter_id;
5707         /* Filter type - wmi_bcn_filter */
5708         __le32 bcn_filter;
5709         /* Buffer len */
5710         __le32 bcn_filter_len;
5711         /* Filter info (threshold, BSSID, RSSI) */
5712         u8 *bcn_filter_buf;
5713 } __packed;
5714
5715 /* Capabilities and IEs to be passed to firmware */
5716 struct wmi_bcn_prb_info {
5717         /* Capabilities */
5718         __le32 caps;
5719         /* ERP info */
5720         __le32 erp;
5721         /* Advanced capabilities */
5722         /* HT capabilities */
5723         /* HT Info */
5724         /* ibss_dfs */
5725         /* wpa Info */
5726         /* rsn Info */
5727         /* rrm info */
5728         /* ath_ext */
5729         /* app IE */
5730 } __packed;
5731
5732 struct wmi_bcn_tmpl_cmd {
5733         /* unique id identifying the VDEV, generated by the caller */
5734         __le32 vdev_id;
5735         /* TIM IE offset from the beginning of the template. */
5736         __le32 tim_ie_offset;
5737         /* beacon probe capabilities and IEs */
5738         struct wmi_bcn_prb_info bcn_prb_info;
5739         /* beacon buffer length */
5740         __le32 buf_len;
5741         /* variable length data */
5742         u8 data[1];
5743 } __packed;
5744
5745 struct wmi_prb_tmpl_cmd {
5746         /* unique id identifying the VDEV, generated by the caller */
5747         __le32 vdev_id;
5748         /* beacon probe capabilities and IEs */
5749         struct wmi_bcn_prb_info bcn_prb_info;
5750         /* beacon buffer length */
5751         __le32 buf_len;
5752         /* Variable length data */
5753         u8 data[1];
5754 } __packed;
5755
5756 enum wmi_sta_ps_mode {
5757         /* enable power save for the given STA VDEV */
5758         WMI_STA_PS_MODE_DISABLED = 0,
5759         /* disable power save  for a given STA VDEV */
5760         WMI_STA_PS_MODE_ENABLED = 1,
5761 };
5762
5763 struct wmi_sta_powersave_mode_cmd {
5764         /* unique id identifying the VDEV, generated by the caller */
5765         __le32 vdev_id;
5766
5767         /*
5768          * Power save mode
5769          * (see enum wmi_sta_ps_mode)
5770          */
5771         __le32 sta_ps_mode;
5772 } __packed;
5773
5774 enum wmi_csa_offload_en {
5775         WMI_CSA_OFFLOAD_DISABLE = 0,
5776         WMI_CSA_OFFLOAD_ENABLE = 1,
5777 };
5778
5779 struct wmi_csa_offload_enable_cmd {
5780         __le32 vdev_id;
5781         __le32 csa_offload_enable;
5782 } __packed;
5783
5784 struct wmi_csa_offload_chanswitch_cmd {
5785         __le32 vdev_id;
5786         struct wmi_channel chan;
5787 } __packed;
5788
5789 /*
5790  * This parameter controls the policy for retrieving frames from AP while the
5791  * STA is in sleep state.
5792  *
5793  * Only takes affect if the sta_ps_mode is enabled
5794  */
5795 enum wmi_sta_ps_param_rx_wake_policy {
5796         /*
5797          * Wake up when ever there is an  RX activity on the VDEV. In this mode
5798          * the Power save SM(state machine) will come out of sleep by either
5799          * sending null frame (or) a data frame (with PS==0) in response to TIM
5800          * bit set in the received beacon frame from AP.
5801          */
5802         WMI_STA_PS_RX_WAKE_POLICY_WAKE = 0,
5803
5804         /*
5805          * Here the power save state machine will not wakeup in response to TIM
5806          * bit, instead it will send a PSPOLL (or) UASPD trigger based on UAPSD
5807          * configuration setup by WMISET_PS_SET_UAPSD  WMI command.  When all
5808          * access categories are delivery-enabled, the station will send a
5809          * UAPSD trigger frame, otherwise it will send a PS-Poll.
5810          */
5811         WMI_STA_PS_RX_WAKE_POLICY_POLL_UAPSD = 1,
5812 };
5813
5814 /*
5815  * Number of tx frames/beacon  that cause the power save SM to wake up.
5816  *
5817  * Value 1 causes the SM to wake up for every TX. Value 0 has a special
5818  * meaning, It will cause the SM to never wake up. This is useful if you want
5819  * to keep the system to sleep all the time for some kind of test mode . host
5820  * can change this parameter any time.  It will affect at the next tx frame.
5821  */
5822 enum wmi_sta_ps_param_tx_wake_threshold {
5823         WMI_STA_PS_TX_WAKE_THRESHOLD_NEVER = 0,
5824         WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS = 1,
5825
5826         /*
5827          * Values greater than one indicate that many TX attempts per beacon
5828          * interval before the STA will wake up
5829          */
5830 };
5831
5832 /*
5833  * The maximum number of PS-Poll frames the FW will send in response to
5834  * traffic advertised in TIM before waking up (by sending a null frame with PS
5835  * = 0). Value 0 has a special meaning: there is no maximum count and the FW
5836  * will send as many PS-Poll as are necessary to retrieve buffered BU. This
5837  * parameter is used when the RX wake policy is
5838  * WMI_STA_PS_RX_WAKE_POLICY_POLL_UAPSD and ignored when the RX wake
5839  * policy is WMI_STA_PS_RX_WAKE_POLICY_WAKE.
5840  */
5841 enum wmi_sta_ps_param_pspoll_count {
5842         WMI_STA_PS_PSPOLL_COUNT_NO_MAX = 0,
5843         /*
5844          * Values greater than 0 indicate the maximum numer of PS-Poll frames
5845          * FW will send before waking up.
5846          */
5847
5848         /* When u-APSD is enabled the firmware will be very reluctant to exit
5849          * STA PS. This could result in very poor Rx performance with STA doing
5850          * PS-Poll for each and every buffered frame. This value is a bit
5851          * arbitrary.
5852          */
5853         WMI_STA_PS_PSPOLL_COUNT_UAPSD = 3,
5854 };
5855
5856 /*
5857  * This will include the delivery and trigger enabled state for every AC.
5858  * This is the negotiated state with AP. The host MLME needs to set this based
5859  * on AP capability and the state Set in the association request by the
5860  * station MLME.Lower 8 bits of the value specify the UAPSD configuration.
5861  */
5862 #define WMI_UAPSD_AC_TYPE_DELI 0
5863 #define WMI_UAPSD_AC_TYPE_TRIG 1
5864
5865 #define WMI_UAPSD_AC_BIT_MASK(ac, type) \
5866         (type == WMI_UAPSD_AC_TYPE_DELI ? 1 << (ac << 1) : 1 << ((ac << 1) + 1))
5867
5868 enum wmi_sta_ps_param_uapsd {
5869         WMI_STA_PS_UAPSD_AC0_DELIVERY_EN = (1 << 0),
5870         WMI_STA_PS_UAPSD_AC0_TRIGGER_EN  = (1 << 1),
5871         WMI_STA_PS_UAPSD_AC1_DELIVERY_EN = (1 << 2),
5872         WMI_STA_PS_UAPSD_AC1_TRIGGER_EN  = (1 << 3),
5873         WMI_STA_PS_UAPSD_AC2_DELIVERY_EN = (1 << 4),
5874         WMI_STA_PS_UAPSD_AC2_TRIGGER_EN  = (1 << 5),
5875         WMI_STA_PS_UAPSD_AC3_DELIVERY_EN = (1 << 6),
5876         WMI_STA_PS_UAPSD_AC3_TRIGGER_EN  = (1 << 7),
5877 };
5878
5879 #define WMI_STA_UAPSD_MAX_INTERVAL_MSEC UINT_MAX
5880
5881 struct wmi_sta_uapsd_auto_trig_param {
5882         __le32 wmm_ac;
5883         __le32 user_priority;
5884         __le32 service_interval;
5885         __le32 suspend_interval;
5886         __le32 delay_interval;
5887 };
5888
5889 struct wmi_sta_uapsd_auto_trig_cmd_fixed_param {
5890         __le32 vdev_id;
5891         struct wmi_mac_addr peer_macaddr;
5892         __le32 num_ac;
5893 };
5894
5895 struct wmi_sta_uapsd_auto_trig_arg {
5896         u32 wmm_ac;
5897         u32 user_priority;
5898         u32 service_interval;
5899         u32 suspend_interval;
5900         u32 delay_interval;
5901 };
5902
5903 enum wmi_sta_powersave_param {
5904         /*
5905          * Controls how frames are retrievd from AP while STA is sleeping
5906          *
5907          * (see enum wmi_sta_ps_param_rx_wake_policy)
5908          */
5909         WMI_STA_PS_PARAM_RX_WAKE_POLICY = 0,
5910
5911         /*
5912          * The STA will go active after this many TX
5913          *
5914          * (see enum wmi_sta_ps_param_tx_wake_threshold)
5915          */
5916         WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD = 1,
5917
5918         /*
5919          * Number of PS-Poll to send before STA wakes up
5920          *
5921          * (see enum wmi_sta_ps_param_pspoll_count)
5922          *
5923          */
5924         WMI_STA_PS_PARAM_PSPOLL_COUNT = 2,
5925
5926         /*
5927          * TX/RX inactivity time in msec before going to sleep.
5928          *
5929          * The power save SM will monitor tx/rx activity on the VDEV, if no
5930          * activity for the specified msec of the parameter the Power save
5931          * SM will go to sleep.
5932          */
5933         WMI_STA_PS_PARAM_INACTIVITY_TIME = 3,
5934
5935         /*
5936          * Set uapsd configuration.
5937          *
5938          * (see enum wmi_sta_ps_param_uapsd)
5939          */
5940         WMI_STA_PS_PARAM_UAPSD = 4,
5941 };
5942
5943 struct wmi_sta_powersave_param_cmd {
5944         __le32 vdev_id;
5945         __le32 param_id; /* %WMI_STA_PS_PARAM_ */
5946         __le32 param_value;
5947 } __packed;
5948
5949 /* No MIMO power save */
5950 #define WMI_STA_MIMO_PS_MODE_DISABLE
5951 /* mimo powersave mode static*/
5952 #define WMI_STA_MIMO_PS_MODE_STATIC
5953 /* mimo powersave mode dynamic */
5954 #define WMI_STA_MIMO_PS_MODE_DYNAMIC
5955
5956 struct wmi_sta_mimo_ps_mode_cmd {
5957         /* unique id identifying the VDEV, generated by the caller */
5958         __le32 vdev_id;
5959         /* mimo powersave mode as defined above */
5960         __le32 mimo_pwrsave_mode;
5961 } __packed;
5962
5963 /* U-APSD configuration of peer station from (re)assoc request and TSPECs */
5964 enum wmi_ap_ps_param_uapsd {
5965         WMI_AP_PS_UAPSD_AC0_DELIVERY_EN = (1 << 0),
5966         WMI_AP_PS_UAPSD_AC0_TRIGGER_EN  = (1 << 1),
5967         WMI_AP_PS_UAPSD_AC1_DELIVERY_EN = (1 << 2),
5968         WMI_AP_PS_UAPSD_AC1_TRIGGER_EN  = (1 << 3),
5969         WMI_AP_PS_UAPSD_AC2_DELIVERY_EN = (1 << 4),
5970         WMI_AP_PS_UAPSD_AC2_TRIGGER_EN  = (1 << 5),
5971         WMI_AP_PS_UAPSD_AC3_DELIVERY_EN = (1 << 6),
5972         WMI_AP_PS_UAPSD_AC3_TRIGGER_EN  = (1 << 7),
5973 };
5974
5975 /* U-APSD maximum service period of peer station */
5976 enum wmi_ap_ps_peer_param_max_sp {
5977         WMI_AP_PS_PEER_PARAM_MAX_SP_UNLIMITED = 0,
5978         WMI_AP_PS_PEER_PARAM_MAX_SP_2 = 1,
5979         WMI_AP_PS_PEER_PARAM_MAX_SP_4 = 2,
5980         WMI_AP_PS_PEER_PARAM_MAX_SP_6 = 3,
5981         MAX_WMI_AP_PS_PEER_PARAM_MAX_SP,
5982 };
5983
5984 /*
5985  * AP power save parameter
5986  * Set a power save specific parameter for a peer station
5987  */
5988 enum wmi_ap_ps_peer_param {
5989         /* Set uapsd configuration for a given peer.
5990          *
5991          * Include the delivery and trigger enabled state for every AC.
5992          * The host  MLME needs to set this based on AP capability and stations
5993          * request Set in the association request  received from the station.
5994          *
5995          * Lower 8 bits of the value specify the UAPSD configuration.
5996          *
5997          * (see enum wmi_ap_ps_param_uapsd)
5998          * The default value is 0.
5999          */
6000         WMI_AP_PS_PEER_PARAM_UAPSD = 0,
6001
6002         /*
6003          * Set the service period for a UAPSD capable station
6004          *
6005          * The service period from wme ie in the (re)assoc request frame.
6006          *
6007          * (see enum wmi_ap_ps_peer_param_max_sp)
6008          */
6009         WMI_AP_PS_PEER_PARAM_MAX_SP = 1,
6010
6011         /* Time in seconds for aging out buffered frames for STA in PS */
6012         WMI_AP_PS_PEER_PARAM_AGEOUT_TIME = 2,
6013 };
6014
6015 struct wmi_ap_ps_peer_cmd {
6016         /* unique id identifying the VDEV, generated by the caller */
6017         __le32 vdev_id;
6018
6019         /* peer MAC address */
6020         struct wmi_mac_addr peer_macaddr;
6021
6022         /* AP powersave param (see enum wmi_ap_ps_peer_param) */
6023         __le32 param_id;
6024
6025         /* AP powersave param value */
6026         __le32 param_value;
6027 } __packed;
6028
6029 /* 128 clients = 4 words */
6030 #define WMI_TIM_BITMAP_ARRAY_SIZE 4
6031
6032 struct wmi_tim_info {
6033         __le32 tim_len;
6034         __le32 tim_mcast;
6035         __le32 tim_bitmap[WMI_TIM_BITMAP_ARRAY_SIZE];
6036         __le32 tim_changed;
6037         __le32 tim_num_ps_pending;
6038 } __packed;
6039
6040 struct wmi_tim_info_arg {
6041         __le32 tim_len;
6042         __le32 tim_mcast;
6043         const __le32 *tim_bitmap;
6044         __le32 tim_changed;
6045         __le32 tim_num_ps_pending;
6046 } __packed;
6047
6048 /* Maximum number of NOA Descriptors supported */
6049 #define WMI_P2P_MAX_NOA_DESCRIPTORS 4
6050 #define WMI_P2P_OPPPS_ENABLE_BIT        BIT(0)
6051 #define WMI_P2P_OPPPS_CTWINDOW_OFFSET   1
6052 #define WMI_P2P_NOA_CHANGED_BIT BIT(0)
6053
6054 struct wmi_p2p_noa_info {
6055         /* Bit 0 - Flag to indicate an update in NOA schedule
6056          * Bits 7-1 - Reserved
6057          */
6058         u8 changed;
6059         /* NOA index */
6060         u8 index;
6061         /* Bit 0 - Opp PS state of the AP
6062          * Bits 1-7 - Ctwindow in TUs
6063          */
6064         u8 ctwindow_oppps;
6065         /* Number of NOA descriptors */
6066         u8 num_descriptors;
6067
6068         struct wmi_p2p_noa_descriptor descriptors[WMI_P2P_MAX_NOA_DESCRIPTORS];
6069 } __packed;
6070
6071 struct wmi_bcn_info {
6072         struct wmi_tim_info tim_info;
6073         struct wmi_p2p_noa_info p2p_noa_info;
6074 } __packed;
6075
6076 struct wmi_host_swba_event {
6077         __le32 vdev_map;
6078         struct wmi_bcn_info bcn_info[0];
6079 } __packed;
6080
6081 struct wmi_10_2_4_bcn_info {
6082         struct wmi_tim_info tim_info;
6083         /* The 10.2.4 FW doesn't have p2p NOA info */
6084 } __packed;
6085
6086 struct wmi_10_2_4_host_swba_event {
6087         __le32 vdev_map;
6088         struct wmi_10_2_4_bcn_info bcn_info[0];
6089 } __packed;
6090
6091 /* 16 words = 512 client + 1 word = for guard */
6092 #define WMI_10_4_TIM_BITMAP_ARRAY_SIZE 17
6093
6094 struct wmi_10_4_tim_info {
6095         __le32 tim_len;
6096         __le32 tim_mcast;
6097         __le32 tim_bitmap[WMI_10_4_TIM_BITMAP_ARRAY_SIZE];
6098         __le32 tim_changed;
6099         __le32 tim_num_ps_pending;
6100 } __packed;
6101
6102 #define WMI_10_4_P2P_MAX_NOA_DESCRIPTORS 1
6103
6104 struct wmi_10_4_p2p_noa_info {
6105         /* Bit 0 - Flag to indicate an update in NOA schedule
6106          * Bits 7-1 - Reserved
6107          */
6108         u8 changed;
6109         /* NOA index */
6110         u8 index;
6111         /* Bit 0 - Opp PS state of the AP
6112          * Bits 1-7 - Ctwindow in TUs
6113          */
6114         u8 ctwindow_oppps;
6115         /* Number of NOA descriptors */
6116         u8 num_descriptors;
6117
6118         struct wmi_p2p_noa_descriptor
6119                 noa_descriptors[WMI_10_4_P2P_MAX_NOA_DESCRIPTORS];
6120 } __packed;
6121
6122 struct wmi_10_4_bcn_info {
6123         struct wmi_10_4_tim_info tim_info;
6124         struct wmi_10_4_p2p_noa_info p2p_noa_info;
6125 } __packed;
6126
6127 struct wmi_10_4_host_swba_event {
6128         __le32 vdev_map;
6129         struct wmi_10_4_bcn_info bcn_info[0];
6130 } __packed;
6131
6132 #define WMI_MAX_AP_VDEV 16
6133
6134 struct wmi_tbtt_offset_event {
6135         __le32 vdev_map;
6136         __le32 tbttoffset_list[WMI_MAX_AP_VDEV];
6137 } __packed;
6138
6139 struct wmi_peer_create_cmd {
6140         __le32 vdev_id;
6141         struct wmi_mac_addr peer_macaddr;
6142         __le32 peer_type;
6143 } __packed;
6144
6145 enum wmi_peer_type {
6146         WMI_PEER_TYPE_DEFAULT = 0,
6147         WMI_PEER_TYPE_BSS = 1,
6148         WMI_PEER_TYPE_TDLS = 2,
6149 };
6150
6151 struct wmi_peer_delete_cmd {
6152         __le32 vdev_id;
6153         struct wmi_mac_addr peer_macaddr;
6154 } __packed;
6155
6156 struct wmi_peer_flush_tids_cmd {
6157         __le32 vdev_id;
6158         struct wmi_mac_addr peer_macaddr;
6159         __le32 peer_tid_bitmap;
6160 } __packed;
6161
6162 struct wmi_fixed_rate {
6163         /*
6164          * rate mode . 0: disable fixed rate (auto rate)
6165          *   1: legacy (non 11n) rate  specified as ieee rate 2*Mbps
6166          *   2: ht20 11n rate  specified as mcs index
6167          *   3: ht40 11n rate  specified as mcs index
6168          */
6169         __le32  rate_mode;
6170         /*
6171          * 4 rate values for 4 rate series. series 0 is stored in byte 0 (LSB)
6172          * and series 3 is stored at byte 3 (MSB)
6173          */
6174         __le32  rate_series;
6175         /*
6176          * 4 retry counts for 4 rate series. retry count for rate 0 is stored
6177          * in byte 0 (LSB) and retry count for rate 3 is stored at byte 3
6178          * (MSB)
6179          */
6180         __le32  rate_retries;
6181 } __packed;
6182
6183 struct wmi_peer_fixed_rate_cmd {
6184         /* unique id identifying the VDEV, generated by the caller */
6185         __le32 vdev_id;
6186         /* peer MAC address */
6187         struct wmi_mac_addr peer_macaddr;
6188         /* fixed rate */
6189         struct wmi_fixed_rate peer_fixed_rate;
6190 } __packed;
6191
6192 #define WMI_MGMT_TID    17
6193
6194 struct wmi_addba_clear_resp_cmd {
6195         /* unique id identifying the VDEV, generated by the caller */
6196         __le32 vdev_id;
6197         /* peer MAC address */
6198         struct wmi_mac_addr peer_macaddr;
6199 } __packed;
6200
6201 struct wmi_addba_send_cmd {
6202         /* unique id identifying the VDEV, generated by the caller */
6203         __le32 vdev_id;
6204         /* peer MAC address */
6205         struct wmi_mac_addr peer_macaddr;
6206         /* Tid number */
6207         __le32 tid;
6208         /* Buffer/Window size*/
6209         __le32 buffersize;
6210 } __packed;
6211
6212 struct wmi_delba_send_cmd {
6213         /* unique id identifying the VDEV, generated by the caller */
6214         __le32 vdev_id;
6215         /* peer MAC address */
6216         struct wmi_mac_addr peer_macaddr;
6217         /* Tid number */
6218         __le32 tid;
6219         /* Is Initiator */
6220         __le32 initiator;
6221         /* Reason code */
6222         __le32 reasoncode;
6223 } __packed;
6224
6225 struct wmi_addba_setresponse_cmd {
6226         /* unique id identifying the vdev, generated by the caller */
6227         __le32 vdev_id;
6228         /* peer mac address */
6229         struct wmi_mac_addr peer_macaddr;
6230         /* Tid number */
6231         __le32 tid;
6232         /* status code */
6233         __le32 statuscode;
6234 } __packed;
6235
6236 struct wmi_send_singleamsdu_cmd {
6237         /* unique id identifying the vdev, generated by the caller */
6238         __le32 vdev_id;
6239         /* peer mac address */
6240         struct wmi_mac_addr peer_macaddr;
6241         /* Tid number */
6242         __le32 tid;
6243 } __packed;
6244
6245 enum wmi_peer_smps_state {
6246         WMI_PEER_SMPS_PS_NONE = 0x0,
6247         WMI_PEER_SMPS_STATIC  = 0x1,
6248         WMI_PEER_SMPS_DYNAMIC = 0x2
6249 };
6250
6251 enum wmi_peer_chwidth {
6252         WMI_PEER_CHWIDTH_20MHZ = 0,
6253         WMI_PEER_CHWIDTH_40MHZ = 1,
6254         WMI_PEER_CHWIDTH_80MHZ = 2,
6255         WMI_PEER_CHWIDTH_160MHZ = 3,
6256 };
6257
6258 enum wmi_peer_param {
6259         WMI_PEER_SMPS_STATE = 0x1, /* see %wmi_peer_smps_state */
6260         WMI_PEER_AMPDU      = 0x2,
6261         WMI_PEER_AUTHORIZE  = 0x3,
6262         WMI_PEER_CHAN_WIDTH = 0x4,
6263         WMI_PEER_NSS        = 0x5,
6264         WMI_PEER_USE_4ADDR  = 0x6,
6265         WMI_PEER_DEBUG      = 0xa,
6266         WMI_PEER_PHYMODE    = 0xd,
6267         WMI_PEER_DUMMY_VAR  = 0xff, /* dummy parameter for STA PS workaround */
6268 };
6269
6270 struct wmi_peer_set_param_cmd {
6271         __le32 vdev_id;
6272         struct wmi_mac_addr peer_macaddr;
6273         __le32 param_id;
6274         __le32 param_value;
6275 } __packed;
6276
6277 #define MAX_SUPPORTED_RATES 128
6278
6279 struct wmi_rate_set {
6280         /* total number of rates */
6281         __le32 num_rates;
6282         /*
6283          * rates (each 8bit value) packed into a 32 bit word.
6284          * the rates are filled from least significant byte to most
6285          * significant byte.
6286          */
6287         __le32 rates[(MAX_SUPPORTED_RATES / 4) + 1];
6288 } __packed;
6289
6290 struct wmi_rate_set_arg {
6291         unsigned int num_rates;
6292         u8 rates[MAX_SUPPORTED_RATES];
6293 };
6294
6295 /*
6296  * NOTE: It would bea good idea to represent the Tx MCS
6297  * info in one word and Rx in another word. This is split
6298  * into multiple words for convenience
6299  */
6300 struct wmi_vht_rate_set {
6301         __le32 rx_max_rate; /* Max Rx data rate */
6302         __le32 rx_mcs_set;  /* Negotiated RX VHT rates */
6303         __le32 tx_max_rate; /* Max Tx data rate */
6304         __le32 tx_mcs_set;  /* Negotiated TX VHT rates */
6305 } __packed;
6306
6307 struct wmi_vht_rate_set_arg {
6308         u32 rx_max_rate;
6309         u32 rx_mcs_set;
6310         u32 tx_max_rate;
6311         u32 tx_mcs_set;
6312 };
6313
6314 struct wmi_peer_set_rates_cmd {
6315         /* peer MAC address */
6316         struct wmi_mac_addr peer_macaddr;
6317         /* legacy rate set */
6318         struct wmi_rate_set peer_legacy_rates;
6319         /* ht rate set */
6320         struct wmi_rate_set peer_ht_rates;
6321 } __packed;
6322
6323 struct wmi_peer_set_q_empty_callback_cmd {
6324         /* unique id identifying the VDEV, generated by the caller */
6325         __le32 vdev_id;
6326         /* peer MAC address */
6327         struct wmi_mac_addr peer_macaddr;
6328         __le32 callback_enable;
6329 } __packed;
6330
6331 struct wmi_peer_flags_map {
6332         u32 auth;
6333         u32 qos;
6334         u32 need_ptk_4_way;
6335         u32 need_gtk_2_way;
6336         u32 apsd;
6337         u32 ht;
6338         u32 bw40;
6339         u32 stbc;
6340         u32 ldbc;
6341         u32 dyn_mimops;
6342         u32 static_mimops;
6343         u32 spatial_mux;
6344         u32 vht;
6345         u32 bw80;
6346         u32 vht_2g;
6347         u32 pmf;
6348         u32 bw160;
6349 };
6350
6351 enum wmi_peer_flags {
6352         WMI_PEER_AUTH = 0x00000001,
6353         WMI_PEER_QOS = 0x00000002,
6354         WMI_PEER_NEED_PTK_4_WAY = 0x00000004,
6355         WMI_PEER_NEED_GTK_2_WAY = 0x00000010,
6356         WMI_PEER_APSD = 0x00000800,
6357         WMI_PEER_HT = 0x00001000,
6358         WMI_PEER_40MHZ = 0x00002000,
6359         WMI_PEER_STBC = 0x00008000,
6360         WMI_PEER_LDPC = 0x00010000,
6361         WMI_PEER_DYN_MIMOPS = 0x00020000,
6362         WMI_PEER_STATIC_MIMOPS = 0x00040000,
6363         WMI_PEER_SPATIAL_MUX = 0x00200000,
6364         WMI_PEER_VHT = 0x02000000,
6365         WMI_PEER_80MHZ = 0x04000000,
6366         WMI_PEER_VHT_2G = 0x08000000,
6367         WMI_PEER_PMF = 0x10000000,
6368         WMI_PEER_160MHZ = 0x20000000
6369 };
6370
6371 enum wmi_10x_peer_flags {
6372         WMI_10X_PEER_AUTH = 0x00000001,
6373         WMI_10X_PEER_QOS = 0x00000002,
6374         WMI_10X_PEER_NEED_PTK_4_WAY = 0x00000004,
6375         WMI_10X_PEER_NEED_GTK_2_WAY = 0x00000010,
6376         WMI_10X_PEER_APSD = 0x00000800,
6377         WMI_10X_PEER_HT = 0x00001000,
6378         WMI_10X_PEER_40MHZ = 0x00002000,
6379         WMI_10X_PEER_STBC = 0x00008000,
6380         WMI_10X_PEER_LDPC = 0x00010000,
6381         WMI_10X_PEER_DYN_MIMOPS = 0x00020000,
6382         WMI_10X_PEER_STATIC_MIMOPS = 0x00040000,
6383         WMI_10X_PEER_SPATIAL_MUX = 0x00200000,
6384         WMI_10X_PEER_VHT = 0x02000000,
6385         WMI_10X_PEER_80MHZ = 0x04000000,
6386         WMI_10X_PEER_160MHZ = 0x20000000
6387 };
6388
6389 enum wmi_10_2_peer_flags {
6390         WMI_10_2_PEER_AUTH = 0x00000001,
6391         WMI_10_2_PEER_QOS = 0x00000002,
6392         WMI_10_2_PEER_NEED_PTK_4_WAY = 0x00000004,
6393         WMI_10_2_PEER_NEED_GTK_2_WAY = 0x00000010,
6394         WMI_10_2_PEER_APSD = 0x00000800,
6395         WMI_10_2_PEER_HT = 0x00001000,
6396         WMI_10_2_PEER_40MHZ = 0x00002000,
6397         WMI_10_2_PEER_STBC = 0x00008000,
6398         WMI_10_2_PEER_LDPC = 0x00010000,
6399         WMI_10_2_PEER_DYN_MIMOPS = 0x00020000,
6400         WMI_10_2_PEER_STATIC_MIMOPS = 0x00040000,
6401         WMI_10_2_PEER_SPATIAL_MUX = 0x00200000,
6402         WMI_10_2_PEER_VHT = 0x02000000,
6403         WMI_10_2_PEER_80MHZ = 0x04000000,
6404         WMI_10_2_PEER_VHT_2G = 0x08000000,
6405         WMI_10_2_PEER_PMF = 0x10000000,
6406         WMI_10_2_PEER_160MHZ = 0x20000000
6407 };
6408
6409 /*
6410  * Peer rate capabilities.
6411  *
6412  * This is of interest to the ratecontrol
6413  * module which resides in the firmware. The bit definitions are
6414  * consistent with that defined in if_athrate.c.
6415  */
6416 #define WMI_RC_DS_FLAG          0x01
6417 #define WMI_RC_CW40_FLAG        0x02
6418 #define WMI_RC_SGI_FLAG         0x04
6419 #define WMI_RC_HT_FLAG          0x08
6420 #define WMI_RC_RTSCTS_FLAG      0x10
6421 #define WMI_RC_TX_STBC_FLAG     0x20
6422 #define WMI_RC_RX_STBC_FLAG     0xC0
6423 #define WMI_RC_RX_STBC_FLAG_S   6
6424 #define WMI_RC_WEP_TKIP_FLAG    0x100
6425 #define WMI_RC_TS_FLAG          0x200
6426 #define WMI_RC_UAPSD_FLAG       0x400
6427
6428 /* Maximum listen interval supported by hw in units of beacon interval */
6429 #define ATH10K_MAX_HW_LISTEN_INTERVAL 5
6430
6431 struct wmi_common_peer_assoc_complete_cmd {
6432         struct wmi_mac_addr peer_macaddr;
6433         __le32 vdev_id;
6434         __le32 peer_new_assoc; /* 1=assoc, 0=reassoc */
6435         __le32 peer_associd; /* 16 LSBs */
6436         __le32 peer_flags;
6437         __le32 peer_caps; /* 16 LSBs */
6438         __le32 peer_listen_intval;
6439         __le32 peer_ht_caps;
6440         __le32 peer_max_mpdu;
6441         __le32 peer_mpdu_density; /* 0..16 */
6442         __le32 peer_rate_caps;
6443         struct wmi_rate_set peer_legacy_rates;
6444         struct wmi_rate_set peer_ht_rates;
6445         __le32 peer_nss; /* num of spatial streams */
6446         __le32 peer_vht_caps;
6447         __le32 peer_phymode;
6448         struct wmi_vht_rate_set peer_vht_rates;
6449 };
6450
6451 struct wmi_main_peer_assoc_complete_cmd {
6452         struct wmi_common_peer_assoc_complete_cmd cmd;
6453
6454         /* HT Operation Element of the peer. Five bytes packed in 2
6455          *  INT32 array and filled from lsb to msb.
6456          */
6457         __le32 peer_ht_info[2];
6458 } __packed;
6459
6460 struct wmi_10_1_peer_assoc_complete_cmd {
6461         struct wmi_common_peer_assoc_complete_cmd cmd;
6462 } __packed;
6463
6464 #define WMI_PEER_ASSOC_INFO0_MAX_MCS_IDX_LSB 0
6465 #define WMI_PEER_ASSOC_INFO0_MAX_MCS_IDX_MASK 0x0f
6466 #define WMI_PEER_ASSOC_INFO0_MAX_NSS_LSB 4
6467 #define WMI_PEER_ASSOC_INFO0_MAX_NSS_MASK 0xf0
6468
6469 struct wmi_10_2_peer_assoc_complete_cmd {
6470         struct wmi_common_peer_assoc_complete_cmd cmd;
6471         __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */
6472 } __packed;
6473
6474 #define PEER_BW_RXNSS_OVERRIDE_OFFSET  31
6475
6476 struct wmi_10_4_peer_assoc_complete_cmd {
6477         struct wmi_10_2_peer_assoc_complete_cmd cmd;
6478         __le32 peer_bw_rxnss_override;
6479 } __packed;
6480
6481 struct wmi_peer_assoc_complete_arg {
6482         u8 addr[ETH_ALEN];
6483         u32 vdev_id;
6484         bool peer_reassoc;
6485         u16 peer_aid;
6486         u32 peer_flags; /* see %WMI_PEER_ */
6487         u16 peer_caps;
6488         u32 peer_listen_intval;
6489         u32 peer_ht_caps;
6490         u32 peer_max_mpdu;
6491         u32 peer_mpdu_density; /* 0..16 */
6492         u32 peer_rate_caps; /* see %WMI_RC_ */
6493         struct wmi_rate_set_arg peer_legacy_rates;
6494         struct wmi_rate_set_arg peer_ht_rates;
6495         u32 peer_num_spatial_streams;
6496         u32 peer_vht_caps;
6497         enum wmi_phy_mode peer_phymode;
6498         struct wmi_vht_rate_set_arg peer_vht_rates;
6499         u32 peer_bw_rxnss_override;
6500 };
6501
6502 struct wmi_peer_add_wds_entry_cmd {
6503         /* peer MAC address */
6504         struct wmi_mac_addr peer_macaddr;
6505         /* wds MAC addr */
6506         struct wmi_mac_addr wds_macaddr;
6507 } __packed;
6508
6509 struct wmi_peer_remove_wds_entry_cmd {
6510         /* wds MAC addr */
6511         struct wmi_mac_addr wds_macaddr;
6512 } __packed;
6513
6514 struct wmi_peer_q_empty_callback_event {
6515         /* peer MAC address */
6516         struct wmi_mac_addr peer_macaddr;
6517 } __packed;
6518
6519 /*
6520  * Channel info WMI event
6521  */
6522 struct wmi_chan_info_event {
6523         __le32 err_code;
6524         __le32 freq;
6525         __le32 cmd_flags;
6526         __le32 noise_floor;
6527         __le32 rx_clear_count;
6528         __le32 cycle_count;
6529         __le32 chan_tx_pwr_range;
6530         __le32 chan_tx_pwr_tp;
6531         __le32 rx_frame_count;
6532         __le32 my_bss_rx_cycle_count;
6533         __le32 rx_11b_mode_data_duration;
6534         __le32 tx_frame_cnt;
6535         __le32 mac_clk_mhz;
6536
6537 } __packed;
6538
6539 struct wmi_10_4_chan_info_event {
6540         __le32 err_code;
6541         __le32 freq;
6542         __le32 cmd_flags;
6543         __le32 noise_floor;
6544         __le32 rx_clear_count;
6545         __le32 cycle_count;
6546         __le32 chan_tx_pwr_range;
6547         __le32 chan_tx_pwr_tp;
6548         __le32 rx_frame_count;
6549 } __packed;
6550
6551 struct wmi_peer_sta_kickout_event {
6552         struct wmi_mac_addr peer_macaddr;
6553 } __packed;
6554
6555 #define WMI_CHAN_INFO_FLAG_COMPLETE BIT(0)
6556 #define WMI_CHAN_INFO_FLAG_PRE_COMPLETE BIT(1)
6557
6558 /* Beacon filter wmi command info */
6559 #define BCN_FLT_MAX_SUPPORTED_IES       256
6560 #define BCN_FLT_MAX_ELEMS_IE_LIST       (BCN_FLT_MAX_SUPPORTED_IES / 32)
6561
6562 struct bss_bcn_stats {
6563         __le32 vdev_id;
6564         __le32 bss_bcnsdropped;
6565         __le32 bss_bcnsdelivered;
6566 } __packed;
6567
6568 struct bcn_filter_stats {
6569         __le32 bcns_dropped;
6570         __le32 bcns_delivered;
6571         __le32 activefilters;
6572         struct bss_bcn_stats bss_stats;
6573 } __packed;
6574
6575 struct wmi_add_bcn_filter_cmd {
6576         u32 vdev_id;
6577         u32 ie_map[BCN_FLT_MAX_ELEMS_IE_LIST];
6578 } __packed;
6579
6580 enum wmi_sta_keepalive_method {
6581         WMI_STA_KEEPALIVE_METHOD_NULL_FRAME = 1,
6582         WMI_STA_KEEPALIVE_METHOD_UNSOLICITATED_ARP_RESPONSE = 2,
6583 };
6584
6585 #define WMI_STA_KEEPALIVE_INTERVAL_DISABLE 0
6586
6587 /* Firmware crashes if keepalive interval exceeds this limit */
6588 #define WMI_STA_KEEPALIVE_INTERVAL_MAX_SECONDS 0xffff
6589
6590 /* note: ip4 addresses are in network byte order, i.e. big endian */
6591 struct wmi_sta_keepalive_arp_resp {
6592         __be32 src_ip4_addr;
6593         __be32 dest_ip4_addr;
6594         struct wmi_mac_addr dest_mac_addr;
6595 } __packed;
6596
6597 struct wmi_sta_keepalive_cmd {
6598         __le32 vdev_id;
6599         __le32 enabled;
6600         __le32 method; /* WMI_STA_KEEPALIVE_METHOD_ */
6601         __le32 interval; /* in seconds */
6602         struct wmi_sta_keepalive_arp_resp arp_resp;
6603 } __packed;
6604
6605 struct wmi_sta_keepalive_arg {
6606         u32 vdev_id;
6607         u32 enabled;
6608         u32 method;
6609         u32 interval;
6610         __be32 src_ip4_addr;
6611         __be32 dest_ip4_addr;
6612         const u8 dest_mac_addr[ETH_ALEN];
6613 };
6614
6615 enum wmi_force_fw_hang_type {
6616         WMI_FORCE_FW_HANG_ASSERT = 1,
6617         WMI_FORCE_FW_HANG_NO_DETECT,
6618         WMI_FORCE_FW_HANG_CTRL_EP_FULL,
6619         WMI_FORCE_FW_HANG_EMPTY_POINT,
6620         WMI_FORCE_FW_HANG_STACK_OVERFLOW,
6621         WMI_FORCE_FW_HANG_INFINITE_LOOP,
6622 };
6623
6624 #define WMI_FORCE_FW_HANG_RANDOM_TIME 0xFFFFFFFF
6625
6626 struct wmi_force_fw_hang_cmd {
6627         __le32 type;
6628         __le32 delay_ms;
6629 } __packed;
6630
6631 enum wmi_pdev_reset_mode_type {
6632         WMI_RST_MODE_TX_FLUSH = 1,
6633         WMI_RST_MODE_WARM_RESET,
6634         WMI_RST_MODE_COLD_RESET,
6635         WMI_RST_MODE_WARM_RESET_RESTORE_CAL,
6636         WMI_RST_MODE_COLD_RESET_RESTORE_CAL,
6637         WMI_RST_MODE_MAX,
6638 };
6639
6640 enum ath10k_dbglog_level {
6641         ATH10K_DBGLOG_LEVEL_VERBOSE = 0,
6642         ATH10K_DBGLOG_LEVEL_INFO = 1,
6643         ATH10K_DBGLOG_LEVEL_WARN = 2,
6644         ATH10K_DBGLOG_LEVEL_ERR = 3,
6645 };
6646
6647 /* VAP ids to enable dbglog */
6648 #define ATH10K_DBGLOG_CFG_VAP_LOG_LSB           0
6649 #define ATH10K_DBGLOG_CFG_VAP_LOG_MASK          0x0000ffff
6650
6651 /* to enable dbglog in the firmware */
6652 #define ATH10K_DBGLOG_CFG_REPORTING_ENABLE_LSB  16
6653 #define ATH10K_DBGLOG_CFG_REPORTING_ENABLE_MASK 0x00010000
6654
6655 /* timestamp resolution */
6656 #define ATH10K_DBGLOG_CFG_RESOLUTION_LSB        17
6657 #define ATH10K_DBGLOG_CFG_RESOLUTION_MASK       0x000E0000
6658
6659 /* number of queued messages before sending them to the host */
6660 #define ATH10K_DBGLOG_CFG_REPORT_SIZE_LSB       20
6661 #define ATH10K_DBGLOG_CFG_REPORT_SIZE_MASK      0x0ff00000
6662
6663 /*
6664  * Log levels to enable. This defines the minimum level to enable, this is
6665  * not a bitmask. See enum ath10k_dbglog_level for the values.
6666  */
6667 #define ATH10K_DBGLOG_CFG_LOG_LVL_LSB           28
6668 #define ATH10K_DBGLOG_CFG_LOG_LVL_MASK          0x70000000
6669
6670 /*
6671  * Note: this is a cleaned up version of a struct firmware uses. For
6672  * example, config_valid was hidden inside an array.
6673  */
6674 struct wmi_dbglog_cfg_cmd {
6675         /* bitmask to hold mod id config*/
6676         __le32 module_enable;
6677
6678         /* see ATH10K_DBGLOG_CFG_ */
6679         __le32 config_enable;
6680
6681         /* mask of module id bits to be changed */
6682         __le32 module_valid;
6683
6684         /* mask of config bits to be changed, see ATH10K_DBGLOG_CFG_ */
6685         __le32 config_valid;
6686 } __packed;
6687
6688 struct wmi_10_4_dbglog_cfg_cmd {
6689         /* bitmask to hold mod id config*/
6690         __le64 module_enable;
6691
6692         /* see ATH10K_DBGLOG_CFG_ */
6693         __le32 config_enable;
6694
6695         /* mask of module id bits to be changed */
6696         __le64 module_valid;
6697
6698         /* mask of config bits to be changed, see ATH10K_DBGLOG_CFG_ */
6699         __le32 config_valid;
6700 } __packed;
6701
6702 enum wmi_roam_reason {
6703         WMI_ROAM_REASON_BETTER_AP = 1,
6704         WMI_ROAM_REASON_BEACON_MISS = 2,
6705         WMI_ROAM_REASON_LOW_RSSI = 3,
6706         WMI_ROAM_REASON_SUITABLE_AP_FOUND = 4,
6707         WMI_ROAM_REASON_HO_FAILED = 5,
6708
6709         /* keep last */
6710         WMI_ROAM_REASON_MAX,
6711 };
6712
6713 struct wmi_roam_ev {
6714         __le32 vdev_id;
6715         __le32 reason;
6716 } __packed;
6717
6718 #define ATH10K_FRAGMT_THRESHOLD_MIN     540
6719 #define ATH10K_FRAGMT_THRESHOLD_MAX     2346
6720
6721 #define WMI_MAX_EVENT 0x1000
6722 /* Maximum number of pending TXed WMI packets */
6723 #define WMI_SKB_HEADROOM sizeof(struct wmi_cmd_hdr)
6724
6725 /* By default disable power save for IBSS */
6726 #define ATH10K_DEFAULT_ATIM 0
6727
6728 #define WMI_MAX_MEM_REQS 16
6729
6730 struct wmi_scan_ev_arg {
6731         __le32 event_type; /* %WMI_SCAN_EVENT_ */
6732         __le32 reason; /* %WMI_SCAN_REASON_ */
6733         __le32 channel_freq; /* only valid for WMI_SCAN_EVENT_FOREIGN_CHANNEL */
6734         __le32 scan_req_id;
6735         __le32 scan_id;
6736         __le32 vdev_id;
6737 };
6738
6739 struct wmi_tlv_mgmt_tx_compl_ev_arg {
6740         __le32 desc_id;
6741         __le32 status;
6742         __le32 pdev_id;
6743 };
6744
6745 struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg {
6746         __le32 num_reports;
6747         const __le32 *desc_ids;
6748         const __le32 *status;
6749 };
6750
6751 struct wmi_mgmt_rx_ev_arg {
6752         __le32 channel;
6753         __le32 snr;
6754         __le32 rate;
6755         __le32 phy_mode;
6756         __le32 buf_len;
6757         __le32 status; /* %WMI_RX_STATUS_ */
6758         struct wmi_mgmt_rx_ext_info ext_info;
6759 };
6760
6761 struct wmi_ch_info_ev_arg {
6762         __le32 err_code;
6763         __le32 freq;
6764         __le32 cmd_flags;
6765         __le32 noise_floor;
6766         __le32 rx_clear_count;
6767         __le32 cycle_count;
6768         __le32 chan_tx_pwr_range;
6769         __le32 chan_tx_pwr_tp;
6770         __le32 rx_frame_count;
6771         __le32 my_bss_rx_cycle_count;
6772         __le32 rx_11b_mode_data_duration;
6773         __le32 tx_frame_cnt;
6774         __le32 mac_clk_mhz;
6775 };
6776
6777 /* From 10.4 firmware, not sure all have the same values. */
6778 enum wmi_vdev_start_status {
6779         WMI_VDEV_START_OK = 0,
6780         WMI_VDEV_START_CHAN_INVALID,
6781 };
6782
6783 struct wmi_vdev_start_ev_arg {
6784         __le32 vdev_id;
6785         __le32 req_id;
6786         __le32 resp_type; /* %WMI_VDEV_RESP_ */
6787         __le32 status; /* See wmi_vdev_start_status enum above */
6788 };
6789
6790 struct wmi_peer_kick_ev_arg {
6791         const u8 *mac_addr;
6792 };
6793
6794 struct wmi_swba_ev_arg {
6795         __le32 vdev_map;
6796         struct wmi_tim_info_arg tim_info[WMI_MAX_AP_VDEV];
6797         const struct wmi_p2p_noa_info *noa_info[WMI_MAX_AP_VDEV];
6798 };
6799
6800 struct wmi_phyerr_ev_arg {
6801         u32 tsf_timestamp;
6802         u16 freq1;
6803         u16 freq2;
6804         u8 rssi_combined;
6805         u8 chan_width_mhz;
6806         u8 phy_err_code;
6807         u16 nf_chains[4];
6808         u32 buf_len;
6809         const u8 *buf;
6810         u8 hdr_len;
6811 };
6812
6813 struct wmi_phyerr_hdr_arg {
6814         u32 num_phyerrs;
6815         u32 tsf_l32;
6816         u32 tsf_u32;
6817         u32 buf_len;
6818         const void *phyerrs;
6819 };
6820
6821 struct wmi_dfs_status_ev_arg {
6822         u32 status;
6823 };
6824
6825 struct wmi_svc_rdy_ev_arg {
6826         __le32 min_tx_power;
6827         __le32 max_tx_power;
6828         __le32 ht_cap;
6829         __le32 vht_cap;
6830         __le32 sw_ver0;
6831         __le32 sw_ver1;
6832         __le32 fw_build;
6833         __le32 phy_capab;
6834         __le32 num_rf_chains;
6835         __le32 eeprom_rd;
6836         __le32 num_mem_reqs;
6837         __le32 low_5ghz_chan;
6838         __le32 high_5ghz_chan;
6839         const __le32 *service_map;
6840         size_t service_map_len;
6841         const struct wlan_host_mem_req *mem_reqs[WMI_MAX_MEM_REQS];
6842 };
6843
6844 struct wmi_svc_avail_ev_arg {
6845         __le32 service_map_ext_len;
6846         const __le32 *service_map_ext;
6847 };
6848
6849 struct wmi_rdy_ev_arg {
6850         __le32 sw_version;
6851         __le32 abi_version;
6852         __le32 status;
6853         const u8 *mac_addr;
6854 };
6855
6856 struct wmi_roam_ev_arg {
6857         __le32 vdev_id;
6858         __le32 reason;
6859         __le32 rssi;
6860 };
6861
6862 struct wmi_echo_ev_arg {
6863         __le32 value;
6864 };
6865
6866 struct wmi_pdev_temperature_event {
6867         /* temperature value in Celcius degree */
6868         __le32 temperature;
6869 } __packed;
6870
6871 struct wmi_pdev_bss_chan_info_event {
6872         __le32 freq;
6873         __le32 noise_floor;
6874         __le64 cycle_busy;
6875         __le64 cycle_total;
6876         __le64 cycle_tx;
6877         __le64 cycle_rx;
6878         __le64 cycle_rx_bss;
6879         __le32 reserved;
6880 } __packed;
6881
6882 /* WOW structures */
6883 enum wmi_wow_wakeup_event {
6884         WOW_BMISS_EVENT = 0,
6885         WOW_BETTER_AP_EVENT,
6886         WOW_DEAUTH_RECVD_EVENT,
6887         WOW_MAGIC_PKT_RECVD_EVENT,
6888         WOW_GTK_ERR_EVENT,
6889         WOW_FOURWAY_HSHAKE_EVENT,
6890         WOW_EAPOL_RECVD_EVENT,
6891         WOW_NLO_DETECTED_EVENT,
6892         WOW_DISASSOC_RECVD_EVENT,
6893         WOW_PATTERN_MATCH_EVENT,
6894         WOW_CSA_IE_EVENT,
6895         WOW_PROBE_REQ_WPS_IE_EVENT,
6896         WOW_AUTH_REQ_EVENT,
6897         WOW_ASSOC_REQ_EVENT,
6898         WOW_HTT_EVENT,
6899         WOW_RA_MATCH_EVENT,
6900         WOW_HOST_AUTO_SHUTDOWN_EVENT,
6901         WOW_IOAC_MAGIC_EVENT,
6902         WOW_IOAC_SHORT_EVENT,
6903         WOW_IOAC_EXTEND_EVENT,
6904         WOW_IOAC_TIMER_EVENT,
6905         WOW_DFS_PHYERR_RADAR_EVENT,
6906         WOW_BEACON_EVENT,
6907         WOW_CLIENT_KICKOUT_EVENT,
6908         WOW_EVENT_MAX,
6909 };
6910
6911 #define C2S(x) case x: return #x
6912
6913 static inline const char *wow_wakeup_event(enum wmi_wow_wakeup_event ev)
6914 {
6915         switch (ev) {
6916         C2S(WOW_BMISS_EVENT);
6917         C2S(WOW_BETTER_AP_EVENT);
6918         C2S(WOW_DEAUTH_RECVD_EVENT);
6919         C2S(WOW_MAGIC_PKT_RECVD_EVENT);
6920         C2S(WOW_GTK_ERR_EVENT);
6921         C2S(WOW_FOURWAY_HSHAKE_EVENT);
6922         C2S(WOW_EAPOL_RECVD_EVENT);
6923         C2S(WOW_NLO_DETECTED_EVENT);
6924         C2S(WOW_DISASSOC_RECVD_EVENT);
6925         C2S(WOW_PATTERN_MATCH_EVENT);
6926         C2S(WOW_CSA_IE_EVENT);
6927         C2S(WOW_PROBE_REQ_WPS_IE_EVENT);
6928         C2S(WOW_AUTH_REQ_EVENT);
6929         C2S(WOW_ASSOC_REQ_EVENT);
6930         C2S(WOW_HTT_EVENT);
6931         C2S(WOW_RA_MATCH_EVENT);
6932         C2S(WOW_HOST_AUTO_SHUTDOWN_EVENT);
6933         C2S(WOW_IOAC_MAGIC_EVENT);
6934         C2S(WOW_IOAC_SHORT_EVENT);
6935         C2S(WOW_IOAC_EXTEND_EVENT);
6936         C2S(WOW_IOAC_TIMER_EVENT);
6937         C2S(WOW_DFS_PHYERR_RADAR_EVENT);
6938         C2S(WOW_BEACON_EVENT);
6939         C2S(WOW_CLIENT_KICKOUT_EVENT);
6940         C2S(WOW_EVENT_MAX);
6941         default:
6942                 return NULL;
6943         }
6944 }
6945
6946 enum wmi_wow_wake_reason {
6947         WOW_REASON_UNSPECIFIED = -1,
6948         WOW_REASON_NLOD = 0,
6949         WOW_REASON_AP_ASSOC_LOST,
6950         WOW_REASON_LOW_RSSI,
6951         WOW_REASON_DEAUTH_RECVD,
6952         WOW_REASON_DISASSOC_RECVD,
6953         WOW_REASON_GTK_HS_ERR,
6954         WOW_REASON_EAP_REQ,
6955         WOW_REASON_FOURWAY_HS_RECV,
6956         WOW_REASON_TIMER_INTR_RECV,
6957         WOW_REASON_PATTERN_MATCH_FOUND,
6958         WOW_REASON_RECV_MAGIC_PATTERN,
6959         WOW_REASON_P2P_DISC,
6960         WOW_REASON_WLAN_HB,
6961         WOW_REASON_CSA_EVENT,
6962         WOW_REASON_PROBE_REQ_WPS_IE_RECV,
6963         WOW_REASON_AUTH_REQ_RECV,
6964         WOW_REASON_ASSOC_REQ_RECV,
6965         WOW_REASON_HTT_EVENT,
6966         WOW_REASON_RA_MATCH,
6967         WOW_REASON_HOST_AUTO_SHUTDOWN,
6968         WOW_REASON_IOAC_MAGIC_EVENT,
6969         WOW_REASON_IOAC_SHORT_EVENT,
6970         WOW_REASON_IOAC_EXTEND_EVENT,
6971         WOW_REASON_IOAC_TIMER_EVENT,
6972         WOW_REASON_ROAM_HO,
6973         WOW_REASON_DFS_PHYERR_RADADR_EVENT,
6974         WOW_REASON_BEACON_RECV,
6975         WOW_REASON_CLIENT_KICKOUT_EVENT,
6976         WOW_REASON_DEBUG_TEST = 0xFF,
6977 };
6978
6979 static inline const char *wow_reason(enum wmi_wow_wake_reason reason)
6980 {
6981         switch (reason) {
6982         C2S(WOW_REASON_UNSPECIFIED);
6983         C2S(WOW_REASON_NLOD);
6984         C2S(WOW_REASON_AP_ASSOC_LOST);
6985         C2S(WOW_REASON_LOW_RSSI);
6986         C2S(WOW_REASON_DEAUTH_RECVD);
6987         C2S(WOW_REASON_DISASSOC_RECVD);
6988         C2S(WOW_REASON_GTK_HS_ERR);
6989         C2S(WOW_REASON_EAP_REQ);
6990         C2S(WOW_REASON_FOURWAY_HS_RECV);
6991         C2S(WOW_REASON_TIMER_INTR_RECV);
6992         C2S(WOW_REASON_PATTERN_MATCH_FOUND);
6993         C2S(WOW_REASON_RECV_MAGIC_PATTERN);
6994         C2S(WOW_REASON_P2P_DISC);
6995         C2S(WOW_REASON_WLAN_HB);
6996         C2S(WOW_REASON_CSA_EVENT);
6997         C2S(WOW_REASON_PROBE_REQ_WPS_IE_RECV);
6998         C2S(WOW_REASON_AUTH_REQ_RECV);
6999         C2S(WOW_REASON_ASSOC_REQ_RECV);
7000         C2S(WOW_REASON_HTT_EVENT);
7001         C2S(WOW_REASON_RA_MATCH);
7002         C2S(WOW_REASON_HOST_AUTO_SHUTDOWN);
7003         C2S(WOW_REASON_IOAC_MAGIC_EVENT);
7004         C2S(WOW_REASON_IOAC_SHORT_EVENT);
7005         C2S(WOW_REASON_IOAC_EXTEND_EVENT);
7006         C2S(WOW_REASON_IOAC_TIMER_EVENT);
7007         C2S(WOW_REASON_ROAM_HO);
7008         C2S(WOW_REASON_DFS_PHYERR_RADADR_EVENT);
7009         C2S(WOW_REASON_BEACON_RECV);
7010         C2S(WOW_REASON_CLIENT_KICKOUT_EVENT);
7011         C2S(WOW_REASON_DEBUG_TEST);
7012         default:
7013                 return NULL;
7014         }
7015 }
7016
7017 #undef C2S
7018
7019 struct wmi_wow_ev_arg {
7020         u32 vdev_id;
7021         u32 flag;
7022         enum wmi_wow_wake_reason wake_reason;
7023         u32 data_len;
7024 };
7025
7026 #define WOW_MIN_PATTERN_SIZE    1
7027 #define WOW_MAX_PATTERN_SIZE    148
7028 #define WOW_MAX_PKT_OFFSET      128
7029 #define WOW_HDR_LEN     (sizeof(struct ieee80211_hdr_3addr) + \
7030         sizeof(struct rfc1042_hdr))
7031 #define WOW_MAX_REDUCE  (WOW_HDR_LEN - sizeof(struct ethhdr) - \
7032         offsetof(struct ieee80211_hdr_3addr, addr1))
7033
7034 enum wmi_tdls_state {
7035         WMI_TDLS_DISABLE,
7036         WMI_TDLS_ENABLE_PASSIVE,
7037         WMI_TDLS_ENABLE_ACTIVE,
7038         WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL,
7039 };
7040
7041 enum wmi_tdls_peer_state {
7042         WMI_TDLS_PEER_STATE_PEERING,
7043         WMI_TDLS_PEER_STATE_CONNECTED,
7044         WMI_TDLS_PEER_STATE_TEARDOWN,
7045 };
7046
7047 struct wmi_tdls_peer_update_cmd_arg {
7048         u32 vdev_id;
7049         enum wmi_tdls_peer_state peer_state;
7050         u8 addr[ETH_ALEN];
7051 };
7052
7053 #define WMI_TDLS_MAX_SUPP_OPER_CLASSES 32
7054
7055 #define WMI_TDLS_PEER_SP_MASK   0x60
7056 #define WMI_TDLS_PEER_SP_LSB    5
7057
7058 enum wmi_tdls_options {
7059         WMI_TDLS_OFFCHAN_EN = BIT(0),
7060         WMI_TDLS_BUFFER_STA_EN = BIT(1),
7061         WMI_TDLS_SLEEP_STA_EN = BIT(2),
7062 };
7063
7064 enum {
7065         WMI_TDLS_PEER_QOS_AC_VO = BIT(0),
7066         WMI_TDLS_PEER_QOS_AC_VI = BIT(1),
7067         WMI_TDLS_PEER_QOS_AC_BK = BIT(2),
7068         WMI_TDLS_PEER_QOS_AC_BE = BIT(3),
7069 };
7070
7071 struct wmi_tdls_peer_capab_arg {
7072         u8 peer_uapsd_queues;
7073         u8 peer_max_sp;
7074         u32 buff_sta_support;
7075         u32 off_chan_support;
7076         u32 peer_curr_operclass;
7077         u32 self_curr_operclass;
7078         u32 peer_chan_len;
7079         u32 peer_operclass_len;
7080         u8 peer_operclass[WMI_TDLS_MAX_SUPP_OPER_CLASSES];
7081         u32 is_peer_responder;
7082         u32 pref_offchan_num;
7083         u32 pref_offchan_bw;
7084 };
7085
7086 struct wmi_10_4_tdls_set_state_cmd {
7087         __le32 vdev_id;
7088         __le32 state;
7089         __le32 notification_interval_ms;
7090         __le32 tx_discovery_threshold;
7091         __le32 tx_teardown_threshold;
7092         __le32 rssi_teardown_threshold;
7093         __le32 rssi_delta;
7094         __le32 tdls_options;
7095         __le32 tdls_peer_traffic_ind_window;
7096         __le32 tdls_peer_traffic_response_timeout_ms;
7097         __le32 tdls_puapsd_mask;
7098         __le32 tdls_puapsd_inactivity_time_ms;
7099         __le32 tdls_puapsd_rx_frame_threshold;
7100         __le32 teardown_notification_ms;
7101         __le32 tdls_peer_kickout_threshold;
7102 } __packed;
7103
7104 struct wmi_tdls_peer_capabilities {
7105         __le32 peer_qos;
7106         __le32 buff_sta_support;
7107         __le32 off_chan_support;
7108         __le32 peer_curr_operclass;
7109         __le32 self_curr_operclass;
7110         __le32 peer_chan_len;
7111         __le32 peer_operclass_len;
7112         u8 peer_operclass[WMI_TDLS_MAX_SUPP_OPER_CLASSES];
7113         __le32 is_peer_responder;
7114         __le32 pref_offchan_num;
7115         __le32 pref_offchan_bw;
7116         struct wmi_channel peer_chan_list[1];
7117 } __packed;
7118
7119 struct wmi_10_4_tdls_peer_update_cmd {
7120         __le32 vdev_id;
7121         struct wmi_mac_addr peer_macaddr;
7122         __le32 peer_state;
7123         __le32 reserved[4];
7124         struct wmi_tdls_peer_capabilities peer_capab;
7125 } __packed;
7126
7127 enum wmi_tdls_peer_reason {
7128         WMI_TDLS_TEARDOWN_REASON_TX,
7129         WMI_TDLS_TEARDOWN_REASON_RSSI,
7130         WMI_TDLS_TEARDOWN_REASON_SCAN,
7131         WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE,
7132         WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT,
7133         WMI_TDLS_TEARDOWN_REASON_BAD_PTR,
7134         WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE,
7135         WMI_TDLS_ENTER_BUF_STA,
7136         WMI_TDLS_EXIT_BUF_STA,
7137         WMI_TDLS_ENTER_BT_BUSY_MODE,
7138         WMI_TDLS_EXIT_BT_BUSY_MODE,
7139         WMI_TDLS_SCAN_STARTED_EVENT,
7140         WMI_TDLS_SCAN_COMPLETED_EVENT,
7141 };
7142
7143 enum wmi_tdls_peer_notification {
7144         WMI_TDLS_SHOULD_DISCOVER,
7145         WMI_TDLS_SHOULD_TEARDOWN,
7146         WMI_TDLS_PEER_DISCONNECTED,
7147         WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION,
7148 };
7149
7150 struct wmi_tdls_peer_event {
7151         struct wmi_mac_addr peer_macaddr;
7152         /* see enum wmi_tdls_peer_notification*/
7153         __le32 peer_status;
7154         /* see enum wmi_tdls_peer_reason */
7155         __le32 peer_reason;
7156         __le32 vdev_id;
7157 } __packed;
7158
7159 enum wmi_txbf_conf {
7160         WMI_TXBF_CONF_UNSUPPORTED,
7161         WMI_TXBF_CONF_BEFORE_ASSOC,
7162         WMI_TXBF_CONF_AFTER_ASSOC,
7163 };
7164
7165 #define WMI_CCA_DETECT_LEVEL_AUTO       0
7166 #define WMI_CCA_DETECT_MARGIN_AUTO      0
7167
7168 struct wmi_pdev_set_adaptive_cca_params {
7169         __le32 enable;
7170         __le32 cca_detect_level;
7171         __le32 cca_detect_margin;
7172 } __packed;
7173
7174 #define WMI_PNO_MAX_SCHED_SCAN_PLANS      2
7175 #define WMI_PNO_MAX_SCHED_SCAN_PLAN_INT   7200
7176 #define WMI_PNO_MAX_SCHED_SCAN_PLAN_ITRNS 100
7177 #define WMI_PNO_MAX_NETW_CHANNELS         26
7178 #define WMI_PNO_MAX_NETW_CHANNELS_EX      60
7179 #define WMI_PNO_MAX_SUPP_NETWORKS         WLAN_SCAN_PARAMS_MAX_SSID
7180 #define WMI_PNO_MAX_IE_LENGTH             WLAN_SCAN_PARAMS_MAX_IE_LEN
7181
7182 /*size based of dot11 declaration without extra IEs as we will not carry those for PNO*/
7183 #define WMI_PNO_MAX_PB_REQ_SIZE    450
7184
7185 #define WMI_PNO_24G_DEFAULT_CH     1
7186 #define WMI_PNO_5G_DEFAULT_CH      36
7187
7188 #define WMI_ACTIVE_MAX_CHANNEL_TIME 40
7189 #define WMI_PASSIVE_MAX_CHANNEL_TIME   110
7190
7191 /* SSID broadcast type */
7192 enum wmi_SSID_bcast_type {
7193         BCAST_UNKNOWN      = 0,
7194         BCAST_NORMAL       = 1,
7195         BCAST_HIDDEN       = 2,
7196 };
7197
7198 struct wmi_network_type {
7199         struct wmi_ssid ssid;
7200         u32 authentication;
7201         u32 encryption;
7202         u32 bcast_nw_type;
7203         u8 channel_count;
7204         u16 channels[WMI_PNO_MAX_NETW_CHANNELS_EX];
7205         s32 rssi_threshold;
7206 } __packed;
7207
7208 struct wmi_pno_scan_req {
7209         u8 enable;
7210         u8 vdev_id;
7211         u8 uc_networks_count;
7212         struct wmi_network_type a_networks[WMI_PNO_MAX_SUPP_NETWORKS];
7213         u32 fast_scan_period;
7214         u32 slow_scan_period;
7215         u8 fast_scan_max_cycles;
7216
7217         bool do_passive_scan;
7218
7219         u32 delay_start_time;
7220         u32 active_min_time;
7221         u32 active_max_time;
7222         u32 passive_min_time;
7223         u32 passive_max_time;
7224
7225         /* mac address randomization attributes */
7226         u32 enable_pno_scan_randomization;
7227         u8 mac_addr[ETH_ALEN];
7228         u8 mac_addr_mask[ETH_ALEN];
7229 } __packed;
7230
7231 enum wmi_host_platform_type {
7232         WMI_HOST_PLATFORM_HIGH_PERF,
7233         WMI_HOST_PLATFORM_LOW_PERF,
7234 };
7235
7236 enum wmi_bss_survey_req_type {
7237         WMI_BSS_SURVEY_REQ_TYPE_READ = 1,
7238         WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR,
7239 };
7240
7241 struct wmi_pdev_chan_info_req_cmd {
7242         __le32 type;
7243         __le32 reserved;
7244 } __packed;
7245
7246 /* bb timing register configurations */
7247 struct wmi_bb_timing_cfg_arg {
7248         /* Tx_end to pa off timing */
7249         u32 bb_tx_timing;
7250
7251         /* Tx_end to external pa off timing */
7252         u32 bb_xpa_timing;
7253 };
7254
7255 struct wmi_pdev_bb_timing_cfg_cmd {
7256         /* Tx_end to pa off timing */
7257         __le32 bb_tx_timing;
7258
7259         /* Tx_end to external pa off timing */
7260         __le32 bb_xpa_timing;
7261 } __packed;
7262
7263 struct ath10k;
7264 struct ath10k_vif;
7265 struct ath10k_fw_stats_pdev;
7266 struct ath10k_fw_stats_peer;
7267 struct ath10k_fw_stats;
7268
7269 int ath10k_wmi_attach(struct ath10k *ar);
7270 void ath10k_wmi_detach(struct ath10k *ar);
7271 void ath10k_wmi_free_host_mem(struct ath10k *ar);
7272 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar);
7273 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar);
7274
7275 struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len);
7276 int ath10k_wmi_connect(struct ath10k *ar);
7277
7278 struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len);
7279 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
7280 int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb,
7281                                u32 cmd_id);
7282 void ath10k_wmi_start_scan_init(struct ath10k *ar, struct wmi_start_scan_arg *arg);
7283
7284 void ath10k_wmi_pull_pdev_stats_base(const struct wmi_pdev_stats_base *src,
7285                                      struct ath10k_fw_stats_pdev *dst);
7286 void ath10k_wmi_pull_pdev_stats_tx(const struct wmi_pdev_stats_tx *src,
7287                                    struct ath10k_fw_stats_pdev *dst);
7288 void ath10k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src,
7289                                    struct ath10k_fw_stats_pdev *dst);
7290 void ath10k_wmi_pull_pdev_stats_extra(const struct wmi_pdev_stats_extra *src,
7291                                       struct ath10k_fw_stats_pdev *dst);
7292 void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src,
7293                                 struct ath10k_fw_stats_peer *dst);
7294 void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar,
7295                                     struct wmi_host_mem_chunks *chunks);
7296 void ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn,
7297                                       const struct wmi_start_scan_arg *arg);
7298 void ath10k_wmi_set_wmm_param(struct wmi_wmm_params *params,
7299                               const struct wmi_wmm_params_arg *arg);
7300 void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
7301                                 const struct wmi_channel_arg *arg);
7302 int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg);
7303
7304 int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb);
7305 int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb);
7306 int ath10k_wmi_event_mgmt_tx_compl(struct ath10k *ar, struct sk_buff *skb);
7307 int ath10k_wmi_event_mgmt_tx_bundle_compl(struct ath10k *ar, struct sk_buff *skb);
7308 void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb);
7309 void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb);
7310 int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb);
7311 void ath10k_wmi_event_update_stats(struct ath10k *ar, struct sk_buff *skb);
7312 void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb);
7313 void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, struct sk_buff *skb);
7314 void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb);
7315 void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb);
7316 void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar, struct sk_buff *skb);
7317 void ath10k_wmi_event_dfs(struct ath10k *ar,
7318                           struct wmi_phyerr_ev_arg *phyerr, u64 tsf);
7319 void ath10k_wmi_event_spectral_scan(struct ath10k *ar,
7320                                     struct wmi_phyerr_ev_arg *phyerr,
7321                                     u64 tsf);
7322 void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb);
7323 void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb);
7324 void ath10k_wmi_event_profile_match(struct ath10k *ar, struct sk_buff *skb);
7325 void ath10k_wmi_event_debug_print(struct ath10k *ar, struct sk_buff *skb);
7326 void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb);
7327 void ath10k_wmi_event_wlan_profile_data(struct ath10k *ar, struct sk_buff *skb);
7328 void ath10k_wmi_event_rtt_measurement_report(struct ath10k *ar,
7329                                              struct sk_buff *skb);
7330 void ath10k_wmi_event_tsf_measurement_report(struct ath10k *ar,
7331                                              struct sk_buff *skb);
7332 void ath10k_wmi_event_rtt_error_report(struct ath10k *ar, struct sk_buff *skb);
7333 void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb);
7334 void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb);
7335 void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb);
7336 void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, struct sk_buff *skb);
7337 void ath10k_wmi_event_gtk_offload_status(struct ath10k *ar,
7338                                          struct sk_buff *skb);
7339 void ath10k_wmi_event_gtk_rekey_fail(struct ath10k *ar, struct sk_buff *skb);
7340 void ath10k_wmi_event_delba_complete(struct ath10k *ar, struct sk_buff *skb);
7341 void ath10k_wmi_event_addba_complete(struct ath10k *ar, struct sk_buff *skb);
7342 void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar,
7343                                                 struct sk_buff *skb);
7344 void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar, struct sk_buff *skb);
7345 void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar, struct sk_buff *skb);
7346 void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, struct sk_buff *skb);
7347 void ath10k_wmi_event_service_ready(struct ath10k *ar, struct sk_buff *skb);
7348 int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb);
7349 void ath10k_wmi_event_service_available(struct ath10k *ar, struct sk_buff *skb);
7350 int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar, const void *phyerr_buf,
7351                                  int left_len, struct wmi_phyerr_ev_arg *arg);
7352 void ath10k_wmi_main_op_fw_stats_fill(struct ath10k *ar,
7353                                       struct ath10k_fw_stats *fw_stats,
7354                                       char *buf);
7355 void ath10k_wmi_10x_op_fw_stats_fill(struct ath10k *ar,
7356                                      struct ath10k_fw_stats *fw_stats,
7357                                      char *buf);
7358 size_t ath10k_wmi_fw_stats_num_peers(struct list_head *head);
7359 size_t ath10k_wmi_fw_stats_num_vdevs(struct list_head *head);
7360 void ath10k_wmi_10_4_op_fw_stats_fill(struct ath10k *ar,
7361                                       struct ath10k_fw_stats *fw_stats,
7362                                       char *buf);
7363 int ath10k_wmi_op_get_vdev_subtype(struct ath10k *ar,
7364                                    enum wmi_vdev_subtype subtype);
7365 int ath10k_wmi_barrier(struct ath10k *ar);
7366 void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table,
7367                                          u32 num_tx_chain);
7368 void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb);
7369
7370 #endif /* _WMI_H_ */