fw-api.h 77.5 KB
Newer Older
J
Johannes Berg 已提交
1 2 3 4 5 6 7
/******************************************************************************
 *
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
 *
 * GPL LICENSE SUMMARY
 *
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
J
Johannes Berg 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
 * USA
 *
 * The full GNU General Public License is included in this distribution
27
 * in the file called COPYING.
J
Johannes Berg 已提交
28 29
 *
 * Contact Information:
30
 *  Intel Linux Wireless <linuxwifi@intel.com>
J
Johannes Berg 已提交
31 32 33 34
 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 *
 * BSD LICENSE
 *
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
J
Johannes Berg 已提交
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name Intel Corporation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

#ifndef __fw_api_h__
#define __fw_api_h__

#include "fw-api-rs.h"
72
#include "fw-api-rx.h"
J
Johannes Berg 已提交
73 74 75 76 77
#include "fw-api-tx.h"
#include "fw-api-sta.h"
#include "fw-api-mac.h"
#include "fw-api-power.h"
#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"
J
Johannes Berg 已提交
82

83
/* Tx queue numbers for non-DQA mode */
J
Johannes Berg 已提交
84 85 86 87 88
enum {
	IWL_MVM_OFFCHANNEL_QUEUE = 8,
	IWL_MVM_CMD_QUEUE = 9,
};

89 90 91
/*
 * DQA queue numbers
 *
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 97
 * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure
 *	that we are never left without the possibility to connect to an AP.
98 99 100 101
 * @IWL_MVM_DQA_MIN_MGMT_QUEUE: first TXQ in pool for MGMT and non-QOS frames.
 *	Each MGMT queue is mapped to a single STA
 *	MGMT frames are frames that return true on ieee80211_is_mgmt()
 * @IWL_MVM_DQA_MAX_MGMT_QUEUE: last TXQ in pool for MGMT frames
102 103
 * @IWL_MVM_DQA_AP_PROBE_RESP_QUEUE: a queue reserved for P2P GO/SoftAP probe
 *	responses
104 105 106 107 108 109 110
 * @IWL_MVM_DQA_MIN_DATA_QUEUE: first TXQ in pool for DATA frames.
 *	DATA frames are intended for !ieee80211_is_mgmt() frames, but if
 *	the MGMT TXQ pool is exhausted, mgmt frames can be sent on DATA queues
 *	as well
 * @IWL_MVM_DQA_MAX_DATA_QUEUE: last TXQ in pool for DATA frames
 */
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 117
	IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
	IWL_MVM_DQA_MAX_MGMT_QUEUE = 8,
118
	IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9,
119 120 121 122
	IWL_MVM_DQA_MIN_DATA_QUEUE = 10,
	IWL_MVM_DQA_MAX_DATA_QUEUE = 31,
};

123 124 125 126 127 128 129 130
enum iwl_mvm_tx_fifo {
	IWL_MVM_TX_FIFO_BK = 0,
	IWL_MVM_TX_FIFO_BE,
	IWL_MVM_TX_FIFO_VI,
	IWL_MVM_TX_FIFO_VO,
	IWL_MVM_TX_FIFO_MCAST = 5,
	IWL_MVM_TX_FIFO_CMD = 7,
};
131

132

133 134 135
/**
 * enum iwl_legacy_cmds - legacy group command IDs
 */
136
enum iwl_legacy_cmds {
137 138 139 140 141
	/**
	 * @MVM_ALIVE:
	 * Alive data from the firmware, as described in
	 * &struct mvm_alive_resp_v3 or &struct mvm_alive_resp.
	 */
J
Johannes Berg 已提交
142
	MVM_ALIVE = 0x1,
143 144 145 146

	/**
	 * @REPLY_ERROR: Cause an error in the firmware, for testing purposes.
	 */
J
Johannes Berg 已提交
147
	REPLY_ERROR = 0x2,
148 149 150 151

	/**
	 * @ECHO_CMD: Send data to the device to have it returned immediately.
	 */
152
	ECHO_CMD = 0x3,
J
Johannes Berg 已提交
153

154 155 156
	/**
	 * @INIT_COMPLETE_NOTIF: Notification that initialization is complete.
	 */
J
Johannes Berg 已提交
157 158
	INIT_COMPLETE_NOTIF = 0x4,

159 160 161 162
	/**
	 * @PHY_CONTEXT_CMD:
	 * Add/modify/remove a PHY context, using &struct iwl_phy_context_cmd.
	 */
J
Johannes Berg 已提交
163
	PHY_CONTEXT_CMD = 0x8,
164 165 166 167

	/**
	 * @DBG_CFG: Debug configuration command.
	 */
J
Johannes Berg 已提交
168
	DBG_CFG = 0x9,
169 170 171 172 173

	/**
	 * @ANTENNA_COUPLING_NOTIFICATION:
	 * Antenna coupling data, &struct iwl_mvm_antenna_coupling_notif
	 */
174
	ANTENNA_COUPLING_NOTIFICATION = 0xa,
J
Johannes Berg 已提交
175

176 177 178 179 180
	/**
	 * @SCAN_ITERATION_COMPLETE_UMAC:
	 * Firmware indicates a scan iteration completed, using
	 * &struct iwl_umac_scan_iter_complete_notif.
	 */
181
	SCAN_ITERATION_COMPLETE_UMAC = 0xb5,
182 183 184 185 186

	/**
	 * @SCAN_CFG_CMD:
	 * uses &struct iwl_scan_config_v1 or &struct iwl_scan_config
	 */
187 188 189
	SCAN_CFG_CMD = 0xc,
	SCAN_REQ_UMAC = 0xd,
	SCAN_ABORT_UMAC = 0xe,
190 191 192 193

	/**
	 * @SCAN_COMPLETE_UMAC: uses &struct iwl_umac_scan_complete
	 */
194 195
	SCAN_COMPLETE_UMAC = 0xf,

196 197
	BA_WINDOW_STATUS_NOTIFICATION_ID = 0x13,

198 199 200 201 202
	/**
	 * @ADD_STA_KEY:
	 * &struct iwl_mvm_add_sta_key_cmd_v1 or
	 * &struct iwl_mvm_add_sta_key_cmd.
	 */
203
	ADD_STA_KEY = 0x17,
204 205 206 207 208

	/**
	 * @ADD_STA:
	 * &struct iwl_mvm_add_sta_cmd or &struct iwl_mvm_add_sta_cmd_v7.
	 */
J
Johannes Berg 已提交
209
	ADD_STA = 0x18,
210 211 212
	/**
	 * @REMOVE_STA: &struct iwl_mvm_rm_sta_cmd
	 */
J
Johannes Berg 已提交
213 214
	REMOVE_STA = 0x19,

215 216 217
	/* paging get item */
	FW_GET_ITEM_CMD = 0x1a,

J
Johannes Berg 已提交
218 219
	/* TX */
	TX_CMD = 0x1c,
220 221 222 223

	/**
	 * @TXPATH_FLUSH: &struct iwl_tx_path_flush_cmd
	 */
J
Johannes Berg 已提交
224
	TXPATH_FLUSH = 0x1e,
225 226 227 228 229 230

	/**
	 * @MGMT_MCAST_KEY:
	 * &struct iwl_mvm_mgmt_mcast_key_cmd or
	 * &struct iwl_mvm_mgmt_mcast_key_cmd_v1
	 */
J
Johannes Berg 已提交
231 232
	MGMT_MCAST_KEY = 0x1f,

233
	/* scheduler config */
234 235 236
	/**
	 * @SCD_QUEUE_CFG: &struct iwl_scd_txq_cfg_cmd
	 */
237 238
	SCD_QUEUE_CFG = 0x1d,

J
Johannes Berg 已提交
239 240 241
	/* global key */
	WEP_KEY = 0x20,

242 243 244
	/* Memory */
	SHARED_MEM_CFG = 0x25,

245 246 247
	/* TDLS */
	TDLS_CHANNEL_SWITCH_CMD = 0x27,
	TDLS_CHANNEL_SWITCH_NOTIFICATION = 0xaa,
248
	TDLS_CONFIG_CMD = 0xa7,
249

250 251 252
	/**
	 * @MAC_CONTEXT_CMD: &struct iwl_mac_ctx_cmd
	 */
J
Johannes Berg 已提交
253
	MAC_CONTEXT_CMD = 0x28,
254 255 256 257 258

	/**
	 * @TIME_EVENT_CMD:
	 * &struct iwl_time_event_cmd, response in &struct iwl_time_event_resp
	 */
J
Johannes Berg 已提交
259
	TIME_EVENT_CMD = 0x29, /* both CMD and response */
260 261 262
	/**
	 * @TIME_EVENT_NOTIFICATION: &struct iwl_time_event_notif
	 */
J
Johannes Berg 已提交
263
	TIME_EVENT_NOTIFICATION = 0x2a,
264 265 266 267
	/**
	 * @BINDING_CONTEXT_CMD:
	 * &struct iwl_binding_cmd or &struct iwl_binding_cmd_v1
	 */
J
Johannes Berg 已提交
268
	BINDING_CONTEXT_CMD = 0x2b,
269 270 271
	/**
	 * @TIME_QUOTA_CMD: &struct iwl_time_quota_cmd
	 */
J
Johannes Berg 已提交
272
	TIME_QUOTA_CMD = 0x2c,
273
	NON_QOS_TX_COUNTER_CMD = 0x2d,
J
Johannes Berg 已提交
274

275 276 277
	/**
	 * @LQ_CMD: using &struct iwl_lq_cmd
	 */
J
Johannes Berg 已提交
278 279
	LQ_CMD = 0x4e,

280 281 282 283
	/**
	 * @FW_PAGING_BLOCK_CMD:
	 * &struct iwl_fw_paging_cmd or &struct iwl_fw_paging_cmd_v1
	 */
284 285
	FW_PAGING_BLOCK_CMD = 0x4f,

J
Johannes Berg 已提交
286 287 288
	/* Scan offload */
	SCAN_OFFLOAD_REQUEST_CMD = 0x51,
	SCAN_OFFLOAD_ABORT_CMD = 0x52,
289
	HOT_SPOT_CMD = 0x53,
J
Johannes Berg 已提交
290 291 292
	SCAN_OFFLOAD_COMPLETE = 0x6D,
	SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
	SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
293
	MATCH_FOUND_NOTIFICATION = 0xd9,
294
	SCAN_ITERATION_COMPLETE = 0xe7,
J
Johannes Berg 已提交
295 296

	/* Phy */
297 298 299
	/**
	 * @PHY_CONFIGURATION_CMD: &struct iwl_phy_cfg_cmd
	 */
J
Johannes Berg 已提交
300 301
	PHY_CONFIGURATION_CMD = 0x6a,
	CALIB_RES_NOTIF_PHY_DB = 0x6b,
302
	PHY_DB_CMD = 0x6c,
J
Johannes Berg 已提交
303

304 305 306 307
	/* ToF - 802.11mc FTM */
	TOF_CMD = 0x10,
	TOF_NOTIFICATION = 0x11,

308 309 310
	/**
	 * @POWER_TABLE_CMD: &struct iwl_device_power_cmd
	 */
J
Johannes Berg 已提交
311
	POWER_TABLE_CMD = 0x77,
312
	PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
E
Emmanuel Grumbach 已提交
313
	LTR_CONFIG = 0xee,
J
Johannes Berg 已提交
314

315 316 317
	/* Thermal Throttling*/
	REPLY_THERMAL_MNG_BACKOFF = 0x7e,

318 319 320
	/* Set/Get DC2DC frequency tune */
	DC2DC_CONFIG_CMD = 0x83,

321 322 323
	/**
	 * @NVM_ACCESS_CMD: using &struct iwl_nvm_access_cmd
	 */
J
Johannes Berg 已提交
324 325 326 327
	NVM_ACCESS_CMD = 0x88,

	SET_CALIB_DEFAULT_CMD = 0x8e,

328
	BEACON_NOTIFICATION = 0x90,
J
Johannes Berg 已提交
329
	BEACON_TEMPLATE_CMD = 0x91,
330 331 332
	/**
	 * @TX_ANT_CONFIGURATION_CMD: &struct iwl_tx_ant_cfg_cmd
	 */
J
Johannes Berg 已提交
333
	TX_ANT_CONFIGURATION_CMD = 0x98,
334 335 336 337

	/**
	 * @STATISTICS_CMD: &struct iwl_statistics_cmd
	 */
338
	STATISTICS_CMD = 0x9c,
339 340 341 342 343 344 345

	/**
	 * @STATISTICS_NOTIFICATION:
	 * one of &struct iwl_notif_statistics_v10,
	 * &struct iwl_notif_statistics_v11,
	 * &struct iwl_notif_statistics_cdb
	 */
J
Johannes Berg 已提交
346
	STATISTICS_NOTIFICATION = 0x9d,
347
	EOSP_NOTIFICATION = 0x9e,
348 349 350 351 352

