1 //------------------------------------------------------------------------------
2 // Copyright (c) 2004-2010 Atheros Corporation.  All rights reserved.
3 //
4 //
5 // Permission to use, copy, modify, and/or distribute this software for any
6 // purpose with or without fee is hereby granted, provided that the above
7 // copyright notice and this permission notice appear in all copies.
8 //
9 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 //
17 //
18 //
19 // Author(s): ="Atheros"
20 //------------------------------------------------------------------------------
21 
22 /*
23  * This file contains the definitions of the WMI protocol specified in the
24  * Wireless Module Interface (WMI).  It includes definitions of all the
25  * commands and events. Commands are messages from the host to the WM.
26  * Events and Replies are messages from the WM to the host.
27  *
28  * Ownership of correctness in regards to commands
29  * belongs to the host driver and the WMI is not required to validate
30  * parameters for value, proper range, or any other checking.
31  *
32  */
33 
34 #ifndef _WMI_H_
35 #define _WMI_H_
36 
37 #ifndef ATH_TARGET
38 #include "athstartpack.h"
39 #endif
40 
41 #include "wmix.h"
42 #include "wlan_defs.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #define HTC_PROTOCOL_VERSION    0x0002
49 #define HTC_PROTOCOL_REVISION   0x0000
50 
51 #define WMI_PROTOCOL_VERSION    0x0002
52 #define WMI_PROTOCOL_REVISION   0x0000
53 
54 #define ATH_MAC_LEN             6               /* length of mac in bytes */
55 #define WMI_CMD_MAX_LEN         100
56 #define WMI_CONTROL_MSG_MAX_LEN     256
57 #define WMI_OPT_CONTROL_MSG_MAX_LEN 1536
58 #define IS_ETHERTYPE(_typeOrLen)        ((_typeOrLen) >= 0x0600)
59 #define RFC1042OUI      {0x00, 0x00, 0x00}
60 
61 #define IP_ETHERTYPE 0x0800
62 
63 #define WMI_IMPLICIT_PSTREAM 0xFF
64 #define WMI_MAX_THINSTREAM 15
65 
66 #ifdef AR6002_REV2
67 #define IBSS_MAX_NUM_STA          4
68 #else
69 #define IBSS_MAX_NUM_STA          8
70 #endif
71 
72 PREPACK struct host_app_area_s {
73     u32 wmi_protocol_ver;
74 } POSTPACK;
75 
76 /*
77  * Data Path
78  */
79 typedef PREPACK struct {
80     u8 dstMac[ATH_MAC_LEN];
81     u8 srcMac[ATH_MAC_LEN];
82     u16 typeOrLen;
83 } POSTPACK ATH_MAC_HDR;
84 
85 typedef PREPACK struct {
86     u8 dsap;
87     u8 ssap;
88     u8 cntl;
89     u8 orgCode[3];
90     u16 etherType;
91 } POSTPACK ATH_LLC_SNAP_HDR;
92 
93 typedef enum {
94     DATA_MSGTYPE = 0x0,
95     CNTL_MSGTYPE,
96     SYNC_MSGTYPE,
97     OPT_MSGTYPE,
98 } WMI_MSG_TYPE;
99 
100 
101 /*
102  * Macros for operating on WMI_DATA_HDR (info) field
103  */
104 
105 #define WMI_DATA_HDR_MSG_TYPE_MASK  0x03
106 #define WMI_DATA_HDR_MSG_TYPE_SHIFT 0
107 #define WMI_DATA_HDR_UP_MASK        0x07
108 #define WMI_DATA_HDR_UP_SHIFT       2
109 /* In AP mode, the same bit (b5) is used to indicate Power save state in
110  * the Rx dir and More data bit state in the tx direction.
111  */
112 #define WMI_DATA_HDR_PS_MASK        0x1
113 #define WMI_DATA_HDR_PS_SHIFT       5
114 
115 #define WMI_DATA_HDR_MORE_MASK      0x1
116 #define WMI_DATA_HDR_MORE_SHIFT     5
117 
118 typedef enum {
119     WMI_DATA_HDR_DATA_TYPE_802_3 = 0,
120     WMI_DATA_HDR_DATA_TYPE_802_11,
121     WMI_DATA_HDR_DATA_TYPE_ACL,
122 } WMI_DATA_HDR_DATA_TYPE;
123 
124 #define WMI_DATA_HDR_DATA_TYPE_MASK     0x3
125 #define WMI_DATA_HDR_DATA_TYPE_SHIFT    6
126 
127 #define WMI_DATA_HDR_SET_MORE_BIT(h) ((h)->info |= (WMI_DATA_HDR_MORE_MASK << WMI_DATA_HDR_MORE_SHIFT))
128 
129 #define WMI_DATA_HDR_IS_MSG_TYPE(h, t)  (((h)->info & (WMI_DATA_HDR_MSG_TYPE_MASK)) == (t))
130 #define WMI_DATA_HDR_SET_MSG_TYPE(h, t) (h)->info = (((h)->info & ~(WMI_DATA_HDR_MSG_TYPE_MASK << WMI_DATA_HDR_MSG_TYPE_SHIFT)) | (t << WMI_DATA_HDR_MSG_TYPE_SHIFT))
131 #define WMI_DATA_HDR_GET_UP(h)    (((h)->info >> WMI_DATA_HDR_UP_SHIFT) & WMI_DATA_HDR_UP_MASK)
132 #define WMI_DATA_HDR_SET_UP(h, p) (h)->info = (((h)->info & ~(WMI_DATA_HDR_UP_MASK << WMI_DATA_HDR_UP_SHIFT)) | (p << WMI_DATA_HDR_UP_SHIFT))
133 
134 #define WMI_DATA_HDR_GET_DATA_TYPE(h)   (((h)->info >> WMI_DATA_HDR_DATA_TYPE_SHIFT) & WMI_DATA_HDR_DATA_TYPE_MASK)
135 #define WMI_DATA_HDR_SET_DATA_TYPE(h, p) (h)->info = (((h)->info & ~(WMI_DATA_HDR_DATA_TYPE_MASK << WMI_DATA_HDR_DATA_TYPE_SHIFT)) | ((p) << WMI_DATA_HDR_DATA_TYPE_SHIFT))
136 
137 #define WMI_DATA_HDR_GET_DOT11(h)   (WMI_DATA_HDR_GET_DATA_TYPE((h)) == WMI_DATA_HDR_DATA_TYPE_802_11)
138 #define WMI_DATA_HDR_SET_DOT11(h, p) WMI_DATA_HDR_SET_DATA_TYPE((h), (p))
139 
140 /* Macros for operating on WMI_DATA_HDR (info2) field */
141 #define WMI_DATA_HDR_SEQNO_MASK     0xFFF
142 #define WMI_DATA_HDR_SEQNO_SHIFT    0
143 
144 #define WMI_DATA_HDR_AMSDU_MASK     0x1
145 #define WMI_DATA_HDR_AMSDU_SHIFT    12
146 
147 #define WMI_DATA_HDR_META_MASK      0x7
148 #define WMI_DATA_HDR_META_SHIFT     13
149 
150 #define GET_SEQ_NO(_v)                  ((_v) & WMI_DATA_HDR_SEQNO_MASK)
151 #define GET_ISMSDU(_v)                  ((_v) & WMI_DATA_HDR_AMSDU_MASK)
152 
153 #define WMI_DATA_HDR_GET_SEQNO(h)        GET_SEQ_NO((h)->info2 >> WMI_DATA_HDR_SEQNO_SHIFT)
154 #define WMI_DATA_HDR_SET_SEQNO(h, _v)   ((h)->info2 = ((h)->info2 & ~(WMI_DATA_HDR_SEQNO_MASK << WMI_DATA_HDR_SEQNO_SHIFT)) | (GET_SEQ_NO(_v) << WMI_DATA_HDR_SEQNO_SHIFT))
155 
156 #define WMI_DATA_HDR_IS_AMSDU(h)        GET_ISMSDU((h)->info2 >> WMI_DATA_HDR_AMSDU_SHIFT)
157 #define WMI_DATA_HDR_SET_AMSDU(h, _v)   ((h)->info2 = ((h)->info2 & ~(WMI_DATA_HDR_AMSDU_MASK << WMI_DATA_HDR_AMSDU_SHIFT)) | (GET_ISMSDU(_v) << WMI_DATA_HDR_AMSDU_SHIFT))
158 
159 #define WMI_DATA_HDR_GET_META(h)        (((h)->info2 >> WMI_DATA_HDR_META_SHIFT) & WMI_DATA_HDR_META_MASK)
160 #define WMI_DATA_HDR_SET_META(h, _v)    ((h)->info2 = ((h)->info2 & ~(WMI_DATA_HDR_META_MASK << WMI_DATA_HDR_META_SHIFT)) | ((_v) << WMI_DATA_HDR_META_SHIFT))
161 
162 typedef PREPACK struct {
163     s8 rssi;
164     u8 info;               /* usage of 'info' field(8-bit):
165                                      *  b1:b0       - WMI_MSG_TYPE
166                                      *  b4:b3:b2    - UP(tid)
167                                      *  b5          - Used in AP mode. More-data in tx dir, PS in rx.
168                                      *  b7:b6       -  Dot3 header(0),
169                                      *                 Dot11 Header(1),
170                                      *                 ACL data(2)
171                                      */
172 
173     u16 info2;              /* usage of 'info2' field(16-bit):
174                                      * b11:b0       - seq_no
175                                      * b12          - A-MSDU?
176                                      * b15:b13      - META_DATA_VERSION 0 - 7
177                                      */
178     u16 reserved;
179 } POSTPACK WMI_DATA_HDR;
180 
181 /*
182  *  TX META VERSION DEFINITIONS
183  */
184 #define WMI_MAX_TX_META_SZ  (12)
185 #define WMI_MAX_TX_META_VERSION (7)
186 #define WMI_META_VERSION_1 (0x01)
187 #define WMI_META_VERSION_2 (0X02)
188 
189 #define WMI_ACL_TO_DOT11_HEADROOM   36
190 
191 #if 0 /* removed to prevent compile errors for WM.. */
192 typedef PREPACK struct {
193 /* intentionally empty. Default version is no meta data. */
194 } POSTPACK WMI_TX_META_V0;
195 #endif
196 
197 typedef PREPACK struct {
198     u8 pktID;           /* The packet ID to identify the tx request */
199     u8 ratePolicyID;    /* The rate policy to be used for the tx of this frame */
200 } POSTPACK WMI_TX_META_V1;
201 
202 
203 #define WMI_CSUM_DIR_TX (0x1)
204 #define TX_CSUM_CALC_FILL (0x1)
205 typedef PREPACK struct {
206     u8 csumStart;       /*Offset from start of the WMI header for csum calculation to begin */
207     u8 csumDest;        /*Offset from start of WMI header where final csum goes*/
208     u8 csumFlags;    /*number of bytes over which csum is calculated*/
209 } POSTPACK WMI_TX_META_V2;
210 
211 
212 /*
213  *  RX META VERSION DEFINITIONS
214  */
215 /* if RX meta data is present at all then the meta data field
216  *  will consume WMI_MAX_RX_META_SZ bytes of space between the
217  *  WMI_DATA_HDR and the payload. How much of the available
218  *  Meta data is actually used depends on which meta data
219  *  version is active. */
220 #define WMI_MAX_RX_META_SZ  (12)
221 #define WMI_MAX_RX_META_VERSION (7)
222 
223 #define WMI_RX_STATUS_OK            0 /* success */
224 #define WMI_RX_STATUS_DECRYPT_ERR   1 /* decrypt error */
225 #define WMI_RX_STATUS_MIC_ERR       2 /* tkip MIC error */
226 #define WMI_RX_STATUS_ERR           3 /* undefined error */
227 
228 #define WMI_RX_FLAGS_AGGR           0x0001 /* part of AGGR */
229 #define WMI_RX_FlAGS_STBC           0x0002 /* used STBC */
230 #define WMI_RX_FLAGS_SGI            0x0004 /* used SGI */
231 #define WMI_RX_FLAGS_HT             0x0008 /* is HT packet */
232 /* the flags field is also used to store the CRYPTO_TYPE of the frame
233  * that value is shifted by WMI_RX_FLAGS_CRYPTO_SHIFT */
234 #define WMI_RX_FLAGS_CRYPTO_SHIFT   4
235 #define WMI_RX_FLAGS_CRYPTO_MASK    0x1f
236 #define WMI_RX_META_GET_CRYPTO(flags) (((flags) >> WMI_RX_FLAGS_CRYPTO_SHIFT) & WMI_RX_FLAGS_CRYPTO_MASK)
237 
238 #if 0 /* removed to prevent compile errors for WM.. */
239 typedef PREPACK struct {
240 /* intentionally empty. Default version is no meta data. */
241 } POSTPACK WMI_RX_META_VERSION_0;
242 #endif
243 
244 typedef PREPACK struct {
245     u8 status; /* one of WMI_RX_STATUS_... */
246     u8 rix;    /* rate index mapped to rate at which this packet was received. */
247     u8 rssi;   /* rssi of packet */
248     u8 channel;/* rf channel during packet reception */
249     u16 flags;  /* a combination of WMI_RX_FLAGS_... */
250 } POSTPACK WMI_RX_META_V1;
251 
252 #define RX_CSUM_VALID_FLAG (0x1)
253 typedef PREPACK struct {
254     u16 csum;
255     u8 csumFlags;/* bit 0 set -partial csum valid
256                              bit 1 set -test mode */
257 } POSTPACK WMI_RX_META_V2;
258 
259 
260 
261 #define WMI_GET_DEVICE_ID(info1) ((info1) & 0xF)
262 
263 /*
264  * Control Path
265  */
266 typedef PREPACK struct {
267     u16 commandId;
268 /*
269  * info1 - 16 bits
270  * b03:b00 - id
271  * b15:b04 - unused
272  */
273     u16 info1;
274 
275     u16 reserved;      /* For alignment */
276 } POSTPACK WMI_CMD_HDR;        /* used for commands and events */
277 
278 /*
279  * List of Commnands
280  */
281 typedef enum {
282     WMI_CONNECT_CMDID           = 0x0001,
283     WMI_RECONNECT_CMDID,
284     WMI_DISCONNECT_CMDID,
285     WMI_SYNCHRONIZE_CMDID,
286     WMI_CREATE_PSTREAM_CMDID,
287     WMI_DELETE_PSTREAM_CMDID,
288     WMI_START_SCAN_CMDID,
289     WMI_SET_SCAN_PARAMS_CMDID,
290     WMI_SET_BSS_FILTER_CMDID,
291     WMI_SET_PROBED_SSID_CMDID,               /* 10 */
292     WMI_SET_LISTEN_INT_CMDID,
293     WMI_SET_BMISS_TIME_CMDID,
294     WMI_SET_DISC_TIMEOUT_CMDID,
295     WMI_GET_CHANNEL_LIST_CMDID,
296     WMI_SET_BEACON_INT_CMDID,
297     WMI_GET_STATISTICS_CMDID,
298     WMI_SET_CHANNEL_PARAMS_CMDID,
299     WMI_SET_POWER_MODE_CMDID,
300     WMI_SET_IBSS_PM_CAPS_CMDID,
301     WMI_SET_POWER_PARAMS_CMDID,              /* 20 */
302     WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID,
303     WMI_ADD_CIPHER_KEY_CMDID,
304     WMI_DELETE_CIPHER_KEY_CMDID,
305     WMI_ADD_KRK_CMDID,
306     WMI_DELETE_KRK_CMDID,
307     WMI_SET_PMKID_CMDID,
308     WMI_SET_TX_PWR_CMDID,
309     WMI_GET_TX_PWR_CMDID,
310     WMI_SET_ASSOC_INFO_CMDID,
311     WMI_ADD_BAD_AP_CMDID,                    /* 30 */
312     WMI_DELETE_BAD_AP_CMDID,
313     WMI_SET_TKIP_COUNTERMEASURES_CMDID,
314     WMI_RSSI_THRESHOLD_PARAMS_CMDID,
315     WMI_TARGET_ERROR_REPORT_BITMASK_CMDID,
316     WMI_SET_ACCESS_PARAMS_CMDID,
317     WMI_SET_RETRY_LIMITS_CMDID,
318     WMI_SET_OPT_MODE_CMDID,
319     WMI_OPT_TX_FRAME_CMDID,
320     WMI_SET_VOICE_PKT_SIZE_CMDID,
321     WMI_SET_MAX_SP_LEN_CMDID,                /* 40 */
322     WMI_SET_ROAM_CTRL_CMDID,
323     WMI_GET_ROAM_TBL_CMDID,
324     WMI_GET_ROAM_DATA_CMDID,
325     WMI_ENABLE_RM_CMDID,
326     WMI_SET_MAX_OFFHOME_DURATION_CMDID,
327     WMI_EXTENSION_CMDID,                        /* Non-wireless extensions */
328     WMI_SNR_THRESHOLD_PARAMS_CMDID,
329     WMI_LQ_THRESHOLD_PARAMS_CMDID,
330     WMI_SET_LPREAMBLE_CMDID,
331     WMI_SET_RTS_CMDID,                       /* 50 */
332     WMI_CLR_RSSI_SNR_CMDID,
333     WMI_SET_FIXRATES_CMDID,
334     WMI_GET_FIXRATES_CMDID,
335     WMI_SET_AUTH_MODE_CMDID,
336     WMI_SET_REASSOC_MODE_CMDID,
337     WMI_SET_WMM_CMDID,
338     WMI_SET_WMM_TXOP_CMDID,
339     WMI_TEST_CMDID,
340     /* COEX AR6002 only*/
341     WMI_SET_BT_STATUS_CMDID,
342     WMI_SET_BT_PARAMS_CMDID,                /* 60 */
343 
344     WMI_SET_KEEPALIVE_CMDID,
345     WMI_GET_KEEPALIVE_CMDID,
346     WMI_SET_APPIE_CMDID,
347     WMI_GET_APPIE_CMDID,
348     WMI_SET_WSC_STATUS_CMDID,
349 
350     /* Wake on Wireless */
351     WMI_SET_HOST_SLEEP_MODE_CMDID,
352     WMI_SET_WOW_MODE_CMDID,
353     WMI_GET_WOW_LIST_CMDID,
354     WMI_ADD_WOW_PATTERN_CMDID,
355     WMI_DEL_WOW_PATTERN_CMDID,               /* 70 */
356 
357     WMI_SET_FRAMERATES_CMDID,
358     WMI_SET_AP_PS_CMDID,
359     WMI_SET_QOS_SUPP_CMDID,
360     /* WMI_THIN_RESERVED_... mark the start and end
361      * values for WMI_THIN_RESERVED command IDs. These
362      * command IDs can be found in wmi_thin.h */
363     WMI_THIN_RESERVED_START = 0x8000,
364     WMI_THIN_RESERVED_END = 0x8fff,
365     /*
366      * Developer commands starts at 0xF000
367      */
368     WMI_SET_BITRATE_CMDID = 0xF000,
369     WMI_GET_BITRATE_CMDID,
370     WMI_SET_WHALPARAM_CMDID,
371 
372 
373     /*Should add the new command to the tail for compatible with
374      * etna.
375      */
376     WMI_SET_MAC_ADDRESS_CMDID,
377     WMI_SET_AKMP_PARAMS_CMDID,
378     WMI_SET_PMKID_LIST_CMDID,
379     WMI_GET_PMKID_LIST_CMDID,
380     WMI_ABORT_SCAN_CMDID,
381     WMI_SET_TARGET_EVENT_REPORT_CMDID,
382 
383     // Unused
384     WMI_UNUSED1,
385     WMI_UNUSED2,
386 
387     /*
388      * AP mode commands
389      */
390     WMI_AP_HIDDEN_SSID_CMDID,
391     WMI_AP_SET_NUM_STA_CMDID,
392     WMI_AP_ACL_POLICY_CMDID,
393     WMI_AP_ACL_MAC_LIST_CMDID,
394     WMI_AP_CONFIG_COMMIT_CMDID,
395     WMI_AP_SET_MLME_CMDID,
396     WMI_AP_SET_PVB_CMDID,
397     WMI_AP_CONN_INACT_CMDID,
398     WMI_AP_PROT_SCAN_TIME_CMDID,
399     WMI_AP_SET_COUNTRY_CMDID,
400     WMI_AP_SET_DTIM_CMDID,
401     WMI_AP_MODE_STAT_CMDID,
402 
403     WMI_SET_IP_CMDID,
404     WMI_SET_PARAMS_CMDID,
405     WMI_SET_MCAST_FILTER_CMDID,
406     WMI_DEL_MCAST_FILTER_CMDID,
407 
408     WMI_ALLOW_AGGR_CMDID,
409     WMI_ADDBA_REQ_CMDID,
410     WMI_DELBA_REQ_CMDID,
411     WMI_SET_HT_CAP_CMDID,
412     WMI_SET_HT_OP_CMDID,
413     WMI_SET_TX_SELECT_RATES_CMDID,
414     WMI_SET_TX_SGI_PARAM_CMDID,
415     WMI_SET_RATE_POLICY_CMDID,
416 
417     WMI_HCI_CMD_CMDID,
418     WMI_RX_FRAME_FORMAT_CMDID,
419     WMI_SET_THIN_MODE_CMDID,
420     WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID,
421 
422     WMI_AP_SET_11BG_RATESET_CMDID,
423     WMI_SET_PMK_CMDID,
424     WMI_MCAST_FILTER_CMDID,
425     /* COEX CMDID AR6003*/
426     WMI_SET_BTCOEX_FE_ANT_CMDID,
427     WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID,
428     WMI_SET_BTCOEX_SCO_CONFIG_CMDID,
429     WMI_SET_BTCOEX_A2DP_CONFIG_CMDID,
430     WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID,
431     WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID,
432     WMI_SET_BTCOEX_DEBUG_CMDID,
433     WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID,
434     WMI_GET_BTCOEX_STATS_CMDID,
435     WMI_GET_BTCOEX_CONFIG_CMDID,
436     WMI_GET_PMK_CMDID,
437     WMI_SET_PASSPHRASE_CMDID,
438     WMI_ENABLE_WAC_CMDID,
439     WMI_WAC_SCAN_REPLY_CMDID,
440     WMI_WAC_CTRL_REQ_CMDID,
441     WMI_SET_DIV_PARAMS_CMDID,
442     WMI_SET_EXCESS_TX_RETRY_THRES_CMDID,
443 } WMI_COMMAND_ID;
444 
445 /*
446  * Frame Types
447  */
448 typedef enum {
449     WMI_FRAME_BEACON        =   0,
450     WMI_FRAME_PROBE_REQ,
451     WMI_FRAME_PROBE_RESP,
452     WMI_FRAME_ASSOC_REQ,
453     WMI_FRAME_ASSOC_RESP,
454     WMI_NUM_MGMT_FRAME
455 } WMI_MGMT_FRAME_TYPE;
456 
457 /*
458  * Connect Command
459  */
460 typedef enum {
461     INFRA_NETWORK       = 0x01,
462     ADHOC_NETWORK       = 0x02,
463     ADHOC_CREATOR       = 0x04,
464     AP_NETWORK          = 0x10,
465 } NETWORK_TYPE;
466 
467 typedef enum {
468     OPEN_AUTH           = 0x01,
469     SHARED_AUTH         = 0x02,
470     LEAP_AUTH           = 0x04,  /* different from IEEE_AUTH_MODE definitions */
471 } DOT11_AUTH_MODE;
472 
473 typedef enum {
474     NONE_AUTH           = 0x01,
475     WPA_AUTH            = 0x02,
476     WPA2_AUTH           = 0x04,
477     WPA_PSK_AUTH        = 0x08,
478     WPA2_PSK_AUTH       = 0x10,
479     WPA_AUTH_CCKM       = 0x20,
480     WPA2_AUTH_CCKM      = 0x40,
481 } AUTH_MODE;
482 
483 typedef enum {
484     NONE_CRYPT          = 0x01,
485     WEP_CRYPT           = 0x02,
486     TKIP_CRYPT          = 0x04,
487     AES_CRYPT           = 0x08,
488 #ifdef WAPI_ENABLE
489     WAPI_CRYPT          = 0x10,
490 #endif /*WAPI_ENABLE*/
491 } CRYPTO_TYPE;
492 
493 #define WMI_MIN_CRYPTO_TYPE NONE_CRYPT
494 #define WMI_MAX_CRYPTO_TYPE (AES_CRYPT + 1)
495 
496 #ifdef WAPI_ENABLE
497 #undef WMI_MAX_CRYPTO_TYPE
498 #define WMI_MAX_CRYPTO_TYPE (WAPI_CRYPT + 1)
499 #endif /* WAPI_ENABLE */
500 
501 #ifdef WAPI_ENABLE
502 #define IW_ENCODE_ALG_SM4       0x20
503 #define IW_AUTH_WAPI_ENABLED    0x20
504 #endif
505 
506 #define WMI_MIN_KEY_INDEX   0
507 #define WMI_MAX_KEY_INDEX   3
508 
509 #ifdef WAPI_ENABLE
510 #undef WMI_MAX_KEY_INDEX
511 #define WMI_MAX_KEY_INDEX   7 /* wapi grpKey 0-3, prwKey 4-7 */
512 #endif /* WAPI_ENABLE */
513 
514 #define WMI_MAX_KEY_LEN     32
515 
516 #define WMI_MAX_SSID_LEN    32
517 
518 typedef enum {
519     CONNECT_ASSOC_POLICY_USER           = 0x0001,
520     CONNECT_SEND_REASSOC                = 0x0002,
521     CONNECT_IGNORE_WPAx_GROUP_CIPHER    = 0x0004,
522     CONNECT_PROFILE_MATCH_DONE          = 0x0008,
523     CONNECT_IGNORE_AAC_BEACON           = 0x0010,
524     CONNECT_CSA_FOLLOW_BSS              = 0x0020,
525     CONNECT_DO_WPA_OFFLOAD              = 0x0040,
526     CONNECT_DO_NOT_DEAUTH               = 0x0080,
527 } WMI_CONNECT_CTRL_FLAGS_BITS;
528 
529 #define DEFAULT_CONNECT_CTRL_FLAGS    (CONNECT_CSA_FOLLOW_BSS)
530 
531 typedef PREPACK struct {
532     u8 networkType;
533     u8 dot11AuthMode;
534     u8 authMode;
535     u8 pairwiseCryptoType;
536     u8 pairwiseCryptoLen;
537     u8 groupCryptoType;
538     u8 groupCryptoLen;
539     u8 ssidLength;
540     u8     ssid[WMI_MAX_SSID_LEN];
541     u16 channel;
542     u8 bssid[ATH_MAC_LEN];
543     u32 ctrl_flags;
544 } POSTPACK WMI_CONNECT_CMD;
545 
546 /*
547  * WMI_RECONNECT_CMDID
548  */
549 typedef PREPACK struct {
550     u16 channel;                    /* hint */
551     u8 bssid[ATH_MAC_LEN];         /* mandatory if set */
552 } POSTPACK WMI_RECONNECT_CMD;
553 
554 #define WMI_PMK_LEN     32
555 typedef PREPACK struct {
556     u8 pmk[WMI_PMK_LEN];
557 } POSTPACK WMI_SET_PMK_CMD;
558 
559 /*
560  * WMI_SET_EXCESS_TX_RETRY_THRES_CMDID
561  */
562 typedef PREPACK struct {
563     A_UINT32 threshold;
564 } POSTPACK WMI_SET_EXCESS_TX_RETRY_THRES_CMD;
565 
566 /*
567  * WMI_ADD_CIPHER_KEY_CMDID
568  */
569 typedef enum {
570     PAIRWISE_USAGE      = 0x00,
571     GROUP_USAGE         = 0x01,
572     TX_USAGE            = 0x02,     /* default Tx Key - Static WEP only */
573 } KEY_USAGE;
574 
575 /*
576  * Bit Flag
577  * Bit 0 - Initialise TSC - default is Initialize
578  */
579 #define KEY_OP_INIT_TSC       0x01
580 #define KEY_OP_INIT_RSC       0x02
581 #ifdef WAPI_ENABLE
582 #define KEY_OP_INIT_WAPIPN    0x10
583 #endif /* WAPI_ENABLE */
584 
585 #define KEY_OP_INIT_VAL     0x03     /* Default Initialise the TSC & RSC */
586 #define KEY_OP_VALID_MASK   0x03
587 
588 typedef PREPACK struct {
589     u8 keyIndex;
590     u8 keyType;
591     u8 keyUsage;           /* KEY_USAGE */
592     u8 keyLength;
593     u8 keyRSC[8];          /* key replay sequence counter */
594     u8 key[WMI_MAX_KEY_LEN];
595     u8 key_op_ctrl;       /* Additional Key Control information */
596     u8 key_macaddr[ATH_MAC_LEN];
597 } POSTPACK WMI_ADD_CIPHER_KEY_CMD;
598 
599 /*
600  * WMI_DELETE_CIPHER_KEY_CMDID
601  */
602 typedef PREPACK struct {
603     u8 keyIndex;
604 } POSTPACK WMI_DELETE_CIPHER_KEY_CMD;
605 
606 #define WMI_KRK_LEN     16
607 /*
608  * WMI_ADD_KRK_CMDID
609  */
610 typedef PREPACK struct {
611     u8 krk[WMI_KRK_LEN];
612 } POSTPACK WMI_ADD_KRK_CMD;
613 
614 /*
615  * WMI_SET_TKIP_COUNTERMEASURES_CMDID
616  */
617 typedef enum {
618     WMI_TKIP_CM_DISABLE = 0x0,
619     WMI_TKIP_CM_ENABLE  = 0x1,
620 } WMI_TKIP_CM_CONTROL;
621 
622 typedef PREPACK struct {
623     u8 cm_en;                     /* WMI_TKIP_CM_CONTROL */
624 } POSTPACK WMI_SET_TKIP_COUNTERMEASURES_CMD;
625 
626 /*
627  * WMI_SET_PMKID_CMDID
628  */
629 
630 #define WMI_PMKID_LEN 16
631 
632 typedef enum {
633    PMKID_DISABLE = 0,
634    PMKID_ENABLE  = 1,
635 } PMKID_ENABLE_FLG;
636 
637 typedef PREPACK struct {
638     u8 bssid[ATH_MAC_LEN];
639     u8 enable;                 /* PMKID_ENABLE_FLG */
640     u8 pmkid[WMI_PMKID_LEN];
641 } POSTPACK WMI_SET_PMKID_CMD;
642 
643 /*
644  * WMI_START_SCAN_CMD
645  */
646 typedef enum {
647     WMI_LONG_SCAN  = 0,
648     WMI_SHORT_SCAN = 1,
649 } WMI_SCAN_TYPE;
650 
651 typedef PREPACK struct {
652     u32   forceFgScan;
653     u32   isLegacy;        /* For Legacy Cisco AP compatibility */
654     u32 homeDwellTime;   /* Maximum duration in the home channel(milliseconds) */
655     u32 forceScanInterval;    /* Time interval between scans (milliseconds)*/
656     u8 scanType;           /* WMI_SCAN_TYPE */
657     u8 numChannels;            /* how many channels follow */
658     u16 channelList[1];         /* channels in Mhz */
659 } POSTPACK WMI_START_SCAN_CMD;
660 
661 /*
662  * WMI_SET_SCAN_PARAMS_CMDID
663  */
664 #define WMI_SHORTSCANRATIO_DEFAULT      3
665 /*
666  *  Warning: ScanCtrlFlag value of 0xFF is used to disable all flags in WMI_SCAN_PARAMS_CMD
667  *  Do not add any more flags to WMI_SCAN_CTRL_FLAG_BITS
668  */
669 typedef enum {
670     CONNECT_SCAN_CTRL_FLAGS = 0x01,    /* set if can scan in the Connect cmd */
671     SCAN_CONNECTED_CTRL_FLAGS = 0x02,  /* set if scan for the SSID it is */
672                                        /* already connected to */
673     ACTIVE_SCAN_CTRL_FLAGS = 0x04,     /* set if enable active scan */
674     ROAM_SCAN_CTRL_FLAGS = 0x08,       /* set if enable roam scan when bmiss and lowrssi */
675     REPORT_BSSINFO_CTRL_FLAGS = 0x10,   /* set if follows customer BSSINFO reporting rule */
676     ENABLE_AUTO_CTRL_FLAGS = 0x20,      /* if disabled, target doesn't
677                                           scan after a disconnect event  */
678     ENABLE_SCAN_ABORT_EVENT = 0x40      /* Scan complete event with canceled status will be generated when a scan is prempted before it gets completed */
679 } WMI_SCAN_CTRL_FLAGS_BITS;
680 
681 #define CAN_SCAN_IN_CONNECT(flags)      (flags & CONNECT_SCAN_CTRL_FLAGS)
682 #define CAN_SCAN_CONNECTED(flags)       (flags & SCAN_CONNECTED_CTRL_FLAGS)
683 #define ENABLE_ACTIVE_SCAN(flags)       (flags & ACTIVE_SCAN_CTRL_FLAGS)
684 #define ENABLE_ROAM_SCAN(flags)         (flags & ROAM_SCAN_CTRL_FLAGS)
685 #define CONFIG_REPORT_BSSINFO(flags)     (flags & REPORT_BSSINFO_CTRL_FLAGS)
686 #define IS_AUTO_SCAN_ENABLED(flags)      (flags & ENABLE_AUTO_CTRL_FLAGS)
687 #define SCAN_ABORT_EVENT_ENABLED(flags) (flags & ENABLE_SCAN_ABORT_EVENT)
688 
689 #define DEFAULT_SCAN_CTRL_FLAGS         (CONNECT_SCAN_CTRL_FLAGS| SCAN_CONNECTED_CTRL_FLAGS| ACTIVE_SCAN_CTRL_FLAGS| ROAM_SCAN_CTRL_FLAGS | ENABLE_AUTO_CTRL_FLAGS)
690 
691 
692 typedef PREPACK struct {
693     u16 fg_start_period;        /* seconds */
694     u16 fg_end_period;          /* seconds */
695     u16 bg_period;              /* seconds */
696     u16 maxact_chdwell_time;    /* msec */
697     u16 pas_chdwell_time;       /* msec */
698     u8 shortScanRatio;         /* how many shorts scan for one long */
699     u8 scanCtrlFlags;
700     u16 minact_chdwell_time;    /* msec */
701     u16 maxact_scan_per_ssid;   /* max active scans per ssid */
702     u32 max_dfsch_act_time;  /* msecs */
703 } POSTPACK WMI_SCAN_PARAMS_CMD;
704 
705 /*
706  * WMI_SET_BSS_FILTER_CMDID
707  */
708 typedef enum {
709     NONE_BSS_FILTER = 0x0,              /* no beacons forwarded */
710     ALL_BSS_FILTER,                     /* all beacons forwarded */
711     PROFILE_FILTER,                     /* only beacons matching profile */
712     ALL_BUT_PROFILE_FILTER,             /* all but beacons matching profile */
713     CURRENT_BSS_FILTER,                 /* only beacons matching current BSS */
714     ALL_BUT_BSS_FILTER,                 /* all but beacons matching BSS */
715     PROBED_SSID_FILTER,                 /* beacons matching probed ssid */
716     LAST_BSS_FILTER,                    /* marker only */
717 } WMI_BSS_FILTER;
718 
719 typedef PREPACK struct {
720     u8 bssFilter;                      /* see WMI_BSS_FILTER */
721     u8 reserved1;                      /* For alignment */
722     u16 reserved2;                      /* For alignment */
723     u32 ieMask;
724 } POSTPACK WMI_BSS_FILTER_CMD;
725 
726 /*
727  * WMI_SET_PROBED_SSID_CMDID
728  */
729 #define MAX_PROBED_SSID_INDEX   9
730 
731 typedef enum {
732     DISABLE_SSID_FLAG  = 0,                  /* disables entry */
733     SPECIFIC_SSID_FLAG = 0x01,               /* probes specified ssid */
734     ANY_SSID_FLAG      = 0x02,               /* probes for any ssid */
735 } WMI_SSID_FLAG;
736 
737 typedef PREPACK struct {
738     u8 entryIndex;                     /* 0 to MAX_PROBED_SSID_INDEX */
739     u8 flag;                           /* WMI_SSID_FLG */
740     u8 ssidLength;
741     u8 ssid[32];
742 } POSTPACK WMI_PROBED_SSID_CMD;
743 
744 /*
745  * WMI_SET_LISTEN_INT_CMDID
746  * The Listen interval is between 15 and 3000 TUs
747  */
748 #define MIN_LISTEN_INTERVAL 15
749 #define MAX_LISTEN_INTERVAL 5000
750 #define MIN_LISTEN_BEACONS 1
751 #define MAX_LISTEN_BEACONS 50
752 
753 typedef PREPACK struct {
754     u16 listenInterval;
755     u16 numBeacons;
756 } POSTPACK WMI_LISTEN_INT_CMD;
757 
758 /*
759  * WMI_SET_BEACON_INT_CMDID
760  */
761 typedef PREPACK struct {
762     u16 beaconInterval;
763 } POSTPACK WMI_BEACON_INT_CMD;
764 
765 /*
766  * WMI_SET_BMISS_TIME_CMDID
767  * valid values are between 1000 and 5000 TUs
768  */
769 
770 #define MIN_BMISS_TIME     1000
771 #define MAX_BMISS_TIME     5000
772 #define MIN_BMISS_BEACONS  1
773 #define MAX_BMISS_BEACONS  50
774 
775 typedef PREPACK struct {
776     u16 bmissTime;
777     u16 numBeacons;
778 } POSTPACK WMI_BMISS_TIME_CMD;
779 
780 /*
781  * WMI_SET_POWER_MODE_CMDID
782  */
783 typedef enum {
784     REC_POWER = 0x01,
785     MAX_PERF_POWER,
786 } WMI_POWER_MODE;
787 
788 typedef PREPACK struct {
789     u8 powerMode;      /* WMI_POWER_MODE */
790 } POSTPACK WMI_POWER_MODE_CMD;
791 
792 typedef PREPACK struct {
793     s8 status;      /* WMI_SET_PARAMS_REPLY */
794 } POSTPACK WMI_SET_PARAMS_REPLY;
795 
796 typedef PREPACK struct {
797     u32 opcode;
798     u32 length;
799     char buffer[1];      /* WMI_SET_PARAMS */
800 } POSTPACK WMI_SET_PARAMS_CMD;
801 
802 typedef PREPACK struct {
803     u8 multicast_mac[ATH_MAC_LEN];      /* WMI_SET_MCAST_FILTER */
804 } POSTPACK WMI_SET_MCAST_FILTER_CMD;
805 
806 typedef PREPACK struct {
807     u8 enable;      /* WMI_MCAST_FILTER */
808 } POSTPACK WMI_MCAST_FILTER_CMD;
809 
810 /*
811  * WMI_SET_POWER_PARAMS_CMDID
812  */
813 typedef enum {
814     IGNORE_DTIM = 0x01,
815     NORMAL_DTIM = 0x02,
816     STICK_DTIM  = 0x03,
817     AUTO_DTIM   = 0x04,
818 } WMI_DTIM_POLICY;
819 
820 /* Policy to determnine whether TX should wakeup WLAN if sleeping */
821 typedef enum {
822     TX_WAKEUP_UPON_SLEEP = 1,
823     TX_DONT_WAKEUP_UPON_SLEEP = 2
824 } WMI_TX_WAKEUP_POLICY_UPON_SLEEP;
825 
826 /*
827  * Policy to determnine whether power save failure event should be sent to
828  * host during scanning
829  */
830 typedef enum {
831     SEND_POWER_SAVE_FAIL_EVENT_ALWAYS = 1,
832     IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN = 2,
833 } POWER_SAVE_FAIL_EVENT_POLICY;
834 
835 typedef PREPACK struct {
836     u16 idle_period;             /* msec */
837     u16 pspoll_number;
838     u16 dtim_policy;
839     u16 tx_wakeup_policy;
840     u16 num_tx_to_wakeup;
841     u16 ps_fail_event_policy;
842 } POSTPACK WMI_POWER_PARAMS_CMD;
843 
844 /* Adhoc power save types */
845 typedef enum {
846     ADHOC_PS_DISABLE=1,
847     ADHOC_PS_ATH=2,
848     ADHOC_PS_IEEE=3,
849     ADHOC_PS_OTHER=4,
850 } WMI_ADHOC_PS_TYPE;
851 
852 typedef PREPACK struct {
853     u8 power_saving;
854     u8 ttl; /* number of beacon periods */
855     u16 atim_windows;          /* msec */
856     u16 timeout_value;         /* msec */
857 } POSTPACK WMI_IBSS_PM_CAPS_CMD;
858 
859 /* AP power save types */
860 typedef enum {
861     AP_PS_DISABLE=1,
862     AP_PS_ATH=2,
863 } WMI_AP_PS_TYPE;
864 
865 typedef PREPACK struct {
866     u32 idle_time;   /* in msec */
867     u32 ps_period;   /* in usec */
868     u8 sleep_period; /* in ps periods */
869     u8 psType;
870 } POSTPACK WMI_AP_PS_CMD;
871 
872 /*
873  * WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID
874  */
875 typedef enum {
876     IGNORE_TIM_ALL_QUEUES_APSD = 0,
877     PROCESS_TIM_ALL_QUEUES_APSD = 1,
878     IGNORE_TIM_SIMULATED_APSD = 2,
879     PROCESS_TIM_SIMULATED_APSD = 3,
880 } APSD_TIM_POLICY;
881 
882 typedef PREPACK struct {
883     u16 psPollTimeout;          /* msec */
884     u16 triggerTimeout;         /* msec */
885     u32 apsdTimPolicy;      /* TIM behavior with  ques APSD enabled. Default is IGNORE_TIM_ALL_QUEUES_APSD */
886     u32 simulatedAPSDTimPolicy;      /* TIM behavior with  simulated APSD enabled. Default is PROCESS_TIM_SIMULATED_APSD */
887 } POSTPACK WMI_POWERSAVE_TIMERS_POLICY_CMD;
888 
889 /*
890  * WMI_SET_VOICE_PKT_SIZE_CMDID
891  */
892 typedef PREPACK struct {
893     u16 voicePktSize;
894 } POSTPACK WMI_SET_VOICE_PKT_SIZE_CMD;
895 
896 /*
897  * WMI_SET_MAX_SP_LEN_CMDID
898  */
899 typedef enum {
900     DELIVER_ALL_PKT = 0x0,
901     DELIVER_2_PKT = 0x1,
902     DELIVER_4_PKT = 0x2,
903     DELIVER_6_PKT = 0x3,
904 } APSD_SP_LEN_TYPE;
905 
906 typedef PREPACK struct {
907     u8 maxSPLen;
908 } POSTPACK WMI_SET_MAX_SP_LEN_CMD;
909 
910 /*
911  * WMI_SET_DISC_TIMEOUT_CMDID
912  */
913 typedef PREPACK struct {
914     u8 disconnectTimeout;          /* seconds */
915 } POSTPACK WMI_DISC_TIMEOUT_CMD;
916 
917 typedef enum {
918     UPLINK_TRAFFIC = 0,
919     DNLINK_TRAFFIC = 1,
920     BIDIR_TRAFFIC = 2,
921 } DIR_TYPE;
922 
923 typedef enum {
924     DISABLE_FOR_THIS_AC = 0,
925     ENABLE_FOR_THIS_AC  = 1,
926     ENABLE_FOR_ALL_AC   = 2,
927 } VOICEPS_CAP_TYPE;
928 
929 typedef enum {
930     TRAFFIC_TYPE_APERIODIC = 0,
931     TRAFFIC_TYPE_PERIODIC = 1,
932 }TRAFFIC_TYPE;
933 
934 /*
935  * WMI_SYNCHRONIZE_CMDID
936  */
937 typedef PREPACK struct {
938     u8 dataSyncMap;
939 } POSTPACK WMI_SYNC_CMD;
940 
941 /*
942  * WMI_CREATE_PSTREAM_CMDID
943  */
944 typedef PREPACK struct {
945     u32 minServiceInt;           /* in milli-sec */
946     u32 maxServiceInt;           /* in milli-sec */
947     u32 inactivityInt;           /* in milli-sec */
948     u32 suspensionInt;           /* in milli-sec */
949     u32 serviceStartTime;
950     u32 minDataRate;             /* in bps */
951     u32 meanDataRate;            /* in bps */
952     u32 peakDataRate;            /* in bps */
953     u32 maxBurstSize;
954     u32 delayBound;
955     u32 minPhyRate;              /* in bps */
956     u32 sba;
957     u32 mediumTime;
958     u16 nominalMSDU;             /* in octects */
959     u16 maxMSDU;                 /* in octects */
960     u8 trafficClass;
961     u8 trafficDirection;        /* DIR_TYPE */
962     u8 rxQueueNum;
963     u8 trafficType;             /* TRAFFIC_TYPE */
964     u8 voicePSCapability;       /* VOICEPS_CAP_TYPE */
965     u8 tsid;
966     u8 userPriority;            /* 802.1D user priority */
967     u8 nominalPHY;              /* nominal phy rate */
968 } POSTPACK WMI_CREATE_PSTREAM_CMD;
969 
970 /*
971  * WMI_DELETE_PSTREAM_CMDID
972  */
973 typedef PREPACK struct {
974     u8 txQueueNumber;
975     u8 rxQueueNumber;
976     u8 trafficDirection;
977     u8 trafficClass;
978     u8 tsid;
979 } POSTPACK WMI_DELETE_PSTREAM_CMD;
980 
981 /*
982  * WMI_SET_CHANNEL_PARAMS_CMDID
983  */
984 typedef enum {
985     WMI_11A_MODE  = 0x1,
986     WMI_11G_MODE  = 0x2,
987     WMI_11AG_MODE = 0x3,
988     WMI_11B_MODE  = 0x4,
989     WMI_11GONLY_MODE = 0x5,
990 } WMI_PHY_MODE;
991 
992 #define WMI_MAX_CHANNELS        32
993 
994 typedef PREPACK struct {
995     u8 reserved1;
996     u8 scanParam;              /* set if enable scan */
997     u8 phyMode;                /* see WMI_PHY_MODE */
998     u8 numChannels;            /* how many channels follow */
999     u16 channelList[1];         /* channels in Mhz */
1000 } POSTPACK WMI_CHANNEL_PARAMS_CMD;
1001 
1002 
1003 /*
1004  *  WMI_RSSI_THRESHOLD_PARAMS_CMDID
1005  *  Setting the polltime to 0 would disable polling.
1006  *  Threshold values are in the ascending order, and should agree to:
1007  *  (lowThreshold_lowerVal < lowThreshold_upperVal < highThreshold_lowerVal
1008  *      < highThreshold_upperVal)
1009  */
1010 
1011 typedef PREPACK struct WMI_RSSI_THRESHOLD_PARAMS{
1012     u32 pollTime;               /* Polling time as a factor of LI */
1013     s16 thresholdAbove1_Val;          /* lowest of upper */
1014     s16 thresholdAbove2_Val;
1015     s16 thresholdAbove3_Val;
1016     s16 thresholdAbove4_Val;
1017     s16 thresholdAbove5_Val;
1018     s16 thresholdAbove6_Val;          /* highest of upper */
1019     s16 thresholdBelow1_Val;         /* lowest of bellow */
1020     s16 thresholdBelow2_Val;
1021     s16 thresholdBelow3_Val;
1022     s16 thresholdBelow4_Val;
1023     s16 thresholdBelow5_Val;
1024     s16 thresholdBelow6_Val;         /* highest of bellow */
1025     u8 weight;                  /* "alpha" */
1026     u8 reserved[3];
1027 } POSTPACK  WMI_RSSI_THRESHOLD_PARAMS_CMD;
1028 
1029 /*
1030  *  WMI_SNR_THRESHOLD_PARAMS_CMDID
1031  *  Setting the polltime to 0 would disable polling.
1032  */
1033 
1034 typedef PREPACK struct WMI_SNR_THRESHOLD_PARAMS{
1035     u32 pollTime;               /* Polling time as a factor of LI */
1036     u8 weight;                  /* "alpha" */
1037     u8 thresholdAbove1_Val;      /* lowest of uppper*/
1038     u8 thresholdAbove2_Val;
1039     u8 thresholdAbove3_Val;
1040     u8 thresholdAbove4_Val;      /* highest of upper */
1041     u8 thresholdBelow1_Val;     /* lowest of bellow */
1042     u8 thresholdBelow2_Val;
1043     u8 thresholdBelow3_Val;
1044     u8 thresholdBelow4_Val;     /* highest of bellow */
1045     u8 reserved[3];
1046 } POSTPACK WMI_SNR_THRESHOLD_PARAMS_CMD;
1047 
1048 /*
1049  *  WMI_LQ_THRESHOLD_PARAMS_CMDID
1050  */
1051 typedef PREPACK struct WMI_LQ_THRESHOLD_PARAMS {
1052     u8 enable;
1053     u8 thresholdAbove1_Val;
1054     u8 thresholdAbove2_Val;
1055     u8 thresholdAbove3_Val;
1056     u8 thresholdAbove4_Val;
1057     u8 thresholdBelow1_Val;
1058     u8 thresholdBelow2_Val;
1059     u8 thresholdBelow3_Val;
1060     u8 thresholdBelow4_Val;
1061     u8 reserved[3];
1062 } POSTPACK  WMI_LQ_THRESHOLD_PARAMS_CMD;
1063 
1064 typedef enum {
1065     WMI_LPREAMBLE_DISABLED = 0,
1066     WMI_LPREAMBLE_ENABLED
1067 } WMI_LPREAMBLE_STATUS;
1068 
1069 typedef enum {
1070     WMI_IGNORE_BARKER_IN_ERP = 0,
1071     WMI_DONOT_IGNORE_BARKER_IN_ERP
1072 } WMI_PREAMBLE_POLICY;
1073 
1074 typedef PREPACK struct {
1075     u8 status;
1076     u8 preamblePolicy;
1077 }POSTPACK WMI_SET_LPREAMBLE_CMD;
1078 
1079 typedef PREPACK struct {
1080     u16 threshold;
1081 }POSTPACK WMI_SET_RTS_CMD;
1082 
1083 /*
1084  *  WMI_TARGET_ERROR_REPORT_BITMASK_CMDID
1085  *  Sets the error reporting event bitmask in target. Target clears it
1086  *  upon an error. Subsequent errors are counted, but not reported
1087  *  via event, unless the bitmask is set again.
1088  */
1089 typedef PREPACK struct {
1090     u32 bitmask;
1091 } POSTPACK  WMI_TARGET_ERROR_REPORT_BITMASK;
1092 
1093 /*
1094  * WMI_SET_TX_PWR_CMDID
1095  */
1096 typedef PREPACK struct {
1097     u8 dbM;                  /* in dbM units */
1098 } POSTPACK WMI_SET_TX_PWR_CMD, WMI_TX_PWR_REPLY;
1099 
1100 /*
1101  * WMI_SET_ASSOC_INFO_CMDID
1102  *
1103  * A maximum of 2 private IEs can be sent in the [Re]Assoc request.
1104  * A 3rd one, the CCX version IE can also be set from the host.
1105  */
1106 #define WMI_MAX_ASSOC_INFO_TYPE    2
1107 #define WMI_CCX_VER_IE             2 /* ieType to set CCX Version IE */
1108 
1109 #define WMI_MAX_ASSOC_INFO_LEN     240
1110 
1111 typedef PREPACK struct {
1112     u8 ieType;
1113     u8 bufferSize;
1114     u8 assocInfo[1];       /* up to WMI_MAX_ASSOC_INFO_LEN */
1115 } POSTPACK WMI_SET_ASSOC_INFO_CMD;
1116 
1117 
1118 /*
1119  * WMI_GET_TX_PWR_CMDID does not take any parameters
1120  */
1121 
1122 /*
1123  * WMI_ADD_BAD_AP_CMDID
1124  */
1125 #define WMI_MAX_BAD_AP_INDEX      1
1126 
1127 typedef PREPACK struct {
1128     u8 badApIndex;         /* 0 to WMI_MAX_BAD_AP_INDEX */
1129     u8 bssid[ATH_MAC_LEN];
1130 } POSTPACK WMI_ADD_BAD_AP_CMD;
1131 
1132 /*
1133  * WMI_DELETE_BAD_AP_CMDID
1134  */
1135 typedef PREPACK struct {
1136     u8 badApIndex;         /* 0 to WMI_MAX_BAD_AP_INDEX */
1137 } POSTPACK WMI_DELETE_BAD_AP_CMD;
1138 
1139 /*
1140  * WMI_SET_ACCESS_PARAMS_CMDID
1141  */
1142 #define WMI_DEFAULT_TXOP_ACPARAM    0       /* implies one MSDU */
1143 #define WMI_DEFAULT_ECWMIN_ACPARAM  4       /* corresponds to CWmin of 15 */
1144 #define WMI_DEFAULT_ECWMAX_ACPARAM  10      /* corresponds to CWmax of 1023 */
1145 #define WMI_MAX_CW_ACPARAM          15      /* maximum eCWmin or eCWmax */
1146 #define WMI_DEFAULT_AIFSN_ACPARAM   2
1147 #define WMI_MAX_AIFSN_ACPARAM       15
1148 typedef PREPACK struct {
1149     u16 txop;                      /* in units of 32 usec */
1150     u8 eCWmin;
1151     u8 eCWmax;
1152     u8 aifsn;
1153     u8 ac;
1154 } POSTPACK WMI_SET_ACCESS_PARAMS_CMD;
1155 
1156 
1157 /*
1158  * WMI_SET_RETRY_LIMITS_CMDID
1159  *
1160  * This command is used to customize the number of retries the
1161  * wlan device will perform on a given frame.
1162  */
1163 #define WMI_MIN_RETRIES 2
1164 #define WMI_MAX_RETRIES 13
1165 typedef enum {
1166     MGMT_FRAMETYPE    = 0,
1167     CONTROL_FRAMETYPE = 1,
1168     DATA_FRAMETYPE    = 2
1169 } WMI_FRAMETYPE;
1170 
1171 typedef PREPACK struct {
1172     u8 frameType;                      /* WMI_FRAMETYPE */
1173     u8 trafficClass;                   /* applies only to DATA_FRAMETYPE */
1174     u8 maxRetries;
1175     u8 enableNotify;
1176 } POSTPACK WMI_SET_RETRY_LIMITS_CMD;
1177 
1178 /*
1179  * WMI_SET_ROAM_CTRL_CMDID
1180  *
1181  * This command is used to influence the Roaming behaviour
1182  * Set the host biases of the BSSs before setting the roam mode as bias
1183  * based.
1184  */
1185 
1186 /*
1187  * Different types of Roam Control
1188  */
1189 
1190 typedef enum {
1191         WMI_FORCE_ROAM          = 1,      /* Roam to the specified BSSID */
1192         WMI_SET_ROAM_MODE       = 2,      /* default ,progd bias, no roam */
1193         WMI_SET_HOST_BIAS       = 3,     /* Set the Host Bias */
1194         WMI_SET_LOWRSSI_SCAN_PARAMS = 4, /* Set lowrssi Scan parameters */
1195 } WMI_ROAM_CTRL_TYPE;
1196 
1197 #define WMI_MIN_ROAM_CTRL_TYPE WMI_FORCE_ROAM
1198 #define WMI_MAX_ROAM_CTRL_TYPE WMI_SET_LOWRSSI_SCAN_PARAMS
1199 
1200 /*
1201  * ROAM MODES
1202  */
1203 
1204 typedef enum {
1205         WMI_DEFAULT_ROAM_MODE   = 1,  /* RSSI based ROAM */
1206         WMI_HOST_BIAS_ROAM_MODE = 2, /* HOST BIAS based ROAM */
1207         WMI_LOCK_BSS_MODE  = 3  /* Lock to the Current BSS - no Roam */
1208 } WMI_ROAM_MODE;
1209 
1210 /*
1211  * BSS HOST BIAS INFO
1212  */
1213 
1214 typedef PREPACK struct {
1215         u8 bssid[ATH_MAC_LEN];
1216         s8 bias;
1217 } POSTPACK WMI_BSS_BIAS;
1218 
1219 typedef PREPACK struct {
1220         u8 numBss;
1221         WMI_BSS_BIAS bssBias[1];
1222 } POSTPACK WMI_BSS_BIAS_INFO;
1223 
1224 typedef PREPACK struct WMI_LOWRSSI_SCAN_PARAMS {
1225         u16 lowrssi_scan_period;
1226         s16 lowrssi_scan_threshold;
1227         s16 lowrssi_roam_threshold;
1228         u8 roam_rssi_floor;
1229         u8 reserved[1];              /* For alignment */
1230 } POSTPACK WMI_LOWRSSI_SCAN_PARAMS;
1231 
1232 typedef PREPACK struct {
1233     PREPACK union {
1234         u8 bssid[ATH_MAC_LEN]; /* WMI_FORCE_ROAM */
1235         u8 roamMode;           /* WMI_SET_ROAM_MODE  */
1236         WMI_BSS_BIAS_INFO bssBiasInfo; /* WMI_SET_HOST_BIAS */
1237         WMI_LOWRSSI_SCAN_PARAMS lrScanParams;
1238     } POSTPACK info;
1239     u8 roamCtrlType ;
1240 } POSTPACK WMI_SET_ROAM_CTRL_CMD;
1241 
1242 /*
1243  * WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID
1244  */
1245 typedef enum {
1246     BT_WLAN_CONN_PRECDENCE_WLAN=0,  /* Default */
1247     BT_WLAN_CONN_PRECDENCE_PAL,
1248 } BT_WLAN_CONN_PRECEDENCE;
1249 
1250 typedef PREPACK struct {
1251     u8 precedence;
1252 } POSTPACK WMI_SET_BT_WLAN_CONN_PRECEDENCE;
1253 
1254 /*
1255  * WMI_ENABLE_RM_CMDID
1256  */
1257 typedef PREPACK struct {
1258         u32 enable_radio_measurements;
1259 } POSTPACK WMI_ENABLE_RM_CMD;
1260 
1261 /*
1262  * WMI_SET_MAX_OFFHOME_DURATION_CMDID
1263  */
1264 typedef PREPACK struct {
1265         u8 max_offhome_duration;
1266 } POSTPACK WMI_SET_MAX_OFFHOME_DURATION_CMD;
1267 
1268 typedef PREPACK struct {
1269     u32 frequency;
1270     u8 threshold;
1271 } POSTPACK WMI_SET_HB_CHALLENGE_RESP_PARAMS_CMD;
1272 /*---------------------- BTCOEX RELATED -------------------------------------*/
1273 /*----------------------COMMON to AR6002 and AR6003 -------------------------*/
1274 typedef enum {
1275     BT_STREAM_UNDEF = 0,
1276     BT_STREAM_SCO,             /* SCO stream */
1277     BT_STREAM_A2DP,            /* A2DP stream */
1278     BT_STREAM_SCAN,            /* BT Discovery or Page */
1279     BT_STREAM_ESCO,
1280     BT_STREAM_MAX
1281 } BT_STREAM_TYPE;
1282 
1283 typedef enum {
1284     BT_PARAM_SCO_PSPOLL_LATENCY_ONE_FOURTH =1,
1285     BT_PARAM_SCO_PSPOLL_LATENCY_HALF,
1286     BT_PARAM_SCO_PSPOLL_LATENCY_THREE_FOURTH,
1287 } BT_PARAMS_SCO_PSPOLL_LATENCY;
1288 
1289 typedef enum {
1290     BT_PARAMS_SCO_STOMP_SCO_NEVER =1,
1291     BT_PARAMS_SCO_STOMP_SCO_ALWAYS,
1292     BT_PARAMS_SCO_STOMP_SCO_IN_LOWRSSI,
1293 } BT_PARAMS_SCO_STOMP_RULES;
1294 
1295 typedef enum {
1296     BT_STATUS_UNDEF = 0,
1297     BT_STATUS_ON,
1298     BT_STATUS_OFF,
1299     BT_STATUS_MAX
1300 } BT_STREAM_STATUS;
1301 
1302 typedef PREPACK struct {
1303     u8 streamType;
1304     u8 status;
1305 } POSTPACK WMI_SET_BT_STATUS_CMD;
1306 
1307 typedef enum {
1308     BT_ANT_TYPE_UNDEF=0,
1309     BT_ANT_TYPE_DUAL,
1310     BT_ANT_TYPE_SPLITTER,
1311     BT_ANT_TYPE_SWITCH,
1312     BT_ANT_TYPE_HIGH_ISO_DUAL
1313 } BT_ANT_FRONTEND_CONFIG;
1314 
1315 typedef enum {
1316     BT_COLOCATED_DEV_BTS4020=0,
1317     BT_COLCATED_DEV_CSR ,
1318     BT_COLOCATED_DEV_VALKYRIE
1319 } BT_COLOCATED_DEV_TYPE;
1320 
1321 /*********************** Applicable to AR6002 ONLY ******************************/
1322 
1323 typedef enum {
1324     BT_PARAM_SCO = 1,         /* SCO stream parameters */
1325     BT_PARAM_A2DP ,
1326     BT_PARAM_ANTENNA_CONFIG,
1327     BT_PARAM_COLOCATED_BT_DEVICE,
1328     BT_PARAM_ACLCOEX,
1329     BT_PARAM_11A_SEPARATE_ANT,
1330     BT_PARAM_MAX
1331 } BT_PARAM_TYPE;
1332 
1333 
1334 #define BT_SCO_ALLOW_CLOSE_RANGE_OPT    (1 << 0)
1335 #define BT_SCO_FORCE_AWAKE_OPT          (1 << 1)
1336 #define BT_SCO_SET_RSSI_OVERRIDE(flags)        ((flags) |= (1 << 2))
1337 #define BT_SCO_GET_RSSI_OVERRIDE(flags)        (((flags) >> 2) & 0x1)
1338 #define BT_SCO_SET_RTS_OVERRIDE(flags)   ((flags) |= (1 << 3))
1339 #define BT_SCO_GET_RTS_OVERRIDE(flags)   (((flags) >> 3) & 0x1)
1340 #define BT_SCO_GET_MIN_LOW_RATE_CNT(flags)     (((flags) >> 8) & 0xFF)
1341 #define BT_SCO_GET_MAX_LOW_RATE_CNT(flags)     (((flags) >> 16) & 0xFF)
1342 #define BT_SCO_SET_MIN_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 8)
1343 #define BT_SCO_SET_MAX_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 16)
1344 
1345 typedef PREPACK struct {
1346     u32 numScoCyclesForceTrigger;  /* Number SCO cycles after which
1347                                            force a pspoll. default = 10 */
1348     u32 dataResponseTimeout;       /* Timeout Waiting for Downlink pkt
1349                                            in response for ps-poll,
1350                                            default = 10 msecs */
1351     u32 stompScoRules;
1352     u32 scoOptFlags;               /* SCO Options Flags :
1353                                             bits:     meaning:
1354                                              0        Allow Close Range Optimization
1355                                              1        Force awake during close range
1356                                              2        If set use host supplied RSSI for OPT
1357                                              3        If set use host supplied RTS COUNT for OPT
1358                                              4..7     Unused
1359                                              8..15    Low Data Rate Min Cnt
1360                                              16..23   Low Data Rate Max Cnt
1361                                         */
1362 
1363     u8 stompDutyCyleVal;           /* Sco cycles to limit ps-poll queuing
1364                                            if stomped */
1365     u8 stompDutyCyleMaxVal;        /*firm ware increases stomp duty cycle
1366                                           gradually uptill this value on need basis*/
1367     u8 psPollLatencyFraction;      /* Fraction of idle
1368                                            period, within which
1369                                            additional ps-polls
1370                                            can be queued */
1371     u8 noSCOSlots;                 /* Number of SCO Tx/Rx slots.
1372                                            HVx, EV3, 2EV3 = 2 */
1373     u8 noIdleSlots;                /* Number of Bluetooth idle slots between
1374                                            consecutive SCO Tx/Rx slots
1375                                            HVx, EV3 = 4
1376                                            2EV3 = 10 */
1377     u8 scoOptOffRssi;/*RSSI value below which we go to ps poll*/
1378     u8 scoOptOnRssi; /*RSSI value above which we reenter opt mode*/
1379     u8 scoOptRtsCount;
1380 } POSTPACK BT_PARAMS_SCO;
1381 
1382 #define BT_A2DP_ALLOW_CLOSE_RANGE_OPT  (1 << 0)
1383 #define BT_A2DP_FORCE_AWAKE_OPT        (1 << 1)
1384 #define BT_A2DP_SET_RSSI_OVERRIDE(flags)        ((flags) |= (1 << 2))
1385 #define BT_A2DP_GET_RSSI_OVERRIDE(flags)        (((flags) >> 2) & 0x1)
1386 #define BT_A2DP_SET_RTS_OVERRIDE(flags)   ((flags) |= (1 << 3))
1387 #define BT_A2DP_GET_RTS_OVERRIDE(flags)   (((flags) >> 3) & 0x1)
1388 #define BT_A2DP_GET_MIN_LOW_RATE_CNT(flags)     (((flags) >> 8) & 0xFF)
1389 #define BT_A2DP_GET_MAX_LOW_RATE_CNT(flags)     (((flags) >> 16) & 0xFF)
1390 #define BT_A2DP_SET_MIN_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 8)
1391 #define BT_A2DP_SET_MAX_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 16)
1392 
1393 typedef PREPACK struct {
1394     u32 a2dpWlanUsageLimit; /* MAX time firmware uses the medium for
1395                                     wlan, after it identifies the idle time
1396                                     default (30 msecs) */
1397     u32 a2dpBurstCntMin;   /* Minimum number of bluetooth data frames
1398                                    to replenish Wlan Usage  limit (default 3) */
1399     u32 a2dpDataRespTimeout;
1400     u32 a2dpOptFlags;      /* A2DP Option flags:
1401                                        bits:    meaning:
1402                                         0       Allow Close Range Optimization
1403                                         1       Force awake during close range
1404                                         2        If set use host supplied RSSI for OPT
1405                                         3        If set use host supplied RTS COUNT for OPT
1406                                         4..7    Unused
1407                                         8..15   Low Data Rate Min Cnt
1408                                         16..23  Low Data Rate Max Cnt
1409                                  */
1410     u8 isCoLocatedBtRoleMaster;
1411     u8 a2dpOptOffRssi;/*RSSI value below which we go to ps poll*/
1412     u8 a2dpOptOnRssi; /*RSSI value above which we reenter opt mode*/
1413     u8 a2dpOptRtsCount;
1414 }POSTPACK BT_PARAMS_A2DP;
1415 
1416 /* During BT ftp/ BT OPP or any another data based acl profile on bluetooth
1417    (non a2dp).*/
1418 typedef PREPACK struct {
1419     u32 aclWlanMediumUsageTime;  /* Wlan usage time during Acl (non-a2dp)
1420                                        coexistence (default 30 msecs) */
1421     u32 aclBtMediumUsageTime;   /* Bt usage time during acl coexistence
1422                                        (default 30 msecs)*/
1423     u32 aclDataRespTimeout;
1424     u32 aclDetectTimeout;      /* ACL coexistence enabled if we get
1425                                        10 Pkts in X msec(default 100 msecs) */
1426     u32 aclmaxPktCnt;          /* No of ACL pkts to receive before
1427                                          enabling ACL coex */
1428 
1429 }POSTPACK BT_PARAMS_ACLCOEX;
1430 
1431 typedef PREPACK struct {
1432     PREPACK union {
1433         BT_PARAMS_SCO scoParams;
1434         BT_PARAMS_A2DP a2dpParams;
1435         BT_PARAMS_ACLCOEX  aclCoexParams;
1436         u8 antType;         /* 0 -Disabled (default)
1437                                      1 - BT_ANT_TYPE_DUAL
1438                                      2 - BT_ANT_TYPE_SPLITTER
1439                                      3 - BT_ANT_TYPE_SWITCH */
1440         u8 coLocatedBtDev;  /* 0 - BT_COLOCATED_DEV_BTS4020 (default)
1441                                      1 - BT_COLCATED_DEV_CSR
1442                                      2 - BT_COLOCATED_DEV_VALKYRIe
1443                                    */
1444     } POSTPACK info;
1445     u8 paramType ;
1446 } POSTPACK WMI_SET_BT_PARAMS_CMD;
1447 
1448 /************************ END AR6002 BTCOEX *******************************/
1449 /*-----------------------AR6003 BTCOEX -----------------------------------*/
1450 
1451 /*  ---------------WMI_SET_BTCOEX_FE_ANT_CMDID --------------------------*/
1452 /* Indicates front end antenna configuration. This command needs to be issued
1453  * right after initialization and after WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID.
1454  * AR6003 enables coexistence and antenna switching based on the configuration.
1455  */
1456 typedef enum {
1457     WMI_BTCOEX_NOT_ENABLED = 0,
1458     WMI_BTCOEX_FE_ANT_SINGLE =1,
1459     WMI_BTCOEX_FE_ANT_DUAL=2,
1460     WMI_BTCOEX_FE_ANT_DUAL_HIGH_ISO=3,
1461     WMI_BTCOEX_FE_ANT_TYPE_MAX
1462 }WMI_BTCOEX_FE_ANT_TYPE;
1463 
1464 typedef PREPACK struct {
1465 	u8 btcoexFeAntType; /* 1 - WMI_BTCOEX_FE_ANT_SINGLE for single antenna front end
1466                                 2 - WMI_BTCOEX_FE_ANT_DUAL for dual antenna front end
1467                                     (for isolations less 35dB, for higher isolation there
1468                                     is not need to pass this command).
1469                                     (not implemented)
1470                               */
1471 }POSTPACK WMI_SET_BTCOEX_FE_ANT_CMD;
1472 
1473 /* -------------WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID ----------------*/
1474 /* Indicate the bluetooth chip to the firmware. Firmware can have different algorithm based
1475  * bluetooth chip type.Based on bluetooth device, different coexistence protocol would be used.
1476  */
1477 typedef PREPACK struct {
1478 	u8 btcoexCoLocatedBTdev; /*1 - Qcom BT (3 -wire PTA)
1479                                     2 - CSR BT  (3 wire PTA)
1480                                     3 - Atheros 3001 BT (3 wire PTA)
1481                                     4 - STE bluetooth (4-wire ePTA)
1482                                     5 - Atheros 3002 BT (4-wire MCI)
1483                                     defaults= 3 (Atheros 3001 BT )
1484                                     */
1485 }POSTPACK WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD;
1486 
1487 /* -------------WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID ------------*/
1488 /* Configuration parameters during bluetooth inquiry and page. Page configuration
1489  * is applicable only on interfaces which can distinguish page (applicable only for ePTA -
1490  * STE bluetooth).
1491  * Bluetooth inquiry start and end is indicated via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID.
1492  * During this the station will be  power-save mode.
1493  */
1494 typedef PREPACK struct {
1495 	u32 btInquiryDataFetchFrequency;/* The frequency of querying the AP for data
1496                                             (via pspoll) is configured by this parameter.
1497                                             "default = 10 ms" */
1498 
1499 	u32 protectBmissDurPostBtInquiry;/* The firmware will continue to be in inquiry state
1500                                              for configured duration, after inquiry completion
1501                                              . This is to ensure other bluetooth transactions
1502                                              (RDP, SDP profiles, link key exchange ...etc)
1503                                              goes through smoothly without wifi stomping.
1504                                              default = 10 secs*/
1505 
1506 	u32 maxpageStomp;                 /*Applicable only for STE-BT interface. Currently not
1507                                              used */
1508 	u32 btInquiryPageFlag;           /* Not used */
1509 }POSTPACK WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD;
1510 
1511 /*---------------------WMI_SET_BTCOEX_SCO_CONFIG_CMDID ---------------*/
1512 /* Configure  SCO parameters. These parameters would be used whenever firmware is indicated
1513  * of (e)SCO profile on bluetooth ( via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID).
1514  * Configration of BTCOEX_SCO_CONFIG data structure are common configuration and applies
1515  * ps-poll mode and opt mode.
1516  * Ps-poll Mode - Station is in power-save and retrieves downlink data between sco gaps.
1517  * Opt Mode - station is in awake state and access point can send data to station any time.
1518  * BTCOEX_PSPOLLMODE_SCO_CONFIG - Configuration applied only during ps-poll mode.
1519  * BTCOEX_OPTMODE_SCO_CONFIG - Configuration applied only during opt mode.
1520  */
1521 #define WMI_SCO_CONFIG_FLAG_ALLOW_OPTIMIZATION   (1 << 0)
1522 #define WMI_SCO_CONFIG_FLAG_IS_EDR_CAPABLE       (1 << 1)
1523 #define WMI_SCO_CONFIG_FLAG_IS_BT_MASTER         (1 << 2)
1524 #define WMI_SCO_CONFIG_FLAG_FW_DETECT_OF_PER     (1 << 3)
1525 typedef PREPACK struct {
1526 	u32 scoSlots;					/* Number of SCO Tx/Rx slots.
1527 										   HVx, EV3, 2EV3 = 2 */
1528 	u32 scoIdleSlots;				/* Number of Bluetooth idle slots between
1529 										   consecutive SCO Tx/Rx slots
1530 										   HVx, EV3 = 4
1531 										   2EV3 = 10
1532                                          */
1533 	u32 scoFlags;				   /* SCO Options Flags :
1534 										  bits:	   meaning:
1535  										  0   Allow Close Range Optimization
1536  										  1   Is EDR capable or Not
1537  										  2   IS Co-located Bt role Master
1538                                           3   Firmware determines the periodicity of SCO.
1539 							  			 */
1540 
1541     u32 linkId;                      /* applicable to STE-BT - not used */
1542 }POSTPACK BTCOEX_SCO_CONFIG;
1543 
1544 typedef PREPACK struct {
1545 	u32 scoCyclesForceTrigger;	/* Number SCO cycles after which
1546 											force a pspoll. default = 10 */
1547     u32 scoDataResponseTimeout;	 /* Timeout Waiting for Downlink pkt
1548 											in response for ps-poll,
1549 											default = 20 msecs */
1550 
1551 	u32 scoStompDutyCyleVal;		 /* not implemented */
1552 
1553 	u32 scoStompDutyCyleMaxVal;     /*Not implemented */
1554 
1555 	u32 scoPsPollLatencyFraction; 	 /* Fraction of idle
1556 											period, within which
1557 											additional ps-polls can be queued
1558                                             1 - 1/4 of idle duration
1559                                             2 - 1/2 of idle duration
1560                                             3 - 3/4 of idle duration
1561                                             default =2 (1/2)
1562                                            */
1563 }POSTPACK BTCOEX_PSPOLLMODE_SCO_CONFIG;
1564 
1565 typedef PREPACK struct {
1566 	u32 scoStompCntIn100ms;/*max number of SCO stomp in 100ms allowed in
1567                                    opt mode. If exceeds the configured value,
1568                                    switch to ps-poll mode
1569                                   default = 3 */
1570 
1571 	u32 scoContStompMax;   /* max number of continuous stomp allowed in opt mode.
1572                                    if exceeded switch to pspoll mode
1573                                     default = 3 */
1574 
1575 	u32 scoMinlowRateMbps; /* Low rate threshold */
1576 
1577 	u32 scoLowRateCnt;     /* number of low rate pkts (< scoMinlowRateMbps) allowed in 100 ms.
1578                                    If exceeded switch/stay to ps-poll mode, lower stay in opt mode.
1579                                    default = 36
1580                                  */
1581 
1582 	u32 scoHighPktRatio;   /*(Total Rx pkts in 100 ms + 1)/
1583                                   ((Total tx pkts in 100 ms - No of high rate pkts in 100 ms) + 1) in 100 ms,
1584                                   if exceeded switch/stay in opt mode and if lower switch/stay in  pspoll mode.
1585                                   default = 5 (80% of high rates)
1586                                  */
1587 
1588 	u32 scoMaxAggrSize;    /* Max number of Rx subframes allowed in this mode. (Firmware re-negogiates
1589                                    max number of aggregates if it was negogiated to higher value
1590                                    default = 1
1591                                    Recommended value Basic rate headsets = 1, EDR (2-EV3)  =4.
1592                                  */
1593 }POSTPACK BTCOEX_OPTMODE_SCO_CONFIG;
1594 
1595 typedef PREPACK struct {
1596     u32 scanInterval;
1597     u32 maxScanStompCnt;
1598 }POSTPACK BTCOEX_WLANSCAN_SCO_CONFIG;
1599 
1600 typedef PREPACK struct {
1601 	BTCOEX_SCO_CONFIG scoConfig;
1602 	BTCOEX_PSPOLLMODE_SCO_CONFIG scoPspollConfig;
1603 	BTCOEX_OPTMODE_SCO_CONFIG scoOptModeConfig;
1604 	BTCOEX_WLANSCAN_SCO_CONFIG scoWlanScanConfig;
1605 }POSTPACK WMI_SET_BTCOEX_SCO_CONFIG_CMD;
1606 
1607 /* ------------------WMI_SET_BTCOEX_A2DP_CONFIG_CMDID -------------------*/
1608 /* Configure A2DP profile parameters. These parameters would be used whenver firmware is indicated
1609  * of A2DP profile on bluetooth ( via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID).
1610  * Configuration of BTCOEX_A2DP_CONFIG data structure are common configuration and applies to
1611  * ps-poll mode and opt mode.
1612  * Ps-poll Mode - Station is in power-save and retrieves downlink data between a2dp data bursts.
1613  * Opt Mode - station is in power save during a2dp bursts and awake in the gaps.
1614  * BTCOEX_PSPOLLMODE_A2DP_CONFIG - Configuration applied only during ps-poll mode.
1615  * BTCOEX_OPTMODE_A2DP_CONFIG - Configuration applied only during opt mode.
1616  */
1617 
1618 #define WMI_A2DP_CONFIG_FLAG_ALLOW_OPTIMIZATION    (1 << 0)
1619 #define WMI_A2DP_CONFIG_FLAG_IS_EDR_CAPABLE        (1 << 1)
1620 #define WMI_A2DP_CONFIG_FLAG_IS_BT_ROLE_MASTER     (1 << 2)
1621 #define WMI_A2DP_CONFIG_FLAG_IS_A2DP_HIGH_PRI      (1 << 3)
1622 #define WMI_A2DP_CONFIG_FLAG_FIND_BT_ROLE          (1 << 4)
1623 
1624 typedef PREPACK struct {
1625     u32 a2dpFlags;      /* A2DP Option flags:
1626 		                        bits:    meaning:
1627                		            0       Allow Close Range Optimization
1628        	                     	1       IS EDR capable
1629        	                     	2       IS Co-located Bt role Master
1630                                 3       a2dp traffic is high priority
1631                                 4       Fw detect the role of bluetooth.
1632                              */
1633 	u32 linkId;         /* Applicable only to STE-BT - not used */
1634 
1635 }POSTPACK BTCOEX_A2DP_CONFIG;
1636 
1637 typedef PREPACK struct {
1638     u32 a2dpWlanMaxDur; /* MAX time firmware uses the medium for
1639                       			wlan, after it identifies the idle time
1640                                 default (30 msecs) */
1641 
1642     u32 a2dpMinBurstCnt;   /* Minimum number of bluetooth data frames
1643                   				to replenish Wlan Usage  limit (default 3) */
1644 
1645     u32 a2dpDataRespTimeout; /* Max duration firmware waits for downlink
1646                                      by stomping on  bluetooth
1647                                      after ps-poll is acknowledged.
1648                                      default = 20 ms
1649                                    */
1650 }POSTPACK BTCOEX_PSPOLLMODE_A2DP_CONFIG;
1651 
1652 typedef PREPACK struct {
1653 	u32 a2dpMinlowRateMbps;  /* Low rate threshold */
1654 
1655 	u32 a2dpLowRateCnt;    /* number of low rate pkts (< a2dpMinlowRateMbps) allowed in 100 ms.
1656                                    If exceeded switch/stay to ps-poll mode, lower stay in opt mode.
1657                                    default = 36
1658                                  */
1659 
1660 	u32 a2dpHighPktRatio;   /*(Total Rx pkts in 100 ms + 1)/
1661                                   ((Total tx pkts in 100 ms - No of high rate pkts in 100 ms) + 1) in 100 ms,
1662                                   if exceeded switch/stay in opt mode and if lower switch/stay in  pspoll mode.
1663                                   default = 5 (80% of high rates)
1664                                  */
1665 
1666 	u32 a2dpMaxAggrSize;    /* Max number of Rx subframes allowed in this mode. (Firmware re-negogiates
1667                                    max number of aggregates if it was negogiated to higher value
1668                                    default = 1
1669                                   Recommended value Basic rate headsets = 1, EDR (2-EV3)  =8.
1670                                  */
1671 	u32 a2dpPktStompCnt;    /*number of a2dp pkts that can be stomped per burst.
1672                                    default = 6*/
1673 
1674 }POSTPACK BTCOEX_OPTMODE_A2DP_CONFIG;
1675 
1676 typedef PREPACK struct {
1677 	BTCOEX_A2DP_CONFIG a2dpConfig;
1678 	BTCOEX_PSPOLLMODE_A2DP_CONFIG a2dppspollConfig;
1679 	BTCOEX_OPTMODE_A2DP_CONFIG a2dpOptConfig;
1680 }POSTPACK WMI_SET_BTCOEX_A2DP_CONFIG_CMD;
1681 
1682 /*------------ WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID---------------------*/
1683 /* Configure non-A2dp ACL profile parameters.The starts of ACL profile can either be
1684  * indicated via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID orenabled via firmware detection
1685  *  which is configured via "aclCoexFlags".
1686  * Configration of BTCOEX_ACLCOEX_CONFIG data structure are common configuration and applies
1687  * ps-poll mode and opt mode.
1688  * Ps-poll Mode - Station is in power-save and retrieves downlink data during wlan medium.
1689  * Opt Mode - station is in power save during bluetooth medium time and awake during wlan duration.
1690  *             (Not implemented yet)
1691  *
1692  * BTCOEX_PSPOLLMODE_ACLCOEX_CONFIG - Configuration applied only during ps-poll mode.
1693  * BTCOEX_OPTMODE_ACLCOEX_CONFIG - Configuration applied only during opt mode.
1694  */
1695 
1696 #define WMI_ACLCOEX_FLAGS_ALLOW_OPTIMIZATION   (1 << 0)
1697 #define WMI_ACLCOEX_FLAGS_DISABLE_FW_DETECTION (1 << 1)
1698 
1699 typedef PREPACK struct {
1700     u32 aclWlanMediumDur; 	    /* Wlan usage time during Acl (non-a2dp)
1701                      					coexistence (default 30 msecs)
1702                                     */
1703 
1704     u32 aclBtMediumDur; 	   /* Bt usage time during acl coexistence
1705 					                     (default 30 msecs)
1706                                    */
1707 
1708 	u32 aclDetectTimeout;	   /* BT activity observation time limit.
1709 									  In this time duration, number of bt pkts are counted.
1710 									  If the Cnt reaches "aclPktCntLowerLimit" value
1711 									  for "aclIterToEnableCoex" iteration continuously,
1712 									  firmware gets into ACL coexistence mode.
1713 									  Similarly, if bt traffic count during ACL coexistence
1714 									  has not reached "aclPktCntLowerLimit" continuously
1715 									  for "aclIterToEnableCoex", then ACL coexistence is
1716 									  disabled.
1717     								  -default 100 msecs
1718                                     */
1719 
1720 	 u32 aclPktCntLowerLimit;   /* Acl Pkt Cnt to be received in duration of
1721 										"aclDetectTimeout" for
1722 										"aclIterForEnDis" times to enabling ACL coex.
1723                                         Similar logic is used to disable acl coexistence.
1724                                         (If "aclPktCntLowerLimit"  cnt of acl pkts
1725                                          are not seen by the for "aclIterForEnDis"
1726                                          then acl coexistence is disabled).
1727                                         default = 10
1728                                    */
1729 
1730 	 u32 aclIterForEnDis;      /* number of Iteration of "aclPktCntLowerLimit" for Enabling and
1731                                        Disabling Acl Coexistence.
1732                                        default = 3
1733                                      */
1734 
1735 	 u32 aclPktCntUpperLimit; /* This is upperBound limit, if there is more than
1736 									  "aclPktCntUpperLimit" seen in "aclDetectTimeout",
1737 									  ACL coexistence is enabled right away.
1738 									  - default 15*/
1739 
1740 	u32 aclCoexFlags;			/* A2DP Option flags:
1741 		  	                          bits:    meaning:
1742        		                          0       Allow Close Range Optimization
1743                     		          1       disable Firmware detection
1744                                       (Currently supported configuration is aclCoexFlags =0)
1745                       			 	*/
1746 	u32 linkId;                /* Applicable only for STE-BT - not used */
1747 
1748 }POSTPACK BTCOEX_ACLCOEX_CONFIG;
1749 
1750 typedef PREPACK struct {
1751     u32 aclDataRespTimeout;   /* Max duration firmware waits for downlink
1752                                       by stomping on  bluetooth
1753                                       after ps-poll is acknowledged.
1754                                      default = 20 ms */
1755 
1756 }POSTPACK BTCOEX_PSPOLLMODE_ACLCOEX_CONFIG;
1757 
1758 
1759 /* Not implemented yet*/
1760 typedef PREPACK struct {
1761 	u32 aclCoexMinlowRateMbps;
1762 	u32 aclCoexLowRateCnt;
1763 	u32 aclCoexHighPktRatio;
1764 	u32 aclCoexMaxAggrSize;
1765 	u32 aclPktStompCnt;
1766 }POSTPACK BTCOEX_OPTMODE_ACLCOEX_CONFIG;
1767 
1768 typedef PREPACK struct {
1769 	BTCOEX_ACLCOEX_CONFIG aclCoexConfig;
1770 	BTCOEX_PSPOLLMODE_ACLCOEX_CONFIG aclCoexPspollConfig;
1771 	BTCOEX_OPTMODE_ACLCOEX_CONFIG aclCoexOptConfig;
1772 }POSTPACK WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD;
1773 
1774 /* -----------WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID ------------------*/
1775 typedef enum {
1776 	WMI_BTCOEX_BT_PROFILE_SCO =1,
1777 	WMI_BTCOEX_BT_PROFILE_A2DP,
1778 	WMI_BTCOEX_BT_PROFILE_INQUIRY_PAGE,
1779 	WMI_BTCOEX_BT_PROFILE_ACLCOEX,
1780 }WMI_BTCOEX_BT_PROFILE;
1781 
1782 typedef PREPACK struct {
1783 	u32 btProfileType;
1784 	u32 btOperatingStatus;
1785 	u32 btLinkId;
1786 }WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD;
1787 
1788 /*--------------------- WMI_SET_BTCOEX_DEBUG_CMDID ---------------------*/
1789 /* Used for firmware development and debugging */
1790 typedef PREPACK struct {
1791 	u32 btcoexDbgParam1;
1792 	u32 btcoexDbgParam2;
1793 	u32 btcoexDbgParam3;
1794 	u32 btcoexDbgParam4;
1795 	u32 btcoexDbgParam5;
1796 }WMI_SET_BTCOEX_DEBUG_CMD;
1797 
1798 /*---------------------WMI_GET_BTCOEX_CONFIG_CMDID --------------------- */
1799 /* Command to firmware to get configuration parameters of the bt profile
1800  * reported via WMI_BTCOEX_CONFIG_EVENTID */
1801 typedef PREPACK struct {
1802 	u32 btProfileType; /* 1 - SCO
1803                                2 - A2DP
1804                                3 - INQUIRY_PAGE
1805                                4 - ACLCOEX
1806                             */
1807 	u32 linkId;    /* not used */
1808 }WMI_GET_BTCOEX_CONFIG_CMD;
1809 
1810 /*------------------WMI_REPORT_BTCOEX_CONFIG_EVENTID------------------- */
1811 /* Event from firmware to host, sent in response to WMI_GET_BTCOEX_CONFIG_CMDID
1812  * */
1813 typedef PREPACK struct {
1814 	u32 btProfileType;
1815 	u32 linkId; /* not used */
1816 	PREPACK union {
1817 		WMI_SET_BTCOEX_SCO_CONFIG_CMD scoConfigCmd;
1818 		WMI_SET_BTCOEX_A2DP_CONFIG_CMD a2dpConfigCmd;
1819 		WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD aclcoexConfig;
1820         WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD btinquiryPageConfigCmd;
1821     } POSTPACK info;
1822 } POSTPACK WMI_BTCOEX_CONFIG_EVENT;
1823 
1824 /*------------- WMI_REPORT_BTCOEX_BTCOEX_STATS_EVENTID--------------------*/
1825 /* Used for firmware development and debugging*/
1826 typedef PREPACK struct {
1827 	u32 highRatePktCnt;
1828 	u32 firstBmissCnt;
1829 	u32 psPollFailureCnt;
1830 	u32 nullFrameFailureCnt;
1831 	u32 optModeTransitionCnt;
1832 }BTCOEX_GENERAL_STATS;
1833 
1834 typedef PREPACK struct {
1835 	u32 scoStompCntAvg;
1836 	u32 scoStompIn100ms;
1837 	u32 scoMaxContStomp;
1838 	u32 scoAvgNoRetries;
1839 	u32 scoMaxNoRetriesIn100ms;
1840 }BTCOEX_SCO_STATS;
1841 
1842 typedef PREPACK struct {
1843 	u32 a2dpBurstCnt;
1844 	u32 a2dpMaxBurstCnt;
1845 	u32 a2dpAvgIdletimeIn100ms;
1846 	u32 a2dpAvgStompCnt;
1847 }BTCOEX_A2DP_STATS;
1848 
1849 typedef PREPACK struct {
1850 	u32 aclPktCntInBtTime;
1851 	u32 aclStompCntInWlanTime;
1852 	u32 aclPktCntIn100ms;
1853 }BTCOEX_ACLCOEX_STATS;
1854 
1855 typedef PREPACK struct {
1856 	BTCOEX_GENERAL_STATS coexStats;
1857 	BTCOEX_SCO_STATS scoStats;
1858 	BTCOEX_A2DP_STATS a2dpStats;
1859 	BTCOEX_ACLCOEX_STATS aclCoexStats;
1860 }WMI_BTCOEX_STATS_EVENT;
1861 
1862 
1863 /*--------------------------END OF BTCOEX -------------------------------------*/
1864 typedef PREPACK struct {
1865     u32 sleepState;
1866 }WMI_REPORT_SLEEP_STATE_EVENT;
1867 
1868 typedef enum {
1869     WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP =0,
1870     WMI_REPORT_SLEEP_STATUS_IS_AWAKE
1871 } WMI_REPORT_SLEEP_STATUS;
1872 typedef enum {
1873     DISCONN_EVT_IN_RECONN = 0,  /* default */
1874     NO_DISCONN_EVT_IN_RECONN
1875 } TARGET_EVENT_REPORT_CONFIG;
1876 
1877 typedef PREPACK struct {
1878     u32 evtConfig;
1879 } POSTPACK WMI_SET_TARGET_EVENT_REPORT_CMD;
1880 
1881 
1882 typedef PREPACK struct {
1883     u16 cmd_buf_sz;     /* HCI cmd buffer size */
1884     u8 buf[1];         /* Absolute HCI cmd */
1885 } POSTPACK WMI_HCI_CMD;
1886 
1887 /*
1888  * Command Replies
1889  */
1890 
1891 /*
1892  * WMI_GET_CHANNEL_LIST_CMDID reply
1893  */
1894 typedef PREPACK struct {
1895     u8 reserved1;
1896     u8 numChannels;            /* number of channels in reply */
1897     u16 channelList[1];         /* channel in Mhz */
1898 } POSTPACK WMI_CHANNEL_LIST_REPLY;
1899 
1900 typedef enum {
1901     A_SUCCEEDED = 0,
1902     A_FAILED_DELETE_STREAM_DOESNOT_EXIST=250,
1903     A_SUCCEEDED_MODIFY_STREAM=251,
1904     A_FAILED_INVALID_STREAM = 252,
1905     A_FAILED_MAX_THINSTREAMS = 253,
1906     A_FAILED_CREATE_REMOVE_PSTREAM_FIRST = 254,
1907 } PSTREAM_REPLY_STATUS;
1908 
1909 typedef PREPACK struct {
1910     u8 status;                 /* PSTREAM_REPLY_STATUS */
1911     u8 txQueueNumber;
1912     u8 rxQueueNumber;
1913     u8 trafficClass;
1914     u8 trafficDirection;       /* DIR_TYPE */
1915 } POSTPACK WMI_CRE_PRIORITY_STREAM_REPLY;
1916 
1917 typedef PREPACK struct {
1918     u8 status;                 /* PSTREAM_REPLY_STATUS */
1919     u8 txQueueNumber;
1920     u8 rxQueueNumber;
1921     u8 trafficDirection;       /* DIR_TYPE */
1922     u8 trafficClass;
1923 } POSTPACK WMI_DEL_PRIORITY_STREAM_REPLY;
1924 
1925 /*
1926  * List of Events (target to host)
1927  */
1928 typedef enum {
1929     WMI_READY_EVENTID           = 0x1001,
1930     WMI_CONNECT_EVENTID,
1931     WMI_DISCONNECT_EVENTID,
1932     WMI_BSSINFO_EVENTID,
1933     WMI_CMDERROR_EVENTID,
1934     WMI_REGDOMAIN_EVENTID,
1935     WMI_PSTREAM_TIMEOUT_EVENTID,
1936     WMI_NEIGHBOR_REPORT_EVENTID,
1937     WMI_TKIP_MICERR_EVENTID,
1938     WMI_SCAN_COMPLETE_EVENTID,           /* 0x100a */
1939     WMI_REPORT_STATISTICS_EVENTID,
1940     WMI_RSSI_THRESHOLD_EVENTID,
1941     WMI_ERROR_REPORT_EVENTID,
1942     WMI_OPT_RX_FRAME_EVENTID,
1943     WMI_REPORT_ROAM_TBL_EVENTID,
1944     WMI_EXTENSION_EVENTID,
1945     WMI_CAC_EVENTID,
1946     WMI_SNR_THRESHOLD_EVENTID,
1947     WMI_LQ_THRESHOLD_EVENTID,
1948     WMI_TX_RETRY_ERR_EVENTID,            /* 0x1014 */
1949     WMI_REPORT_ROAM_DATA_EVENTID,
1950     WMI_TEST_EVENTID,
1951     WMI_APLIST_EVENTID,
1952     WMI_GET_WOW_LIST_EVENTID,
1953     WMI_GET_PMKID_LIST_EVENTID,
1954     WMI_CHANNEL_CHANGE_EVENTID,
1955     WMI_PEER_NODE_EVENTID,
1956     WMI_PSPOLL_EVENTID,
1957     WMI_DTIMEXPIRY_EVENTID,
1958     WMI_WLAN_VERSION_EVENTID,
1959     WMI_SET_PARAMS_REPLY_EVENTID,
1960     WMI_ADDBA_REQ_EVENTID,              /*0x1020 */
1961     WMI_ADDBA_RESP_EVENTID,
1962     WMI_DELBA_REQ_EVENTID,
1963     WMI_TX_COMPLETE_EVENTID,
1964     WMI_HCI_EVENT_EVENTID,
1965     WMI_ACL_DATA_EVENTID,
1966     WMI_REPORT_SLEEP_STATE_EVENTID,
1967 #ifdef WAPI_ENABLE
1968     WMI_WAPI_REKEY_EVENTID,
1969 #endif
1970     WMI_REPORT_BTCOEX_STATS_EVENTID,
1971     WMI_REPORT_BTCOEX_CONFIG_EVENTID,
1972     WMI_ACM_REJECT_EVENTID,
1973     WMI_THIN_RESERVED_START_EVENTID = 0x8000,
1974     /* Events in this range are reserved for thinmode
1975      * See wmi_thin.h for actual definitions */
1976     WMI_THIN_RESERVED_END_EVENTID = 0x8fff,
1977 
1978 } WMI_EVENT_ID;
1979 
1980 
1981 typedef enum {
1982     WMI_11A_CAPABILITY   = 1,
1983     WMI_11G_CAPABILITY   = 2,
1984     WMI_11AG_CAPABILITY  = 3,
1985     WMI_11NA_CAPABILITY  = 4,
1986     WMI_11NG_CAPABILITY  = 5,
1987     WMI_11NAG_CAPABILITY = 6,
1988     // END CAPABILITY
1989     WMI_11N_CAPABILITY_OFFSET = (WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY),
1990 } WMI_PHY_CAPABILITY;
1991 
1992 typedef PREPACK struct {
1993     u8 macaddr[ATH_MAC_LEN];
1994     u8 phyCapability;              /* WMI_PHY_CAPABILITY */
1995 } POSTPACK WMI_READY_EVENT_1;
1996 
1997 typedef PREPACK struct {
1998     u32 sw_version;
1999     u32 abi_version;
2000     u8 macaddr[ATH_MAC_LEN];
2001     u8 phyCapability;              /* WMI_PHY_CAPABILITY */
2002 } POSTPACK WMI_READY_EVENT_2;
2003 
2004 #if defined(ATH_TARGET)
2005 #ifdef AR6002_REV2
2006 #define WMI_READY_EVENT WMI_READY_EVENT_1  /* AR6002_REV2 target code */
2007 #else
2008 #define WMI_READY_EVENT WMI_READY_EVENT_2  /* AR6001, AR6002_REV4, AR6002_REV5 */
2009 #endif
2010 #else
2011 #define WMI_READY_EVENT WMI_READY_EVENT_2 /* host code */
2012 #endif
2013 
2014 
2015 /*
2016  * Connect Event
2017  */
2018 typedef PREPACK struct {
2019     u16 channel;
2020     u8 bssid[ATH_MAC_LEN];
2021     u16 listenInterval;
2022     u16 beaconInterval;
2023     u32 networkType;
2024     u8 beaconIeLen;
2025     u8 assocReqLen;
2026     u8 assocRespLen;
2027     u8 assocInfo[1];
2028 } POSTPACK WMI_CONNECT_EVENT;
2029 
2030 /*
2031  * Disconnect Event
2032  */
2033 typedef enum {
2034     NO_NETWORK_AVAIL   = 0x01,
2035     LOST_LINK          = 0x02,     /* bmiss */
2036     DISCONNECT_CMD     = 0x03,
2037     BSS_DISCONNECTED   = 0x04,
2038     AUTH_FAILED        = 0x05,
2039     ASSOC_FAILED       = 0x06,
2040     NO_RESOURCES_AVAIL = 0x07,
2041     CSERV_DISCONNECT   = 0x08,
2042     INVALID_PROFILE    = 0x0a,
2043     DOT11H_CHANNEL_SWITCH = 0x0b,
2044     PROFILE_MISMATCH   = 0x0c,
2045     CONNECTION_EVICTED = 0x0d,
2046     IBSS_MERGE         = 0xe,
2047 } WMI_DISCONNECT_REASON;
2048 
2049 typedef PREPACK struct {
2050     u16 protocolReasonStatus;  /* reason code, see 802.11 spec. */
2051     u8 bssid[ATH_MAC_LEN];    /* set if known */
2052     u8 disconnectReason ;      /* see WMI_DISCONNECT_REASON */
2053     u8 assocRespLen;
2054     u8 assocInfo[1];
2055 } POSTPACK WMI_DISCONNECT_EVENT;
2056 
2057 /*
2058  * BSS Info Event.
2059  * Mechanism used to inform host of the presence and characteristic of
2060  * wireless networks present.  Consists of bss info header followed by
2061  * the beacon or probe-response frame body.  The 802.11 header is not included.
2062  */
2063 typedef enum {
2064     BEACON_FTYPE = 0x1,
2065     PROBERESP_FTYPE,
2066     ACTION_MGMT_FTYPE,
2067     PROBEREQ_FTYPE,
2068 } WMI_BI_FTYPE;
2069 
2070 enum {
2071     BSS_ELEMID_CHANSWITCH = 0x01,
2072     BSS_ELEMID_ATHEROS = 0x02,
2073 };
2074 
2075 typedef PREPACK struct {
2076     u16 channel;
2077     u8 frameType;          /* see WMI_BI_FTYPE */
2078     u8 snr;
2079     s16 rssi;
2080     u8 bssid[ATH_MAC_LEN];
2081     u32 ieMask;
2082 } POSTPACK WMI_BSS_INFO_HDR;
2083 
2084 /*
2085  * BSS INFO HDR version 2.0
2086  * With 6 bytes HTC header and 6 bytes of WMI header
2087  * WMI_BSS_INFO_HDR cannot be accommodated in the removed 802.11 management
2088  * header space.
2089  * - Reduce the ieMask to 2 bytes as only two bit flags are used
2090  * - Remove rssi and compute it on the host. rssi = snr - 95
2091  */
2092 typedef PREPACK struct {
2093     u16 channel;
2094     u8 frameType;          /* see WMI_BI_FTYPE */
2095     u8 snr;
2096     u8 bssid[ATH_MAC_LEN];
2097     u16 ieMask;
2098 } POSTPACK WMI_BSS_INFO_HDR2;
2099 
2100 /*
2101  * Command Error Event
2102  */
2103 typedef enum {
2104     INVALID_PARAM  = 0x01,
2105     ILLEGAL_STATE  = 0x02,
2106     INTERNAL_ERROR = 0x03,
2107 } WMI_ERROR_CODE;
2108 
2109 typedef PREPACK struct {
2110     u16 commandId;
2111     u8 errorCode;
2112 } POSTPACK WMI_CMD_ERROR_EVENT;
2113 
2114 /*
2115  * New Regulatory Domain Event
2116  */
2117 typedef PREPACK struct {
2118     u32 regDomain;
2119 } POSTPACK WMI_REG_DOMAIN_EVENT;
2120 
2121 typedef PREPACK struct {
2122     u8 txQueueNumber;
2123     u8 rxQueueNumber;
2124     u8 trafficDirection;
2125     u8 trafficClass;
2126 } POSTPACK WMI_PSTREAM_TIMEOUT_EVENT;
2127 
2128 typedef PREPACK struct {
2129     u8 reserve1;
2130     u8 reserve2;
2131     u8 reserve3;
2132     u8 trafficClass;
2133 } POSTPACK WMI_ACM_REJECT_EVENT;
2134 
2135 /*
2136  * The WMI_NEIGHBOR_REPORT Event is generated by the target to inform
2137  * the host of BSS's it has found that matches the current profile.
2138  * It can be used by the host to cache PMKs and/to initiate pre-authentication
2139  * if the BSS supports it.  The first bssid is always the current associated
2140  * BSS.
2141  * The bssid and bssFlags information repeats according to the number
2142  * or APs reported.
2143  */
2144 typedef enum {
2145     WMI_DEFAULT_BSS_FLAGS   = 0x00,
2146     WMI_PREAUTH_CAPABLE_BSS = 0x01,
2147     WMI_PMKID_VALID_BSS     = 0x02,
2148 } WMI_BSS_FLAGS;
2149 
2150 typedef PREPACK struct {
2151     u8 bssid[ATH_MAC_LEN];
2152     u8 bssFlags;            /* see WMI_BSS_FLAGS */
2153 } POSTPACK WMI_NEIGHBOR_INFO;
2154 
2155 typedef PREPACK struct {
2156     s8 numberOfAps;
2157     WMI_NEIGHBOR_INFO neighbor[1];
2158 } POSTPACK WMI_NEIGHBOR_REPORT_EVENT;
2159 
2160 /*
2161  * TKIP MIC Error Event
2162  */
2163 typedef PREPACK struct {
2164     u8 keyid;
2165     u8 ismcast;
2166 } POSTPACK WMI_TKIP_MICERR_EVENT;
2167 
2168 /*
2169  * WMI_SCAN_COMPLETE_EVENTID - no parameters (old), staus parameter (new)
2170  */
2171 typedef PREPACK struct {
2172     s32 status;
2173 } POSTPACK WMI_SCAN_COMPLETE_EVENT;
2174 
2175 #define MAX_OPT_DATA_LEN 1400
2176 
2177 /*
2178  * WMI_SET_ADHOC_BSSID_CMDID
2179  */
2180 typedef PREPACK struct {
2181     u8 bssid[ATH_MAC_LEN];
2182 } POSTPACK WMI_SET_ADHOC_BSSID_CMD;
2183 
2184 /*
2185  * WMI_SET_OPT_MODE_CMDID
2186  */
2187 typedef enum {
2188     SPECIAL_OFF,
2189     SPECIAL_ON,
2190 } OPT_MODE_TYPE;
2191 
2192 typedef PREPACK struct {
2193     u8 optMode;
2194 } POSTPACK WMI_SET_OPT_MODE_CMD;
2195 
2196 /*
2197  * WMI_TX_OPT_FRAME_CMDID
2198  */
2199 typedef enum {
2200     OPT_PROBE_REQ   = 0x01,
2201     OPT_PROBE_RESP  = 0x02,
2202     OPT_CPPP_START  = 0x03,
2203     OPT_CPPP_STOP   = 0x04,
2204 } WMI_OPT_FTYPE;
2205 
2206 typedef PREPACK struct {
2207     u16 optIEDataLen;
2208     u8 frmType;
2209     u8 dstAddr[ATH_MAC_LEN];
2210     u8 bssid[ATH_MAC_LEN];
2211     u8 reserved;               /* For alignment */
2212     u8 optIEData[1];
2213 } POSTPACK WMI_OPT_TX_FRAME_CMD;
2214 
2215 /*
2216  * Special frame receive Event.
2217  * Mechanism used to inform host of the receiption of the special frames.
2218  * Consists of special frame info header followed by special frame body.
2219  * The 802.11 header is not included.
2220  */
2221 typedef PREPACK struct {
2222     u16 channel;
2223     u8 frameType;          /* see WMI_OPT_FTYPE */
2224     s8 snr;
2225     u8 srcAddr[ATH_MAC_LEN];
2226     u8 bssid[ATH_MAC_LEN];
2227 } POSTPACK WMI_OPT_RX_INFO_HDR;
2228 
2229 /*
2230  * Reporting statistics.
2231  */
2232 typedef PREPACK struct {
2233     u32 tx_packets;
2234     u32 tx_bytes;
2235     u32 tx_unicast_pkts;
2236     u32 tx_unicast_bytes;
2237     u32 tx_multicast_pkts;
2238     u32 tx_multicast_bytes;
2239     u32 tx_broadcast_pkts;
2240     u32 tx_broadcast_bytes;
2241     u32 tx_rts_success_cnt;
2242     u32 tx_packet_per_ac[4];
2243     u32 tx_errors_per_ac[4];
2244 
2245     u32 tx_errors;
2246     u32 tx_failed_cnt;
2247     u32 tx_retry_cnt;
2248     u32 tx_mult_retry_cnt;
2249     u32 tx_rts_fail_cnt;
2250     s32 tx_unicast_rate;
2251 }POSTPACK tx_stats_t;
2252 
2253 typedef PREPACK struct {
2254     u32 rx_packets;
2255     u32 rx_bytes;
2256     u32 rx_unicast_pkts;
2257     u32 rx_unicast_bytes;
2258     u32 rx_multicast_pkts;
2259     u32 rx_multicast_bytes;
2260     u32 rx_broadcast_pkts;
2261     u32 rx_broadcast_bytes;
2262     u32 rx_fragment_pkt;
2263 
2264     u32 rx_errors;
2265     u32 rx_crcerr;
2266     u32 rx_key_cache_miss;
2267     u32 rx_decrypt_err;
2268     u32 rx_duplicate_frames;
2269     s32 rx_unicast_rate;
2270 }POSTPACK rx_stats_t;
2271 
2272 typedef PREPACK struct {
2273     u32 tkip_local_mic_failure;
2274     u32 tkip_counter_measures_invoked;
2275     u32 tkip_replays;
2276     u32 tkip_format_errors;
2277     u32 ccmp_format_errors;
2278     u32 ccmp_replays;
2279 }POSTPACK tkip_ccmp_stats_t;
2280 
2281 typedef PREPACK struct {
2282     u32 power_save_failure_cnt;
2283     u16 stop_tx_failure_cnt;
2284     u16 atim_tx_failure_cnt;
2285     u16 atim_rx_failure_cnt;
2286     u16 bcn_rx_failure_cnt;
2287 }POSTPACK pm_stats_t;
2288 
2289 typedef PREPACK struct {
2290     u32 cs_bmiss_cnt;
2291     u32 cs_lowRssi_cnt;
2292     u16 cs_connect_cnt;
2293     u16 cs_disconnect_cnt;
2294     s16 cs_aveBeacon_rssi;
2295     u16 cs_roam_count;
2296     s16 cs_rssi;
2297     u8 cs_snr;
2298     u8 cs_aveBeacon_snr;
2299     u8 cs_lastRoam_msec;
2300 } POSTPACK cserv_stats_t;
2301 
2302 typedef PREPACK struct {
2303     tx_stats_t          tx_stats;
2304     rx_stats_t          rx_stats;
2305     tkip_ccmp_stats_t   tkipCcmpStats;
2306 }POSTPACK wlan_net_stats_t;
2307 
2308 typedef PREPACK struct {
2309     u32 arp_received;
2310     u32 arp_matched;
2311     u32 arp_replied;
2312 } POSTPACK arp_stats_t;
2313 
2314 typedef PREPACK struct {
2315     u32 wow_num_pkts_dropped;
2316     u16 wow_num_events_discarded;
2317     u8 wow_num_host_pkt_wakeups;
2318     u8 wow_num_host_event_wakeups;
2319 } POSTPACK wlan_wow_stats_t;
2320 
2321 typedef PREPACK struct {
2322     u32 lqVal;
2323     s32 noise_floor_calibation;
2324     pm_stats_t          pmStats;
2325     wlan_net_stats_t    txrxStats;
2326     wlan_wow_stats_t    wowStats;
2327     arp_stats_t         arpStats;
2328     cserv_stats_t       cservStats;
2329 } POSTPACK WMI_TARGET_STATS;
2330 
2331 /*
2332  * WMI_RSSI_THRESHOLD_EVENTID.
2333  * Indicate the RSSI events to host. Events are indicated when we breach a
2334  * thresold value.
2335  */
2336 typedef enum{
2337     WMI_RSSI_THRESHOLD1_ABOVE = 0,
2338     WMI_RSSI_THRESHOLD2_ABOVE,
2339     WMI_RSSI_THRESHOLD3_ABOVE,
2340     WMI_RSSI_THRESHOLD4_ABOVE,
2341     WMI_RSSI_THRESHOLD5_ABOVE,
2342     WMI_RSSI_THRESHOLD6_ABOVE,
2343     WMI_RSSI_THRESHOLD1_BELOW,
2344     WMI_RSSI_THRESHOLD2_BELOW,
2345     WMI_RSSI_THRESHOLD3_BELOW,
2346     WMI_RSSI_THRESHOLD4_BELOW,
2347     WMI_RSSI_THRESHOLD5_BELOW,
2348     WMI_RSSI_THRESHOLD6_BELOW
2349 }WMI_RSSI_THRESHOLD_VAL;
2350 
2351 typedef PREPACK struct {
2352     s16 rssi;
2353     u8 range;
2354 }POSTPACK WMI_RSSI_THRESHOLD_EVENT;
2355 
2356 /*
2357  *  WMI_ERROR_REPORT_EVENTID
2358  */
2359 typedef enum{
2360     WMI_TARGET_PM_ERR_FAIL      = 0x00000001,
2361     WMI_TARGET_KEY_NOT_FOUND    = 0x00000002,
2362     WMI_TARGET_DECRYPTION_ERR   = 0x00000004,
2363     WMI_TARGET_BMISS            = 0x00000008,
2364     WMI_PSDISABLE_NODE_JOIN     = 0x00000010,
2365     WMI_TARGET_COM_ERR          = 0x00000020,
2366     WMI_TARGET_FATAL_ERR        = 0x00000040
2367 } WMI_TARGET_ERROR_VAL;
2368 
2369 typedef PREPACK struct {
2370     u32 errorVal;
2371 }POSTPACK  WMI_TARGET_ERROR_REPORT_EVENT;
2372 
2373 typedef PREPACK struct {
2374     u8 retrys;
2375 }POSTPACK  WMI_TX_RETRY_ERR_EVENT;
2376 
2377 typedef enum{
2378     WMI_SNR_THRESHOLD1_ABOVE = 1,
2379     WMI_SNR_THRESHOLD1_BELOW,
2380     WMI_SNR_THRESHOLD2_ABOVE,
2381     WMI_SNR_THRESHOLD2_BELOW,
2382     WMI_SNR_THRESHOLD3_ABOVE,
2383     WMI_SNR_THRESHOLD3_BELOW,
2384     WMI_SNR_THRESHOLD4_ABOVE,
2385     WMI_SNR_THRESHOLD4_BELOW
2386 } WMI_SNR_THRESHOLD_VAL;
2387 
2388 typedef PREPACK struct {
2389     u8 range;  /* WMI_SNR_THRESHOLD_VAL */
2390     u8 snr;
2391 }POSTPACK  WMI_SNR_THRESHOLD_EVENT;
2392 
2393 typedef enum{
2394     WMI_LQ_THRESHOLD1_ABOVE = 1,
2395     WMI_LQ_THRESHOLD1_BELOW,
2396     WMI_LQ_THRESHOLD2_ABOVE,
2397     WMI_LQ_THRESHOLD2_BELOW,
2398     WMI_LQ_THRESHOLD3_ABOVE,
2399     WMI_LQ_THRESHOLD3_BELOW,
2400     WMI_LQ_THRESHOLD4_ABOVE,
2401     WMI_LQ_THRESHOLD4_BELOW
2402 } WMI_LQ_THRESHOLD_VAL;
2403 
2404 typedef PREPACK struct {
2405     s32 lq;
2406     u8 range;  /* WMI_LQ_THRESHOLD_VAL */
2407 }POSTPACK  WMI_LQ_THRESHOLD_EVENT;
2408 /*
2409  * WMI_REPORT_ROAM_TBL_EVENTID
2410  */
2411 #define MAX_ROAM_TBL_CAND   5
2412 
2413 typedef PREPACK struct {
2414     s32 roam_util;
2415     u8 bssid[ATH_MAC_LEN];
2416     s8 rssi;
2417     s8 rssidt;
2418     s8 last_rssi;
2419     s8 util;
2420     s8 bias;
2421     u8 reserved; /* For alignment */
2422 } POSTPACK WMI_BSS_ROAM_INFO;
2423 
2424 
2425 typedef PREPACK struct {
2426     u16 roamMode;
2427     u16 numEntries;
2428     WMI_BSS_ROAM_INFO bssRoamInfo[1];
2429 } POSTPACK WMI_TARGET_ROAM_TBL;
2430 
2431 /*
2432  * WMI_HCI_EVENT_EVENTID
2433  */
2434 typedef PREPACK struct {
2435     u16 evt_buf_sz;     /* HCI event buffer size */
2436     u8 buf[1];         /* HCI  event */
2437 } POSTPACK WMI_HCI_EVENT;
2438 
2439 /*
2440  *  WMI_CAC_EVENTID
2441  */
2442 typedef enum {
2443     CAC_INDICATION_ADMISSION = 0x00,
2444     CAC_INDICATION_ADMISSION_RESP = 0x01,
2445     CAC_INDICATION_DELETE = 0x02,
2446     CAC_INDICATION_NO_RESP = 0x03,
2447 }CAC_INDICATION;
2448 
2449 #define WMM_TSPEC_IE_LEN   63
2450 
2451 typedef PREPACK struct {
2452     u8 ac;
2453     u8 cac_indication;
2454     u8 statusCode;
2455     u8 tspecSuggestion[WMM_TSPEC_IE_LEN];
2456 }POSTPACK  WMI_CAC_EVENT;
2457 
2458 /*
2459  * WMI_APLIST_EVENTID
2460  */
2461 
2462 typedef enum {
2463     APLIST_VER1 = 1,
2464 } APLIST_VER;
2465 
2466 typedef PREPACK struct {
2467     u8 bssid[ATH_MAC_LEN];
2468     u16 channel;
2469 } POSTPACK  WMI_AP_INFO_V1;
2470 
2471 typedef PREPACK union {
2472     WMI_AP_INFO_V1  apInfoV1;
2473 } POSTPACK WMI_AP_INFO;
2474 
2475 typedef PREPACK struct {
2476     u8 apListVer;
2477     u8 numAP;
2478     WMI_AP_INFO apList[1];
2479 } POSTPACK WMI_APLIST_EVENT;
2480 
2481 /*
2482  * developer commands
2483  */
2484 
2485 /*
2486  * WMI_SET_BITRATE_CMDID
2487  *
2488  * Get bit rate cmd uses same definition as set bit rate cmd
2489  */
2490 typedef enum {
2491     RATE_AUTO   = -1,
2492     RATE_1Mb    = 0,
2493     RATE_2Mb    = 1,
2494     RATE_5_5Mb  = 2,
2495     RATE_11Mb   = 3,
2496     RATE_6Mb    = 4,
2497     RATE_9Mb    = 5,
2498     RATE_12Mb   = 6,
2499     RATE_18Mb   = 7,
2500     RATE_24Mb   = 8,
2501     RATE_36Mb   = 9,
2502     RATE_48Mb   = 10,
2503     RATE_54Mb   = 11,
2504     RATE_MCS_0_20 = 12,
2505     RATE_MCS_1_20 = 13,
2506     RATE_MCS_2_20 = 14,
2507     RATE_MCS_3_20 = 15,
2508     RATE_MCS_4_20 = 16,
2509     RATE_MCS_5_20 = 17,
2510     RATE_MCS_6_20 = 18,
2511     RATE_MCS_7_20 = 19,
2512     RATE_MCS_0_40 = 20,
2513     RATE_MCS_1_40 = 21,
2514     RATE_MCS_2_40 = 22,
2515     RATE_MCS_3_40 = 23,
2516     RATE_MCS_4_40 = 24,
2517     RATE_MCS_5_40 = 25,
2518     RATE_MCS_6_40 = 26,
2519     RATE_MCS_7_40 = 27,
2520 } WMI_BIT_RATE;
2521 
2522 typedef PREPACK struct {
2523     s8 rateIndex;          /* see WMI_BIT_RATE */
2524     s8 mgmtRateIndex;
2525     s8 ctlRateIndex;
2526 } POSTPACK WMI_BIT_RATE_CMD;
2527 
2528 
2529 typedef PREPACK struct {
2530     s8 rateIndex;          /* see WMI_BIT_RATE */
2531 } POSTPACK  WMI_BIT_RATE_REPLY;
2532 
2533 
2534 /*
2535  * WMI_SET_FIXRATES_CMDID
2536  *
2537  * Get fix rates cmd uses same definition as set fix rates cmd
2538  */
2539 #define FIX_RATE_1Mb            ((u32)0x1)
2540 #define FIX_RATE_2Mb            ((u32)0x2)
2541 #define FIX_RATE_5_5Mb          ((u32)0x4)
2542 #define FIX_RATE_11Mb           ((u32)0x8)
2543 #define FIX_RATE_6Mb            ((u32)0x10)
2544 #define FIX_RATE_9Mb            ((u32)0x20)
2545 #define FIX_RATE_12Mb           ((u32)0x40)
2546 #define FIX_RATE_18Mb           ((u32)0x80)
2547 #define FIX_RATE_24Mb           ((u32)0x100)
2548 #define FIX_RATE_36Mb           ((u32)0x200)
2549 #define FIX_RATE_48Mb           ((u32)0x400)
2550 #define FIX_RATE_54Mb           ((u32)0x800)
2551 #define FIX_RATE_MCS_0_20       ((u32)0x1000)
2552 #define FIX_RATE_MCS_1_20       ((u32)0x2000)
2553 #define FIX_RATE_MCS_2_20       ((u32)0x4000)
2554 #define FIX_RATE_MCS_3_20       ((u32)0x8000)
2555 #define FIX_RATE_MCS_4_20       ((u32)0x10000)
2556 #define FIX_RATE_MCS_5_20       ((u32)0x20000)
2557 #define FIX_RATE_MCS_6_20       ((u32)0x40000)
2558 #define FIX_RATE_MCS_7_20       ((u32)0x80000)
2559 #define FIX_RATE_MCS_0_40       ((u32)0x100000)
2560 #define FIX_RATE_MCS_1_40       ((u32)0x200000)
2561 #define FIX_RATE_MCS_2_40       ((u32)0x400000)
2562 #define FIX_RATE_MCS_3_40       ((u32)0x800000)
2563 #define FIX_RATE_MCS_4_40       ((u32)0x1000000)
2564 #define FIX_RATE_MCS_5_40       ((u32)0x2000000)
2565 #define FIX_RATE_MCS_6_40       ((u32)0x4000000)
2566 #define FIX_RATE_MCS_7_40       ((u32)0x8000000)
2567 
2568 typedef PREPACK struct {
2569     u32 fixRateMask;          /* see WMI_BIT_RATE */
2570 } POSTPACK WMI_FIX_RATES_CMD, WMI_FIX_RATES_REPLY;
2571 
2572 typedef PREPACK struct {
2573     u8 bEnableMask;
2574     u8 frameType;               /*type and subtype*/
2575     u32 frameRateMask;          /* see WMI_BIT_RATE */
2576 } POSTPACK WMI_FRAME_RATES_CMD, WMI_FRAME_RATES_REPLY;
2577 
2578 /*
2579  * WMI_SET_RECONNECT_AUTH_MODE_CMDID
2580  *
2581  * Set authentication mode
2582  */
2583 typedef enum {
2584     RECONN_DO_AUTH = 0x00,
2585     RECONN_NOT_AUTH = 0x01
2586 } WMI_AUTH_MODE;
2587 
2588 typedef PREPACK struct {
2589     u8 mode;
2590 } POSTPACK WMI_SET_AUTH_MODE_CMD;
2591 
2592 /*
2593  * WMI_SET_REASSOC_MODE_CMDID
2594  *
2595  * Set authentication mode
2596  */
2597 typedef enum {
2598     REASSOC_DO_DISASSOC = 0x00,
2599     REASSOC_DONOT_DISASSOC = 0x01
2600 } WMI_REASSOC_MODE;
2601 
2602 typedef PREPACK struct {
2603     u8 mode;
2604 }POSTPACK WMI_SET_REASSOC_MODE_CMD;
2605 
2606 typedef enum {
2607     ROAM_DATA_TIME = 1,            /* Get The Roam Time Data */
2608 } ROAM_DATA_TYPE;
2609 
2610 typedef PREPACK struct {
2611     u32 disassoc_time;
2612     u32 no_txrx_time;
2613     u32 assoc_time;
2614     u32 allow_txrx_time;
2615     u8 disassoc_bssid[ATH_MAC_LEN];
2616     s8 disassoc_bss_rssi;
2617     u8 assoc_bssid[ATH_MAC_LEN];
2618     s8 assoc_bss_rssi;
2619 } POSTPACK WMI_TARGET_ROAM_TIME;
2620 
2621 typedef PREPACK struct {
2622     PREPACK union {
2623         WMI_TARGET_ROAM_TIME roamTime;
2624     } POSTPACK u;
2625     u8 roamDataType ;
2626 } POSTPACK WMI_TARGET_ROAM_DATA;
2627 
2628 typedef enum {
2629     WMI_WMM_DISABLED = 0,
2630     WMI_WMM_ENABLED
2631 } WMI_WMM_STATUS;
2632 
2633 typedef PREPACK struct {
2634     u8 status;
2635 }POSTPACK WMI_SET_WMM_CMD;
2636 
2637 typedef PREPACK struct {
2638     u8 status;
2639 }POSTPACK WMI_SET_QOS_SUPP_CMD;
2640 
2641 typedef enum {
2642     WMI_TXOP_DISABLED = 0,
2643     WMI_TXOP_ENABLED
2644 } WMI_TXOP_CFG;
2645 
2646 typedef PREPACK struct {
2647     u8 txopEnable;
2648 }POSTPACK WMI_SET_WMM_TXOP_CMD;
2649 
2650 typedef PREPACK struct {
2651     u8 keepaliveInterval;
2652 } POSTPACK WMI_SET_KEEPALIVE_CMD;
2653 
2654 typedef PREPACK struct {
2655     u32 configured;
2656     u8 keepaliveInterval;
2657 } POSTPACK WMI_GET_KEEPALIVE_CMD;
2658 
2659 /*
2660  * Add Application specified IE to a management frame
2661  */
2662 #define WMI_MAX_IE_LEN  255
2663 
2664 typedef PREPACK struct {
2665     u8 mgmtFrmType;  /* one of WMI_MGMT_FRAME_TYPE */
2666     u8 ieLen;    /* Length  of the IE that should be added to the MGMT frame */
2667     u8 ieInfo[1];
2668 } POSTPACK WMI_SET_APPIE_CMD;
2669 
2670 /*
2671  * Notify the WSC registration status to the target
2672  */
2673 #define WSC_REG_ACTIVE     1
2674 #define WSC_REG_INACTIVE   0
2675 /* Generic Hal Interface for setting hal paramters. */
2676 /* Add new Set HAL Param cmdIds here for newer params */
2677 typedef enum {
2678    WHAL_SETCABTO_CMDID = 1,
2679 }WHAL_CMDID;
2680 
2681 typedef PREPACK struct {
2682     u8 cabTimeOut;
2683 } POSTPACK WHAL_SETCABTO_PARAM;
2684 
2685 typedef PREPACK struct {
2686     u8 whalCmdId;
2687     u8 data[1];
2688 } POSTPACK WHAL_PARAMCMD;
2689 
2690 
2691 #define WOW_MAX_FILTER_LISTS 1 /*4*/
2692 #define WOW_MAX_FILTERS_PER_LIST 4
2693 #define WOW_PATTERN_SIZE 64
2694 #define WOW_MASK_SIZE 64
2695 
2696 #define MAC_MAX_FILTERS_PER_LIST 4
2697 
2698 typedef PREPACK struct {
2699     u8 wow_valid_filter;
2700     u8 wow_filter_id;
2701     u8 wow_filter_size;
2702     u8 wow_filter_offset;
2703     u8 wow_filter_mask[WOW_MASK_SIZE];
2704     u8 wow_filter_pattern[WOW_PATTERN_SIZE];
2705 } POSTPACK WOW_FILTER;
2706 
2707 
2708 typedef PREPACK struct {
2709     u8 wow_valid_list;
2710     u8 wow_list_id;
2711     u8 wow_num_filters;
2712     u8 wow_total_list_size;
2713     WOW_FILTER list[WOW_MAX_FILTERS_PER_LIST];
2714 } POSTPACK WOW_FILTER_LIST;
2715 
2716 typedef PREPACK struct {
2717     u8 valid_filter;
2718     u8 mac_addr[ATH_MAC_LEN];
2719 } POSTPACK MAC_FILTER;
2720 
2721 
2722 typedef PREPACK struct {
2723     u8 total_list_size;
2724     u8 enable;
2725     MAC_FILTER list[MAC_MAX_FILTERS_PER_LIST];
2726 } POSTPACK MAC_FILTER_LIST;
2727 
2728 #define MAX_IP_ADDRS  2
2729 typedef PREPACK struct {
2730     u32 ips[MAX_IP_ADDRS];  /* IP in Network Byte Order */
2731 } POSTPACK WMI_SET_IP_CMD;
2732 
2733 typedef PREPACK struct {
2734     u32 awake;
2735     u32 asleep;
2736 } POSTPACK WMI_SET_HOST_SLEEP_MODE_CMD;
2737 
2738 typedef enum {
2739     WOW_FILTER_SSID = 0x1
2740 } WMI_WOW_FILTER;
2741 
2742 typedef PREPACK struct {
2743     u32 enable_wow;
2744     WMI_WOW_FILTER filter;
2745     u16 hostReqDelay;
2746 } POSTPACK WMI_SET_WOW_MODE_CMD;
2747 
2748 typedef PREPACK struct {
2749     u8 filter_list_id;
2750 } POSTPACK WMI_GET_WOW_LIST_CMD;
2751 
2752 /*
2753  * WMI_GET_WOW_LIST_CMD reply
2754  */
2755 typedef PREPACK struct {
2756     u8 num_filters;     /* number of patterns in reply */
2757     u8 this_filter_num; /*  this is filter # x of total num_filters */
2758     u8 wow_mode;
2759     u8 host_mode;
2760     WOW_FILTER  wow_filters[1];
2761 } POSTPACK WMI_GET_WOW_LIST_REPLY;
2762 
2763 typedef PREPACK struct {
2764     u8 filter_list_id;
2765     u8 filter_size;
2766     u8 filter_offset;
2767     u8 filter[1];
2768 } POSTPACK WMI_ADD_WOW_PATTERN_CMD;
2769 
2770 typedef PREPACK struct {
2771     u16 filter_list_id;
2772     u16 filter_id;
2773 } POSTPACK WMI_DEL_WOW_PATTERN_CMD;
2774 
2775 typedef PREPACK struct {
2776     u8 macaddr[ATH_MAC_LEN];
2777 } POSTPACK WMI_SET_MAC_ADDRESS_CMD;
2778 
2779 /*
2780  * WMI_SET_AKMP_PARAMS_CMD
2781  */
2782 
2783 #define WMI_AKMP_MULTI_PMKID_EN   0x000001
2784 
2785 typedef PREPACK struct {
2786     u32 akmpInfo;
2787 } POSTPACK WMI_SET_AKMP_PARAMS_CMD;
2788 
2789 typedef PREPACK struct {
2790     u8 pmkid[WMI_PMKID_LEN];
2791 } POSTPACK WMI_PMKID;
2792 
2793 /*
2794  * WMI_SET_PMKID_LIST_CMD
2795  */
2796 #define WMI_MAX_PMKID_CACHE   8
2797 
2798 typedef PREPACK struct {
2799     u32 numPMKID;
2800     WMI_PMKID   pmkidList[WMI_MAX_PMKID_CACHE];
2801 } POSTPACK WMI_SET_PMKID_LIST_CMD;
2802 
2803 /*
2804  * WMI_GET_PMKID_LIST_CMD  Reply
2805  * Following the Number of PMKIDs is the list of PMKIDs
2806  */
2807 typedef PREPACK struct {
2808     u32 numPMKID;
2809     u8 bssidList[ATH_MAC_LEN][1];
2810     WMI_PMKID   pmkidList[1];
2811 } POSTPACK WMI_PMKID_LIST_REPLY;
2812 
2813 typedef PREPACK struct {
2814     u16 oldChannel;
2815     u32 newChannel;
2816 } POSTPACK WMI_CHANNEL_CHANGE_EVENT;
2817 
2818 typedef PREPACK struct {
2819     u32 version;
2820 } POSTPACK WMI_WLAN_VERSION_EVENT;
2821 
2822 
2823 /* WMI_ADDBA_REQ_EVENTID */
2824 typedef PREPACK struct {
2825     u8 tid;
2826     u8 win_sz;
2827     u16 st_seq_no;
2828     u8 status;         /* f/w response for ADDBA Req; OK(0) or failure(!=0) */
2829 } POSTPACK WMI_ADDBA_REQ_EVENT;
2830 
2831 /* WMI_ADDBA_RESP_EVENTID */
2832 typedef PREPACK struct {
2833     u8 tid;
2834     u8 status;         /* OK(0), failure (!=0) */
2835     u16 amsdu_sz;       /* Three values: Not supported(0), 3839, 8k */
2836 } POSTPACK WMI_ADDBA_RESP_EVENT;
2837 
2838 /* WMI_DELBA_EVENTID
2839  * f/w received a DELBA for peer and processed it.
2840  * Host is notified of this
2841  */
2842 typedef PREPACK struct {
2843     u8 tid;
2844     u8 is_peer_initiator;
2845     u16 reason_code;
2846 } POSTPACK WMI_DELBA_EVENT;
2847 
2848 
2849 #ifdef WAPI_ENABLE
2850 #define WAPI_REKEY_UCAST    1
2851 #define WAPI_REKEY_MCAST    2
2852 typedef PREPACK struct {
2853     u8 type;
2854     u8 macAddr[ATH_MAC_LEN];
2855 } POSTPACK WMI_WAPIREKEY_EVENT;
2856 #endif
2857 
2858 
2859 /* WMI_ALLOW_AGGR_CMDID
2860  * Configures tid's to allow ADDBA negotiations
2861  * on each tid, in each direction
2862  */
2863 typedef PREPACK struct {
2864     u16 tx_allow_aggr;  /* 16-bit mask to allow uplink ADDBA negotiation - bit position indicates tid*/
2865     u16 rx_allow_aggr;  /* 16-bit mask to allow donwlink ADDBA negotiation - bit position indicates tid*/
2866 } POSTPACK WMI_ALLOW_AGGR_CMD;
2867 
2868 /* WMI_ADDBA_REQ_CMDID
2869  * f/w starts performing ADDBA negotiations with peer
2870  * on the given tid
2871  */
2872 typedef PREPACK struct {
2873     u8 tid;
2874 } POSTPACK WMI_ADDBA_REQ_CMD;
2875 
2876 /* WMI_DELBA_REQ_CMDID
2877  * f/w would teardown BA with peer.
2878  * is_send_initiator indicates if it's or tx or rx side
2879  */
2880 typedef PREPACK struct {
2881     u8 tid;
2882     u8 is_sender_initiator;
2883 
2884 } POSTPACK WMI_DELBA_REQ_CMD;
2885 
2886 #define PEER_NODE_JOIN_EVENT 0x00
2887 #define PEER_NODE_LEAVE_EVENT 0x01
2888 #define PEER_FIRST_NODE_JOIN_EVENT 0x10
2889 #define PEER_LAST_NODE_LEAVE_EVENT 0x11
2890 typedef PREPACK struct {
2891     u8 eventCode;
2892     u8 peerMacAddr[ATH_MAC_LEN];
2893 } POSTPACK WMI_PEER_NODE_EVENT;
2894 
2895 #define IEEE80211_FRAME_TYPE_MGT          0x00
2896 #define IEEE80211_FRAME_TYPE_CTL          0x04
2897 
2898 /*
2899  * Transmit complete event data structure(s)
2900  */
2901 
2902 
2903 typedef PREPACK struct {
2904 #define TX_COMPLETE_STATUS_SUCCESS 0
2905 #define TX_COMPLETE_STATUS_RETRIES 1
2906 #define TX_COMPLETE_STATUS_NOLINK  2
2907 #define TX_COMPLETE_STATUS_TIMEOUT 3
2908 #define TX_COMPLETE_STATUS_OTHER   4
2909 
2910     u8 status; /* one of TX_COMPLETE_STATUS_... */
2911     u8 pktID; /* packet ID to identify parent packet */
2912     u8 rateIdx; /* rate index on successful transmission */
2913     u8 ackFailures; /* number of ACK failures in tx attempt */
2914 #if 0 /* optional params currently omitted. */
2915     u32 queueDelay; // usec delay measured Tx Start time - host delivery time
2916     u32 mediaDelay; // usec delay measured ACK rx time - host delivery time
2917 #endif
2918 } POSTPACK TX_COMPLETE_MSG_V1; /* version 1 of tx complete msg */
2919 
2920 typedef PREPACK struct {
2921     u8 numMessages; /* number of tx comp msgs following this struct */
2922     u8 msgLen; /* length in bytes for each individual msg following this struct */
2923     u8 msgType; /* version of tx complete msg data following this struct */
2924     u8 reserved; /* individual messages follow this header */
2925 } POSTPACK WMI_TX_COMPLETE_EVENT;
2926 
2927 #define WMI_TXCOMPLETE_VERSION_1 (0x01)
2928 
2929 
2930 /*
2931  * ------- AP Mode definitions --------------
2932  */
2933 
2934 /*
2935  * !!! Warning !!!
2936  * -Changing the following values needs compilation of both driver and firmware
2937  */
2938 #ifdef AR6002_REV2
2939 #define AP_MAX_NUM_STA          4
2940 #else
2941 #define AP_MAX_NUM_STA          8
2942 #endif
2943 #define AP_ACL_SIZE             10
2944 #define IEEE80211_MAX_IE        256
2945 #define MCAST_AID               0xFF /* Spl. AID used to set DTIM flag in the beacons */
2946 #define DEF_AP_COUNTRY_CODE     "US "
2947 #define DEF_AP_WMODE_G          WMI_11G_MODE
2948 #define DEF_AP_WMODE_AG         WMI_11AG_MODE
2949 #define DEF_AP_DTIM             5
2950 #define DEF_BEACON_INTERVAL     100
2951 
2952 /* AP mode disconnect reasons */
2953 #define AP_DISCONNECT_STA_LEFT      101
2954 #define AP_DISCONNECT_FROM_HOST     102
2955 #define AP_DISCONNECT_COMM_TIMEOUT  103
2956 
2957 /*
2958  * Used with WMI_AP_HIDDEN_SSID_CMDID
2959  */
2960 #define HIDDEN_SSID_FALSE   0
2961 #define HIDDEN_SSID_TRUE    1
2962 typedef PREPACK struct {
2963     u8 hidden_ssid;
2964 } POSTPACK WMI_AP_HIDDEN_SSID_CMD;
2965 
2966 /*
2967  * Used with WMI_AP_ACL_POLICY_CMDID
2968  */
2969 #define AP_ACL_DISABLE          0x00
2970 #define AP_ACL_ALLOW_MAC        0x01
2971 #define AP_ACL_DENY_MAC         0x02
2972 #define AP_ACL_RETAIN_LIST_MASK 0x80
2973 typedef PREPACK struct {
2974     u8 policy;
2975 } POSTPACK WMI_AP_ACL_POLICY_CMD;
2976 
2977 /*
2978  * Used with WMI_AP_ACL_MAC_LIST_CMDID
2979  */
2980 #define ADD_MAC_ADDR    1
2981 #define DEL_MAC_ADDR    2
2982 typedef PREPACK struct {
2983     u8 action;
2984     u8 index;
2985     u8 mac[ATH_MAC_LEN];
2986     u8 wildcard;
2987 } POSTPACK WMI_AP_ACL_MAC_CMD;
2988 
2989 typedef PREPACK struct {
2990     u16 index;
2991     u8 acl_mac[AP_ACL_SIZE][ATH_MAC_LEN];
2992     u8 wildcard[AP_ACL_SIZE];
2993     u8 policy;
2994 } POSTPACK WMI_AP_ACL;
2995 
2996 /*
2997  * Used with WMI_AP_SET_NUM_STA_CMDID
2998  */
2999 typedef PREPACK struct {
3000     u8 num_sta;
3001 } POSTPACK WMI_AP_SET_NUM_STA_CMD;
3002 
3003 /*
3004  * Used with WMI_AP_SET_MLME_CMDID
3005  */
3006 typedef PREPACK struct {
3007     u8 mac[ATH_MAC_LEN];
3008     u16 reason;              /* 802.11 reason code */
3009     u8 cmd;                 /* operation to perform */
3010 #define WMI_AP_MLME_ASSOC       1   /* associate station */
3011 #define WMI_AP_DISASSOC         2   /* disassociate station */
3012 #define WMI_AP_DEAUTH           3   /* deauthenticate station */
3013 #define WMI_AP_MLME_AUTHORIZE   4   /* authorize station */
3014 #define WMI_AP_MLME_UNAUTHORIZE 5   /* unauthorize station */
3015 } POSTPACK WMI_AP_SET_MLME_CMD;
3016 
3017 typedef PREPACK struct {
3018     u32 period;
3019 } POSTPACK WMI_AP_CONN_INACT_CMD;
3020 
3021 typedef PREPACK struct {
3022     u32 period_min;
3023     u32 dwell_ms;
3024 } POSTPACK WMI_AP_PROT_SCAN_TIME_CMD;
3025 
3026 typedef PREPACK struct {
3027     u32 flag;
3028     u16 aid;
3029 } POSTPACK WMI_AP_SET_PVB_CMD;
3030 
3031 #define WMI_DISABLE_REGULATORY_CODE "FF"
3032 
3033 typedef PREPACK struct {
3034     u8 countryCode[3];
3035 } POSTPACK WMI_AP_SET_COUNTRY_CMD;
3036 
3037 typedef PREPACK struct {
3038     u8 dtim;
3039 } POSTPACK WMI_AP_SET_DTIM_CMD;
3040 
3041 typedef PREPACK struct {
3042     u8 band; /* specifies which band to apply these values */
3043     u8 enable; /* allows 11n to be disabled on a per band basis */
3044     u8 chan_width_40M_supported;
3045     u8 short_GI_20MHz;
3046     u8 short_GI_40MHz;
3047     u8 intolerance_40MHz;
3048     u8 max_ampdu_len_exp;
3049 } POSTPACK WMI_SET_HT_CAP_CMD;
3050 
3051 typedef PREPACK struct {
3052     u8 sta_chan_width;
3053 } POSTPACK WMI_SET_HT_OP_CMD;
3054 
3055 typedef PREPACK struct {
3056     u32 rateMasks[8];
3057 } POSTPACK WMI_SET_TX_SELECT_RATES_CMD;
3058 
3059 typedef PREPACK struct {
3060     u32 sgiMask;
3061     u8 sgiPERThreshold;
3062 } POSTPACK WMI_SET_TX_SGI_PARAM_CMD;
3063 
3064 #define DEFAULT_SGI_MASK 0x08080000
3065 #define DEFAULT_SGI_PER 10
3066 
3067 typedef PREPACK struct {
3068     u32 rateField; /* 1 bit per rate corresponding to index */
3069     u8 id;
3070     u8 shortTrys;
3071     u8 longTrys;
3072     u8 reserved; /* padding */
3073 } POSTPACK WMI_SET_RATE_POLICY_CMD;
3074 
3075 typedef PREPACK struct {
3076     u8 metaVersion; /* version of meta data for rx packets <0 = default> (0-7 = valid) */
3077     u8 dot11Hdr; /* 1 == leave .11 header intact , 0 == replace .11 header with .3 <default> */
3078     u8 defragOnHost; /* 1 == defragmentation is performed by host, 0 == performed by target <default> */
3079     u8 reserved[1]; /* alignment */
3080 } POSTPACK WMI_RX_FRAME_FORMAT_CMD;
3081 
3082 
3083 typedef PREPACK struct {
3084     u8 enable;     /* 1 == device operates in thin mode , 0 == normal mode <default> */
3085     u8 reserved[3];
3086 } POSTPACK WMI_SET_THIN_MODE_CMD;
3087 
3088 /* AP mode events */
3089 /* WMI_PS_POLL_EVENT */
3090 typedef PREPACK struct {
3091     u16 aid;
3092 } POSTPACK WMI_PSPOLL_EVENT;
3093 
3094 typedef PREPACK struct {
3095     u32 tx_bytes;
3096     u32 tx_pkts;
3097     u32 tx_error;
3098     u32 tx_discard;
3099     u32 rx_bytes;
3100     u32 rx_pkts;
3101     u32 rx_error;
3102     u32 rx_discard;
3103     u32 aid;
3104 } POSTPACK WMI_PER_STA_STAT;
3105 
3106 #define AP_GET_STATS    0
3107 #define AP_CLEAR_STATS  1
3108 
3109 typedef PREPACK struct {
3110     u32 action;
3111     WMI_PER_STA_STAT    sta[AP_MAX_NUM_STA+1];
3112 } POSTPACK WMI_AP_MODE_STAT;
3113 #define WMI_AP_MODE_STAT_SIZE(numSta) (sizeof(u32) + ((numSta + 1) * sizeof(WMI_PER_STA_STAT)))
3114 
3115 #define AP_11BG_RATESET1        1
3116 #define AP_11BG_RATESET2        2
3117 #define DEF_AP_11BG_RATESET     AP_11BG_RATESET1
3118 typedef PREPACK struct {
3119     u8 rateset;
3120 } POSTPACK WMI_AP_SET_11BG_RATESET_CMD;
3121 /*
3122  * End of AP mode definitions
3123  */
3124 
3125 #ifndef ATH_TARGET
3126 #include "athendpack.h"
3127 #endif
3128 
3129 #ifdef __cplusplus
3130 }
3131 #endif
3132 
3133 #endif /* _WMI_H_ */
3134