Linux Audio

Check our new training course

Linux kernel drivers training

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