	/**
	 * @REDUCE_TX_POWER_CMD:
	 * &struct iwl_dev_tx_power_cmd_v3 or &struct iwl_dev_tx_power_cmd
	 */
353
	REDUCE_TX_POWER_CMD = 0x9f,
J
Johannes Berg 已提交
354 355 356 357 358

	/* RF-KILL commands and notifications */
	CARD_STATE_CMD = 0xa0,
	CARD_STATE_NOTIFICATION = 0xa1,

359 360
	MISSED_BEACONS_NOTIFICATION = 0xa2,

361 362 363
	/**
	 * @MAC_PM_POWER_TABLE: using &struct iwl_mac_power_cmd
	 */
364 365
	MAC_PM_POWER_TABLE = 0xa9,

366 367 368
	/**
	 * @MFUART_LOAD_NOTIFICATION: &struct iwl_mfuart_load_notif
	 */
369 370
	MFUART_LOAD_NOTIFICATION = 0xb1,

371 372 373
	/**
	 * @RSS_CONFIG_CMD: &struct iwl_rss_config_cmd
	 */
374 375
	RSS_CONFIG_CMD = 0xb3,

J
Johannes Berg 已提交
376 377
	REPLY_RX_PHY_CMD = 0xc0,
	REPLY_RX_MPDU_CMD = 0xc1,
378
	FRAME_RELEASE = 0xc3,
J
Johannes Berg 已提交
379 380
	BA_NOTIF = 0xc5,

381
	/* Location Aware Regulatory */
382 383 384
	/**
	 * @MCC_UPDATE_CMD: using &struct iwl_mcc_update_cmd
	 */
385
	MCC_UPDATE_CMD = 0xc8,
386 387 388 389

	/**
	 * @MCC_CHUB_UPDATE_CMD: using &struct iwl_mcc_chub_notif
	 */
390
	MCC_CHUB_UPDATE_CMD = 0xc9,
391

392 393
	MARKER_CMD = 0xcb,

394 395 396
	/* BT Coex */
	BT_COEX_PRIO_TABLE = 0xcc,
	BT_COEX_PROT_ENV = 0xcd,
397 398 399
	/**
	 * @BT_PROFILE_NOTIFICATION: &struct iwl_bt_coex_profile_notif
	 */
400
	BT_PROFILE_NOTIFICATION = 0xce,
401 402 403
	/**
	 * @BT_CONFIG: &struct iwl_bt_coex_cmd
	 */
404 405 406 407
	BT_CONFIG = 0x9b,
	BT_COEX_UPDATE_SW_BOOST = 0x5a,
	BT_COEX_UPDATE_CORUN_LUT = 0x5b,
	BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
408 409 410
	/**
	 * @BT_COEX_CI: &struct iwl_bt_coex_ci_cmd
	 */
E
Emmanuel Grumbach 已提交
411
	BT_COEX_CI = 0x5d,
412

413 414 415
	/**
	 * @REPLY_SF_CFG_CMD: &struct iwl_sf_cfg_cmd
	 */
416
	REPLY_SF_CFG_CMD = 0xd1,
417 418 419
	/**
	 * @REPLY_BEACON_FILTERING_CMD: &struct iwl_beacon_filter_cmd
	 */
420 421
	REPLY_BEACON_FILTERING_CMD = 0xd2,

422 423 424 425
	/* DTS measurements */
	CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
	DTS_MEASUREMENT_NOTIFICATION = 0xdd,

J
Johannes Berg 已提交
426
	REPLY_DEBUG_CMD = 0xf0,
427
	LDBG_CONFIG_CMD = 0xf6,
J
Johannes Berg 已提交
428 429
	DEBUG_LOG_MSG = 0xf7,

430
	BCAST_FILTER_CMD = 0xcf,
431 432
	MCAST_FILTER_CMD = 0xd0,

433 434 435
	/**
	 * @D3_CONFIG_CMD: &struct iwl_d3_manager_config
	 */
J
Johannes Berg 已提交
436 437 438 439
	D3_CONFIG_CMD = 0xd3,
	PROT_OFFLOAD_CONFIG_CMD = 0xd4,
	OFFLOADS_QUERY_CMD = 0xd5,
	REMOTE_WAKE_CONFIG_CMD = 0xd6,
440
	D0I3_END_CMD = 0xed,
J
Johannes Berg 已提交
441

442 443 444
	/**
	 * @WOWLAN_PATTERNS: &struct iwl_wowlan_patterns_cmd
	 */
J
Johannes Berg 已提交
445
	WOWLAN_PATTERNS = 0xe0,
446 447 448 449

	/**
	 * @WOWLAN_CONFIGURATION: &struct iwl_wowlan_config_cmd
	 */
J
Johannes Berg 已提交
450
	WOWLAN_CONFIGURATION = 0xe1,
451 452 453
	/**
	 * @WOWLAN_TSC_RSC_PARAM: &struct iwl_wowlan_rsc_tsc_params_cmd
	 */
J
Johannes Berg 已提交
454
	WOWLAN_TSC_RSC_PARAM = 0xe2,
455 456 457
	/**
	 * @WOWLAN_TKIP_PARAM: &struct iwl_wowlan_tkip_params_cmd
	 */
J
Johannes Berg 已提交
458
	WOWLAN_TKIP_PARAM = 0xe3,
459 460 461
	/**
	 * @WOWLAN_KEK_KCK_MATERIAL: &struct iwl_wowlan_kek_kck_material_cmd
	 */
J
Johannes Berg 已提交
462
	WOWLAN_KEK_KCK_MATERIAL = 0xe4,
463 464 465
	/**
	 * @WOWLAN_GET_STATUSES: response in &struct iwl_wowlan_status
	 */
J
Johannes Berg 已提交
466 467 468 469
	WOWLAN_GET_STATUSES = 0xe5,
	WOWLAN_TX_POWER_PER_DB = 0xe6,

	/* and for NetDetect */
470 471 472
	SCAN_OFFLOAD_PROFILES_QUERY_CMD = 0x56,
	SCAN_OFFLOAD_HOTSPOTS_CONFIG_CMD = 0x58,
	SCAN_OFFLOAD_HOTSPOTS_QUERY_CMD = 0x59,
J
Johannes Berg 已提交
473 474 475 476

	REPLY_MAX = 0xff,
};

477 478 479
/* Please keep this enum *SORTED* by hex value.
 * Needed for binary search, otherwise a warning will be triggered.
 */
480 481 482
enum iwl_mac_conf_subcmd_ids {
	LINK_QUALITY_MEASUREMENT_CMD = 0x1,
	LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF = 0xFE,
483
	CHANNEL_SWITCH_NOA_NOTIF = 0xFF,
484 485
};

486 487 488
/**
 * enum iwl_phy_ops_subcmd_ids - PHY group commands
 */
489 490
enum iwl_phy_ops_subcmd_ids {
	CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
491
	CTDP_CONFIG_CMD = 0x03,
492 493 494 495

	/**
	 * @TEMP_REPORTING_THRESHOLDS_CMD: &struct temp_report_ths_cmd
	 */
496
	TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
497
	GEO_TX_POWER_LIMIT = 0x05,
498
	CT_KILL_NOTIFICATION = 0xFE,
499 500 501
	DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
};

502 503 504
/**
 * enum iwl_system_subcmd_ids - system group command IDs
 */
505
enum iwl_system_subcmd_ids {
506 507 508 509 510
	/**
	 * @SHARED_MEM_CFG_CMD:
	 * response in &struct iwl_shared_mem_cfg or
	 * &struct iwl_shared_mem_cfg_v1
	 */
511
	SHARED_MEM_CFG_CMD = 0x0,
512
	INIT_EXTENDED_CFG_CMD = 0x03,
513 514
};

515 516 517
/**
 * enum iwl_data_path_subcmd_ids - data path group commands
 */
518
enum iwl_data_path_subcmd_ids {
519 520 521
	/**
	 * @DQA_ENABLE_CMD: &struct iwl_dqa_enable_cmd
	 */
522
	DQA_ENABLE_CMD = 0x0,
523
	UPDATE_MU_GROUPS_CMD = 0x1,
524
	TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2,
525
	STA_PM_NOTIF = 0xFD,
526
	MU_GROUP_MGMT_NOTIF = 0xFE,
527
	RX_QUEUES_NOTIFICATION = 0xFF,
528 529
};

530 531 532 533
enum iwl_prot_offload_subcmd_ids {
	STORED_BEACON_NTF = 0xFF,
};

534 535
enum iwl_regulatory_and_nvm_subcmd_ids {
	NVM_ACCESS_COMPLETE = 0x0,
536
	NVM_GET_INFO = 0x2,
537 538
};

539
enum iwl_debug_cmds {
I
Ido Yariv 已提交
540 541
	LMAC_RD_WR = 0x0,
	UMAC_RD_WR = 0x1,
542
	MFU_ASSERT_DUMP_NTF = 0xFE,
I
Ido Yariv 已提交
543 544
};

545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
/**
 * enum iwl_mvm_command_groups - command groups for the firmware
 * @LEGACY_GROUP: legacy group, uses command IDs from &enum iwl_legacy_cmds
 * @LONG_GROUP: legacy group with long header, also uses command IDs
 *	from &enum iwl_legacy_cmds
 * @SYSTEM_GROUP: system group, uses command IDs from
 *	&enum iwl_system_subcmd_ids
 * @MAC_CONF_GROUP: MAC configuration group, uses command IDs from
 *	&enum iwl_mac_conf_subcmd_ids
 * @PHY_OPS_GROUP: PHY operations group, uses command IDs from
 *	&enum iwl_phy_ops_subcmd_ids
 * @DATA_PATH_GROUP: data path group, uses command IDs from
 *	&enum iwl_data_path_subcmd_ids
 * @SCAN_GROUP: scan group, uses command IDs from &enum iwl_scan_subcmd_ids
 * @NAN_GROUP: NAN group, uses command IDs from &enum iwl_nan_subcmd_ids
 * @TOF_GROUP: TOF group, uses command IDs from &enum iwl_tof_subcmd_ids
 * @PROT_OFFLOAD_GROUP: protocol offload group, uses command IDs from
 *	&enum iwl_prot_offload_subcmd_ids
 * @REGULATORY_AND_NVM_GROUP: regulatory/NVM group, uses command IDs from
 *	&enum iwl_regulatory_and_nvm_subcmd_ids
 * @DEBUG_GROUP: Debug group, uses command IDs from &enum iwl_debug_cmds
 */
enum iwl_mvm_command_groups {
568 569
	LEGACY_GROUP = 0x0,
	LONG_GROUP = 0x1,
570
	SYSTEM_GROUP = 0x2,
571
	MAC_CONF_GROUP = 0x3,
572
	PHY_OPS_GROUP = 0x4,
573
	DATA_PATH_GROUP = 0x5,
574
	PROT_OFFLOAD_GROUP = 0xb,
575
	REGULATORY_AND_NVM_GROUP = 0xc,
I
Ido Yariv 已提交
576
	DEBUG_GROUP = 0xf,
577 578
};

J
Johannes Berg 已提交
579 580 581 582 583 584 585 586
/**
 * struct iwl_cmd_response - generic response struct for most commands
 * @status: status of the command asked, changes for each one
 */
struct iwl_cmd_response {
	__le32 status;
};

587 588 589 590 591 592 593 594
/*
 * struct iwl_dqa_enable_cmd
 * @cmd_queue: the TXQ number of the command queue
 */
struct iwl_dqa_enable_cmd {
	__le32 cmd_queue;
} __packed; /* DQA_CONTROL_CMD_API_S_VER_1 */

J
Johannes Berg 已提交
595 596 597 598 599 600 601 602
/*
 * struct iwl_tx_ant_cfg_cmd
 * @valid: valid antenna configuration
 */
struct iwl_tx_ant_cfg_cmd {
	__le32 valid;
} __packed;

603 604
/**
 * struct iwl_calib_ctrl - Calibration control struct.
J
Johannes Berg 已提交
605 606
 * Sent as part of the phy configuration command.
 * @flow_trigger: bitmap for which calibrations to perform according to
607
 *		flow triggers, using &enum iwl_calib_cfg
J
Johannes Berg 已提交
608
 * @event_trigger: bitmap for which calibrations to perform according to
609
 *		event triggers, using &enum iwl_calib_cfg
J
Johannes Berg 已提交
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
 */
struct iwl_calib_ctrl {
	__le32 flow_trigger;
	__le32 event_trigger;
} __packed;

/* This enum defines the bitmap of various calibrations to enable in both
 * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
 */
