blob: 995898c5d017f20a7b62123860c7211ee9f64a5e [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:
Emmanuel Grumbachcb2f8272015-11-17 15:39:56 +020029 * Intel Linux Wireless <linuxwifi@intel.com>
Johannes Berg8ca151b2013-01-24 14:25:36 +010030 * 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,
Johannes Berg13555e82015-09-02 16:16:49 +0200216 FRAME_RELEASE = 0xc3,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100217 BA_NOTIF = 0xc5,
218
Arik Nemtsovdcaf9f52014-03-04 19:54:12 +0200219 /* Location Aware Regulatory */
220 MCC_UPDATE_CMD = 0xc8,
Arik Nemtsov88931cc2014-03-05 12:26:15 +0200221 MCC_CHUB_UPDATE_CMD = 0xc9,
Arik Nemtsovdcaf9f52014-03-04 19:54:12 +0200222
Matti Gottlieba2d79c52014-08-25 14:41:23 +0300223 MARKER_CMD = 0xcb,
224
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200225 /* BT Coex */
226 BT_COEX_PRIO_TABLE = 0xcc,
227 BT_COEX_PROT_ENV = 0xcd,
228 BT_PROFILE_NOTIFICATION = 0xce,
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300229 BT_CONFIG = 0x9b,
230 BT_COEX_UPDATE_SW_BOOST = 0x5a,
231 BT_COEX_UPDATE_CORUN_LUT = 0x5b,
232 BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300233 BT_COEX_CI = 0x5d,
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200234
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +0200235 REPLY_SF_CFG_CMD = 0xd1,
Hila Gonen7df15b12012-12-12 11:16:19 +0200236 REPLY_BEACON_FILTERING_CMD = 0xd2,
237
Luciano Coelhoa0a09242014-09-04 12:29:15 +0300238 /* DTS measurements */
239 CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
240 DTS_MEASUREMENT_NOTIFICATION = 0xdd,
241
Johannes Berg8ca151b2013-01-24 14:25:36 +0100242 REPLY_DEBUG_CMD = 0xf0,
Golan Ben Ami321c2102015-07-27 17:02:35 +0300243 LDBG_CONFIG_CMD = 0xf6,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100244 DEBUG_LOG_MSG = 0xf7,
245
Eliad Pellerc87163b2014-01-08 10:11:11 +0200246 BCAST_FILTER_CMD = 0xcf,
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +0300247 MCAST_FILTER_CMD = 0xd0,
248
Johannes Berg8ca151b2013-01-24 14:25:36 +0100249 /* D3 commands/notifications */
250 D3_CONFIG_CMD = 0xd3,
251 PROT_OFFLOAD_CONFIG_CMD = 0xd4,
252 OFFLOADS_QUERY_CMD = 0xd5,
253 REMOTE_WAKE_CONFIG_CMD = 0xd6,
Arik Nemtsov98ee7782013-10-02 16:58:09 +0300254 D0I3_END_CMD = 0xed,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100255
256 /* for WoWLAN in particular */
257 WOWLAN_PATTERNS = 0xe0,
258 WOWLAN_CONFIGURATION = 0xe1,
259 WOWLAN_TSC_RSC_PARAM = 0xe2,
260 WOWLAN_TKIP_PARAM = 0xe3,
261 WOWLAN_KEK_KCK_MATERIAL = 0xe4,
262 WOWLAN_GET_STATUSES = 0xe5,
263 WOWLAN_TX_POWER_PER_DB = 0xe6,
264
265 /* and for NetDetect */
Luciano Coelhob04998f2014-11-20 15:58:34 +0200266 SCAN_OFFLOAD_PROFILES_QUERY_CMD = 0x56,
267 SCAN_OFFLOAD_HOTSPOTS_CONFIG_CMD = 0x58,
268 SCAN_OFFLOAD_HOTSPOTS_QUERY_CMD = 0x59,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100269
270 REPLY_MAX = 0xff,
271};
272
Sharon Dvir39bdb172015-10-15 18:18:09 +0300273/* Please keep this enum *SORTED* by hex value.
274 * Needed for binary search, otherwise a warning will be triggered.
275 */
Aviya Erenfeld09eef332015-09-01 19:34:38 +0300276enum iwl_phy_ops_subcmd_ids {
277 CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
278 DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
279};
280
281/* command groups */
282enum {
Sharon Dvir39bdb172015-10-15 18:18:09 +0300283 LEGACY_GROUP = 0x0,
284 LONG_GROUP = 0x1,
Aviya Erenfeld09eef332015-09-01 19:34:38 +0300285 PHY_OPS_GROUP = 0x4,
286};
287
Johannes Berg8ca151b2013-01-24 14:25:36 +0100288/**
289 * struct iwl_cmd_response - generic response struct for most commands
290 * @status: status of the command asked, changes for each one
291 */
292struct iwl_cmd_response {
293 __le32 status;
294};
295
296/*
297 * struct iwl_tx_ant_cfg_cmd
298 * @valid: valid antenna configuration
299 */
300struct iwl_tx_ant_cfg_cmd {
301 __le32 valid;
302} __packed;
303
304/*
305 * Calibration control struct.
306 * Sent as part of the phy configuration command.
307 * @flow_trigger: bitmap for which calibrations to perform according to
308 * flow triggers.
309 * @event_trigger: bitmap for which calibrations to perform according to
310 * event triggers.
311 */
312struct iwl_calib_ctrl {
313 __le32 flow_trigger;
314 __le32 event_trigger;
315} __packed;
316
317/* This enum defines the bitmap of various calibrations to enable in both
318 * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
319 */
320enum iwl_calib_cfg {
321 IWL_CALIB_CFG_XTAL_IDX = BIT(0),
322 IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
323 IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
324 IWL_CALIB_CFG_PAPD_IDX = BIT(3),
325 IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
326 IWL_CALIB_CFG_DC_IDX = BIT(5),
327 IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
328 IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
329 IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
330 IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
331 IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
332 IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
333 IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
334 IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
335 IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
336 IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
337 IWL_CALIB_CFG_DAC_IDX = BIT(16),
338 IWL_CALIB_CFG_ABS_IDX = BIT(17),
339 IWL_CALIB_CFG_AGC_IDX = BIT(18),
340};
341
342/*
343 * Phy configuration command.
344 */
345struct iwl_phy_cfg_cmd {
346 __le32 phy_cfg;
347 struct iwl_calib_ctrl calib_control;
348} __packed;
349
350#define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
351#define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
352#define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
353#define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
354#define PHY_CFG_TX_CHAIN_A BIT(8)
355#define PHY_CFG_TX_CHAIN_B BIT(9)
356#define PHY_CFG_TX_CHAIN_C BIT(10)
357#define PHY_CFG_RX_CHAIN_A BIT(12)
358#define PHY_CFG_RX_CHAIN_B BIT(13)
359#define PHY_CFG_RX_CHAIN_C BIT(14)
360
361
362/* Target of the NVM_ACCESS_CMD */
363enum {
364 NVM_ACCESS_TARGET_CACHE = 0,
365 NVM_ACCESS_TARGET_OTP = 1,
366 NVM_ACCESS_TARGET_EEPROM = 2,
367};
368
Emmanuel Grumbachb9545b42013-03-06 11:34:44 +0200369/* Section types for NVM_ACCESS_CMD */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100370enum {
Eran Hararyae2b21b2014-01-09 08:08:24 +0200371 NVM_SECTION_TYPE_SW = 1,
Eran Harary77db0a32014-02-04 14:21:38 +0200372 NVM_SECTION_TYPE_REGULATORY = 3,
Eran Hararyae2b21b2014-01-09 08:08:24 +0200373 NVM_SECTION_TYPE_CALIBRATION = 4,
374 NVM_SECTION_TYPE_PRODUCTION = 5,
Eran Harary77db0a32014-02-04 14:21:38 +0200375 NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
Eran Hararyce500072014-12-01 17:53:53 +0200376 NVM_SECTION_TYPE_PHY_SKU = 12,
377 NVM_MAX_NUM_SECTIONS = 13,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100378};
379
380/**
381 * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
382 * @op_code: 0 - read, 1 - write
383 * @target: NVM_ACCESS_TARGET_*
384 * @type: NVM_SECTION_TYPE_*
385 * @offset: offset in bytes into the section
386 * @length: in bytes, to read/write
387 * @data: if write operation, the data to write. On read its empty
388 */
Emmanuel Grumbachb9545b42013-03-06 11:34:44 +0200389struct iwl_nvm_access_cmd {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100390 u8 op_code;
391 u8 target;
392 __le16 type;
393 __le16 offset;
394 __le16 length;
395 u8 data[];
396} __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
397
Matti Gottlieba6c4fb42015-07-15 16:19:29 +0300398#define NUM_OF_FW_PAGING_BLOCKS 33 /* 32 for data and 1 block for CSS */
399
400/*
401 * struct iwl_fw_paging_cmd - paging layout
402 *
403 * (FW_PAGING_BLOCK_CMD = 0x4f)
404 *
405 * Send to FW the paging layout in the driver.
406 *
407 * @flags: various flags for the command
408 * @block_size: the block size in powers of 2
409 * @block_num: number of blocks specified in the command.
410 * @device_phy_addr: virtual addresses from device side
411*/
412struct iwl_fw_paging_cmd {
413 __le32 flags;
414 __le32 block_size;
415 __le32 block_num;
416 __le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
417} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */
418
Matti Gottliebe1120182015-07-19 11:15:07 +0300419/*
420 * Fw items ID's
421 *
422 * @IWL_FW_ITEM_ID_PAGING: Address of the pages that the FW will upload
423 * download
424 */
425enum iwl_fw_item_id {
426 IWL_FW_ITEM_ID_PAGING = 3,
427};
428
429/*
430 * struct iwl_fw_get_item_cmd - get an item from the fw
431 */
432struct iwl_fw_get_item_cmd {
433 __le32 item_id;
434} __packed; /* FW_GET_ITEM_CMD_API_S_VER_1 */
435
Golan Ben Ami321c2102015-07-27 17:02:35 +0300436#define CONT_REC_COMMAND_SIZE 80
437#define ENABLE_CONT_RECORDING 0x15
438#define DISABLE_CONT_RECORDING 0x16
439
440/*
441 * struct iwl_continuous_record_mode - recording mode
442 */
443struct iwl_continuous_record_mode {
444 __le16 enable_recording;
445} __packed;
446
447/*
448 * struct iwl_continuous_record_cmd - enable/disable continuous recording
449 */
450struct iwl_continuous_record_cmd {
451 struct iwl_continuous_record_mode record_mode;
452 u8 pad[CONT_REC_COMMAND_SIZE -
453 sizeof(struct iwl_continuous_record_mode)];
454} __packed;
455
Matti Gottliebe1120182015-07-19 11:15:07 +0300456struct iwl_fw_get_item_resp {
457 __le32 item_id;
458 __le32 item_byte_cnt;
459 __le32 item_val;
460} __packed; /* FW_GET_ITEM_RSP_S_VER_1 */
461
Johannes Berg8ca151b2013-01-24 14:25:36 +0100462/**
463 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
464 * @offset: offset in bytes into the section
465 * @length: in bytes, either how much was written or read
466 * @type: NVM_SECTION_TYPE_*
467 * @status: 0 for success, fail otherwise
468 * @data: if read operation, the data returned. Empty on write.
469 */
Emmanuel Grumbachb9545b42013-03-06 11:34:44 +0200470struct iwl_nvm_access_resp {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100471 __le16 offset;
472 __le16 length;
473 __le16 type;
474 __le16 status;
475 u8 data[];
476} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
477
478/* MVM_ALIVE 0x1 */
479
480/* alive response is_valid values */
481#define ALIVE_RESP_UCODE_OK BIT(0)
482#define ALIVE_RESP_RFKILL BIT(1)
483
484/* alive response ver_type values */
485enum {
486 FW_TYPE_HW = 0,
487 FW_TYPE_PROT = 1,
488 FW_TYPE_AP = 2,
489 FW_TYPE_WOWLAN = 3,
490 FW_TYPE_TIMING = 4,
491 FW_TYPE_WIPAN = 5
492};
493
494/* alive response ver_subtype values */
495enum {
496 FW_SUBTYPE_FULL_FEATURE = 0,
497 FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
498 FW_SUBTYPE_REDUCED = 2,
499 FW_SUBTYPE_ALIVE_ONLY = 3,
500 FW_SUBTYPE_WOWLAN = 4,
501 FW_SUBTYPE_AP_SUBTYPE = 5,
502 FW_SUBTYPE_WIPAN = 6,
503 FW_SUBTYPE_INITIALIZE = 9
504};
505
506#define IWL_ALIVE_STATUS_ERR 0xDEAD
507#define IWL_ALIVE_STATUS_OK 0xCAFE
508
509#define IWL_ALIVE_FLG_RFKILL BIT(0)
510
Emmanuel Grumbach7e1223b2015-02-03 20:11:48 +0200511struct mvm_alive_resp_ver1 {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100512 __le16 status;
513 __le16 flags;
514 u8 ucode_minor;
515 u8 ucode_major;
516 __le16 id;
517 u8 api_minor;
518 u8 api_major;
519 u8 ver_subtype;
520 u8 ver_type;
521 u8 mac;
522 u8 opt;
523 __le16 reserved2;
524 __le32 timestamp;
525 __le32 error_event_table_ptr; /* SRAM address for error log */
526 __le32 log_event_table_ptr; /* SRAM address for event log */
527 __le32 cpu_register_ptr;
528 __le32 dbgm_config_ptr;
529 __le32 alive_counter_ptr;
530 __le32 scd_base_ptr; /* SRAM address for SCD */
531} __packed; /* ALIVE_RES_API_S_VER_1 */
532
Eran Harary01a9ca52014-02-03 09:29:57 +0200533struct mvm_alive_resp_ver2 {
534 __le16 status;
535 __le16 flags;
536 u8 ucode_minor;
537 u8 ucode_major;
538 __le16 id;
539 u8 api_minor;
540 u8 api_major;
541 u8 ver_subtype;
542 u8 ver_type;
543 u8 mac;
544 u8 opt;
545 __le16 reserved2;
546 __le32 timestamp;
547 __le32 error_event_table_ptr; /* SRAM address for error log */
548 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
549 __le32 cpu_register_ptr;
550 __le32 dbgm_config_ptr;
551 __le32 alive_counter_ptr;
552 __le32 scd_base_ptr; /* SRAM address for SCD */
553 __le32 st_fwrd_addr; /* pointer to Store and forward */
554 __le32 st_fwrd_size;
555 u8 umac_minor; /* UMAC version: minor */
556 u8 umac_major; /* UMAC version: major */
557 __le16 umac_id; /* UMAC version: id */
558 __le32 error_info_addr; /* SRAM address for UMAC error log */
559 __le32 dbg_print_buff_addr;
560} __packed; /* ALIVE_RES_API_S_VER_2 */
561
Emmanuel Grumbach7e1223b2015-02-03 20:11:48 +0200562struct mvm_alive_resp {
563 __le16 status;
564 __le16 flags;
565 __le32 ucode_minor;
566 __le32 ucode_major;
567 u8 ver_subtype;
568 u8 ver_type;
569 u8 mac;
570 u8 opt;
571 __le32 timestamp;
572 __le32 error_event_table_ptr; /* SRAM address for error log */
573 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
574 __le32 cpu_register_ptr;
575 __le32 dbgm_config_ptr;
576 __le32 alive_counter_ptr;
577 __le32 scd_base_ptr; /* SRAM address for SCD */
578 __le32 st_fwrd_addr; /* pointer to Store and forward */
579 __le32 st_fwrd_size;
580 __le32 umac_minor; /* UMAC version: minor */
581 __le32 umac_major; /* UMAC version: major */
582 __le32 error_info_addr; /* SRAM address for UMAC error log */
583 __le32 dbg_print_buff_addr;
584} __packed; /* ALIVE_RES_API_S_VER_3 */
585
Johannes Berg8ca151b2013-01-24 14:25:36 +0100586/* Error response/notification */
587enum {
588 FW_ERR_UNKNOWN_CMD = 0x0,
589 FW_ERR_INVALID_CMD_PARAM = 0x1,
590 FW_ERR_SERVICE = 0x2,
591 FW_ERR_ARC_MEMORY = 0x3,
592 FW_ERR_ARC_CODE = 0x4,
593 FW_ERR_WATCH_DOG = 0x5,
594 FW_ERR_WEP_GRP_KEY_INDX = 0x10,
595 FW_ERR_WEP_KEY_SIZE = 0x11,
596 FW_ERR_OBSOLETE_FUNC = 0x12,
597 FW_ERR_UNEXPECTED = 0xFE,
598 FW_ERR_FATAL = 0xFF
599};
600
601/**
602 * struct iwl_error_resp - FW error indication
603 * ( REPLY_ERROR = 0x2 )
604 * @error_type: one of FW_ERR_*
605 * @cmd_id: the command ID for which the error occured
606 * @bad_cmd_seq_num: sequence number of the erroneous command
607 * @error_service: which service created the error, applicable only if
608 * error_type = 2, otherwise 0
609 * @timestamp: TSF in usecs.
610 */
611struct iwl_error_resp {
612 __le32 error_type;
613 u8 cmd_id;
614 u8 reserved1;
615 __le16 bad_cmd_seq_num;
616 __le32 error_service;
617 __le64 timestamp;
618} __packed;
619
620
621/* Common PHY, MAC and Bindings definitions */
622
623#define MAX_MACS_IN_BINDING (3)
624#define MAX_BINDINGS (4)
625#define AUX_BINDING_INDEX (3)
626#define MAX_PHYS (4)
627
628/* Used to extract ID and color from the context dword */
629#define FW_CTXT_ID_POS (0)
630#define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
631#define FW_CTXT_COLOR_POS (8)
632#define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
633#define FW_CTXT_INVALID (0xffffffff)
634
635#define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
636 (_color << FW_CTXT_COLOR_POS))
637
638/* Possible actions on PHYs, MACs and Bindings */
639enum {
640 FW_CTXT_ACTION_STUB = 0,
641 FW_CTXT_ACTION_ADD,
642 FW_CTXT_ACTION_MODIFY,
643 FW_CTXT_ACTION_REMOVE,
644 FW_CTXT_ACTION_NUM
645}; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
646
647/* Time Events */
648
649/* Time Event types, according to MAC type */
650enum iwl_time_event_type {
651 /* BSS Station Events */
652 TE_BSS_STA_AGGRESSIVE_ASSOC,
653 TE_BSS_STA_ASSOC,
654 TE_BSS_EAP_DHCP_PROT,
655 TE_BSS_QUIET_PERIOD,
656
657 /* P2P Device Events */
658 TE_P2P_DEVICE_DISCOVERABLE,
659 TE_P2P_DEVICE_LISTEN,
660 TE_P2P_DEVICE_ACTION_SCAN,
661 TE_P2P_DEVICE_FULL_SCAN,
662
663 /* P2P Client Events */
664 TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
665 TE_P2P_CLIENT_ASSOC,
666 TE_P2P_CLIENT_QUIET_PERIOD,
667
668 /* P2P GO Events */
669 TE_P2P_GO_ASSOC_PROT,
670 TE_P2P_GO_REPETITIVE_NOA,
671 TE_P2P_GO_CT_WINDOW,
672
673 /* WiDi Sync Events */
674 TE_WIDI_TX_SYNC,
675
Andrei Otcheretianski7f0a7c62014-05-04 11:48:12 +0300676 /* Channel Switch NoA */
Luciano Coelhof991e172014-08-26 16:14:10 +0300677 TE_CHANNEL_SWITCH_PERIOD,
Andrei Otcheretianski7f0a7c62014-05-04 11:48:12 +0300678
Johannes Berg8ca151b2013-01-24 14:25:36 +0100679 TE_MAX
680}; /* MAC_EVENT_TYPE_API_E_VER_1 */
681
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300682
683
684/* Time event - defines for command API v1 */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100685
686/*
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300687 * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
688 * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
689 * the first fragment is scheduled.
690 * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
691 * the first 2 fragments are scheduled.
692 * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
693 * number of fragments are valid.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100694 *
695 * Other than the constant defined above, specifying a fragmentation value 'x'
696 * means that the event can be fragmented but only the first 'x' will be
697 * scheduled.
698 */
699enum {
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300700 TE_V1_FRAG_NONE = 0,
701 TE_V1_FRAG_SINGLE = 1,
702 TE_V1_FRAG_DUAL = 2,
703 TE_V1_FRAG_ENDLESS = 0xffffffff
Johannes Berg8ca151b2013-01-24 14:25:36 +0100704};
705
Johannes Berg8ca151b2013-01-24 14:25:36 +0100706/* If a Time Event can be fragmented, this is the max number of fragments */
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300707#define TE_V1_FRAG_MAX_MSK 0x0fffffff
708/* Repeat the time event endlessly (until removed) */
709#define TE_V1_REPEAT_ENDLESS 0xffffffff
710/* If a Time Event has bounded repetitions, this is the maximal value */
711#define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
712
713/* Time Event dependencies: none, on another TE, or in a specific time */
714enum {
715 TE_V1_INDEPENDENT = 0,
716 TE_V1_DEP_OTHER = BIT(0),
717 TE_V1_DEP_TSF = BIT(1),
718 TE_V1_EVENT_SOCIOPATHIC = BIT(2),
719}; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
720
721/*
722 * @TE_V1_NOTIF_NONE: no notifications
723 * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
724 * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
725 * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
726 * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
727 * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
728 * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
729 * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
730 * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
731 *
732 * Supported Time event notifications configuration.
733 * A notification (both event and fragment) includes a status indicating weather
734 * the FW was able to schedule the event or not. For fragment start/end
735 * notification the status is always success. There is no start/end fragment
736 * notification for monolithic events.
737 */
738enum {
739 TE_V1_NOTIF_NONE = 0,
740 TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
741 TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
742 TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
743 TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
744 TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
745 TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
746 TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
747 TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
748}; /* MAC_EVENT_ACTION_API_E_VER_2 */
749
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300750/* Time event - defines for command API */
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300751
752/*
753 * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
754 * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
755 * the first fragment is scheduled.
756 * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
757 * the first 2 fragments are scheduled.
758 * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
759 * number of fragments are valid.
760 *
761 * Other than the constant defined above, specifying a fragmentation value 'x'
762 * means that the event can be fragmented but only the first 'x' will be
763 * scheduled.
764 */
765enum {
766 TE_V2_FRAG_NONE = 0,
767 TE_V2_FRAG_SINGLE = 1,
768 TE_V2_FRAG_DUAL = 2,
769 TE_V2_FRAG_MAX = 0xfe,
770 TE_V2_FRAG_ENDLESS = 0xff
771};
772
773/* Repeat the time event endlessly (until removed) */
774#define TE_V2_REPEAT_ENDLESS 0xff
775/* If a Time Event has bounded repetitions, this is the maximal value */
776#define TE_V2_REPEAT_MAX 0xfe
777
778#define TE_V2_PLACEMENT_POS 12
779#define TE_V2_ABSENCE_POS 15
780
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300781/* Time event policy values
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300782 * A notification (both event and fragment) includes a status indicating weather
783 * the FW was able to schedule the event or not. For fragment start/end
784 * notification the status is always success. There is no start/end fragment
785 * notification for monolithic events.
786 *
787 * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
788 * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
789 * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
790 * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
791 * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
792 * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
793 * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
794 * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
795 * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
796 * @TE_V2_DEP_OTHER: depends on another time event
797 * @TE_V2_DEP_TSF: depends on a specific time
798 * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
799 * @TE_V2_ABSENCE: are we present or absent during the Time Event.
800 */
801enum {
802 TE_V2_DEFAULT_POLICY = 0x0,
803
804 /* notifications (event start/stop, fragment start/stop) */
805 TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
806 TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
807 TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
808 TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
809
810 TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
811 TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
812 TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
813 TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
Emmanuel Grumbach1f6bf072014-02-16 15:36:00 +0200814 T2_V2_START_IMMEDIATELY = BIT(11),
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300815
816 TE_V2_NOTIF_MSK = 0xff,
817
818 /* placement characteristics */
819 TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
820 TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
821 TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
822
823 /* are we present or absent during the Time Event. */
824 TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
825};
826
827/**
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300828 * struct iwl_time_event_cmd_api - configuring Time Events
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300829 * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
830 * with version 1. determined by IWL_UCODE_TLV_FLAGS)
831 * ( TIME_EVENT_CMD = 0x29 )
832 * @id_and_color: ID and color of the relevant MAC
833 * @action: action to perform, one of FW_CTXT_ACTION_*
834 * @id: this field has two meanings, depending on the action:
835 * If the action is ADD, then it means the type of event to add.
836 * For all other actions it is the unique event ID assigned when the
837 * event was added by the FW.
838 * @apply_time: When to start the Time Event (in GP2)
839 * @max_delay: maximum delay to event's start (apply time), in TU
840 * @depends_on: the unique ID of the event we depend on (if any)
841 * @interval: interval between repetitions, in TU
842 * @duration: duration of event in TU
843 * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
844 * @max_frags: maximal number of fragments the Time Event can be divided to
845 * @policy: defines whether uCode shall notify the host or other uCode modules
846 * on event and/or fragment start and/or end
847 * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
848 * TE_EVENT_SOCIOPATHIC
849 * using TE_ABSENCE and using TE_NOTIF_*
850 */
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300851struct iwl_time_event_cmd {
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300852 /* COMMON_INDEX_HDR_API_S_VER_1 */
853 __le32 id_and_color;
854 __le32 action;
855 __le32 id;
856 /* MAC_TIME_EVENT_DATA_API_S_VER_2 */
857 __le32 apply_time;
858 __le32 max_delay;
859 __le32 depends_on;
860 __le32 interval;
861 __le32 duration;
862 u8 repeat;
863 u8 max_frags;
864 __le16 policy;
865} __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
866
Johannes Berg8ca151b2013-01-24 14:25:36 +0100867/**
868 * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
869 * @status: bit 0 indicates success, all others specify errors
870 * @id: the Time Event type
871 * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
872 * @id_and_color: ID and color of the relevant MAC
873 */
874struct iwl_time_event_resp {
875 __le32 status;
876 __le32 id;
877 __le32 unique_id;
878 __le32 id_and_color;
879} __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
880
881/**
882 * struct iwl_time_event_notif - notifications of time event start/stop
883 * ( TIME_EVENT_NOTIFICATION = 0x2a )
884 * @timestamp: action timestamp in GP2
885 * @session_id: session's unique id
886 * @unique_id: unique id of the Time Event itself
887 * @id_and_color: ID and color of the relevant MAC
888 * @action: one of TE_NOTIF_START or TE_NOTIF_END
889 * @status: true if scheduled, false otherwise (not executed)
890 */
891struct iwl_time_event_notif {
892 __le32 timestamp;
893 __le32 session_id;
894 __le32 unique_id;
895 __le32 id_and_color;
896 __le32 action;
897 __le32 status;
898} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
899
900
901/* Bindings and Time Quota */
902
903/**
904 * struct iwl_binding_cmd - configuring bindings
905 * ( BINDING_CONTEXT_CMD = 0x2b )
906 * @id_and_color: ID and color of the relevant Binding
907 * @action: action to perform, one of FW_CTXT_ACTION_*
908 * @macs: array of MAC id and colors which belong to the binding
909 * @phy: PHY id and color which belongs to the binding
910 */
911struct iwl_binding_cmd {
912 /* COMMON_INDEX_HDR_API_S_VER_1 */
913 __le32 id_and_color;
914 __le32 action;
915 /* BINDING_DATA_API_S_VER_1 */
916 __le32 macs[MAX_MACS_IN_BINDING];
917 __le32 phy;
918} __packed; /* BINDING_CMD_API_S_VER_1 */
919
Ilan Peer35adfd62013-02-04 13:16:24 +0200920/* The maximal number of fragments in the FW's schedule session */
921#define IWL_MVM_MAX_QUOTA 128
922
Johannes Berg8ca151b2013-01-24 14:25:36 +0100923/**
924 * struct iwl_time_quota_data - configuration of time quota per binding
925 * @id_and_color: ID and color of the relevant Binding
926 * @quota: absolute time quota in TU. The scheduler will try to divide the
927 * remainig quota (after Time Events) according to this quota.
928 * @max_duration: max uninterrupted context duration in TU
929 */
930struct iwl_time_quota_data {
931 __le32 id_and_color;
932 __le32 quota;
933 __le32 max_duration;
934} __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
935
936/**
937 * struct iwl_time_quota_cmd - configuration of time quota between bindings
938 * ( TIME_QUOTA_CMD = 0x2c )
939 * @quotas: allocations per binding
940 */
941struct iwl_time_quota_cmd {
942 struct iwl_time_quota_data quotas[MAX_BINDINGS];
943} __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
944
945
946/* PHY context */
947
948/* Supported bands */
949#define PHY_BAND_5 (0)
950#define PHY_BAND_24 (1)
951
952/* Supported channel width, vary if there is VHT support */
953#define PHY_VHT_CHANNEL_MODE20 (0x0)
954#define PHY_VHT_CHANNEL_MODE40 (0x1)
955#define PHY_VHT_CHANNEL_MODE80 (0x2)
956#define PHY_VHT_CHANNEL_MODE160 (0x3)
957
958/*
959 * Control channel position:
960 * For legacy set bit means upper channel, otherwise lower.
961 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
962 * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
963 * center_freq
964 * |
965 * 40Mhz |_______|_______|
966 * 80Mhz |_______|_______|_______|_______|
967 * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
968 * code 011 010 001 000 | 100 101 110 111
969 */
970#define PHY_VHT_CTRL_POS_1_BELOW (0x0)
971#define PHY_VHT_CTRL_POS_2_BELOW (0x1)
972#define PHY_VHT_CTRL_POS_3_BELOW (0x2)
973#define PHY_VHT_CTRL_POS_4_BELOW (0x3)
974#define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
975#define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
976#define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
977#define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
978
979/*
980 * @band: PHY_BAND_*
981 * @channel: channel number
982 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
983 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
984 */
985struct iwl_fw_channel_info {
986 u8 band;
987 u8 channel;
988 u8 width;
989 u8 ctrl_pos;
990} __packed;
991
992#define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
993#define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
994 (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
995#define PHY_RX_CHAIN_VALID_POS (1)
996#define PHY_RX_CHAIN_VALID_MSK \
997 (0x7 << PHY_RX_CHAIN_VALID_POS)
998#define PHY_RX_CHAIN_FORCE_SEL_POS (4)
999#define PHY_RX_CHAIN_FORCE_SEL_MSK \
1000 (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
1001#define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
1002#define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
1003 (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
1004#define PHY_RX_CHAIN_CNT_POS (10)
1005#define PHY_RX_CHAIN_CNT_MSK \
1006 (0x3 << PHY_RX_CHAIN_CNT_POS)
1007#define PHY_RX_CHAIN_MIMO_CNT_POS (12)
1008#define PHY_RX_CHAIN_MIMO_CNT_MSK \
1009 (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
1010#define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
1011#define PHY_RX_CHAIN_MIMO_FORCE_MSK \
1012 (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
1013
1014/* TODO: fix the value, make it depend on firmware at runtime? */
1015#define NUM_PHY_CTX 3
1016
1017/* TODO: complete missing documentation */
1018/**
1019 * struct iwl_phy_context_cmd - config of the PHY context
1020 * ( PHY_CONTEXT_CMD = 0x8 )
1021 * @id_and_color: ID and color of the relevant Binding
1022 * @action: action to perform, one of FW_CTXT_ACTION_*
1023 * @apply_time: 0 means immediate apply and context switch.
1024 * other value means apply new params after X usecs
1025 * @tx_param_color: ???
1026 * @channel_info:
1027 * @txchain_info: ???
1028 * @rxchain_info: ???
1029 * @acquisition_data: ???
1030 * @dsp_cfg_flags: set to 0
1031 */
1032struct iwl_phy_context_cmd {
1033 /* COMMON_INDEX_HDR_API_S_VER_1 */
1034 __le32 id_and_color;
1035 __le32 action;
1036 /* PHY_CONTEXT_DATA_API_S_VER_1 */
1037 __le32 apply_time;
1038 __le32 tx_param_color;
1039 struct iwl_fw_channel_info ci;
1040 __le32 txchain_info;
1041 __le32 rxchain_info;
1042 __le32 acquisition_data;
1043 __le32 dsp_cfg_flags;
1044} __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
1045
Ariej Marjieh720befbf2014-07-07 09:04:58 +03001046/*
1047 * Aux ROC command
1048 *
1049 * Command requests the firmware to create a time event for a certain duration
1050 * and remain on the given channel. This is done by using the Aux framework in
1051 * the FW.
1052 * The command was first used for Hot Spot issues - but can be used regardless
1053 * to Hot Spot.
1054 *
1055 * ( HOT_SPOT_CMD 0x53 )
1056 *
1057 * @id_and_color: ID and color of the MAC
1058 * @action: action to perform, one of FW_CTXT_ACTION_*
1059 * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
1060 * event_unique_id should be the id of the time event assigned by ucode.
1061 * Otherwise ignore the event_unique_id.
1062 * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
1063 * activity.
1064 * @channel_info: channel info
1065 * @node_addr: Our MAC Address
1066 * @reserved: reserved for alignment
1067 * @apply_time: GP2 value to start (should always be the current GP2 value)
1068 * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
1069 * time by which start of the event is allowed to be postponed.
1070 * @duration: event duration in TU To calculate event duration:
1071 * timeEventDuration = min(duration, remainingQuota)
1072 */
1073struct iwl_hs20_roc_req {
1074 /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
1075 __le32 id_and_color;
1076 __le32 action;
1077 __le32 event_unique_id;
1078 __le32 sta_id_and_color;
1079 struct iwl_fw_channel_info channel_info;
1080 u8 node_addr[ETH_ALEN];
1081 __le16 reserved;
1082 __le32 apply_time;
1083 __le32 apply_time_max_delay;
1084 __le32 duration;
1085} __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
1086
1087/*
1088 * values for AUX ROC result values
1089 */
1090enum iwl_mvm_hot_spot {
1091 HOT_SPOT_RSP_STATUS_OK,
1092 HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
1093 HOT_SPOT_MAX_NUM_OF_SESSIONS,
1094};
1095
1096/*
1097 * Aux ROC command response
1098 *
1099 * In response to iwl_hs20_roc_req the FW sends this command to notify the
1100 * driver the uid of the timevent.
1101 *
1102 * ( HOT_SPOT_CMD 0x53 )
1103 *
1104 * @event_unique_id: Unique ID of time event assigned by ucode
1105 * @status: Return status 0 is success, all the rest used for specific errors
1106 */
1107struct iwl_hs20_roc_res {
1108 __le32 event_unique_id;
1109 __le32 status;
1110} __packed; /* HOT_SPOT_RSP_API_S_VER_1 */
1111
Johannes Berg8ca151b2013-01-24 14:25:36 +01001112/**
1113 * struct iwl_radio_version_notif - information on the radio version
1114 * ( RADIO_VERSION_NOTIFICATION = 0x68 )
1115 * @radio_flavor:
1116 * @radio_step:
1117 * @radio_dash:
1118 */
1119struct iwl_radio_version_notif {
1120 __le32 radio_flavor;
1121 __le32 radio_step;
1122 __le32 radio_dash;
1123} __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
1124
1125enum iwl_card_state_flags {
1126 CARD_ENABLED = 0x00,
1127 HW_CARD_DISABLED = 0x01,
1128 SW_CARD_DISABLED = 0x02,
1129 CT_KILL_CARD_DISABLED = 0x04,
1130 HALT_CARD_DISABLED = 0x08,
1131 CARD_DISABLED_MSK = 0x0f,
1132 CARD_IS_RX_ON = 0x10,
1133};
1134
1135/**
1136 * struct iwl_radio_version_notif - information on the radio version
1137 * ( CARD_STATE_NOTIFICATION = 0xa1 )
1138 * @flags: %iwl_card_state_flags
1139 */
1140struct iwl_card_state_notif {
1141 __le32 flags;
1142} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
1143
1144/**
Hila Gonend64048e2013-03-13 18:00:03 +02001145 * struct iwl_missed_beacons_notif - information on missed beacons
1146 * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
1147 * @mac_id: interface ID
1148 * @consec_missed_beacons_since_last_rx: number of consecutive missed
1149 * beacons since last RX.
1150 * @consec_missed_beacons: number of consecutive missed beacons
1151 * @num_expected_beacons:
1152 * @num_recvd_beacons:
1153 */
1154struct iwl_missed_beacons_notif {
1155 __le32 mac_id;
1156 __le32 consec_missed_beacons_since_last_rx;
1157 __le32 consec_missed_beacons;
1158 __le32 num_expected_beacons;
1159 __le32 num_recvd_beacons;
1160} __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
1161
1162/**
Chaya Rachel Ivgy30269c12014-11-15 21:08:29 +02001163 * struct iwl_mfuart_load_notif - mfuart image version & status
1164 * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
1165 * @installed_ver: installed image version
1166 * @external_ver: external image version
1167 * @status: MFUART loading status
1168 * @duration: MFUART loading time
1169*/
1170struct iwl_mfuart_load_notif {
1171 __le32 installed_ver;
1172 __le32 external_ver;
1173 __le32 status;
1174 __le32 duration;
1175} __packed; /*MFU_LOADER_NTFY_API_S_VER_1*/
1176
1177/**
Johannes Berg8ca151b2013-01-24 14:25:36 +01001178 * struct iwl_set_calib_default_cmd - set default value for calibration.
1179 * ( SET_CALIB_DEFAULT_CMD = 0x8e )
1180 * @calib_index: the calibration to set value for
1181 * @length: of data
1182 * @data: the value to set for the calibration result
1183 */
1184struct iwl_set_calib_default_cmd {
1185 __le16 calib_index;
1186 __le16 length;
1187 u8 data[0];
1188} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
1189
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +03001190#define MAX_PORT_ID_NUM 2
Eliad Pellere59647e2013-11-28 14:08:50 +02001191#define MAX_MCAST_FILTERING_ADDRESSES 256
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +03001192
1193/**
1194 * struct iwl_mcast_filter_cmd - configure multicast filter.
1195 * @filter_own: Set 1 to filter out multicast packets sent by station itself
1196 * @port_id: Multicast MAC addresses array specifier. This is a strange way
1197 * to identify network interface adopted in host-device IF.
1198 * It is used by FW as index in array of addresses. This array has
1199 * MAX_PORT_ID_NUM members.
1200 * @count: Number of MAC addresses in the array
1201 * @pass_all: Set 1 to pass all multicast packets.
1202 * @bssid: current association BSSID.
1203 * @addr_list: Place holder for array of MAC addresses.
1204 * IMPORTANT: add padding if necessary to ensure DWORD alignment.
1205 */
1206struct iwl_mcast_filter_cmd {
1207 u8 filter_own;
1208 u8 port_id;
1209 u8 count;
1210 u8 pass_all;
1211 u8 bssid[6];
1212 u8 reserved[2];
1213 u8 addr_list[0];
1214} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
1215
Eliad Pellerc87163b2014-01-08 10:11:11 +02001216#define MAX_BCAST_FILTERS 8
1217#define MAX_BCAST_FILTER_ATTRS 2
1218
1219/**
1220 * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
1221 * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
1222 * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
1223 * start of ip payload).
1224 */
1225enum iwl_mvm_bcast_filter_attr_offset {
1226 BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
1227 BCAST_FILTER_OFFSET_IP_END = 1,
1228};
1229
1230/**
1231 * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
1232 * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset.
1233 * @offset: starting offset of this pattern.
1234 * @val: value to match - big endian (MSB is the first
1235 * byte to match from offset pos).
1236 * @mask: mask to match (big endian).
1237 */
1238struct iwl_fw_bcast_filter_attr {
1239 u8 offset_type;
1240 u8 offset;
1241 __le16 reserved1;
1242 __be32 val;
1243 __be32 mask;
1244} __packed; /* BCAST_FILTER_ATT_S_VER_1 */
1245
1246/**
1247 * enum iwl_mvm_bcast_filter_frame_type - filter frame type
1248 * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
1249 * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
1250 */
1251enum iwl_mvm_bcast_filter_frame_type {
1252 BCAST_FILTER_FRAME_TYPE_ALL = 0,
1253 BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
1254};
1255
1256/**
1257 * struct iwl_fw_bcast_filter - broadcast filter
1258 * @discard: discard frame (1) or let it pass (0).
1259 * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
1260 * @num_attrs: number of valid attributes in this filter.
1261 * @attrs: attributes of this filter. a filter is considered matched
1262 * only when all its attributes are matched (i.e. AND relationship)
1263 */
1264struct iwl_fw_bcast_filter {
1265 u8 discard;
1266 u8 frame_type;
1267 u8 num_attrs;
1268 u8 reserved1;
1269 struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
1270} __packed; /* BCAST_FILTER_S_VER_1 */
1271
1272/**
1273 * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
1274 * @default_discard: default action for this mac (discard (1) / pass (0)).
1275 * @attached_filters: bitmap of relevant filters for this mac.
1276 */
1277struct iwl_fw_bcast_mac {
1278 u8 default_discard;
1279 u8 reserved1;
1280 __le16 attached_filters;
1281} __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
1282
1283/**
1284 * struct iwl_bcast_filter_cmd - broadcast filtering configuration
1285 * @disable: enable (0) / disable (1)
1286 * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
1287 * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
1288 * @filters: broadcast filters
1289 * @macs: broadcast filtering configuration per-mac
1290 */
1291struct iwl_bcast_filter_cmd {
1292 u8 disable;
1293 u8 max_bcast_filters;
1294 u8 max_macs;
1295 u8 reserved1;
1296 struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
1297 struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
1298} __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
1299
Matti Gottlieba2d79c52014-08-25 14:41:23 +03001300/*
1301 * enum iwl_mvm_marker_id - maker ids
1302 *
1303 * The ids for different type of markers to insert into the usniffer logs
1304 */
1305enum iwl_mvm_marker_id {
1306 MARKER_ID_TX_FRAME_LATENCY = 1,
1307}; /* MARKER_ID_API_E_VER_1 */
1308
1309/**
1310 * struct iwl_mvm_marker - mark info into the usniffer logs
1311 *
1312 * (MARKER_CMD = 0xcb)
1313 *
1314 * Mark the UTC time stamp into the usniffer logs together with additional
1315 * metadata, so the usniffer output can be parsed.
1316 * In the command response the ucode will return the GP2 time.
1317 *
1318 * @dw_len: The amount of dwords following this byte including this byte.
1319 * @marker_id: A unique marker id (iwl_mvm_marker_id).
1320 * @reserved: reserved.
1321 * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
1322 * @metadata: additional meta data that will be written to the unsiffer log
1323 */
1324struct iwl_mvm_marker {
1325 u8 dwLen;
1326 u8 markerId;
1327 __le16 reserved;
1328 __le64 timestamp;
1329 __le32 metadata[0];
1330} __packed; /* MARKER_API_S_VER_1 */
1331
Matti Gottlieb0becb372015-05-31 09:18:30 +03001332/*
1333 * enum iwl_dc2dc_config_id - flag ids
1334 *
1335 * Ids of dc2dc configuration flags
1336 */
1337enum iwl_dc2dc_config_id {
1338 DCDC_LOW_POWER_MODE_MSK_SET = 0x1, /* not used */
1339 DCDC_FREQ_TUNE_SET = 0x2,
1340}; /* MARKER_ID_API_E_VER_1 */
1341
1342/**
1343 * struct iwl_dc2dc_config_cmd - configure dc2dc values
1344 *
1345 * (DC2DC_CONFIG_CMD = 0x83)
1346 *
1347 * Set/Get & configure dc2dc values.
1348 * The command always returns the current dc2dc values.
1349 *
1350 * @flags: set/get dc2dc
1351 * @enable_low_power_mode: not used.
1352 * @dc2dc_freq_tune0: frequency divider - digital domain
1353 * @dc2dc_freq_tune1: frequency divider - analog domain
1354 */
1355struct iwl_dc2dc_config_cmd {
1356 __le32 flags;
1357 __le32 enable_low_power_mode; /* not used */
1358 __le32 dc2dc_freq_tune0;
1359 __le32 dc2dc_freq_tune1;
1360} __packed; /* DC2DC_CONFIG_CMD_API_S_VER_1 */
1361
1362/**
1363 * struct iwl_dc2dc_config_resp - response for iwl_dc2dc_config_cmd
1364 *
1365 * Current dc2dc values returned by the FW.
1366 *
1367 * @dc2dc_freq_tune0: frequency divider - digital domain
1368 * @dc2dc_freq_tune1: frequency divider - analog domain
1369 */
1370struct iwl_dc2dc_config_resp {
1371 __le32 dc2dc_freq_tune0;
1372 __le32 dc2dc_freq_tune1;
1373} __packed; /* DC2DC_CONFIG_RESP_API_S_VER_1 */
1374
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001375/***********************************
1376 * Smart Fifo API
1377 ***********************************/
1378/* Smart Fifo state */
1379enum iwl_sf_state {
1380 SF_LONG_DELAY_ON = 0, /* should never be called by driver */
1381 SF_FULL_ON,
1382 SF_UNINIT,
1383 SF_INIT_OFF,
1384 SF_HW_NUM_STATES
1385};
1386
1387/* Smart Fifo possible scenario */
1388enum iwl_sf_scenario {
1389 SF_SCENARIO_SINGLE_UNICAST,
1390 SF_SCENARIO_AGG_UNICAST,
1391 SF_SCENARIO_MULTICAST,
1392 SF_SCENARIO_BA_RESP,
1393 SF_SCENARIO_TX_RESP,
1394 SF_NUM_SCENARIO
1395};
1396
1397#define SF_TRANSIENT_STATES_NUMBER 2 /* SF_LONG_DELAY_ON and SF_FULL_ON */
1398#define SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */
1399
1400/* smart FIFO default values */
Emmanuel Grumbachb4c82ad2014-12-01 16:44:09 +02001401#define SF_W_MARK_SISO 6144
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001402#define SF_W_MARK_MIMO2 8192
1403#define SF_W_MARK_MIMO3 6144
1404#define SF_W_MARK_LEGACY 4096
1405#define SF_W_MARK_SCAN 4096
1406
Eran Hararyf4a3ee42015-02-08 13:58:50 +02001407/* SF Scenarios timers for default configuration (aligned to 32 uSec) */
1408#define SF_SINGLE_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
1409#define SF_SINGLE_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
1410#define SF_AGG_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
1411#define SF_AGG_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
1412#define SF_MCAST_IDLE_TIMER_DEF 160 /* 150 mSec */
1413#define SF_MCAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
1414#define SF_BA_IDLE_TIMER_DEF 160 /* 150 uSec */
1415#define SF_BA_AGING_TIMER_DEF 400 /* 0.4 mSec */
1416#define SF_TX_RE_IDLE_TIMER_DEF 160 /* 150 uSec */
1417#define SF_TX_RE_AGING_TIMER_DEF 400 /* 0.4 mSec */
1418
1419/* SF Scenarios timers for BSS MAC configuration (aligned to 32 uSec) */
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001420#define SF_SINGLE_UNICAST_IDLE_TIMER 320 /* 300 uSec */
1421#define SF_SINGLE_UNICAST_AGING_TIMER 2016 /* 2 mSec */
1422#define SF_AGG_UNICAST_IDLE_TIMER 320 /* 300 uSec */
1423#define SF_AGG_UNICAST_AGING_TIMER 2016 /* 2 mSec */
1424#define SF_MCAST_IDLE_TIMER 2016 /* 2 mSec */
1425#define SF_MCAST_AGING_TIMER 10016 /* 10 mSec */
1426#define SF_BA_IDLE_TIMER 320 /* 300 uSec */
1427#define SF_BA_AGING_TIMER 2016 /* 2 mSec */
1428#define SF_TX_RE_IDLE_TIMER 320 /* 300 uSec */
1429#define SF_TX_RE_AGING_TIMER 2016 /* 2 mSec */
1430
1431#define SF_LONG_DELAY_AGING_TIMER 1000000 /* 1 Sec */
1432
Eran Harary161bdb72014-07-27 08:03:06 +03001433#define SF_CFG_DUMMY_NOTIF_OFF BIT(16)
1434
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001435/**
1436 * Smart Fifo configuration command.
Emmanuel Grumbach86974bf2014-07-31 14:32:37 +03001437 * @state: smart fifo state, types listed in enum %iwl_sf_sate.
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001438 * @watermark: Minimum allowed availabe free space in RXF for transient state.
1439 * @long_delay_timeouts: aging and idle timer values for each scenario
1440 * in long delay state.
1441 * @full_on_timeouts: timer values for each scenario in full on state.
1442 */
1443struct iwl_sf_cfg_cmd {
Emmanuel Grumbach86974bf2014-07-31 14:32:37 +03001444 __le32 state;
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001445 __le32 watermark[SF_TRANSIENT_STATES_NUMBER];
1446 __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1447 __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1448} __packed; /* SF_CFG_API_S_VER_2 */
1449
Eran Harary8ba2d7a2015-02-08 11:41:43 +02001450/***********************************
1451 * Location Aware Regulatory (LAR) API - MCC updates
1452 ***********************************/
1453
1454/**
1455 * struct iwl_mcc_update_cmd - Request the device to update geographic
1456 * regulatory profile according to the given MCC (Mobile Country Code).
1457 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
1458 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
1459 * MCC in the cmd response will be the relevant MCC in the NVM.
1460 * @mcc: given mobile country code
1461 * @source_id: the source from where we got the MCC, see iwl_mcc_source
1462 * @reserved: reserved for alignment
1463 */
1464struct iwl_mcc_update_cmd {
1465 __le16 mcc;
1466 u8 source_id;
1467 u8 reserved;
1468} __packed; /* LAR_UPDATE_MCC_CMD_API_S */
1469
1470/**
1471 * iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
1472 * Contains the new channel control profile map, if changed, and the new MCC
1473 * (mobile country code).
1474 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
Jonathan Doron47c8b152014-11-27 16:55:25 +02001475 * @status: see &enum iwl_mcc_update_status
Eran Harary8ba2d7a2015-02-08 11:41:43 +02001476 * @mcc: the new applied MCC
1477 * @cap: capabilities for all channels which matches the MCC
1478 * @source_id: the MCC source, see iwl_mcc_source
1479 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
1480 * channels, depending on platform)
1481 * @channels: channel control data map, DWORD for each channel. Only the first
1482 * 16bits are used.
1483 */
1484struct iwl_mcc_update_resp {
1485 __le32 status;
1486 __le16 mcc;
1487 u8 cap;
1488 u8 source_id;
1489 __le32 n_channels;
1490 __le32 channels[0];
1491} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S */
1492
1493/**
1494 * struct iwl_mcc_chub_notif - chub notifies of mcc change
1495 * (MCC_CHUB_UPDATE_CMD = 0xc9)
1496 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
1497 * the cellular and connectivity cores that gets updates of the mcc, and
1498 * notifies the ucode directly of any mcc change.
1499 * The ucode requests the driver to request the device to update geographic
1500 * regulatory profile according to the given MCC (Mobile Country Code).
1501 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
1502 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
1503 * MCC in the cmd response will be the relevant MCC in the NVM.
1504 * @mcc: given mobile country code
1505 * @source_id: identity of the change originator, see iwl_mcc_source
1506 * @reserved1: reserved for alignment
1507 */
1508struct iwl_mcc_chub_notif {
1509 u16 mcc;
1510 u8 source_id;
1511 u8 reserved1;
1512} __packed; /* LAR_MCC_NOTIFY_S */
1513
1514enum iwl_mcc_update_status {
1515 MCC_RESP_NEW_CHAN_PROFILE,
1516 MCC_RESP_SAME_CHAN_PROFILE,
1517 MCC_RESP_INVALID,
1518 MCC_RESP_NVM_DISABLED,
1519 MCC_RESP_ILLEGAL,
1520 MCC_RESP_LOW_PRIORITY,
1521};
1522
1523enum iwl_mcc_source {
1524 MCC_SOURCE_OLD_FW = 0,
1525 MCC_SOURCE_ME = 1,
1526 MCC_SOURCE_BIOS = 2,
1527 MCC_SOURCE_3G_LTE_HOST = 3,
1528 MCC_SOURCE_3G_LTE_DEVICE = 4,
1529 MCC_SOURCE_WIFI = 5,
1530 MCC_SOURCE_RESERVED = 6,
1531 MCC_SOURCE_DEFAULT = 7,
1532 MCC_SOURCE_UNINITIALIZED = 8,
1533 MCC_SOURCE_GET_CURRENT = 0x10
1534};
1535
Luciano Coelhoa0a09242014-09-04 12:29:15 +03001536/* DTS measurements */
1537
1538enum iwl_dts_measurement_flags {
1539 DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0),
1540 DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1),
1541};
1542
1543/**
1544 * iwl_dts_measurement_cmd - request DTS temperature and/or voltage measurements
1545 *
1546 * @flags: indicates which measurements we want as specified in &enum
1547 * iwl_dts_measurement_flags
1548 */
1549struct iwl_dts_measurement_cmd {
1550 __le32 flags;
1551} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
1552
1553/**
Arik Nemtsov78efc702015-10-06 12:22:47 +03001554* enum iwl_dts_control_measurement_mode - DTS measurement type
1555* @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
1556* back (latest value. Not waiting for new value). Use automatic
1557* SW DTS configuration.
1558* @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
1559* trigger DTS reading and provide read back temperature read
1560* when available.
1561* @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
1562* @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
1563* without measurement trigger.
1564*/
1565enum iwl_dts_control_measurement_mode {
1566 DTS_AUTOMATIC = 0,
1567 DTS_REQUEST_READ = 1,
1568 DTS_OVER_WRITE = 2,
1569 DTS_DIRECT_WITHOUT_MEASURE = 3,
1570};
1571
1572/**
1573* enum iwl_dts_used - DTS to use or used for measurement in the DTS request
1574* @DTS_USE_TOP: Top
1575* @DTS_USE_CHAIN_A: chain A
1576* @DTS_USE_CHAIN_B: chain B
1577* @DTS_USE_CHAIN_C: chain C
1578* @XTAL_TEMPERATURE - read temperature from xtal
1579*/
1580enum iwl_dts_used {
1581 DTS_USE_TOP = 0,
1582 DTS_USE_CHAIN_A = 1,
1583 DTS_USE_CHAIN_B = 2,
1584 DTS_USE_CHAIN_C = 3,
1585 XTAL_TEMPERATURE = 4,
1586};
1587
1588/**
1589* enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
1590* @DTS_BIT6_MODE: bit 6 mode
1591* @DTS_BIT8_MODE: bit 8 mode
1592*/
1593enum iwl_dts_bit_mode {
1594 DTS_BIT6_MODE = 0,
1595 DTS_BIT8_MODE = 1,
1596};
1597
1598/**
1599 * iwl_ext_dts_measurement_cmd - request extended DTS temperature measurements
1600 * @control_mode: see &enum iwl_dts_control_measurement_mode
1601 * @temperature: used when over write DTS mode is selected
1602 * @sensor: set temperature sensor to use. See &enum iwl_dts_used
1603 * @avg_factor: average factor to DTS in request DTS read mode
1604 * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
1605 * @step_duration: step duration for the DTS
1606 */
1607struct iwl_ext_dts_measurement_cmd {
1608 __le32 control_mode;
1609 __le32 temperature;
1610 __le32 sensor;
1611 __le32 avg_factor;
1612 __le32 bit_mode;
1613 __le32 step_duration;
1614} __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */
1615
1616/**
Luciano Coelhoa0a09242014-09-04 12:29:15 +03001617 * iwl_dts_measurement_notif - notification received with the measurements
1618 *
1619 * @temp: the measured temperature
1620 * @voltage: the measured voltage
1621 */
1622struct iwl_dts_measurement_notif {
1623 __le32 temp;
1624 __le32 voltage;
1625} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S */
1626
Arik Nemtsov77c5d7e2014-09-11 13:10:08 +03001627/***********************************
1628 * TDLS API
1629 ***********************************/
1630
1631/* Type of TDLS request */
1632enum iwl_tdls_channel_switch_type {
1633 TDLS_SEND_CHAN_SW_REQ = 0,
1634 TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
1635 TDLS_MOVE_CH,
1636}; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */
1637
1638/**
1639 * Switch timing sub-element in a TDLS channel-switch command
1640 * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
1641 * received from peer
1642 * @max_offchan_duration: What amount of microseconds out of a DTIM is given
1643 * to the TDLS off-channel communication. For instance if the DTIM is
1644 * 200TU and the TDLS peer is to be given 25% of the time, the value
1645 * given will be 50TU, or 50 * 1024 if translated into microseconds.
1646 * @switch_time: switch time the peer sent in its channel switch timing IE
1647 * @switch_timout: switch timeout the peer sent in its channel switch timing IE
1648 */
1649struct iwl_tdls_channel_switch_timing {
1650 __le32 frame_timestamp; /* GP2 time of peer packet Rx */
1651 __le32 max_offchan_duration; /* given in micro-seconds */
1652 __le32 switch_time; /* given in micro-seconds */
1653 __le32 switch_timeout; /* given in micro-seconds */
1654} __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */
1655
1656#define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200
1657
1658/**
1659 * TDLS channel switch frame template
1660 *
1661 * A template representing a TDLS channel-switch request or response frame
1662 *
1663 * @switch_time_offset: offset to the channel switch timing IE in the template
1664 * @tx_cmd: Tx parameters for the frame
1665 * @data: frame data
1666 */
1667struct iwl_tdls_channel_switch_frame {
1668 __le32 switch_time_offset;
1669 struct iwl_tx_cmd tx_cmd;
1670 u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
1671} __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
1672
1673/**
1674 * TDLS channel switch command
1675 *
1676 * The command is sent to initiate a channel switch and also in response to
1677 * incoming TDLS channel-switch request/response packets from remote peers.
1678 *
1679 * @switch_type: see &enum iwl_tdls_channel_switch_type
1680 * @peer_sta_id: station id of TDLS peer
1681 * @ci: channel we switch to
1682 * @timing: timing related data for command
1683 * @frame: channel-switch request/response template, depending to switch_type
1684 */
1685struct iwl_tdls_channel_switch_cmd {
1686 u8 switch_type;
1687 __le32 peer_sta_id;
1688 struct iwl_fw_channel_info ci;
1689 struct iwl_tdls_channel_switch_timing timing;
1690 struct iwl_tdls_channel_switch_frame frame;
1691} __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
1692
1693/**
1694 * TDLS channel switch start notification
1695 *
1696 * @status: non-zero on success
1697 * @offchannel_duration: duration given in microseconds
1698 * @sta_id: peer currently performing the channel-switch with
1699 */
1700struct iwl_tdls_channel_switch_notif {
1701 __le32 status;
1702 __le32 offchannel_duration;
1703 __le32 sta_id;
1704} __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */
1705
Arik Nemtsov307e4722014-09-15 18:48:59 +03001706/**
1707 * TDLS station info
1708 *
1709 * @sta_id: station id of the TDLS peer
1710 * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
1711 * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
1712 * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
1713 */
1714struct iwl_tdls_sta_info {
1715 u8 sta_id;
1716 u8 tx_to_peer_tid;
1717 __le16 tx_to_peer_ssn;
1718 __le32 is_initiator;
1719} __packed; /* TDLS_STA_INFO_VER_1 */
1720
1721/**
1722 * TDLS basic config command
1723 *
1724 * @id_and_color: MAC id and color being configured
1725 * @tdls_peer_count: amount of currently connected TDLS peers
1726 * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
1727 * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
1728 * @sta_info: per-station info. Only the first tdls_peer_count entries are set
1729 * @pti_req_data_offset: offset of network-level data for the PTI template
1730 * @pti_req_tx_cmd: Tx parameters for PTI request template
1731 * @pti_req_template: PTI request template data
1732 */
1733struct iwl_tdls_config_cmd {
1734 __le32 id_and_color; /* mac id and color */
1735 u8 tdls_peer_count;
1736 u8 tx_to_ap_tid;
1737 __le16 tx_to_ap_ssn;
1738 struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];
1739
1740 __le32 pti_req_data_offset;
1741 struct iwl_tx_cmd pti_req_tx_cmd;
1742 u8 pti_req_template[0];
1743} __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */
1744
1745/**
1746 * TDLS per-station config information from FW
1747 *
1748 * @sta_id: station id of the TDLS peer
1749 * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
1750 * the peer
1751 */
1752struct iwl_tdls_config_sta_info_res {
1753 __le16 sta_id;
1754 __le16 tx_to_peer_last_seq;
1755} __packed; /* TDLS_STA_INFO_RSP_VER_1 */
1756
1757/**
1758 * TDLS config information from FW
1759 *
1760 * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
1761 * @sta_info: per-station TDLS config information
1762 */
1763struct iwl_tdls_config_res {
1764 __le32 tx_to_ap_last_seq;
1765 struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
1766} __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */
1767
Liad Kaufman04fd2c22014-12-15 17:54:16 +02001768#define TX_FIFO_MAX_NUM 8
1769#define RX_FIFO_MAX_NUM 2
1770
1771/**
1772 * Shared memory configuration information from the FW
1773 *
1774 * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
1775 * accessible)
1776 * @shared_mem_size: shared memory size
1777 * @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to
1778 * 0x0 as accessible only via DBGM RDAT)
1779 * @sample_buff_size: internal sample buff size
1780 * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre
1781 * 8000 HW set to 0x0 as not accessible)
1782 * @txfifo_size: size of TXF0 ... TXF7
1783 * @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0
1784 * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
1785 * when paging is not supported this should be 0
1786 * @page_buff_size: size of %page_buff_addr
1787 */
1788struct iwl_shared_mem_cfg {
1789 __le32 shared_mem_addr;
1790 __le32 shared_mem_size;
1791 __le32 sample_buff_addr;
1792 __le32 sample_buff_size;
1793 __le32 txfifo_addr;
1794 __le32 txfifo_size[TX_FIFO_MAX_NUM];
1795 __le32 rxfifo_size[RX_FIFO_MAX_NUM];
1796 __le32 page_buff_addr;
1797 __le32 page_buff_size;
1798} __packed; /* SHARED_MEM_ALLOC_API_S_VER_1 */
1799
Johannes Berg8ca151b2013-01-24 14:25:36 +01001800#endif /* __fw_api_h__ */