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