enum iwl_calib_cfg {
	IWL_CALIB_CFG_XTAL_IDX			= BIT(0),
	IWL_CALIB_CFG_TEMPERATURE_IDX		= BIT(1),
	IWL_CALIB_CFG_VOLTAGE_READ_IDX		= BIT(2),
	IWL_CALIB_CFG_PAPD_IDX			= BIT(3),
	IWL_CALIB_CFG_TX_PWR_IDX		= BIT(4),
	IWL_CALIB_CFG_DC_IDX			= BIT(5),
	IWL_CALIB_CFG_BB_FILTER_IDX		= BIT(6),
	IWL_CALIB_CFG_LO_LEAKAGE_IDX		= BIT(7),
	IWL_CALIB_CFG_TX_IQ_IDX			= BIT(8),
	IWL_CALIB_CFG_TX_IQ_SKEW_IDX		= BIT(9),
	IWL_CALIB_CFG_RX_IQ_IDX			= BIT(10),
	IWL_CALIB_CFG_RX_IQ_SKEW_IDX		= BIT(11),
	IWL_CALIB_CFG_SENSITIVITY_IDX		= BIT(12),
	IWL_CALIB_CFG_CHAIN_NOISE_IDX		= BIT(13),
	IWL_CALIB_CFG_DISCONNECTED_ANT_IDX	= BIT(14),
	IWL_CALIB_CFG_ANT_COUPLING_IDX		= BIT(15),
	IWL_CALIB_CFG_DAC_IDX			= BIT(16),
	IWL_CALIB_CFG_ABS_IDX			= BIT(17),
	IWL_CALIB_CFG_AGC_IDX			= BIT(18),
};

641 642 643 644
/**
 * struct iwl_phy_cfg_cmd - Phy configuration command
 * @phy_cfg: PHY configuration value, uses &enum iwl_fw_phy_cfg
 * @calib_control: calibration control data
J
Johannes Berg 已提交
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662
 */
struct iwl_phy_cfg_cmd {
	__le32	phy_cfg;
	struct iwl_calib_ctrl calib_control;
} __packed;

#define PHY_CFG_RADIO_TYPE	(BIT(0) | BIT(1))
#define PHY_CFG_RADIO_STEP	(BIT(2) | BIT(3))
#define PHY_CFG_RADIO_DASH	(BIT(4) | BIT(5))
#define PHY_CFG_PRODUCT_NUMBER	(BIT(6) | BIT(7))
#define PHY_CFG_TX_CHAIN_A	BIT(8)
#define PHY_CFG_TX_CHAIN_B	BIT(9)
#define PHY_CFG_TX_CHAIN_C	BIT(10)
#define PHY_CFG_RX_CHAIN_A	BIT(12)
#define PHY_CFG_RX_CHAIN_B	BIT(13)
#define PHY_CFG_RX_CHAIN_C	BIT(14)


663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
/**
 * enum iwl_nvm_access_op - NVM access opcode
 * @IWL_NVM_READ: read NVM
 * @IWL_NVM_WRITE: write NVM
 */
enum iwl_nvm_access_op {
	IWL_NVM_READ	= 0,
	IWL_NVM_WRITE	= 1,
};

/**
 * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
 * @NVM_ACCESS_TARGET_CACHE: access the cache
 * @NVM_ACCESS_TARGET_OTP: access the OTP
 * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
 */
enum iwl_nvm_access_target {
J
Johannes Berg 已提交
680 681 682 683 684
	NVM_ACCESS_TARGET_CACHE = 0,
	NVM_ACCESS_TARGET_OTP = 1,
	NVM_ACCESS_TARGET_EEPROM = 2,
};

685 686 687 688 689 690 691 692 693 694 695
/**
 * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
 * @NVM_SECTION_TYPE_SW: software section
 * @NVM_SECTION_TYPE_REGULATORY: regulatory section
 * @NVM_SECTION_TYPE_CALIBRATION: calibration section
 * @NVM_SECTION_TYPE_PRODUCTION: production section
 * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
 * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
 * @NVM_MAX_NUM_SECTIONS: number of sections
 */
enum iwl_nvm_section_type {
696
	NVM_SECTION_TYPE_SW = 1,
697
	NVM_SECTION_TYPE_REGULATORY = 3,
698 699
	NVM_SECTION_TYPE_CALIBRATION = 4,
	NVM_SECTION_TYPE_PRODUCTION = 5,
700
	NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
701 702
	NVM_SECTION_TYPE_PHY_SKU = 12,
	NVM_MAX_NUM_SECTIONS = 13,
J
Johannes Berg 已提交
703 704 705
};

/**
706 707 708 709
 * struct iwl_nvm_access_cmd - Request the device to send an NVM section
 * @op_code: &enum iwl_nvm_access_op
 * @target: &enum iwl_nvm_access_target
 * @type: &enum iwl_nvm_section_type
J
Johannes Berg 已提交
710 711 712 713
 * @offset: offset in bytes into the section
 * @length: in bytes, to read/write
 * @data: if write operation, the data to write. On read its empty
 */
714
struct iwl_nvm_access_cmd {
J
Johannes Berg 已提交
715 716 717 718 719 720 721 722
	u8 op_code;
	u8 target;
	__le16 type;
	__le16 offset;
	__le16 length;
	u8 data[];
} __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */

723 724
#define NUM_OF_FW_PAGING_BLOCKS	33 /* 32 for data and 1 block for CSS */

725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
/**
 * struct iwl_fw_paging_cmd_v1 - paging layout
 *
 * (FW_PAGING_BLOCK_CMD = 0x4f)
 *
 * Send to FW the paging layout in the driver.
 *
 * @flags: various flags for the command
 * @block_size: the block size in powers of 2
 * @block_num: number of blocks specified in the command.
 * @device_phy_addr: virtual addresses from device side
 */
struct iwl_fw_paging_cmd_v1 {
	__le32 flags;
	__le32 block_size;
	__le32 block_num;
	__le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */

/**
745 746 747 748 749 750 751 752 753 754
 * struct iwl_fw_paging_cmd - paging layout
 *
 * (FW_PAGING_BLOCK_CMD = 0x4f)
 *
 * Send to FW the paging layout in the driver.
 *
 * @flags: various flags for the command
 * @block_size: the block size in powers of 2
 * @block_num: number of blocks specified in the command.
 * @device_phy_addr: virtual addresses from device side
755
 */
756 757 758 759
struct iwl_fw_paging_cmd {
	__le32 flags;
	__le32 block_size;
	__le32 block_num;
760
	__le64 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
761
} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_2 */
762

763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
/*
 * Fw items ID's
 *
 * @IWL_FW_ITEM_ID_PAGING: Address of the pages that the FW will upload
 *	download
 */
enum iwl_fw_item_id {
	IWL_FW_ITEM_ID_PAGING = 3,
};

/*
 * struct iwl_fw_get_item_cmd - get an item from the fw
 */
struct iwl_fw_get_item_cmd {
	__le32 item_id;
} __packed; /* FW_GET_ITEM_CMD_API_S_VER_1 */

780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799
#define CONT_REC_COMMAND_SIZE	80
#define ENABLE_CONT_RECORDING	0x15
#define DISABLE_CONT_RECORDING	0x16

/*
 * struct iwl_continuous_record_mode - recording mode
 */
struct iwl_continuous_record_mode {
	__le16 enable_recording;
} __packed;

/*
 * struct iwl_continuous_record_cmd - enable/disable continuous recording
 */
struct iwl_continuous_record_cmd {
	struct iwl_continuous_record_mode record_mode;
	u8 pad[CONT_REC_COMMAND_SIZE -
		sizeof(struct iwl_continuous_record_mode)];
} __packed;

800 801 802 803 804 805
struct iwl_fw_get_item_resp {
	__le32 item_id;
	__le32 item_byte_cnt;
	__le32 item_val;
} __packed; /* FW_GET_ITEM_RSP_S_VER_1 */

J
Johannes Berg 已提交
806 807 808 809 810 811 812 813
/**
 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
 * @offset: offset in bytes into the section
 * @length: in bytes, either how much was written or read
 * @type: NVM_SECTION_TYPE_*
 * @status: 0 for success, fail otherwise
 * @data: if read operation, the data returned. Empty on write.
 */
814
struct iwl_nvm_access_resp {
J
Johannes Berg 已提交
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
	__le16 offset;
	__le16 length;
	__le16 type;
	__le16 status;
	u8 data[];
} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */

/* MVM_ALIVE 0x1 */

/* alive response is_valid values */
#define ALIVE_RESP_UCODE_OK	BIT(0)
#define ALIVE_RESP_RFKILL	BIT(1)

/* alive response ver_type values */
enum {
	FW_TYPE_HW = 0,
	FW_TYPE_PROT = 1,
	FW_TYPE_AP = 2,
	FW_TYPE_WOWLAN = 3,
	FW_TYPE_TIMING = 4,
	FW_TYPE_WIPAN = 5
};

/* alive response ver_subtype values */
enum {
	FW_SUBTYPE_FULL_FEATURE = 0,
	FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
	FW_SUBTYPE_REDUCED = 2,
	FW_SUBTYPE_ALIVE_ONLY = 3,
	FW_SUBTYPE_WOWLAN = 4,
	FW_SUBTYPE_AP_SUBTYPE = 5,
	FW_SUBTYPE_WIPAN = 6,
	FW_SUBTYPE_INITIALIZE = 9
};

#define IWL_ALIVE_STATUS_ERR 0xDEAD
#define IWL_ALIVE_STATUS_OK 0xCAFE

#define IWL_ALIVE_FLG_RFKILL	BIT(0)

855
struct iwl_lmac_alive {
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
	__le32 ucode_minor;
	__le32 ucode_major;
	u8 ver_subtype;
	u8 ver_type;
	u8 mac;
	u8 opt;
	__le32 timestamp;
	__le32 error_event_table_ptr;	/* SRAM address for error log */
	__le32 log_event_table_ptr;	/* SRAM address for LMAC event log */
	__le32 cpu_register_ptr;
	__le32 dbgm_config_ptr;
	__le32 alive_counter_ptr;
	__le32 scd_base_ptr;		/* SRAM address for SCD */
	__le32 st_fwrd_addr;		/* pointer to Store and forward */
	__le32 st_fwrd_size;
871 872 873
} __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */

struct iwl_umac_alive {
874 875 876 877
	__le32 umac_minor;		/* UMAC version: minor */
	__le32 umac_major;		/* UMAC version: major */
	__le32 error_info_addr;		/* SRAM address for UMAC error log */
	__le32 dbg_print_buff_addr;
878 879 880 881 882 883 884
} __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */

struct mvm_alive_resp_v3 {
	__le16 status;
	__le16 flags;
	struct iwl_lmac_alive lmac_data;
	struct iwl_umac_alive umac_data;
885 886
} __packed; /* ALIVE_RES_API_S_VER_3 */

887 888 889 890 891 892 893
struct mvm_alive_resp {
	__le16 status;
	__le16 flags;
	struct iwl_lmac_alive lmac_data[2];
	struct iwl_umac_alive umac_data;
} __packed; /* ALIVE_RES_API_S_VER_4 */

J
Johannes Berg 已提交
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
/* Error response/notification */
enum {
	FW_ERR_UNKNOWN_CMD = 0x0,
	FW_ERR_INVALID_CMD_PARAM = 0x1,
	FW_ERR_SERVICE = 0x2,
	FW_ERR_ARC_MEMORY = 0x3,
	FW_ERR_ARC_CODE = 0x4,
	FW_ERR_WATCH_DOG = 0x5,
	FW_ERR_WEP_GRP_KEY_INDX = 0x10,
	FW_ERR_WEP_KEY_SIZE = 0x11,
	FW_ERR_OBSOLETE_FUNC = 0x12,
	FW_ERR_UNEXPECTED = 0xFE,
	FW_ERR_FATAL = 0xFF
};

/**
 * struct iwl_error_resp - FW error indication
 * ( REPLY_ERROR = 0x2 )
 * @error_type: one of FW_ERR_*
 * @cmd_id: the command ID for which the error occured
 * @bad_cmd_seq_num: sequence number of the erroneous command
 * @error_service: which service created the error, applicable only if
 *	error_type = 2, otherwise 0
 * @timestamp: TSF in usecs.
 */
struct iwl_error_resp {
	__le32 error_type;
	u8 cmd_id;
	u8 reserved1;
	__le16 bad_cmd_seq_num;
	__le32 error_service;
	__le64 timestamp;
} __packed;


/* Common PHY, MAC and Bindings definitions */
#define MAX_MACS_IN_BINDING	(3)
#define MAX_BINDINGS		(4)

933 934 935 936 937 938 939 940 941 942 943 944 945 946 947
/**
 * enum iwl_mvm_id_and_color - ID and color fields in context dword
 * @FW_CTXT_ID_POS: position of the ID
 * @FW_CTXT_ID_MSK: mask of the ID
 * @FW_CTXT_COLOR_POS: position of the color
 * @FW_CTXT_COLOR_MSK: mask of the color
 * @FW_CTXT_INVALID: value used to indicate unused/invalid
 */
enum iwl_mvm_id_and_color {
	FW_CTXT_ID_POS		= 0,
	FW_CTXT_ID_MSK		= 0xff << FW_CTXT_ID_POS,
	FW_CTXT_COLOR_POS	= 8,
	FW_CTXT_COLOR_MSK	= 0xff << FW_CTXT_COLOR_POS,
	FW_CTXT_INVALID		= 0xffffffff,
};
J
Johannes Berg 已提交
948 949 950 951 952

#define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
					  (_color << FW_CTXT_COLOR_POS))

