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