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