/* Possible actions on PHYs, MACs and Bindings */
953
enum iwl_phy_ctxt_action {
J
Johannes Berg 已提交
954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983
	FW_CTXT_ACTION_STUB = 0,
	FW_CTXT_ACTION_ADD,
	FW_CTXT_ACTION_MODIFY,
	FW_CTXT_ACTION_REMOVE,
	FW_CTXT_ACTION_NUM
}; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */

/* Time Events */

/* Time Event types, according to MAC type */
enum iwl_time_event_type {
	/* BSS Station Events */
	TE_BSS_STA_AGGRESSIVE_ASSOC,
	TE_BSS_STA_ASSOC,
	TE_BSS_EAP_DHCP_PROT,
	TE_BSS_QUIET_PERIOD,

	/* P2P Device Events */
	TE_P2P_DEVICE_DISCOVERABLE,
	TE_P2P_DEVICE_LISTEN,
	TE_P2P_DEVICE_ACTION_SCAN,
	TE_P2P_DEVICE_FULL_SCAN,

	/* P2P Client Events */
	TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
	TE_P2P_CLIENT_ASSOC,
	TE_P2P_CLIENT_QUIET_PERIOD,

	/* P2P GO Events */
	TE_P2P_GO_ASSOC_PROT,
984
	TE_P2P_GO_REPETITIVET_NOA,
J
Johannes Berg 已提交
985 986 987 988 989
	TE_P2P_GO_CT_WINDOW,

	/* WiDi Sync Events */
	TE_WIDI_TX_SYNC,

990
	/* Channel Switch NoA */
991
	TE_CHANNEL_SWITCH_PERIOD,
992

J
Johannes Berg 已提交
993 994 995
	TE_MAX
}; /* MAC_EVENT_TYPE_API_E_VER_1 */

996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026


/* Time event - defines for command API v1 */

/*
 * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
 * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
 *	the first fragment is scheduled.
 * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
 *	the first 2 fragments are scheduled.
 * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
 *	number of fragments are valid.
 *
 * Other than the constant defined above, specifying a fragmentation value 'x'
 * means that the event can be fragmented but only the first 'x' will be
 * scheduled.
 */
enum {
	TE_V1_FRAG_NONE = 0,
	TE_V1_FRAG_SINGLE = 1,
	TE_V1_FRAG_DUAL = 2,
	TE_V1_FRAG_ENDLESS = 0xffffffff
};

/* If a Time Event can be fragmented, this is the max number of fragments */
#define TE_V1_FRAG_MAX_MSK	0x0fffffff
/* Repeat the time event endlessly (until removed) */
#define TE_V1_REPEAT_ENDLESS	0xffffffff
/* If a Time Event has bounded repetitions, this is the maximal value */
#define TE_V1_REPEAT_MAX_MSK_V1	0x0fffffff

J
Johannes Berg 已提交
1027 1028
/* Time Event dependencies: none, on another TE, or in a specific time */
enum {
1029 1030 1031 1032
	TE_V1_INDEPENDENT		= 0,
	TE_V1_DEP_OTHER			= BIT(0),
	TE_V1_DEP_TSF			= BIT(1),
	TE_V1_EVENT_SOCIOPATHIC		= BIT(2),
J
Johannes Berg 已提交
1033
}; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
1034

1035
/*
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
 * @TE_V1_NOTIF_NONE: no notifications
 * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
 * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
 * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
 * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
 * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
 * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
 * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
 * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
 *
1046 1047 1048 1049 1050 1051
 * Supported Time event notifications configuration.
 * A notification (both event and fragment) includes a status indicating weather
 * the FW was able to schedule the event or not. For fragment start/end
 * notification the status is always success. There is no start/end fragment
 * notification for monolithic events.
 */
J
Johannes Berg 已提交
1052
enum {
1053 1054 1055 1056 1057 1058 1059 1060 1061
	TE_V1_NOTIF_NONE = 0,
	TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
	TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
	TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
	TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
	TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
	TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
	TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
	TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
1062
}; /* MAC_EVENT_ACTION_API_E_VER_2 */
J
Johannes Berg 已提交
1063

1064
/* Time event - defines for command API */
1065

J
Johannes Berg 已提交
1066
/*
1067 1068
 * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
 * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
J
Johannes Berg 已提交
1069
 *  the first fragment is scheduled.
1070
 * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
J
Johannes Berg 已提交
1071
 *  the first 2 fragments are scheduled.
1072 1073
 * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
 *  number of fragments are valid.
J
Johannes Berg 已提交
1074 1075 1076 1077 1078 1079
 *
 * Other than the constant defined above, specifying a fragmentation value 'x'
 * means that the event can be fragmented but only the first 'x' will be
 * scheduled.
 */
enum {
1080 1081 1082 1083 1084
	TE_V2_FRAG_NONE = 0,
	TE_V2_FRAG_SINGLE = 1,
	TE_V2_FRAG_DUAL = 2,
	TE_V2_FRAG_MAX = 0xfe,
	TE_V2_FRAG_ENDLESS = 0xff
J
Johannes Berg 已提交
1085 1086 1087
};

/* Repeat the time event endlessly (until removed) */
1088
#define TE_V2_REPEAT_ENDLESS	0xff
J
Johannes Berg 已提交
1089
/* If a Time Event has bounded repetitions, this is the maximal value */
1090 1091 1092 1093 1094
#define TE_V2_REPEAT_MAX	0xfe

#define TE_V2_PLACEMENT_POS	12
#define TE_V2_ABSENCE_POS	15

1095 1096
/**
 * enum iwl_time_event_policy - Time event policy values
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110
 * A notification (both event and fragment) includes a status indicating weather
 * the FW was able to schedule the event or not. For fragment start/end
 * notification the status is always success. There is no start/end fragment
 * notification for monolithic events.
 *
 * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
 * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
 * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
 * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
 * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
 * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
 * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
 * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
 * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
1111
 * @T2_V2_START_IMMEDIATELY: start time event immediately
1112 1113 1114 1115 1116
 * @TE_V2_DEP_OTHER: depends on another time event
 * @TE_V2_DEP_TSF: depends on a specific time
 * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
 * @TE_V2_ABSENCE: are we present or absent during the Time Event.
 */
1117
enum iwl_time_event_policy {
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
	TE_V2_DEFAULT_POLICY = 0x0,

	/* notifications (event start/stop, fragment start/stop) */
	TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
	TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
	TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
	TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),

	TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
	TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
	TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
	TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
1130
	T2_V2_START_IMMEDIATELY = BIT(11),
1131 1132 1133 1134 1135 1136 1137 1138 1139

	/* placement characteristics */
	TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
	TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
	TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),

	/* are we present or absent during the Time Event. */
	TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
};
J
Johannes Berg 已提交
1140 1141

/**
1142
 * struct iwl_time_event_cmd - configuring Time Events
1143 1144
 * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
 * with version 1. determined by IWL_UCODE_TLV_FLAGS)
J
Johannes Berg 已提交
1145
 * ( TIME_EVENT_CMD = 0x29 )
1146 1147 1148
 * @id_and_color: ID and color of the relevant MAC,
 *	&enum iwl_mvm_id_and_color
 * @action: action to perform, one of &enum iwl_phy_ctxt_action
J
Johannes Berg 已提交
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159
 * @id: this field has two meanings, depending on the action:
 *	If the action is ADD, then it means the type of event to add.
 *	For all other actions it is the unique event ID assigned when the
 *	event was added by the FW.
 * @apply_time: When to start the Time Event (in GP2)
 * @max_delay: maximum delay to event's start (apply time), in TU
 * @depends_on: the unique ID of the event we depend on (if any)
 * @interval: interval between repetitions, in TU
 * @duration: duration of event in TU
 * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
 * @max_frags: maximal number of fragments the Time Event can be divided to
1160 1161 1162 1163
 * @policy: defines whether uCode shall notify the host or other uCode modules
 *	on event and/or fragment start and/or end
 *	using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
 *	TE_EVENT_SOCIOPATHIC
1164 1165
 *	using TE_ABSENCE and using TE_NOTIF_*,
 *	&enum iwl_time_event_policy
J
Johannes Berg 已提交
1166
 */
1167
struct iwl_time_event_cmd {
J
Johannes Berg 已提交
1168 1169 1170 1171
	/* COMMON_INDEX_HDR_API_S_VER_1 */
	__le32 id_and_color;
	__le32 action;
	__le32 id;
1172
	/* MAC_TIME_EVENT_DATA_API_S_VER_2 */
J
Johannes Berg 已提交
1173 1174 1175 1176 1177
	__le32 apply_time;
	__le32 max_delay;
	__le32 depends_on;
	__le32 interval;
	__le32 duration;
1178 1179 1180 1181
	u8 repeat;
	u8 max_frags;
	__le16 policy;
} __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
J
Johannes Berg 已提交
1182 1183 1184 1185 1186 1187

/**
 * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
 * @status: bit 0 indicates success, all others specify errors
 * @id: the Time Event type
 * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
1188 1189
 * @id_and_color: ID and color of the relevant MAC,
 *	&enum iwl_mvm_id_and_color
J
Johannes Berg 已提交
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
 */
struct iwl_time_event_resp {
	__le32 status;
	__le32 id;
	__le32 unique_id;
	__le32 id_and_color;
} __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */

/**
 * struct iwl_time_event_notif - notifications of time event start/stop
 * ( TIME_EVENT_NOTIFICATION = 0x2a )
 * @timestamp: action timestamp in GP2
 * @session_id: session's unique id
 * @unique_id: unique id of the Time Event itself
 * @id_and_color: ID and color of the relevant MAC
1205
 * @action: &enum iwl_time_event_policy
J
Johannes Berg 已提交
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219
 * @status: true if scheduled, false otherwise (not executed)
 */
struct iwl_time_event_notif {
	__le32 timestamp;
	__le32 session_id;
	__le32 unique_id;
	__le32 id_and_color;
	__le32 action;
	__le32 status;
} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */


/* Bindings and Time Quota */

1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239
/**
 * struct iwl_binding_cmd_v1 - configuring bindings
 * ( BINDING_CONTEXT_CMD = 0x2b )
 * @id_and_color: ID and color of the relevant Binding,
 *	&enum iwl_mvm_id_and_color
 * @action: action to perform, one of FW_CTXT_ACTION_*
 * @macs: array of MAC id and colors which belong to the binding,
 *	&enum iwl_mvm_id_and_color
 * @phy: PHY id and color which belongs to the binding,
 *	&enum iwl_mvm_id_and_color
 */
struct iwl_binding_cmd_v1 {
	/* COMMON_INDEX_HDR_API_S_VER_1 */
	__le32 id_and_color;
	__le32 action;
	/* BINDING_DATA_API_S_VER_1 */
	__le32 macs[MAX_MACS_IN_BINDING];
	__le32 phy;
} __packed; /* BINDING_CMD_API_S_VER_1 */

J
Johannes Berg 已提交
1240 1241 1242
/**
 * struct iwl_binding_cmd - configuring bindings
 * ( BINDING_CONTEXT_CMD = 0x2b )
1243 1244
 * @id_and_color: ID and color of the relevant Binding,
 *	&enum iwl_mvm_id_and_color
J
Johannes Berg 已提交
1245 1246
 * @action: action to perform, one of FW_CTXT_ACTION_*
 * @macs: array of MAC id and colors which belong to the binding
1247
 *	&enum iwl_mvm_id_and_color
J
Johannes Berg 已提交
1248
 * @phy: PHY id and color which belongs to the binding
1249
 *	&enum iwl_mvm_id_and_color
1250
 * @lmac_id: the lmac id the binding belongs to
J
Johannes Berg 已提交
1251 1252 1253 1254 1255 1256 1257 1258
 */
struct iwl_binding_cmd {
	/* COMMON_INDEX_HDR_API_S_VER_1 */
	__le32 id_and_color;
	__le32 action;
	/* BINDING_DATA_API_S_VER_1 */
	__le32 macs[MAX_MACS_IN_BINDING];
	__le32 phy;
1259 1260 1261
	__le32 lmac_id;
} __packed; /* BINDING_CMD_API_S_VER_2 */

1262
#define IWL_BINDING_CMD_SIZE_V1	sizeof(struct iwl_binding_cmd_v1)
1263 1264
#define IWL_LMAC_24G_INDEX		0
#define IWL_LMAC_5G_INDEX		1
J
Johannes Berg 已提交
1265

