1 /******************************************************************************
2  *
3  * This file is provided under a dual BSD/GPLv2 license.  When using or
4  * redistributing this file, you may do so under either license.
5  *
6  * GPL LICENSE SUMMARY
7  *
8  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of version 2 of the GNU General Public License as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24  * USA
25  *
26  * The full GNU General Public License is included in this distribution
27  * in the file called COPYING.
28  *
29  * Contact Information:
30  *  Intel Linux Wireless <linuxwifi@intel.com>
31  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32  *
33  * BSD LICENSE
34  *
35  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
37  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions
42  * are met:
43  *
44  *  * Redistributions of source code must retain the above copyright
45  *    notice, this list of conditions and the following disclaimer.
46  *  * Redistributions in binary form must reproduce the above copyright
47  *    notice, this list of conditions and the following disclaimer in
48  *    the documentation and/or other materials provided with the
49  *    distribution.
50  *  * Neither the name Intel Corporation nor the names of its
51  *    contributors may be used to endorse or promote products derived
52  *    from this software without specific prior written permission.
53  *
54  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65  *
66  *****************************************************************************/
67 
68 #ifndef __fw_api_h__
69 #define __fw_api_h__
70 
71 #include "fw-api-rs.h"
72 #include "fw-api-rx.h"
73 #include "fw-api-tx.h"
74 #include "fw-api-sta.h"
75 #include "fw-api-mac.h"
76 #include "fw-api-power.h"
77 #include "fw-api-d3.h"
78 #include "fw-api-coex.h"
79 #include "fw-api-scan.h"
80 #include "fw-api-stats.h"
81 #include "fw-api-tof.h"
82 
83 /* Tx queue numbers for non-DQA mode */
84 enum {
85 	IWL_MVM_OFFCHANNEL_QUEUE = 8,
86 	IWL_MVM_CMD_QUEUE = 9,
87 };
88 
89 /*
90  * DQA queue numbers
91  *
92  * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW
93  * @IWL_MVM_DQA_AUX_QUEUE: a queue reserved for aux frames
94  * @IWL_MVM_DQA_P2P_DEVICE_QUEUE: a queue reserved for P2P device frames
95  * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames
96  * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure
97  *	that we are never left without the possibility to connect to an AP.
98  * @IWL_MVM_DQA_MIN_MGMT_QUEUE: first TXQ in pool for MGMT and non-QOS frames.
99  *	Each MGMT queue is mapped to a single STA
100  *	MGMT frames are frames that return true on ieee80211_is_mgmt()
101  * @IWL_MVM_DQA_MAX_MGMT_QUEUE: last TXQ in pool for MGMT frames
102  * @IWL_MVM_DQA_AP_PROBE_RESP_QUEUE: a queue reserved for P2P GO/SoftAP probe
103  *	responses
104  * @IWL_MVM_DQA_MIN_DATA_QUEUE: first TXQ in pool for DATA frames.
105  *	DATA frames are intended for !ieee80211_is_mgmt() frames, but if
106  *	the MGMT TXQ pool is exhausted, mgmt frames can be sent on DATA queues
107  *	as well
108  * @IWL_MVM_DQA_MAX_DATA_QUEUE: last TXQ in pool for DATA frames
109  */
110 enum iwl_mvm_dqa_txq {
111 	IWL_MVM_DQA_CMD_QUEUE = 0,
112 	IWL_MVM_DQA_AUX_QUEUE = 1,
113 	IWL_MVM_DQA_P2P_DEVICE_QUEUE = 2,
114 	IWL_MVM_DQA_GCAST_QUEUE = 3,
115 	IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4,
116 	IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
117 	IWL_MVM_DQA_MAX_MGMT_QUEUE = 8,
118 	IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9,
119 	IWL_MVM_DQA_MIN_DATA_QUEUE = 10,
120 	IWL_MVM_DQA_MAX_DATA_QUEUE = 31,
121 };
122 
123 enum iwl_mvm_tx_fifo {
124 	IWL_MVM_TX_FIFO_BK = 0,
125 	IWL_MVM_TX_FIFO_BE,
126 	IWL_MVM_TX_FIFO_VI,
127 	IWL_MVM_TX_FIFO_VO,
128 	IWL_MVM_TX_FIFO_MCAST = 5,
129 	IWL_MVM_TX_FIFO_CMD = 7,
130 };
131 
132 
133 /**
134  * enum iwl_legacy_cmds - legacy group command IDs
135  */
136 enum iwl_legacy_cmds {
137 	/**
138 	 * @MVM_ALIVE:
139 	 * Alive data from the firmware, as described in
140 	 * &struct mvm_alive_resp_v3 or &struct mvm_alive_resp.
141 	 */
142 	MVM_ALIVE = 0x1,
143 
144 	/**
145 	 * @REPLY_ERROR: Cause an error in the firmware, for testing purposes.
146 	 */
147 	REPLY_ERROR = 0x2,
148 
149 	/**
150 	 * @ECHO_CMD: Send data to the device to have it returned immediately.
151 	 */
152 	ECHO_CMD = 0x3,
153 
154 	/**
155 	 * @INIT_COMPLETE_NOTIF: Notification that initialization is complete.
156 	 */
157 	INIT_COMPLETE_NOTIF = 0x4,
158 
159 	/**
160 	 * @PHY_CONTEXT_CMD:
161 	 * Add/modify/remove a PHY context, using &struct iwl_phy_context_cmd.
162 	 */
163 	PHY_CONTEXT_CMD = 0x8,
164 
165 	/**
166 	 * @DBG_CFG: Debug configuration command.
167 	 */
168 	DBG_CFG = 0x9,
169 
170 	/**
171 	 * @ANTENNA_COUPLING_NOTIFICATION:
172 	 * Antenna coupling data, &struct iwl_mvm_antenna_coupling_notif
173 	 */
174 	ANTENNA_COUPLING_NOTIFICATION = 0xa,
175 
176 	/**
177 	 * @SCAN_ITERATION_COMPLETE_UMAC:
178 	 * Firmware indicates a scan iteration completed, using
179 	 * &struct iwl_umac_scan_iter_complete_notif.
180 	 */
181 	SCAN_ITERATION_COMPLETE_UMAC = 0xb5,
182 
183 	/**
184 	 * @SCAN_CFG_CMD:
185 	 * uses &struct iwl_scan_config_v1 or &struct iwl_scan_config
186 	 */
187 	SCAN_CFG_CMD = 0xc,
188 
189 	/**
190 	 * @SCAN_REQ_UMAC: uses &struct iwl_scan_req_umac
191 	 */
192 	SCAN_REQ_UMAC = 0xd,
193 
194 	/**
195 	 * @SCAN_ABORT_UMAC: uses &struct iwl_umac_scan_abort
196 	 */
197 	SCAN_ABORT_UMAC = 0xe,
198 
199 	/**
200 	 * @SCAN_COMPLETE_UMAC: uses &struct iwl_umac_scan_complete
201 	 */
202 	SCAN_COMPLETE_UMAC = 0xf,
203 
204 	/**
205 	 * @BA_WINDOW_STATUS_NOTIFICATION_ID:
206 	 * uses &struct iwl_ba_window_status_notif
207 	 */
208 	BA_WINDOW_STATUS_NOTIFICATION_ID = 0x13,
209 
210 	/**
211 	 * @ADD_STA_KEY:
212 	 * &struct iwl_mvm_add_sta_key_cmd_v1 or
213 	 * &struct iwl_mvm_add_sta_key_cmd.
214 	 */
215 	ADD_STA_KEY = 0x17,
216 
217 	/**
218 	 * @ADD_STA:
219 	 * &struct iwl_mvm_add_sta_cmd or &struct iwl_mvm_add_sta_cmd_v7.
220 	 */
221 	ADD_STA = 0x18,
222 
223 	/**
224 	 * @REMOVE_STA: &struct iwl_mvm_rm_sta_cmd
225 	 */
226 	REMOVE_STA = 0x19,
227 
228 	/**
229 	 * @FW_GET_ITEM_CMD: uses &struct iwl_fw_get_item_cmd
230 	 */
231 	FW_GET_ITEM_CMD = 0x1a,
232 
233 	/**
234 	 * @TX_CMD: uses &struct iwl_tx_cmd or &struct iwl_tx_cmd_gen2,
235 	 *	response in &struct iwl_mvm_tx_resp or
236 	 *	&struct iwl_mvm_tx_resp_v3
237 	 */
238 	TX_CMD = 0x1c,
239 
240 	/**
241 	 * @TXPATH_FLUSH: &struct iwl_tx_path_flush_cmd
242 	 */
243 	TXPATH_FLUSH = 0x1e,
244 
245 	/**
246 	 * @MGMT_MCAST_KEY:
247 	 * &struct iwl_mvm_mgmt_mcast_key_cmd or
248 	 * &struct iwl_mvm_mgmt_mcast_key_cmd_v1
249 	 */
250 	MGMT_MCAST_KEY = 0x1f,
251 
252 	/* scheduler config */
253 	/**
254 	 * @SCD_QUEUE_CFG: &struct iwl_scd_txq_cfg_cmd for older hardware,
255 	 *	&struct iwl_tx_queue_cfg_cmd with &struct iwl_tx_queue_cfg_rsp
256 	 *	for newer (A000) hardware.
257 	 */
258 	SCD_QUEUE_CFG = 0x1d,
259 
260 	/**
261 	 * @WEP_KEY: uses &struct iwl_mvm_wep_key_cmd
262 	 */
263 	WEP_KEY = 0x20,
264 
265 	/**
266 	 * @SHARED_MEM_CFG:
267 	 * retrieve shared memory configuration - response in
268 	 * &struct iwl_shared_mem_cfg
269 	 */
270 	SHARED_MEM_CFG = 0x25,
271 
272 	/**
273 	 * @TDLS_CHANNEL_SWITCH_CMD: uses &struct iwl_tdls_channel_switch_cmd
274 	 */
275 	TDLS_CHANNEL_SWITCH_CMD = 0x27,
276 
277 	/**
278 	 * @TDLS_CHANNEL_SWITCH_NOTIFICATION:
279 	 * uses &struct iwl_tdls_channel_switch_notif
280 	 */
281 	TDLS_CHANNEL_SWITCH_NOTIFICATION = 0xaa,
282 
283 	/**
284 	 * @TDLS_CONFIG_CMD:
285 	 * &struct iwl_tdls_config_cmd, response in &struct iwl_tdls_config_res
286 	 */
287 	TDLS_CONFIG_CMD = 0xa7,
288 
289 	/**
290 	 * @MAC_CONTEXT_CMD: &struct iwl_mac_ctx_cmd
291 	 */
292 	MAC_CONTEXT_CMD = 0x28,
293 
294 	/**
295 	 * @TIME_EVENT_CMD:
296 	 * &struct iwl_time_event_cmd, response in &struct iwl_time_event_resp
297 	 */
298 	TIME_EVENT_CMD = 0x29, /* both CMD and response */
299 
300 	/**
301 	 * @TIME_EVENT_NOTIFICATION: &struct iwl_time_event_notif
302 	 */
303 	TIME_EVENT_NOTIFICATION = 0x2a,
304 
305 	/**
306 	 * @BINDING_CONTEXT_CMD:
307 	 * &struct iwl_binding_cmd or &struct iwl_binding_cmd_v1
308 	 */
309 	BINDING_CONTEXT_CMD = 0x2b,
310 
311 	/**
312 	 * @TIME_QUOTA_CMD: &struct iwl_time_quota_cmd
313 	 */
314 	TIME_QUOTA_CMD = 0x2c,
315 
316 	/**
317 	 * @NON_QOS_TX_COUNTER_CMD:
318 	 * command is &struct iwl_nonqos_seq_query_cmd
319 	 */
320 	NON_QOS_TX_COUNTER_CMD = 0x2d,
321 
322 	/**
323 	 * @LQ_CMD: using &struct iwl_lq_cmd
324 	 */
325 	LQ_CMD = 0x4e,
326 
327 	/**
328 	 * @FW_PAGING_BLOCK_CMD:
329 	 * &struct iwl_fw_paging_cmd
330 	 */
331 	FW_PAGING_BLOCK_CMD = 0x4f,
332 
333 	/**
334 	 * @SCAN_OFFLOAD_REQUEST_CMD: uses &struct iwl_scan_req_lmac
335 	 */
336 	SCAN_OFFLOAD_REQUEST_CMD = 0x51,
337 
338 	/**
339 	 * @SCAN_OFFLOAD_ABORT_CMD: abort the scan - no further contents
340 	 */
341 	SCAN_OFFLOAD_ABORT_CMD = 0x52,
342 
343 	/**
344 	 * @HOT_SPOT_CMD: uses &struct iwl_hs20_roc_req
345 	 */
346 	HOT_SPOT_CMD = 0x53,
347 
348 	/**
349 	 * @SCAN_OFFLOAD_COMPLETE:
350 	 * notification, &struct iwl_periodic_scan_complete
351 	 */
352 	SCAN_OFFLOAD_COMPLETE = 0x6D,
353 
354 	/**
355 	 * @SCAN_OFFLOAD_UPDATE_PROFILES_CMD:
356 	 * update scan offload (scheduled scan) profiles/blacklist/etc.
357 	 */
358 	SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
359 
360 	/**
361 	 * @MATCH_FOUND_NOTIFICATION: scan match found
362 	 */
363 	MATCH_FOUND_NOTIFICATION = 0xd9,
364 
365 	/**
366 	 * @SCAN_ITERATION_COMPLETE:
367 	 * uses &struct iwl_lmac_scan_complete_notif
368 	 */
369 	SCAN_ITERATION_COMPLETE = 0xe7,
370 
371 	/* Phy */
372 	/**
373 	 * @PHY_CONFIGURATION_CMD: &struct iwl_phy_cfg_cmd
374 	 */
375 	PHY_CONFIGURATION_CMD = 0x6a,
376 
377 	/**
378 	 * @CALIB_RES_NOTIF_PHY_DB: &struct iwl_calib_res_notif_phy_db
379 	 */
380 	CALIB_RES_NOTIF_PHY_DB = 0x6b,
381 
382 	/**
383 	 * @PHY_DB_CMD: &struct iwl_phy_db_cmd
384 	 */
385 	PHY_DB_CMD = 0x6c,
386 
387 	/**
388 	 * @TOF_CMD: &struct iwl_tof_config_cmd
389 	 */
390 	TOF_CMD = 0x10,
391 
392 	/**
393 	 * @TOF_NOTIFICATION: &struct iwl_tof_gen_resp_cmd
394 	 */
395 	TOF_NOTIFICATION = 0x11,
396 
397 	/**
398 	 * @POWER_TABLE_CMD: &struct iwl_device_power_cmd
399 	 */
400 	POWER_TABLE_CMD = 0x77,
401 
402 	/**
403 	 * @PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION:
404 	 * &struct iwl_uapsd_misbehaving_ap_notif
405 	 */
406 	PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
407 
408 	/**
409 	 * @LTR_CONFIG: &struct iwl_ltr_config_cmd
410 	 */
411 	LTR_CONFIG = 0xee,
412 
413 	/**
414 	 * @REPLY_THERMAL_MNG_BACKOFF:
415 	 * Thermal throttling command
416 	 */
417 	REPLY_THERMAL_MNG_BACKOFF = 0x7e,
418 
419 	/**
420 	 * @DC2DC_CONFIG_CMD:
421 	 * Set/Get DC2DC frequency tune
422 	 * Command is &struct iwl_dc2dc_config_cmd,
423 	 * response is &struct iwl_dc2dc_config_resp
424 	 */
425 	DC2DC_CONFIG_CMD = 0x83,
426 
427 	/**
428 	 * @NVM_ACCESS_CMD: using &struct iwl_nvm_access_cmd
429 	 */
430 	NVM_ACCESS_CMD = 0x88,
431 
432 	/**
433 	 * @BEACON_NOTIFICATION: &struct iwl_extended_beacon_notif
434 	 */
435 	BEACON_NOTIFICATION = 0x90,
436 
437 	/**
438 	 * @BEACON_TEMPLATE_CMD:
439 	 *	Uses one of &struct iwl_mac_beacon_cmd_v6,
440 	 *	&struct iwl_mac_beacon_cmd_v7 or &struct iwl_mac_beacon_cmd
441 	 *	depending on the device version.
442 	 */
443 	BEACON_TEMPLATE_CMD = 0x91,
444 	/**
445 	 * @TX_ANT_CONFIGURATION_CMD: &struct iwl_tx_ant_cfg_cmd
446 	 */
447 	TX_ANT_CONFIGURATION_CMD = 0x98,
448 
449 	/**
450 	 * @STATISTICS_CMD:
451 	 * one of &struct iwl_statistics_cmd,
452 	 * &struct iwl_notif_statistics_v11,
453 	 * &struct iwl_notif_statistics_v10,
454 	 * &struct iwl_notif_statistics_cdb
455 	 */
456 	STATISTICS_CMD = 0x9c,
457 
458 	/**
459 	 * @STATISTICS_NOTIFICATION:
460 	 * one of &struct iwl_notif_statistics_v10,
461 	 * &struct iwl_notif_statistics_v11,
462 	 * &struct iwl_notif_statistics_cdb
463 	 */
464 	STATISTICS_NOTIFICATION = 0x9d,
465 
466 	/**
467 	 * @EOSP_NOTIFICATION:
468 	 * Notify that a service period ended,
469 	 * &struct iwl_mvm_eosp_notification
470 	 */
471 	EOSP_NOTIFICATION = 0x9e,
472 
473 	/**
474 	 * @REDUCE_TX_POWER_CMD:
475 	 * &struct iwl_dev_tx_power_cmd_v3 or &struct iwl_dev_tx_power_cmd
476 	 */
477 	REDUCE_TX_POWER_CMD = 0x9f,
478 
479 	/**
480 	 * @CARD_STATE_NOTIFICATION:
481 	 * Card state (RF/CT kill) notification,
482 	 * uses &struct iwl_card_state_notif
483 	 */
484 	CARD_STATE_NOTIFICATION = 0xa1,
485 
486 	/**
487 	 * @MISSED_BEACONS_NOTIFICATION: &struct iwl_missed_beacons_notif
488 	 */
489 	MISSED_BEACONS_NOTIFICATION = 0xa2,
490 
491 	/**
492 	 * @MAC_PM_POWER_TABLE: using &struct iwl_mac_power_cmd
493 	 */
494 	MAC_PM_POWER_TABLE = 0xa9,
495 
496 	/**
497 	 * @MFUART_LOAD_NOTIFICATION: &struct iwl_mfuart_load_notif
498 	 */
499 	MFUART_LOAD_NOTIFICATION = 0xb1,
500 
501 	/**
502 	 * @RSS_CONFIG_CMD: &struct iwl_rss_config_cmd
503 	 */
504 	RSS_CONFIG_CMD = 0xb3,
505 
506 	/**
507 	 * @REPLY_RX_PHY_CMD: &struct iwl_rx_phy_info
508 	 */
509 	REPLY_RX_PHY_CMD = 0xc0,
510 
511 	/**
512 	 * @REPLY_RX_MPDU_CMD:
513 	 * &struct iwl_rx_mpdu_res_start or &struct iwl_rx_mpdu_desc
514 	 */
515 	REPLY_RX_MPDU_CMD = 0xc1,
516 
517 	/**
518 	 * @FRAME_RELEASE:
519 	 * Frame release (reorder helper) notification, uses
520 	 * &struct iwl_frame_release
521 	 */
522 	FRAME_RELEASE = 0xc3,
523 
524 	/**
525 	 * @BA_NOTIF:
526 	 * BlockAck notification, uses &struct iwl_mvm_compressed_ba_notif
527 	 * or &struct iwl_mvm_ba_notif depending on the HW
528 	 */
529 	BA_NOTIF = 0xc5,
530 
531 	/* Location Aware Regulatory */
532 	/**
533 	 * @MCC_UPDATE_CMD: using &struct iwl_mcc_update_cmd
534 	 */
535 	MCC_UPDATE_CMD = 0xc8,
536 
537 	/**
538 	 * @MCC_CHUB_UPDATE_CMD: using &struct iwl_mcc_chub_notif
539 	 */
540 	MCC_CHUB_UPDATE_CMD = 0xc9,
541 
542 	/**
543 	 * @MARKER_CMD: trace marker command, uses &struct iwl_mvm_marker
544 	 */
545 	MARKER_CMD = 0xcb,
546 
547 	/**
548 	 * @BT_PROFILE_NOTIFICATION: &struct iwl_bt_coex_profile_notif
549 	 */
550 	BT_PROFILE_NOTIFICATION = 0xce,
551 
552 	/**
553 	 * @BT_CONFIG: &struct iwl_bt_coex_cmd
554 	 */
555 	BT_CONFIG = 0x9b,
556 
557 	/**
558 	 * @BT_COEX_UPDATE_CORUN_LUT:
559 	 * &struct iwl_bt_coex_corun_lut_update_cmd
560 	 */
561 	BT_COEX_UPDATE_CORUN_LUT = 0x5b,
562 
563 	/**
564 	 * @BT_COEX_UPDATE_REDUCED_TXP:
565 	 * &struct iwl_bt_coex_reduced_txp_update_cmd
566 	 */
567 	BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
568 
569 	/**
570 	 * @BT_COEX_CI: &struct iwl_bt_coex_ci_cmd
571 	 */
572 	BT_COEX_CI = 0x5d,
573 
574 	/**
575 	 * @REPLY_SF_CFG_CMD: &struct iwl_sf_cfg_cmd
576 	 */
577 	REPLY_SF_CFG_CMD = 0xd1,
578 	/**
579 	 * @REPLY_BEACON_FILTERING_CMD: &struct iwl_beacon_filter_cmd
580 	 */
581 	REPLY_BEACON_FILTERING_CMD = 0xd2,
582 
583 	/**
584 	 * @DTS_MEASUREMENT_NOTIFICATION:
585 	 * &struct iwl_dts_measurement_notif_v1 or
586 	 * &struct iwl_dts_measurement_notif_v2
587 	 */
588 	DTS_MEASUREMENT_NOTIFICATION = 0xdd,
589 
590 	/**
591 	 * @LDBG_CONFIG_CMD: configure continuous trace recording
592 	 */
593 	LDBG_CONFIG_CMD = 0xf6,
594 
595 	/**
596 	 * @DEBUG_LOG_MSG: Debugging log data from firmware
597 	 */
598 	DEBUG_LOG_MSG = 0xf7,
599 
600 	/**
601 	 * @BCAST_FILTER_CMD: &struct iwl_bcast_filter_cmd
602 	 */
603 	BCAST_FILTER_CMD = 0xcf,
604 
605 	/**
606 	 * @MCAST_FILTER_CMD: &struct iwl_mcast_filter_cmd
607 	 */
608 	MCAST_FILTER_CMD = 0xd0,
609 
610 	/**
611 	 * @D3_CONFIG_CMD: &struct iwl_d3_manager_config
612 	 */
613 	D3_CONFIG_CMD = 0xd3,
614 
615 	/**
616 	 * @PROT_OFFLOAD_CONFIG_CMD: Depending on firmware, uses one of
617 	 * &struct iwl_proto_offload_cmd_v1, &struct iwl_proto_offload_cmd_v2,
618 	 * &struct iwl_proto_offload_cmd_v3_small,
619 	 * &struct iwl_proto_offload_cmd_v3_large
620 	 */
621 	PROT_OFFLOAD_CONFIG_CMD = 0xd4,
622 
623 	/**
624 	 * @OFFLOADS_QUERY_CMD:
625 	 * No data in command, response in &struct iwl_wowlan_status
626 	 */
627 	OFFLOADS_QUERY_CMD = 0xd5,
628 
629 	/**
630 	 * @REMOTE_WAKE_CONFIG_CMD: &struct iwl_wowlan_remote_wake_config
631 	 */
632 	REMOTE_WAKE_CONFIG_CMD = 0xd6,
633 
634 	/**
635 	 * @D0I3_END_CMD: End D0i3/D3 state, no command data
636 	 */
637 	D0I3_END_CMD = 0xed,
638 
639 	/**
640 	 * @WOWLAN_PATTERNS: &struct iwl_wowlan_patterns_cmd
641 	 */
642 	WOWLAN_PATTERNS = 0xe0,
643 
644 	/**
645 	 * @WOWLAN_CONFIGURATION: &struct iwl_wowlan_config_cmd
646 	 */
647 	WOWLAN_CONFIGURATION = 0xe1,
648 
649 	/**
650 	 * @WOWLAN_TSC_RSC_PARAM: &struct iwl_wowlan_rsc_tsc_params_cmd
651 	 */
652 	WOWLAN_TSC_RSC_PARAM = 0xe2,
653 
654 	/**
655 	 * @WOWLAN_TKIP_PARAM: &struct iwl_wowlan_tkip_params_cmd
656 	 */
657 	WOWLAN_TKIP_PARAM = 0xe3,
658 
659 	/**
660 	 * @WOWLAN_KEK_KCK_MATERIAL: &struct iwl_wowlan_kek_kck_material_cmd
661 	 */
662 	WOWLAN_KEK_KCK_MATERIAL = 0xe4,
663 
664 	/**
665 	 * @WOWLAN_GET_STATUSES: response in &struct iwl_wowlan_status
666 	 */
667 	WOWLAN_GET_STATUSES = 0xe5,
668 
669 	/**
670 	 * @SCAN_OFFLOAD_PROFILES_QUERY_CMD:
671 	 * No command data, response is &struct iwl_scan_offload_profiles_query
672 	 */
673 	SCAN_OFFLOAD_PROFILES_QUERY_CMD = 0x56,
674 };
675 
676 /* Please keep this enum *SORTED* by hex value.
677  * Needed for binary search, otherwise a warning will be triggered.
678  */
679 enum iwl_mac_conf_subcmd_ids {
680 	LINK_QUALITY_MEASUREMENT_CMD = 0x1,
681 	LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF = 0xFE,
682 	CHANNEL_SWITCH_NOA_NOTIF = 0xFF,
683 };
684 
685 /**
686  * enum iwl_phy_ops_subcmd_ids - PHY group commands
687  */
688 enum iwl_phy_ops_subcmd_ids {
689 	/**
690 	 * @CMD_DTS_MEASUREMENT_TRIGGER_WIDE:
691 	 * Uses either &struct iwl_dts_measurement_cmd or
692 	 * &struct iwl_ext_dts_measurement_cmd
693 	 */
694 	CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
695 
696 	/**
697 	 * @CTDP_CONFIG_CMD: &struct iwl_mvm_ctdp_cmd
698 	 */
699 	CTDP_CONFIG_CMD = 0x03,
700 
701 	/**
702 	 * @TEMP_REPORTING_THRESHOLDS_CMD: &struct temp_report_ths_cmd
703 	 */
704 	TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
705 
706 	/**
707 	 * @GEO_TX_POWER_LIMIT: &struct iwl_geo_tx_power_profiles_cmd
708 	 */
709 	GEO_TX_POWER_LIMIT = 0x05,
710 
711 	/**
712 	 * @CT_KILL_NOTIFICATION: &struct ct_kill_notif
713 	 */
714 	CT_KILL_NOTIFICATION = 0xFE,
715 
716 	/**
717 	 * @DTS_MEASUREMENT_NOTIF_WIDE:
718 	 * &struct iwl_dts_measurement_notif_v1 or
719 	 * &struct iwl_dts_measurement_notif_v2
720 	 */
721 	DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
722 };
723 
724 /**
725  * enum iwl_system_subcmd_ids - system group command IDs
726  */
727 enum iwl_system_subcmd_ids {
728 	/**
729 	 * @SHARED_MEM_CFG_CMD:
730 	 * response in &struct iwl_shared_mem_cfg or
731 	 * &struct iwl_shared_mem_cfg_v2
732 	 */
733 	SHARED_MEM_CFG_CMD = 0x0,
734 
735 	/**
736 	 * @INIT_EXTENDED_CFG_CMD: &struct iwl_init_extended_cfg_cmd
737 	 */
738 	INIT_EXTENDED_CFG_CMD = 0x03,
739 };
740 
741 /**
742  * enum iwl_data_path_subcmd_ids - data path group commands
743  */
744 enum iwl_data_path_subcmd_ids {
745 	/**
746 	 * @DQA_ENABLE_CMD: &struct iwl_dqa_enable_cmd
747 	 */
748 	DQA_ENABLE_CMD = 0x0,
749 
750 	/**
751 	 * @UPDATE_MU_GROUPS_CMD: &struct iwl_mu_group_mgmt_cmd
752 	 */
753 	UPDATE_MU_GROUPS_CMD = 0x1,
754 
755 	/**
756 	 * @TRIGGER_RX_QUEUES_NOTIF_CMD: &struct iwl_rxq_sync_cmd
757 	 */
758 	TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2,
759 
760 	/**
761 	 * @STA_PM_NOTIF: &struct iwl_mvm_pm_state_notification
762 	 */
763 	STA_PM_NOTIF = 0xFD,
764 
765 	/**
766 	 * @MU_GROUP_MGMT_NOTIF: &struct iwl_mu_group_mgmt_notif
767 	 */
768 	MU_GROUP_MGMT_NOTIF = 0xFE,
769 
770 	/**
771 	 * @RX_QUEUES_NOTIFICATION: &struct iwl_rxq_sync_notification
772 	 */
773 	RX_QUEUES_NOTIFICATION = 0xFF,
774 };
775 
776 /**
777  * enum iwl_prot_offload_subcmd_ids - protocol offload commands
778  */
779 enum iwl_prot_offload_subcmd_ids {
780 	/**
781 	 * @STORED_BEACON_NTF: &struct iwl_stored_beacon_notif
782 	 */
783 	STORED_BEACON_NTF = 0xFF,
784 };
785 
786 /**
787  * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands
788  */
789 enum iwl_regulatory_and_nvm_subcmd_ids {
790 	/**
791 	 * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd
792 	 */
793 	NVM_ACCESS_COMPLETE = 0x0,
794 
795 	/**
796 	 * @NVM_GET_INFO:
797 	 * Command is &struct iwl_nvm_get_info,
798 	 * response is &struct iwl_nvm_get_info_rsp
799 	 */
800 	NVM_GET_INFO = 0x2,
801 };
802 
803 /**
804  * enum iwl_debug_cmds - debug commands
805  */
806 enum iwl_debug_cmds {
807 	/**
808 	 * @LMAC_RD_WR:
809 	 * LMAC memory read/write, using &struct iwl_dbg_mem_access_cmd and
810 	 * &struct iwl_dbg_mem_access_rsp
811 	 */
812 	LMAC_RD_WR = 0x0,
813 	/**
814 	 * @UMAC_RD_WR:
815 	 * UMAC memory read/write, using &struct iwl_dbg_mem_access_cmd and
816 	 * &struct iwl_dbg_mem_access_rsp
817 	 */
818 	UMAC_RD_WR = 0x1,
819 	/**
820 	 * @MFU_ASSERT_DUMP_NTF:
821 	 * &struct iwl_mfu_assert_dump_notif
822 	 */
823 	MFU_ASSERT_DUMP_NTF = 0xFE,
824 };
825 
826 /**
827  * enum iwl_mvm_command_groups - command groups for the firmware
828  * @LEGACY_GROUP: legacy group, uses command IDs from &enum iwl_legacy_cmds
829  * @LONG_GROUP: legacy group with long header, also uses command IDs
830  *	from &enum iwl_legacy_cmds
831  * @SYSTEM_GROUP: system group, uses command IDs from
832  *	&enum iwl_system_subcmd_ids
833  * @MAC_CONF_GROUP: MAC configuration group, uses command IDs from
834  *	&enum iwl_mac_conf_subcmd_ids
835  * @PHY_OPS_GROUP: PHY operations group, uses command IDs from
836  *	&enum iwl_phy_ops_subcmd_ids
837  * @DATA_PATH_GROUP: data path group, uses command IDs from
838  *	&enum iwl_data_path_subcmd_ids
839  * @NAN_GROUP: NAN group, uses command IDs from &enum iwl_nan_subcmd_ids
840  * @TOF_GROUP: TOF group, uses command IDs from &enum iwl_tof_subcmd_ids
841  * @PROT_OFFLOAD_GROUP: protocol offload group, uses command IDs from
842  *	&enum iwl_prot_offload_subcmd_ids
843  * @REGULATORY_AND_NVM_GROUP: regulatory/NVM group, uses command IDs from
844  *	&enum iwl_regulatory_and_nvm_subcmd_ids
845  * @DEBUG_GROUP: Debug group, uses command IDs from &enum iwl_debug_cmds
846  */
847 enum iwl_mvm_command_groups {
848 	LEGACY_GROUP = 0x0,
849 	LONG_GROUP = 0x1,
850 	SYSTEM_GROUP = 0x2,
851 	MAC_CONF_GROUP = 0x3,
852 	PHY_OPS_GROUP = 0x4,
853 	DATA_PATH_GROUP = 0x5,
854 	PROT_OFFLOAD_GROUP = 0xb,
855 	REGULATORY_AND_NVM_GROUP = 0xc,
856 	DEBUG_GROUP = 0xf,
857 };
858 
859 /**
860  * struct iwl_cmd_response - generic response struct for most commands
861  * @status: status of the command asked, changes for each one
862  */
863 struct iwl_cmd_response {
864 	__le32 status;
865 };
866 
867 /*
868  * struct iwl_dqa_enable_cmd
869  * @cmd_queue: the TXQ number of the command queue
870  */
871 struct iwl_dqa_enable_cmd {
872 	__le32 cmd_queue;
873 } __packed; /* DQA_CONTROL_CMD_API_S_VER_1 */
874 
875 /*
876  * struct iwl_tx_ant_cfg_cmd
877  * @valid: valid antenna configuration
878  */
879 struct iwl_tx_ant_cfg_cmd {
880 	__le32 valid;
881 } __packed;
882 
883 /**
884  * struct iwl_calib_ctrl - Calibration control struct.
885  * Sent as part of the phy configuration command.
886  * @flow_trigger: bitmap for which calibrations to perform according to
887  *		flow triggers, using &enum iwl_calib_cfg
888  * @event_trigger: bitmap for which calibrations to perform according to
889  *		event triggers, using &enum iwl_calib_cfg
890  */
891 struct iwl_calib_ctrl {
892 	__le32 flow_trigger;
893 	__le32 event_trigger;
894 } __packed;
895 
896 /* This enum defines the bitmap of various calibrations to enable in both
897  * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
898  */
899 enum iwl_calib_cfg {
900 	IWL_CALIB_CFG_XTAL_IDX			= BIT(0),
901 	IWL_CALIB_CFG_TEMPERATURE_IDX		= BIT(1),
902 	IWL_CALIB_CFG_VOLTAGE_READ_IDX		= BIT(2),
903 	IWL_CALIB_CFG_PAPD_IDX			= BIT(3),
904 	IWL_CALIB_CFG_TX_PWR_IDX		= BIT(4),
905 	IWL_CALIB_CFG_DC_IDX			= BIT(5),
906 	IWL_CALIB_CFG_BB_FILTER_IDX		= BIT(6),
907 	IWL_CALIB_CFG_LO_LEAKAGE_IDX		= BIT(7),
908 	IWL_CALIB_CFG_TX_IQ_IDX			= BIT(8),
909 	IWL_CALIB_CFG_TX_IQ_SKEW_IDX		= BIT(9),
910 	IWL_CALIB_CFG_RX_IQ_IDX			= BIT(10),
911 	IWL_CALIB_CFG_RX_IQ_SKEW_IDX		= BIT(11),
912 	IWL_CALIB_CFG_SENSITIVITY_IDX		= BIT(12),
913 	IWL_CALIB_CFG_CHAIN_NOISE_IDX		= BIT(13),
914 	IWL_CALIB_CFG_DISCONNECTED_ANT_IDX	= BIT(14),
915 	IWL_CALIB_CFG_ANT_COUPLING_IDX		= BIT(15),
916 	IWL_CALIB_CFG_DAC_IDX			= BIT(16),
917 	IWL_CALIB_CFG_ABS_IDX			= BIT(17),
918 	IWL_CALIB_CFG_AGC_IDX			= BIT(18),
919 };
920 
921 /**
922  * struct iwl_phy_cfg_cmd - Phy configuration command
923  * @phy_cfg: PHY configuration value, uses &enum iwl_fw_phy_cfg
924  * @calib_control: calibration control data
925  */
926 struct iwl_phy_cfg_cmd {
927 	__le32	phy_cfg;
928 	struct iwl_calib_ctrl calib_control;
929 } __packed;
930 
931 #define PHY_CFG_RADIO_TYPE	(BIT(0) | BIT(1))
932 #define PHY_CFG_RADIO_STEP	(BIT(2) | BIT(3))
933 #define PHY_CFG_RADIO_DASH	(BIT(4) | BIT(5))
934 #define PHY_CFG_PRODUCT_NUMBER	(BIT(6) | BIT(7))
935 #define PHY_CFG_TX_CHAIN_A	BIT(8)
936 #define PHY_CFG_TX_CHAIN_B	BIT(9)
937 #define PHY_CFG_TX_CHAIN_C	BIT(10)
938 #define PHY_CFG_RX_CHAIN_A	BIT(12)
939 #define PHY_CFG_RX_CHAIN_B	BIT(13)
940 #define PHY_CFG_RX_CHAIN_C	BIT(14)
941 
942 
943 /**
944  * enum iwl_nvm_access_op - NVM access opcode
945  * @IWL_NVM_READ: read NVM
946  * @IWL_NVM_WRITE: write NVM
947  */
948 enum iwl_nvm_access_op {
949 	IWL_NVM_READ	= 0,
950 	IWL_NVM_WRITE	= 1,
951 };
952 
953 /**
954  * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
955  * @NVM_ACCESS_TARGET_CACHE: access the cache
956  * @NVM_ACCESS_TARGET_OTP: access the OTP
957  * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
958  */
959 enum iwl_nvm_access_target {
960 	NVM_ACCESS_TARGET_CACHE = 0,
961 	NVM_ACCESS_TARGET_OTP = 1,
962 	NVM_ACCESS_TARGET_EEPROM = 2,
963 };
964 
965 /**
966  * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
967  * @NVM_SECTION_TYPE_SW: software section
968  * @NVM_SECTION_TYPE_REGULATORY: regulatory section
969  * @NVM_SECTION_TYPE_CALIBRATION: calibration section
970  * @NVM_SECTION_TYPE_PRODUCTION: production section
971  * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
972  * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
973  * @NVM_MAX_NUM_SECTIONS: number of sections
974  */
975 enum iwl_nvm_section_type {
976 	NVM_SECTION_TYPE_SW = 1,
977 	NVM_SECTION_TYPE_REGULATORY = 3,
978 	NVM_SECTION_TYPE_CALIBRATION = 4,
979 	NVM_SECTION_TYPE_PRODUCTION = 5,
980 	NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
981 	NVM_SECTION_TYPE_PHY_SKU = 12,
982 	NVM_MAX_NUM_SECTIONS = 13,
983 };
984 
985 /**
986  * struct iwl_nvm_access_cmd - Request the device to send an NVM section
987  * @op_code: &enum iwl_nvm_access_op
988  * @target: &enum iwl_nvm_access_target
989  * @type: &enum iwl_nvm_section_type
990  * @offset: offset in bytes into the section
991  * @length: in bytes, to read/write
992  * @data: if write operation, the data to write. On read its empty
993  */
994 struct iwl_nvm_access_cmd {
995 	u8 op_code;
996 	u8 target;
997 	__le16 type;
998 	__le16 offset;
999 	__le16 length;
1000 	u8 data[];
1001 } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
1002 
1003 #define NUM_OF_FW_PAGING_BLOCKS	33 /* 32 for data and 1 block for CSS */
1004 
1005 /**
1006  * struct iwl_fw_paging_cmd - paging layout
1007  *
1008  * (FW_PAGING_BLOCK_CMD = 0x4f)
1009  *
1010  * Send to FW the paging layout in the driver.
1011  *
1012  * @flags: various flags for the command
1013  * @block_size: the block size in powers of 2
1014  * @block_num: number of blocks specified in the command.
1015  * @device_phy_addr: virtual addresses from device side
1016  */
1017 struct iwl_fw_paging_cmd {
1018 	__le32 flags;
1019 	__le32 block_size;
1020 	__le32 block_num;
1021 	__le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
1022 } __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */
1023 
1024 /*
1025  * Fw items ID's
1026  *
1027  * @IWL_FW_ITEM_ID_PAGING: Address of the pages that the FW will upload
1028  *	download
1029  */
1030 enum iwl_fw_item_id {
1031 	IWL_FW_ITEM_ID_PAGING = 3,
1032 };
1033 
1034 /*
1035  * struct iwl_fw_get_item_cmd - get an item from the fw
1036  */
1037 struct iwl_fw_get_item_cmd {
1038 	__le32 item_id;
1039 } __packed; /* FW_GET_ITEM_CMD_API_S_VER_1 */
1040 
1041 #define CONT_REC_COMMAND_SIZE	80
1042 #define ENABLE_CONT_RECORDING	0x15
1043 #define DISABLE_CONT_RECORDING	0x16
1044 
1045 /*
1046  * struct iwl_continuous_record_mode - recording mode
1047  */
1048 struct iwl_continuous_record_mode {
1049 	__le16 enable_recording;
1050 } __packed;
1051 
1052 /*
1053  * struct iwl_continuous_record_cmd - enable/disable continuous recording
1054  */
1055 struct iwl_continuous_record_cmd {
1056 	struct iwl_continuous_record_mode record_mode;
1057 	u8 pad[CONT_REC_COMMAND_SIZE -
1058 		sizeof(struct iwl_continuous_record_mode)];
1059 } __packed;
1060 
1061 struct iwl_fw_get_item_resp {
1062 	__le32 item_id;
1063 	__le32 item_byte_cnt;
1064 	__le32 item_val;
1065 } __packed; /* FW_GET_ITEM_RSP_S_VER_1 */
1066 
1067 /**
1068  * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
1069  * @offset: offset in bytes into the section
1070  * @length: in bytes, either how much was written or read
1071  * @type: NVM_SECTION_TYPE_*
1072  * @status: 0 for success, fail otherwise
1073  * @data: if read operation, the data returned. Empty on write.
1074  */
1075 struct iwl_nvm_access_resp {
1076 	__le16 offset;
1077 	__le16 length;
1078 	__le16 type;
1079 	__le16 status;
1080 	u8 data[];
1081 } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
1082 
1083 /* MVM_ALIVE 0x1 */
1084 
1085 /* alive response is_valid values */
1086 #define ALIVE_RESP_UCODE_OK	BIT(0)
1087 #define ALIVE_RESP_RFKILL	BIT(1)
1088 
1089 /* alive response ver_type values */
1090 enum {
1091 	FW_TYPE_HW = 0,
1092 	FW_TYPE_PROT = 1,
1093 	FW_TYPE_AP = 2,
1094 	FW_TYPE_WOWLAN = 3,
1095 	FW_TYPE_TIMING = 4,
1096 	FW_TYPE_WIPAN = 5
1097 };
1098 
1099 /* alive response ver_subtype values */
1100 enum {
1101 	FW_SUBTYPE_FULL_FEATURE = 0,
1102 	FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
1103 	FW_SUBTYPE_REDUCED = 2,
1104 	FW_SUBTYPE_ALIVE_ONLY = 3,
1105 	FW_SUBTYPE_WOWLAN = 4,
1106 	FW_SUBTYPE_AP_SUBTYPE = 5,
1107 	FW_SUBTYPE_WIPAN = 6,
1108 	FW_SUBTYPE_INITIALIZE = 9
1109 };
1110 
1111 #define IWL_ALIVE_STATUS_ERR 0xDEAD
1112 #define IWL_ALIVE_STATUS_OK 0xCAFE
1113 
1114 #define IWL_ALIVE_FLG_RFKILL	BIT(0)
1115 
1116 struct iwl_lmac_alive {
1117 	__le32 ucode_minor;
1118 	__le32 ucode_major;
1119 	u8 ver_subtype;
1120 	u8 ver_type;
1121 	u8 mac;
1122 	u8 opt;
1123 	__le32 timestamp;
1124 	__le32 error_event_table_ptr;	/* SRAM address for error log */
1125 	__le32 log_event_table_ptr;	/* SRAM address for LMAC event log */
1126 	__le32 cpu_register_ptr;
1127 	__le32 dbgm_config_ptr;
1128 	__le32 alive_counter_ptr;
1129 	__le32 scd_base_ptr;		/* SRAM address for SCD */
1130 	__le32 st_fwrd_addr;		/* pointer to Store and forward */
1131 	__le32 st_fwrd_size;
1132 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
1133 
1134 struct iwl_umac_alive {
1135 	__le32 umac_minor;		/* UMAC version: minor */
1136 	__le32 umac_major;		/* UMAC version: major */
1137 	__le32 error_info_addr;		/* SRAM address for UMAC error log */
1138 	__le32 dbg_print_buff_addr;
1139 } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
1140 
1141 struct mvm_alive_resp_v3 {
1142 	__le16 status;
1143 	__le16 flags;
1144 	struct iwl_lmac_alive lmac_data;
1145 	struct iwl_umac_alive umac_data;
1146 } __packed; /* ALIVE_RES_API_S_VER_3 */
1147 
1148 struct mvm_alive_resp {
1149 	__le16 status;
1150 	__le16 flags;
1151 	struct iwl_lmac_alive lmac_data[2];
1152 	struct iwl_umac_alive umac_data;
1153 } __packed; /* ALIVE_RES_API_S_VER_4 */
1154 
1155 /* Error response/notification */
1156 enum {
1157 	FW_ERR_UNKNOWN_CMD = 0x0,
1158 	FW_ERR_INVALID_CMD_PARAM = 0x1,
1159 	FW_ERR_SERVICE = 0x2,
1160 	FW_ERR_ARC_MEMORY = 0x3,
1161 	FW_ERR_ARC_CODE = 0x4,
1162 	FW_ERR_WATCH_DOG = 0x5,
1163 	FW_ERR_WEP_GRP_KEY_INDX = 0x10,
1164 	FW_ERR_WEP_KEY_SIZE = 0x11,
1165 	FW_ERR_OBSOLETE_FUNC = 0x12,
1166 	FW_ERR_UNEXPECTED = 0xFE,
1167 	FW_ERR_FATAL = 0xFF
1168 };
1169 
1170 /**
1171  * struct iwl_error_resp - FW error indication
1172  * ( REPLY_ERROR = 0x2 )
1173  * @error_type: one of FW_ERR_*
1174  * @cmd_id: the command ID for which the error occured
1175  * @reserved1: reserved
1176  * @bad_cmd_seq_num: sequence number of the erroneous command
1177  * @error_service: which service created the error, applicable only if
1178  *	error_type = 2, otherwise 0
1179  * @timestamp: TSF in usecs.
1180  */
1181 struct iwl_error_resp {
1182 	__le32 error_type;
1183 	u8 cmd_id;
1184 	u8 reserved1;
1185 	__le16 bad_cmd_seq_num;
1186 	__le32 error_service;
1187 	__le64 timestamp;
1188 } __packed;
1189 
1190 
1191 /* Common PHY, MAC and Bindings definitions */
1192 #define MAX_MACS_IN_BINDING	(3)
1193 #define MAX_BINDINGS		(4)
1194 
1195 /**
1196  * enum iwl_mvm_id_and_color - ID and color fields in context dword
1197  * @FW_CTXT_ID_POS: position of the ID
1198  * @FW_CTXT_ID_MSK: mask of the ID
1199  * @FW_CTXT_COLOR_POS: position of the color
1200  * @FW_CTXT_COLOR_MSK: mask of the color
1201  * @FW_CTXT_INVALID: value used to indicate unused/invalid
1202  */
1203 enum iwl_mvm_id_and_color {
1204 	FW_CTXT_ID_POS		= 0,
1205 	FW_CTXT_ID_MSK		= 0xff << FW_CTXT_ID_POS,
1206 	FW_CTXT_COLOR_POS	= 8,
1207 	FW_CTXT_COLOR_MSK	= 0xff << FW_CTXT_COLOR_POS,
1208 	FW_CTXT_INVALID		= 0xffffffff,
1209 };
1210 
1211 #define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
1212 					  (_color << FW_CTXT_COLOR_POS))
1213 
1214 /* Possible actions on PHYs, MACs and Bindings */
1215 enum iwl_phy_ctxt_action {
1216 	FW_CTXT_ACTION_STUB = 0,
1217 	FW_CTXT_ACTION_ADD,
1218 	FW_CTXT_ACTION_MODIFY,
1219 	FW_CTXT_ACTION_REMOVE,
1220 	FW_CTXT_ACTION_NUM
1221 }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
1222 
1223 /* Time Events */
1224 
1225 /* Time Event types, according to MAC type */
1226 enum iwl_time_event_type {
1227 	/* BSS Station Events */
1228 	TE_BSS_STA_AGGRESSIVE_ASSOC,
1229 	TE_BSS_STA_ASSOC,
1230 	TE_BSS_EAP_DHCP_PROT,
1231 	TE_BSS_QUIET_PERIOD,
1232 
1233 	/* P2P Device Events */
1234 	TE_P2P_DEVICE_DISCOVERABLE,
1235 	TE_P2P_DEVICE_LISTEN,
1236 	TE_P2P_DEVICE_ACTION_SCAN,
1237 	TE_P2P_DEVICE_FULL_SCAN,
1238 
1239 	/* P2P Client Events */
1240 	TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
1241 	TE_P2P_CLIENT_ASSOC,
1242 	TE_P2P_CLIENT_QUIET_PERIOD,
1243 
1244 	/* P2P GO Events */
1245 	TE_P2P_GO_ASSOC_PROT,
1246 	TE_P2P_GO_REPETITIVET_NOA,
1247 	TE_P2P_GO_CT_WINDOW,
1248 
1249 	/* WiDi Sync Events */
1250 	TE_WIDI_TX_SYNC,
1251 
1252 	/* Channel Switch NoA */
1253 	TE_CHANNEL_SWITCH_PERIOD,
1254 
1255 	TE_MAX
1256 }; /* MAC_EVENT_TYPE_API_E_VER_1 */
1257 
1258 
1259 
1260 /* Time event - defines for command API v1 */
1261 
1262 /*
1263  * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
1264  * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
1265  *	the first fragment is scheduled.
1266  * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
1267  *	the first 2 fragments are scheduled.
1268  * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
1269  *	number of fragments are valid.
1270  *
1271  * Other than the constant defined above, specifying a fragmentation value 'x'
1272  * means that the event can be fragmented but only the first 'x' will be
1273  * scheduled.
1274  */
1275 enum {
1276 	TE_V1_FRAG_NONE = 0,
1277 	TE_V1_FRAG_SINGLE = 1,
1278 	TE_V1_FRAG_DUAL = 2,
1279 	TE_V1_FRAG_ENDLESS = 0xffffffff
1280 };
1281 
1282 /* If a Time Event can be fragmented, this is the max number of fragments */
1283 #define TE_V1_FRAG_MAX_MSK	0x0fffffff
1284 /* Repeat the time event endlessly (until removed) */
1285 #define TE_V1_REPEAT_ENDLESS	0xffffffff
1286 /* If a Time Event has bounded repetitions, this is the maximal value */
1287 #define TE_V1_REPEAT_MAX_MSK_V1	0x0fffffff
1288 
1289 /* Time Event dependencies: none, on another TE, or in a specific time */
1290 enum {
1291 	TE_V1_INDEPENDENT		= 0,
1292 	TE_V1_DEP_OTHER			= BIT(0),
1293 	TE_V1_DEP_TSF			= BIT(1),
1294 	TE_V1_EVENT_SOCIOPATHIC		= BIT(2),
1295 }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
1296 
1297 /*
1298  * @TE_V1_NOTIF_NONE: no notifications
1299  * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
1300  * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
1301  * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
1302  * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
1303  * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
1304  * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
1305  * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
1306  * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
1307  *
1308  * Supported Time event notifications configuration.
1309  * A notification (both event and fragment) includes a status indicating weather
1310  * the FW was able to schedule the event or not. For fragment start/end
1311  * notification the status is always success. There is no start/end fragment
1312  * notification for monolithic events.
1313  */
1314 enum {
1315 	TE_V1_NOTIF_NONE = 0,
1316 	TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
1317 	TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
1318 	TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
1319 	TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
1320 	TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
1321 	TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
1322 	TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
1323 	TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
1324 }; /* MAC_EVENT_ACTION_API_E_VER_2 */
1325 
1326 /* Time event - defines for command API */
1327 
1328 /*
1329  * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
1330  * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
1331  *  the first fragment is scheduled.
1332  * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
1333  *  the first 2 fragments are scheduled.
1334  * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
1335  *  number of fragments are valid.
1336  *
1337  * Other than the constant defined above, specifying a fragmentation value 'x'
1338  * means that the event can be fragmented but only the first 'x' will be
1339  * scheduled.
1340  */
1341 enum {
1342 	TE_V2_FRAG_NONE = 0,
1343 	TE_V2_FRAG_SINGLE = 1,
1344 	TE_V2_FRAG_DUAL = 2,
1345 	TE_V2_FRAG_MAX = 0xfe,
1346 	TE_V2_FRAG_ENDLESS = 0xff
1347 };
1348 
1349 /* Repeat the time event endlessly (until removed) */
1350 #define TE_V2_REPEAT_ENDLESS	0xff
1351 /* If a Time Event has bounded repetitions, this is the maximal value */
1352 #define TE_V2_REPEAT_MAX	0xfe
1353 
1354 #define TE_V2_PLACEMENT_POS	12
1355 #define TE_V2_ABSENCE_POS	15
1356 
1357 /**
1358  * enum iwl_time_event_policy - Time event policy values
1359  * A notification (both event and fragment) includes a status indicating weather
1360  * the FW was able to schedule the event or not. For fragment start/end
1361  * notification the status is always success. There is no start/end fragment
1362  * notification for monolithic events.
1363  *
1364  * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
1365  * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
1366  * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
1367  * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
1368  * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
1369  * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
1370  * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
1371  * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
1372  * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
1373  * @T2_V2_START_IMMEDIATELY: start time event immediately
1374  * @TE_V2_DEP_OTHER: depends on another time event
1375  * @TE_V2_DEP_TSF: depends on a specific time
1376  * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
1377  * @TE_V2_ABSENCE: are we present or absent during the Time Event.
1378  */
1379 enum iwl_time_event_policy {
1380 	TE_V2_DEFAULT_POLICY = 0x0,
1381 
1382 	/* notifications (event start/stop, fragment start/stop) */
1383 	TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
1384 	TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
1385 	TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
1386 	TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
1387 
1388 	TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
1389 	TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
1390 	TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
1391 	TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
1392 	T2_V2_START_IMMEDIATELY = BIT(11),
1393 
1394 	/* placement characteristics */
1395 	TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
1396 	TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
1397 	TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
1398 
1399 	/* are we present or absent during the Time Event. */
1400 	TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
1401 };
1402 
1403 /**
1404  * struct iwl_time_event_cmd - configuring Time Events
1405  * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
1406  * with version 1. determined by IWL_UCODE_TLV_FLAGS)
1407  * ( TIME_EVENT_CMD = 0x29 )
1408  * @id_and_color: ID and color of the relevant MAC,
1409  *	&enum iwl_mvm_id_and_color
1410  * @action: action to perform, one of &enum iwl_phy_ctxt_action
1411  * @id: this field has two meanings, depending on the action:
1412  *	If the action is ADD, then it means the type of event to add.
1413  *	For all other actions it is the unique event ID assigned when the
1414  *	event was added by the FW.
1415  * @apply_time: When to start the Time Event (in GP2)
1416  * @max_delay: maximum delay to event's start (apply time), in TU
1417  * @depends_on: the unique ID of the event we depend on (if any)
1418  * @interval: interval between repetitions, in TU
1419  * @duration: duration of event in TU
1420  * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
1421  * @max_frags: maximal number of fragments the Time Event can be divided to
1422  * @policy: defines whether uCode shall notify the host or other uCode modules
1423  *	on event and/or fragment start and/or end
1424  *	using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
1425  *	TE_EVENT_SOCIOPATHIC
1426  *	using TE_ABSENCE and using TE_NOTIF_*,
1427  *	&enum iwl_time_event_policy
1428  */
1429 struct iwl_time_event_cmd {
1430 	/* COMMON_INDEX_HDR_API_S_VER_1 */
1431 	__le32 id_and_color;
1432 	__le32 action;
1433 	__le32 id;
1434 	/* MAC_TIME_EVENT_DATA_API_S_VER_2 */
1435 	__le32 apply_time;
1436 	__le32 max_delay;
1437 	__le32 depends_on;
1438 	__le32 interval;
1439 	__le32 duration;
1440 	u8 repeat;
1441 	u8 max_frags;
1442 	__le16 policy;
1443 } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
1444 
1445 /**
1446  * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
1447  * @status: bit 0 indicates success, all others specify errors
1448  * @id: the Time Event type
1449  * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
1450  * @id_and_color: ID and color of the relevant MAC,
1451  *	&enum iwl_mvm_id_and_color
1452  */
1453 struct iwl_time_event_resp {
1454 	__le32 status;
1455 	__le32 id;
1456 	__le32 unique_id;
1457 	__le32 id_and_color;
1458 } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
1459 
1460 /**
1461  * struct iwl_time_event_notif - notifications of time event start/stop
1462  * ( TIME_EVENT_NOTIFICATION = 0x2a )
1463  * @timestamp: action timestamp in GP2
1464  * @session_id: session's unique id
1465  * @unique_id: unique id of the Time Event itself
1466  * @id_and_color: ID and color of the relevant MAC
1467  * @action: &enum iwl_time_event_policy
1468  * @status: true if scheduled, false otherwise (not executed)
1469  */
1470 struct iwl_time_event_notif {
1471 	__le32 timestamp;
1472 	__le32 session_id;
1473 	__le32 unique_id;
1474 	__le32 id_and_color;
1475 	__le32 action;
1476 	__le32 status;
1477 } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
1478 
1479 
1480 /* Bindings and Time Quota */
1481 
1482 /**
1483  * struct iwl_binding_cmd_v1 - configuring bindings
1484  * ( BINDING_CONTEXT_CMD = 0x2b )
1485  * @id_and_color: ID and color of the relevant Binding,
1486  *	&enum iwl_mvm_id_and_color
1487  * @action: action to perform, one of FW_CTXT_ACTION_*
1488  * @macs: array of MAC id and colors which belong to the binding,
1489  *	&enum iwl_mvm_id_and_color
1490  * @phy: PHY id and color which belongs to the binding,
1491  *	&enum iwl_mvm_id_and_color
1492  */
1493 struct iwl_binding_cmd_v1 {
1494 	/* COMMON_INDEX_HDR_API_S_VER_1 */
1495 	__le32 id_and_color;
1496 	__le32 action;
1497 	/* BINDING_DATA_API_S_VER_1 */
1498 	__le32 macs[MAX_MACS_IN_BINDING];
1499 	__le32 phy;
1500 } __packed; /* BINDING_CMD_API_S_VER_1 */
1501 
1502 /**
1503  * struct iwl_binding_cmd - configuring bindings
1504  * ( BINDING_CONTEXT_CMD = 0x2b )
1505  * @id_and_color: ID and color of the relevant Binding,
1506  *	&enum iwl_mvm_id_and_color
1507  * @action: action to perform, one of FW_CTXT_ACTION_*
1508  * @macs: array of MAC id and colors which belong to the binding
1509  *	&enum iwl_mvm_id_and_color
1510  * @phy: PHY id and color which belongs to the binding
1511  *	&enum iwl_mvm_id_and_color
1512  * @lmac_id: the lmac id the binding belongs to
1513  */
1514 struct iwl_binding_cmd {
1515 	/* COMMON_INDEX_HDR_API_S_VER_1 */
1516 	__le32 id_and_color;
1517 	__le32 action;
1518 	/* BINDING_DATA_API_S_VER_1 */
1519 	__le32 macs[MAX_MACS_IN_BINDING];
1520 	__le32 phy;
1521 	__le32 lmac_id;
1522 } __packed; /* BINDING_CMD_API_S_VER_2 */
1523 
1524 #define IWL_BINDING_CMD_SIZE_V1	sizeof(struct iwl_binding_cmd_v1)
1525 #define IWL_LMAC_24G_INDEX		0
1526 #define IWL_LMAC_5G_INDEX		1
1527 
1528 /* The maximal number of fragments in the FW's schedule session */
1529 #define IWL_MVM_MAX_QUOTA 128
1530 
1531 /**
1532  * struct iwl_time_quota_data - configuration of time quota per binding
1533  * @id_and_color: ID and color of the relevant Binding,
1534  *	&enum iwl_mvm_id_and_color
1535  * @quota: absolute time quota in TU. The scheduler will try to divide the
1536  *	remainig quota (after Time Events) according to this quota.
1537  * @max_duration: max uninterrupted context duration in TU
1538  */
1539 struct iwl_time_quota_data {
1540 	__le32 id_and_color;
1541 	__le32 quota;
1542 	__le32 max_duration;
1543 } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
1544 
1545 /**
1546  * struct iwl_time_quota_cmd - configuration of time quota between bindings
1547  * ( TIME_QUOTA_CMD = 0x2c )
1548  * @quotas: allocations per binding
1549  * Note: on non-CDB the fourth one is the auxilary mac and is
1550  *	essentially zero.
1551  *	On CDB the fourth one is a regular binding.
1552  */
1553 struct iwl_time_quota_cmd {
1554 	struct iwl_time_quota_data quotas[MAX_BINDINGS];
1555 } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
1556 
1557 
1558 /* PHY context */
1559 
1560 /* Supported bands */
1561 #define PHY_BAND_5  (0)
1562 #define PHY_BAND_24 (1)
1563 
1564 /* Supported channel width, vary if there is VHT support */
1565 #define PHY_VHT_CHANNEL_MODE20	(0x0)
1566 #define PHY_VHT_CHANNEL_MODE40	(0x1)
1567 #define PHY_VHT_CHANNEL_MODE80	(0x2)
1568 #define PHY_VHT_CHANNEL_MODE160	(0x3)
1569 
1570 /*
1571  * Control channel position:
1572  * For legacy set bit means upper channel, otherwise lower.
1573  * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
1574  *   bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
1575  *                                   center_freq
1576  *                                        |
1577  * 40Mhz                          |_______|_______|
1578  * 80Mhz                  |_______|_______|_______|_______|
1579  * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
1580  * code      011     010     001     000  |  100     101     110    111
1581  */
1582 #define PHY_VHT_CTRL_POS_1_BELOW  (0x0)
1583 #define PHY_VHT_CTRL_POS_2_BELOW  (0x1)
1584 #define PHY_VHT_CTRL_POS_3_BELOW  (0x2)
1585 #define PHY_VHT_CTRL_POS_4_BELOW  (0x3)
1586 #define PHY_VHT_CTRL_POS_1_ABOVE  (0x4)
1587 #define PHY_VHT_CTRL_POS_2_ABOVE  (0x5)
1588 #define PHY_VHT_CTRL_POS_3_ABOVE  (0x6)
1589 #define PHY_VHT_CTRL_POS_4_ABOVE  (0x7)
1590 
1591 /*
1592  * @band: PHY_BAND_*
1593  * @channel: channel number
1594  * @width: PHY_[VHT|LEGACY]_CHANNEL_*
1595  * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
1596  */
1597 struct iwl_fw_channel_info {
1598 	u8 band;
1599 	u8 channel;
1600 	u8 width;
1601 	u8 ctrl_pos;
1602 } __packed;
1603 
1604 #define PHY_RX_CHAIN_DRIVER_FORCE_POS	(0)
1605 #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
1606 	(0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
1607 #define PHY_RX_CHAIN_VALID_POS		(1)
1608 #define PHY_RX_CHAIN_VALID_MSK \
1609 	(0x7 << PHY_RX_CHAIN_VALID_POS)
1610 #define PHY_RX_CHAIN_FORCE_SEL_POS	(4)
1611 #define PHY_RX_CHAIN_FORCE_SEL_MSK \
1612 	(0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
1613 #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS	(7)
1614 #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
1615 	(0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
1616 #define PHY_RX_CHAIN_CNT_POS		(10)
1617 #define PHY_RX_CHAIN_CNT_MSK \
1618 	(0x3 << PHY_RX_CHAIN_CNT_POS)
1619 #define PHY_RX_CHAIN_MIMO_CNT_POS	(12)
1620 #define PHY_RX_CHAIN_MIMO_CNT_MSK \
1621 	(0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
1622 #define PHY_RX_CHAIN_MIMO_FORCE_POS	(14)
1623 #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
1624 	(0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
1625 
1626 /* TODO: fix the value, make it depend on firmware at runtime? */
1627 #define NUM_PHY_CTX	3
1628 
1629 /* TODO: complete missing documentation */
1630 /**
1631  * struct iwl_phy_context_cmd - config of the PHY context
1632  * ( PHY_CONTEXT_CMD = 0x8 )
1633  * @id_and_color: ID and color of the relevant Binding
1634  * @action: action to perform, one of FW_CTXT_ACTION_*
1635  * @apply_time: 0 means immediate apply and context switch.
1636  *	other value means apply new params after X usecs
1637  * @tx_param_color: ???
1638  * @ci: channel info
1639  * @txchain_info: ???
1640  * @rxchain_info: ???
1641  * @acquisition_data: ???
1642  * @dsp_cfg_flags: set to 0
1643  */
1644 struct iwl_phy_context_cmd {
1645 	/* COMMON_INDEX_HDR_API_S_VER_1 */
1646 	__le32 id_and_color;
1647 	__le32 action;
1648 	/* PHY_CONTEXT_DATA_API_S_VER_1 */
1649 	__le32 apply_time;
1650 	__le32 tx_param_color;
1651 	struct iwl_fw_channel_info ci;
1652 	__le32 txchain_info;
1653 	__le32 rxchain_info;
1654 	__le32 acquisition_data;
1655 	__le32 dsp_cfg_flags;
1656 } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
1657 
1658 /*
1659  * Aux ROC command
1660  *
1661  * Command requests the firmware to create a time event for a certain duration
1662  * and remain on the given channel. This is done by using the Aux framework in
1663  * the FW.
1664  * The command was first used for Hot Spot issues - but can be used regardless
1665  * to Hot Spot.
1666  *
1667  * ( HOT_SPOT_CMD 0x53 )
1668  *
1669  * @id_and_color: ID and color of the MAC
1670  * @action: action to perform, one of FW_CTXT_ACTION_*
1671  * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
1672  *	event_unique_id should be the id of the time event assigned by ucode.
1673  *	Otherwise ignore the event_unique_id.
1674  * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
1675  *	activity.
1676  * @channel_info: channel info
1677  * @node_addr: Our MAC Address
1678  * @reserved: reserved for alignment
1679  * @apply_time: GP2 value to start (should always be the current GP2 value)
1680  * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
1681  *	time by which start of the event is allowed to be postponed.
1682  * @duration: event duration in TU To calculate event duration:
1683  *	timeEventDuration = min(duration, remainingQuota)
1684  */
1685 struct iwl_hs20_roc_req {
1686 	/* COMMON_INDEX_HDR_API_S_VER_1 hdr */
1687 	__le32 id_and_color;
1688 	__le32 action;
1689 	__le32 event_unique_id;
1690 	__le32 sta_id_and_color;
1691 	struct iwl_fw_channel_info channel_info;
1692 	u8 node_addr[ETH_ALEN];
1693 	__le16 reserved;
1694 	__le32 apply_time;
1695 	__le32 apply_time_max_delay;
1696 	__le32 duration;
1697 } __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
1698 
1699 /*
1700  * values for AUX ROC result values
1701  */
1702 enum iwl_mvm_hot_spot {
1703 	HOT_SPOT_RSP_STATUS_OK,
1704 	HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
1705 	HOT_SPOT_MAX_NUM_OF_SESSIONS,
1706 };
1707 
1708 /*
1709  * Aux ROC command response
1710  *
1711  * In response to iwl_hs20_roc_req the FW sends this command to notify the
1712  * driver the uid of the timevent.
1713  *
1714  * ( HOT_SPOT_CMD 0x53 )
1715  *
1716  * @event_unique_id: Unique ID of time event assigned by ucode
1717  * @status: Return status 0 is success, all the rest used for specific errors
1718  */
1719 struct iwl_hs20_roc_res {
1720 	__le32 event_unique_id;
1721 	__le32 status;
1722 } __packed; /* HOT_SPOT_RSP_API_S_VER_1 */
1723 
1724 /**
1725  * struct iwl_radio_version_notif - information on the radio version
1726  * ( RADIO_VERSION_NOTIFICATION = 0x68 )
1727  * @radio_flavor: radio flavor
1728  * @radio_step: radio version step
1729  * @radio_dash: radio version dash
1730  */
1731 struct iwl_radio_version_notif {
1732 	__le32 radio_flavor;
1733 	__le32 radio_step;
1734 	__le32 radio_dash;
1735 } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
1736 
1737 enum iwl_card_state_flags {
1738 	CARD_ENABLED		= 0x00,
1739 	HW_CARD_DISABLED	= 0x01,
1740 	SW_CARD_DISABLED	= 0x02,
1741 	CT_KILL_CARD_DISABLED	= 0x04,
1742 	HALT_CARD_DISABLED	= 0x08,
1743 	CARD_DISABLED_MSK	= 0x0f,
1744 	CARD_IS_RX_ON		= 0x10,
1745 };
1746 
1747 /**
1748  * struct iwl_radio_version_notif - information on the radio version
1749  * ( CARD_STATE_NOTIFICATION = 0xa1 )
1750  * @flags: %iwl_card_state_flags
1751  */
1752 struct iwl_card_state_notif {
1753 	__le32 flags;
1754 } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
1755 
1756 /**
1757  * struct iwl_missed_beacons_notif - information on missed beacons
1758  * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
1759  * @mac_id: interface ID
1760  * @consec_missed_beacons_since_last_rx: number of consecutive missed
1761  *	beacons since last RX.
1762  * @consec_missed_beacons: number of consecutive missed beacons
1763  * @num_expected_beacons: number of expected beacons
1764  * @num_recvd_beacons: number of received beacons
1765  */
1766 struct iwl_missed_beacons_notif {
1767 	__le32 mac_id;
1768 	__le32 consec_missed_beacons_since_last_rx;
1769 	__le32 consec_missed_beacons;
1770 	__le32 num_expected_beacons;
1771 	__le32 num_recvd_beacons;
1772 } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
1773 
1774 /**
1775  * struct iwl_mfuart_load_notif - mfuart image version & status
1776  * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
1777  * @installed_ver: installed image version
1778  * @external_ver: external image version
1779  * @status: MFUART loading status
1780  * @duration: MFUART loading time
1781  * @image_size: MFUART image size in bytes
1782 */
1783 struct iwl_mfuart_load_notif {
1784 	__le32 installed_ver;
1785 	__le32 external_ver;
1786 	__le32 status;
1787 	__le32 duration;
1788 	/* image size valid only in v2 of the command */
1789 	__le32 image_size;
1790 } __packed; /*MFU_LOADER_NTFY_API_S_VER_2*/
1791 
1792 /**
1793  * struct iwl_mfu_assert_dump_notif - mfuart dump logs
1794  * ( MFU_ASSERT_DUMP_NTF = 0xfe )
1795  * @assert_id: mfuart assert id that cause the notif
1796  * @curr_reset_num: number of asserts since uptime
1797  * @index_num: current chunk id
1798  * @parts_num: total number of chunks
1799  * @data_size: number of data bytes sent
1800  * @data: data buffer
1801  */
1802 struct iwl_mfu_assert_dump_notif {
1803 	__le32   assert_id;
1804 	__le32   curr_reset_num;
1805 	__le16   index_num;
1806 	__le16   parts_num;
1807 	__le32   data_size;
1808 	__le32   data[0];
1809 } __packed; /*MFU_DUMP_ASSERT_API_S_VER_1*/
1810 
1811 #define MAX_PORT_ID_NUM	2
1812 #define MAX_MCAST_FILTERING_ADDRESSES 256
1813 
1814 /**
1815  * struct iwl_mcast_filter_cmd - configure multicast filter.
1816  * @filter_own: Set 1 to filter out multicast packets sent by station itself
1817  * @port_id:	Multicast MAC addresses array specifier. This is a strange way
1818  *		to identify network interface adopted in host-device IF.
1819  *		It is used by FW as index in array of addresses. This array has
1820  *		MAX_PORT_ID_NUM members.
1821  * @count:	Number of MAC addresses in the array
1822  * @pass_all:	Set 1 to pass all multicast packets.
1823  * @bssid:	current association BSSID.
1824  * @reserved:	reserved
1825  * @addr_list:	Place holder for array of MAC addresses.
1826  *		IMPORTANT: add padding if necessary to ensure DWORD alignment.
1827  */
1828 struct iwl_mcast_filter_cmd {
1829 	u8 filter_own;
1830 	u8 port_id;
1831 	u8 count;
1832 	u8 pass_all;
1833 	u8 bssid[6];
1834 	u8 reserved[2];
1835 	u8 addr_list[0];
1836 } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
1837 
1838 #define MAX_BCAST_FILTERS 8
1839 #define MAX_BCAST_FILTER_ATTRS 2
1840 
1841 /**
1842  * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
1843  * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
1844  * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
1845  *	start of ip payload).
1846  */
1847 enum iwl_mvm_bcast_filter_attr_offset {
1848 	BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
1849 	BCAST_FILTER_OFFSET_IP_END = 1,
1850 };
1851 
1852 /**
1853  * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
1854  * @offset_type:	&enum iwl_mvm_bcast_filter_attr_offset.
1855  * @offset:	starting offset of this pattern.
1856  * @reserved1:	reserved
1857  * @val:	value to match - big endian (MSB is the first
1858  *		byte to match from offset pos).
1859  * @mask:	mask to match (big endian).
1860  */
1861 struct iwl_fw_bcast_filter_attr {
1862 	u8 offset_type;
1863 	u8 offset;
1864 	__le16 reserved1;
1865 	__be32 val;
1866 	__be32 mask;
1867 } __packed; /* BCAST_FILTER_ATT_S_VER_1 */
1868 
1869 /**
1870  * enum iwl_mvm_bcast_filter_frame_type - filter frame type
1871  * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
1872  * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
1873  */
1874 enum iwl_mvm_bcast_filter_frame_type {
1875 	BCAST_FILTER_FRAME_TYPE_ALL = 0,
1876 	BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
1877 };
1878 
1879 /**
1880  * struct iwl_fw_bcast_filter - broadcast filter
1881  * @discard: discard frame (1) or let it pass (0).
1882  * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
1883  * @reserved1: reserved
1884  * @num_attrs: number of valid attributes in this filter.
1885  * @attrs: attributes of this filter. a filter is considered matched
1886  *	only when all its attributes are matched (i.e. AND relationship)
1887  */
1888 struct iwl_fw_bcast_filter {
1889 	u8 discard;
1890 	u8 frame_type;
1891 	u8 num_attrs;
1892 	u8 reserved1;
1893 	struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
1894 } __packed; /* BCAST_FILTER_S_VER_1 */
1895 
1896 #define BA_WINDOW_STREAMS_MAX		16
1897 #define BA_WINDOW_STATUS_TID_MSK	0x000F
1898 #define BA_WINDOW_STATUS_STA_ID_POS	4
1899 #define BA_WINDOW_STATUS_STA_ID_MSK	0x01F0
1900 #define BA_WINDOW_STATUS_VALID_MSK	BIT(9)
1901 
1902 /**
1903  * struct iwl_ba_window_status_notif - reordering window's status notification
1904  * @bitmap: bitmap of received frames [start_seq_num + 0]..[start_seq_num + 63]
1905  * @ra_tid: bit 3:0 - TID, bit 8:4 - STA_ID, bit 9 - valid
1906  * @start_seq_num: the start sequence number of the bitmap
1907  * @mpdu_rx_count: the number of received MPDUs since entering D0i3
1908  */
1909 struct iwl_ba_window_status_notif {
1910 	__le64 bitmap[BA_WINDOW_STREAMS_MAX];
1911 	__le16 ra_tid[BA_WINDOW_STREAMS_MAX];
1912 	__le32 start_seq_num[BA_WINDOW_STREAMS_MAX];
1913 	__le16 mpdu_rx_count[BA_WINDOW_STREAMS_MAX];
1914 } __packed; /* BA_WINDOW_STATUS_NTFY_API_S_VER_1 */
1915 
1916 /**
1917  * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
1918  * @default_discard: default action for this mac (discard (1) / pass (0)).
1919  * @reserved1: reserved
1920  * @attached_filters: bitmap of relevant filters for this mac.
1921  */
1922 struct iwl_fw_bcast_mac {
1923 	u8 default_discard;
1924 	u8 reserved1;
1925 	__le16 attached_filters;
1926 } __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
1927 
1928 /**
1929  * struct iwl_bcast_filter_cmd - broadcast filtering configuration
1930  * @disable: enable (0) / disable (1)
1931  * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
1932  * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
1933  * @reserved1: reserved
1934  * @filters: broadcast filters
1935  * @macs: broadcast filtering configuration per-mac
1936  */
1937 struct iwl_bcast_filter_cmd {
1938 	u8 disable;
1939 	u8 max_bcast_filters;
1940 	u8 max_macs;
1941 	u8 reserved1;
1942 	struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
1943 	struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
1944 } __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
1945 
1946 /*
1947  * enum iwl_mvm_marker_id - maker ids
1948  *
1949  * The ids for different type of markers to insert into the usniffer logs
1950  */
1951 enum iwl_mvm_marker_id {
1952 	MARKER_ID_TX_FRAME_LATENCY = 1,
1953 }; /* MARKER_ID_API_E_VER_1 */
1954 
1955 /**
1956  * struct iwl_mvm_marker - mark info into the usniffer logs
1957  *
1958  * (MARKER_CMD = 0xcb)
1959  *
1960  * Mark the UTC time stamp into the usniffer logs together with additional
1961  * metadata, so the usniffer output can be parsed.
1962  * In the command response the ucode will return the GP2 time.
1963  *
1964  * @dw_len: The amount of dwords following this byte including this byte.
1965  * @marker_id: A unique marker id (iwl_mvm_marker_id).
1966  * @reserved: reserved.
1967  * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
1968  * @metadata: additional meta data that will be written to the unsiffer log
1969  */
1970 struct iwl_mvm_marker {
1971 	u8 dw_len;
1972 	u8 marker_id;
1973 	__le16 reserved;
1974 	__le64 timestamp;
1975 	__le32 metadata[0];
1976 } __packed; /* MARKER_API_S_VER_1 */
1977 
1978 /*
1979  * enum iwl_dc2dc_config_id - flag ids
1980  *
1981  * Ids of dc2dc configuration flags
1982  */
1983 enum iwl_dc2dc_config_id {
1984 	DCDC_LOW_POWER_MODE_MSK_SET  = 0x1, /* not used */
1985 	DCDC_FREQ_TUNE_SET = 0x2,
1986 }; /* MARKER_ID_API_E_VER_1 */
1987 
1988 /**
1989  * struct iwl_dc2dc_config_cmd - configure dc2dc values
1990  *
1991  * (DC2DC_CONFIG_CMD = 0x83)
1992  *
1993  * Set/Get & configure dc2dc values.
1994  * The command always returns the current dc2dc values.
1995  *
1996  * @flags: set/get dc2dc
1997  * @enable_low_power_mode: not used.
1998  * @dc2dc_freq_tune0: frequency divider - digital domain
1999  * @dc2dc_freq_tune1: frequency divider - analog domain
2000  */
2001 struct iwl_dc2dc_config_cmd {
2002 	__le32 flags;
2003 	__le32 enable_low_power_mode; /* not used */
2004 	__le32 dc2dc_freq_tune0;
2005 	__le32 dc2dc_freq_tune1;
2006 } __packed; /* DC2DC_CONFIG_CMD_API_S_VER_1 */
2007 
2008 /**
2009  * struct iwl_dc2dc_config_resp - response for iwl_dc2dc_config_cmd
2010  *
2011  * Current dc2dc values returned by the FW.
2012  *
2013  * @dc2dc_freq_tune0: frequency divider - digital domain
2014  * @dc2dc_freq_tune1: frequency divider - analog domain
2015  */
2016 struct iwl_dc2dc_config_resp {
2017 	__le32 dc2dc_freq_tune0;
2018 	__le32 dc2dc_freq_tune1;
2019 } __packed; /* DC2DC_CONFIG_RESP_API_S_VER_1 */
2020 
2021 /***********************************
2022  * Smart Fifo API
2023  ***********************************/
2024 /* Smart Fifo state */
2025 enum iwl_sf_state {
2026 	SF_LONG_DELAY_ON = 0, /* should never be called by driver */
2027 	SF_FULL_ON,
2028 	SF_UNINIT,
2029 	SF_INIT_OFF,
2030 	SF_HW_NUM_STATES
2031 };
2032 
2033 /* Smart Fifo possible scenario */
2034 enum iwl_sf_scenario {
2035 	SF_SCENARIO_SINGLE_UNICAST,
2036 	SF_SCENARIO_AGG_UNICAST,
2037 	SF_SCENARIO_MULTICAST,
2038 	SF_SCENARIO_BA_RESP,
2039 	SF_SCENARIO_TX_RESP,
2040 	SF_NUM_SCENARIO
2041 };
2042 
2043 #define SF_TRANSIENT_STATES_NUMBER 2	/* SF_LONG_DELAY_ON and SF_FULL_ON */
2044 #define SF_NUM_TIMEOUT_TYPES 2		/* Aging timer and Idle timer */
2045 
2046 /* smart FIFO default values */
2047 #define SF_W_MARK_SISO 6144
2048 #define SF_W_MARK_MIMO2 8192
2049 #define SF_W_MARK_MIMO3 6144
2050 #define SF_W_MARK_LEGACY 4096
2051 #define SF_W_MARK_SCAN 4096
2052 
2053 /* SF Scenarios timers for default configuration (aligned to 32 uSec) */
2054 #define SF_SINGLE_UNICAST_IDLE_TIMER_DEF 160	/* 150 uSec  */
2055 #define SF_SINGLE_UNICAST_AGING_TIMER_DEF 400	/* 0.4 mSec */
2056 #define SF_AGG_UNICAST_IDLE_TIMER_DEF 160		/* 150 uSec */
2057 #define SF_AGG_UNICAST_AGING_TIMER_DEF 400		/* 0.4 mSec */
2058 #define SF_MCAST_IDLE_TIMER_DEF 160		/* 150 mSec */
2059 #define SF_MCAST_AGING_TIMER_DEF 400		/* 0.4 mSec */
2060 #define SF_BA_IDLE_TIMER_DEF 160			/* 150 uSec */
2061 #define SF_BA_AGING_TIMER_DEF 400			/* 0.4 mSec */
2062 #define SF_TX_RE_IDLE_TIMER_DEF 160			/* 150 uSec */
2063 #define SF_TX_RE_AGING_TIMER_DEF 400		/* 0.4 mSec */
2064 
2065 /* SF Scenarios timers for BSS MAC configuration (aligned to 32 uSec) */
2066 #define SF_SINGLE_UNICAST_IDLE_TIMER 320	/* 300 uSec  */
2067 #define SF_SINGLE_UNICAST_AGING_TIMER 2016	/* 2 mSec */
2068 #define SF_AGG_UNICAST_IDLE_TIMER 320		/* 300 uSec */
2069 #define SF_AGG_UNICAST_AGING_TIMER 2016		/* 2 mSec */
2070 #define SF_MCAST_IDLE_TIMER 2016		/* 2 mSec */
2071 #define SF_MCAST_AGING_TIMER 10016		/* 10 mSec */
2072 #define SF_BA_IDLE_TIMER 320			/* 300 uSec */
2073 #define SF_BA_AGING_TIMER 2016			/* 2 mSec */
2074 #define SF_TX_RE_IDLE_TIMER 320			/* 300 uSec */
2075 #define SF_TX_RE_AGING_TIMER 2016		/* 2 mSec */
2076 
2077 #define SF_LONG_DELAY_AGING_TIMER 1000000	/* 1 Sec */
2078 
2079 #define SF_CFG_DUMMY_NOTIF_OFF	BIT(16)
2080 
2081 /**
2082  * struct iwl_sf_cfg_cmd - Smart Fifo configuration command.
2083  * @state: smart fifo state, types listed in &enum iwl_sf_state.
2084  * @watermark: Minimum allowed availabe free space in RXF for transient state.
2085  * @long_delay_timeouts: aging and idle timer values for each scenario
2086  * in long delay state.
2087  * @full_on_timeouts: timer values for each scenario in full on state.
2088  */
2089 struct iwl_sf_cfg_cmd {
2090 	__le32 state;
2091 	__le32 watermark[SF_TRANSIENT_STATES_NUMBER];
2092 	__le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
2093 	__le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
2094 } __packed; /* SF_CFG_API_S_VER_2 */
2095 
2096 /***********************************
2097  * Location Aware Regulatory (LAR) API - MCC updates
2098  ***********************************/
2099 
2100 /**
2101  * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
2102  * regulatory profile according to the given MCC (Mobile Country Code).
2103  * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
2104  * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
2105  * MCC in the cmd response will be the relevant MCC in the NVM.
2106  * @mcc: given mobile country code
2107  * @source_id: the source from where we got the MCC, see iwl_mcc_source
2108  * @reserved: reserved for alignment
2109  */
2110 struct iwl_mcc_update_cmd_v1 {
2111 	__le16 mcc;
2112 	u8 source_id;
2113 	u8 reserved;
2114 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
2115 
2116 /**
2117  * struct iwl_mcc_update_cmd - Request the device to update geographic
2118  * regulatory profile according to the given MCC (Mobile Country Code).
2119  * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
2120  * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
2121  * MCC in the cmd response will be the relevant MCC in the NVM.
2122  * @mcc: given mobile country code
2123  * @source_id: the source from where we got the MCC, see iwl_mcc_source
2124  * @reserved: reserved for alignment
2125  * @key: integrity key for MCC API OEM testing
2126  * @reserved2: reserved
2127  */
2128 struct iwl_mcc_update_cmd {
2129 	__le16 mcc;
2130 	u8 source_id;
2131 	u8 reserved;
2132 	__le32 key;
2133 	u8 reserved2[20];
2134 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
2135 
2136 /**
2137  * struct iwl_mcc_update_resp_v1  - response to MCC_UPDATE_CMD.
2138  * Contains the new channel control profile map, if changed, and the new MCC
2139  * (mobile country code).
2140  * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
2141  * @status: see &enum iwl_mcc_update_status
2142  * @mcc: the new applied MCC
2143  * @cap: capabilities for all channels which matches the MCC
2144  * @source_id: the MCC source, see iwl_mcc_source
2145  * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
2146  *		channels, depending on platform)
2147  * @channels: channel control data map, DWORD for each channel. Only the first
2148  *	16bits are used.
2149  */
2150 struct iwl_mcc_update_resp_v1  {
2151 	__le32 status;
2152 	__le16 mcc;
2153 	u8 cap;
2154 	u8 source_id;
2155 	__le32 n_channels;
2156 	__le32 channels[0];
2157 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
2158 
2159 /**
2160  * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
2161  * Contains the new channel control profile map, if changed, and the new MCC
2162  * (mobile country code).
2163  * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
2164  * @status: see &enum iwl_mcc_update_status
2165  * @mcc: the new applied MCC
2166  * @cap: capabilities for all channels which matches the MCC
2167  * @source_id: the MCC source, see iwl_mcc_source
2168  * @time: time elapsed from the MCC test start (in 30 seconds TU)
2169  * @reserved: reserved.
2170  * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
2171  *		channels, depending on platform)
2172  * @channels: channel control data map, DWORD for each channel. Only the first
2173  *	16bits are used.
2174  */
2175 struct iwl_mcc_update_resp {
2176 	__le32 status;
2177 	__le16 mcc;
2178 	u8 cap;
2179 	u8 source_id;
2180 	__le16 time;
2181 	__le16 reserved;
2182 	__le32 n_channels;
2183 	__le32 channels[0];
2184 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
2185 
2186 /**
2187  * struct iwl_mcc_chub_notif - chub notifies of mcc change
2188  * (MCC_CHUB_UPDATE_CMD = 0xc9)
2189  * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
2190  * the cellular and connectivity cores that gets updates of the mcc, and
2191  * notifies the ucode directly of any mcc change.
2192  * The ucode requests the driver to request the device to update geographic
2193  * regulatory  profile according to the given MCC (Mobile Country Code).
2194  * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
2195  * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
2196  * MCC in the cmd response will be the relevant MCC in the NVM.
2197  * @mcc: given mobile country code
2198  * @source_id: identity of the change originator, see iwl_mcc_source
2199  * @reserved1: reserved for alignment
2200  */
2201 struct iwl_mcc_chub_notif {
2202 	__le16 mcc;
2203 	u8 source_id;
2204 	u8 reserved1;
2205 } __packed; /* LAR_MCC_NOTIFY_S */
2206 
2207 enum iwl_mcc_update_status {
2208 	MCC_RESP_NEW_CHAN_PROFILE,
2209 	MCC_RESP_SAME_CHAN_PROFILE,
2210 	MCC_RESP_INVALID,
2211 	MCC_RESP_NVM_DISABLED,
2212 	MCC_RESP_ILLEGAL,
2213 	MCC_RESP_LOW_PRIORITY,
2214 	MCC_RESP_TEST_MODE_ACTIVE,
2215 	MCC_RESP_TEST_MODE_NOT_ACTIVE,
2216 	MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
2217 };
2218 
2219 enum iwl_mcc_source {
2220 	MCC_SOURCE_OLD_FW = 0,
2221 	MCC_SOURCE_ME = 1,
2222 	MCC_SOURCE_BIOS = 2,
2223 	MCC_SOURCE_3G_LTE_HOST = 3,
2224 	MCC_SOURCE_3G_LTE_DEVICE = 4,
2225 	MCC_SOURCE_WIFI = 5,
2226 	MCC_SOURCE_RESERVED = 6,
2227 	MCC_SOURCE_DEFAULT = 7,
2228 	MCC_SOURCE_UNINITIALIZED = 8,
2229 	MCC_SOURCE_MCC_API = 9,
2230 	MCC_SOURCE_GET_CURRENT = 0x10,
2231 	MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
2232 };
2233 
2234 /* DTS measurements */
2235 
2236 enum iwl_dts_measurement_flags {
2237 	DTS_TRIGGER_CMD_FLAGS_TEMP	= BIT(0),
2238 	DTS_TRIGGER_CMD_FLAGS_VOLT	= BIT(1),
2239 };
2240 
2241 /**
2242  * struct iwl_dts_measurement_cmd - request DTS temp and/or voltage measurements
2243  *
2244  * @flags: indicates which measurements we want as specified in
2245  *	&enum iwl_dts_measurement_flags
2246  */
2247 struct iwl_dts_measurement_cmd {
2248 	__le32 flags;
2249 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
2250 
2251 /**
2252 * enum iwl_dts_control_measurement_mode - DTS measurement type
2253 * @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
2254 *                 back (latest value. Not waiting for new value). Use automatic
2255 *                 SW DTS configuration.
2256 * @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
2257 *                    trigger DTS reading and provide read back temperature read
2258 *                    when available.
2259 * @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
2260 * @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
2261 *                              without measurement trigger.
2262 */
2263 enum iwl_dts_control_measurement_mode {
2264 	DTS_AUTOMATIC			= 0,
2265 	DTS_REQUEST_READ		= 1,
2266 	DTS_OVER_WRITE			= 2,
2267 	DTS_DIRECT_WITHOUT_MEASURE	= 3,
2268 };
2269 
2270 /**
2271 * enum iwl_dts_used - DTS to use or used for measurement in the DTS request
2272 * @DTS_USE_TOP: Top
2273 * @DTS_USE_CHAIN_A: chain A
2274 * @DTS_USE_CHAIN_B: chain B
2275 * @DTS_USE_CHAIN_C: chain C
2276 * @XTAL_TEMPERATURE: read temperature from xtal
2277 */
2278 enum iwl_dts_used {
2279 	DTS_USE_TOP		= 0,
2280 	DTS_USE_CHAIN_A		= 1,
2281 	DTS_USE_CHAIN_B		= 2,
2282 	DTS_USE_CHAIN_C		= 3,
2283 	XTAL_TEMPERATURE	= 4,
2284 };
2285 
2286 /**
2287 * enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
2288 * @DTS_BIT6_MODE: bit 6 mode
2289 * @DTS_BIT8_MODE: bit 8 mode
2290 */
2291 enum iwl_dts_bit_mode {
2292 	DTS_BIT6_MODE	= 0,
2293 	DTS_BIT8_MODE	= 1,
2294 };
2295 
2296 /**
2297  * struct iwl_ext_dts_measurement_cmd - request extended DTS temp measurements
2298  * @control_mode: see &enum iwl_dts_control_measurement_mode
2299  * @temperature: used when over write DTS mode is selected
2300  * @sensor: set temperature sensor to use. See &enum iwl_dts_used
2301  * @avg_factor: average factor to DTS in request DTS read mode
2302  * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
2303  * @step_duration: step duration for the DTS
2304  */
2305 struct iwl_ext_dts_measurement_cmd {
2306 	__le32 control_mode;
2307 	__le32 temperature;
2308 	__le32 sensor;
2309 	__le32 avg_factor;
2310 	__le32 bit_mode;
2311 	__le32 step_duration;
2312 } __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */
2313 
2314 /**
2315  * struct iwl_dts_measurement_notif_v1 - measurements notification
2316  *
2317  * @temp: the measured temperature
2318  * @voltage: the measured voltage
2319  */
2320 struct iwl_dts_measurement_notif_v1 {
2321 	__le32 temp;
2322 	__le32 voltage;
2323 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
2324 
2325 /**
2326  * struct iwl_dts_measurement_notif_v2 - measurements notification
2327  *
2328  * @temp: the measured temperature
2329  * @voltage: the measured voltage
2330  * @threshold_idx: the trip index that was crossed
2331  */
2332 struct iwl_dts_measurement_notif_v2 {
2333 	__le32 temp;
2334 	__le32 voltage;
2335 	__le32 threshold_idx;
2336 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
2337 
2338 /**
2339  * struct ct_kill_notif - CT-kill entry notification
2340  *
2341  * @temperature: the current temperature in celsius
2342  * @reserved: reserved
2343  */
2344 struct ct_kill_notif {
2345 	__le16 temperature;
2346 	__le16 reserved;
2347 } __packed; /* GRP_PHY_CT_KILL_NTF */
2348 
2349 /**
2350 * enum ctdp_cmd_operation - CTDP command operations
2351 * @CTDP_CMD_OPERATION_START: update the current budget
2352 * @CTDP_CMD_OPERATION_STOP: stop ctdp
2353 * @CTDP_CMD_OPERATION_REPORT: get the average budget
2354 */
2355 enum iwl_mvm_ctdp_cmd_operation {
2356 	CTDP_CMD_OPERATION_START	= 0x1,
2357 	CTDP_CMD_OPERATION_STOP		= 0x2,
2358 	CTDP_CMD_OPERATION_REPORT	= 0x4,
2359 };/* CTDP_CMD_OPERATION_TYPE_E */
2360 
2361 /**
2362  * struct iwl_mvm_ctdp_cmd - track and manage the FW power consumption budget
2363  *
2364  * @operation: see &enum iwl_mvm_ctdp_cmd_operation
2365  * @budget: the budget in milliwatt
2366  * @window_size: defined in API but not used
2367  */
2368 struct iwl_mvm_ctdp_cmd {
2369 	__le32 operation;
2370 	__le32 budget;
2371 	__le32 window_size;
2372 } __packed;
2373 
2374 #define IWL_MAX_DTS_TRIPS	8
2375 
2376 /**
2377  * struct temp_report_ths_cmd - set temperature thresholds
2378  *
2379  * @num_temps: number of temperature thresholds passed
2380  * @thresholds: array with the thresholds to be configured
2381  */
2382 struct temp_report_ths_cmd {
2383 	__le32 num_temps;
2384 	__le16 thresholds[IWL_MAX_DTS_TRIPS];
2385 } __packed; /* GRP_PHY_TEMP_REPORTING_THRESHOLDS_CMD */
2386 
2387 /***********************************
2388  * TDLS API
2389  ***********************************/
2390 
2391 /* Type of TDLS request */
2392 enum iwl_tdls_channel_switch_type {
2393 	TDLS_SEND_CHAN_SW_REQ = 0,
2394 	TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
2395 	TDLS_MOVE_CH,
2396 }; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */
2397 
2398 /**
2399  * struct iwl_tdls_channel_switch_timing - Switch timing in TDLS channel-switch
2400  * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
2401  *	received from peer
2402  * @max_offchan_duration: What amount of microseconds out of a DTIM is given
2403  *	to the TDLS off-channel communication. For instance if the DTIM is
2404  *	200TU and the TDLS peer is to be given 25% of the time, the value
2405  *	given will be 50TU, or 50 * 1024 if translated into microseconds.
2406  * @switch_time: switch time the peer sent in its channel switch timing IE
2407  * @switch_timeout: switch timeout the peer sent in its channel switch timing IE
2408  */
2409 struct iwl_tdls_channel_switch_timing {
2410 	__le32 frame_timestamp; /* GP2 time of peer packet Rx */
2411 	__le32 max_offchan_duration; /* given in micro-seconds */
2412 	__le32 switch_time; /* given in micro-seconds */
2413 	__le32 switch_timeout; /* given in micro-seconds */
2414 } __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */
2415 
2416 #define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200
2417 
2418 /**
2419  * struct iwl_tdls_channel_switch_frame - TDLS channel switch frame template
2420  *
2421  * A template representing a TDLS channel-switch request or response frame
2422  *
2423  * @switch_time_offset: offset to the channel switch timing IE in the template
2424  * @tx_cmd: Tx parameters for the frame
2425  * @data: frame data
2426  */
2427 struct iwl_tdls_channel_switch_frame {
2428 	__le32 switch_time_offset;
2429 	struct iwl_tx_cmd tx_cmd;
2430 	u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
2431 } __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
2432 
2433 /**
2434  * struct iwl_tdls_channel_switch_cmd - TDLS channel switch command
2435  *
2436  * The command is sent to initiate a channel switch and also in response to
2437  * incoming TDLS channel-switch request/response packets from remote peers.
2438  *
2439  * @switch_type: see &enum iwl_tdls_channel_switch_type
2440  * @peer_sta_id: station id of TDLS peer
2441  * @ci: channel we switch to
2442  * @timing: timing related data for command
2443  * @frame: channel-switch request/response template, depending to switch_type
2444  */
2445 struct iwl_tdls_channel_switch_cmd {
2446 	u8 switch_type;
2447 	__le32 peer_sta_id;
2448 	struct iwl_fw_channel_info ci;
2449 	struct iwl_tdls_channel_switch_timing timing;
2450 	struct iwl_tdls_channel_switch_frame frame;
2451 } __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
2452 
2453 /**
2454  * struct iwl_tdls_channel_switch_notif - TDLS channel switch start notification
2455  *
2456  * @status: non-zero on success
2457  * @offchannel_duration: duration given in microseconds
2458  * @sta_id: peer currently performing the channel-switch with
2459  */
2460 struct iwl_tdls_channel_switch_notif {
2461 	__le32 status;
2462 	__le32 offchannel_duration;
2463 	__le32 sta_id;
2464 } __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */
2465 
2466 /**
2467  * struct iwl_tdls_sta_info - TDLS station info
2468  *
2469  * @sta_id: station id of the TDLS peer
2470  * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
2471  * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
2472  * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
2473  */
2474 struct iwl_tdls_sta_info {
2475 	u8 sta_id;
2476 	u8 tx_to_peer_tid;
2477 	__le16 tx_to_peer_ssn;
2478 	__le32 is_initiator;
2479 } __packed; /* TDLS_STA_INFO_VER_1 */
2480 
2481 /**
2482  * struct iwl_tdls_config_cmd - TDLS basic config command
2483  *
2484  * @id_and_color: MAC id and color being configured
2485  * @tdls_peer_count: amount of currently connected TDLS peers
2486  * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
2487  * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
2488  * @sta_info: per-station info. Only the first tdls_peer_count entries are set
2489  * @pti_req_data_offset: offset of network-level data for the PTI template
2490  * @pti_req_tx_cmd: Tx parameters for PTI request template
2491  * @pti_req_template: PTI request template data
2492  */
2493 struct iwl_tdls_config_cmd {
2494 	__le32 id_and_color; /* mac id and color */
2495 	u8 tdls_peer_count;
2496 	u8 tx_to_ap_tid;
2497 	__le16 tx_to_ap_ssn;
2498 	struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];
2499 
2500 	__le32 pti_req_data_offset;
2501 	struct iwl_tx_cmd pti_req_tx_cmd;
2502 	u8 pti_req_template[0];
2503 } __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */
2504 
2505 /**
2506  * struct iwl_tdls_config_sta_info_res - TDLS per-station config information
2507  *
2508  * @sta_id: station id of the TDLS peer
2509  * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
2510  *	the peer
2511  */
2512 struct iwl_tdls_config_sta_info_res {
2513 	__le16 sta_id;
2514 	__le16 tx_to_peer_last_seq;
2515 } __packed; /* TDLS_STA_INFO_RSP_VER_1 */
2516 
2517 /**
2518  * struct iwl_tdls_config_res - TDLS config information from FW
2519  *
2520  * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
2521  * @sta_info: per-station TDLS config information
2522  */
2523 struct iwl_tdls_config_res {
2524 	__le32 tx_to_ap_last_seq;
2525 	struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
2526 } __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */
2527 
2528 #define TX_FIFO_MAX_NUM_9000		8
2529 #define TX_FIFO_MAX_NUM			15
2530 #define RX_FIFO_MAX_NUM			2
2531 #define TX_FIFO_INTERNAL_MAX_NUM	6
2532 
2533 /**
2534  * struct iwl_shared_mem_cfg_v2 - Shared memory configuration information
2535  *
2536  * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
2537  *	accessible)
2538  * @shared_mem_size: shared memory size
2539  * @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to
2540  *	0x0 as accessible only via DBGM RDAT)
2541  * @sample_buff_size: internal sample buff size
2542  * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre
2543  *	8000 HW set to 0x0 as not accessible)
2544  * @txfifo_size: size of TXF0 ... TXF7
2545  * @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0
2546  * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
2547  *	when paging is not supported this should be 0
2548  * @page_buff_size: size of %page_buff_addr
2549  * @rxfifo_addr: Start address of rxFifo
2550  * @internal_txfifo_addr: start address of internalFifo
2551  * @internal_txfifo_size: internal fifos' size
2552  *
2553  * NOTE: on firmware that don't have IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG
2554  *	 set, the last 3 members don't exist.
2555  */
2556 struct iwl_shared_mem_cfg_v2 {
2557 	__le32 shared_mem_addr;
2558 	__le32 shared_mem_size;
2559 	__le32 sample_buff_addr;
2560 	__le32 sample_buff_size;
2561 	__le32 txfifo_addr;
2562 	__le32 txfifo_size[TX_FIFO_MAX_NUM_9000];
2563 	__le32 rxfifo_size[RX_FIFO_MAX_NUM];
2564 	__le32 page_buff_addr;
2565 	__le32 page_buff_size;
2566 	__le32 rxfifo_addr;
2567 	__le32 internal_txfifo_addr;
2568 	__le32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
2569 } __packed; /* SHARED_MEM_ALLOC_API_S_VER_2 */
2570 
2571 /**
2572  * struct iwl_shared_mem_lmac_cfg - LMAC shared memory configuration
2573  *
2574  * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB)
2575  * @txfifo_size: size of TX FIFOs
2576  * @rxfifo1_addr: RXF1 addr
2577  * @rxfifo1_size: RXF1 size
2578  */
2579 struct iwl_shared_mem_lmac_cfg {
2580 	__le32 txfifo_addr;
2581 	__le32 txfifo_size[TX_FIFO_MAX_NUM];
2582 	__le32 rxfifo1_addr;
2583 	__le32 rxfifo1_size;
2584 
2585 } __packed; /* SHARED_MEM_ALLOC_LMAC_API_S_VER_1 */
2586 
2587 /**
2588  * struct iwl_shared_mem_cfg - Shared memory configuration information
2589  *
2590  * @shared_mem_addr: shared memory address
2591  * @shared_mem_size: shared memory size
2592  * @sample_buff_addr: internal sample (mon/adc) buff addr
2593  * @sample_buff_size: internal sample buff size
2594  * @rxfifo2_addr: start addr of RXF2
2595  * @rxfifo2_size: size of RXF2
2596  * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
2597  *	when paging is not supported this should be 0
2598  * @page_buff_size: size of %page_buff_addr
2599  * @lmac_num: number of LMACs (1 or 2)
2600  * @lmac_smem: per - LMAC smem data
2601  */
2602 struct iwl_shared_mem_cfg {
2603 	__le32 shared_mem_addr;
2604 	__le32 shared_mem_size;
2605 	__le32 sample_buff_addr;
2606 	__le32 sample_buff_size;
2607 	__le32 rxfifo2_addr;
2608 	__le32 rxfifo2_size;
2609 	__le32 page_buff_addr;
2610 	__le32 page_buff_size;
2611 	__le32 lmac_num;
2612 	struct iwl_shared_mem_lmac_cfg lmac_smem[2];
2613 } __packed; /* SHARED_MEM_ALLOC_API_S_VER_3 */
2614 
2615 /**
2616  * struct iwl_mu_group_mgmt_cmd - VHT MU-MIMO group configuration
2617  *
2618  * @reserved: reserved
2619  * @membership_status: a bitmap of MU groups
2620  * @user_position:the position of station in a group. If the station is in the
2621  *	group then bits (group * 2) is the position -1
2622  */
2623 struct iwl_mu_group_mgmt_cmd {
2624 	__le32 reserved;
2625 	__le32 membership_status[2];
2626 	__le32 user_position[4];
2627 } __packed; /* MU_GROUP_ID_MNG_TABLE_API_S_VER_1 */
2628 
2629 /**
2630  * struct iwl_mu_group_mgmt_notif - VHT MU-MIMO group id notification
2631  *
2632  * @membership_status: a bitmap of MU groups
2633  * @user_position: the position of station in a group. If the station is in the
2634  *	group then bits (group * 2) is the position -1
2635  */
2636 struct iwl_mu_group_mgmt_notif {
2637 	__le32 membership_status[2];
2638 	__le32 user_position[4];
2639 } __packed; /* MU_GROUP_MNG_NTFY_API_S_VER_1 */
2640 
2641 #define MAX_STORED_BEACON_SIZE 600
2642 
2643 /**
2644  * struct iwl_stored_beacon_notif - Stored beacon notification
2645  *
2646  * @system_time: system time on air rise
2647  * @tsf: TSF on air rise
2648  * @beacon_timestamp: beacon on air rise
2649  * @band: band, matches &RX_RES_PHY_FLAGS_BAND_24 definition
2650  * @channel: channel this beacon was received on
2651  * @rates: rate in ucode internal format
2652  * @byte_count: frame's byte count
2653  * @data: beacon data, length in @byte_count
2654  */
2655 struct iwl_stored_beacon_notif {
2656 	__le32 system_time;
2657 	__le64 tsf;
2658 	__le32 beacon_timestamp;
2659 	__le16 band;
2660 	__le16 channel;
2661 	__le32 rates;
2662 	__le32 byte_count;
2663 	u8 data[MAX_STORED_BEACON_SIZE];
2664 } __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_2 */
2665 
2666 #define LQM_NUMBER_OF_STATIONS_IN_REPORT 16
2667 
2668 enum iwl_lqm_cmd_operatrions {
2669 	LQM_CMD_OPERATION_START_MEASUREMENT = 0x01,
2670 	LQM_CMD_OPERATION_STOP_MEASUREMENT = 0x02,
2671 };
2672 
2673 enum iwl_lqm_status {
2674 	LQM_STATUS_SUCCESS = 0,
2675 	LQM_STATUS_TIMEOUT = 1,
2676 	LQM_STATUS_ABORT = 2,
2677 };
2678 
2679 /**
2680  * struct iwl_link_qual_msrmnt_cmd - Link Quality Measurement command
2681  * @cmd_operation: command operation to be performed (start or stop)
2682  *	as defined above.
2683  * @mac_id: MAC ID the measurement applies to.
2684  * @measurement_time: time of the total measurement to be performed, in uSec.
2685  * @timeout: maximum time allowed until a response is sent, in uSec.
2686  */
2687 struct iwl_link_qual_msrmnt_cmd {
2688 	__le32 cmd_operation;
2689 	__le32 mac_id;
2690 	__le32 measurement_time;
2691 	__le32 timeout;
2692 } __packed /* LQM_CMD_API_S_VER_1 */;
2693 
2694 /**
2695  * struct iwl_link_qual_msrmnt_notif - Link Quality Measurement notification
2696  *
2697  * @frequent_stations_air_time: an array containing the total air time
2698  *	(in uSec) used by the most frequently transmitting stations.
2699  * @number_of_stations: the number of uniqe stations included in the array
2700  *	(a number between 0 to 16)
2701  * @total_air_time_other_stations: the total air time (uSec) used by all the
2702  *	stations which are not included in the above report.
2703  * @time_in_measurement_window: the total time in uSec in which a measurement
2704  *	took place.
2705  * @tx_frame_dropped: the number of TX frames dropped due to retry limit during
2706  *	measurement
2707  * @mac_id: MAC ID the measurement applies to.
2708  * @status: return status. may be one of the LQM_STATUS_* defined above.
2709  * @reserved: reserved.
2710  */
2711 struct iwl_link_qual_msrmnt_notif {
2712 	__le32 frequent_stations_air_time[LQM_NUMBER_OF_STATIONS_IN_REPORT];
2713 	__le32 number_of_stations;
2714 	__le32 total_air_time_other_stations;
2715 	__le32 time_in_measurement_window;
2716 	__le32 tx_frame_dropped;
2717 	__le32 mac_id;
2718 	__le32 status;
2719 	u8 reserved[12];
2720 } __packed; /* LQM_MEASUREMENT_COMPLETE_NTF_API_S_VER1 */
2721 
2722 /**
2723  * struct iwl_channel_switch_noa_notif - Channel switch NOA notification
2724  *
2725  * @id_and_color: ID and color of the MAC
2726  */
2727 struct iwl_channel_switch_noa_notif {
2728 	__le32 id_and_color;
2729 } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */
2730 
2731 /* Operation types for the debug mem access */
2732 enum {
2733 	DEBUG_MEM_OP_READ = 0,
2734 	DEBUG_MEM_OP_WRITE = 1,
2735 	DEBUG_MEM_OP_WRITE_BYTES = 2,
2736 };
2737 
2738 #define DEBUG_MEM_MAX_SIZE_DWORDS 32
2739 
2740 /**
2741  * struct iwl_dbg_mem_access_cmd - Request the device to read/write memory
2742  * @op: DEBUG_MEM_OP_*
2743  * @addr: address to read/write from/to
2744  * @len: in dwords, to read/write
2745  * @data: for write opeations, contains the source buffer
2746  */
2747 struct iwl_dbg_mem_access_cmd {
2748 	__le32 op;
2749 	__le32 addr;
2750 	__le32 len;
2751 	__le32 data[];
2752 } __packed; /* DEBUG_(U|L)MAC_RD_WR_CMD_API_S_VER_1 */
2753 
2754 /* Status responses for the debug mem access */
2755 enum {
2756 	DEBUG_MEM_STATUS_SUCCESS = 0x0,
2757 	DEBUG_MEM_STATUS_FAILED = 0x1,
2758 	DEBUG_MEM_STATUS_LOCKED = 0x2,
2759 	DEBUG_MEM_STATUS_HIDDEN = 0x3,
2760 	DEBUG_MEM_STATUS_LENGTH = 0x4,
2761 };
2762 
2763 /**
2764  * struct iwl_dbg_mem_access_rsp - Response to debug mem commands
2765  * @status: DEBUG_MEM_STATUS_*
2766  * @len: read dwords (0 for write operations)
2767  * @data: contains the read DWs
2768  */
2769 struct iwl_dbg_mem_access_rsp {
2770 	__le32 status;
2771 	__le32 len;
2772 	__le32 data[];
2773 } __packed; /* DEBUG_(U|L)MAC_RD_WR_RSP_API_S_VER_1 */
2774 
2775 /**
2776  * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
2777  * @reserved: reserved
2778  */
2779 struct iwl_nvm_access_complete_cmd {
2780 	__le32 reserved;
2781 } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
2782 
2783 /**
2784  * enum iwl_extended_cfg_flag - commands driver may send before
2785  *	finishing init flow
2786  * @IWL_INIT_DEBUG_CFG: driver is going to send debug config command
2787  * @IWL_INIT_NVM: driver is going to send NVM_ACCESS commands
2788  * @IWL_INIT_PHY: driver is going to send PHY_DB commands
2789  */
2790 enum iwl_extended_cfg_flags {
2791 	IWL_INIT_DEBUG_CFG,
2792 	IWL_INIT_NVM,
2793 	IWL_INIT_PHY,
2794 };
2795 
2796 /**
2797  * struct iwl_extended_cfg_cmd - mark what commands ucode should wait for
2798  * before finishing init flows
2799  * @init_flags: values from iwl_extended_cfg_flags
2800  */
2801 struct iwl_init_extended_cfg_cmd {
2802 	__le32 init_flags;
2803 } __packed; /* INIT_EXTENDED_CFG_CMD_API_S_VER_1 */
2804 
2805 /*
2806  * struct iwl_nvm_get_info - request to get NVM data
2807  */
2808 struct iwl_nvm_get_info {
2809 	__le32 reserved;
2810 } __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */
2811 
2812 /**
2813  * struct iwl_nvm_get_info_general - general NVM data
2814  * @flags: 1 - empty, 0 - valid
2815  * @nvm_version: nvm version
2816  * @board_type: board type
2817  * @reserved: reserved
2818  */
2819 struct iwl_nvm_get_info_general {
2820 	__le32 flags;
2821 	__le16 nvm_version;
2822 	u8 board_type;
2823 	u8 reserved;
2824 } __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */
2825 
2826 /**
2827  * struct iwl_nvm_get_info_sku - mac information
2828  * @enable_24g: band 2.4G enabled
2829  * @enable_5g: band 5G enabled
2830  * @enable_11n: 11n enabled
2831  * @enable_11ac: 11ac enabled
2832  * @mimo_disable: MIMO enabled
2833  * @ext_crypto: Extended crypto enabled
2834  */
2835 struct iwl_nvm_get_info_sku {
2836 	__le32 enable_24g;
2837 	__le32 enable_5g;
2838 	__le32 enable_11n;
2839 	__le32 enable_11ac;
2840 	__le32 mimo_disable;
2841 	__le32 ext_crypto;
2842 } __packed; /* GRP_REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_1 */
2843 
2844 /**
2845  * struct iwl_nvm_get_info_phy - phy information
2846  * @tx_chains: BIT 0 chain A, BIT 1 chain B
2847  * @rx_chains: BIT 0 chain A, BIT 1 chain B
2848  */
2849 struct iwl_nvm_get_info_phy {
2850 	__le32 tx_chains;
2851 	__le32 rx_chains;
2852 } __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
2853 
2854 #define IWL_NUM_CHANNELS (51)
2855 
2856 /**
2857  * struct iwl_nvm_get_info_regulatory - regulatory information
2858  * @lar_enabled: is LAR enabled
2859  * @channel_profile: regulatory data of this channel
2860  * @reserved: reserved
2861  */
2862 struct iwl_nvm_get_info_regulatory {
2863 	__le32 lar_enabled;
2864 	__le16 channel_profile[IWL_NUM_CHANNELS];
2865 	__le16 reserved;
2866 } __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
2867 
2868 /**
2869  * struct iwl_nvm_get_info_rsp - response to get NVM data
2870  * @general: general NVM data
2871  * @mac_sku: data relating to MAC sku
2872  * @phy_sku: data relating to PHY sku
2873  * @regulatory: regulatory data
2874  */
2875 struct iwl_nvm_get_info_rsp {
2876 	struct iwl_nvm_get_info_general general;
2877 	struct iwl_nvm_get_info_sku mac_sku;
2878 	struct iwl_nvm_get_info_phy phy_sku;
2879 	struct iwl_nvm_get_info_regulatory regulatory;
2880 } __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_1 */
2881 
2882 /**
2883  * struct iwl_mvm_antenna_coupling_notif - antenna coupling notification
2884  * @isolation: antenna isolation value
2885  */
2886 struct iwl_mvm_antenna_coupling_notif {
2887 	__le32 isolation;
2888 } __packed;
2889 
2890 #endif /* __fw_api_h__ */
2891