1 /*
2  * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
3  * Copyright (c) 2006-2012 Wilocity .
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  * This file contains the definitions of the WMI protocol specified in the
20  * Wireless Module Interface (WMI) for the Wilocity
21  * MARLON 60 Gigabit wireless solution.
22  * It includes definitions of all the commands and events.
23  * Commands are messages from the host to the WM.
24  * Events are messages from the WM to the host.
25  */
26 
27 #ifndef __WILOCITY_WMI_H__
28 #define __WILOCITY_WMI_H__
29 
30 /* General */
31 #define WILOCITY_MAX_ASSOC_STA (8)
32 #define WILOCITY_DEFAULT_ASSOC_STA (1)
33 #define WMI_MAC_LEN		(6)
34 #define WMI_PROX_RANGE_NUM	(3)
35 #define WMI_MAX_LOSS_DMG_BEACONS	(32)
36 
37 /* List of Commands */
38 enum wmi_command_id {
39 	WMI_CONNECT_CMDID		= 0x0001,
40 	WMI_DISCONNECT_CMDID		= 0x0003,
41 	WMI_DISCONNECT_STA_CMDID	= 0x0004,
42 	WMI_START_SCAN_CMDID		= 0x0007,
43 	WMI_SET_BSS_FILTER_CMDID	= 0x0009,
44 	WMI_SET_PROBED_SSID_CMDID	= 0x000a,
45 	WMI_SET_LISTEN_INT_CMDID	= 0x000b,
46 	WMI_BCON_CTRL_CMDID		= 0x000f,
47 	WMI_ADD_CIPHER_KEY_CMDID	= 0x0016,
48 	WMI_DELETE_CIPHER_KEY_CMDID	= 0x0017,
49 	WMI_SET_APPIE_CMDID		= 0x003f,
50 	WMI_SET_WSC_STATUS_CMDID	= 0x0041,
51 	WMI_PXMT_RANGE_CFG_CMDID	= 0x0042,
52 	WMI_PXMT_SNR2_RANGE_CFG_CMDID	= 0x0043,
53 /*	WMI_FAST_MEM_ACC_MODE_CMDID	= 0x0300, */
54 	WMI_MEM_READ_CMDID		= 0x0800,
55 	WMI_MEM_WR_CMDID		= 0x0801,
56 	WMI_ECHO_CMDID			= 0x0803,
57 	WMI_DEEP_ECHO_CMDID		= 0x0804,
58 	WMI_CONFIG_MAC_CMDID		= 0x0805,
59 	WMI_CONFIG_PHY_DEBUG_CMDID	= 0x0806,
60 	WMI_ADD_DEBUG_TX_PCKT_CMDID	= 0x0808,
61 	WMI_PHY_GET_STATISTICS_CMDID	= 0x0809,
62 	WMI_FS_TUNE_CMDID		= 0x080a,
63 	WMI_CORR_MEASURE_CMDID		= 0x080b,
64 	WMI_READ_RSSI_CMDID		= 0x080c,
65 	WMI_TEMP_SENSE_CMDID		= 0x080e,
66 	WMI_DC_CALIB_CMDID		= 0x080f,
67 	WMI_SEND_TONE_CMDID		= 0x0810,
68 	WMI_IQ_TX_CALIB_CMDID		= 0x0811,
69 	WMI_IQ_RX_CALIB_CMDID		= 0x0812,
70 	WMI_SET_UCODE_IDLE_CMDID	= 0x0813,
71 	WMI_SET_WORK_MODE_CMDID		= 0x0815,
72 	WMI_LO_LEAKAGE_CALIB_CMDID	= 0x0816,
73 	WMI_MARLON_R_READ_CMDID		= 0x0818,
74 	WMI_MARLON_R_WRITE_CMDID	= 0x0819,
75 	WMI_MARLON_R_TXRX_SEL_CMDID	= 0x081a,
76 	MAC_IO_STATIC_PARAMS_CMDID	= 0x081b,
77 	MAC_IO_DYNAMIC_PARAMS_CMDID	= 0x081c,
78 	WMI_SILENT_RSSI_CALIB_CMDID	= 0x081d,
79 	WMI_RF_RX_TEST_CMDID		= 0x081e,
80 	WMI_CFG_RX_CHAIN_CMDID		= 0x0820,
81 	WMI_VRING_CFG_CMDID		= 0x0821,
82 	WMI_BCAST_VRING_CFG_CMDID	= 0x0822,
83 	WMI_VRING_BA_EN_CMDID		= 0x0823,
84 	WMI_VRING_BA_DIS_CMDID		= 0x0824,
85 	WMI_RCP_ADDBA_RESP_CMDID	= 0x0825,
86 	WMI_RCP_DELBA_CMDID		= 0x0826,
87 	WMI_SET_SSID_CMDID		= 0x0827,
88 	WMI_GET_SSID_CMDID		= 0x0828,
89 	WMI_SET_PCP_CHANNEL_CMDID	= 0x0829,
90 	WMI_GET_PCP_CHANNEL_CMDID	= 0x082a,
91 	WMI_SW_TX_REQ_CMDID		= 0x082b,
92 	WMI_READ_MAC_RXQ_CMDID		= 0x0830,
93 	WMI_READ_MAC_TXQ_CMDID		= 0x0831,
94 	WMI_WRITE_MAC_RXQ_CMDID		= 0x0832,
95 	WMI_WRITE_MAC_TXQ_CMDID		= 0x0833,
96 	WMI_WRITE_MAC_XQ_FIELD_CMDID	= 0x0834,
97 	WMI_MLME_PUSH_CMDID		= 0x0835,
98 	WMI_BEAMFORMING_MGMT_CMDID	= 0x0836,
99 	WMI_BF_TXSS_MGMT_CMDID		= 0x0837,
100 	WMI_BF_SM_MGMT_CMDID		= 0x0838,
101 	WMI_BF_RXSS_MGMT_CMDID		= 0x0839,
102 	WMI_BF_TRIG_CMDID		= 0x083A,
103 	WMI_SET_SECTORS_CMDID		= 0x0849,
104 	WMI_MAINTAIN_PAUSE_CMDID	= 0x0850,
105 	WMI_MAINTAIN_RESUME_CMDID	= 0x0851,
106 	WMI_RS_MGMT_CMDID		= 0x0852,
107 	WMI_RF_MGMT_CMDID		= 0x0853,
108 	WMI_THERMAL_THROTTLING_CTRL_CMDID	= 0x0854,
109 	WMI_THERMAL_THROTTLING_GET_STATUS_CMDID	= 0x0855,
110 	/* Performance monitoring commands */
111 	WMI_BF_CTRL_CMDID		= 0x0862,
112 	WMI_NOTIFY_REQ_CMDID		= 0x0863,
113 	WMI_GET_STATUS_CMDID		= 0x0864,
114 	WMI_UNIT_TEST_CMDID		= 0x0900,
115 	WMI_HICCUP_CMDID		= 0x0901,
116 	WMI_FLASH_READ_CMDID		= 0x0902,
117 	WMI_FLASH_WRITE_CMDID		= 0x0903,
118 	WMI_SECURITY_UNIT_TEST_CMDID	= 0x0904,
119 	/*P2P*/
120 	WMI_P2P_CFG_CMDID		= 0x0910,
121 	WMI_PORT_ALLOCATE_CMDID		= 0x0911,
122 	WMI_PORT_DELETE_CMDID		= 0x0912,
123 	WMI_POWER_MGMT_CFG_CMDID	= 0x0913,
124 	WMI_START_LISTEN_CMDID		= 0x0914,
125 	WMI_START_SEARCH_CMDID		= 0x0915,
126 	WMI_DISCOVERY_START_CMDID	= 0x0916,
127 	WMI_DISCOVERY_STOP_CMDID	= 0x0917,
128 	WMI_PCP_START_CMDID		= 0x0918,
129 	WMI_PCP_STOP_CMDID		= 0x0919,
130 	WMI_GET_PCP_FACTOR_CMDID	= 0x091b,
131 
132 	WMI_SET_MAC_ADDRESS_CMDID	= 0xf003,
133 	WMI_ABORT_SCAN_CMDID		= 0xf007,
134 	WMI_SET_PMK_CMDID		= 0xf028,
135 
136 	WMI_SET_PROMISCUOUS_MODE_CMDID	= 0xf041,
137 	WMI_GET_PMK_CMDID		= 0xf048,
138 	WMI_SET_PASSPHRASE_CMDID	= 0xf049,
139 	WMI_SEND_ASSOC_RES_CMDID	= 0xf04a,
140 	WMI_SET_ASSOC_REQ_RELAY_CMDID	= 0xf04b,
141 	WMI_EAPOL_TX_CMDID		= 0xf04c,
142 	WMI_MAC_ADDR_REQ_CMDID		= 0xf04d,
143 	WMI_FW_VER_CMDID		= 0xf04e,
144 	WMI_PMC_CMDID			= 0xf04f,
145 };
146 
147 /*
148  * Commands data structures
149  */
150 
151 /*
152  * WMI_CONNECT_CMDID
153  */
154 enum wmi_network_type {
155 	WMI_NETTYPE_INFRA		= 0x01,
156 	WMI_NETTYPE_ADHOC		= 0x02,
157 	WMI_NETTYPE_ADHOC_CREATOR	= 0x04,
158 	WMI_NETTYPE_AP			= 0x10,
159 	WMI_NETTYPE_P2P			= 0x20,
160 	WMI_NETTYPE_WBE			= 0x40, /* PCIE over 60g */
161 };
162 
163 enum wmi_dot11_auth_mode {
164 	WMI_AUTH11_OPEN			= 0x01,
165 	WMI_AUTH11_SHARED		= 0x02,
166 	WMI_AUTH11_LEAP			= 0x04,
167 	WMI_AUTH11_WSC			= 0x08,
168 };
169 
170 enum wmi_auth_mode {
171 	WMI_AUTH_NONE			= 0x01,
172 	WMI_AUTH_WPA			= 0x02,
173 	WMI_AUTH_WPA2			= 0x04,
174 	WMI_AUTH_WPA_PSK		= 0x08,
175 	WMI_AUTH_WPA2_PSK		= 0x10,
176 	WMI_AUTH_WPA_CCKM		= 0x20,
177 	WMI_AUTH_WPA2_CCKM		= 0x40,
178 };
179 
180 enum wmi_crypto_type {
181 	WMI_CRYPT_NONE			= 0x01,
182 	WMI_CRYPT_WEP			= 0x02,
183 	WMI_CRYPT_TKIP			= 0x04,
184 	WMI_CRYPT_AES			= 0x08,
185 	WMI_CRYPT_AES_GCMP		= 0x20,
186 };
187 
188 enum wmi_connect_ctrl_flag_bits {
189 	WMI_CONNECT_ASSOC_POLICY_USER		= 0x0001,
190 	WMI_CONNECT_SEND_REASSOC		= 0x0002,
191 	WMI_CONNECT_IGNORE_WPA_GROUP_CIPHER	= 0x0004,
192 	WMI_CONNECT_PROFILE_MATCH_DONE		= 0x0008,
193 	WMI_CONNECT_IGNORE_AAC_BEACON		= 0x0010,
194 	WMI_CONNECT_CSA_FOLLOW_BSS		= 0x0020,
195 	WMI_CONNECT_DO_WPA_OFFLOAD		= 0x0040,
196 	WMI_CONNECT_DO_NOT_DEAUTH		= 0x0080,
197 };
198 
199 #define WMI_MAX_SSID_LEN    (32)
200 
201 struct wmi_connect_cmd {
202 	u8 network_type;
203 	u8 dot11_auth_mode;
204 	u8 auth_mode;
205 	u8 pairwise_crypto_type;
206 	u8 pairwise_crypto_len;
207 	u8 group_crypto_type;
208 	u8 group_crypto_len;
209 	u8 ssid_len;
210 	u8 ssid[WMI_MAX_SSID_LEN];
211 	u8 channel;
212 	u8 reserved0;
213 	u8 bssid[WMI_MAC_LEN];
214 	__le32 ctrl_flags;
215 	u8 dst_mac[WMI_MAC_LEN];
216 	u8 reserved1[2];
217 } __packed;
218 
219 /*
220  * WMI_DISCONNECT_STA_CMDID
221  */
222 struct wmi_disconnect_sta_cmd {
223 	u8 dst_mac[WMI_MAC_LEN];
224 	__le16 disconnect_reason;
225 } __packed;
226 
227 /*
228  * WMI_SET_PMK_CMDID
229  */
230 
231 #define WMI_MIN_KEY_INDEX	(0)
232 #define WMI_MAX_KEY_INDEX	(3)
233 #define WMI_MAX_KEY_LEN		(32)
234 #define WMI_PASSPHRASE_LEN	(64)
235 #define WMI_PMK_LEN		(32)
236 
237 struct  wmi_set_pmk_cmd {
238 	u8 pmk[WMI_PMK_LEN];
239 } __packed;
240 
241 /*
242  * WMI_SET_PASSPHRASE_CMDID
243  */
244 struct wmi_set_passphrase_cmd {
245 	u8 ssid[WMI_MAX_SSID_LEN];
246 	u8 passphrase[WMI_PASSPHRASE_LEN];
247 	u8 ssid_len;
248 	u8 passphrase_len;
249 } __packed;
250 
251 /*
252  * WMI_ADD_CIPHER_KEY_CMDID
253  */
254 enum wmi_key_usage {
255 	WMI_KEY_USE_PAIRWISE	= 0,
256 	WMI_KEY_USE_GROUP	= 1,
257 	WMI_KEY_USE_TX		= 2,  /* default Tx Key - Static WEP only */
258 };
259 
260 struct wmi_add_cipher_key_cmd {
261 	u8 key_index;
262 	u8 key_type;
263 	u8 key_usage;		/* enum wmi_key_usage */
264 	u8 key_len;
265 	u8 key_rsc[8];		/* key replay sequence counter */
266 	u8 key[WMI_MAX_KEY_LEN];
267 	u8 key_op_ctrl;		/* Additional Key Control information */
268 	u8 mac[WMI_MAC_LEN];
269 } __packed;
270 
271 /*
272  * WMI_DELETE_CIPHER_KEY_CMDID
273  */
274 struct wmi_delete_cipher_key_cmd {
275 	u8 key_index;
276 	u8 mac[WMI_MAC_LEN];
277 } __packed;
278 
279 /*
280  * WMI_START_SCAN_CMDID
281  *
282  * Start L1 scan operation
283  *
284  * Returned events:
285  * - WMI_RX_MGMT_PACKET_EVENTID - for every probe resp.
286  * - WMI_SCAN_COMPLETE_EVENTID
287  */
288 enum wmi_scan_type {
289 	WMI_LONG_SCAN		= 0,
290 	WMI_SHORT_SCAN		= 1,
291 	WMI_PBC_SCAN		= 2,
292 	WMI_DIRECT_SCAN		= 3,
293 	WMI_ACTIVE_SCAN		= 4,
294 };
295 
296 struct wmi_start_scan_cmd {
297 	u8 direct_scan_mac_addr[6];
298 	u8 reserved[2];
299 	__le32 home_dwell_time;	/* Max duration in the home channel(ms) */
300 	__le32 force_scan_interval;	/* Time interval between scans (ms)*/
301 	u8 scan_type;		/* wmi_scan_type */
302 	u8 num_channels;		/* how many channels follow */
303 	struct {
304 		u8 channel;
305 		u8 reserved;
306 	} channel_list[0];	/* channels ID's */
307 				/* 0 - 58320 MHz */
308 				/* 1 - 60480 MHz */
309 				/* 2 - 62640 MHz */
310 } __packed;
311 
312 /*
313  * WMI_SET_PROBED_SSID_CMDID
314  */
315 #define MAX_PROBED_SSID_INDEX	(3)
316 
317 enum wmi_ssid_flag {
318 	WMI_SSID_FLAG_DISABLE	= 0,	/* disables entry */
319 	WMI_SSID_FLAG_SPECIFIC	= 1,	/* probes specified ssid */
320 	WMI_SSID_FLAG_ANY	= 2,	/* probes for any ssid */
321 };
322 
323 struct wmi_probed_ssid_cmd {
324 	u8 entry_index;			/* 0 to MAX_PROBED_SSID_INDEX */
325 	u8 flag;			/* enum wmi_ssid_flag */
326 	u8 ssid_len;
327 	u8 ssid[WMI_MAX_SSID_LEN];
328 } __packed;
329 
330 /*
331  * WMI_SET_APPIE_CMDID
332  * Add Application specified IE to a management frame
333  */
334 #define WMI_MAX_IE_LEN		(1024)
335 
336 /*
337  * Frame Types
338  */
339 enum wmi_mgmt_frame_type {
340 	WMI_FRAME_BEACON	= 0,
341 	WMI_FRAME_PROBE_REQ	= 1,
342 	WMI_FRAME_PROBE_RESP	= 2,
343 	WMI_FRAME_ASSOC_REQ	= 3,
344 	WMI_FRAME_ASSOC_RESP	= 4,
345 	WMI_NUM_MGMT_FRAME,
346 };
347 
348 struct wmi_set_appie_cmd {
349 	u8 mgmt_frm_type;	/* enum wmi_mgmt_frame_type */
350 	u8 reserved;
351 	__le16 ie_len;	/* Length of the IE to be added to MGMT frame */
352 	u8 ie_info[0];
353 } __packed;
354 
355 /*
356  * WMI_PXMT_RANGE_CFG_CMDID
357  */
358 struct wmi_pxmt_range_cfg_cmd {
359 	u8 dst_mac[WMI_MAC_LEN];
360 	__le16 range;
361 } __packed;
362 
363 /*
364  * WMI_PXMT_SNR2_RANGE_CFG_CMDID
365  */
366 struct wmi_pxmt_snr2_range_cfg_cmd {
367 	s8 snr2range_arr[WMI_PROX_RANGE_NUM-1];
368 } __packed;
369 
370 /*
371  * WMI_RF_MGMT_CMDID
372  */
373 enum wmi_rf_mgmt_type {
374 	WMI_RF_MGMT_W_DISABLE	= 0,
375 	WMI_RF_MGMT_W_ENABLE	= 1,
376 	WMI_RF_MGMT_GET_STATUS	= 2,
377 };
378 
379 struct wmi_rf_mgmt_cmd {
380 	__le32 rf_mgmt_type;
381 } __packed;
382 
383 /*
384  * WMI_THERMAL_THROTTLING_CTRL_CMDID
385  */
386 #define THERMAL_THROTTLING_USE_DEFAULT_MAX_TXOP_LENGTH	(0xFFFFFFFF)
387 
388 struct wmi_thermal_throttling_ctrl_cmd {
389 	__le32 time_on_usec;
390 	__le32 time_off_usec;
391 	__le32 max_txop_length_usec;
392 } __packed;
393 
394 /*
395  * WMI_RF_RX_TEST_CMDID
396  */
397 struct wmi_rf_rx_test_cmd {
398 	__le32 sector;
399 } __packed;
400 
401 /*
402  * WMI_CORR_MEASURE_CMDID
403  */
404 struct wmi_corr_measure_cmd {
405 	s32 freq_mhz;
406 	__le32 length_samples;
407 	__le32 iterations;
408 } __packed;
409 
410 /*
411  * WMI_SET_SSID_CMDID
412  */
413 struct wmi_set_ssid_cmd {
414 	__le32 ssid_len;
415 	u8 ssid[WMI_MAX_SSID_LEN];
416 } __packed;
417 
418 /*
419  * WMI_SET_PCP_CHANNEL_CMDID
420  */
421 struct wmi_set_pcp_channel_cmd {
422 	u8 channel;
423 	u8 reserved[3];
424 } __packed;
425 
426 /*
427  * WMI_BCON_CTRL_CMDID
428  */
429 struct wmi_bcon_ctrl_cmd {
430 	__le16 bcon_interval;
431 	__le16 frag_num;
432 	__le64 ss_mask;
433 	u8 network_type;
434 	u8 pcp_max_assoc_sta;
435 	u8 disable_sec_offload;
436 	u8 disable_sec;
437 } __packed;
438 
439 /******* P2P ***********/
440 
441 /*
442  * WMI_PORT_ALLOCATE_CMDID
443  */
444 enum wmi_port_role {
445 	WMI_PORT_STA		= 0,
446 	WMI_PORT_PCP		= 1,
447 	WMI_PORT_AP		= 2,
448 	WMI_PORT_P2P_DEV	= 3,
449 	WMI_PORT_P2P_CLIENT	= 4,
450 	WMI_PORT_P2P_GO		= 5,
451 };
452 
453 struct wmi_port_allocate_cmd {
454 	u8 mac[WMI_MAC_LEN];
455 	u8 port_role;
456 	u8 mid;
457 } __packed;
458 
459 /*
460  * WMI_PORT_DELETE_CMDID
461  */
462 struct wmi_delete_port_cmd {
463 	u8 mid;
464 	u8 reserved[3];
465 } __packed;
466 
467 /*
468  * WMI_P2P_CFG_CMDID
469  */
470 enum wmi_discovery_mode {
471 	WMI_DISCOVERY_MODE_NON_OFFLOAD	= 0,
472 	WMI_DISCOVERY_MODE_OFFLOAD	= 1,
473 	WMI_DISCOVERY_MODE_PEER2PEER	= 2,
474 };
475 
476 struct wmi_p2p_cfg_cmd {
477 	u8 discovery_mode;	/* wmi_discovery_mode */
478 	u8 channel;
479 	__le16 bcon_interval; /* base to listen/search duration calculation */
480 } __packed;
481 
482 /*
483  * WMI_POWER_MGMT_CFG_CMDID
484  */
485 enum wmi_power_source_type {
486 	WMI_POWER_SOURCE_BATTERY	= 0,
487 	WMI_POWER_SOURCE_OTHER		= 1,
488 };
489 
490 struct wmi_power_mgmt_cfg_cmd {
491 	u8 power_source;	/* wmi_power_source_type */
492 	u8 reserved[3];
493 } __packed;
494 
495 /*
496  * WMI_PCP_START_CMDID
497  */
498 struct wmi_pcp_start_cmd {
499 	__le16 bcon_interval;
500 	u8 pcp_max_assoc_sta;
501 	u8 reserved0[9];
502 	u8 network_type;
503 	u8 channel;
504 	u8 disable_sec_offload;
505 	u8 disable_sec;
506 } __packed;
507 
508 /*
509  * WMI_SW_TX_REQ_CMDID
510  */
511 struct wmi_sw_tx_req_cmd {
512 	u8 dst_mac[WMI_MAC_LEN];
513 	__le16 len;
514 	u8 payload[0];
515 } __packed;
516 
517 /*
518  * WMI_VRING_CFG_CMDID
519  */
520 
521 struct wmi_sw_ring_cfg {
522 	__le64 ring_mem_base;
523 	__le16 ring_size;
524 	__le16 max_mpdu_size;
525 } __packed;
526 
527 struct wmi_vring_cfg_schd {
528 	__le16 priority;
529 	__le16 timeslot_us;
530 } __packed;
531 
532 enum wmi_vring_cfg_encap_trans_type {
533 	WMI_VRING_ENC_TYPE_802_3		= 0,
534 	WMI_VRING_ENC_TYPE_NATIVE_WIFI		= 1,
535 };
536 
537 enum wmi_vring_cfg_ds_cfg {
538 	WMI_VRING_DS_PBSS			= 0,
539 	WMI_VRING_DS_STATION			= 1,
540 	WMI_VRING_DS_AP				= 2,
541 	WMI_VRING_DS_ADDR4			= 3,
542 };
543 
544 enum wmi_vring_cfg_nwifi_ds_trans_type {
545 	WMI_NWIFI_TX_TRANS_MODE_NO		= 0,
546 	WMI_NWIFI_TX_TRANS_MODE_AP2PBSS		= 1,
547 	WMI_NWIFI_TX_TRANS_MODE_STA2PBSS	= 2,
548 };
549 
550 enum wmi_vring_cfg_schd_params_priority {
551 	WMI_SCH_PRIO_REGULAR			= 0,
552 	WMI_SCH_PRIO_HIGH			= 1,
553 };
554 
555 #define CIDXTID_CID_POS (0)
556 #define CIDXTID_CID_LEN (4)
557 #define CIDXTID_CID_MSK (0xF)
558 #define CIDXTID_TID_POS (4)
559 #define CIDXTID_TID_LEN (4)
560 #define CIDXTID_TID_MSK (0xF0)
561 
562 struct wmi_vring_cfg {
563 	struct wmi_sw_ring_cfg tx_sw_ring;
564 	u8 ringid;				/* 0-23 vrings */
565 
566 	u8 cidxtid;
567 
568 	u8 encap_trans_type;
569 	u8 ds_cfg;				/* 802.3 DS cfg */
570 	u8 nwifi_ds_trans_type;
571 
572 	#define VRING_CFG_MAC_CTRL_LIFETIME_EN_POS (0)
573 	#define VRING_CFG_MAC_CTRL_LIFETIME_EN_LEN (1)
574 	#define VRING_CFG_MAC_CTRL_LIFETIME_EN_MSK (0x1)
575 	#define VRING_CFG_MAC_CTRL_AGGR_EN_POS (1)
576 	#define VRING_CFG_MAC_CTRL_AGGR_EN_LEN (1)
577 	#define VRING_CFG_MAC_CTRL_AGGR_EN_MSK (0x2)
578 	u8 mac_ctrl;
579 
580 	#define VRING_CFG_TO_RESOLUTION_VALUE_POS (0)
581 	#define VRING_CFG_TO_RESOLUTION_VALUE_LEN (6)
582 	#define VRING_CFG_TO_RESOLUTION_VALUE_MSK (0x3F)
583 	u8 to_resolution;
584 	u8 agg_max_wsize;
585 	struct wmi_vring_cfg_schd schd_params;
586 } __packed;
587 
588 enum wmi_vring_cfg_cmd_action {
589 	WMI_VRING_CMD_ADD			= 0,
590 	WMI_VRING_CMD_MODIFY			= 1,
591 	WMI_VRING_CMD_DELETE			= 2,
592 };
593 
594 struct wmi_vring_cfg_cmd {
595 	__le32 action;
596 	struct wmi_vring_cfg vring_cfg;
597 } __packed;
598 
599 /*
600  * WMI_BCAST_VRING_CFG_CMDID
601  */
602 struct wmi_bcast_vring_cfg {
603 	struct wmi_sw_ring_cfg tx_sw_ring;
604 	u8 ringid;				/* 0-23 vrings */
605 	u8 encap_trans_type;
606 	u8 ds_cfg;				/* 802.3 DS cfg */
607 	u8 nwifi_ds_trans_type;
608 } __packed;
609 
610 struct wmi_bcast_vring_cfg_cmd {
611 	__le32 action;
612 	struct wmi_bcast_vring_cfg vring_cfg;
613 } __packed;
614 
615 /*
616  * WMI_VRING_BA_EN_CMDID
617  */
618 struct wmi_vring_ba_en_cmd {
619 	u8 ringid;
620 	u8 agg_max_wsize;
621 	__le16 ba_timeout;
622 	u8 amsdu;
623 } __packed;
624 
625 /*
626  * WMI_VRING_BA_DIS_CMDID
627  */
628 struct wmi_vring_ba_dis_cmd {
629 	u8 ringid;
630 	u8 reserved;
631 	__le16 reason;
632 } __packed;
633 
634 /*
635  * WMI_NOTIFY_REQ_CMDID
636  */
637 struct wmi_notify_req_cmd {
638 	u8 cid;
639 	u8 year;
640 	u8 month;
641 	u8 day;
642 	__le32 interval_usec;
643 	u8 hour;
644 	u8 minute;
645 	u8 second;
646 	u8 miliseconds;
647 } __packed;
648 
649 /*
650  * WMI_CFG_RX_CHAIN_CMDID
651  */
652 enum wmi_sniffer_cfg_mode {
653 	WMI_SNIFFER_OFF				= 0,
654 	WMI_SNIFFER_ON				= 1,
655 };
656 
657 enum wmi_sniffer_cfg_phy_info_mode {
658 	WMI_SNIFFER_PHY_INFO_DISABLED		= 0,
659 	WMI_SNIFFER_PHY_INFO_ENABLED		= 1,
660 };
661 
662 enum wmi_sniffer_cfg_phy_support {
663 	WMI_SNIFFER_CP				= 0,
664 	WMI_SNIFFER_DP				= 1,
665 	WMI_SNIFFER_BOTH_PHYS			= 2,
666 };
667 
668 struct wmi_sniffer_cfg {
669 	__le32 mode;		/* enum wmi_sniffer_cfg_mode */
670 	__le32 phy_info_mode;	/* enum wmi_sniffer_cfg_phy_info_mode */
671 	__le32 phy_support;	/* enum wmi_sniffer_cfg_phy_support */
672 	u8 channel;
673 	u8 reserved[3];
674 } __packed;
675 
676 enum wmi_cfg_rx_chain_cmd_action {
677 	WMI_RX_CHAIN_ADD			= 0,
678 	WMI_RX_CHAIN_DEL			= 1,
679 };
680 
681 enum wmi_cfg_rx_chain_cmd_decap_trans_type {
682 	WMI_DECAP_TYPE_802_3			= 0,
683 	WMI_DECAP_TYPE_NATIVE_WIFI		= 1,
684 	WMI_DECAP_TYPE_NONE			= 2,
685 };
686 
687 enum wmi_cfg_rx_chain_cmd_nwifi_ds_trans_type {
688 	WMI_NWIFI_RX_TRANS_MODE_NO		= 0,
689 	WMI_NWIFI_RX_TRANS_MODE_PBSS2AP		= 1,
690 	WMI_NWIFI_RX_TRANS_MODE_PBSS2STA	= 2,
691 };
692 
693 enum wmi_cfg_rx_chain_cmd_reorder_type {
694 	WMI_RX_HW_REORDER = 0,
695 	WMI_RX_SW_REORDER = 1,
696 };
697 
698 struct wmi_cfg_rx_chain_cmd {
699 	__le32 action;
700 	struct wmi_sw_ring_cfg rx_sw_ring;
701 	u8 mid;
702 	u8 decap_trans_type;
703 
704 	#define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_POS (0)
705 	#define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_LEN (1)
706 	#define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_MSK (0x1)
707 	#define L2_802_3_OFFLOAD_CTRL_SNAP_KEEP_POS (1)
708 	#define L2_802_3_OFFLOAD_CTRL_SNAP_KEEP_LEN (1)
709 	#define L2_802_3_OFFLOAD_CTRL_SNAP_KEEP_MSK (0x2)
710 	u8 l2_802_3_offload_ctrl;
711 
712 	#define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_POS (0)
713 	#define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_LEN (1)
714 	#define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_MSK (0x1)
715 	#define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_POS (1)
716 	#define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_LEN (1)
717 	#define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_MSK (0x2)
718 	u8 l2_nwifi_offload_ctrl;
719 
720 	u8 vlan_id;
721 	u8 nwifi_ds_trans_type;
722 
723 	#define L3_L4_CTRL_IPV4_CHECKSUM_EN_POS (0)
724 	#define L3_L4_CTRL_IPV4_CHECKSUM_EN_LEN (1)
725 	#define L3_L4_CTRL_IPV4_CHECKSUM_EN_MSK (0x1)
726 	#define L3_L4_CTRL_TCPIP_CHECKSUM_EN_POS (1)
727 	#define L3_L4_CTRL_TCPIP_CHECKSUM_EN_LEN (1)
728 	#define L3_L4_CTRL_TCPIP_CHECKSUM_EN_MSK (0x2)
729 	u8 l3_l4_ctrl;
730 
731 	#define RING_CTRL_OVERRIDE_PREFETCH_THRSH_POS (0)
732 	#define RING_CTRL_OVERRIDE_PREFETCH_THRSH_LEN (1)
733 	#define RING_CTRL_OVERRIDE_PREFETCH_THRSH_MSK (0x1)
734 	#define RING_CTRL_OVERRIDE_WB_THRSH_POS (1)
735 	#define RING_CTRL_OVERRIDE_WB_THRSH_LEN (1)
736 	#define RING_CTRL_OVERRIDE_WB_THRSH_MSK (0x2)
737 	#define RING_CTRL_OVERRIDE_ITR_THRSH_POS (2)
738 	#define RING_CTRL_OVERRIDE_ITR_THRSH_LEN (1)
739 	#define RING_CTRL_OVERRIDE_ITR_THRSH_MSK (0x4)
740 	#define RING_CTRL_OVERRIDE_HOST_THRSH_POS (3)
741 	#define RING_CTRL_OVERRIDE_HOST_THRSH_LEN (1)
742 	#define RING_CTRL_OVERRIDE_HOST_THRSH_MSK (0x8)
743 	u8 ring_ctrl;
744 
745 	__le16 prefetch_thrsh;
746 	__le16 wb_thrsh;
747 	__le32 itr_value;
748 	__le16 host_thrsh;
749 	u8 reorder_type;
750 	u8 reserved;
751 	struct wmi_sniffer_cfg sniffer_cfg;
752 } __packed;
753 
754 /*
755  * WMI_RCP_ADDBA_RESP_CMDID
756  */
757 struct wmi_rcp_addba_resp_cmd {
758 	u8 cidxtid;
759 	u8 dialog_token;
760 	__le16 status_code;
761 	__le16 ba_param_set;	/* ieee80211_ba_parameterset field to send */
762 	__le16 ba_timeout;
763 } __packed;
764 
765 /*
766  * WMI_RCP_DELBA_CMDID
767  */
768 struct wmi_rcp_delba_cmd {
769 	u8 cidxtid;
770 	u8 reserved;
771 	__le16 reason;
772 } __packed;
773 
774 /*
775  * WMI_RCP_ADDBA_REQ_CMDID
776  */
777 struct wmi_rcp_addba_req_cmd {
778 	u8 cidxtid;
779 	u8 dialog_token;
780 	/* ieee80211_ba_parameterset field as it received */
781 	__le16 ba_param_set;
782 	__le16 ba_timeout;
783 	/* ieee80211_ba_seqstrl field as it received */
784 	__le16 ba_seq_ctrl;
785 } __packed;
786 
787 /*
788  * WMI_SET_MAC_ADDRESS_CMDID
789  */
790 struct wmi_set_mac_address_cmd {
791 	u8 mac[WMI_MAC_LEN];
792 	u8 reserved[2];
793 } __packed;
794 
795 /*
796 * WMI_EAPOL_TX_CMDID
797 */
798 struct wmi_eapol_tx_cmd {
799 	u8 dst_mac[WMI_MAC_LEN];
800 	__le16 eapol_len;
801 	u8 eapol[0];
802 } __packed;
803 
804 /*
805  * WMI_ECHO_CMDID
806  *
807  * Check FW is alive
808  *
809  * WMI_DEEP_ECHO_CMDID
810  *
811  * Check FW and ucode are alive
812  *
813  * Returned event: WMI_ECHO_RSP_EVENTID
814  * same event for both commands
815  */
816 struct wmi_echo_cmd {
817 	__le32 value;
818 } __packed;
819 
820 /*
821  * WMI_TEMP_SENSE_CMDID
822  *
823  * Measure MAC and radio temperatures
824  */
825 
826 /* Possible modes for temperature measurement */
827 enum wmi_temperature_measure_mode {
828 	TEMPERATURE_USE_OLD_VALUE	= 0x1,
829 	TEMPERATURE_MEASURE_NOW		= 0x2,
830 };
831 
832 struct wmi_temp_sense_cmd {
833 	__le32 measure_baseband_en;
834 	__le32 measure_rf_en;
835 	__le32 measure_mode;
836 } __packed;
837 
838 /*
839  * WMI Events
840  */
841 
842 /*
843  * List of Events (target to host)
844  */
845 enum wmi_event_id {
846 	WMI_READY_EVENTID			= 0x1001,
847 	WMI_CONNECT_EVENTID			= 0x1002,
848 	WMI_DISCONNECT_EVENTID			= 0x1003,
849 	WMI_SCAN_COMPLETE_EVENTID		= 0x100a,
850 	WMI_REPORT_STATISTICS_EVENTID		= 0x100b,
851 	WMI_RD_MEM_RSP_EVENTID			= 0x1800,
852 	WMI_FW_READY_EVENTID			= 0x1801,
853 	WMI_EXIT_FAST_MEM_ACC_MODE_EVENTID	= 0x0200,
854 	WMI_ECHO_RSP_EVENTID			= 0x1803,
855 	WMI_FS_TUNE_DONE_EVENTID		= 0x180a,
856 	WMI_CORR_MEASURE_EVENTID		= 0x180b,
857 	WMI_READ_RSSI_EVENTID			= 0x180c,
858 	WMI_TEMP_SENSE_DONE_EVENTID		= 0x180e,
859 	WMI_DC_CALIB_DONE_EVENTID		= 0x180f,
860 	WMI_IQ_TX_CALIB_DONE_EVENTID		= 0x1811,
861 	WMI_IQ_RX_CALIB_DONE_EVENTID		= 0x1812,
862 	WMI_SET_WORK_MODE_DONE_EVENTID		= 0x1815,
863 	WMI_LO_LEAKAGE_CALIB_DONE_EVENTID	= 0x1816,
864 	WMI_MARLON_R_READ_DONE_EVENTID		= 0x1818,
865 	WMI_MARLON_R_WRITE_DONE_EVENTID		= 0x1819,
866 	WMI_MARLON_R_TXRX_SEL_DONE_EVENTID	= 0x181a,
867 	WMI_SILENT_RSSI_CALIB_DONE_EVENTID	= 0x181d,
868 	WMI_RF_RX_TEST_DONE_EVENTID		= 0x181e,
869 	WMI_CFG_RX_CHAIN_DONE_EVENTID		= 0x1820,
870 	WMI_VRING_CFG_DONE_EVENTID		= 0x1821,
871 	WMI_BA_STATUS_EVENTID			= 0x1823,
872 	WMI_RCP_ADDBA_REQ_EVENTID		= 0x1824,
873 	WMI_ADDBA_RESP_SENT_EVENTID		= 0x1825,
874 	WMI_DELBA_EVENTID			= 0x1826,
875 	WMI_GET_SSID_EVENTID			= 0x1828,
876 	WMI_GET_PCP_CHANNEL_EVENTID		= 0x182a,
877 	WMI_SW_TX_COMPLETE_EVENTID		= 0x182b,
878 
879 	WMI_READ_MAC_RXQ_EVENTID		= 0x1830,
880 	WMI_READ_MAC_TXQ_EVENTID		= 0x1831,
881 	WMI_WRITE_MAC_RXQ_EVENTID		= 0x1832,
882 	WMI_WRITE_MAC_TXQ_EVENTID		= 0x1833,
883 	WMI_WRITE_MAC_XQ_FIELD_EVENTID		= 0x1834,
884 
885 	WMI_BEAFORMING_MGMT_DONE_EVENTID	= 0x1836,
886 	WMI_BF_TXSS_MGMT_DONE_EVENTID		= 0x1837,
887 	WMI_BF_RXSS_MGMT_DONE_EVENTID		= 0x1839,
888 	WMI_RS_MGMT_DONE_EVENTID		= 0x1852,
889 	WMI_RF_MGMT_STATUS_EVENTID		= 0x1853,
890 	WMI_THERMAL_THROTTLING_STATUS_EVENTID	= 0x1855,
891 	WMI_BF_SM_MGMT_DONE_EVENTID		= 0x1838,
892 	WMI_RX_MGMT_PACKET_EVENTID		= 0x1840,
893 	WMI_TX_MGMT_PACKET_EVENTID		= 0x1841,
894 
895 	/* Performance monitoring events */
896 	WMI_DATA_PORT_OPEN_EVENTID		= 0x1860,
897 	WMI_WBE_LINKDOWN_EVENTID		= 0x1861,
898 
899 	WMI_BF_CTRL_DONE_EVENTID		= 0x1862,
900 	WMI_NOTIFY_REQ_DONE_EVENTID		= 0x1863,
901 	WMI_GET_STATUS_DONE_EVENTID		= 0x1864,
902 
903 	WMI_UNIT_TEST_EVENTID			= 0x1900,
904 	WMI_FLASH_READ_DONE_EVENTID		= 0x1902,
905 	WMI_FLASH_WRITE_DONE_EVENTID		= 0x1903,
906 	/*P2P*/
907 	WMI_P2P_CFG_DONE_EVENTID		= 0x1910,
908 	WMI_PORT_ALLOCATED_EVENTID		= 0x1911,
909 	WMI_PORT_DELETED_EVENTID		= 0x1912,
910 	WMI_LISTEN_STARTED_EVENTID		= 0x1914,
911 	WMI_SEARCH_STARTED_EVENTID		= 0x1915,
912 	WMI_DISCOVERY_STARTED_EVENTID		= 0x1916,
913 	WMI_DISCOVERY_STOPPED_EVENTID		= 0x1917,
914 	WMI_PCP_STARTED_EVENTID			= 0x1918,
915 	WMI_PCP_STOPPED_EVENTID			= 0x1919,
916 	WMI_PCP_FACTOR_EVENTID			= 0x191a,
917 	WMI_SET_CHANNEL_EVENTID			= 0x9000,
918 	WMI_ASSOC_REQ_EVENTID			= 0x9001,
919 	WMI_EAPOL_RX_EVENTID			= 0x9002,
920 	WMI_MAC_ADDR_RESP_EVENTID		= 0x9003,
921 	WMI_FW_VER_EVENTID			= 0x9004,
922 };
923 
924 /*
925  * Events data structures
926  */
927 
928 enum wmi_fw_status {
929 	WMI_FW_STATUS_SUCCESS,
930 	WMI_FW_STATUS_FAILURE,
931 };
932 
933 /*
934  * WMI_RF_MGMT_STATUS_EVENTID
935  */
936 enum wmi_rf_status {
937 	WMI_RF_ENABLED			= 0,
938 	WMI_RF_DISABLED_HW		= 1,
939 	WMI_RF_DISABLED_SW		= 2,
940 	WMI_RF_DISABLED_HW_SW		= 3,
941 };
942 
943 struct wmi_rf_mgmt_status_event {
944 	__le32 rf_status;
945 } __packed;
946 
947 /*
948  * WMI_THERMAL_THROTTLING_STATUS_EVENTID
949  */
950 struct wmi_thermal_throttling_status_event {
951 	__le32 time_on_usec;
952 	__le32 time_off_usec;
953 	__le32 max_txop_length_usec;
954 } __packed;
955 
956 /*
957  * WMI_GET_STATUS_DONE_EVENTID
958  */
959 struct wmi_get_status_done_event {
960 	__le32 is_associated;
961 	u8 cid;
962 	u8 reserved0[3];
963 	u8 bssid[WMI_MAC_LEN];
964 	u8 channel;
965 	u8 reserved1;
966 	u8 network_type;
967 	u8 reserved2[3];
968 	__le32 ssid_len;
969 	u8 ssid[WMI_MAX_SSID_LEN];
970 	__le32 rf_status;
971 	__le32 is_secured;
972 } __packed;
973 
974 /*
975  * WMI_FW_VER_EVENTID
976  */
977 struct wmi_fw_ver_event {
978 	u8 major;
979 	u8 minor;
980 	__le16 subminor;
981 	__le16 build;
982 } __packed;
983 
984 /*
985 * WMI_MAC_ADDR_RESP_EVENTID
986 */
987 struct wmi_mac_addr_resp_event {
988 	u8 mac[WMI_MAC_LEN];
989 	u8 auth_mode;
990 	u8 crypt_mode;
991 	__le32 offload_mode;
992 } __packed;
993 
994 /*
995 * WMI_EAPOL_RX_EVENTID
996 */
997 struct wmi_eapol_rx_event {
998 	u8 src_mac[WMI_MAC_LEN];
999 	__le16 eapol_len;
1000 	u8 eapol[0];
1001 } __packed;
1002 
1003 /*
1004 * WMI_READY_EVENTID
1005 */
1006 enum wmi_phy_capability {
1007 	WMI_11A_CAPABILITY		= 1,
1008 	WMI_11G_CAPABILITY		= 2,
1009 	WMI_11AG_CAPABILITY		= 3,
1010 	WMI_11NA_CAPABILITY		= 4,
1011 	WMI_11NG_CAPABILITY		= 5,
1012 	WMI_11NAG_CAPABILITY		= 6,
1013 	WMI_11AD_CAPABILITY		= 7,
1014 	WMI_11N_CAPABILITY_OFFSET = WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY,
1015 };
1016 
1017 struct wmi_ready_event {
1018 	__le32 sw_version;
1019 	__le32 abi_version;
1020 	u8 mac[WMI_MAC_LEN];
1021 	u8 phy_capability;		/* enum wmi_phy_capability */
1022 	u8 numof_additional_mids;
1023 } __packed;
1024 
1025 /*
1026  * WMI_NOTIFY_REQ_DONE_EVENTID
1027  */
1028 struct wmi_notify_req_done_event {
1029 	__le32 status; /* beamforming status, 0: fail; 1: OK; 2: retrying */
1030 	__le64 tsf;
1031 	__le32 snr_val;
1032 	__le32 tx_tpt;
1033 	__le32 tx_goodput;
1034 	__le32 rx_goodput;
1035 	__le16 bf_mcs;
1036 	__le16 my_rx_sector;
1037 	__le16 my_tx_sector;
1038 	__le16 other_rx_sector;
1039 	__le16 other_tx_sector;
1040 	__le16 range;
1041 	u8 sqi;
1042 	u8 reserved[3];
1043 } __packed;
1044 
1045 /*
1046  * WMI_CONNECT_EVENTID
1047  */
1048 struct wmi_connect_event {
1049 	u8 channel;
1050 	u8 reserved0;
1051 	u8 bssid[WMI_MAC_LEN];
1052 	__le16 listen_interval;
1053 	__le16 beacon_interval;
1054 	u8 network_type;
1055 	u8 reserved1[3];
1056 	u8 beacon_ie_len;
1057 	u8 assoc_req_len;
1058 	u8 assoc_resp_len;
1059 	u8 cid;
1060 	u8 reserved2[3];
1061 	u8 assoc_info[0];
1062 } __packed;
1063 
1064 /*
1065  * WMI_DISCONNECT_EVENTID
1066  */
1067 enum wmi_disconnect_reason {
1068 	WMI_DIS_REASON_NO_NETWORK_AVAIL		= 1,
1069 	WMI_DIS_REASON_LOST_LINK		= 2, /* bmiss */
1070 	WMI_DIS_REASON_DISCONNECT_CMD		= 3,
1071 	WMI_DIS_REASON_BSS_DISCONNECTED		= 4,
1072 	WMI_DIS_REASON_AUTH_FAILED		= 5,
1073 	WMI_DIS_REASON_ASSOC_FAILED		= 6,
1074 	WMI_DIS_REASON_NO_RESOURCES_AVAIL	= 7,
1075 	WMI_DIS_REASON_CSERV_DISCONNECT		= 8,
1076 	WMI_DIS_REASON_INVALID_PROFILE		= 10,
1077 	WMI_DIS_REASON_DOT11H_CHANNEL_SWITCH	= 11,
1078 	WMI_DIS_REASON_PROFILE_MISMATCH		= 12,
1079 	WMI_DIS_REASON_CONNECTION_EVICTED	= 13,
1080 	WMI_DIS_REASON_IBSS_MERGE		= 14,
1081 };
1082 
1083 struct wmi_disconnect_event {
1084 	__le16 protocol_reason_status;	/* reason code, see 802.11 spec. */
1085 	u8 bssid[WMI_MAC_LEN];		/* set if known */
1086 	u8 disconnect_reason;		/* see wmi_disconnect_reason */
1087 	u8 assoc_resp_len;	/* not used */
1088 	u8 assoc_info[0];	/* not used */
1089 } __packed;
1090 
1091 /*
1092  * WMI_SCAN_COMPLETE_EVENTID
1093  */
1094 enum scan_status {
1095 	WMI_SCAN_SUCCESS	= 0,
1096 	WMI_SCAN_FAILED		= 1,
1097 	WMI_SCAN_ABORTED	= 2,
1098 	WMI_SCAN_REJECTED	= 3,
1099 };
1100 
1101 struct wmi_scan_complete_event {
1102 	__le32 status;	/* scan_status */
1103 } __packed;
1104 
1105 /*
1106  * WMI_BA_STATUS_EVENTID
1107  */
1108 enum wmi_vring_ba_status {
1109 	WMI_BA_AGREED			= 0,
1110 	WMI_BA_NON_AGREED		= 1,
1111 	/* BA_EN in middle of teardown flow */
1112 	WMI_BA_TD_WIP			= 2,
1113 	/* BA_DIS or BA_EN in middle of BA SETUP flow */
1114 	WMI_BA_SETUP_WIP		= 3,
1115 	/* BA_EN when the BA session is already active */
1116 	WMI_BA_SESSION_ACTIVE		= 4,
1117 	/* BA_DIS when the BA session is not active */
1118 	WMI_BA_SESSION_NOT_ACTIVE	= 5,
1119 };
1120 
1121 struct wmi_vring_ba_status_event {
1122 	__le16 status; /* enum wmi_vring_ba_status */
1123 	u8 reserved[2];
1124 	u8 ringid;
1125 	u8 agg_wsize;
1126 	__le16 ba_timeout;
1127 	u8 amsdu;
1128 } __packed;
1129 
1130 /*
1131  * WMI_DELBA_EVENTID
1132  */
1133 struct wmi_delba_event {
1134 	u8 cidxtid;
1135 	u8 from_initiator;
1136 	__le16 reason;
1137 } __packed;
1138 
1139 /*
1140  * WMI_VRING_CFG_DONE_EVENTID
1141  */
1142 struct wmi_vring_cfg_done_event {
1143 	u8 ringid;
1144 	u8 status;
1145 	u8 reserved[2];
1146 	__le32 tx_vring_tail_ptr;
1147 } __packed;
1148 
1149 /*
1150  * WMI_ADDBA_RESP_SENT_EVENTID
1151  */
1152 struct wmi_rcp_addba_resp_sent_event {
1153 	u8 cidxtid;
1154 	u8 reserved;
1155 	__le16 status;
1156 } __packed;
1157 
1158 /*
1159  * WMI_RCP_ADDBA_REQ_EVENTID
1160  */
1161 struct wmi_rcp_addba_req_event {
1162 	u8 cidxtid;
1163 	u8 dialog_token;
1164 	__le16 ba_param_set;	/* ieee80211_ba_parameterset as it received */
1165 	__le16 ba_timeout;
1166 	__le16 ba_seq_ctrl;	/* ieee80211_ba_seqstrl field as it received */
1167 } __packed;
1168 
1169 /*
1170  * WMI_CFG_RX_CHAIN_DONE_EVENTID
1171  */
1172 enum wmi_cfg_rx_chain_done_event_status {
1173 	WMI_CFG_RX_CHAIN_SUCCESS	= 1,
1174 };
1175 
1176 struct wmi_cfg_rx_chain_done_event {
1177 	__le32 rx_ring_tail_ptr;	/* Rx V-Ring Tail pointer */
1178 	__le32 status;
1179 } __packed;
1180 
1181 /*
1182  * WMI_WBE_LINKDOWN_EVENTID
1183  */
1184 enum wmi_wbe_link_down_event_reason {
1185 	WMI_WBE_REASON_USER_REQUEST	= 0,
1186 	WMI_WBE_REASON_RX_DISASSOC	= 1,
1187 	WMI_WBE_REASON_BAD_PHY_LINK	= 2,
1188 };
1189 
1190 struct wmi_wbe_link_down_event {
1191 	u8 cid;
1192 	u8 reserved[3];
1193 	__le32 reason;
1194 } __packed;
1195 
1196 /*
1197  * WMI_DATA_PORT_OPEN_EVENTID
1198  */
1199 struct wmi_data_port_open_event {
1200 	u8 cid;
1201 	u8 reserved[3];
1202 } __packed;
1203 
1204 /*
1205  * WMI_GET_PCP_CHANNEL_EVENTID
1206  */
1207 struct wmi_get_pcp_channel_event {
1208 	u8 channel;
1209 	u8 reserved[3];
1210 } __packed;
1211 
1212 /*
1213  * WMI_P2P_CFG_DONE_EVENTID
1214  */
1215 struct wmi_p2p_cfg_done_event {
1216 	u8 status;	/* wmi_fw_status */
1217 	u8 reserved[3];
1218 } __packed;
1219 
1220 /*
1221 * WMI_PORT_ALLOCATED_EVENTID
1222 */
1223 struct wmi_port_allocated_event {
1224 	u8 status;	/* wmi_fw_status */
1225 	u8 reserved[3];
1226 } __packed;
1227 
1228 /*
1229 * WMI_PORT_DELETED_EVENTID
1230 */
1231 struct wmi_port_deleted_event {
1232 	u8 status;	/* wmi_fw_status */
1233 	u8 reserved[3];
1234 } __packed;
1235 
1236 /*
1237  * WMI_LISTEN_STARTED_EVENTID
1238  */
1239 struct wmi_listen_started_event {
1240 	u8 status;	/* wmi_fw_status */
1241 	u8 reserved[3];
1242 } __packed;
1243 
1244 /*
1245  * WMI_SEARCH_STARTED_EVENTID
1246  */
1247 struct wmi_search_started_event {
1248 	u8 status;	/* wmi_fw_status */
1249 	u8 reserved[3];
1250 } __packed;
1251 
1252 /*
1253  * WMI_PCP_STARTED_EVENTID
1254  */
1255 struct wmi_pcp_started_event {
1256 	u8 status;	/* wmi_fw_status */
1257 	u8 reserved[3];
1258 } __packed;
1259 
1260 /*
1261  * WMI_PCP_FACTOR_EVENTID
1262  */
1263 struct wmi_pcp_factor_event {
1264 	__le32 pcp_factor;
1265 } __packed;
1266 
1267 /*
1268  * WMI_SW_TX_COMPLETE_EVENTID
1269  */
1270 enum wmi_sw_tx_status {
1271 	WMI_TX_SW_STATUS_SUCCESS		= 0,
1272 	WMI_TX_SW_STATUS_FAILED_NO_RESOURCES	= 1,
1273 	WMI_TX_SW_STATUS_FAILED_TX		= 2,
1274 };
1275 
1276 struct wmi_sw_tx_complete_event {
1277 	u8 status;	/* enum wmi_sw_tx_status */
1278 	u8 reserved[3];
1279 } __packed;
1280 
1281 /*
1282  * WMI_CORR_MEASURE_EVENTID
1283  */
1284 struct wmi_corr_measure_event {
1285 	s32 i;
1286 	s32 q;
1287 	s32 image_i;
1288 	s32 image_q;
1289 } __packed;
1290 
1291 /*
1292  * WMI_READ_RSSI_EVENTID
1293  */
1294 struct wmi_read_rssi_event {
1295 	__le32 ina_rssi_adc_dbm;
1296 } __packed;
1297 
1298 /*
1299  * WMI_GET_SSID_EVENTID
1300  */
1301 struct wmi_get_ssid_event {
1302 	__le32 ssid_len;
1303 	u8 ssid[WMI_MAX_SSID_LEN];
1304 } __packed;
1305 
1306 /*
1307  * WMI_RX_MGMT_PACKET_EVENTID
1308  */
1309 struct wmi_rx_mgmt_info {
1310 	u8 mcs;
1311 	s8 snr;
1312 	u8 range;
1313 	u8 sqi;
1314 	__le16 stype;
1315 	__le16 status;
1316 	__le32 len;
1317 	u8 qid;
1318 	u8 mid;
1319 	u8 cid;
1320 	u8 channel;	/* From Radio MNGR */
1321 } __packed;
1322 
1323 /*
1324  * WMI_TX_MGMT_PACKET_EVENTID
1325  */
1326 struct wmi_tx_mgmt_packet_event {
1327 	u8 payload[0];
1328 } __packed;
1329 
1330 struct wmi_rx_mgmt_packet_event {
1331 	struct wmi_rx_mgmt_info info;
1332 	u8 payload[0];
1333 } __packed;
1334 
1335 /*
1336  * WMI_ECHO_RSP_EVENTID
1337  */
1338 struct wmi_echo_event {
1339 	__le32 echoed_value;
1340 } __packed;
1341 
1342 /*
1343  * WMI_TEMP_SENSE_DONE_EVENTID
1344  *
1345  * Measure MAC and radio temperatures
1346  */
1347 struct wmi_temp_sense_done_event {
1348 	__le32 baseband_t1000;
1349 	__le32 rf_t1000;
1350 } __packed;
1351 
1352 #endif /* __WILOCITY_WMI_H__ */
1353