1266 1267 1268
/* The maximal number of fragments in the FW's schedule session */
#define IWL_MVM_MAX_QUOTA 128

J
Johannes Berg 已提交
1269 1270
/**
 * struct iwl_time_quota_data - configuration of time quota per binding
1271 1272
 * @id_and_color: ID and color of the relevant Binding,
 *	&enum iwl_mvm_id_and_color
J
Johannes Berg 已提交
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286
 * @quota: absolute time quota in TU. The scheduler will try to divide the
 *	remainig quota (after Time Events) according to this quota.
 * @max_duration: max uninterrupted context duration in TU
 */
struct iwl_time_quota_data {
	__le32 id_and_color;
	__le32 quota;
	__le32 max_duration;
} __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */

/**
 * struct iwl_time_quota_cmd - configuration of time quota between bindings
 * ( TIME_QUOTA_CMD = 0x2c )
 * @quotas: allocations per binding
1287 1288 1289
 * Note: on non-CDB the fourth one is the auxilary mac and is
 *	essentially zero.
 *	On CDB the fourth one is a regular binding.
J
Johannes Berg 已提交
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395
 */
struct iwl_time_quota_cmd {
	struct iwl_time_quota_data quotas[MAX_BINDINGS];
} __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */


/* PHY context */

/* Supported bands */
#define PHY_BAND_5  (0)
#define PHY_BAND_24 (1)

/* Supported channel width, vary if there is VHT support */
#define PHY_VHT_CHANNEL_MODE20	(0x0)
#define PHY_VHT_CHANNEL_MODE40	(0x1)
#define PHY_VHT_CHANNEL_MODE80	(0x2)
#define PHY_VHT_CHANNEL_MODE160	(0x3)

/*
 * Control channel position:
 * For legacy set bit means upper channel, otherwise lower.
 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
 *   bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
 *                                   center_freq
 *                                        |
 * 40Mhz                          |_______|_______|
 * 80Mhz                  |_______|_______|_______|_______|
 * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
 * code      011     010     001     000  |  100     101     110    111
 */
#define PHY_VHT_CTRL_POS_1_BELOW  (0x0)
#define PHY_VHT_CTRL_POS_2_BELOW  (0x1)
#define PHY_VHT_CTRL_POS_3_BELOW  (0x2)
#define PHY_VHT_CTRL_POS_4_BELOW  (0x3)
#define PHY_VHT_CTRL_POS_1_ABOVE  (0x4)
#define PHY_VHT_CTRL_POS_2_ABOVE  (0x5)
#define PHY_VHT_CTRL_POS_3_ABOVE  (0x6)
#define PHY_VHT_CTRL_POS_4_ABOVE  (0x7)

/*
 * @band: PHY_BAND_*
 * @channel: channel number
 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
 */
struct iwl_fw_channel_info {
	u8 band;
	u8 channel;
	u8 width;
	u8 ctrl_pos;
} __packed;

