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