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