#define PHY_RX_CHAIN_DRIVER_FORCE_POS	(0)
#define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
	(0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
#define PHY_RX_CHAIN_VALID_POS		(1)
#define PHY_RX_CHAIN_VALID_MSK \
	(0x7 << PHY_RX_CHAIN_VALID_POS)
#define PHY_RX_CHAIN_FORCE_SEL_POS	(4)
#define PHY_RX_CHAIN_FORCE_SEL_MSK \
	(0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
#define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS	(7)
#define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
	(0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
#define PHY_RX_CHAIN_CNT_POS		(10)
#define PHY_RX_CHAIN_CNT_MSK \
	(0x3 << PHY_RX_CHAIN_CNT_POS)
#define PHY_RX_CHAIN_MIMO_CNT_POS	(12)
#define PHY_RX_CHAIN_MIMO_CNT_MSK \
	(0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
#define PHY_RX_CHAIN_MIMO_FORCE_POS	(14)
#define PHY_RX_CHAIN_MIMO_FORCE_MSK \
	(0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)

/* TODO: fix the value, make it depend on firmware at runtime? */
#define NUM_PHY_CTX	3

/* TODO: complete missing documentation */
/**
 * struct iwl_phy_context_cmd - config of the PHY context
 * ( PHY_CONTEXT_CMD = 0x8 )
 * @id_and_color: ID and color of the relevant Binding
 * @action: action to perform, one of FW_CTXT_ACTION_*
 * @apply_time: 0 means immediate apply and context switch.
 *	other value means apply new params after X usecs
 * @tx_param_color: ???
 * @channel_info:
 * @txchain_info: ???
 * @rxchain_info: ???
 * @acquisition_data: ???
 * @dsp_cfg_flags: set to 0
 */
struct iwl_phy_context_cmd {
	/* COMMON_INDEX_HDR_API_S_VER_1 */
	__le32 id_and_color;
	__le32 action;
	/* PHY_CONTEXT_DATA_API_S_VER_1 */
	__le32 apply_time;
	__le32 tx_param_color;
	struct iwl_fw_channel_info ci;
	__le32 txchain_info;
	__le32 rxchain_info;
	__le32 acquisition_data;
	__le32 dsp_cfg_flags;
} __packed; /* PHY_CONTEXT_CMD_API_VER_1 */

1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461
/*
 * Aux ROC command
 *
 * Command requests the firmware to create a time event for a certain duration
 * and remain on the given channel. This is done by using the Aux framework in
 * the FW.
 * The command was first used for Hot Spot issues - but can be used regardless
 * to Hot Spot.
 *
 * ( HOT_SPOT_CMD 0x53 )
 *
 * @id_and_color: ID and color of the MAC
 * @action: action to perform, one of FW_CTXT_ACTION_*
 * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
 *	event_unique_id should be the id of the time event assigned by ucode.
 *	Otherwise ignore the event_unique_id.
 * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
 *	activity.
 * @channel_info: channel info
 * @node_addr: Our MAC Address
 * @reserved: reserved for alignment
 * @apply_time: GP2 value to start (should always be the current GP2 value)
 * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
 *	time by which start of the event is allowed to be postponed.
 * @duration: event duration in TU To calculate event duration:
 *	timeEventDuration = min(duration, remainingQuota)
 */
struct iwl_hs20_roc_req {
	/* COMMON_INDEX_HDR_API_S_VER_1 hdr */
	__le32 id_and_color;
	__le32 action;
	__le32 event_unique_id;
	__le32 sta_id_and_color;
	struct iwl_fw_channel_info channel_info;
	u8 node_addr[ETH_ALEN];
	__le16 reserved;
	__le32 apply_time;
	__le32 apply_time_max_delay;
	__le32 duration;
} __packed; /* HOT_SPOT_CMD_API_S_VER_1 */

/*
 * values for AUX ROC result values
 */
enum iwl_mvm_hot_spot {
	HOT_SPOT_RSP_STATUS_OK,
	HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
	HOT_SPOT_MAX_NUM_OF_SESSIONS,
};

/*
 * Aux ROC command response
 *
 * In response to iwl_hs20_roc_req the FW sends this command to notify the
 * driver the uid of the timevent.
 *
 * ( HOT_SPOT_CMD 0x53 )
 *
 * @event_unique_id: Unique ID of time event assigned by ucode
 * @status: Return status 0 is success, all the rest used for specific errors
 */
struct iwl_hs20_roc_res {
	__le32 event_unique_id;
	__le32 status;
} __packed; /* HOT_SPOT_RSP_API_S_VER_1 */

J
Johannes Berg 已提交
1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493
/**
 * struct iwl_radio_version_notif - information on the radio version
 * ( RADIO_VERSION_NOTIFICATION = 0x68 )
 * @radio_flavor:
 * @radio_step:
 * @radio_dash:
 */
struct iwl_radio_version_notif {
	__le32 radio_flavor;
	__le32 radio_step;
	__le32 radio_dash;
} __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */

enum iwl_card_state_flags {
	CARD_ENABLED		= 0x00,
	HW_CARD_DISABLED	= 0x01,
	SW_CARD_DISABLED	= 0x02,
	CT_KILL_CARD_DISABLED	= 0x04,
	HALT_CARD_DISABLED	= 0x08,
	CARD_DISABLED_MSK	= 0x0f,
	CARD_IS_RX_ON		= 0x10,
};

/**
 * struct iwl_radio_version_notif - information on the radio version
 * ( CARD_STATE_NOTIFICATION = 0xa1 )
 * @flags: %iwl_card_state_flags
 */
struct iwl_card_state_notif {
	__le32 flags;
} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */

1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511
/**
 * struct iwl_missed_beacons_notif - information on missed beacons
 * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
 * @mac_id: interface ID
 * @consec_missed_beacons_since_last_rx: number of consecutive missed
 *	beacons since last RX.
 * @consec_missed_beacons: number of consecutive missed beacons
 * @num_expected_beacons:
 * @num_recvd_beacons:
 */
struct iwl_missed_beacons_notif {
	__le32 mac_id;
	__le32 consec_missed_beacons_since_last_rx;
	__le32 consec_missed_beacons;
	__le32 num_expected_beacons;
	__le32 num_recvd_beacons;
} __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */

1512 1513 1514 1515 1516 1517 1518
/**
 * struct iwl_mfuart_load_notif - mfuart image version & status
 * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
 * @installed_ver: installed image version
 * @external_ver: external image version
 * @status: MFUART loading status
 * @duration: MFUART loading time
1519
 * @image_size: MFUART image size in bytes
1520 1521 1522 1523 1524 1525
*/
struct iwl_mfuart_load_notif {
	__le32 installed_ver;
	__le32 external_ver;
	__le32 status;
	__le32 duration;
1526 1527 1528
	/* image size valid only in v2 of the command */
	__le32 image_size;
} __packed; /*MFU_LOADER_NTFY_API_S_VER_2*/
1529

1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548
/**
 * struct iwl_mfu_assert_dump_notif - mfuart dump logs
 * ( MFU_ASSERT_DUMP_NTF = 0xfe )
 * @assert_id: mfuart assert id that cause the notif
 * @curr_reset_num: number of asserts since uptime
 * @index_num: current chunk id
 * @parts_num: total number of chunks
 * @data_size: number of data bytes sent
 * @data: data buffer
 */
struct iwl_mfu_assert_dump_notif {
	__le32   assert_id;
	__le32   curr_reset_num;
	__le16   index_num;
	__le16   parts_num;
	__le32   data_size;
	__le32   data[0];
} __packed; /*MFU_DUMP_ASSERT_API_S_VER_1*/

J
Johannes Berg 已提交
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561
/**
 * struct iwl_set_calib_default_cmd - set default value for calibration.
 * ( SET_CALIB_DEFAULT_CMD = 0x8e )
 * @calib_index: the calibration to set value for
 * @length: of data
 * @data: the value to set for the calibration result
 */
struct iwl_set_calib_default_cmd {
	__le16 calib_index;
	__le16 length;
	u8 data[0];
} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */

1562
#define MAX_PORT_ID_NUM	2
1563
#define MAX_MCAST_FILTERING_ADDRESSES 256
1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587

/**
 * struct iwl_mcast_filter_cmd - configure multicast filter.
 * @filter_own: Set 1 to filter out multicast packets sent by station itself
 * @port_id:	Multicast MAC addresses array specifier. This is a strange way
 *		to identify network interface adopted in host-device IF.
 *		It is used by FW as index in array of addresses. This array has
 *		MAX_PORT_ID_NUM members.
 * @count:	Number of MAC addresses in the array
 * @pass_all:	Set 1 to pass all multicast packets.
 * @bssid:	current association BSSID.
 * @addr_list:	Place holder for array of MAC addresses.
 *		IMPORTANT: add padding if necessary to ensure DWORD alignment.
 */
struct iwl_mcast_filter_cmd {
	u8 filter_own;
	u8 port_id;
	u8 count;
	u8 pass_all;
	u8 bssid[6];
	u8 reserved[2];
	u8 addr_list[0];
} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */

1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643
#define MAX_BCAST_FILTERS 8
#define MAX_BCAST_FILTER_ATTRS 2

/**
 * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
 * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
 * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
 *	start of ip payload).
 */
enum iwl_mvm_bcast_filter_attr_offset {
	BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
	BCAST_FILTER_OFFSET_IP_END = 1,
};

/**
 * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
 * @offset_type:	&enum iwl_mvm_bcast_filter_attr_offset.
 * @offset:	starting offset of this pattern.
 * @val:		value to match - big endian (MSB is the first
 *		byte to match from offset pos).
 * @mask:	mask to match (big endian).
 */
struct iwl_fw_bcast_filter_attr {
	u8 offset_type;
	u8 offset;
	__le16 reserved1;
	__be32 val;
	__be32 mask;
} __packed; /* BCAST_FILTER_ATT_S_VER_1 */

/**
 * enum iwl_mvm_bcast_filter_frame_type - filter frame type
 * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
 * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
 */
enum iwl_mvm_bcast_filter_frame_type {
	BCAST_FILTER_FRAME_TYPE_ALL = 0,
	BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
};

/**
 * struct iwl_fw_bcast_filter - broadcast filter
 * @discard: discard frame (1) or let it pass (0).
 * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
 * @num_attrs: number of valid attributes in this filter.
 * @attrs: attributes of this filter. a filter is considered matched
 *	only when all its attributes are matched (i.e. AND relationship)
 */
struct iwl_fw_bcast_filter {
	u8 discard;
	u8 frame_type;
	u8 num_attrs;
	u8 reserved1;
	struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
} __packed; /* BCAST_FILTER_S_VER_1 */

1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663
#define BA_WINDOW_STREAMS_MAX		16
#define BA_WINDOW_STATUS_TID_MSK	0x000F
#define BA_WINDOW_STATUS_STA_ID_POS	4
#define BA_WINDOW_STATUS_STA_ID_MSK	0x01F0
#define BA_WINDOW_STATUS_VALID_MSK	BIT(9)

/**
 * struct iwl_ba_window_status_notif - reordering window's status notification
 * @bitmap: bitmap of received frames [start_seq_num + 0]..[start_seq_num + 63]
 * @ra_tid: bit 3:0 - TID, bit 8:4 - STA_ID, bit 9 - valid
 * @start_seq_num: the start sequence number of the bitmap
 * @mpdu_rx_count: the number of received MPDUs since entering D0i3
 */
struct iwl_ba_window_status_notif {
	__le64 bitmap[BA_WINDOW_STREAMS_MAX];
	__le16 ra_tid[BA_WINDOW_STREAMS_MAX];
	__le32 start_seq_num[BA_WINDOW_STREAMS_MAX];
	__le16 mpdu_rx_count[BA_WINDOW_STREAMS_MAX];
} __packed; /* BA_WINDOW_STATUS_NTFY_API_S_VER_1 */

1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691
/**
 * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
 * @default_discard: default action for this mac (discard (1) / pass (0)).
 * @attached_filters: bitmap of relevant filters for this mac.
 */
struct iwl_fw_bcast_mac {
	u8 default_discard;
	u8 reserved1;
	__le16 attached_filters;
} __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */

/**
 * struct iwl_bcast_filter_cmd - broadcast filtering configuration
 * @disable: enable (0) / disable (1)
 * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
 * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
 * @filters: broadcast filters
 * @macs: broadcast filtering configuration per-mac
 */
struct iwl_bcast_filter_cmd {
	u8 disable;
	u8 max_bcast_filters;
	u8 max_macs;
	u8 reserved1;
	struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
	struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
} __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */

1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723
/*
 * enum iwl_mvm_marker_id - maker ids
 *
 * The ids for different type of markers to insert into the usniffer logs
 */
enum iwl_mvm_marker_id {
	MARKER_ID_TX_FRAME_LATENCY = 1,
}; /* MARKER_ID_API_E_VER_1 */

/**
 * struct iwl_mvm_marker - mark info into the usniffer logs
 *
 * (MARKER_CMD = 0xcb)
 *
 * Mark the UTC time stamp into the usniffer logs together with additional
 * metadata, so the usniffer output can be parsed.
 * In the command response the ucode will return the GP2 time.
 *
 * @dw_len: The amount of dwords following this byte including this byte.
 * @marker_id: A unique marker id (iwl_mvm_marker_id).
 * @reserved: reserved.
 * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
 * @metadata: additional meta data that will be written to the unsiffer log
 */
struct iwl_mvm_marker {
	u8 dwLen;
	u8 markerId;
	__le16 reserved;
	__le64 timestamp;
	__le32 metadata[0];
} __packed; /* MARKER_API_S_VER_1 */

1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766
/*
 * enum iwl_dc2dc_config_id - flag ids
 *
 * Ids of dc2dc configuration flags
 */
enum iwl_dc2dc_config_id {
	DCDC_LOW_POWER_MODE_MSK_SET  = 0x1, /* not used */
	DCDC_FREQ_TUNE_SET = 0x2,
}; /* MARKER_ID_API_E_VER_1 */

/**
 * struct iwl_dc2dc_config_cmd - configure dc2dc values
 *
 * (DC2DC_CONFIG_CMD = 0x83)
 *
 * Set/Get & configure dc2dc values.
 * The command always returns the current dc2dc values.
 *
 * @flags: set/get dc2dc
 * @enable_low_power_mode: not used.
 * @dc2dc_freq_tune0: frequency divider - digital domain
 * @dc2dc_freq_tune1: frequency divider - analog domain
 */
struct iwl_dc2dc_config_cmd {
	__le32 flags;
	__le32 enable_low_power_mode; /* not used */
	__le32 dc2dc_freq_tune0;
	__le32 dc2dc_freq_tune1;
} __packed; /* DC2DC_CONFIG_CMD_API_S_VER_1 */

/**
 * struct iwl_dc2dc_config_resp - response for iwl_dc2dc_config_cmd
 *
 * Current dc2dc values returned by the FW.
 *
 * @dc2dc_freq_tune0: frequency divider - digital domain
 * @dc2dc_freq_tune1: frequency divider - analog domain
 */
struct iwl_dc2dc_config_resp {
	__le32 dc2dc_freq_tune0;
	__le32 dc2dc_freq_tune1;
} __packed; /* DC2DC_CONFIG_RESP_API_S_VER_1 */

1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792
/***********************************
 * Smart Fifo API
 ***********************************/
/* Smart Fifo state */
enum iwl_sf_state {
	SF_LONG_DELAY_ON = 0, /* should never be called by driver */
	SF_FULL_ON,
	SF_UNINIT,
	SF_INIT_OFF,
	SF_HW_NUM_STATES
};

/* Smart Fifo possible scenario */
enum iwl_sf_scenario {
	SF_SCENARIO_SINGLE_UNICAST,
	SF_SCENARIO_AGG_UNICAST,
	SF_SCENARIO_MULTICAST,
	SF_SCENARIO_BA_RESP,
	SF_SCENARIO_TX_RESP,
	SF_NUM_SCENARIO
};

#define SF_TRANSIENT_STATES_NUMBER 2	/* SF_LONG_DELAY_ON and SF_FULL_ON */
#define SF_NUM_TIMEOUT_TYPES 2		/* Aging timer and Idle timer */

/* smart FIFO default values */
1793
#define SF_W_MARK_SISO 6144
1794 1795 1796 1797 1798
#define SF_W_MARK_MIMO2 8192
#define SF_W_MARK_MIMO3 6144
#define SF_W_MARK_LEGACY 4096
#define SF_W_MARK_SCAN 4096

1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811
/* SF Scenarios timers for default configuration (aligned to 32 uSec) */
#define SF_SINGLE_UNICAST_IDLE_TIMER_DEF 160	/* 150 uSec  */
#define SF_SINGLE_UNICAST_AGING_TIMER_DEF 400	/* 0.4 mSec */
#define SF_AGG_UNICAST_IDLE_TIMER_DEF 160		/* 150 uSec */
#define SF_AGG_UNICAST_AGING_TIMER_DEF 400		/* 0.4 mSec */
#define SF_MCAST_IDLE_TIMER_DEF 160		/* 150 mSec */
#define SF_MCAST_AGING_TIMER_DEF 400		/* 0.4 mSec */
#define SF_BA_IDLE_TIMER_DEF 160			/* 150 uSec */
#define SF_BA_AGING_TIMER_DEF 400			/* 0.4 mSec */
#define SF_TX_RE_IDLE_TIMER_DEF 160			/* 150 uSec */
#define SF_TX_RE_AGING_TIMER_DEF 400		/* 0.4 mSec */

/* SF Scenarios timers for BSS MAC configuration (aligned to 32 uSec) */
1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824
#define SF_SINGLE_UNICAST_IDLE_TIMER 320	/* 300 uSec  */
#define SF_SINGLE_UNICAST_AGING_TIMER 2016	/* 2 mSec */
#define SF_AGG_UNICAST_IDLE_TIMER 320		/* 300 uSec */
#define SF_AGG_UNICAST_AGING_TIMER 2016		/* 2 mSec */
#define SF_MCAST_IDLE_TIMER 2016		/* 2 mSec */
#define SF_MCAST_AGING_TIMER 10016		/* 10 mSec */
#define SF_BA_IDLE_TIMER 320			/* 300 uSec */
#define SF_BA_AGING_TIMER 2016			/* 2 mSec */
#define SF_TX_RE_IDLE_TIMER 320			/* 300 uSec */
#define SF_TX_RE_AGING_TIMER 2016		/* 2 mSec */

#define SF_LONG_DELAY_AGING_TIMER 1000000	/* 1 Sec */

1825 1826
#define SF_CFG_DUMMY_NOTIF_OFF	BIT(16)

1827
/**
1828 1829
 * struct iwl_sf_cfg_cmd - Smart Fifo configuration command.
 * @state: smart fifo state, types listed in &enum iwl_sf_state.
1830 1831 1832 1833 1834 1835
 * @watermark: Minimum allowed availabe free space in RXF for transient state.
 * @long_delay_timeouts: aging and idle timer values for each scenario
 * in long delay state.
 * @full_on_timeouts: timer values for each scenario in full on state.
 */
struct iwl_sf_cfg_cmd {
1836
	__le32 state;
1837 1838 1839 1840 1841
	__le32 watermark[SF_TRANSIENT_STATES_NUMBER];
	__le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
	__le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
} __packed; /* SF_CFG_API_S_VER_2 */

1842 1843 1844 1845
/***********************************
 * Location Aware Regulatory (LAR) API - MCC updates
 ***********************************/

1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861
/**
 * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
 * regulatory profile according to the given MCC (Mobile Country Code).
 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
 * MCC in the cmd response will be the relevant MCC in the NVM.
 * @mcc: given mobile country code
 * @source_id: the source from where we got the MCC, see iwl_mcc_source
 * @reserved: reserved for alignment
 */
struct iwl_mcc_update_cmd_v1 {
	__le16 mcc;
	u8 source_id;
	u8 reserved;
} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */

1862 1863 1864 1865 1866 1867 1868 1869 1870
/**
 * struct iwl_mcc_update_cmd - Request the device to update geographic
 * regulatory profile according to the given MCC (Mobile Country Code).
 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
 * MCC in the cmd response will be the relevant MCC in the NVM.
 * @mcc: given mobile country code
 * @source_id: the source from where we got the MCC, see iwl_mcc_source
 * @reserved: reserved for alignment
1871 1872
 * @key: integrity key for MCC API OEM testing
 * @reserved2: reserved
1873 1874 1875 1876 1877
 */
struct iwl_mcc_update_cmd {
	__le16 mcc;
	u8 source_id;
	u8 reserved;
1878
	__le32 key;
1879
	u8 reserved2[20];
1880 1881 1882
} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */

/**
1883
 * struct iwl_mcc_update_resp_v1  - response to MCC_UPDATE_CMD.
1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903
 * Contains the new channel control profile map, if changed, and the new MCC
 * (mobile country code).
 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
 * @status: see &enum iwl_mcc_update_status
 * @mcc: the new applied MCC
 * @cap: capabilities for all channels which matches the MCC
 * @source_id: the MCC source, see iwl_mcc_source
 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
 *		channels, depending on platform)
 * @channels: channel control data map, DWORD for each channel. Only the first
 *	16bits are used.
 */
struct iwl_mcc_update_resp_v1  {
	__le32 status;
	__le16 mcc;
	u8 cap;
	u8 source_id;
	__le32 n_channels;
	__le32 channels[0];
} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
1904 1905

/**
1906
 * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
1907 1908 1909
 * Contains the new channel control profile map, if changed, and the new MCC
 * (mobile country code).
 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
1910
 * @status: see &enum iwl_mcc_update_status
1911 1912 1913
 * @mcc: the new applied MCC
 * @cap: capabilities for all channels which matches the MCC
 * @source_id: the MCC source, see iwl_mcc_source
1914 1915
 * @time: time elapsed from the MCC test start (in 30 seconds TU)
 * @reserved: reserved.
1916 1917 1918 1919 1920 1921 1922 1923 1924 1925
 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
 *		channels, depending on platform)
 * @channels: channel control data map, DWORD for each channel. Only the first
 *	16bits are used.
 */
struct iwl_mcc_update_resp {
	__le32 status;
	__le16 mcc;
	u8 cap;
	u8 source_id;
1926 1927
	__le16 time;
	__le16 reserved;
1928 1929
	__le32 n_channels;
	__le32 channels[0];
1930
} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947

/**
 * struct iwl_mcc_chub_notif - chub notifies of mcc change
 * (MCC_CHUB_UPDATE_CMD = 0xc9)
 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
 * the cellular and connectivity cores that gets updates of the mcc, and
 * notifies the ucode directly of any mcc change.
 * The ucode requests the driver to request the device to update geographic
 * regulatory  profile according to the given MCC (Mobile Country Code).
 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
 * MCC in the cmd response will be the relevant MCC in the NVM.
 * @mcc: given mobile country code
 * @source_id: identity of the change originator, see iwl_mcc_source
 * @reserved1: reserved for alignment
 */
struct iwl_mcc_chub_notif {
1948
	__le16 mcc;
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959
	u8 source_id;
	u8 reserved1;
} __packed; /* LAR_MCC_NOTIFY_S */

enum iwl_mcc_update_status {
	MCC_RESP_NEW_CHAN_PROFILE,
	MCC_RESP_SAME_CHAN_PROFILE,
	MCC_RESP_INVALID,
	MCC_RESP_NVM_DISABLED,
	MCC_RESP_ILLEGAL,
	MCC_RESP_LOW_PRIORITY,
1960 1961 1962
	MCC_RESP_TEST_MODE_ACTIVE,
	MCC_RESP_TEST_MODE_NOT_ACTIVE,
	MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974
};

enum iwl_mcc_source {
	MCC_SOURCE_OLD_FW = 0,
	MCC_SOURCE_ME = 1,
	MCC_SOURCE_BIOS = 2,
	MCC_SOURCE_3G_LTE_HOST = 3,
	MCC_SOURCE_3G_LTE_DEVICE = 4,
	MCC_SOURCE_WIFI = 5,
	MCC_SOURCE_RESERVED = 6,
	MCC_SOURCE_DEFAULT = 7,
	MCC_SOURCE_UNINITIALIZED = 8,
1975 1976 1977
	MCC_SOURCE_MCC_API = 9,
	MCC_SOURCE_GET_CURRENT = 0x10,
	MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
1978 1979
};

1980 1981 1982 1983 1984 1985 1986 1987
/* DTS measurements */

enum iwl_dts_measurement_flags {
	DTS_TRIGGER_CMD_FLAGS_TEMP	= BIT(0),
	DTS_TRIGGER_CMD_FLAGS_VOLT	= BIT(1),
};

/**
1988
 * struct iwl_dts_measurement_cmd - request DTS temp and/or voltage measurements
1989
 *
1990 1991
 * @flags: indicates which measurements we want as specified in
 *	&enum iwl_dts_measurement_flags
1992 1993 1994 1995 1996
 */
struct iwl_dts_measurement_cmd {
	__le32 flags;
} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */

1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042
/**
* enum iwl_dts_control_measurement_mode - DTS measurement type
* @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
*                 back (latest value. Not waiting for new value). Use automatic
*                 SW DTS configuration.
* @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
*                    trigger DTS reading and provide read back temperature read
*                    when available.
* @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
* @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
*                              without measurement trigger.
*/
enum iwl_dts_control_measurement_mode {
	DTS_AUTOMATIC			= 0,
	DTS_REQUEST_READ		= 1,
	DTS_OVER_WRITE			= 2,
	DTS_DIRECT_WITHOUT_MEASURE	= 3,
};

/**
* enum iwl_dts_used - DTS to use or used for measurement in the DTS request
* @DTS_USE_TOP: Top
* @DTS_USE_CHAIN_A: chain A
* @DTS_USE_CHAIN_B: chain B
* @DTS_USE_CHAIN_C: chain C
* @XTAL_TEMPERATURE - read temperature from xtal
*/
enum iwl_dts_used {
	DTS_USE_TOP		= 0,
	DTS_USE_CHAIN_A		= 1,
	DTS_USE_CHAIN_B		= 2,
	DTS_USE_CHAIN_C		= 3,
	XTAL_TEMPERATURE	= 4,
};

/**
* enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
* @DTS_BIT6_MODE: bit 6 mode
* @DTS_BIT8_MODE: bit 8 mode
*/
enum iwl_dts_bit_mode {
	DTS_BIT6_MODE	= 0,
	DTS_BIT8_MODE	= 1,
};

/**
2043
 * struct iwl_ext_dts_measurement_cmd - request extended DTS temp measurements
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059
 * @control_mode: see &enum iwl_dts_control_measurement_mode
 * @temperature: used when over write DTS mode is selected
 * @sensor: set temperature sensor to use. See &enum iwl_dts_used
 * @avg_factor: average factor to DTS in request DTS read mode
 * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
 * @step_duration: step duration for the DTS
 */
struct iwl_ext_dts_measurement_cmd {
	__le32 control_mode;
	__le32 temperature;
	__le32 sensor;
	__le32 avg_factor;
	__le32 bit_mode;
	__le32 step_duration;
} __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */

2060
/**
2061
 * struct iwl_dts_measurement_notif_v1 - measurements notification
2062 2063 2064 2065
 *
 * @temp: the measured temperature
 * @voltage: the measured voltage
 */
2066
struct iwl_dts_measurement_notif_v1 {
2067 2068
	__le32 temp;
	__le32 voltage;
2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082
} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/

/**
 * struct iwl_dts_measurement_notif_v2 - measurements notification
 *
 * @temp: the measured temperature
 * @voltage: the measured voltage
 * @threshold_idx: the trip index that was crossed
 */
struct iwl_dts_measurement_notif_v2 {
	__le32 temp;
	__le32 voltage;
	__le32 threshold_idx;
} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
2083

2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094
/**
 * struct ct_kill_notif - CT-kill entry notification
 *
 * @temperature: the current temperature in celsius
 * @reserved: reserved
 */
struct ct_kill_notif {
	__le16 temperature;
	__le16 reserved;
} __packed; /* GRP_PHY_CT_KILL_NTF */

2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119
/**
* enum ctdp_cmd_operation - CTDP command operations
* @CTDP_CMD_OPERATION_START: update the current budget
* @CTDP_CMD_OPERATION_STOP: stop ctdp
* @CTDP_CMD_OPERATION_REPORT: get the avgerage budget
*/
enum iwl_mvm_ctdp_cmd_operation {
	CTDP_CMD_OPERATION_START	= 0x1,
	CTDP_CMD_OPERATION_STOP		= 0x2,
	CTDP_CMD_OPERATION_REPORT	= 0x4,
};/* CTDP_CMD_OPERATION_TYPE_E */

/**
 * struct iwl_mvm_ctdp_cmd - track and manage the FW power consumption budget
 *
 * @operation: see &enum iwl_mvm_ctdp_cmd_operation
 * @budget: the budget in milliwatt
 * @window_size: defined in API but not used
 */
struct iwl_mvm_ctdp_cmd {
	__le32 operation;
	__le32 budget;
	__le32 window_size;
} __packed;

2120 2121 2122
#define IWL_MAX_DTS_TRIPS	8

/**
2123
 * struct temp_report_ths_cmd - set temperature thresholds
2124 2125 2126 2127 2128 2129 2130 2131 2132
 *
 * @num_temps: number of temperature thresholds passed
 * @thresholds: array with the thresholds to be configured
 */
struct temp_report_ths_cmd {
	__le32 num_temps;
	__le16 thresholds[IWL_MAX_DTS_TRIPS];
} __packed; /* GRP_PHY_TEMP_REPORTING_THRESHOLDS_CMD */

2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144
/***********************************
 * TDLS API
 ***********************************/

/* Type of TDLS request */
enum iwl_tdls_channel_switch_type {
	TDLS_SEND_CHAN_SW_REQ = 0,
	TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
	TDLS_MOVE_CH,
}; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */

/**
2145
 * struct iwl_tdls_channel_switch_timing - Switch timing in TDLS channel-switch
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164
 * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
 *	received from peer
 * @max_offchan_duration: What amount of microseconds out of a DTIM is given
 *	to the TDLS off-channel communication. For instance if the DTIM is
 *	200TU and the TDLS peer is to be given 25% of the time, the value
 *	given will be 50TU, or 50 * 1024 if translated into microseconds.
 * @switch_time: switch time the peer sent in its channel switch timing IE
 * @switch_timout: switch timeout the peer sent in its channel switch timing IE
 */
struct iwl_tdls_channel_switch_timing {
	__le32 frame_timestamp; /* GP2 time of peer packet Rx */
	__le32 max_offchan_duration; /* given in micro-seconds */
	__le32 switch_time; /* given in micro-seconds */
	__le32 switch_timeout; /* given in micro-seconds */
} __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */

#define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200

/**
2165
 * struct iwl_tdls_channel_switch_frame - TDLS channel switch frame template
2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179
 *
 * A template representing a TDLS channel-switch request or response frame
 *
 * @switch_time_offset: offset to the channel switch timing IE in the template
 * @tx_cmd: Tx parameters for the frame
 * @data: frame data
 */
struct iwl_tdls_channel_switch_frame {
	__le32 switch_time_offset;
	struct iwl_tx_cmd tx_cmd;
	u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
} __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */

/**
2180
 * struct iwl_tdls_channel_switch_cmd - TDLS channel switch command
2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199
 *
 * The command is sent to initiate a channel switch and also in response to
 * incoming TDLS channel-switch request/response packets from remote peers.
 *
 * @switch_type: see &enum iwl_tdls_channel_switch_type
 * @peer_sta_id: station id of TDLS peer
 * @ci: channel we switch to
 * @timing: timing related data for command
 * @frame: channel-switch request/response template, depending to switch_type
 */
struct iwl_tdls_channel_switch_cmd {
	u8 switch_type;
	__le32 peer_sta_id;
	struct iwl_fw_channel_info ci;
	struct iwl_tdls_channel_switch_timing timing;
	struct iwl_tdls_channel_switch_frame frame;
} __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */

/**
2200
 * struct iwl_tdls_channel_switch_notif - TDLS channel switch start notification
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211
 *
 * @status: non-zero on success
 * @offchannel_duration: duration given in microseconds
 * @sta_id: peer currently performing the channel-switch with
 */
struct iwl_tdls_channel_switch_notif {
	__le32 status;
	__le32 offchannel_duration;
	__le32 sta_id;
} __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */

2212
/**
2213
 * struct iwl_tdls_sta_info - TDLS station info
2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227
 *
 * @sta_id: station id of the TDLS peer
 * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
 * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
 * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
 */
struct iwl_tdls_sta_info {
	u8 sta_id;
	u8 tx_to_peer_tid;
	__le16 tx_to_peer_ssn;
	__le32 is_initiator;
} __packed; /* TDLS_STA_INFO_VER_1 */

/**
2228
 * struct iwl_tdls_config_cmd - TDLS basic config command
2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251
 *
 * @id_and_color: MAC id and color being configured
 * @tdls_peer_count: amount of currently connected TDLS peers
 * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
 * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
 * @sta_info: per-station info. Only the first tdls_peer_count entries are set
 * @pti_req_data_offset: offset of network-level data for the PTI template
 * @pti_req_tx_cmd: Tx parameters for PTI request template
 * @pti_req_template: PTI request template data
 */
struct iwl_tdls_config_cmd {
	__le32 id_and_color; /* mac id and color */
	u8 tdls_peer_count;
	u8 tx_to_ap_tid;
	__le16 tx_to_ap_ssn;
	struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];

	__le32 pti_req_data_offset;
	struct iwl_tx_cmd pti_req_tx_cmd;
	u8 pti_req_template[0];
} __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */

/**
2252
 * struct iwl_tdls_config_sta_info_res - TDLS per-station config information
2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263
 *
 * @sta_id: station id of the TDLS peer
 * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
 *	the peer
 */
struct iwl_tdls_config_sta_info_res {
	__le16 sta_id;
	__le16 tx_to_peer_last_seq;
} __packed; /* TDLS_STA_INFO_RSP_VER_1 */

/**
2264
 * struct iwl_tdls_config_res - TDLS config information from FW
2265 2266 2267 2268 2269 2270 2271 2272 2273
 *
 * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
 * @sta_info: per-station TDLS config information
 */
struct iwl_tdls_config_res {
	__le32 tx_to_ap_last_seq;
	struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
} __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */

2274 2275 2276
#define TX_FIFO_MAX_NUM_9000		8
#define TX_FIFO_MAX_NUM			15
#define RX_FIFO_MAX_NUM			2
2277
#define TX_FIFO_INTERNAL_MAX_NUM	6
2278 2279

/**
2280
 * struct iwl_shared_mem_cfg_v1 - Shared memory configuration information
2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294
 *
 * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
 *	accessible)
 * @shared_mem_size: shared memory size
 * @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to
 *	0x0 as accessible only via DBGM RDAT)
 * @sample_buff_size: internal sample buff size
 * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre
 *	8000 HW set to 0x0 as not accessible)
 * @txfifo_size: size of TXF0 ... TXF7
 * @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0
 * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
 *	when paging is not supported this should be 0
 * @page_buff_size: size of %page_buff_addr
2295 2296 2297 2298 2299 2300
 * @rxfifo_addr: Start address of rxFifo
 * @internal_txfifo_addr: start address of internalFifo
 * @internal_txfifo_size: internal fifos' size
 *
 * NOTE: on firmware that don't have IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG
 *	 set, the last 3 members don't exist.
2301
 */
2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316
struct iwl_shared_mem_cfg_v1 {
	__le32 shared_mem_addr;
	__le32 shared_mem_size;
	__le32 sample_buff_addr;
	__le32 sample_buff_size;
	__le32 txfifo_addr;
	__le32 txfifo_size[TX_FIFO_MAX_NUM_9000];
	__le32 rxfifo_size[RX_FIFO_MAX_NUM];
	__le32 page_buff_addr;
	__le32 page_buff_size;
	__le32 rxfifo_addr;
	__le32 internal_txfifo_addr;
	__le32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
} __packed; /* SHARED_MEM_ALLOC_API_S_VER_2 */

2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333
/**
 * struct iwl_shared_mem_lmac_cfg - LMAC shared memory configuration
 *
 * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB)
 * @txfifo_size: size of TX FIFOs
 * @rxfifo1_addr: RXF1 addr
 * @rxfifo1_size: RXF1 size
 */
struct iwl_shared_mem_lmac_cfg {
	__le32 txfifo_addr;
	__le32 txfifo_size[TX_FIFO_MAX_NUM];
	__le32 rxfifo1_addr;
	__le32 rxfifo1_size;

} __packed; /* SHARED_MEM_ALLOC_LMAC_API_S_VER_1 */

/**
2334
 * struct iwl_shared_mem_cfg - Shared memory configuration information
2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347
 *
 * @shared_mem_addr: shared memory address
 * @shared_mem_size: shared memory size
 * @sample_buff_addr: internal sample (mon/adc) buff addr
 * @sample_buff_size: internal sample buff size
 * @rxfifo2_addr: start addr of RXF2
 * @rxfifo2_size: size of RXF2
 * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
 *	when paging is not supported this should be 0
 * @page_buff_size: size of %page_buff_addr
 * @lmac_num: number of LMACs (1 or 2)
 * @lmac_smem: per - LMAC smem data
 */
2348 2349 2350 2351 2352
struct iwl_shared_mem_cfg {
	__le32 shared_mem_addr;
	__le32 shared_mem_size;
	__le32 sample_buff_addr;
	__le32 sample_buff_size;
2353 2354
	__le32 rxfifo2_addr;
	__le32 rxfifo2_size;
2355 2356
	__le32 page_buff_addr;
	__le32 page_buff_size;
2357 2358
	__le32 lmac_num;
	struct iwl_shared_mem_lmac_cfg lmac_smem[2];
2359
} __packed; /* SHARED_MEM_ALLOC_API_S_VER_3 */
2360

2361
/**
2362
 * struct iwl_mu_group_mgmt_cmd - VHT MU-MIMO group configuration
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373
 *
 * @membership_status: a bitmap of MU groups
 * @user_position:the position of station in a group. If the station is in the
 *	group then bits (group * 2) is the position -1
 */
struct iwl_mu_group_mgmt_cmd {
	__le32 reserved;
	__le32 membership_status[2];
	__le32 user_position[4];
} __packed; /* MU_GROUP_ID_MNG_TABLE_API_S_VER_1 */

2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385
/**
 * struct iwl_mu_group_mgmt_notif - VHT MU-MIMO group id notification
 *
 * @membership_status: a bitmap of MU groups
 * @user_position: the position of station in a group. If the station is in the
 *	group then bits (group * 2) is the position -1
 */
struct iwl_mu_group_mgmt_notif {
	__le32 membership_status[2];
	__le32 user_position[4];
} __packed; /* MU_GROUP_MNG_NTFY_API_S_VER_1 */

2386 2387 2388
#define MAX_STORED_BEACON_SIZE 600

/**
2389
 * struct iwl_stored_beacon_notif - Stored beacon notification
2390 2391 2392 2393
 *
 * @system_time: system time on air rise
 * @tsf: TSF on air rise
 * @beacon_timestamp: beacon on air rise
2394
 * @band: band, matches &RX_RES_PHY_FLAGS_BAND_24 definition
2395 2396 2397 2398 2399 2400 2401 2402
 * @channel: channel this beacon was received on
 * @rates: rate in ucode internal format
 * @byte_count: frame's byte count
 */
struct iwl_stored_beacon_notif {
	__le32 system_time;
	__le64 tsf;
	__le32 beacon_timestamp;
2403
	__le16 band;
2404 2405 2406 2407
	__le16 channel;
	__le32 rates;
	__le32 byte_count;
	u8 data[MAX_STORED_BEACON_SIZE];
2408
} __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_2 */
2409

2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423
#define LQM_NUMBER_OF_STATIONS_IN_REPORT 16

enum iwl_lqm_cmd_operatrions {
	LQM_CMD_OPERATION_START_MEASUREMENT = 0x01,
	LQM_CMD_OPERATION_STOP_MEASUREMENT = 0x02,
};

enum iwl_lqm_status {
	LQM_STATUS_SUCCESS = 0,
	LQM_STATUS_TIMEOUT = 1,
	LQM_STATUS_ABORT = 2,
};

/**
2424
 * struct iwl_link_qual_msrmnt_cmd - Link Quality Measurement command
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438
 * @cmd_operatrion: command operation to be performed (start or stop)
 *	as defined above.
 * @mac_id: MAC ID the measurement applies to.
 * @measurement_time: time of the total measurement to be performed, in uSec.
 * @timeout: maximum time allowed until a response is sent, in uSec.
 */
struct iwl_link_qual_msrmnt_cmd {
	__le32 cmd_operation;
	__le32 mac_id;
	__le32 measurement_time;
	__le32 timeout;
} __packed /* LQM_CMD_API_S_VER_1 */;

/**
2439
 * struct iwl_link_qual_msrmnt_notif - Link Quality Measurement notification
2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462
 *
 * @frequent_stations_air_time: an array containing the total air time
 *	(in uSec) used by the most frequently transmitting stations.
 * @number_of_stations: the number of uniqe stations included in the array
 *	(a number between 0 to 16)
 * @total_air_time_other_stations: the total air time (uSec) used by all the
 *	stations which are not included in the above report.
 * @time_in_measurement_window: the total time in uSec in which a measurement
 *	took place.
 * @tx_frame_dropped: the number of TX frames dropped due to retry limit during
 *	measurement
 * @mac_id: MAC ID the measurement applies to.
 * @status: return status. may be one of the LQM_STATUS_* defined above.
 * @reserved: reserved.
 */
struct iwl_link_qual_msrmnt_notif {
	__le32 frequent_stations_air_time[LQM_NUMBER_OF_STATIONS_IN_REPORT];
	__le32 number_of_stations;
	__le32 total_air_time_other_stations;
	__le32 time_in_measurement_window;
	__le32 tx_frame_dropped;
	__le32 mac_id;
	__le32 status;
2463
	u8 reserved[12];
2464 2465
} __packed; /* LQM_MEASUREMENT_COMPLETE_NTF_API_S_VER1 */

2466
/**
2467
 * struct iwl_channel_switch_noa_notif - Channel switch NOA notification
2468 2469 2470 2471 2472 2473 2474
 *
 * @id_and_color: ID and color of the MAC
 */
struct iwl_channel_switch_noa_notif {
	__le32 id_and_color;
} __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */

I
Ido Yariv 已提交
2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518
/* Operation types for the debug mem access */
enum {
	DEBUG_MEM_OP_READ = 0,
	DEBUG_MEM_OP_WRITE = 1,
	DEBUG_MEM_OP_WRITE_BYTES = 2,
};

#define DEBUG_MEM_MAX_SIZE_DWORDS 32

/**
 * struct iwl_dbg_mem_access_cmd - Request the device to read/write memory
 * @op: DEBUG_MEM_OP_*
 * @addr: address to read/write from/to
 * @len: in dwords, to read/write
 * @data: for write opeations, contains the source buffer
 */
struct iwl_dbg_mem_access_cmd {
	__le32 op;
	__le32 addr;
	__le32 len;
	__le32 data[];
} __packed; /* DEBUG_(U|L)MAC_RD_WR_CMD_API_S_VER_1 */

/* Status responses for the debug mem access */
enum {
	DEBUG_MEM_STATUS_SUCCESS = 0x0,
	DEBUG_MEM_STATUS_FAILED = 0x1,
	DEBUG_MEM_STATUS_LOCKED = 0x2,
	DEBUG_MEM_STATUS_HIDDEN = 0x3,
	DEBUG_MEM_STATUS_LENGTH = 0x4,
};

/**
 * struct iwl_dbg_mem_access_rsp - Response to debug mem commands
 * @status: DEBUG_MEM_STATUS_*
 * @len: read dwords (0 for write operations)
 * @data: contains the read DWs
 */
struct iwl_dbg_mem_access_rsp {
	__le32 status;
	__le32 len;
	__le32 data[];
} __packed; /* DEBUG_(U|L)MAC_RD_WR_RSP_API_S_VER_1 */

2519 2520 2521 2522 2523 2524 2525
/**
 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
 */
struct iwl_nvm_access_complete_cmd {
	__le32 reserved;
} __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */

2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547
/**
 * enum iwl_extended_cfg_flag - commands driver may send before
 *	finishing init flow
 * @IWL_INIT_DEBUG_CFG: driver is going to send debug config command
 * @IWL_INIT_NVM: driver is going to send NVM_ACCESS commands
 * @IWL_INIT_PHY: driver is going to send PHY_DB commands
 */
enum iwl_extended_cfg_flags {
	IWL_INIT_DEBUG_CFG,
	IWL_INIT_NVM,
	IWL_INIT_PHY,
};

/**
 * struct iwl_extended_cfg_cmd - mark what commands ucode should wait for
 * before finishing init flows
 * @init_flags: values from iwl_extended_cfg_flags
 */
struct iwl_init_extended_cfg_cmd {
	__le32 init_flags;
} __packed; /* INIT_EXTENDED_CFG_CMD_API_S_VER_1 */

2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623
/*
 * struct iwl_nvm_get_info - request to get NVM data
 */
struct iwl_nvm_get_info {
	__le32 reserved;
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */

/**
 * struct iwl_nvm_get_info_general - general NVM data
 * @flags: 1 - empty, 0 - valid
 * @nvm_version: nvm version
 * @board_type: board type
 */
struct iwl_nvm_get_info_general {
	__le32 flags;
	__le16 nvm_version;
	u8 board_type;
	u8 reserved;
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */

/**
 * struct iwl_nvm_get_info_sku - mac information
 * @enable_24g: band 2.4G enabled
 * @enable_5g: band 5G enabled
 * @enable_11n: 11n enabled
 * @enable_11ac: 11ac enabled
 * @mimo_disable: MIMO enabled
 * @ext_crypto: Extended crypto enabled
 */
struct iwl_nvm_get_info_sku {
	__le32 enable_24g;
	__le32 enable_5g;
	__le32 enable_11n;
	__le32 enable_11ac;
	__le32 mimo_disable;
	__le32 ext_crypto;
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_1 */

/**
 * struct iwl_nvm_get_info_phy - phy information
 * @tx_chains: BIT 0 chain A, BIT 1 chain B
 * @rx_chains: BIT 0 chain A, BIT 1 chain B
 */
struct iwl_nvm_get_info_phy {
	__le32 tx_chains;
	__le32 rx_chains;
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */

#define IWL_NUM_CHANNELS (51)

/**
 * struct iwl_nvm_get_info_regulatory - regulatory information
 * @lar_enabled: is LAR enabled
 * @channel_profile: regulatory data of this channel
 * @regulatory: regulatory data, see &enum iwl_nvm_channel_flags for data
 */
struct iwl_nvm_get_info_regulatory {
	__le32 lar_enabled;
	__le16 channel_profile[IWL_NUM_CHANNELS];
	__le16 reserved;
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */

/**
 * struct iwl_nvm_get_info_rsp - response to get NVM data
 * @general: general NVM data
 * @mac_sku: data relating to MAC sku
 * @phy_sku: data relating to PHY sku
 * @regulatory: regulatory data
 */
struct iwl_nvm_get_info_rsp {
	struct iwl_nvm_get_info_general general;
	struct iwl_nvm_get_info_sku mac_sku;
	struct iwl_nvm_get_info_phy phy_sku;
	struct iwl_nvm_get_info_regulatory regulatory;
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_1 */

2624 2625 2626 2627 2628 2629 2630 2631
/**
 * struct iwl_mvm_antenna_coupling_notif - antenna coupling notification
 * @isolation: antenna isolation value
 */
struct iwl_mvm_antenna_coupling_notif {
	__le32 isolation;
} __packed;

J
Johannes Berg 已提交
2632
#endif /* __fw_api_h__ */