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