blob: 667a92274c87773c1d123b41911afb5e38d19405 [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.
Johannes Berg8b4139d2014-07-24 14:05:26 +02009 * Copyright(c) 2013 - 2014 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.
Johannes Berg8b4139d2014-07-24 14:05:26 +020035 * Copyright(c) 2013 - 2014 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"
70#include "fw-api-tx.h"
71#include "fw-api-sta.h"
72#include "fw-api-mac.h"
73#include "fw-api-power.h"
74#include "fw-api-d3.h"
Emmanuel Grumbach5b7ff612014-03-11 19:27:45 +020075#include "fw-api-coex.h"
Haim Dreyfusse820c2d2014-04-06 11:19:09 +030076#include "fw-api-scan.h"
Johannes Berg8ca151b2013-01-24 14:25:36 +010077
Eytan Lifshitz19e737c2013-09-09 13:30:15 +020078/* Tx queue numbers */
Johannes Berg8ca151b2013-01-24 14:25:36 +010079enum {
80 IWL_MVM_OFFCHANNEL_QUEUE = 8,
81 IWL_MVM_CMD_QUEUE = 9,
Johannes Berg8ca151b2013-01-24 14:25:36 +010082};
83
Johannes Bergb2d81db2014-08-01 20:48:25 +020084enum iwl_mvm_tx_fifo {
85 IWL_MVM_TX_FIFO_BK = 0,
86 IWL_MVM_TX_FIFO_BE,
87 IWL_MVM_TX_FIFO_VI,
88 IWL_MVM_TX_FIFO_VO,
89 IWL_MVM_TX_FIFO_MCAST = 5,
90 IWL_MVM_TX_FIFO_CMD = 7,
91};
Eytan Lifshitz19e737c2013-09-09 13:30:15 +020092
Johannes Berg8ca151b2013-01-24 14:25:36 +010093#define IWL_MVM_STATION_COUNT 16
94
Arik Nemtsovcf7b4912014-05-15 11:44:40 +030095#define IWL_MVM_TDLS_STA_COUNT 4
96
Johannes Berg8ca151b2013-01-24 14:25:36 +010097/* commands */
98enum {
99 MVM_ALIVE = 0x1,
100 REPLY_ERROR = 0x2,
101
102 INIT_COMPLETE_NOTIF = 0x4,
103
104 /* PHY context commands */
105 PHY_CONTEXT_CMD = 0x8,
106 DBG_CFG = 0x9,
Emmanuel Grumbachb9fae2d2014-02-17 11:24:10 +0200107 ANTENNA_COUPLING_NOTIFICATION = 0xa,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100108
109 /* station table */
Max Stepanov5a258aa2013-04-07 09:11:21 +0300110 ADD_STA_KEY = 0x17,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100111 ADD_STA = 0x18,
112 REMOVE_STA = 0x19,
113
114 /* TX */
115 TX_CMD = 0x1c,
116 TXPATH_FLUSH = 0x1e,
117 MGMT_MCAST_KEY = 0x1f,
118
Avri Altman3edf8ff2014-07-30 11:41:01 +0300119 /* scheduler config */
120 SCD_QUEUE_CFG = 0x1d,
121
Johannes Berg8ca151b2013-01-24 14:25:36 +0100122 /* global key */
123 WEP_KEY = 0x20,
124
125 /* MAC and Binding commands */
126 MAC_CONTEXT_CMD = 0x28,
127 TIME_EVENT_CMD = 0x29, /* both CMD and response */
128 TIME_EVENT_NOTIFICATION = 0x2a,
129 BINDING_CONTEXT_CMD = 0x2b,
130 TIME_QUOTA_CMD = 0x2c,
Johannes Berg4ac6cb52013-08-08 09:30:13 +0200131 NON_QOS_TX_COUNTER_CMD = 0x2d,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100132
133 LQ_CMD = 0x4e,
134
135 /* Calibration */
136 TEMPERATURE_NOTIFICATION = 0x62,
137 CALIBRATION_CFG_CMD = 0x65,
138 CALIBRATION_RES_NOTIFICATION = 0x66,
139 CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
140 RADIO_VERSION_NOTIFICATION = 0x68,
141
142 /* Scan offload */
143 SCAN_OFFLOAD_REQUEST_CMD = 0x51,
144 SCAN_OFFLOAD_ABORT_CMD = 0x52,
Ariej Marjieh720befbf2014-07-07 09:04:58 +0300145 HOT_SPOT_CMD = 0x53,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100146 SCAN_OFFLOAD_COMPLETE = 0x6D,
147 SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
148 SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
David Spinadel35a000b2013-08-28 09:29:43 +0300149 MATCH_FOUND_NOTIFICATION = 0xd9,
David Spinadelfb98be52014-05-04 12:51:10 +0300150 SCAN_ITERATION_COMPLETE = 0xe7,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100151
152 /* Phy */
153 PHY_CONFIGURATION_CMD = 0x6a,
154 CALIB_RES_NOTIF_PHY_DB = 0x6b,
155 /* PHY_DB_CMD = 0x6c, */
156
Alexander Bondare811ada2013-03-10 15:29:44 +0200157 /* Power - legacy power table command */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100158 POWER_TABLE_CMD = 0x77,
Alexander Bondar175a70b2013-04-14 20:59:37 +0300159 PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100160
Eytan Lifshitz9ee718a2013-05-19 19:14:41 +0300161 /* Thermal Throttling*/
162 REPLY_THERMAL_MNG_BACKOFF = 0x7e,
163
Johannes Berg8ca151b2013-01-24 14:25:36 +0100164 /* Scanning */
165 SCAN_REQUEST_CMD = 0x80,
166 SCAN_ABORT_CMD = 0x81,
167 SCAN_START_NOTIFICATION = 0x82,
168 SCAN_RESULTS_NOTIFICATION = 0x83,
169 SCAN_COMPLETE_NOTIFICATION = 0x84,
170
171 /* NVM */
172 NVM_ACCESS_CMD = 0x88,
173
174 SET_CALIB_DEFAULT_CMD = 0x8e,
175
Ilan Peer571765c2013-03-05 15:26:03 +0200176 BEACON_NOTIFICATION = 0x90,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100177 BEACON_TEMPLATE_CMD = 0x91,
178 TX_ANT_CONFIGURATION_CMD = 0x98,
179 STATISTICS_NOTIFICATION = 0x9d,
Johannes Berg3e56ead2013-02-15 22:23:18 +0100180 EOSP_NOTIFICATION = 0x9e,
Matti Gottlieb88f2fd72013-07-09 15:25:46 +0300181 REDUCE_TX_POWER_CMD = 0x9f,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100182
183 /* RF-KILL commands and notifications */
184 CARD_STATE_CMD = 0xa0,
185 CARD_STATE_NOTIFICATION = 0xa1,
186
Hila Gonend64048e2013-03-13 18:00:03 +0200187 MISSED_BEACONS_NOTIFICATION = 0xa2,
188
Alexander Bondare811ada2013-03-10 15:29:44 +0200189 /* Power - new power table command */
190 MAC_PM_POWER_TABLE = 0xa9,
191
Johannes Berg8ca151b2013-01-24 14:25:36 +0100192 REPLY_RX_PHY_CMD = 0xc0,
193 REPLY_RX_MPDU_CMD = 0xc1,
194 BA_NOTIF = 0xc5,
195
Matti Gottlieba2d79c52014-08-25 14:41:23 +0300196 MARKER_CMD = 0xcb,
197
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200198 /* BT Coex */
199 BT_COEX_PRIO_TABLE = 0xcc,
200 BT_COEX_PROT_ENV = 0xcd,
201 BT_PROFILE_NOTIFICATION = 0xce,
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300202 BT_CONFIG = 0x9b,
203 BT_COEX_UPDATE_SW_BOOST = 0x5a,
204 BT_COEX_UPDATE_CORUN_LUT = 0x5b,
205 BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300206 BT_COEX_CI = 0x5d,
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200207
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +0200208 REPLY_SF_CFG_CMD = 0xd1,
Hila Gonen7df15b12012-12-12 11:16:19 +0200209 REPLY_BEACON_FILTERING_CMD = 0xd2,
210
Luciano Coelhoa0a092432014-09-04 12:29:15 +0300211 /* DTS measurements */
212 CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
213 DTS_MEASUREMENT_NOTIFICATION = 0xdd,
214
Johannes Berg8ca151b2013-01-24 14:25:36 +0100215 REPLY_DEBUG_CMD = 0xf0,
216 DEBUG_LOG_MSG = 0xf7,
217
Eliad Pellerc87163b2014-01-08 10:11:11 +0200218 BCAST_FILTER_CMD = 0xcf,
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +0300219 MCAST_FILTER_CMD = 0xd0,
220
Johannes Berg8ca151b2013-01-24 14:25:36 +0100221 /* D3 commands/notifications */
222 D3_CONFIG_CMD = 0xd3,
223 PROT_OFFLOAD_CONFIG_CMD = 0xd4,
224 OFFLOADS_QUERY_CMD = 0xd5,
225 REMOTE_WAKE_CONFIG_CMD = 0xd6,
Arik Nemtsov98ee7782013-10-02 16:58:09 +0300226 D0I3_END_CMD = 0xed,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100227
228 /* for WoWLAN in particular */
229 WOWLAN_PATTERNS = 0xe0,
230 WOWLAN_CONFIGURATION = 0xe1,
231 WOWLAN_TSC_RSC_PARAM = 0xe2,
232 WOWLAN_TKIP_PARAM = 0xe3,
233 WOWLAN_KEK_KCK_MATERIAL = 0xe4,
234 WOWLAN_GET_STATUSES = 0xe5,
235 WOWLAN_TX_POWER_PER_DB = 0xe6,
236
237 /* and for NetDetect */
238 NET_DETECT_CONFIG_CMD = 0x54,
239 NET_DETECT_PROFILES_QUERY_CMD = 0x56,
240 NET_DETECT_PROFILES_CMD = 0x57,
241 NET_DETECT_HOTSPOTS_CMD = 0x58,
242 NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59,
243
244 REPLY_MAX = 0xff,
245};
246
247/**
248 * struct iwl_cmd_response - generic response struct for most commands
249 * @status: status of the command asked, changes for each one
250 */
251struct iwl_cmd_response {
252 __le32 status;
253};
254
255/*
256 * struct iwl_tx_ant_cfg_cmd
257 * @valid: valid antenna configuration
258 */
259struct iwl_tx_ant_cfg_cmd {
260 __le32 valid;
261} __packed;
262
Matti Gottlieb88f2fd72013-07-09 15:25:46 +0300263/**
264 * struct iwl_reduce_tx_power_cmd - TX power reduction command
265 * REDUCE_TX_POWER_CMD = 0x9f
266 * @flags: (reserved for future implementation)
267 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
268 * @pwr_restriction: TX power restriction in dBms.
269 */
270struct iwl_reduce_tx_power_cmd {
271 u8 flags;
272 u8 mac_context_id;
273 __le16 pwr_restriction;
274} __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
275
Johannes Berg8ca151b2013-01-24 14:25:36 +0100276/*
277 * Calibration control struct.
278 * Sent as part of the phy configuration command.
279 * @flow_trigger: bitmap for which calibrations to perform according to
280 * flow triggers.
281 * @event_trigger: bitmap for which calibrations to perform according to
282 * event triggers.
283 */
284struct iwl_calib_ctrl {
285 __le32 flow_trigger;
286 __le32 event_trigger;
287} __packed;
288
289/* This enum defines the bitmap of various calibrations to enable in both
290 * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
291 */
292enum iwl_calib_cfg {
293 IWL_CALIB_CFG_XTAL_IDX = BIT(0),
294 IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
295 IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
296 IWL_CALIB_CFG_PAPD_IDX = BIT(3),
297 IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
298 IWL_CALIB_CFG_DC_IDX = BIT(5),
299 IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
300 IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
301 IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
302 IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
303 IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
304 IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
305 IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
306 IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
307 IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
308 IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
309 IWL_CALIB_CFG_DAC_IDX = BIT(16),
310 IWL_CALIB_CFG_ABS_IDX = BIT(17),
311 IWL_CALIB_CFG_AGC_IDX = BIT(18),
312};
313
314/*
315 * Phy configuration command.
316 */
317struct iwl_phy_cfg_cmd {
318 __le32 phy_cfg;
319 struct iwl_calib_ctrl calib_control;
320} __packed;
321
322#define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
323#define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
324#define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
325#define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
326#define PHY_CFG_TX_CHAIN_A BIT(8)
327#define PHY_CFG_TX_CHAIN_B BIT(9)
328#define PHY_CFG_TX_CHAIN_C BIT(10)
329#define PHY_CFG_RX_CHAIN_A BIT(12)
330#define PHY_CFG_RX_CHAIN_B BIT(13)
331#define PHY_CFG_RX_CHAIN_C BIT(14)
332
333
334/* Target of the NVM_ACCESS_CMD */
335enum {
336 NVM_ACCESS_TARGET_CACHE = 0,
337 NVM_ACCESS_TARGET_OTP = 1,
338 NVM_ACCESS_TARGET_EEPROM = 2,
339};
340
Emmanuel Grumbachb9545b42013-03-06 11:34:44 +0200341/* Section types for NVM_ACCESS_CMD */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100342enum {
Eran Hararyae2b21b2014-01-09 08:08:24 +0200343 NVM_SECTION_TYPE_SW = 1,
Eran Harary77db0a32014-02-04 14:21:38 +0200344 NVM_SECTION_TYPE_REGULATORY = 3,
Eran Hararyae2b21b2014-01-09 08:08:24 +0200345 NVM_SECTION_TYPE_CALIBRATION = 4,
346 NVM_SECTION_TYPE_PRODUCTION = 5,
Eran Harary77db0a32014-02-04 14:21:38 +0200347 NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
348 NVM_MAX_NUM_SECTIONS = 12,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100349};
350
351/**
352 * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
353 * @op_code: 0 - read, 1 - write
354 * @target: NVM_ACCESS_TARGET_*
355 * @type: NVM_SECTION_TYPE_*
356 * @offset: offset in bytes into the section
357 * @length: in bytes, to read/write
358 * @data: if write operation, the data to write. On read its empty
359 */
Emmanuel Grumbachb9545b42013-03-06 11:34:44 +0200360struct iwl_nvm_access_cmd {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100361 u8 op_code;
362 u8 target;
363 __le16 type;
364 __le16 offset;
365 __le16 length;
366 u8 data[];
367} __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
368
369/**
370 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
371 * @offset: offset in bytes into the section
372 * @length: in bytes, either how much was written or read
373 * @type: NVM_SECTION_TYPE_*
374 * @status: 0 for success, fail otherwise
375 * @data: if read operation, the data returned. Empty on write.
376 */
Emmanuel Grumbachb9545b42013-03-06 11:34:44 +0200377struct iwl_nvm_access_resp {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100378 __le16 offset;
379 __le16 length;
380 __le16 type;
381 __le16 status;
382 u8 data[];
383} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
384
385/* MVM_ALIVE 0x1 */
386
387/* alive response is_valid values */
388#define ALIVE_RESP_UCODE_OK BIT(0)
389#define ALIVE_RESP_RFKILL BIT(1)
390
391/* alive response ver_type values */
392enum {
393 FW_TYPE_HW = 0,
394 FW_TYPE_PROT = 1,
395 FW_TYPE_AP = 2,
396 FW_TYPE_WOWLAN = 3,
397 FW_TYPE_TIMING = 4,
398 FW_TYPE_WIPAN = 5
399};
400
401/* alive response ver_subtype values */
402enum {
403 FW_SUBTYPE_FULL_FEATURE = 0,
404 FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
405 FW_SUBTYPE_REDUCED = 2,
406 FW_SUBTYPE_ALIVE_ONLY = 3,
407 FW_SUBTYPE_WOWLAN = 4,
408 FW_SUBTYPE_AP_SUBTYPE = 5,
409 FW_SUBTYPE_WIPAN = 6,
410 FW_SUBTYPE_INITIALIZE = 9
411};
412
413#define IWL_ALIVE_STATUS_ERR 0xDEAD
414#define IWL_ALIVE_STATUS_OK 0xCAFE
415
416#define IWL_ALIVE_FLG_RFKILL BIT(0)
417
418struct mvm_alive_resp {
419 __le16 status;
420 __le16 flags;
421 u8 ucode_minor;
422 u8 ucode_major;
423 __le16 id;
424 u8 api_minor;
425 u8 api_major;
426 u8 ver_subtype;
427 u8 ver_type;
428 u8 mac;
429 u8 opt;
430 __le16 reserved2;
431 __le32 timestamp;
432 __le32 error_event_table_ptr; /* SRAM address for error log */
433 __le32 log_event_table_ptr; /* SRAM address for event log */
434 __le32 cpu_register_ptr;
435 __le32 dbgm_config_ptr;
436 __le32 alive_counter_ptr;
437 __le32 scd_base_ptr; /* SRAM address for SCD */
438} __packed; /* ALIVE_RES_API_S_VER_1 */
439
Eran Harary01a9ca52014-02-03 09:29:57 +0200440struct mvm_alive_resp_ver2 {
441 __le16 status;
442 __le16 flags;
443 u8 ucode_minor;
444 u8 ucode_major;
445 __le16 id;
446 u8 api_minor;
447 u8 api_major;
448 u8 ver_subtype;
449 u8 ver_type;
450 u8 mac;
451 u8 opt;
452 __le16 reserved2;
453 __le32 timestamp;
454 __le32 error_event_table_ptr; /* SRAM address for error log */
455 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
456 __le32 cpu_register_ptr;
457 __le32 dbgm_config_ptr;
458 __le32 alive_counter_ptr;
459 __le32 scd_base_ptr; /* SRAM address for SCD */
460 __le32 st_fwrd_addr; /* pointer to Store and forward */
461 __le32 st_fwrd_size;
462 u8 umac_minor; /* UMAC version: minor */
463 u8 umac_major; /* UMAC version: major */
464 __le16 umac_id; /* UMAC version: id */
465 __le32 error_info_addr; /* SRAM address for UMAC error log */
466 __le32 dbg_print_buff_addr;
467} __packed; /* ALIVE_RES_API_S_VER_2 */
468
Johannes Berg8ca151b2013-01-24 14:25:36 +0100469/* Error response/notification */
470enum {
471 FW_ERR_UNKNOWN_CMD = 0x0,
472 FW_ERR_INVALID_CMD_PARAM = 0x1,
473 FW_ERR_SERVICE = 0x2,
474 FW_ERR_ARC_MEMORY = 0x3,
475 FW_ERR_ARC_CODE = 0x4,
476 FW_ERR_WATCH_DOG = 0x5,
477 FW_ERR_WEP_GRP_KEY_INDX = 0x10,
478 FW_ERR_WEP_KEY_SIZE = 0x11,
479 FW_ERR_OBSOLETE_FUNC = 0x12,
480 FW_ERR_UNEXPECTED = 0xFE,
481 FW_ERR_FATAL = 0xFF
482};
483
484/**
485 * struct iwl_error_resp - FW error indication
486 * ( REPLY_ERROR = 0x2 )
487 * @error_type: one of FW_ERR_*
488 * @cmd_id: the command ID for which the error occured
489 * @bad_cmd_seq_num: sequence number of the erroneous command
490 * @error_service: which service created the error, applicable only if
491 * error_type = 2, otherwise 0
492 * @timestamp: TSF in usecs.
493 */
494struct iwl_error_resp {
495 __le32 error_type;
496 u8 cmd_id;
497 u8 reserved1;
498 __le16 bad_cmd_seq_num;
499 __le32 error_service;
500 __le64 timestamp;
501} __packed;
502
503
504/* Common PHY, MAC and Bindings definitions */
505
506#define MAX_MACS_IN_BINDING (3)
507#define MAX_BINDINGS (4)
508#define AUX_BINDING_INDEX (3)
509#define MAX_PHYS (4)
510
511/* Used to extract ID and color from the context dword */
512#define FW_CTXT_ID_POS (0)
513#define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
514#define FW_CTXT_COLOR_POS (8)
515#define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
516#define FW_CTXT_INVALID (0xffffffff)
517
518#define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
519 (_color << FW_CTXT_COLOR_POS))
520
521/* Possible actions on PHYs, MACs and Bindings */
522enum {
523 FW_CTXT_ACTION_STUB = 0,
524 FW_CTXT_ACTION_ADD,
525 FW_CTXT_ACTION_MODIFY,
526 FW_CTXT_ACTION_REMOVE,
527 FW_CTXT_ACTION_NUM
528}; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
529
530/* Time Events */
531
532/* Time Event types, according to MAC type */
533enum iwl_time_event_type {
534 /* BSS Station Events */
535 TE_BSS_STA_AGGRESSIVE_ASSOC,
536 TE_BSS_STA_ASSOC,
537 TE_BSS_EAP_DHCP_PROT,
538 TE_BSS_QUIET_PERIOD,
539
540 /* P2P Device Events */
541 TE_P2P_DEVICE_DISCOVERABLE,
542 TE_P2P_DEVICE_LISTEN,
543 TE_P2P_DEVICE_ACTION_SCAN,
544 TE_P2P_DEVICE_FULL_SCAN,
545
546 /* P2P Client Events */
547 TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
548 TE_P2P_CLIENT_ASSOC,
549 TE_P2P_CLIENT_QUIET_PERIOD,
550
551 /* P2P GO Events */
552 TE_P2P_GO_ASSOC_PROT,
553 TE_P2P_GO_REPETITIVE_NOA,
554 TE_P2P_GO_CT_WINDOW,
555
556 /* WiDi Sync Events */
557 TE_WIDI_TX_SYNC,
558
Andrei Otcheretianski7f0a7c62014-05-04 11:48:12 +0300559 /* Channel Switch NoA */
Luciano Coelhof991e172014-08-26 16:14:10 +0300560 TE_CHANNEL_SWITCH_PERIOD,
Andrei Otcheretianski7f0a7c62014-05-04 11:48:12 +0300561
Johannes Berg8ca151b2013-01-24 14:25:36 +0100562 TE_MAX
563}; /* MAC_EVENT_TYPE_API_E_VER_1 */
564
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300565
566
567/* Time event - defines for command API v1 */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100568
569/*
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300570 * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
571 * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
572 * the first fragment is scheduled.
573 * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
574 * the first 2 fragments are scheduled.
575 * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
576 * number of fragments are valid.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100577 *
578 * Other than the constant defined above, specifying a fragmentation value 'x'
579 * means that the event can be fragmented but only the first 'x' will be
580 * scheduled.
581 */
582enum {
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300583 TE_V1_FRAG_NONE = 0,
584 TE_V1_FRAG_SINGLE = 1,
585 TE_V1_FRAG_DUAL = 2,
586 TE_V1_FRAG_ENDLESS = 0xffffffff
Johannes Berg8ca151b2013-01-24 14:25:36 +0100587};
588
Johannes Berg8ca151b2013-01-24 14:25:36 +0100589/* If a Time Event can be fragmented, this is the max number of fragments */
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300590#define TE_V1_FRAG_MAX_MSK 0x0fffffff
591/* Repeat the time event endlessly (until removed) */
592#define TE_V1_REPEAT_ENDLESS 0xffffffff
593/* If a Time Event has bounded repetitions, this is the maximal value */
594#define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
595
596/* Time Event dependencies: none, on another TE, or in a specific time */
597enum {
598 TE_V1_INDEPENDENT = 0,
599 TE_V1_DEP_OTHER = BIT(0),
600 TE_V1_DEP_TSF = BIT(1),
601 TE_V1_EVENT_SOCIOPATHIC = BIT(2),
602}; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
603
604/*
605 * @TE_V1_NOTIF_NONE: no notifications
606 * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
607 * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
608 * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
609 * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
610 * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
611 * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
612 * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
613 * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
614 *
615 * Supported Time event notifications configuration.
616 * A notification (both event and fragment) includes a status indicating weather
617 * the FW was able to schedule the event or not. For fragment start/end
618 * notification the status is always success. There is no start/end fragment
619 * notification for monolithic events.
620 */
621enum {
622 TE_V1_NOTIF_NONE = 0,
623 TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
624 TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
625 TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
626 TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
627 TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
628 TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
629 TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
630 TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
631}; /* MAC_EVENT_ACTION_API_E_VER_2 */
632
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300633/* Time event - defines for command API */
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300634
635/*
636 * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
637 * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
638 * the first fragment is scheduled.
639 * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
640 * the first 2 fragments are scheduled.
641 * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
642 * number of fragments are valid.
643 *
644 * Other than the constant defined above, specifying a fragmentation value 'x'
645 * means that the event can be fragmented but only the first 'x' will be
646 * scheduled.
647 */
648enum {
649 TE_V2_FRAG_NONE = 0,
650 TE_V2_FRAG_SINGLE = 1,
651 TE_V2_FRAG_DUAL = 2,
652 TE_V2_FRAG_MAX = 0xfe,
653 TE_V2_FRAG_ENDLESS = 0xff
654};
655
656/* Repeat the time event endlessly (until removed) */
657#define TE_V2_REPEAT_ENDLESS 0xff
658/* If a Time Event has bounded repetitions, this is the maximal value */
659#define TE_V2_REPEAT_MAX 0xfe
660
661#define TE_V2_PLACEMENT_POS 12
662#define TE_V2_ABSENCE_POS 15
663
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300664/* Time event policy values
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300665 * A notification (both event and fragment) includes a status indicating weather
666 * the FW was able to schedule the event or not. For fragment start/end
667 * notification the status is always success. There is no start/end fragment
668 * notification for monolithic events.
669 *
670 * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
671 * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
672 * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
673 * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
674 * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
675 * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
676 * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
677 * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
678 * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
679 * @TE_V2_DEP_OTHER: depends on another time event
680 * @TE_V2_DEP_TSF: depends on a specific time
681 * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
682 * @TE_V2_ABSENCE: are we present or absent during the Time Event.
683 */
684enum {
685 TE_V2_DEFAULT_POLICY = 0x0,
686
687 /* notifications (event start/stop, fragment start/stop) */
688 TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
689 TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
690 TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
691 TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
692
693 TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
694 TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
695 TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
696 TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
Emmanuel Grumbach1f6bf072014-02-16 15:36:00 +0200697 T2_V2_START_IMMEDIATELY = BIT(11),
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300698
699 TE_V2_NOTIF_MSK = 0xff,
700
701 /* placement characteristics */
702 TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
703 TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
704 TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
705
706 /* are we present or absent during the Time Event. */
707 TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
708};
709
710/**
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300711 * struct iwl_time_event_cmd_api - configuring Time Events
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300712 * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
713 * with version 1. determined by IWL_UCODE_TLV_FLAGS)
714 * ( TIME_EVENT_CMD = 0x29 )
715 * @id_and_color: ID and color of the relevant MAC
716 * @action: action to perform, one of FW_CTXT_ACTION_*
717 * @id: this field has two meanings, depending on the action:
718 * If the action is ADD, then it means the type of event to add.
719 * For all other actions it is the unique event ID assigned when the
720 * event was added by the FW.
721 * @apply_time: When to start the Time Event (in GP2)
722 * @max_delay: maximum delay to event's start (apply time), in TU
723 * @depends_on: the unique ID of the event we depend on (if any)
724 * @interval: interval between repetitions, in TU
725 * @duration: duration of event in TU
726 * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
727 * @max_frags: maximal number of fragments the Time Event can be divided to
728 * @policy: defines whether uCode shall notify the host or other uCode modules
729 * on event and/or fragment start and/or end
730 * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
731 * TE_EVENT_SOCIOPATHIC
732 * using TE_ABSENCE and using TE_NOTIF_*
733 */
Emmanuel Grumbacha373f672014-03-30 08:40:46 +0300734struct iwl_time_event_cmd {
Eytan Lifshitzf8f03c32013-08-07 19:36:42 +0300735 /* COMMON_INDEX_HDR_API_S_VER_1 */
736 __le32 id_and_color;
737 __le32 action;
738 __le32 id;
739 /* MAC_TIME_EVENT_DATA_API_S_VER_2 */
740 __le32 apply_time;
741 __le32 max_delay;
742 __le32 depends_on;
743 __le32 interval;
744 __le32 duration;
745 u8 repeat;
746 u8 max_frags;
747 __le16 policy;
748} __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
749
Johannes Berg8ca151b2013-01-24 14:25:36 +0100750/**
751 * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
752 * @status: bit 0 indicates success, all others specify errors
753 * @id: the Time Event type
754 * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
755 * @id_and_color: ID and color of the relevant MAC
756 */
757struct iwl_time_event_resp {
758 __le32 status;
759 __le32 id;
760 __le32 unique_id;
761 __le32 id_and_color;
762} __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
763
764/**
765 * struct iwl_time_event_notif - notifications of time event start/stop
766 * ( TIME_EVENT_NOTIFICATION = 0x2a )
767 * @timestamp: action timestamp in GP2
768 * @session_id: session's unique id
769 * @unique_id: unique id of the Time Event itself
770 * @id_and_color: ID and color of the relevant MAC
771 * @action: one of TE_NOTIF_START or TE_NOTIF_END
772 * @status: true if scheduled, false otherwise (not executed)
773 */
774struct iwl_time_event_notif {
775 __le32 timestamp;
776 __le32 session_id;
777 __le32 unique_id;
778 __le32 id_and_color;
779 __le32 action;
780 __le32 status;
781} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
782
783
784/* Bindings and Time Quota */
785
786/**
787 * struct iwl_binding_cmd - configuring bindings
788 * ( BINDING_CONTEXT_CMD = 0x2b )
789 * @id_and_color: ID and color of the relevant Binding
790 * @action: action to perform, one of FW_CTXT_ACTION_*
791 * @macs: array of MAC id and colors which belong to the binding
792 * @phy: PHY id and color which belongs to the binding
793 */
794struct iwl_binding_cmd {
795 /* COMMON_INDEX_HDR_API_S_VER_1 */
796 __le32 id_and_color;
797 __le32 action;
798 /* BINDING_DATA_API_S_VER_1 */
799 __le32 macs[MAX_MACS_IN_BINDING];
800 __le32 phy;
801} __packed; /* BINDING_CMD_API_S_VER_1 */
802
Ilan Peer35adfd62013-02-04 13:16:24 +0200803/* The maximal number of fragments in the FW's schedule session */
804#define IWL_MVM_MAX_QUOTA 128
805
Johannes Berg8ca151b2013-01-24 14:25:36 +0100806/**
807 * struct iwl_time_quota_data - configuration of time quota per binding
808 * @id_and_color: ID and color of the relevant Binding
809 * @quota: absolute time quota in TU. The scheduler will try to divide the
810 * remainig quota (after Time Events) according to this quota.
811 * @max_duration: max uninterrupted context duration in TU
812 */
813struct iwl_time_quota_data {
814 __le32 id_and_color;
815 __le32 quota;
816 __le32 max_duration;
817} __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
818
819/**
820 * struct iwl_time_quota_cmd - configuration of time quota between bindings
821 * ( TIME_QUOTA_CMD = 0x2c )
822 * @quotas: allocations per binding
823 */
824struct iwl_time_quota_cmd {
825 struct iwl_time_quota_data quotas[MAX_BINDINGS];
826} __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
827
828
829/* PHY context */
830
831/* Supported bands */
832#define PHY_BAND_5 (0)
833#define PHY_BAND_24 (1)
834
835/* Supported channel width, vary if there is VHT support */
836#define PHY_VHT_CHANNEL_MODE20 (0x0)
837#define PHY_VHT_CHANNEL_MODE40 (0x1)
838#define PHY_VHT_CHANNEL_MODE80 (0x2)
839#define PHY_VHT_CHANNEL_MODE160 (0x3)
840
841/*
842 * Control channel position:
843 * For legacy set bit means upper channel, otherwise lower.
844 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
845 * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
846 * center_freq
847 * |
848 * 40Mhz |_______|_______|
849 * 80Mhz |_______|_______|_______|_______|
850 * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
851 * code 011 010 001 000 | 100 101 110 111
852 */
853#define PHY_VHT_CTRL_POS_1_BELOW (0x0)
854#define PHY_VHT_CTRL_POS_2_BELOW (0x1)
855#define PHY_VHT_CTRL_POS_3_BELOW (0x2)
856#define PHY_VHT_CTRL_POS_4_BELOW (0x3)
857#define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
858#define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
859#define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
860#define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
861
862/*
863 * @band: PHY_BAND_*
864 * @channel: channel number
865 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
866 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
867 */
868struct iwl_fw_channel_info {
869 u8 band;
870 u8 channel;
871 u8 width;
872 u8 ctrl_pos;
873} __packed;
874
875#define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
876#define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
877 (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
878#define PHY_RX_CHAIN_VALID_POS (1)
879#define PHY_RX_CHAIN_VALID_MSK \
880 (0x7 << PHY_RX_CHAIN_VALID_POS)
881#define PHY_RX_CHAIN_FORCE_SEL_POS (4)
882#define PHY_RX_CHAIN_FORCE_SEL_MSK \
883 (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
884#define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
885#define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
886 (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
887#define PHY_RX_CHAIN_CNT_POS (10)
888#define PHY_RX_CHAIN_CNT_MSK \
889 (0x3 << PHY_RX_CHAIN_CNT_POS)
890#define PHY_RX_CHAIN_MIMO_CNT_POS (12)
891#define PHY_RX_CHAIN_MIMO_CNT_MSK \
892 (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
893#define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
894#define PHY_RX_CHAIN_MIMO_FORCE_MSK \
895 (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
896
897/* TODO: fix the value, make it depend on firmware at runtime? */
898#define NUM_PHY_CTX 3
899
900/* TODO: complete missing documentation */
901/**
902 * struct iwl_phy_context_cmd - config of the PHY context
903 * ( PHY_CONTEXT_CMD = 0x8 )
904 * @id_and_color: ID and color of the relevant Binding
905 * @action: action to perform, one of FW_CTXT_ACTION_*
906 * @apply_time: 0 means immediate apply and context switch.
907 * other value means apply new params after X usecs
908 * @tx_param_color: ???
909 * @channel_info:
910 * @txchain_info: ???
911 * @rxchain_info: ???
912 * @acquisition_data: ???
913 * @dsp_cfg_flags: set to 0
914 */
915struct iwl_phy_context_cmd {
916 /* COMMON_INDEX_HDR_API_S_VER_1 */
917 __le32 id_and_color;
918 __le32 action;
919 /* PHY_CONTEXT_DATA_API_S_VER_1 */
920 __le32 apply_time;
921 __le32 tx_param_color;
922 struct iwl_fw_channel_info ci;
923 __le32 txchain_info;
924 __le32 rxchain_info;
925 __le32 acquisition_data;
926 __le32 dsp_cfg_flags;
927} __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
928
Ariej Marjieh720befbf2014-07-07 09:04:58 +0300929/*
930 * Aux ROC command
931 *
932 * Command requests the firmware to create a time event for a certain duration
933 * and remain on the given channel. This is done by using the Aux framework in
934 * the FW.
935 * The command was first used for Hot Spot issues - but can be used regardless
936 * to Hot Spot.
937 *
938 * ( HOT_SPOT_CMD 0x53 )
939 *
940 * @id_and_color: ID and color of the MAC
941 * @action: action to perform, one of FW_CTXT_ACTION_*
942 * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
943 * event_unique_id should be the id of the time event assigned by ucode.
944 * Otherwise ignore the event_unique_id.
945 * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
946 * activity.
947 * @channel_info: channel info
948 * @node_addr: Our MAC Address
949 * @reserved: reserved for alignment
950 * @apply_time: GP2 value to start (should always be the current GP2 value)
951 * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
952 * time by which start of the event is allowed to be postponed.
953 * @duration: event duration in TU To calculate event duration:
954 * timeEventDuration = min(duration, remainingQuota)
955 */
956struct iwl_hs20_roc_req {
957 /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
958 __le32 id_and_color;
959 __le32 action;
960 __le32 event_unique_id;
961 __le32 sta_id_and_color;
962 struct iwl_fw_channel_info channel_info;
963 u8 node_addr[ETH_ALEN];
964 __le16 reserved;
965 __le32 apply_time;
966 __le32 apply_time_max_delay;
967 __le32 duration;
968} __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
969
970/*
971 * values for AUX ROC result values
972 */
973enum iwl_mvm_hot_spot {
974 HOT_SPOT_RSP_STATUS_OK,
975 HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
976 HOT_SPOT_MAX_NUM_OF_SESSIONS,
977};
978
979/*
980 * Aux ROC command response
981 *
982 * In response to iwl_hs20_roc_req the FW sends this command to notify the
983 * driver the uid of the timevent.
984 *
985 * ( HOT_SPOT_CMD 0x53 )
986 *
987 * @event_unique_id: Unique ID of time event assigned by ucode
988 * @status: Return status 0 is success, all the rest used for specific errors
989 */
990struct iwl_hs20_roc_res {
991 __le32 event_unique_id;
992 __le32 status;
993} __packed; /* HOT_SPOT_RSP_API_S_VER_1 */
994
Johannes Berg8ca151b2013-01-24 14:25:36 +0100995#define IWL_RX_INFO_PHY_CNT 8
Avri Altmana2d7b872013-07-09 01:42:17 +0300996#define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
997#define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
998#define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
999#define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
1000#define IWL_RX_INFO_ENERGY_ANT_A_POS 0
1001#define IWL_RX_INFO_ENERGY_ANT_B_POS 8
1002#define IWL_RX_INFO_ENERGY_ANT_C_POS 16
1003
Johannes Berg8ca151b2013-01-24 14:25:36 +01001004#define IWL_RX_INFO_AGC_IDX 1
1005#define IWL_RX_INFO_RSSI_AB_IDX 2
Emmanuel Grumbach8101a7f2013-02-28 11:54:28 +02001006#define IWL_OFDM_AGC_A_MSK 0x0000007f
1007#define IWL_OFDM_AGC_A_POS 0
1008#define IWL_OFDM_AGC_B_MSK 0x00003f80
1009#define IWL_OFDM_AGC_B_POS 7
1010#define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
1011#define IWL_OFDM_AGC_CODE_POS 20
Johannes Berg8ca151b2013-01-24 14:25:36 +01001012#define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
Johannes Berg8ca151b2013-01-24 14:25:36 +01001013#define IWL_OFDM_RSSI_A_POS 0
Emmanuel Grumbach8101a7f2013-02-28 11:54:28 +02001014#define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
1015#define IWL_OFDM_RSSI_ALLBAND_A_POS 8
Johannes Berg8ca151b2013-01-24 14:25:36 +01001016#define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
Johannes Berg8ca151b2013-01-24 14:25:36 +01001017#define IWL_OFDM_RSSI_B_POS 16
Emmanuel Grumbach8101a7f2013-02-28 11:54:28 +02001018#define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
1019#define IWL_OFDM_RSSI_ALLBAND_B_POS 24
Johannes Berg8ca151b2013-01-24 14:25:36 +01001020
1021/**
1022 * struct iwl_rx_phy_info - phy info
1023 * (REPLY_RX_PHY_CMD = 0xc0)
1024 * @non_cfg_phy_cnt: non configurable DSP phy data byte count
1025 * @cfg_phy_cnt: configurable DSP phy data byte count
1026 * @stat_id: configurable DSP phy data set ID
1027 * @reserved1:
1028 * @system_timestamp: GP2 at on air rise
1029 * @timestamp: TSF at on air rise
1030 * @beacon_time_stamp: beacon at on-air rise
1031 * @phy_flags: general phy flags: band, modulation, ...
1032 * @channel: channel number
1033 * @non_cfg_phy_buf: for various implementations of non_cfg_phy
1034 * @rate_n_flags: RATE_MCS_*
1035 * @byte_count: frame's byte-count
1036 * @frame_time: frame's time on the air, based on byte count and frame rate
1037 * calculation
Emmanuel Grumbach6bfcb7e2013-03-03 10:19:45 +02001038 * @mac_active_msk: what MACs were active when the frame was received
Johannes Berg8ca151b2013-01-24 14:25:36 +01001039 *
1040 * Before each Rx, the device sends this data. It contains PHY information
1041 * about the reception of the packet.
1042 */
1043struct iwl_rx_phy_info {
1044 u8 non_cfg_phy_cnt;
1045 u8 cfg_phy_cnt;
1046 u8 stat_id;
1047 u8 reserved1;
1048 __le32 system_timestamp;
1049 __le64 timestamp;
1050 __le32 beacon_time_stamp;
1051 __le16 phy_flags;
1052 __le16 channel;
1053 __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
1054 __le32 rate_n_flags;
1055 __le32 byte_count;
Emmanuel Grumbach6bfcb7e2013-03-03 10:19:45 +02001056 __le16 mac_active_msk;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001057 __le16 frame_time;
1058} __packed;
1059
1060struct iwl_rx_mpdu_res_start {
1061 __le16 byte_count;
1062 __le16 reserved;
1063} __packed;
1064
1065/**
1066 * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
1067 * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
1068 * @RX_RES_PHY_FLAGS_MOD_CCK:
1069 * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
1070 * @RX_RES_PHY_FLAGS_NARROW_BAND:
1071 * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
1072 * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
1073 * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
1074 * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
1075 * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
1076 */
1077enum iwl_rx_phy_flags {
1078 RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
1079 RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
1080 RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
1081 RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
1082 RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
1083 RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
1084 RX_RES_PHY_FLAGS_AGG = BIT(7),
1085 RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
1086 RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
1087 RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
1088};
1089
1090/**
1091 * enum iwl_mvm_rx_status - written by fw for each Rx packet
1092 * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
1093 * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
1094 * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
1095 * @RX_MPDU_RES_STATUS_KEY_VALID:
1096 * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
1097 * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
1098 * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
1099 * in the driver.
1100 * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
1101 * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
1102 * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
1103 * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
1104 * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
1105 * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
1106 * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
1107 * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
1108 * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
1109 * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
1110 * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
1111 * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
1112 * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
1113 * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
1114 * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
1115 * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
1116 * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
1117 * @RX_MPDU_RES_STATUS_STA_ID_MSK:
1118 * @RX_MPDU_RES_STATUS_RRF_KILL:
1119 * @RX_MPDU_RES_STATUS_FILTERING_MSK:
1120 * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
1121 */
1122enum iwl_mvm_rx_status {
1123 RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
1124 RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
1125 RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
1126 RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
1127 RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
1128 RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
1129 RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
1130 RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
1131 RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
1132 RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
1133 RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
1134 RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
1135 RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
Max Stepanove36e5432013-08-27 19:56:13 +03001136 RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
Johannes Berg8ca151b2013-01-24 14:25:36 +01001137 RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
1138 RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
1139 RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
1140 RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
1141 RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
1142 RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
1143 RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
1144 RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
1145 RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
1146 RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
1147 RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
1148 RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
1149 RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
1150};
1151
1152/**
1153 * struct iwl_radio_version_notif - information on the radio version
1154 * ( RADIO_VERSION_NOTIFICATION = 0x68 )
1155 * @radio_flavor:
1156 * @radio_step:
1157 * @radio_dash:
1158 */
1159struct iwl_radio_version_notif {
1160 __le32 radio_flavor;
1161 __le32 radio_step;
1162 __le32 radio_dash;
1163} __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
1164
1165enum iwl_card_state_flags {
1166 CARD_ENABLED = 0x00,
1167 HW_CARD_DISABLED = 0x01,
1168 SW_CARD_DISABLED = 0x02,
1169 CT_KILL_CARD_DISABLED = 0x04,
1170 HALT_CARD_DISABLED = 0x08,
1171 CARD_DISABLED_MSK = 0x0f,
1172 CARD_IS_RX_ON = 0x10,
1173};
1174
1175/**
1176 * struct iwl_radio_version_notif - information on the radio version
1177 * ( CARD_STATE_NOTIFICATION = 0xa1 )
1178 * @flags: %iwl_card_state_flags
1179 */
1180struct iwl_card_state_notif {
1181 __le32 flags;
1182} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
1183
1184/**
Hila Gonend64048e2013-03-13 18:00:03 +02001185 * struct iwl_missed_beacons_notif - information on missed beacons
1186 * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
1187 * @mac_id: interface ID
1188 * @consec_missed_beacons_since_last_rx: number of consecutive missed
1189 * beacons since last RX.
1190 * @consec_missed_beacons: number of consecutive missed beacons
1191 * @num_expected_beacons:
1192 * @num_recvd_beacons:
1193 */
1194struct iwl_missed_beacons_notif {
1195 __le32 mac_id;
1196 __le32 consec_missed_beacons_since_last_rx;
1197 __le32 consec_missed_beacons;
1198 __le32 num_expected_beacons;
1199 __le32 num_recvd_beacons;
1200} __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
1201
1202/**
Johannes Berg8ca151b2013-01-24 14:25:36 +01001203 * struct iwl_set_calib_default_cmd - set default value for calibration.
1204 * ( SET_CALIB_DEFAULT_CMD = 0x8e )
1205 * @calib_index: the calibration to set value for
1206 * @length: of data
1207 * @data: the value to set for the calibration result
1208 */
1209struct iwl_set_calib_default_cmd {
1210 __le16 calib_index;
1211 __le16 length;
1212 u8 data[0];
1213} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
1214
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +03001215#define MAX_PORT_ID_NUM 2
Eliad Pellere59647e2013-11-28 14:08:50 +02001216#define MAX_MCAST_FILTERING_ADDRESSES 256
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +03001217
1218/**
1219 * struct iwl_mcast_filter_cmd - configure multicast filter.
1220 * @filter_own: Set 1 to filter out multicast packets sent by station itself
1221 * @port_id: Multicast MAC addresses array specifier. This is a strange way
1222 * to identify network interface adopted in host-device IF.
1223 * It is used by FW as index in array of addresses. This array has
1224 * MAX_PORT_ID_NUM members.
1225 * @count: Number of MAC addresses in the array
1226 * @pass_all: Set 1 to pass all multicast packets.
1227 * @bssid: current association BSSID.
1228 * @addr_list: Place holder for array of MAC addresses.
1229 * IMPORTANT: add padding if necessary to ensure DWORD alignment.
1230 */
1231struct iwl_mcast_filter_cmd {
1232 u8 filter_own;
1233 u8 port_id;
1234 u8 count;
1235 u8 pass_all;
1236 u8 bssid[6];
1237 u8 reserved[2];
1238 u8 addr_list[0];
1239} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
1240
Eliad Pellerc87163b2014-01-08 10:11:11 +02001241#define MAX_BCAST_FILTERS 8
1242#define MAX_BCAST_FILTER_ATTRS 2
1243
1244/**
1245 * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
1246 * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
1247 * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
1248 * start of ip payload).
1249 */
1250enum iwl_mvm_bcast_filter_attr_offset {
1251 BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
1252 BCAST_FILTER_OFFSET_IP_END = 1,
1253};
1254
1255/**
1256 * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
1257 * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset.
1258 * @offset: starting offset of this pattern.
1259 * @val: value to match - big endian (MSB is the first
1260 * byte to match from offset pos).
1261 * @mask: mask to match (big endian).
1262 */
1263struct iwl_fw_bcast_filter_attr {
1264 u8 offset_type;
1265 u8 offset;
1266 __le16 reserved1;
1267 __be32 val;
1268 __be32 mask;
1269} __packed; /* BCAST_FILTER_ATT_S_VER_1 */
1270
1271/**
1272 * enum iwl_mvm_bcast_filter_frame_type - filter frame type
1273 * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
1274 * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
1275 */
1276enum iwl_mvm_bcast_filter_frame_type {
1277 BCAST_FILTER_FRAME_TYPE_ALL = 0,
1278 BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
1279};
1280
1281/**
1282 * struct iwl_fw_bcast_filter - broadcast filter
1283 * @discard: discard frame (1) or let it pass (0).
1284 * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
1285 * @num_attrs: number of valid attributes in this filter.
1286 * @attrs: attributes of this filter. a filter is considered matched
1287 * only when all its attributes are matched (i.e. AND relationship)
1288 */
1289struct iwl_fw_bcast_filter {
1290 u8 discard;
1291 u8 frame_type;
1292 u8 num_attrs;
1293 u8 reserved1;
1294 struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
1295} __packed; /* BCAST_FILTER_S_VER_1 */
1296
1297/**
1298 * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
1299 * @default_discard: default action for this mac (discard (1) / pass (0)).
1300 * @attached_filters: bitmap of relevant filters for this mac.
1301 */
1302struct iwl_fw_bcast_mac {
1303 u8 default_discard;
1304 u8 reserved1;
1305 __le16 attached_filters;
1306} __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
1307
1308/**
1309 * struct iwl_bcast_filter_cmd - broadcast filtering configuration
1310 * @disable: enable (0) / disable (1)
1311 * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
1312 * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
1313 * @filters: broadcast filters
1314 * @macs: broadcast filtering configuration per-mac
1315 */
1316struct iwl_bcast_filter_cmd {
1317 u8 disable;
1318 u8 max_bcast_filters;
1319 u8 max_macs;
1320 u8 reserved1;
1321 struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
1322 struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
1323} __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
1324
Matti Gottlieba2d79c52014-08-25 14:41:23 +03001325/*
1326 * enum iwl_mvm_marker_id - maker ids
1327 *
1328 * The ids for different type of markers to insert into the usniffer logs
1329 */
1330enum iwl_mvm_marker_id {
1331 MARKER_ID_TX_FRAME_LATENCY = 1,
1332}; /* MARKER_ID_API_E_VER_1 */
1333
1334/**
1335 * struct iwl_mvm_marker - mark info into the usniffer logs
1336 *
1337 * (MARKER_CMD = 0xcb)
1338 *
1339 * Mark the UTC time stamp into the usniffer logs together with additional
1340 * metadata, so the usniffer output can be parsed.
1341 * In the command response the ucode will return the GP2 time.
1342 *
1343 * @dw_len: The amount of dwords following this byte including this byte.
1344 * @marker_id: A unique marker id (iwl_mvm_marker_id).
1345 * @reserved: reserved.
1346 * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
1347 * @metadata: additional meta data that will be written to the unsiffer log
1348 */
1349struct iwl_mvm_marker {
1350 u8 dwLen;
1351 u8 markerId;
1352 __le16 reserved;
1353 __le64 timestamp;
1354 __le32 metadata[0];
1355} __packed; /* MARKER_API_S_VER_1 */
1356
Eytan Lifshitz9ee718a2013-05-19 19:14:41 +03001357struct mvm_statistics_dbg {
1358 __le32 burst_check;
1359 __le32 burst_count;
1360 __le32 wait_for_silence_timeout_cnt;
1361 __le32 reserved[3];
1362} __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
1363
1364struct mvm_statistics_div {
1365 __le32 tx_on_a;
1366 __le32 tx_on_b;
1367 __le32 exec_time;
1368 __le32 probe_time;
1369 __le32 rssi_ant;
1370 __le32 reserved2;
1371} __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
1372
1373struct mvm_statistics_general_common {
1374 __le32 temperature; /* radio temperature */
1375 __le32 temperature_m; /* radio voltage */
1376 struct mvm_statistics_dbg dbg;
1377 __le32 sleep_time;
1378 __le32 slots_out;
1379 __le32 slots_idle;
1380 __le32 ttl_timestamp;
1381 struct mvm_statistics_div div;
1382 __le32 rx_enable_counter;
1383 /*
1384 * num_of_sos_states:
1385 * count the number of times we have to re-tune
1386 * in order to get out of bad PHY status
1387 */
1388 __le32 num_of_sos_states;
1389} __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
1390
1391struct mvm_statistics_rx_non_phy {
1392 __le32 bogus_cts; /* CTS received when not expecting CTS */
1393 __le32 bogus_ack; /* ACK received when not expecting ACK */
1394 __le32 non_bssid_frames; /* number of frames with BSSID that
1395 * doesn't belong to the STA BSSID */
1396 __le32 filtered_frames; /* count frames that were dumped in the
1397 * filtering process */
1398 __le32 non_channel_beacons; /* beacons with our bss id but not on
1399 * our serving channel */
1400 __le32 channel_beacons; /* beacons with our bss id and in our
1401 * serving channel */
1402 __le32 num_missed_bcon; /* number of missed beacons */
1403 __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
1404 * ADC was in saturation */
1405 __le32 ina_detection_search_time;/* total time (in 0.8us) searched
1406 * for INA */
1407 __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
1408 __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
1409 __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
1410 __le32 interference_data_flag; /* flag for interference data
1411 * availability. 1 when data is
1412 * available. */
1413 __le32 channel_load; /* counts RX Enable time in uSec */
1414 __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
1415 * and CCK) counter */
1416 __le32 beacon_rssi_a;
1417 __le32 beacon_rssi_b;
1418 __le32 beacon_rssi_c;
1419 __le32 beacon_energy_a;
1420 __le32 beacon_energy_b;
1421 __le32 beacon_energy_c;
1422 __le32 num_bt_kills;
1423 __le32 mac_id;
1424 __le32 directed_data_mpdu;
1425} __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
1426
1427struct mvm_statistics_rx_phy {
1428 __le32 ina_cnt;
1429 __le32 fina_cnt;
1430 __le32 plcp_err;
1431 __le32 crc32_err;
1432 __le32 overrun_err;
1433 __le32 early_overrun_err;
1434 __le32 crc32_good;
1435 __le32 false_alarm_cnt;
1436 __le32 fina_sync_err_cnt;
1437 __le32 sfd_timeout;
1438 __le32 fina_timeout;
1439 __le32 unresponded_rts;
1440 __le32 rxe_frame_limit_overrun;
1441 __le32 sent_ack_cnt;
1442 __le32 sent_cts_cnt;
1443 __le32 sent_ba_rsp_cnt;
1444 __le32 dsp_self_kill;
1445 __le32 mh_format_err;
1446 __le32 re_acq_main_rssi_sum;
1447 __le32 reserved;
1448} __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
1449
1450struct mvm_statistics_rx_ht_phy {
1451 __le32 plcp_err;
1452 __le32 overrun_err;
1453 __le32 early_overrun_err;
1454 __le32 crc32_good;
1455 __le32 crc32_err;
1456 __le32 mh_format_err;
1457 __le32 agg_crc32_good;
1458 __le32 agg_mpdu_cnt;
1459 __le32 agg_cnt;
1460 __le32 unsupport_mcs;
1461} __packed; /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
1462
1463#define MAX_CHAINS 3
1464
1465struct mvm_statistics_tx_non_phy_agg {
1466 __le32 ba_timeout;
1467 __le32 ba_reschedule_frames;
1468 __le32 scd_query_agg_frame_cnt;
1469 __le32 scd_query_no_agg;
1470 __le32 scd_query_agg;
1471 __le32 scd_query_mismatch;
1472 __le32 frame_not_ready;
1473 __le32 underrun;
1474 __le32 bt_prio_kill;
1475 __le32 rx_ba_rsp_cnt;
1476 __s8 txpower[MAX_CHAINS];
1477 __s8 reserved;
1478 __le32 reserved2;
1479} __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
1480
1481struct mvm_statistics_tx_channel_width {
1482 __le32 ext_cca_narrow_ch20[1];
1483 __le32 ext_cca_narrow_ch40[2];
1484 __le32 ext_cca_narrow_ch80[3];
1485 __le32 ext_cca_narrow_ch160[4];
1486 __le32 last_tx_ch_width_indx;
1487 __le32 rx_detected_per_ch_width[4];
1488 __le32 success_per_ch_width[4];
1489 __le32 fail_per_ch_width[4];
1490}; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
1491
1492struct mvm_statistics_tx {
1493 __le32 preamble_cnt;
1494 __le32 rx_detected_cnt;
1495 __le32 bt_prio_defer_cnt;
1496 __le32 bt_prio_kill_cnt;
1497 __le32 few_bytes_cnt;
1498 __le32 cts_timeout;
1499 __le32 ack_timeout;
1500 __le32 expected_ack_cnt;
1501 __le32 actual_ack_cnt;
1502 __le32 dump_msdu_cnt;
1503 __le32 burst_abort_next_frame_mismatch_cnt;
1504 __le32 burst_abort_missing_next_frame_cnt;
1505 __le32 cts_timeout_collision;
1506 __le32 ack_or_ba_timeout_collision;
1507 struct mvm_statistics_tx_non_phy_agg agg;
1508 struct mvm_statistics_tx_channel_width channel_width;
1509} __packed; /* STATISTICS_TX_API_S_VER_4 */
1510
1511
1512struct mvm_statistics_bt_activity {
1513 __le32 hi_priority_tx_req_cnt;
1514 __le32 hi_priority_tx_denied_cnt;
1515 __le32 lo_priority_tx_req_cnt;
1516 __le32 lo_priority_tx_denied_cnt;
1517 __le32 hi_priority_rx_req_cnt;
1518 __le32 hi_priority_rx_denied_cnt;
1519 __le32 lo_priority_rx_req_cnt;
1520 __le32 lo_priority_rx_denied_cnt;
1521} __packed; /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
1522
1523struct mvm_statistics_general {
1524 struct mvm_statistics_general_common common;
1525 __le32 beacon_filtered;
1526 __le32 missed_beacons;
Andrei Otcheretianskia20fd392013-07-21 17:23:59 +03001527 __s8 beacon_filter_average_energy;
Eytan Lifshitz9ee718a2013-05-19 19:14:41 +03001528 __s8 beacon_filter_reason;
1529 __s8 beacon_filter_current_energy;
1530 __s8 beacon_filter_reserved;
1531 __le32 beacon_filter_delta_time;
1532 struct mvm_statistics_bt_activity bt_activity;
1533} __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
1534
1535struct mvm_statistics_rx {
1536 struct mvm_statistics_rx_phy ofdm;
1537 struct mvm_statistics_rx_phy cck;
1538 struct mvm_statistics_rx_non_phy general;
1539 struct mvm_statistics_rx_ht_phy ofdm_ht;
1540} __packed; /* STATISTICS_RX_API_S_VER_3 */
1541
1542/*
1543 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
1544 *
1545 * By default, uCode issues this notification after receiving a beacon
1546 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
1547 * REPLY_STATISTICS_CMD 0x9c, above.
1548 *
1549 * Statistics counters continue to increment beacon after beacon, but are
1550 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
1551 * 0x9c with CLEAR_STATS bit set (see above).
1552 *
1553 * uCode also issues this notification during scans. uCode clears statistics
1554 * appropriately so that each notification contains statistics for only the
1555 * one channel that has just been scanned.
1556 */
1557
1558struct iwl_notif_statistics { /* STATISTICS_NTFY_API_S_VER_8 */
1559 __le32 flag;
1560 struct mvm_statistics_rx rx;
1561 struct mvm_statistics_tx tx;
1562 struct mvm_statistics_general general;
1563} __packed;
1564
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001565/***********************************
1566 * Smart Fifo API
1567 ***********************************/
1568/* Smart Fifo state */
1569enum iwl_sf_state {
1570 SF_LONG_DELAY_ON = 0, /* should never be called by driver */
1571 SF_FULL_ON,
1572 SF_UNINIT,
1573 SF_INIT_OFF,
1574 SF_HW_NUM_STATES
1575};
1576
1577/* Smart Fifo possible scenario */
1578enum iwl_sf_scenario {
1579 SF_SCENARIO_SINGLE_UNICAST,
1580 SF_SCENARIO_AGG_UNICAST,
1581 SF_SCENARIO_MULTICAST,
1582 SF_SCENARIO_BA_RESP,
1583 SF_SCENARIO_TX_RESP,
1584 SF_NUM_SCENARIO
1585};
1586
1587#define SF_TRANSIENT_STATES_NUMBER 2 /* SF_LONG_DELAY_ON and SF_FULL_ON */
1588#define SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */
1589
1590/* smart FIFO default values */
1591#define SF_W_MARK_SISO 4096
1592#define SF_W_MARK_MIMO2 8192
1593#define SF_W_MARK_MIMO3 6144
1594#define SF_W_MARK_LEGACY 4096
1595#define SF_W_MARK_SCAN 4096
1596
1597/* SF Scenarios timers for FULL_ON state (aligned to 32 uSec) */
1598#define SF_SINGLE_UNICAST_IDLE_TIMER 320 /* 300 uSec */
1599#define SF_SINGLE_UNICAST_AGING_TIMER 2016 /* 2 mSec */
1600#define SF_AGG_UNICAST_IDLE_TIMER 320 /* 300 uSec */
1601#define SF_AGG_UNICAST_AGING_TIMER 2016 /* 2 mSec */
1602#define SF_MCAST_IDLE_TIMER 2016 /* 2 mSec */
1603#define SF_MCAST_AGING_TIMER 10016 /* 10 mSec */
1604#define SF_BA_IDLE_TIMER 320 /* 300 uSec */
1605#define SF_BA_AGING_TIMER 2016 /* 2 mSec */
1606#define SF_TX_RE_IDLE_TIMER 320 /* 300 uSec */
1607#define SF_TX_RE_AGING_TIMER 2016 /* 2 mSec */
1608
1609#define SF_LONG_DELAY_AGING_TIMER 1000000 /* 1 Sec */
1610
Eran Harary161bdb72014-07-27 08:03:06 +03001611#define SF_CFG_DUMMY_NOTIF_OFF BIT(16)
1612
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001613/**
1614 * Smart Fifo configuration command.
Emmanuel Grumbach86974bf2014-07-31 14:32:37 +03001615 * @state: smart fifo state, types listed in enum %iwl_sf_sate.
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001616 * @watermark: Minimum allowed availabe free space in RXF for transient state.
1617 * @long_delay_timeouts: aging and idle timer values for each scenario
1618 * in long delay state.
1619 * @full_on_timeouts: timer values for each scenario in full on state.
1620 */
1621struct iwl_sf_cfg_cmd {
Emmanuel Grumbach86974bf2014-07-31 14:32:37 +03001622 __le32 state;
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +02001623 __le32 watermark[SF_TRANSIENT_STATES_NUMBER];
1624 __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1625 __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1626} __packed; /* SF_CFG_API_S_VER_2 */
1627
Luciano Coelhoa0a092432014-09-04 12:29:15 +03001628/* DTS measurements */
1629
1630enum iwl_dts_measurement_flags {
1631 DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0),
1632 DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1),
1633};
1634
1635/**
1636 * iwl_dts_measurement_cmd - request DTS temperature and/or voltage measurements
1637 *
1638 * @flags: indicates which measurements we want as specified in &enum
1639 * iwl_dts_measurement_flags
1640 */
1641struct iwl_dts_measurement_cmd {
1642 __le32 flags;
1643} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
1644
1645/**
1646 * iwl_dts_measurement_notif - notification received with the measurements
1647 *
1648 * @temp: the measured temperature
1649 * @voltage: the measured voltage
1650 */
1651struct iwl_dts_measurement_notif {
1652 __le32 temp;
1653 __le32 voltage;
1654} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S */
1655
Avri Altman3edf8ff2014-07-30 11:41:01 +03001656/**
1657 * enum iwl_scd_control - scheduler config command control flags
1658 * @IWL_SCD_CONTROL_RM_TID: remove TID from this queue
1659 * @IWL_SCD_CONTROL_SET_SSN: use the SSN and program it into HW
1660 */
1661enum iwl_scd_control {
1662 IWL_SCD_CONTROL_RM_TID = BIT(4),
1663 IWL_SCD_CONTROL_SET_SSN = BIT(5),
1664};
1665
1666/**
1667 * enum iwl_scd_flags - scheduler config command flags
1668 * @IWL_SCD_FLAGS_SHARE_TID: multiple TIDs map to this queue
1669 * @IWL_SCD_FLAGS_SHARE_RA: multiple RAs map to this queue
1670 * @IWL_SCD_FLAGS_DQA_ENABLED: DQA is enabled
1671 */
1672enum iwl_scd_flags {
1673 IWL_SCD_FLAGS_SHARE_TID = BIT(0),
1674 IWL_SCD_FLAGS_SHARE_RA = BIT(1),
1675 IWL_SCD_FLAGS_DQA_ENABLED = BIT(2),
1676};
1677
1678#define IWL_SCDQ_INVALID_STA 0xff
1679
1680/**
1681 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command
1682 * @token: dialog token addba - unused legacy
1683 * @sta_id: station id 4-bit
1684 * @tid: TID 0..7
1685 * @scd_queue: TFD queue num 0 .. 31
1686 * @enable: 1 queue enable, 0 queue disable
1687 * @aggregate: 1 aggregated queue, 0 otherwise
1688 * @tx_fifo: tx fifo num 0..7
1689 * @window: up to 64
1690 * @ssn: starting seq num 12-bit
1691 * @control: command control flags
1692 * @flags: flags - see &enum iwl_scd_flags
1693 *
1694 * Note that every time the command is sent, all parameters must
1695 * be filled with the exception of
1696 * - the SSN, which is only used with @IWL_SCD_CONTROL_SET_SSN
1697 * - the window, which is only relevant when starting aggregation
1698 */
1699struct iwl_scd_txq_cfg_cmd {
1700 u8 token;
1701 u8 sta_id;
1702 u8 tid;
1703 u8 scd_queue;
1704 u8 enable;
1705 u8 aggregate;
1706 u8 tx_fifo;
1707 u8 window;
1708 __le16 ssn;
1709 u8 control;
1710 u8 flags;
1711} __packed;
1712
Johannes Berg8ca151b2013-01-24 14:25:36 +01001713#endif /* __fw_api_h__ */