iwlwifi: mvm: add registration to cooling device
[linux-2.6-block.git] / drivers / net / wireless / intel / iwlwifi / mvm / fw-api.h
CommitLineData
8ca151b5
JB
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
51368bf7 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
ee9219b2 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
6fa52430 10 * Copyright(c) 2016 Intel Deutschland GmbH
8ca151b5
JB
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
410dc5aa 27 * in the file called COPYING.
8ca151b5
JB
28 *
29 * Contact Information:
cb2f8277 30 * Intel Linux Wireless <linuxwifi@intel.com>
8ca151b5
JB
31 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32 *
33 * BSD LICENSE
34 *
51368bf7 35 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
ee9219b2 36 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
6fa52430 37 * Copyright(c) 2016 Intel Deutschland GmbH
8ca151b5
JB
38 * All rights reserved.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * * Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
49 * distribution.
50 * * Neither the name Intel Corporation nor the names of its
51 * contributors may be used to endorse or promote products derived
52 * from this software without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *
66 *****************************************************************************/
67
68#ifndef __fw_api_h__
69#define __fw_api_h__
70
71#include "fw-api-rs.h"
ee6dbb29 72#include "fw-api-rx.h"
8ca151b5
JB
73#include "fw-api-tx.h"
74#include "fw-api-sta.h"
75#include "fw-api-mac.h"
76#include "fw-api-power.h"
77#include "fw-api-d3.h"
5b7ff615 78#include "fw-api-coex.h"
e820c2da 79#include "fw-api-scan.h"
d19ac589 80#include "fw-api-stats.h"
ce792918 81#include "fw-api-tof.h"
8ca151b5 82
19e737c9 83/* Tx queue numbers */
8ca151b5
JB
84enum {
85 IWL_MVM_OFFCHANNEL_QUEUE = 8,
86 IWL_MVM_CMD_QUEUE = 9,
8ca151b5
JB
87};
88
b2d81db7
JB
89enum iwl_mvm_tx_fifo {
90 IWL_MVM_TX_FIFO_BK = 0,
91 IWL_MVM_TX_FIFO_BE,
92 IWL_MVM_TX_FIFO_VI,
93 IWL_MVM_TX_FIFO_VO,
94 IWL_MVM_TX_FIFO_MCAST = 5,
95 IWL_MVM_TX_FIFO_CMD = 7,
96};
19e737c9 97
8ca151b5
JB
98#define IWL_MVM_STATION_COUNT 16
99
cf7b491d
AN
100#define IWL_MVM_TDLS_STA_COUNT 4
101
8ca151b5
JB
102/* commands */
103enum {
104 MVM_ALIVE = 0x1,
105 REPLY_ERROR = 0x2,
e5046019 106 ECHO_CMD = 0x3,
8ca151b5
JB
107
108 INIT_COMPLETE_NOTIF = 0x4,
109
110 /* PHY context commands */
111 PHY_CONTEXT_CMD = 0x8,
112 DBG_CFG = 0x9,
b9fae2d5 113 ANTENNA_COUPLING_NOTIFICATION = 0xa,
8ca151b5 114
d2496221 115 /* UMAC scan commands */
ee9219b2 116 SCAN_ITERATION_COMPLETE_UMAC = 0xb5,
d2496221
DS
117 SCAN_CFG_CMD = 0xc,
118 SCAN_REQ_UMAC = 0xd,
119 SCAN_ABORT_UMAC = 0xe,
120 SCAN_COMPLETE_UMAC = 0xf,
121
8ca151b5 122 /* station table */
5a258aae 123 ADD_STA_KEY = 0x17,
8ca151b5
JB
124 ADD_STA = 0x18,
125 REMOVE_STA = 0x19,
126
e1120187
MG
127 /* paging get item */
128 FW_GET_ITEM_CMD = 0x1a,
129
8ca151b5
JB
130 /* TX */
131 TX_CMD = 0x1c,
132 TXPATH_FLUSH = 0x1e,
133 MGMT_MCAST_KEY = 0x1f,
134
3edf8ff6
AA
135 /* scheduler config */
136 SCD_QUEUE_CFG = 0x1d,
137
8ca151b5
JB
138 /* global key */
139 WEP_KEY = 0x20,
140
04fd2c28
LK
141 /* Memory */
142 SHARED_MEM_CFG = 0x25,
143
77c5d7ef
AN
144 /* TDLS */
145 TDLS_CHANNEL_SWITCH_CMD = 0x27,
146 TDLS_CHANNEL_SWITCH_NOTIFICATION = 0xaa,
307e4723 147 TDLS_CONFIG_CMD = 0xa7,
77c5d7ef 148
8ca151b5
JB
149 /* MAC and Binding commands */
150 MAC_CONTEXT_CMD = 0x28,
151 TIME_EVENT_CMD = 0x29, /* both CMD and response */
152 TIME_EVENT_NOTIFICATION = 0x2a,
153 BINDING_CONTEXT_CMD = 0x2b,
154 TIME_QUOTA_CMD = 0x2c,
4ac6cb59 155 NON_QOS_TX_COUNTER_CMD = 0x2d,
8ca151b5
JB
156
157 LQ_CMD = 0x4e,
158
a6c4fb44
MG
159 /* paging block to FW cpu2 */
160 FW_PAGING_BLOCK_CMD = 0x4f,
161
8ca151b5
JB
162 /* Scan offload */
163 SCAN_OFFLOAD_REQUEST_CMD = 0x51,
164 SCAN_OFFLOAD_ABORT_CMD = 0x52,
720befbf 165 HOT_SPOT_CMD = 0x53,
8ca151b5
JB
166 SCAN_OFFLOAD_COMPLETE = 0x6D,
167 SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
168 SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
35a000b7 169 MATCH_FOUND_NOTIFICATION = 0xd9,
fb98be5e 170 SCAN_ITERATION_COMPLETE = 0xe7,
8ca151b5
JB
171
172 /* Phy */
173 PHY_CONFIGURATION_CMD = 0x6a,
174 CALIB_RES_NOTIF_PHY_DB = 0x6b,
175 /* PHY_DB_CMD = 0x6c, */
176
ce792918
GG
177 /* ToF - 802.11mc FTM */
178 TOF_CMD = 0x10,
179 TOF_NOTIFICATION = 0x11,
180
e811ada7 181 /* Power - legacy power table command */
8ca151b5 182 POWER_TABLE_CMD = 0x77,
175a70b7 183 PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
9180ac50 184 LTR_CONFIG = 0xee,
8ca151b5 185
9ee718aa
EL
186 /* Thermal Throttling*/
187 REPLY_THERMAL_MNG_BACKOFF = 0x7e,
188
0becb377
MG
189 /* Set/Get DC2DC frequency tune */
190 DC2DC_CONFIG_CMD = 0x83,
191
8ca151b5
JB
192 /* NVM */
193 NVM_ACCESS_CMD = 0x88,
194
195 SET_CALIB_DEFAULT_CMD = 0x8e,
196
571765c8 197 BEACON_NOTIFICATION = 0x90,
8ca151b5
JB
198 BEACON_TEMPLATE_CMD = 0x91,
199 TX_ANT_CONFIGURATION_CMD = 0x98,
91a8bcde 200 STATISTICS_CMD = 0x9c,
8ca151b5 201 STATISTICS_NOTIFICATION = 0x9d,
3e56eadf 202 EOSP_NOTIFICATION = 0x9e,
88f2fd73 203 REDUCE_TX_POWER_CMD = 0x9f,
8ca151b5
JB
204
205 /* RF-KILL commands and notifications */
206 CARD_STATE_CMD = 0xa0,
207 CARD_STATE_NOTIFICATION = 0xa1,
208
d64048ed
HG
209 MISSED_BEACONS_NOTIFICATION = 0xa2,
210
e811ada7
AB
211 /* Power - new power table command */
212 MAC_PM_POWER_TABLE = 0xa9,
213
30269c12
CRI
214 MFUART_LOAD_NOTIFICATION = 0xb1,
215
43413a97
SS
216 RSS_CONFIG_CMD = 0xb3,
217
8ca151b5
JB
218 REPLY_RX_PHY_CMD = 0xc0,
219 REPLY_RX_MPDU_CMD = 0xc1,
13555e8b 220 FRAME_RELEASE = 0xc3,
8ca151b5
JB
221 BA_NOTIF = 0xc5,
222
dcaf9f5e
AN
223 /* Location Aware Regulatory */
224 MCC_UPDATE_CMD = 0xc8,
88931cc9 225 MCC_CHUB_UPDATE_CMD = 0xc9,
dcaf9f5e 226
a2d79c57
MG
227 MARKER_CMD = 0xcb,
228
fb3ceb81
EG
229 /* BT Coex */
230 BT_COEX_PRIO_TABLE = 0xcc,
231 BT_COEX_PROT_ENV = 0xcd,
232 BT_PROFILE_NOTIFICATION = 0xce,
430a3bba
EG
233 BT_CONFIG = 0x9b,
234 BT_COEX_UPDATE_SW_BOOST = 0x5a,
235 BT_COEX_UPDATE_CORUN_LUT = 0x5b,
236 BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
dac94da8 237 BT_COEX_CI = 0x5d,
fb3ceb81 238
1f3b0ff8 239 REPLY_SF_CFG_CMD = 0xd1,
7df15b1e
HG
240 REPLY_BEACON_FILTERING_CMD = 0xd2,
241
a0a09243
LC
242 /* DTS measurements */
243 CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
244 DTS_MEASUREMENT_NOTIFICATION = 0xdd,
245
8ca151b5 246 REPLY_DEBUG_CMD = 0xf0,
321c2104 247 LDBG_CONFIG_CMD = 0xf6,
8ca151b5
JB
248 DEBUG_LOG_MSG = 0xf7,
249
c87163b9 250 BCAST_FILTER_CMD = 0xcf,
51b6b9e0
EG
251 MCAST_FILTER_CMD = 0xd0,
252
8ca151b5
JB
253 /* D3 commands/notifications */
254 D3_CONFIG_CMD = 0xd3,
255 PROT_OFFLOAD_CONFIG_CMD = 0xd4,
256 OFFLOADS_QUERY_CMD = 0xd5,
257 REMOTE_WAKE_CONFIG_CMD = 0xd6,
98ee7783 258 D0I3_END_CMD = 0xed,
8ca151b5
JB
259
260 /* for WoWLAN in particular */
261 WOWLAN_PATTERNS = 0xe0,
262 WOWLAN_CONFIGURATION = 0xe1,
263 WOWLAN_TSC_RSC_PARAM = 0xe2,
264 WOWLAN_TKIP_PARAM = 0xe3,
265 WOWLAN_KEK_KCK_MATERIAL = 0xe4,
266 WOWLAN_GET_STATUSES = 0xe5,
267 WOWLAN_TX_POWER_PER_DB = 0xe6,
268
269 /* and for NetDetect */
b04998f3
LC
270 SCAN_OFFLOAD_PROFILES_QUERY_CMD = 0x56,
271 SCAN_OFFLOAD_HOTSPOTS_CONFIG_CMD = 0x58,
272 SCAN_OFFLOAD_HOTSPOTS_QUERY_CMD = 0x59,
8ca151b5
JB
273
274 REPLY_MAX = 0xff,
275};
276
39bdb17e
SD
277/* Please keep this enum *SORTED* by hex value.
278 * Needed for binary search, otherwise a warning will be triggered.
279 */
09eef330
AE
280enum iwl_phy_ops_subcmd_ids {
281 CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
5c89e7bc 282 CTDP_CONFIG_CMD = 0x03,
c221daf2 283 TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
0a3b7119 284 CT_KILL_NOTIFICATION = 0xFE,
09eef330
AE
285 DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
286};
287
0db056d3
SS
288enum iwl_prot_offload_subcmd_ids {
289 STORED_BEACON_NTF = 0xFF,
290};
291
09eef330
AE
292/* command groups */
293enum {
39bdb17e
SD
294 LEGACY_GROUP = 0x0,
295 LONG_GROUP = 0x1,
09eef330 296 PHY_OPS_GROUP = 0x4,
0db056d3 297 PROT_OFFLOAD_GROUP = 0xb,
09eef330
AE
298};
299
8ca151b5
JB
300/**
301 * struct iwl_cmd_response - generic response struct for most commands
302 * @status: status of the command asked, changes for each one
303 */
304struct iwl_cmd_response {
305 __le32 status;
306};
307
308/*
309 * struct iwl_tx_ant_cfg_cmd
310 * @valid: valid antenna configuration
311 */
312struct iwl_tx_ant_cfg_cmd {
313 __le32 valid;
314} __packed;
315
316/*
317 * Calibration control struct.
318 * Sent as part of the phy configuration command.
319 * @flow_trigger: bitmap for which calibrations to perform according to
320 * flow triggers.
321 * @event_trigger: bitmap for which calibrations to perform according to
322 * event triggers.
323 */
324struct iwl_calib_ctrl {
325 __le32 flow_trigger;
326 __le32 event_trigger;
327} __packed;
328
329/* This enum defines the bitmap of various calibrations to enable in both
330 * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
331 */
332enum iwl_calib_cfg {
333 IWL_CALIB_CFG_XTAL_IDX = BIT(0),
334 IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
335 IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
336 IWL_CALIB_CFG_PAPD_IDX = BIT(3),
337 IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
338 IWL_CALIB_CFG_DC_IDX = BIT(5),
339 IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
340 IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
341 IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
342 IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
343 IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
344 IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
345 IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
346 IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
347 IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
348 IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
349 IWL_CALIB_CFG_DAC_IDX = BIT(16),
350 IWL_CALIB_CFG_ABS_IDX = BIT(17),
351 IWL_CALIB_CFG_AGC_IDX = BIT(18),
352};
353
354/*
355 * Phy configuration command.
356 */
357struct iwl_phy_cfg_cmd {
358 __le32 phy_cfg;
359 struct iwl_calib_ctrl calib_control;
360} __packed;
361
362#define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
363#define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
364#define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
365#define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
366#define PHY_CFG_TX_CHAIN_A BIT(8)
367#define PHY_CFG_TX_CHAIN_B BIT(9)
368#define PHY_CFG_TX_CHAIN_C BIT(10)
369#define PHY_CFG_RX_CHAIN_A BIT(12)
370#define PHY_CFG_RX_CHAIN_B BIT(13)
371#define PHY_CFG_RX_CHAIN_C BIT(14)
372
373
374/* Target of the NVM_ACCESS_CMD */
375enum {
376 NVM_ACCESS_TARGET_CACHE = 0,
377 NVM_ACCESS_TARGET_OTP = 1,
378 NVM_ACCESS_TARGET_EEPROM = 2,
379};
380
b9545b48 381/* Section types for NVM_ACCESS_CMD */
8ca151b5 382enum {
ae2b21b0 383 NVM_SECTION_TYPE_SW = 1,
77db0a3c 384 NVM_SECTION_TYPE_REGULATORY = 3,
ae2b21b0
EH
385 NVM_SECTION_TYPE_CALIBRATION = 4,
386 NVM_SECTION_TYPE_PRODUCTION = 5,
77db0a3c 387 NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
ce500071
EH
388 NVM_SECTION_TYPE_PHY_SKU = 12,
389 NVM_MAX_NUM_SECTIONS = 13,
8ca151b5
JB
390};
391
392/**
393 * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
394 * @op_code: 0 - read, 1 - write
395 * @target: NVM_ACCESS_TARGET_*
396 * @type: NVM_SECTION_TYPE_*
397 * @offset: offset in bytes into the section
398 * @length: in bytes, to read/write
399 * @data: if write operation, the data to write. On read its empty
400 */
b9545b48 401struct iwl_nvm_access_cmd {
8ca151b5
JB
402 u8 op_code;
403 u8 target;
404 __le16 type;
405 __le16 offset;
406 __le16 length;
407 u8 data[];
408} __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
409
a6c4fb44
MG
410#define NUM_OF_FW_PAGING_BLOCKS 33 /* 32 for data and 1 block for CSS */
411
412/*
413 * struct iwl_fw_paging_cmd - paging layout
414 *
415 * (FW_PAGING_BLOCK_CMD = 0x4f)
416 *
417 * Send to FW the paging layout in the driver.
418 *
419 * @flags: various flags for the command
420 * @block_size: the block size in powers of 2
421 * @block_num: number of blocks specified in the command.
422 * @device_phy_addr: virtual addresses from device side
423*/
424struct iwl_fw_paging_cmd {
425 __le32 flags;
426 __le32 block_size;
427 __le32 block_num;
428 __le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
429} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */
430
e1120187
MG
431/*
432 * Fw items ID's
433 *
434 * @IWL_FW_ITEM_ID_PAGING: Address of the pages that the FW will upload
435 * download
436 */
437enum iwl_fw_item_id {
438 IWL_FW_ITEM_ID_PAGING = 3,
439};
440
441/*
442 * struct iwl_fw_get_item_cmd - get an item from the fw
443 */
444struct iwl_fw_get_item_cmd {
445 __le32 item_id;
446} __packed; /* FW_GET_ITEM_CMD_API_S_VER_1 */
447
321c2104
GBA
448#define CONT_REC_COMMAND_SIZE 80
449#define ENABLE_CONT_RECORDING 0x15
450#define DISABLE_CONT_RECORDING 0x16
451
452/*
453 * struct iwl_continuous_record_mode - recording mode
454 */
455struct iwl_continuous_record_mode {
456 __le16 enable_recording;
457} __packed;
458
459/*
460 * struct iwl_continuous_record_cmd - enable/disable continuous recording
461 */
462struct iwl_continuous_record_cmd {
463 struct iwl_continuous_record_mode record_mode;
464 u8 pad[CONT_REC_COMMAND_SIZE -
465 sizeof(struct iwl_continuous_record_mode)];
466} __packed;
467
e1120187
MG
468struct iwl_fw_get_item_resp {
469 __le32 item_id;
470 __le32 item_byte_cnt;
471 __le32 item_val;
472} __packed; /* FW_GET_ITEM_RSP_S_VER_1 */
473
8ca151b5
JB
474/**
475 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
476 * @offset: offset in bytes into the section
477 * @length: in bytes, either how much was written or read
478 * @type: NVM_SECTION_TYPE_*
479 * @status: 0 for success, fail otherwise
480 * @data: if read operation, the data returned. Empty on write.
481 */
b9545b48 482struct iwl_nvm_access_resp {
8ca151b5
JB
483 __le16 offset;
484 __le16 length;
485 __le16 type;
486 __le16 status;
487 u8 data[];
488} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
489
490/* MVM_ALIVE 0x1 */
491
492/* alive response is_valid values */
493#define ALIVE_RESP_UCODE_OK BIT(0)
494#define ALIVE_RESP_RFKILL BIT(1)
495
496/* alive response ver_type values */
497enum {
498 FW_TYPE_HW = 0,
499 FW_TYPE_PROT = 1,
500 FW_TYPE_AP = 2,
501 FW_TYPE_WOWLAN = 3,
502 FW_TYPE_TIMING = 4,
503 FW_TYPE_WIPAN = 5
504};
505
506/* alive response ver_subtype values */
507enum {
508 FW_SUBTYPE_FULL_FEATURE = 0,
509 FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
510 FW_SUBTYPE_REDUCED = 2,
511 FW_SUBTYPE_ALIVE_ONLY = 3,
512 FW_SUBTYPE_WOWLAN = 4,
513 FW_SUBTYPE_AP_SUBTYPE = 5,
514 FW_SUBTYPE_WIPAN = 6,
515 FW_SUBTYPE_INITIALIZE = 9
516};
517
518#define IWL_ALIVE_STATUS_ERR 0xDEAD
519#define IWL_ALIVE_STATUS_OK 0xCAFE
520
521#define IWL_ALIVE_FLG_RFKILL BIT(0)
522
7e1223b5 523struct mvm_alive_resp_ver1 {
8ca151b5
JB
524 __le16 status;
525 __le16 flags;
526 u8 ucode_minor;
527 u8 ucode_major;
528 __le16 id;
529 u8 api_minor;
530 u8 api_major;
531 u8 ver_subtype;
532 u8 ver_type;
533 u8 mac;
534 u8 opt;
535 __le16 reserved2;
536 __le32 timestamp;
537 __le32 error_event_table_ptr; /* SRAM address for error log */
538 __le32 log_event_table_ptr; /* SRAM address for event log */
539 __le32 cpu_register_ptr;
540 __le32 dbgm_config_ptr;
541 __le32 alive_counter_ptr;
542 __le32 scd_base_ptr; /* SRAM address for SCD */
543} __packed; /* ALIVE_RES_API_S_VER_1 */
544
01a9ca51
EH
545struct mvm_alive_resp_ver2 {
546 __le16 status;
547 __le16 flags;
548 u8 ucode_minor;
549 u8 ucode_major;
550 __le16 id;
551 u8 api_minor;
552 u8 api_major;
553 u8 ver_subtype;
554 u8 ver_type;
555 u8 mac;
556 u8 opt;
557 __le16 reserved2;
558 __le32 timestamp;
559 __le32 error_event_table_ptr; /* SRAM address for error log */
560 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
561 __le32 cpu_register_ptr;
562 __le32 dbgm_config_ptr;
563 __le32 alive_counter_ptr;
564 __le32 scd_base_ptr; /* SRAM address for SCD */
565 __le32 st_fwrd_addr; /* pointer to Store and forward */
566 __le32 st_fwrd_size;
567 u8 umac_minor; /* UMAC version: minor */
568 u8 umac_major; /* UMAC version: major */
569 __le16 umac_id; /* UMAC version: id */
570 __le32 error_info_addr; /* SRAM address for UMAC error log */
571 __le32 dbg_print_buff_addr;
572} __packed; /* ALIVE_RES_API_S_VER_2 */
573
7e1223b5
EG
574struct mvm_alive_resp {
575 __le16 status;
576 __le16 flags;
577 __le32 ucode_minor;
578 __le32 ucode_major;
579 u8 ver_subtype;
580 u8 ver_type;
581 u8 mac;
582 u8 opt;
583 __le32 timestamp;
584 __le32 error_event_table_ptr; /* SRAM address for error log */
585 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
586 __le32 cpu_register_ptr;
587 __le32 dbgm_config_ptr;
588 __le32 alive_counter_ptr;
589 __le32 scd_base_ptr; /* SRAM address for SCD */
590 __le32 st_fwrd_addr; /* pointer to Store and forward */
591 __le32 st_fwrd_size;
592 __le32 umac_minor; /* UMAC version: minor */
593 __le32 umac_major; /* UMAC version: major */
594 __le32 error_info_addr; /* SRAM address for UMAC error log */
595 __le32 dbg_print_buff_addr;
596} __packed; /* ALIVE_RES_API_S_VER_3 */
597
8ca151b5
JB
598/* Error response/notification */
599enum {
600 FW_ERR_UNKNOWN_CMD = 0x0,
601 FW_ERR_INVALID_CMD_PARAM = 0x1,
602 FW_ERR_SERVICE = 0x2,
603 FW_ERR_ARC_MEMORY = 0x3,
604 FW_ERR_ARC_CODE = 0x4,
605 FW_ERR_WATCH_DOG = 0x5,
606 FW_ERR_WEP_GRP_KEY_INDX = 0x10,
607 FW_ERR_WEP_KEY_SIZE = 0x11,
608 FW_ERR_OBSOLETE_FUNC = 0x12,
609 FW_ERR_UNEXPECTED = 0xFE,
610 FW_ERR_FATAL = 0xFF
611};
612
613/**
614 * struct iwl_error_resp - FW error indication
615 * ( REPLY_ERROR = 0x2 )
616 * @error_type: one of FW_ERR_*
617 * @cmd_id: the command ID for which the error occured
618 * @bad_cmd_seq_num: sequence number of the erroneous command
619 * @error_service: which service created the error, applicable only if
620 * error_type = 2, otherwise 0
621 * @timestamp: TSF in usecs.
622 */
623struct iwl_error_resp {
624 __le32 error_type;
625 u8 cmd_id;
626 u8 reserved1;
627 __le16 bad_cmd_seq_num;
628 __le32 error_service;
629 __le64 timestamp;
630} __packed;
631
632
633/* Common PHY, MAC and Bindings definitions */
634
635#define MAX_MACS_IN_BINDING (3)
636#define MAX_BINDINGS (4)
637#define AUX_BINDING_INDEX (3)
638#define MAX_PHYS (4)
639
640/* Used to extract ID and color from the context dword */
641#define FW_CTXT_ID_POS (0)
642#define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
643#define FW_CTXT_COLOR_POS (8)
644#define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
645#define FW_CTXT_INVALID (0xffffffff)
646
647#define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
648 (_color << FW_CTXT_COLOR_POS))
649
650/* Possible actions on PHYs, MACs and Bindings */
651enum {
652 FW_CTXT_ACTION_STUB = 0,
653 FW_CTXT_ACTION_ADD,
654 FW_CTXT_ACTION_MODIFY,
655 FW_CTXT_ACTION_REMOVE,
656 FW_CTXT_ACTION_NUM
657}; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
658
659/* Time Events */
660
661/* Time Event types, according to MAC type */
662enum iwl_time_event_type {
663 /* BSS Station Events */
664 TE_BSS_STA_AGGRESSIVE_ASSOC,
665 TE_BSS_STA_ASSOC,
666 TE_BSS_EAP_DHCP_PROT,
667 TE_BSS_QUIET_PERIOD,
668
669 /* P2P Device Events */
670 TE_P2P_DEVICE_DISCOVERABLE,
671 TE_P2P_DEVICE_LISTEN,
672 TE_P2P_DEVICE_ACTION_SCAN,
673 TE_P2P_DEVICE_FULL_SCAN,
674
675 /* P2P Client Events */
676 TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
677 TE_P2P_CLIENT_ASSOC,
678 TE_P2P_CLIENT_QUIET_PERIOD,
679
680 /* P2P GO Events */
681 TE_P2P_GO_ASSOC_PROT,
682 TE_P2P_GO_REPETITIVE_NOA,
683 TE_P2P_GO_CT_WINDOW,
684
685 /* WiDi Sync Events */
686 TE_WIDI_TX_SYNC,
687
7f0a7c67 688 /* Channel Switch NoA */
f991e17b 689 TE_CHANNEL_SWITCH_PERIOD,
7f0a7c67 690
8ca151b5
JB
691 TE_MAX
692}; /* MAC_EVENT_TYPE_API_E_VER_1 */
693
f8f03c3e
EL
694
695
696/* Time event - defines for command API v1 */
697
698/*
699 * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
700 * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
701 * the first fragment is scheduled.
702 * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
703 * the first 2 fragments are scheduled.
704 * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
705 * number of fragments are valid.
706 *
707 * Other than the constant defined above, specifying a fragmentation value 'x'
708 * means that the event can be fragmented but only the first 'x' will be
709 * scheduled.
710 */
711enum {
712 TE_V1_FRAG_NONE = 0,
713 TE_V1_FRAG_SINGLE = 1,
714 TE_V1_FRAG_DUAL = 2,
715 TE_V1_FRAG_ENDLESS = 0xffffffff
716};
717
718/* If a Time Event can be fragmented, this is the max number of fragments */
719#define TE_V1_FRAG_MAX_MSK 0x0fffffff
720/* Repeat the time event endlessly (until removed) */
721#define TE_V1_REPEAT_ENDLESS 0xffffffff
722/* If a Time Event has bounded repetitions, this is the maximal value */
723#define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
724
8ca151b5
JB
725/* Time Event dependencies: none, on another TE, or in a specific time */
726enum {
f8f03c3e
EL
727 TE_V1_INDEPENDENT = 0,
728 TE_V1_DEP_OTHER = BIT(0),
729 TE_V1_DEP_TSF = BIT(1),
730 TE_V1_EVENT_SOCIOPATHIC = BIT(2),
8ca151b5 731}; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
f8f03c3e 732
1da80e80 733/*
f8f03c3e
EL
734 * @TE_V1_NOTIF_NONE: no notifications
735 * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
736 * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
737 * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
738 * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
739 * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
740 * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
741 * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
742 * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
743 *
1da80e80
IP
744 * Supported Time event notifications configuration.
745 * A notification (both event and fragment) includes a status indicating weather
746 * the FW was able to schedule the event or not. For fragment start/end
747 * notification the status is always success. There is no start/end fragment
748 * notification for monolithic events.
1da80e80 749 */
8ca151b5 750enum {
f8f03c3e
EL
751 TE_V1_NOTIF_NONE = 0,
752 TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
753 TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
754 TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
755 TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
756 TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
757 TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
758 TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
759 TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
1da80e80 760}; /* MAC_EVENT_ACTION_API_E_VER_2 */
8ca151b5 761
a373f67c 762/* Time event - defines for command API */
f8f03c3e 763
8ca151b5 764/*
f8f03c3e
EL
765 * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
766 * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
8ca151b5 767 * the first fragment is scheduled.
f8f03c3e 768 * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
8ca151b5 769 * the first 2 fragments are scheduled.
f8f03c3e
EL
770 * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
771 * number of fragments are valid.
8ca151b5
JB
772 *
773 * Other than the constant defined above, specifying a fragmentation value 'x'
774 * means that the event can be fragmented but only the first 'x' will be
775 * scheduled.
776 */
777enum {
f8f03c3e
EL
778 TE_V2_FRAG_NONE = 0,
779 TE_V2_FRAG_SINGLE = 1,
780 TE_V2_FRAG_DUAL = 2,
781 TE_V2_FRAG_MAX = 0xfe,
782 TE_V2_FRAG_ENDLESS = 0xff
8ca151b5
JB
783};
784
785/* Repeat the time event endlessly (until removed) */
f8f03c3e 786#define TE_V2_REPEAT_ENDLESS 0xff
8ca151b5 787/* If a Time Event has bounded repetitions, this is the maximal value */
f8f03c3e
EL
788#define TE_V2_REPEAT_MAX 0xfe
789
790#define TE_V2_PLACEMENT_POS 12
791#define TE_V2_ABSENCE_POS 15
792
a373f67c 793/* Time event policy values
f8f03c3e
EL
794 * A notification (both event and fragment) includes a status indicating weather
795 * the FW was able to schedule the event or not. For fragment start/end
796 * notification the status is always success. There is no start/end fragment
797 * notification for monolithic events.
798 *
799 * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
800 * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
801 * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
802 * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
803 * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
804 * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
805 * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
806 * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
807 * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
808 * @TE_V2_DEP_OTHER: depends on another time event
809 * @TE_V2_DEP_TSF: depends on a specific time
810 * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
811 * @TE_V2_ABSENCE: are we present or absent during the Time Event.
812 */
813enum {
814 TE_V2_DEFAULT_POLICY = 0x0,
815
816 /* notifications (event start/stop, fragment start/stop) */
817 TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
818 TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
819 TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
820 TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
821
822 TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
823 TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
824 TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
825 TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
1f6bf078 826 T2_V2_START_IMMEDIATELY = BIT(11),
f8f03c3e
EL
827
828 TE_V2_NOTIF_MSK = 0xff,
829
830 /* placement characteristics */
831 TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
832 TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
833 TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
834
835 /* are we present or absent during the Time Event. */
836 TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
837};
8ca151b5
JB
838
839/**
a373f67c 840 * struct iwl_time_event_cmd_api - configuring Time Events
f8f03c3e
EL
841 * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
842 * with version 1. determined by IWL_UCODE_TLV_FLAGS)
8ca151b5
JB
843 * ( TIME_EVENT_CMD = 0x29 )
844 * @id_and_color: ID and color of the relevant MAC
845 * @action: action to perform, one of FW_CTXT_ACTION_*
846 * @id: this field has two meanings, depending on the action:
847 * If the action is ADD, then it means the type of event to add.
848 * For all other actions it is the unique event ID assigned when the
849 * event was added by the FW.
850 * @apply_time: When to start the Time Event (in GP2)
851 * @max_delay: maximum delay to event's start (apply time), in TU
852 * @depends_on: the unique ID of the event we depend on (if any)
853 * @interval: interval between repetitions, in TU
8ca151b5
JB
854 * @duration: duration of event in TU
855 * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
8ca151b5 856 * @max_frags: maximal number of fragments the Time Event can be divided to
f8f03c3e
EL
857 * @policy: defines whether uCode shall notify the host or other uCode modules
858 * on event and/or fragment start and/or end
859 * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
860 * TE_EVENT_SOCIOPATHIC
861 * using TE_ABSENCE and using TE_NOTIF_*
8ca151b5 862 */
a373f67c 863struct iwl_time_event_cmd {
8ca151b5
JB
864 /* COMMON_INDEX_HDR_API_S_VER_1 */
865 __le32 id_and_color;
866 __le32 action;
867 __le32 id;
f8f03c3e 868 /* MAC_TIME_EVENT_DATA_API_S_VER_2 */
8ca151b5
JB
869 __le32 apply_time;
870 __le32 max_delay;
8ca151b5 871 __le32 depends_on;
8ca151b5 872 __le32 interval;
8ca151b5 873 __le32 duration;
f8f03c3e
EL
874 u8 repeat;
875 u8 max_frags;
876 __le16 policy;
877} __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
8ca151b5
JB
878
879/**
880 * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
881 * @status: bit 0 indicates success, all others specify errors
882 * @id: the Time Event type
883 * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
884 * @id_and_color: ID and color of the relevant MAC
885 */
886struct iwl_time_event_resp {
887 __le32 status;
888 __le32 id;
889 __le32 unique_id;
890 __le32 id_and_color;
891} __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
892
893/**
894 * struct iwl_time_event_notif - notifications of time event start/stop
895 * ( TIME_EVENT_NOTIFICATION = 0x2a )
896 * @timestamp: action timestamp in GP2
897 * @session_id: session's unique id
898 * @unique_id: unique id of the Time Event itself
899 * @id_and_color: ID and color of the relevant MAC
900 * @action: one of TE_NOTIF_START or TE_NOTIF_END
901 * @status: true if scheduled, false otherwise (not executed)
902 */
903struct iwl_time_event_notif {
904 __le32 timestamp;
905 __le32 session_id;
906 __le32 unique_id;
907 __le32 id_and_color;
908 __le32 action;
909 __le32 status;
910} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
911
912
913/* Bindings and Time Quota */
914
915/**
916 * struct iwl_binding_cmd - configuring bindings
917 * ( BINDING_CONTEXT_CMD = 0x2b )
918 * @id_and_color: ID and color of the relevant Binding
919 * @action: action to perform, one of FW_CTXT_ACTION_*
920 * @macs: array of MAC id and colors which belong to the binding
921 * @phy: PHY id and color which belongs to the binding
922 */
923struct iwl_binding_cmd {
924 /* COMMON_INDEX_HDR_API_S_VER_1 */
925 __le32 id_and_color;
926 __le32 action;
927 /* BINDING_DATA_API_S_VER_1 */
928 __le32 macs[MAX_MACS_IN_BINDING];
929 __le32 phy;
930} __packed; /* BINDING_CMD_API_S_VER_1 */
931
35adfd6e
IP
932/* The maximal number of fragments in the FW's schedule session */
933#define IWL_MVM_MAX_QUOTA 128
934
8ca151b5
JB
935/**
936 * struct iwl_time_quota_data - configuration of time quota per binding
937 * @id_and_color: ID and color of the relevant Binding
938 * @quota: absolute time quota in TU. The scheduler will try to divide the
939 * remainig quota (after Time Events) according to this quota.
940 * @max_duration: max uninterrupted context duration in TU
941 */
942struct iwl_time_quota_data {
943 __le32 id_and_color;
944 __le32 quota;
945 __le32 max_duration;
946} __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
947
948/**
949 * struct iwl_time_quota_cmd - configuration of time quota between bindings
950 * ( TIME_QUOTA_CMD = 0x2c )
951 * @quotas: allocations per binding
952 */
953struct iwl_time_quota_cmd {
954 struct iwl_time_quota_data quotas[MAX_BINDINGS];
955} __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
956
957
958/* PHY context */
959
960/* Supported bands */
961#define PHY_BAND_5 (0)
962#define PHY_BAND_24 (1)
963
964/* Supported channel width, vary if there is VHT support */
965#define PHY_VHT_CHANNEL_MODE20 (0x0)
966#define PHY_VHT_CHANNEL_MODE40 (0x1)
967#define PHY_VHT_CHANNEL_MODE80 (0x2)
968#define PHY_VHT_CHANNEL_MODE160 (0x3)
969
970/*
971 * Control channel position:
972 * For legacy set bit means upper channel, otherwise lower.
973 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
974 * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
975 * center_freq
976 * |
977 * 40Mhz |_______|_______|
978 * 80Mhz |_______|_______|_______|_______|
979 * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
980 * code 011 010 001 000 | 100 101 110 111
981 */
982#define PHY_VHT_CTRL_POS_1_BELOW (0x0)
983#define PHY_VHT_CTRL_POS_2_BELOW (0x1)
984#define PHY_VHT_CTRL_POS_3_BELOW (0x2)
985#define PHY_VHT_CTRL_POS_4_BELOW (0x3)
986#define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
987#define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
988#define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
989#define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
990
991/*
992 * @band: PHY_BAND_*
993 * @channel: channel number
994 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
995 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
996 */
997struct iwl_fw_channel_info {
998 u8 band;
999 u8 channel;
1000 u8 width;
1001 u8 ctrl_pos;
1002} __packed;
1003
1004#define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
1005#define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
1006 (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
1007#define PHY_RX_CHAIN_VALID_POS (1)
1008#define PHY_RX_CHAIN_VALID_MSK \
1009 (0x7 << PHY_RX_CHAIN_VALID_POS)
1010#define PHY_RX_CHAIN_FORCE_SEL_POS (4)
1011#define PHY_RX_CHAIN_FORCE_SEL_MSK \
1012 (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
1013#define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
1014#define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
1015 (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
1016#define PHY_RX_CHAIN_CNT_POS (10)
1017#define PHY_RX_CHAIN_CNT_MSK \
1018 (0x3 << PHY_RX_CHAIN_CNT_POS)
1019#define PHY_RX_CHAIN_MIMO_CNT_POS (12)
1020#define PHY_RX_CHAIN_MIMO_CNT_MSK \
1021 (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
1022#define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
1023#define PHY_RX_CHAIN_MIMO_FORCE_MSK \
1024 (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
1025
1026/* TODO: fix the value, make it depend on firmware at runtime? */
1027#define NUM_PHY_CTX 3
1028
1029/* TODO: complete missing documentation */
1030/**
1031 * struct iwl_phy_context_cmd - config of the PHY context
1032 * ( PHY_CONTEXT_CMD = 0x8 )
1033 * @id_and_color: ID and color of the relevant Binding
1034 * @action: action to perform, one of FW_CTXT_ACTION_*
1035 * @apply_time: 0 means immediate apply and context switch.
1036 * other value means apply new params after X usecs
1037 * @tx_param_color: ???
1038 * @channel_info:
1039 * @txchain_info: ???
1040 * @rxchain_info: ???
1041 * @acquisition_data: ???
1042 * @dsp_cfg_flags: set to 0
1043 */
1044struct iwl_phy_context_cmd {
1045 /* COMMON_INDEX_HDR_API_S_VER_1 */
1046 __le32 id_and_color;
1047 __le32 action;
1048 /* PHY_CONTEXT_DATA_API_S_VER_1 */
1049 __le32 apply_time;
1050 __le32 tx_param_color;
1051 struct iwl_fw_channel_info ci;
1052 __le32 txchain_info;
1053 __le32 rxchain_info;
1054 __le32 acquisition_data;
1055 __le32 dsp_cfg_flags;
1056} __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
1057
720befbf
AM
1058/*
1059 * Aux ROC command
1060 *
1061 * Command requests the firmware to create a time event for a certain duration
1062 * and remain on the given channel. This is done by using the Aux framework in
1063 * the FW.
1064 * The command was first used for Hot Spot issues - but can be used regardless
1065 * to Hot Spot.
1066 *
1067 * ( HOT_SPOT_CMD 0x53 )
1068 *
1069 * @id_and_color: ID and color of the MAC
1070 * @action: action to perform, one of FW_CTXT_ACTION_*
1071 * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
1072 * event_unique_id should be the id of the time event assigned by ucode.
1073 * Otherwise ignore the event_unique_id.
1074 * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
1075 * activity.
1076 * @channel_info: channel info
1077 * @node_addr: Our MAC Address
1078 * @reserved: reserved for alignment
1079 * @apply_time: GP2 value to start (should always be the current GP2 value)
1080 * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
1081 * time by which start of the event is allowed to be postponed.
1082 * @duration: event duration in TU To calculate event duration:
1083 * timeEventDuration = min(duration, remainingQuota)
1084 */
1085struct iwl_hs20_roc_req {
1086 /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
1087 __le32 id_and_color;
1088 __le32 action;
1089 __le32 event_unique_id;
1090 __le32 sta_id_and_color;
1091 struct iwl_fw_channel_info channel_info;
1092 u8 node_addr[ETH_ALEN];
1093 __le16 reserved;
1094 __le32 apply_time;
1095 __le32 apply_time_max_delay;
1096 __le32 duration;
1097} __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
1098
1099/*
1100 * values for AUX ROC result values
1101 */
1102enum iwl_mvm_hot_spot {
1103 HOT_SPOT_RSP_STATUS_OK,
1104 HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
1105 HOT_SPOT_MAX_NUM_OF_SESSIONS,
1106};
1107
1108/*
1109 * Aux ROC command response
1110 *
1111 * In response to iwl_hs20_roc_req the FW sends this command to notify the
1112 * driver the uid of the timevent.
1113 *
1114 * ( HOT_SPOT_CMD 0x53 )
1115 *
1116 * @event_unique_id: Unique ID of time event assigned by ucode
1117 * @status: Return status 0 is success, all the rest used for specific errors
1118 */
1119struct iwl_hs20_roc_res {
1120 __le32 event_unique_id;
1121 __le32 status;
1122} __packed; /* HOT_SPOT_RSP_API_S_VER_1 */
1123
8ca151b5
JB
1124/**
1125 * struct iwl_radio_version_notif - information on the radio version
1126 * ( RADIO_VERSION_NOTIFICATION = 0x68 )
1127 * @radio_flavor:
1128 * @radio_step:
1129 * @radio_dash:
1130 */
1131struct iwl_radio_version_notif {
1132 __le32 radio_flavor;
1133 __le32 radio_step;
1134 __le32 radio_dash;
1135} __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
1136
1137enum iwl_card_state_flags {
1138 CARD_ENABLED = 0x00,
1139 HW_CARD_DISABLED = 0x01,
1140 SW_CARD_DISABLED = 0x02,
1141 CT_KILL_CARD_DISABLED = 0x04,
1142 HALT_CARD_DISABLED = 0x08,
1143 CARD_DISABLED_MSK = 0x0f,
1144 CARD_IS_RX_ON = 0x10,
1145};
1146
1147/**
1148 * struct iwl_radio_version_notif - information on the radio version
1149 * ( CARD_STATE_NOTIFICATION = 0xa1 )
1150 * @flags: %iwl_card_state_flags
1151 */
1152struct iwl_card_state_notif {
1153 __le32 flags;
1154} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
1155
d64048ed
HG
1156/**
1157 * struct iwl_missed_beacons_notif - information on missed beacons
1158 * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
1159 * @mac_id: interface ID
1160 * @consec_missed_beacons_since_last_rx: number of consecutive missed
1161 * beacons since last RX.
1162 * @consec_missed_beacons: number of consecutive missed beacons
1163 * @num_expected_beacons:
1164 * @num_recvd_beacons:
1165 */
1166struct iwl_missed_beacons_notif {
1167 __le32 mac_id;
1168 __le32 consec_missed_beacons_since_last_rx;
1169 __le32 consec_missed_beacons;
1170 __le32 num_expected_beacons;
1171 __le32 num_recvd_beacons;
1172} __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
1173
30269c12
CRI
1174/**
1175 * struct iwl_mfuart_load_notif - mfuart image version & status
1176 * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
1177 * @installed_ver: installed image version
1178 * @external_ver: external image version
1179 * @status: MFUART loading status
1180 * @duration: MFUART loading time
1181*/
1182struct iwl_mfuart_load_notif {
1183 __le32 installed_ver;
1184 __le32 external_ver;
1185 __le32 status;
1186 __le32 duration;
1187} __packed; /*MFU_LOADER_NTFY_API_S_VER_1*/
1188
8ca151b5
JB
1189/**
1190 * struct iwl_set_calib_default_cmd - set default value for calibration.
1191 * ( SET_CALIB_DEFAULT_CMD = 0x8e )
1192 * @calib_index: the calibration to set value for
1193 * @length: of data
1194 * @data: the value to set for the calibration result
1195 */
1196struct iwl_set_calib_default_cmd {
1197 __le16 calib_index;
1198 __le16 length;
1199 u8 data[0];
1200} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
1201
51b6b9e0 1202#define MAX_PORT_ID_NUM 2
e59647ea 1203#define MAX_MCAST_FILTERING_ADDRESSES 256
51b6b9e0
EG
1204
1205/**
1206 * struct iwl_mcast_filter_cmd - configure multicast filter.
1207 * @filter_own: Set 1 to filter out multicast packets sent by station itself
1208 * @port_id: Multicast MAC addresses array specifier. This is a strange way
1209 * to identify network interface adopted in host-device IF.
1210 * It is used by FW as index in array of addresses. This array has
1211 * MAX_PORT_ID_NUM members.
1212 * @count: Number of MAC addresses in the array
1213 * @pass_all: Set 1 to pass all multicast packets.
1214 * @bssid: current association BSSID.
1215 * @addr_list: Place holder for array of MAC addresses.
1216 * IMPORTANT: add padding if necessary to ensure DWORD alignment.
1217 */
1218struct iwl_mcast_filter_cmd {
1219 u8 filter_own;
1220 u8 port_id;
1221 u8 count;
1222 u8 pass_all;
1223 u8 bssid[6];
1224 u8 reserved[2];
1225 u8 addr_list[0];
1226} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
1227
c87163b9
EP
1228#define MAX_BCAST_FILTERS 8
1229#define MAX_BCAST_FILTER_ATTRS 2
1230
1231/**
1232 * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
1233 * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
1234 * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
1235 * start of ip payload).
1236 */
1237enum iwl_mvm_bcast_filter_attr_offset {
1238 BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
1239 BCAST_FILTER_OFFSET_IP_END = 1,
1240};
1241
1242/**
1243 * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
1244 * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset.
1245 * @offset: starting offset of this pattern.
1246 * @val: value to match - big endian (MSB is the first
1247 * byte to match from offset pos).
1248 * @mask: mask to match (big endian).
1249 */
1250struct iwl_fw_bcast_filter_attr {
1251 u8 offset_type;
1252 u8 offset;
1253 __le16 reserved1;
1254 __be32 val;
1255 __be32 mask;
1256} __packed; /* BCAST_FILTER_ATT_S_VER_1 */
1257
1258/**
1259 * enum iwl_mvm_bcast_filter_frame_type - filter frame type
1260 * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
1261 * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
1262 */
1263enum iwl_mvm_bcast_filter_frame_type {
1264 BCAST_FILTER_FRAME_TYPE_ALL = 0,
1265 BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
1266};
1267
1268/**
1269 * struct iwl_fw_bcast_filter - broadcast filter
1270 * @discard: discard frame (1) or let it pass (0).
1271 * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
1272 * @num_attrs: number of valid attributes in this filter.
1273 * @attrs: attributes of this filter. a filter is considered matched
1274 * only when all its attributes are matched (i.e. AND relationship)
1275 */
1276struct iwl_fw_bcast_filter {
1277 u8 discard;
1278 u8 frame_type;
1279 u8 num_attrs;
1280 u8 reserved1;
1281 struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
1282} __packed; /* BCAST_FILTER_S_VER_1 */
1283
1284/**
1285 * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
1286 * @default_discard: default action for this mac (discard (1) / pass (0)).
1287 * @attached_filters: bitmap of relevant filters for this mac.
1288 */
1289struct iwl_fw_bcast_mac {
1290 u8 default_discard;
1291 u8 reserved1;
1292 __le16 attached_filters;
1293} __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
1294
1295/**
1296 * struct iwl_bcast_filter_cmd - broadcast filtering configuration
1297 * @disable: enable (0) / disable (1)
1298 * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
1299 * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
1300 * @filters: broadcast filters
1301 * @macs: broadcast filtering configuration per-mac
1302 */
1303struct iwl_bcast_filter_cmd {
1304 u8 disable;
1305 u8 max_bcast_filters;
1306 u8 max_macs;
1307 u8 reserved1;
1308 struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
1309 struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
1310} __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
1311
a2d79c57
MG
1312/*
1313 * enum iwl_mvm_marker_id - maker ids
1314 *
1315 * The ids for different type of markers to insert into the usniffer logs
1316 */
1317enum iwl_mvm_marker_id {
1318 MARKER_ID_TX_FRAME_LATENCY = 1,
1319}; /* MARKER_ID_API_E_VER_1 */
1320
1321/**
1322 * struct iwl_mvm_marker - mark info into the usniffer logs
1323 *
1324 * (MARKER_CMD = 0xcb)
1325 *
1326 * Mark the UTC time stamp into the usniffer logs together with additional
1327 * metadata, so the usniffer output can be parsed.
1328 * In the command response the ucode will return the GP2 time.
1329 *
1330 * @dw_len: The amount of dwords following this byte including this byte.
1331 * @marker_id: A unique marker id (iwl_mvm_marker_id).
1332 * @reserved: reserved.
1333 * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
1334 * @metadata: additional meta data that will be written to the unsiffer log
1335 */
1336struct iwl_mvm_marker {
1337 u8 dwLen;
1338 u8 markerId;
1339 __le16 reserved;
1340 __le64 timestamp;
1341 __le32 metadata[0];
1342} __packed; /* MARKER_API_S_VER_1 */
1343
0becb377
MG
1344/*
1345 * enum iwl_dc2dc_config_id - flag ids
1346 *
1347 * Ids of dc2dc configuration flags
1348 */
1349enum iwl_dc2dc_config_id {
1350 DCDC_LOW_POWER_MODE_MSK_SET = 0x1, /* not used */
1351 DCDC_FREQ_TUNE_SET = 0x2,
1352}; /* MARKER_ID_API_E_VER_1 */
1353
1354/**
1355 * struct iwl_dc2dc_config_cmd - configure dc2dc values
1356 *
1357 * (DC2DC_CONFIG_CMD = 0x83)
1358 *
1359 * Set/Get & configure dc2dc values.
1360 * The command always returns the current dc2dc values.
1361 *
1362 * @flags: set/get dc2dc
1363 * @enable_low_power_mode: not used.
1364 * @dc2dc_freq_tune0: frequency divider - digital domain
1365 * @dc2dc_freq_tune1: frequency divider - analog domain
1366 */
1367struct iwl_dc2dc_config_cmd {
1368 __le32 flags;
1369 __le32 enable_low_power_mode; /* not used */
1370 __le32 dc2dc_freq_tune0;
1371 __le32 dc2dc_freq_tune1;
1372} __packed; /* DC2DC_CONFIG_CMD_API_S_VER_1 */
1373
1374/**
1375 * struct iwl_dc2dc_config_resp - response for iwl_dc2dc_config_cmd
1376 *
1377 * Current dc2dc values returned by the FW.
1378 *
1379 * @dc2dc_freq_tune0: frequency divider - digital domain
1380 * @dc2dc_freq_tune1: frequency divider - analog domain
1381 */
1382struct iwl_dc2dc_config_resp {
1383 __le32 dc2dc_freq_tune0;
1384 __le32 dc2dc_freq_tune1;
1385} __packed; /* DC2DC_CONFIG_RESP_API_S_VER_1 */
1386
1f3b0ff8
LE
1387/***********************************
1388 * Smart Fifo API
1389 ***********************************/
1390/* Smart Fifo state */
1391enum iwl_sf_state {
1392 SF_LONG_DELAY_ON = 0, /* should never be called by driver */
1393 SF_FULL_ON,
1394 SF_UNINIT,
1395 SF_INIT_OFF,
1396 SF_HW_NUM_STATES
1397};
1398
1399/* Smart Fifo possible scenario */
1400enum iwl_sf_scenario {
1401 SF_SCENARIO_SINGLE_UNICAST,
1402 SF_SCENARIO_AGG_UNICAST,
1403 SF_SCENARIO_MULTICAST,
1404 SF_SCENARIO_BA_RESP,
1405 SF_SCENARIO_TX_RESP,
1406 SF_NUM_SCENARIO
1407};
1408
1409#define SF_TRANSIENT_STATES_NUMBER 2 /* SF_LONG_DELAY_ON and SF_FULL_ON */
1410#define SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */
1411
1412/* smart FIFO default values */
b4c82adc 1413#define SF_W_MARK_SISO 6144
1f3b0ff8
LE
1414#define SF_W_MARK_MIMO2 8192
1415#define SF_W_MARK_MIMO3 6144
1416#define SF_W_MARK_LEGACY 4096
1417#define SF_W_MARK_SCAN 4096
1418
f4a3ee49
EH
1419/* SF Scenarios timers for default configuration (aligned to 32 uSec) */
1420#define SF_SINGLE_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
1421#define SF_SINGLE_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
1422#define SF_AGG_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
1423#define SF_AGG_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
1424#define SF_MCAST_IDLE_TIMER_DEF 160 /* 150 mSec */
1425#define SF_MCAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
1426#define SF_BA_IDLE_TIMER_DEF 160 /* 150 uSec */
1427#define SF_BA_AGING_TIMER_DEF 400 /* 0.4 mSec */
1428#define SF_TX_RE_IDLE_TIMER_DEF 160 /* 150 uSec */
1429#define SF_TX_RE_AGING_TIMER_DEF 400 /* 0.4 mSec */
1430
1431/* SF Scenarios timers for BSS MAC configuration (aligned to 32 uSec) */
1f3b0ff8
LE
1432#define SF_SINGLE_UNICAST_IDLE_TIMER 320 /* 300 uSec */
1433#define SF_SINGLE_UNICAST_AGING_TIMER 2016 /* 2 mSec */
1434#define SF_AGG_UNICAST_IDLE_TIMER 320 /* 300 uSec */
1435#define SF_AGG_UNICAST_AGING_TIMER 2016 /* 2 mSec */
1436#define SF_MCAST_IDLE_TIMER 2016 /* 2 mSec */
1437#define SF_MCAST_AGING_TIMER 10016 /* 10 mSec */
1438#define SF_BA_IDLE_TIMER 320 /* 300 uSec */
1439#define SF_BA_AGING_TIMER 2016 /* 2 mSec */
1440#define SF_TX_RE_IDLE_TIMER 320 /* 300 uSec */
1441#define SF_TX_RE_AGING_TIMER 2016 /* 2 mSec */
1442
1443#define SF_LONG_DELAY_AGING_TIMER 1000000 /* 1 Sec */
1444
161bdb77
EH
1445#define SF_CFG_DUMMY_NOTIF_OFF BIT(16)
1446
1f3b0ff8
LE
1447/**
1448 * Smart Fifo configuration command.
86974bff 1449 * @state: smart fifo state, types listed in enum %iwl_sf_sate.
1f3b0ff8
LE
1450 * @watermark: Minimum allowed availabe free space in RXF for transient state.
1451 * @long_delay_timeouts: aging and idle timer values for each scenario
1452 * in long delay state.
1453 * @full_on_timeouts: timer values for each scenario in full on state.
1454 */
1455struct iwl_sf_cfg_cmd {
86974bff 1456 __le32 state;
1f3b0ff8
LE
1457 __le32 watermark[SF_TRANSIENT_STATES_NUMBER];
1458 __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1459 __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1460} __packed; /* SF_CFG_API_S_VER_2 */
1461
8ba2d7a1
EH
1462/***********************************
1463 * Location Aware Regulatory (LAR) API - MCC updates
1464 ***********************************/
1465
6fa52430
MG
1466/**
1467 * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
1468 * regulatory profile according to the given MCC (Mobile Country Code).
1469 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
1470 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
1471 * MCC in the cmd response will be the relevant MCC in the NVM.
1472 * @mcc: given mobile country code
1473 * @source_id: the source from where we got the MCC, see iwl_mcc_source
1474 * @reserved: reserved for alignment
1475 */
1476struct iwl_mcc_update_cmd_v1 {
1477 __le16 mcc;
1478 u8 source_id;
1479 u8 reserved;
1480} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
1481
8ba2d7a1
EH
1482/**
1483 * struct iwl_mcc_update_cmd - Request the device to update geographic
1484 * regulatory profile according to the given MCC (Mobile Country Code).
1485 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
1486 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
1487 * MCC in the cmd response will be the relevant MCC in the NVM.
1488 * @mcc: given mobile country code
1489 * @source_id: the source from where we got the MCC, see iwl_mcc_source
1490 * @reserved: reserved for alignment
6fa52430
MG
1491 * @key: integrity key for MCC API OEM testing
1492 * @reserved2: reserved
8ba2d7a1
EH
1493 */
1494struct iwl_mcc_update_cmd {
1495 __le16 mcc;
1496 u8 source_id;
1497 u8 reserved;
6fa52430
MG
1498 __le32 key;
1499 __le32 reserved2[5];
1500} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
1501
1502/**
1503 * iwl_mcc_update_resp_v1 - response to MCC_UPDATE_CMD.
1504 * Contains the new channel control profile map, if changed, and the new MCC
1505 * (mobile country code).
1506 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
1507 * @status: see &enum iwl_mcc_update_status
1508 * @mcc: the new applied MCC
1509 * @cap: capabilities for all channels which matches the MCC
1510 * @source_id: the MCC source, see iwl_mcc_source
1511 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
1512 * channels, depending on platform)
1513 * @channels: channel control data map, DWORD for each channel. Only the first
1514 * 16bits are used.
1515 */
1516struct iwl_mcc_update_resp_v1 {
1517 __le32 status;
1518 __le16 mcc;
1519 u8 cap;
1520 u8 source_id;
1521 __le32 n_channels;
1522 __le32 channels[0];
1523} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
8ba2d7a1
EH
1524
1525/**
1526 * iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
1527 * Contains the new channel control profile map, if changed, and the new MCC
1528 * (mobile country code).
1529 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
47c8b154 1530 * @status: see &enum iwl_mcc_update_status
8ba2d7a1
EH
1531 * @mcc: the new applied MCC
1532 * @cap: capabilities for all channels which matches the MCC
1533 * @source_id: the MCC source, see iwl_mcc_source
6fa52430
MG
1534 * @time: time elapsed from the MCC test start (in 30 seconds TU)
1535 * @reserved: reserved.
8ba2d7a1
EH
1536 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
1537 * channels, depending on platform)
1538 * @channels: channel control data map, DWORD for each channel. Only the first
1539 * 16bits are used.
1540 */
1541struct iwl_mcc_update_resp {
1542 __le32 status;
1543 __le16 mcc;
1544 u8 cap;
1545 u8 source_id;
6fa52430
MG
1546 __le16 time;
1547 __le16 reserved;
8ba2d7a1
EH
1548 __le32 n_channels;
1549 __le32 channels[0];
6fa52430 1550} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
8ba2d7a1
EH
1551
1552/**
1553 * struct iwl_mcc_chub_notif - chub notifies of mcc change
1554 * (MCC_CHUB_UPDATE_CMD = 0xc9)
1555 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
1556 * the cellular and connectivity cores that gets updates of the mcc, and
1557 * notifies the ucode directly of any mcc change.
1558 * The ucode requests the driver to request the device to update geographic
1559 * regulatory profile according to the given MCC (Mobile Country Code).
1560 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
1561 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
1562 * MCC in the cmd response will be the relevant MCC in the NVM.
1563 * @mcc: given mobile country code
1564 * @source_id: identity of the change originator, see iwl_mcc_source
1565 * @reserved1: reserved for alignment
1566 */
1567struct iwl_mcc_chub_notif {
1568 u16 mcc;
1569 u8 source_id;
1570 u8 reserved1;
1571} __packed; /* LAR_MCC_NOTIFY_S */
1572
1573enum iwl_mcc_update_status {
1574 MCC_RESP_NEW_CHAN_PROFILE,
1575 MCC_RESP_SAME_CHAN_PROFILE,
1576 MCC_RESP_INVALID,
1577 MCC_RESP_NVM_DISABLED,
1578 MCC_RESP_ILLEGAL,
1579 MCC_RESP_LOW_PRIORITY,
6fa52430
MG
1580 MCC_RESP_TEST_MODE_ACTIVE,
1581 MCC_RESP_TEST_MODE_NOT_ACTIVE,
1582 MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
8ba2d7a1
EH
1583};
1584
1585enum iwl_mcc_source {
1586 MCC_SOURCE_OLD_FW = 0,
1587 MCC_SOURCE_ME = 1,
1588 MCC_SOURCE_BIOS = 2,
1589 MCC_SOURCE_3G_LTE_HOST = 3,
1590 MCC_SOURCE_3G_LTE_DEVICE = 4,
1591 MCC_SOURCE_WIFI = 5,
1592 MCC_SOURCE_RESERVED = 6,
1593 MCC_SOURCE_DEFAULT = 7,
1594 MCC_SOURCE_UNINITIALIZED = 8,
6fa52430
MG
1595 MCC_SOURCE_MCC_API = 9,
1596 MCC_SOURCE_GET_CURRENT = 0x10,
1597 MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
8ba2d7a1
EH
1598};
1599
a0a09243
LC
1600/* DTS measurements */
1601
1602enum iwl_dts_measurement_flags {
1603 DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0),
1604 DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1),
1605};
1606
1607/**
1608 * iwl_dts_measurement_cmd - request DTS temperature and/or voltage measurements
1609 *
1610 * @flags: indicates which measurements we want as specified in &enum
1611 * iwl_dts_measurement_flags
1612 */
1613struct iwl_dts_measurement_cmd {
1614 __le32 flags;
1615} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
1616
78efc702
AN
1617/**
1618* enum iwl_dts_control_measurement_mode - DTS measurement type
1619* @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
1620* back (latest value. Not waiting for new value). Use automatic
1621* SW DTS configuration.
1622* @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
1623* trigger DTS reading and provide read back temperature read
1624* when available.
1625* @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
1626* @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
1627* without measurement trigger.
1628*/
1629enum iwl_dts_control_measurement_mode {
1630 DTS_AUTOMATIC = 0,
1631 DTS_REQUEST_READ = 1,
1632 DTS_OVER_WRITE = 2,
1633 DTS_DIRECT_WITHOUT_MEASURE = 3,
1634};
1635
1636/**
1637* enum iwl_dts_used - DTS to use or used for measurement in the DTS request
1638* @DTS_USE_TOP: Top
1639* @DTS_USE_CHAIN_A: chain A
1640* @DTS_USE_CHAIN_B: chain B
1641* @DTS_USE_CHAIN_C: chain C
1642* @XTAL_TEMPERATURE - read temperature from xtal
1643*/
1644enum iwl_dts_used {
1645 DTS_USE_TOP = 0,
1646 DTS_USE_CHAIN_A = 1,
1647 DTS_USE_CHAIN_B = 2,
1648 DTS_USE_CHAIN_C = 3,
1649 XTAL_TEMPERATURE = 4,
1650};
1651
1652/**
1653* enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
1654* @DTS_BIT6_MODE: bit 6 mode
1655* @DTS_BIT8_MODE: bit 8 mode
1656*/
1657enum iwl_dts_bit_mode {
1658 DTS_BIT6_MODE = 0,
1659 DTS_BIT8_MODE = 1,
1660};
1661
1662/**
1663 * iwl_ext_dts_measurement_cmd - request extended DTS temperature measurements
1664 * @control_mode: see &enum iwl_dts_control_measurement_mode
1665 * @temperature: used when over write DTS mode is selected
1666 * @sensor: set temperature sensor to use. See &enum iwl_dts_used
1667 * @avg_factor: average factor to DTS in request DTS read mode
1668 * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
1669 * @step_duration: step duration for the DTS
1670 */
1671struct iwl_ext_dts_measurement_cmd {
1672 __le32 control_mode;
1673 __le32 temperature;
1674 __le32 sensor;
1675 __le32 avg_factor;
1676 __le32 bit_mode;
1677 __le32 step_duration;
1678} __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */
1679
a0a09243 1680/**
c221daf2 1681 * struct iwl_dts_measurement_notif_v1 - measurements notification
a0a09243
LC
1682 *
1683 * @temp: the measured temperature
1684 * @voltage: the measured voltage
1685 */
c221daf2 1686struct iwl_dts_measurement_notif_v1 {
a0a09243
LC
1687 __le32 temp;
1688 __le32 voltage;
c221daf2
CRI
1689} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
1690
1691/**
1692 * struct iwl_dts_measurement_notif_v2 - measurements notification
1693 *
1694 * @temp: the measured temperature
1695 * @voltage: the measured voltage
1696 * @threshold_idx: the trip index that was crossed
1697 */
1698struct iwl_dts_measurement_notif_v2 {
1699 __le32 temp;
1700 __le32 voltage;
1701 __le32 threshold_idx;
1702} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
a0a09243 1703
0a3b7119
CRI
1704/**
1705 * struct ct_kill_notif - CT-kill entry notification
1706 *
1707 * @temperature: the current temperature in celsius
1708 * @reserved: reserved
1709 */
1710struct ct_kill_notif {
1711 __le16 temperature;
1712 __le16 reserved;
1713} __packed; /* GRP_PHY_CT_KILL_NTF */
1714
5c89e7bc
CRI
1715/**
1716* enum ctdp_cmd_operation - CTDP command operations
1717* @CTDP_CMD_OPERATION_START: update the current budget
1718* @CTDP_CMD_OPERATION_STOP: stop ctdp
1719* @CTDP_CMD_OPERATION_REPORT: get the avgerage budget
1720*/
1721enum iwl_mvm_ctdp_cmd_operation {
1722 CTDP_CMD_OPERATION_START = 0x1,
1723 CTDP_CMD_OPERATION_STOP = 0x2,
1724 CTDP_CMD_OPERATION_REPORT = 0x4,
1725};/* CTDP_CMD_OPERATION_TYPE_E */
1726
1727/**
1728 * struct iwl_mvm_ctdp_cmd - track and manage the FW power consumption budget
1729 *
1730 * @operation: see &enum iwl_mvm_ctdp_cmd_operation
1731 * @budget: the budget in milliwatt
1732 * @window_size: defined in API but not used
1733 */
1734struct iwl_mvm_ctdp_cmd {
1735 __le32 operation;
1736 __le32 budget;
1737 __le32 window_size;
1738} __packed;
1739
c221daf2
CRI
1740#define IWL_MAX_DTS_TRIPS 8
1741
1742/**
1743 * struct iwl_temp_report_ths_cmd - set temperature thresholds
1744 *
1745 * @num_temps: number of temperature thresholds passed
1746 * @thresholds: array with the thresholds to be configured
1747 */
1748struct temp_report_ths_cmd {
1749 __le32 num_temps;
1750 __le16 thresholds[IWL_MAX_DTS_TRIPS];
1751} __packed; /* GRP_PHY_TEMP_REPORTING_THRESHOLDS_CMD */
1752
77c5d7ef
AN
1753/***********************************
1754 * TDLS API
1755 ***********************************/
1756
1757/* Type of TDLS request */
1758enum iwl_tdls_channel_switch_type {
1759 TDLS_SEND_CHAN_SW_REQ = 0,
1760 TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
1761 TDLS_MOVE_CH,
1762}; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */
1763
1764/**
1765 * Switch timing sub-element in a TDLS channel-switch command
1766 * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
1767 * received from peer
1768 * @max_offchan_duration: What amount of microseconds out of a DTIM is given
1769 * to the TDLS off-channel communication. For instance if the DTIM is
1770 * 200TU and the TDLS peer is to be given 25% of the time, the value
1771 * given will be 50TU, or 50 * 1024 if translated into microseconds.
1772 * @switch_time: switch time the peer sent in its channel switch timing IE
1773 * @switch_timout: switch timeout the peer sent in its channel switch timing IE
1774 */
1775struct iwl_tdls_channel_switch_timing {
1776 __le32 frame_timestamp; /* GP2 time of peer packet Rx */
1777 __le32 max_offchan_duration; /* given in micro-seconds */
1778 __le32 switch_time; /* given in micro-seconds */
1779 __le32 switch_timeout; /* given in micro-seconds */
1780} __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */
1781
1782#define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200
1783
1784/**
1785 * TDLS channel switch frame template
1786 *
1787 * A template representing a TDLS channel-switch request or response frame
1788 *
1789 * @switch_time_offset: offset to the channel switch timing IE in the template
1790 * @tx_cmd: Tx parameters for the frame
1791 * @data: frame data
1792 */
1793struct iwl_tdls_channel_switch_frame {
1794 __le32 switch_time_offset;
1795 struct iwl_tx_cmd tx_cmd;
1796 u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
1797} __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
1798
1799/**
1800 * TDLS channel switch command
1801 *
1802 * The command is sent to initiate a channel switch and also in response to
1803 * incoming TDLS channel-switch request/response packets from remote peers.
1804 *
1805 * @switch_type: see &enum iwl_tdls_channel_switch_type
1806 * @peer_sta_id: station id of TDLS peer
1807 * @ci: channel we switch to
1808 * @timing: timing related data for command
1809 * @frame: channel-switch request/response template, depending to switch_type
1810 */
1811struct iwl_tdls_channel_switch_cmd {
1812 u8 switch_type;
1813 __le32 peer_sta_id;
1814 struct iwl_fw_channel_info ci;
1815 struct iwl_tdls_channel_switch_timing timing;
1816 struct iwl_tdls_channel_switch_frame frame;
1817} __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
1818
1819/**
1820 * TDLS channel switch start notification
1821 *
1822 * @status: non-zero on success
1823 * @offchannel_duration: duration given in microseconds
1824 * @sta_id: peer currently performing the channel-switch with
1825 */
1826struct iwl_tdls_channel_switch_notif {
1827 __le32 status;
1828 __le32 offchannel_duration;
1829 __le32 sta_id;
1830} __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */
1831
307e4723
AN
1832/**
1833 * TDLS station info
1834 *
1835 * @sta_id: station id of the TDLS peer
1836 * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
1837 * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
1838 * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
1839 */
1840struct iwl_tdls_sta_info {
1841 u8 sta_id;
1842 u8 tx_to_peer_tid;
1843 __le16 tx_to_peer_ssn;
1844 __le32 is_initiator;
1845} __packed; /* TDLS_STA_INFO_VER_1 */
1846
1847/**
1848 * TDLS basic config command
1849 *
1850 * @id_and_color: MAC id and color being configured
1851 * @tdls_peer_count: amount of currently connected TDLS peers
1852 * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
1853 * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
1854 * @sta_info: per-station info. Only the first tdls_peer_count entries are set
1855 * @pti_req_data_offset: offset of network-level data for the PTI template
1856 * @pti_req_tx_cmd: Tx parameters for PTI request template
1857 * @pti_req_template: PTI request template data
1858 */
1859struct iwl_tdls_config_cmd {
1860 __le32 id_and_color; /* mac id and color */
1861 u8 tdls_peer_count;
1862 u8 tx_to_ap_tid;
1863 __le16 tx_to_ap_ssn;
1864 struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];
1865
1866 __le32 pti_req_data_offset;
1867 struct iwl_tx_cmd pti_req_tx_cmd;
1868 u8 pti_req_template[0];
1869} __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */
1870
1871/**
1872 * TDLS per-station config information from FW
1873 *
1874 * @sta_id: station id of the TDLS peer
1875 * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
1876 * the peer
1877 */
1878struct iwl_tdls_config_sta_info_res {
1879 __le16 sta_id;
1880 __le16 tx_to_peer_last_seq;
1881} __packed; /* TDLS_STA_INFO_RSP_VER_1 */
1882
1883/**
1884 * TDLS config information from FW
1885 *
1886 * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
1887 * @sta_info: per-station TDLS config information
1888 */
1889struct iwl_tdls_config_res {
1890 __le32 tx_to_ap_last_seq;
1891 struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
1892} __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */
1893
04fd2c28
LK
1894#define TX_FIFO_MAX_NUM 8
1895#define RX_FIFO_MAX_NUM 2
1896
1897/**
1898 * Shared memory configuration information from the FW
1899 *
1900 * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
1901 * accessible)
1902 * @shared_mem_size: shared memory size
1903 * @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to
1904 * 0x0 as accessible only via DBGM RDAT)
1905 * @sample_buff_size: internal sample buff size
1906 * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre
1907 * 8000 HW set to 0x0 as not accessible)
1908 * @txfifo_size: size of TXF0 ... TXF7
1909 * @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0
1910 * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
1911 * when paging is not supported this should be 0
1912 * @page_buff_size: size of %page_buff_addr
1913 */
1914struct iwl_shared_mem_cfg {
1915 __le32 shared_mem_addr;
1916 __le32 shared_mem_size;
1917 __le32 sample_buff_addr;
1918 __le32 sample_buff_size;
1919 __le32 txfifo_addr;
1920 __le32 txfifo_size[TX_FIFO_MAX_NUM];
1921 __le32 rxfifo_size[RX_FIFO_MAX_NUM];
1922 __le32 page_buff_addr;
1923 __le32 page_buff_size;
1924} __packed; /* SHARED_MEM_ALLOC_API_S_VER_1 */
1925
0db056d3
SS
1926#define MAX_STORED_BEACON_SIZE 600
1927
1928/**
1929 * Stored beacon notification
1930 *
1931 * @system_time: system time on air rise
1932 * @tsf: TSF on air rise
1933 * @beacon_timestamp: beacon on air rise
1934 * @phy_flags: general phy flags: band, modulation, etc.
1935 * @channel: channel this beacon was received on
1936 * @rates: rate in ucode internal format
1937 * @byte_count: frame's byte count
1938 */
1939struct iwl_stored_beacon_notif {
1940 __le32 system_time;
1941 __le64 tsf;
1942 __le32 beacon_timestamp;
1943 __le16 phy_flags;
1944 __le16 channel;
1945 __le32 rates;
1946 __le32 byte_count;
1947 u8 data[MAX_STORED_BEACON_SIZE];
1948} __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_1 */
1949
8ca151b5 1950#endif /* __fw_api_h__ */