1 /* $OpenBSD: if_iwmreg.h,v 1.4 2015/06/15 08:06:11 stsp Exp $ */
2
3 /******************************************************************************
4 *
5 * This file is provided under a dual BSD/GPLv2 license. When using or
6 * redistributing this file, you may do so under either license.
7 *
8 * GPL LICENSE SUMMARY
9 *
10 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING.
28 *
29 * Contact Information:
30 * Intel Linux Wireless <ilw@linux.intel.com>
31 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32 *
33 * BSD LICENSE
34 *
35 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
36 * 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 #ifndef __IF_IWM_REG_H__
66 #define __IF_IWM_REG_H__
67
68 #define le16_to_cpup(_a_) (le16toh(*(const uint16_t *)(_a_)))
69 #define le32_to_cpup(_a_) (le32toh(*(const uint32_t *)(_a_)))
70
71 /*
72 * BEGIN iwl-csr.h
73 */
74
75 /*
76 * CSR (control and status registers)
77 *
78 * CSR registers are mapped directly into PCI bus space, and are accessible
79 * whenever platform supplies power to device, even when device is in
80 * low power states due to driver-invoked device resets
81 * (e.g. IWM_CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes.
82 *
83 * Use iwl_write32() and iwl_read32() family to access these registers;
84 * these provide simple PCI bus access, without waking up the MAC.
85 * Do not use iwl_write_direct32() family for these registers;
86 * no need to "grab nic access" via IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ.
87 * The MAC (uCode processor, etc.) does not need to be powered up for accessing
88 * the CSR registers.
89 *
90 * NOTE: Device does need to be awake in order to read this memory
91 * via IWM_CSR_EEPROM and IWM_CSR_OTP registers
92 */
93 #define IWM_CSR_HW_IF_CONFIG_REG (0x000) /* hardware interface config */
94 #define IWM_CSR_INT_COALESCING (0x004) /* accum ints, 32-usec units */
95 #define IWM_CSR_INT (0x008) /* host interrupt status/ack */
96 #define IWM_CSR_INT_MASK (0x00c) /* host interrupt enable */
97 #define IWM_CSR_FH_INT_STATUS (0x010) /* busmaster int status/ack*/
98 #define IWM_CSR_GPIO_IN (0x018) /* read external chip pins */
99 #define IWM_CSR_RESET (0x020) /* busmaster enable, NMI, etc*/
100 #define IWM_CSR_GP_CNTRL (0x024)
101
102 /* 2nd byte of IWM_CSR_INT_COALESCING, not accessible via iwl_write32()! */
103 #define IWM_CSR_INT_PERIODIC_REG (0x005)
104
105 /*
106 * Hardware revision info
107 * Bit fields:
108 * 31-16: Reserved
109 * 15-4: Type of device: see IWM_CSR_HW_REV_TYPE_xxx definitions
110 * 3-2: Revision step: 0 = A, 1 = B, 2 = C, 3 = D
111 * 1-0: "Dash" (-) value, as in A-1, etc.
112 */
113 #define IWM_CSR_HW_REV (0x028)
114
115 /*
116 * EEPROM and OTP (one-time-programmable) memory reads
117 *
118 * NOTE: Device must be awake, initialized via apm_ops.init(),
119 * in order to read.
120 */
121 #define IWM_CSR_EEPROM_REG (0x02c)
122 #define IWM_CSR_EEPROM_GP (0x030)
123 #define IWM_CSR_OTP_GP_REG (0x034)
124
125 #define IWM_CSR_GIO_REG (0x03C)
126 #define IWM_CSR_GP_UCODE_REG (0x048)
127 #define IWM_CSR_GP_DRIVER_REG (0x050)
128
129 /*
130 * UCODE-DRIVER GP (general purpose) mailbox registers.
131 * SET/CLR registers set/clear bit(s) if "1" is written.
132 */
133 #define IWM_CSR_UCODE_DRV_GP1 (0x054)
134 #define IWM_CSR_UCODE_DRV_GP1_SET (0x058)
135 #define IWM_CSR_UCODE_DRV_GP1_CLR (0x05c)
136 #define IWM_CSR_UCODE_DRV_GP2 (0x060)
137
138 #define IWM_CSR_MBOX_SET_REG (0x088)
139 #define IWM_CSR_MBOX_SET_REG_OS_ALIVE 0x20
140
141 #define IWM_CSR_LED_REG (0x094)
142 #define IWM_CSR_DRAM_INT_TBL_REG (0x0A0)
143 #define IWM_CSR_MAC_SHADOW_REG_CTRL (0x0A8) /* 6000 and up */
144
145
146 /* GIO Chicken Bits (PCI Express bus link power management) */
147 #define IWM_CSR_GIO_CHICKEN_BITS (0x100)
148
149 /* Analog phase-lock-loop configuration */
150 #define IWM_CSR_ANA_PLL_CFG (0x20c)
151
152 /*
153 * CSR Hardware Revision Workaround Register. Indicates hardware rev;
154 * "step" determines CCK backoff for txpower calculation. Used for 4965 only.
155 * See also IWM_CSR_HW_REV register.
156 * Bit fields:
157 * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step
158 * 1-0: "Dash" (-) value, as in C-1, etc.
159 */
160 #define IWM_CSR_HW_REV_WA_REG (0x22C)
161
162 #define IWM_CSR_DBG_HPET_MEM_REG (0x240)
163 #define IWM_CSR_DBG_LINK_PWR_MGMT_REG (0x250)
164
165 /* Bits for IWM_CSR_HW_IF_CONFIG_REG */
166 #define IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH (0x00000003)
167 #define IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP (0x0000000C)
168 #define IWM_CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x000000C0)
169 #define IWM_CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
170 #define IWM_CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
171 #define IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE (0x00000C00)
172 #define IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH (0x00003000)
173 #define IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP (0x0000C000)
174
175 #define IWM_CSR_HW_IF_CONFIG_REG_POS_MAC_DASH (0)
176 #define IWM_CSR_HW_IF_CONFIG_REG_POS_MAC_STEP (2)
177 #define IWM_CSR_HW_IF_CONFIG_REG_POS_BOARD_VER (6)
178 #define IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE (10)
179 #define IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_DASH (12)
180 #define IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_STEP (14)
181
182 #define IWM_CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000)
183 #define IWM_CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000)
184 #define IWM_CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */
185 #define IWM_CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */
186 #define IWM_CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */
187 #define IWM_CSR_HW_IF_CONFIG_REG_ENABLE_PME (0x10000000)
188 #define IWM_CSR_HW_IF_CONFIG_REG_PERSIST_MODE (0x40000000) /* PERSISTENCE */
189
190 #define IWM_CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int*/
191 #define IWM_CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec*/
192
193 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
194 * acknowledged (reset) by host writing "1" to flagged bits. */
195 #define IWM_CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
196 #define IWM_CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
197 #define IWM_CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */
198 #define IWM_CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
199 #define IWM_CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
200 #define IWM_CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
201 #define IWM_CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
202 #define IWM_CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
203 #define IWM_CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses */
204 #define IWM_CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */
205 #define IWM_CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */
206
207 #define IWM_CSR_INI_SET_MASK (IWM_CSR_INT_BIT_FH_RX | \
208 IWM_CSR_INT_BIT_HW_ERR | \
209 IWM_CSR_INT_BIT_FH_TX | \
210 IWM_CSR_INT_BIT_SW_ERR | \
211 IWM_CSR_INT_BIT_RF_KILL | \
212 IWM_CSR_INT_BIT_SW_RX | \
213 IWM_CSR_INT_BIT_WAKEUP | \
214 IWM_CSR_INT_BIT_ALIVE | \
215 IWM_CSR_INT_BIT_RX_PERIODIC)
216
217 /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
218 #define IWM_CSR_FH_INT_BIT_ERR (1 << 31) /* Error */
219 #define IWM_CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */
220 #define IWM_CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */
221 #define IWM_CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */
222 #define IWM_CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */
223 #define IWM_CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */
224
225 #define IWM_CSR_FH_INT_RX_MASK (IWM_CSR_FH_INT_BIT_HI_PRIOR | \
226 IWM_CSR_FH_INT_BIT_RX_CHNL1 | \
227 IWM_CSR_FH_INT_BIT_RX_CHNL0)
228
229 #define IWM_CSR_FH_INT_TX_MASK (IWM_CSR_FH_INT_BIT_TX_CHNL1 | \
230 IWM_CSR_FH_INT_BIT_TX_CHNL0)
231
232 /* GPIO */
233 #define IWM_CSR_GPIO_IN_BIT_AUX_POWER (0x00000200)
234 #define IWM_CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000)
235 #define IWM_CSR_GPIO_IN_VAL_VMAIN_PWR_SRC (0x00000200)
236
237 /* RESET */
238 #define IWM_CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001)
239 #define IWM_CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002)
240 #define IWM_CSR_RESET_REG_FLAG_SW_RESET (0x00000080)
241 #define IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100)
242 #define IWM_CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200)
243 #define IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED (0x80000000)
244
245 /*
246 * GP (general purpose) CONTROL REGISTER
247 * Bit fields:
248 * 27: HW_RF_KILL_SW
249 * Indicates state of (platform's) hardware RF-Kill switch
250 * 26-24: POWER_SAVE_TYPE
251 * Indicates current power-saving mode:
252 * 000 -- No power saving
253 * 001 -- MAC power-down
254 * 010 -- PHY (radio) power-down
255 * 011 -- Error
256 * 9-6: SYS_CONFIG
257 * Indicates current system configuration, reflecting pins on chip
258 * as forced high/low by device circuit board.
259 * 4: GOING_TO_SLEEP
260 * Indicates MAC is entering a power-saving sleep power-down.
261 * Not a good time to access device-internal resources.
262 * 3: MAC_ACCESS_REQ
263 * Host sets this to request and maintain MAC wakeup, to allow host
264 * access to device-internal resources. Host must wait for
265 * MAC_CLOCK_READY (and !GOING_TO_SLEEP) before accessing non-CSR
266 * device registers.
267 * 2: INIT_DONE
268 * Host sets this to put device into fully operational D0 power mode.
269 * Host resets this after SW_RESET to put device into low power mode.
270 * 0: MAC_CLOCK_READY
271 * Indicates MAC (ucode processor, etc.) is powered up and can run.
272 * Internal resources are accessible.
273 * NOTE: This does not indicate that the processor is actually running.
274 * NOTE: This does not indicate that device has completed
275 * init or post-power-down restore of internal SRAM memory.
276 * Use IWM_CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP as indication that
277 * SRAM is restored and uCode is in normal operation mode.
278 * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and
279 * do not need to save/restore it.
280 * NOTE: After device reset, this bit remains "0" until host sets
281 * INIT_DONE
282 */
283 #define IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001)
284 #define IWM_CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
285 #define IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008)
286 #define IWM_CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
287
288 #define IWM_CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001)
289
290 #define IWM_CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000)
291 #define IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN (0x04000000)
292 #define IWM_CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000)
293
294
295 /* HW REV */
296 #define IWM_CSR_HW_REV_DASH(_val) (((_val) & 0x0000003) >> 0)
297 #define IWM_CSR_HW_REV_STEP(_val) (((_val) & 0x000000C) >> 2)
298
299 /**
300 * hw_rev values
301 */
302 enum {
303 IWM_SILICON_A_STEP = 0,
304 IWM_SILICON_B_STEP,
305 IWM_SILICON_C_STEP,
306 };
307
308
309 #define IWM_CSR_HW_REV_TYPE_MSK (0x000FFF0)
310 #define IWM_CSR_HW_REV_TYPE_5300 (0x0000020)
311 #define IWM_CSR_HW_REV_TYPE_5350 (0x0000030)
312 #define IWM_CSR_HW_REV_TYPE_5100 (0x0000050)
313 #define IWM_CSR_HW_REV_TYPE_5150 (0x0000040)
314 #define IWM_CSR_HW_REV_TYPE_1000 (0x0000060)
315 #define IWM_CSR_HW_REV_TYPE_6x00 (0x0000070)
316 #define IWM_CSR_HW_REV_TYPE_6x50 (0x0000080)
317 #define IWM_CSR_HW_REV_TYPE_6150 (0x0000084)
318 #define IWM_CSR_HW_REV_TYPE_6x05 (0x00000B0)
319 #define IWM_CSR_HW_REV_TYPE_6x30 IWM_CSR_HW_REV_TYPE_6x05
320 #define IWM_CSR_HW_REV_TYPE_6x35 IWM_CSR_HW_REV_TYPE_6x05
321 #define IWM_CSR_HW_REV_TYPE_2x30 (0x00000C0)
322 #define IWM_CSR_HW_REV_TYPE_2x00 (0x0000100)
323 #define IWM_CSR_HW_REV_TYPE_105 (0x0000110)
324 #define IWM_CSR_HW_REV_TYPE_135 (0x0000120)
325 #define IWM_CSR_HW_REV_TYPE_7265D (0x0000210)
326 #define IWM_CSR_HW_REV_TYPE_NONE (0x00001F0)
327
328 /* EEPROM REG */
329 #define IWM_CSR_EEPROM_REG_READ_VALID_MSK (0x00000001)
330 #define IWM_CSR_EEPROM_REG_BIT_CMD (0x00000002)
331 #define IWM_CSR_EEPROM_REG_MSK_ADDR (0x0000FFFC)
332 #define IWM_CSR_EEPROM_REG_MSK_DATA (0xFFFF0000)
333
334 /* EEPROM GP */
335 #define IWM_CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */
336 #define IWM_CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
337 #define IWM_CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP (0x00000000)
338 #define IWM_CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP (0x00000001)
339 #define IWM_CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002)
340 #define IWM_CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004)
341
342 /* One-time-programmable memory general purpose reg */
343 #define IWM_CSR_OTP_GP_REG_DEVICE_SELECT (0x00010000) /* 0 - EEPROM, 1 - OTP */
344 #define IWM_CSR_OTP_GP_REG_OTP_ACCESS_MODE (0x00020000) /* 0 - absolute, 1 - relative */
345 #define IWM_CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK (0x00100000) /* bit 20 */
346 #define IWM_CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK (0x00200000) /* bit 21 */
347
348 /* GP REG */
349 #define IWM_CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */
350 #define IWM_CSR_GP_REG_NO_POWER_SAVE (0x00000000)
351 #define IWM_CSR_GP_REG_MAC_POWER_SAVE (0x01000000)
352 #define IWM_CSR_GP_REG_PHY_POWER_SAVE (0x02000000)
353 #define IWM_CSR_GP_REG_POWER_SAVE_ERROR (0x03000000)
354
355
356 /* CSR GIO */
357 #define IWM_CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002)
358
359 /*
360 * UCODE-DRIVER GP (general purpose) mailbox register 1
361 * Host driver and uCode write and/or read this register to communicate with
362 * each other.
363 * Bit fields:
364 * 4: UCODE_DISABLE
365 * Host sets this to request permanent halt of uCode, same as
366 * sending CARD_STATE command with "halt" bit set.
367 * 3: CT_KILL_EXIT
368 * Host sets this to request exit from CT_KILL state, i.e. host thinks
369 * device temperature is low enough to continue normal operation.
370 * 2: CMD_BLOCKED
371 * Host sets this during RF KILL power-down sequence (HW, SW, CT KILL)
372 * to release uCode to clear all Tx and command queues, enter
373 * unassociated mode, and power down.
374 * NOTE: Some devices also use HBUS_TARG_MBX_C register for this bit.
375 * 1: SW_BIT_RFKILL
376 * Host sets this when issuing CARD_STATE command to request
377 * device sleep.
378 * 0: MAC_SLEEP
379 * uCode sets this when preparing a power-saving power-down.
380 * uCode resets this when power-up is complete and SRAM is sane.
381 * NOTE: device saves internal SRAM data to host when powering down,
382 * and must restore this data after powering back up.
383 * MAC_SLEEP is the best indication that restore is complete.
384 * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and
385 * do not need to save/restore it.
386 */
387 #define IWM_CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001)
388 #define IWM_CSR_UCODE_SW_BIT_RFKILL (0x00000002)
389 #define IWM_CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004)
390 #define IWM_CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008)
391 #define IWM_CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE (0x00000020)
392
393 /* GP Driver */
394 #define IWM_CSR_GP_DRIVER_REG_BIT_RADIO_SKU_MSK (0x00000003)
395 #define IWM_CSR_GP_DRIVER_REG_BIT_RADIO_SKU_3x3_HYB (0x00000000)
396 #define IWM_CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_HYB (0x00000001)
397 #define IWM_CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA (0x00000002)
398 #define IWM_CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6 (0x00000004)
399 #define IWM_CSR_GP_DRIVER_REG_BIT_6050_1x2 (0x00000008)
400
401 #define IWM_CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER (0x00000080)
402
403 /* GIO Chicken Bits (PCI Express bus link power management) */
404 #define IWM_CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000)
405 #define IWM_CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000)
406
407 /* LED */
408 #define IWM_CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF)
409 #define IWM_CSR_LED_REG_TURN_ON (0x60)
410 #define IWM_CSR_LED_REG_TURN_OFF (0x20)
411
412 /* ANA_PLL */
413 #define IWM_CSR50_ANA_PLL_CFG_VAL (0x00880300)
414
415 /* HPET MEM debug */
416 #define IWM_CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000)
417
418 /* DRAM INT TABLE */
419 #define IWM_CSR_DRAM_INT_TBL_ENABLE (1 << 31)
420 #define IWM_CSR_DRAM_INIT_TBL_WRITE_POINTER (1 << 28)
421 #define IWM_CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27)
422
423 /* SECURE boot registers */
424 #define IWM_CSR_SECURE_BOOT_CONFIG_ADDR (0x100)
425 enum iwm_secure_boot_config_reg {
426 IWM_CSR_SECURE_BOOT_CONFIG_INSPECTOR_BURNED_IN_OTP = 0x00000001,
427 IWM_CSR_SECURE_BOOT_CONFIG_INSPECTOR_NOT_REQ = 0x00000002,
428 };
429
430 #define IWM_CSR_SECURE_BOOT_CPU1_STATUS_ADDR (0x100)
431 #define IWM_CSR_SECURE_BOOT_CPU2_STATUS_ADDR (0x100)
432 enum iwm_secure_boot_status_reg {
433 IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_STATUS = 0x00000003,
434 IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_COMPLETED = 0x00000002,
435 IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_SUCCESS = 0x00000004,
436 IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_FAIL = 0x00000008,
437 IWM_CSR_SECURE_BOOT_CPU_STATUS_SIGN_VERF_FAIL = 0x00000010,
438 };
439
440 #define IWM_FH_UCODE_LOAD_STATUS 0x1af0
441 #define IWM_FH_MEM_TB_MAX_LENGTH 0x20000
442
443 #define IWM_LMPM_SECURE_UCODE_LOAD_CPU1_HDR_ADDR 0x1e78
444 #define IWM_LMPM_SECURE_UCODE_LOAD_CPU2_HDR_ADDR 0x1e7c
445
446 #define IWM_LMPM_SECURE_CPU1_HDR_MEM_SPACE 0x420000
447 #define IWM_LMPM_SECURE_CPU2_HDR_MEM_SPACE 0x420400
448
449 #define IWM_CSR_SECURE_TIME_OUT (100)
450
451 /* extended range in FW SRAM */
452 #define IWM_FW_MEM_EXTENDED_START 0x40000
453 #define IWM_FW_MEM_EXTENDED_END 0x57FFF
454
455 /* FW chicken bits */
456 #define IWM_LMPM_CHICK 0xa01ff8
457 #define IWM_LMPM_CHICK_EXTENDED_ADDR_SPACE 0x01
458
459 #define IWM_UREG_CHICK 0xa05c00
460 #define IWM_UREG_CHICK_MSI_ENABLE 0x01000000
461 #define IWM_UREG_CHICK_MSIX_ENABLE 0x02000000
462
463 #define IWM_FH_TCSR_0_REG0 (0x1D00)
464
465 /*
466 * HBUS (Host-side Bus)
467 *
468 * HBUS registers are mapped directly into PCI bus space, but are used
469 * to indirectly access device's internal memory or registers that
470 * may be powered-down.
471 *
472 * Use iwl_write_direct32()/iwl_read_direct32() family for these registers;
473 * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ
474 * to make sure the MAC (uCode processor, etc.) is powered up for accessing
475 * internal resources.
476 *
477 * Do not use iwl_write32()/iwl_read32() family to access these registers;
478 * these provide only simple PCI bus access, without waking up the MAC.
479 */
480 #define IWM_HBUS_BASE (0x400)
481
482 /*
483 * Registers for accessing device's internal SRAM memory (e.g. SCD SRAM
484 * structures, error log, event log, verifying uCode load).
485 * First write to address register, then read from or write to data register
486 * to complete the job. Once the address register is set up, accesses to
487 * data registers auto-increment the address by one dword.
488 * Bit usage for address registers (read or write):
489 * 0-31: memory address within device
490 */
491 #define IWM_HBUS_TARG_MEM_RADDR (IWM_HBUS_BASE+0x00c)
492 #define IWM_HBUS_TARG_MEM_WADDR (IWM_HBUS_BASE+0x010)
493 #define IWM_HBUS_TARG_MEM_WDAT (IWM_HBUS_BASE+0x018)
494 #define IWM_HBUS_TARG_MEM_RDAT (IWM_HBUS_BASE+0x01c)
495
496 /* Mailbox C, used as workaround alternative to CSR_UCODE_DRV_GP1 mailbox */
497 #define IWM_HBUS_TARG_MBX_C (IWM_HBUS_BASE+0x030)
498 #define IWM_HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004)
499
500 /*
501 * Registers for accessing device's internal peripheral registers
502 * (e.g. SCD, BSM, etc.). First write to address register,
503 * then read from or write to data register to complete the job.
504 * Bit usage for address registers (read or write):
505 * 0-15: register address (offset) within device
506 * 24-25: (# bytes - 1) to read or write (e.g. 3 for dword)
507 */
508 #define IWM_HBUS_TARG_PRPH_WADDR (IWM_HBUS_BASE+0x044)
509 #define IWM_HBUS_TARG_PRPH_RADDR (IWM_HBUS_BASE+0x048)
510 #define IWM_HBUS_TARG_PRPH_WDAT (IWM_HBUS_BASE+0x04c)
511 #define IWM_HBUS_TARG_PRPH_RDAT (IWM_HBUS_BASE+0x050)
512
513 /* enable the ID buf for read */
514 #define IWM_WFPM_PS_CTL_CLR 0xa0300c
515 #define IWM_WFMP_MAC_ADDR_0 0xa03080
516 #define IWM_WFMP_MAC_ADDR_1 0xa03084
517 #define IWM_LMPM_PMG_EN 0xa01cec
518 #define IWM_RADIO_REG_SYS_MANUAL_DFT_0 0xad4078
519 #define IWM_RFIC_REG_RD 0xad0470
520 #define IWM_WFPM_CTRL_REG 0xa03030
521 #define IWM_WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK 0x08000000
522 #define IWM_ENABLE_WFPM 0x80000000
523
524 #define IWM_AUX_MISC_REG 0xa200b0
525 #define IWM_HW_STEP_LOCATION_BITS 24
526
527 #define IWM_AUX_MISC_MASTER1_EN 0xa20818
528 #define IWM_AUX_MISC_MASTER1_EN_SBE_MSK 0x1
529 #define IWM_AUX_MISC_MASTER1_SMPHR_STATUS 0xa20800
530 #define IWM_RSA_ENABLE 0xa24b08
531 #define IWM_PREG_AUX_BUS_WPROT_0 0xa04cc0
532 #define IWM_SB_CFG_OVERRIDE_ADDR 0xa26c78
533 #define IWM_SB_CFG_OVERRIDE_ENABLE 0x8000
534 #define IWM_SB_CFG_BASE_OVERRIDE 0xa20000
535 #define IWM_SB_MODIFY_CFG_FLAG 0xa03088
536 #define IWM_SB_CPU_1_STATUS 0xa01e30
537 #define IWM_SB_CPU_2_STATUS 0Xa01e34
538
539 /* Used to enable DBGM */
540 #define IWM_HBUS_TARG_TEST_REG (IWM_HBUS_BASE+0x05c)
541
542 /*
543 * Per-Tx-queue write pointer (index, really!)
544 * Indicates index to next TFD that driver will fill (1 past latest filled).
545 * Bit usage:
546 * 0-7: queue write index
547 * 11-8: queue selector
548 */
549 #define IWM_HBUS_TARG_WRPTR (IWM_HBUS_BASE+0x060)
550
551 /**********************************************************
552 * CSR values
553 **********************************************************/
554 /*
555 * host interrupt timeout value
556 * used with setting interrupt coalescing timer
557 * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit
558 *
559 * default interrupt coalescing timer is 64 x 32 = 2048 usecs
560 */
561 #define IWM_HOST_INT_TIMEOUT_MAX (0xFF)
562 #define IWM_HOST_INT_TIMEOUT_DEF (0x40)
563 #define IWM_HOST_INT_TIMEOUT_MIN (0x0)
564 #define IWM_HOST_INT_OPER_MODE (1 << 31)
565
566 /*****************************************************************************
567 * 7000/3000 series SHR DTS addresses *
568 *****************************************************************************/
569
570 /* Diode Results Register Structure: */
571 enum iwm_dtd_diode_reg {
572 IWM_DTS_DIODE_REG_DIG_VAL = 0x000000FF, /* bits [7:0] */
573 IWM_DTS_DIODE_REG_VREF_LOW = 0x0000FF00, /* bits [15:8] */
574 IWM_DTS_DIODE_REG_VREF_HIGH = 0x00FF0000, /* bits [23:16] */
575 IWM_DTS_DIODE_REG_VREF_ID = 0x03000000, /* bits [25:24] */
576 IWM_DTS_DIODE_REG_PASS_ONCE = 0x80000000, /* bits [31:31] */
577 IWM_DTS_DIODE_REG_FLAGS_MSK = 0xFF000000, /* bits [31:24] */
578 /* Those are the masks INSIDE the flags bit-field: */
579 IWM_DTS_DIODE_REG_FLAGS_VREFS_ID_POS = 0,
580 IWM_DTS_DIODE_REG_FLAGS_VREFS_ID = 0x00000003, /* bits [1:0] */
581 IWM_DTS_DIODE_REG_FLAGS_PASS_ONCE_POS = 7,
582 IWM_DTS_DIODE_REG_FLAGS_PASS_ONCE = 0x00000080, /* bits [7:7] */
583 };
584
585 /*
586 * END iwl-csr.h
587 */
588
589 /*
590 * BEGIN iwl-fw.h
591 */
592
593 /**
594 * enum iwm_ucode_tlv_flag - ucode API flags
595 * @IWM_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously
596 * was a separate TLV but moved here to save space.
597 * @IWM_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID,
598 * treats good CRC threshold as a boolean
599 * @IWM_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
600 * @IWM_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD
601 * @IWM_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan
602 * offload profile config command.
603 * @IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six
604 * (rather than two) IPv6 addresses
605 * @IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element
606 * from the probe request template.
607 * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version)
608 * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version)
609 * @IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD
610 * @IWM_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS.
611 * @IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save
612 * @IWM_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering.
613 */
614 enum iwm_ucode_tlv_flag {
615 IWM_UCODE_TLV_FLAGS_PAN = (1 << 0),
616 IWM_UCODE_TLV_FLAGS_NEWSCAN = (1 << 1),
617 IWM_UCODE_TLV_FLAGS_MFP = (1 << 2),
618 IWM_UCODE_TLV_FLAGS_SHORT_BL = (1 << 7),
619 IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = (1 << 10),
620 IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID = (1 << 12),
621 IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL = (1 << 15),
622 IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE = (1 << 16),
623 IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT = (1 << 24),
624 IWM_UCODE_TLV_FLAGS_EBS_SUPPORT = (1 << 25),
625 IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD = (1 << 26),
626 IWM_UCODE_TLV_FLAGS_BCAST_FILTERING = (1 << 29),
627 };
628
629 #define IWM_UCODE_TLV_FLAG_BITS \
630 "\020\1PAN\2NEWSCAN\3MFP\4P2P\5DW_BC_TABLE\6NEWBT_COEX\7PM_CMD\10SHORT_BL\11RX_ENERG \
631 Y\12TIME_EVENT_V2\13D3_6_IPV6\14BF_UPDATED\15NO_BASIC_SSID\17D3_CONTINUITY\20NEW_NSOFF \
632 L_S\21NEW_NSOFFL_L\22SCHED_SCAN\24STA_KEY_CMD\25DEVICE_PS_CMD\26P2P_PS\27P2P_PS_DCM\30 \
633 P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40LTE_COEX"
634
635 /**
636 * enum iwm_ucode_tlv_api - ucode api
637 * @IWM_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
638 * longer than the passive one, which is essential for fragmented scan.
639 * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
640 * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params
641 * @IWM_UCODE_TLV_API_NEW_VERSION: new versioning format
642 * @IWM_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan
643 * iteration complete notification, and the timestamp reported for RX
644 * received during scan, are reported in TSF of the mac specified in the
645 * scan request.
646 * @IWM_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of
647 * ADD_MODIFY_STA_KEY_API_S_VER_2.
648 * @IWM_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement.
649 * @IWM_UCODE_TLV_API_NAN2_VER2: This ucode supports NAN API version 2
650 * @IWM_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used
651 * @IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY: Quota command includes a field
652 * indicating low latency direction.
653 * @IWM_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is
654 * deprecated.
655 * @IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8
656 * of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8
657 * @IWM_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS
658 * @IWM_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of
659 * the REDUCE_TX_POWER_CMD.
660 * @IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short
661 * version of the beacon notification.
662 * @IWM_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of
663 * BEACON_FILTER_CONFIG_API_S_VER_4.
664 * @IWM_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of
665 * REGULATORY_NVM_GET_INFO_RSP_API_S.
666 * @IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of
667 * LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S.
668 * @IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of
669 * SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S and v3 of
670 * SCAN_OFFLOAD_PROFILES_QUERY_RSP_S.
671 * @IWM_UCODE_TLV_API_MBSSID_HE: This ucode supports v2 of
672 * STA_CONTEXT_DOT11AX_API_S
673 * @IWM_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar
674 * version tables.
675 *
676 * @IWM_NUM_UCODE_TLV_API: number of bits used
677 */
678 enum iwm_ucode_tlv_api {
679 IWM_UCODE_TLV_API_FRAGMENTED_SCAN = 8,
680 IWM_UCODE_TLV_API_WIFI_MCC_UPDATE = 9,
681 IWM_UCODE_TLV_API_LQ_SS_PARAMS = 18,
682 IWM_UCODE_TLV_API_NEW_VERSION = 20,
683 IWM_UCODE_TLV_API_SCAN_TSF_REPORT = 28,
684 IWM_UCODE_TLV_API_TKIP_MIC_KEYS = 29,
685 IWM_UCODE_TLV_API_STA_TYPE = 30,
686 IWM_UCODE_TLV_API_NAN2_VER2 = 31,
687 IWM_UCODE_TLV_API_ADAPTIVE_DWELL = 32,
688 IWM_UCODE_TLV_API_OCE = 33,
689 IWM_UCODE_TLV_API_NEW_BEACON_TEMPLATE = 34,
690 IWM_UCODE_TLV_API_NEW_RX_STATS = 35,
691 IWM_UCODE_TLV_API_WOWLAN_KEY_MATERIAL = 36,
692 IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY = 38,
693 IWM_UCODE_TLV_API_DEPRECATE_TTAK = 41,
694 IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = 42,
695 IWM_UCODE_TLV_API_FRAG_EBS = 44,
696 IWM_UCODE_TLV_API_REDUCE_TX_POWER = 45,
697 IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF = 46,
698 IWM_UCODE_TLV_API_BEACON_FILTER_V4 = 47,
699 IWM_UCODE_TLV_API_REGULATORY_NVM_INFO = 48,
700 IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ = 49,
701 IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS = 50,
702 IWM_UCODE_TLV_API_MBSSID_HE = 52,
703 IWM_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = 53,
704 IWM_UCODE_TLV_API_FTM_RTT_ACCURACY = 54,
705 IWM_UCODE_TLV_API_SAR_TABLE_VER = 55,
706 IWM_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = 57,
707 IWM_UCODE_TLV_API_SCAN_EXT_CHAN_VER = 58,
708
709 IWM_NUM_UCODE_TLV_API = 128,
710 };
711
712 /**
713 * enum iwm_ucode_tlv_capa - ucode capabilities
714 * @IWM_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3
715 * @IWM_UCODE_TLV_CAPA_LAR_SUPPORT: supports Location Aware Regulatory
716 * @IWM_UCODE_TLV_CAPA_UMAC_SCAN: supports UMAC scan.
717 * @IWM_UCODE_TLV_CAPA_BEAMFORMER: supports Beamformer
718 * @IWM_UCODE_TLV_CAPA_TOF_SUPPORT: supports Time of Flight (802.11mc FTM)
719 * @IWM_UCODE_TLV_CAPA_TDLS_SUPPORT: support basic TDLS functionality
720 * @IWM_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT: supports insertion of current
721 * tx power value into TPC Report action frame and Link Measurement Report
722 * action frame
723 * @IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT: supports updating current
724 * channel in DS parameter set element in probe requests.
725 * @IWM_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT: supports adding TPC Report IE in
726 * probe requests.
727 * @IWM_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests
728 * @IWM_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA),
729 * which also implies support for the scheduler configuration command
730 * @IWM_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH: supports TDLS channel switching
731 * @IWM_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG: Consolidated D3-D0 image
732 * @IWM_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command
733 * @IWM_UCODE_TLV_CAPA_DC2DC_SUPPORT: supports DC2DC Command
734 * @IWM_UCODE_TLV_CAPA_2G_COEX_SUPPORT: supports 2G coex Command
735 * @IWM_UCODE_TLV_CAPA_CSUM_SUPPORT: supports TCP Checksum Offload
736 * @IWM_UCODE_TLV_CAPA_RADIO_BEACON_STATS: support radio and beacon statistics
737 * @IWM_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD: support p2p standalone U-APSD
738 * @IWM_UCODE_TLV_CAPA_BT_COEX_PLCR: enabled BT Coex packet level co-running
739 * @IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC: ucode supports LAR updates with different
740 * sources for the MCC. This TLV bit is a future replacement to
741 * IWM_UCODE_TLV_API_WIFI_MCC_UPDATE. When either is set, multi-source LAR
742 * is supported.
743 * @IWM_UCODE_TLV_CAPA_BT_COEX_RRC: supports BT Coex RRC
744 * @IWM_UCODE_TLV_CAPA_GSCAN_SUPPORT: supports gscan
745 * @IWM_UCODE_TLV_CAPA_NAN_SUPPORT: supports NAN
746 * @IWM_UCODE_TLV_CAPA_UMAC_UPLOAD: supports upload mode in umac (1=supported,
747 * 0=no support)
748 * @IWM_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement
749 * @IWM_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts
750 * @IWM_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT
751 * @IWM_UCODE_TLV_CAPA_BEACON_ANT_SELECTION: firmware will decide on what
752 * antenna the beacon should be transmitted
753 * @IWM_UCODE_TLV_CAPA_BEACON_STORING: firmware will store the latest beacon
754 * from AP and will send it upon d0i3 exit.
755 * @IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2: support LAR API V2
756 * @IWM_UCODE_TLV_CAPA_CT_KILL_BY_FW: firmware responsible for CT-kill
757 * @IWM_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT: supports temperature
758 * thresholds reporting
759 * @IWM_UCODE_TLV_CAPA_CTDP_SUPPORT: supports cTDP command
760 * @IWM_UCODE_TLV_CAPA_USNIFFER_UNIFIED: supports usniffer enabled in
761 * regular image.
762 * @IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared
763 * memory addresses from the firmware.
764 * @IWM_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement
765 * @IWM_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger
766 * command size (command version 4) that supports toggling ACK TX
767 * power reduction.
768 *
769 * @IWM_NUM_UCODE_TLV_CAPA: number of bits used
770 */
771 enum iwm_ucode_tlv_capa {
772 IWM_UCODE_TLV_CAPA_D0I3_SUPPORT = 0,
773 IWM_UCODE_TLV_CAPA_LAR_SUPPORT = 1,
774 IWM_UCODE_TLV_CAPA_UMAC_SCAN = 2,
775 IWM_UCODE_TLV_CAPA_BEAMFORMER = 3,
776 IWM_UCODE_TLV_CAPA_TOF_SUPPORT = 5,
777 IWM_UCODE_TLV_CAPA_TDLS_SUPPORT = 6,
778 IWM_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT = 8,
779 IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT = 9,
780 IWM_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = 10,
781 IWM_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = 11,
782 IWM_UCODE_TLV_CAPA_DQA_SUPPORT = 12,
783 IWM_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH = 13,
784 IWM_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG = 17,
785 IWM_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = 18,
786 IWM_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT = 19,
787 IWM_UCODE_TLV_CAPA_2G_COEX_SUPPORT = 20,
788 IWM_UCODE_TLV_CAPA_CSUM_SUPPORT = 21,
789 IWM_UCODE_TLV_CAPA_RADIO_BEACON_STATS = 22,
790 IWM_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD = 26,
791 IWM_UCODE_TLV_CAPA_BT_COEX_PLCR = 28,
792 IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC = 29,
793 IWM_UCODE_TLV_CAPA_BT_COEX_RRC = 30,
794 IWM_UCODE_TLV_CAPA_GSCAN_SUPPORT = 31,
795 IWM_UCODE_TLV_CAPA_NAN_SUPPORT = 34,
796 IWM_UCODE_TLV_CAPA_UMAC_UPLOAD = 35,
797 IWM_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = 64,
798 IWM_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = 65,
799 IWM_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = 67,
800 IWM_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT = 68,
801 IWM_UCODE_TLV_CAPA_BEACON_ANT_SELECTION = 71,
802 IWM_UCODE_TLV_CAPA_BEACON_STORING = 72,
803 IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2 = 73,
804 IWM_UCODE_TLV_CAPA_CT_KILL_BY_FW = 74,
805 IWM_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT = 75,
806 IWM_UCODE_TLV_CAPA_CTDP_SUPPORT = 76,
807 IWM_UCODE_TLV_CAPA_USNIFFER_UNIFIED = 77,
808 IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = 80,
809 IWM_UCODE_TLV_CAPA_LQM_SUPPORT = 81,
810 IWM_UCODE_TLV_CAPA_TX_POWER_ACK = 84,
811
812 IWM_NUM_UCODE_TLV_CAPA = 128
813 };
814
815 /* The default calibrate table size if not specified by firmware file */
816 #define IWM_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
817 #define IWM_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE 19
818 #define IWM_MAX_PHY_CALIBRATE_TBL_SIZE 253
819
820 /* The default max probe length if not specified by the firmware file */
821 #define IWM_DEFAULT_MAX_PROBE_LENGTH 200
822
823 /*
824 * enumeration of ucode section.
825 * This enumeration is used directly for older firmware (before 16.0).
826 * For new firmware, there can be up to 4 sections (see below) but the
827 * first one packaged into the firmware file is the DATA section and
828 * some debugging code accesses that.
829 */
830 enum iwm_ucode_sec {
831 IWM_UCODE_SECTION_DATA,
832 IWM_UCODE_SECTION_INST,
833 };
834 /*
835 * For 16.0 uCode and above, there is no differentiation between sections,
836 * just an offset to the HW address.
837 */
838 #define IWM_CPU1_CPU2_SEPARATOR_SECTION 0xFFFFCCCC
839 #define IWM_PAGING_SEPARATOR_SECTION 0xAAAABBBB
840
841 /* uCode version contains 4 values: Major/Minor/API/Serial */
842 #define IWM_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
843 #define IWM_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
844 #define IWM_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
845 #define IWM_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
846
847 /*
848 * Calibration control struct.
849 * Sent as part of the phy configuration command.
850 * @flow_trigger: bitmap for which calibrations to perform according to
851 * flow triggers.
852 * @event_trigger: bitmap for which calibrations to perform according to
853 * event triggers.
854 */
855 struct iwm_tlv_calib_ctrl {
856 uint32_t flow_trigger;
857 uint32_t event_trigger;
858 } __packed;
859
860 enum iwm_fw_phy_cfg {
861 IWM_FW_PHY_CFG_RADIO_TYPE_POS = 0,
862 IWM_FW_PHY_CFG_RADIO_TYPE = 0x3 << IWM_FW_PHY_CFG_RADIO_TYPE_POS,
863 IWM_FW_PHY_CFG_RADIO_STEP_POS = 2,
864 IWM_FW_PHY_CFG_RADIO_STEP = 0x3 << IWM_FW_PHY_CFG_RADIO_STEP_POS,
865 IWM_FW_PHY_CFG_RADIO_DASH_POS = 4,
866 IWM_FW_PHY_CFG_RADIO_DASH = 0x3 << IWM_FW_PHY_CFG_RADIO_DASH_POS,
867 IWM_FW_PHY_CFG_TX_CHAIN_POS = 16,
868 IWM_FW_PHY_CFG_TX_CHAIN = 0xf << IWM_FW_PHY_CFG_TX_CHAIN_POS,
869 IWM_FW_PHY_CFG_RX_CHAIN_POS = 20,
870 IWM_FW_PHY_CFG_RX_CHAIN = 0xf << IWM_FW_PHY_CFG_RX_CHAIN_POS,
871 };
872
873 #define IWM_UCODE_MAX_CS 1
874
875 /**
876 * struct iwm_fw_cipher_scheme - a cipher scheme supported by FW.
877 * @cipher: a cipher suite selector
878 * @flags: cipher scheme flags (currently reserved for a future use)
879 * @hdr_len: a size of MPDU security header
880 * @pn_len: a size of PN
881 * @pn_off: an offset of pn from the beginning of the security header
882 * @key_idx_off: an offset of key index byte in the security header
883 * @key_idx_mask: a bit mask of key_idx bits
884 * @key_idx_shift: bit shift needed to get key_idx
885 * @mic_len: mic length in bytes
886 * @hw_cipher: a HW cipher index used in host commands
887 */
888 struct iwm_fw_cipher_scheme {
889 uint32_t cipher;
890 uint8_t flags;
891 uint8_t hdr_len;
892 uint8_t pn_len;
893 uint8_t pn_off;
894 uint8_t key_idx_off;
895 uint8_t key_idx_mask;
896 uint8_t key_idx_shift;
897 uint8_t mic_len;
898 uint8_t hw_cipher;
899 } __packed;
900
901 /**
902 * struct iwm_fw_cscheme_list - a cipher scheme list
903 * @size: a number of entries
904 * @cs: cipher scheme entries
905 */
906 struct iwm_fw_cscheme_list {
907 uint8_t size;
908 struct iwm_fw_cipher_scheme cs[];
909 } __packed;
910
911 /*
912 * END iwl-fw.h
913 */
914
915 /*
916 * BEGIN iwl-fw-file.h
917 */
918
919 /* v1/v2 uCode file layout */
920 struct iwm_ucode_header {
921 uint32_t ver; /* major/minor/API/serial */
922 union {
923 struct {
924 uint32_t inst_size; /* bytes of runtime code */
925 uint32_t data_size; /* bytes of runtime data */
926 uint32_t init_size; /* bytes of init code */
927 uint32_t init_data_size; /* bytes of init data */
928 uint32_t boot_size; /* bytes of bootstrap code */
929 uint8_t data[0]; /* in same order as sizes */
930 } v1;
931 struct {
932 uint32_t build; /* build number */
933 uint32_t inst_size; /* bytes of runtime code */
934 uint32_t data_size; /* bytes of runtime data */
935 uint32_t init_size; /* bytes of init code */
936 uint32_t init_data_size; /* bytes of init data */
937 uint32_t boot_size; /* bytes of bootstrap code */
938 uint8_t data[0]; /* in same order as sizes */
939 } v2;
940 } u;
941 };
942
943 /*
944 * new TLV uCode file layout
945 *
946 * The new TLV file format contains TLVs, that each specify
947 * some piece of data.
948 */
949
950 enum iwm_ucode_tlv_type {
951 IWM_UCODE_TLV_INVALID = 0, /* unused */
952 IWM_UCODE_TLV_INST = 1,
953 IWM_UCODE_TLV_DATA = 2,
954 IWM_UCODE_TLV_INIT = 3,
955 IWM_UCODE_TLV_INIT_DATA = 4,
956 IWM_UCODE_TLV_BOOT = 5,
957 IWM_UCODE_TLV_PROBE_MAX_LEN = 6, /* a uint32_t value */
958 IWM_UCODE_TLV_PAN = 7,
959 IWM_UCODE_TLV_RUNT_EVTLOG_PTR = 8,
960 IWM_UCODE_TLV_RUNT_EVTLOG_SIZE = 9,
961 IWM_UCODE_TLV_RUNT_ERRLOG_PTR = 10,
962 IWM_UCODE_TLV_INIT_EVTLOG_PTR = 11,
963 IWM_UCODE_TLV_INIT_EVTLOG_SIZE = 12,
964 IWM_UCODE_TLV_INIT_ERRLOG_PTR = 13,
965 IWM_UCODE_TLV_ENHANCE_SENS_TBL = 14,
966 IWM_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
967 IWM_UCODE_TLV_WOWLAN_INST = 16,
968 IWM_UCODE_TLV_WOWLAN_DATA = 17,
969 IWM_UCODE_TLV_FLAGS = 18,
970 IWM_UCODE_TLV_SEC_RT = 19,
971 IWM_UCODE_TLV_SEC_INIT = 20,
972 IWM_UCODE_TLV_SEC_WOWLAN = 21,
973 IWM_UCODE_TLV_DEF_CALIB = 22,
974 IWM_UCODE_TLV_PHY_SKU = 23,
975 IWM_UCODE_TLV_SECURE_SEC_RT = 24,
976 IWM_UCODE_TLV_SECURE_SEC_INIT = 25,
977 IWM_UCODE_TLV_SECURE_SEC_WOWLAN = 26,
978 IWM_UCODE_TLV_NUM_OF_CPU = 27,
979 IWM_UCODE_TLV_CSCHEME = 28,
980
981 /*
982 * Following two are not in our base tag, but allow
983 * handling ucode version 9.
984 */
985 IWM_UCODE_TLV_API_CHANGES_SET = 29,
986 IWM_UCODE_TLV_ENABLED_CAPABILITIES = 30,
987
988 IWM_UCODE_TLV_N_SCAN_CHANNELS = 31,
989 IWM_UCODE_TLV_PAGING = 32,
990 IWM_UCODE_TLV_SEC_RT_USNIFFER = 34,
991 IWM_UCODE_TLV_SDIO_ADMA_ADDR = 35,
992 IWM_UCODE_TLV_FW_VERSION = 36,
993 IWM_UCODE_TLV_FW_DBG_DEST = 38,
994 IWM_UCODE_TLV_FW_DBG_CONF = 39,
995 IWM_UCODE_TLV_FW_DBG_TRIGGER = 40,
996 IWM_UCODE_TLV_CMD_VERSIONS = 48,
997 IWM_UCODE_TLV_FW_GSCAN_CAPA = 50,
998 IWM_UCODE_TLV_FW_MEM_SEG = 51,
999 };
1000
1001 struct iwm_ucode_tlv {
1002 uint32_t type; /* see above */
1003 uint32_t length; /* not including type/length fields */
1004 uint8_t data[0];
1005 };
1006
1007 struct iwm_ucode_api {
1008 uint32_t api_index;
1009 uint32_t api_flags;
1010 } __packed;
1011
1012 struct iwm_ucode_capa {
1013 uint32_t api_index;
1014 uint32_t api_capa;
1015 } __packed;
1016
1017 #define IWM_TLV_UCODE_MAGIC 0x0a4c5749
1018
1019 struct iwm_tlv_ucode_header {
1020 /*
1021 * The TLV style ucode header is distinguished from
1022 * the v1/v2 style header by first four bytes being
1023 * zero, as such is an invalid combination of
1024 * major/minor/API/serial versions.
1025 */
1026 uint32_t zero;
1027 uint32_t magic;
1028 uint8_t human_readable[64];
1029 uint32_t ver; /* major/minor/API/serial */
1030 uint32_t build;
1031 uint64_t ignore;
1032 /*
1033 * The data contained herein has a TLV layout,
1034 * see above for the TLV header and types.
1035 * Note that each TLV is padded to a length
1036 * that is a multiple of 4 for alignment.
1037 */
1038 uint8_t data[0];
1039 };
1040
1041 /*
1042 * END iwl-fw-file.h
1043 */
1044
1045 /*
1046 * BEGIN iwl-prph.h
1047 */
1048
1049 /*
1050 * Registers in this file are internal, not PCI bus memory mapped.
1051 * Driver accesses these via IWM_HBUS_TARG_PRPH_* registers.
1052 */
1053 #define IWM_PRPH_BASE (0x00000)
1054 #define IWM_PRPH_END (0xFFFFF)
1055
1056 /* APMG (power management) constants */
1057 #define IWM_APMG_BASE (IWM_PRPH_BASE + 0x3000)
1058 #define IWM_APMG_CLK_CTRL_REG (IWM_APMG_BASE + 0x0000)
1059 #define IWM_APMG_CLK_EN_REG (IWM_APMG_BASE + 0x0004)
1060 #define IWM_APMG_CLK_DIS_REG (IWM_APMG_BASE + 0x0008)
1061 #define IWM_APMG_PS_CTRL_REG (IWM_APMG_BASE + 0x000c)
1062 #define IWM_APMG_PCIDEV_STT_REG (IWM_APMG_BASE + 0x0010)
1063 #define IWM_APMG_RFKILL_REG (IWM_APMG_BASE + 0x0014)
1064 #define IWM_APMG_RTC_INT_STT_REG (IWM_APMG_BASE + 0x001c)
1065 #define IWM_APMG_RTC_INT_MSK_REG (IWM_APMG_BASE + 0x0020)
1066 #define IWM_APMG_DIGITAL_SVR_REG (IWM_APMG_BASE + 0x0058)
1067 #define IWM_APMG_ANALOG_SVR_REG (IWM_APMG_BASE + 0x006C)
1068
1069 #define IWM_APMS_CLK_VAL_MRB_FUNC_MODE (0x00000001)
1070 #define IWM_APMG_CLK_VAL_DMA_CLK_RQT (0x00000200)
1071 #define IWM_APMG_CLK_VAL_BSM_CLK_RQT (0x00000800)
1072
1073 #define IWM_APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS (0x00400000)
1074 #define IWM_APMG_PS_CTRL_VAL_RESET_REQ (0x04000000)
1075 #define IWM_APMG_PS_CTRL_MSK_PWR_SRC (0x03000000)
1076 #define IWM_APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000)
1077 #define IWM_APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000)
1078 #define IWM_APMG_SVR_VOLTAGE_CONFIG_BIT_MSK (0x000001E0) /* bit 8:5 */
1079 #define IWM_APMG_SVR_DIGITAL_VOLTAGE_1_32 (0x00000060)
1080
1081 #define IWM_APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800)
1082
1083 #define IWM_APMG_RTC_INT_STT_RFKILL (0x10000000)
1084
1085 /* Device system time */
1086 #define IWM_DEVICE_SYSTEM_TIME_REG 0xA0206C
1087
1088 /* Device NMI register */
1089 #define IWM_DEVICE_SET_NMI_REG 0x00a01c30
1090 #define IWM_DEVICE_SET_NMI_VAL_HW 0x01
1091 #define IWM_DEVICE_SET_NMI_VAL_DRV 0x80
1092 #define IWM_DEVICE_SET_NMI_8000_REG 0x00a01c24
1093 #define IWM_DEVICE_SET_NMI_8000_VAL 0x1000000
1094
1095 /*
1096 * Device reset for family 8000
1097 * write to bit 24 in order to reset the CPU
1098 */
1099 #define IWM_RELEASE_CPU_RESET 0x300c
1100 #define IWM_RELEASE_CPU_RESET_BIT 0x1000000
1101
1102
1103 /*****************************************************************************
1104 * 7000/3000 series SHR DTS addresses *
1105 *****************************************************************************/
1106
1107 #define IWM_SHR_MISC_WFM_DTS_EN (0x00a10024)
1108 #define IWM_DTSC_CFG_MODE (0x00a10604)
1109 #define IWM_DTSC_VREF_AVG (0x00a10648)
1110 #define IWM_DTSC_VREF5_AVG (0x00a1064c)
1111 #define IWM_DTSC_CFG_MODE_PERIODIC (0x2)
1112 #define IWM_DTSC_PTAT_AVG (0x00a10650)
1113
1114
1115 /**
1116 * Tx Scheduler
1117 *
1118 * The Tx Scheduler selects the next frame to be transmitted, choosing TFDs
1119 * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in
1120 * host DRAM. It steers each frame's Tx command (which contains the frame
1121 * data) into one of up to 7 prioritized Tx DMA FIFO channels within the
1122 * device. A queue maps to only one (selectable by driver) Tx DMA channel,
1123 * but one DMA channel may take input from several queues.
1124 *
1125 * Tx DMA FIFOs have dedicated purposes.
1126 *
1127 * For 5000 series and up, they are used differently
1128 * (cf. iwl5000_default_queue_to_tx_fifo in iwl-5000.c):
1129 *
1130 * 0 -- EDCA BK (background) frames, lowest priority
1131 * 1 -- EDCA BE (best effort) frames, normal priority
1132 * 2 -- EDCA VI (video) frames, higher priority
1133 * 3 -- EDCA VO (voice) and management frames, highest priority
1134 * 4 -- unused
1135 * 5 -- unused
1136 * 6 -- unused
1137 * 7 -- Commands
1138 *
1139 * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6.
1140 * In addition, driver can map the remaining queues to Tx DMA/FIFO
1141 * channels 0-3 to support 11n aggregation via EDCA DMA channels.
1142 *
1143 * The driver sets up each queue to work in one of two modes:
1144 *
1145 * 1) Scheduler-Ack, in which the scheduler automatically supports a
1146 * block-ack (BA) window of up to 64 TFDs. In this mode, each queue
1147 * contains TFDs for a unique combination of Recipient Address (RA)
1148 * and Traffic Identifier (TID), that is, traffic of a given
1149 * Quality-Of-Service (QOS) priority, destined for a single station.
1150 *
1151 * In scheduler-ack mode, the scheduler keeps track of the Tx status of
1152 * each frame within the BA window, including whether it's been transmitted,
1153 * and whether it's been acknowledged by the receiving station. The device
1154 * automatically processes block-acks received from the receiving STA,
1155 * and reschedules un-acked frames to be retransmitted (successful
1156 * Tx completion may end up being out-of-order).
1157 *
1158 * The driver must maintain the queue's Byte Count table in host DRAM
1159 * for this mode.
1160 * This mode does not support fragmentation.
1161 *
1162 * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order.
1163 * The device may automatically retry Tx, but will retry only one frame
1164 * at a time, until receiving ACK from receiving station, or reaching
1165 * retry limit and giving up.
1166 *
1167 * The command queue (#4/#9) must use this mode!
1168 * This mode does not require use of the Byte Count table in host DRAM.
1169 *
1170 * Driver controls scheduler operation via 3 means:
1171 * 1) Scheduler registers
1172 * 2) Shared scheduler data base in internal SRAM
1173 * 3) Shared data in host DRAM
1174 *
1175 * Initialization:
1176 *
1177 * When loading, driver should allocate memory for:
1178 * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs.
1179 * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory
1180 * (1024 bytes for each queue).
1181 *
1182 * After receiving "Alive" response from uCode, driver must initialize
1183 * the scheduler (especially for queue #4/#9, the command queue, otherwise
1184 * the driver can't issue commands!):
1185 */
1186 #define IWM_SCD_MEM_LOWER_BOUND (0x0000)
1187
1188 /**
1189 * Max Tx window size is the max number of contiguous TFDs that the scheduler
1190 * can keep track of at one time when creating block-ack chains of frames.
1191 * Note that "64" matches the number of ack bits in a block-ack packet.
1192 */
1193 #define IWM_SCD_WIN_SIZE 64
1194 #define IWM_SCD_FRAME_LIMIT 64
1195
1196 #define IWM_SCD_TXFIFO_POS_TID (0)
1197 #define IWM_SCD_TXFIFO_POS_RA (4)
1198 #define IWM_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF)
1199
1200 /* agn SCD */
1201 #define IWM_SCD_QUEUE_STTS_REG_POS_TXF (0)
1202 #define IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE (3)
1203 #define IWM_SCD_QUEUE_STTS_REG_POS_WSL (4)
1204 #define IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (19)
1205 #define IWM_SCD_QUEUE_STTS_REG_MSK (0x017F0000)
1206
1207 #define IWM_SCD_QUEUE_CTX_REG1_CREDIT_POS (8)
1208 #define IWM_SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00)
1209 #define IWM_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24)
1210 #define IWM_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000)
1211 #define IWM_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS (0)
1212 #define IWM_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK (0x0000007F)
1213 #define IWM_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16)
1214 #define IWM_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000)
1215 #define IWM_SCD_GP_CTRL_ENABLE_31_QUEUES (1 << 0)
1216 #define IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE (1 << 18)
1217
1218 /* Context Data */
1219 #define IWM_SCD_CONTEXT_MEM_LOWER_BOUND (IWM_SCD_MEM_LOWER_BOUND + 0x600)
1220 #define IWM_SCD_CONTEXT_MEM_UPPER_BOUND (IWM_SCD_MEM_LOWER_BOUND + 0x6A0)
1221
1222 /* Tx status */
1223 #define IWM_SCD_TX_STTS_MEM_LOWER_BOUND (IWM_SCD_MEM_LOWER_BOUND + 0x6A0)
1224 #define IWM_SCD_TX_STTS_MEM_UPPER_BOUND (IWM_SCD_MEM_LOWER_BOUND + 0x7E0)
1225
1226 /* Translation Data */
1227 #define IWM_SCD_TRANS_TBL_MEM_LOWER_BOUND (IWM_SCD_MEM_LOWER_BOUND + 0x7E0)
1228 #define IWM_SCD_TRANS_TBL_MEM_UPPER_BOUND (IWM_SCD_MEM_LOWER_BOUND + 0x808)
1229
1230 #define IWM_SCD_CONTEXT_QUEUE_OFFSET(x)\
1231 (IWM_SCD_CONTEXT_MEM_LOWER_BOUND + ((x) * 8))
1232
1233 #define IWM_SCD_TX_STTS_QUEUE_OFFSET(x)\
1234 (IWM_SCD_TX_STTS_MEM_LOWER_BOUND + ((x) * 16))
1235
1236 #define IWM_SCD_TRANS_TBL_OFFSET_QUEUE(x) \
1237 ((IWM_SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc)
1238
1239 #define IWM_SCD_BASE (IWM_PRPH_BASE + 0xa02c00)
1240
1241 #define IWM_SCD_SRAM_BASE_ADDR (IWM_SCD_BASE + 0x0)
1242 #define IWM_SCD_DRAM_BASE_ADDR (IWM_SCD_BASE + 0x8)
1243 #define IWM_SCD_AIT (IWM_SCD_BASE + 0x0c)
1244 #define IWM_SCD_TXFACT (IWM_SCD_BASE + 0x10)
1245 #define IWM_SCD_ACTIVE (IWM_SCD_BASE + 0x14)
1246 #define IWM_SCD_QUEUECHAIN_SEL (IWM_SCD_BASE + 0xe8)
1247 #define IWM_SCD_CHAINEXT_EN (IWM_SCD_BASE + 0x244)
1248 #define IWM_SCD_AGGR_SEL (IWM_SCD_BASE + 0x248)
1249 #define IWM_SCD_INTERRUPT_MASK (IWM_SCD_BASE + 0x108)
1250 #define IWM_SCD_GP_CTRL (IWM_SCD_BASE + 0x1a8)
1251 #define IWM_SCD_EN_CTRL (IWM_SCD_BASE + 0x254)
1252
IWM_SCD_QUEUE_WRPTR(unsigned int chnl)1253 static inline unsigned int IWM_SCD_QUEUE_WRPTR(unsigned int chnl)
1254 {
1255 if (chnl < 20)
1256 return IWM_SCD_BASE + 0x18 + chnl * 4;
1257 return IWM_SCD_BASE + 0x284 + (chnl - 20) * 4;
1258 }
1259
IWM_SCD_QUEUE_RDPTR(unsigned int chnl)1260 static inline unsigned int IWM_SCD_QUEUE_RDPTR(unsigned int chnl)
1261 {
1262 if (chnl < 20)
1263 return IWM_SCD_BASE + 0x68 + chnl * 4;
1264 return IWM_SCD_BASE + 0x2B4 + (chnl - 20) * 4;
1265 }
1266
IWM_SCD_QUEUE_STATUS_BITS(unsigned int chnl)1267 static inline unsigned int IWM_SCD_QUEUE_STATUS_BITS(unsigned int chnl)
1268 {
1269 if (chnl < 20)
1270 return IWM_SCD_BASE + 0x10c + chnl * 4;
1271 return IWM_SCD_BASE + 0x384 + (chnl - 20) * 4;
1272 }
1273
1274 /*********************** END TX SCHEDULER *************************************/
1275
1276 /* Oscillator clock */
1277 #define IWM_OSC_CLK (0xa04068)
1278 #define IWM_OSC_CLK_FORCE_CONTROL (0x8)
1279
1280 /*
1281 * END iwl-prph.h
1282 */
1283
1284 /*
1285 * BEGIN iwl-fh.h
1286 */
1287
1288 /****************************/
1289 /* Flow Handler Definitions */
1290 /****************************/
1291
1292 /**
1293 * This I/O area is directly read/writable by driver (e.g. Linux uses writel())
1294 * Addresses are offsets from device's PCI hardware base address.
1295 */
1296 #define IWM_FH_MEM_LOWER_BOUND (0x1000)
1297 #define IWM_FH_MEM_UPPER_BOUND (0x2000)
1298
1299 /**
1300 * Keep-Warm (KW) buffer base address.
1301 *
1302 * Driver must allocate a 4KByte buffer that is for keeping the
1303 * host DRAM powered on (via dummy accesses to DRAM) to maintain low-latency
1304 * DRAM access when doing Txing or Rxing. The dummy accesses prevent host
1305 * from going into a power-savings mode that would cause higher DRAM latency,
1306 * and possible data over/under-runs, before all Tx/Rx is complete.
1307 *
1308 * Driver loads IWM_FH_KW_MEM_ADDR_REG with the physical address (bits 35:4)
1309 * of the buffer, which must be 4K aligned. Once this is set up, the device
1310 * automatically invokes keep-warm accesses when normal accesses might not
1311 * be sufficient to maintain fast DRAM response.
1312 *
1313 * Bit fields:
1314 * 31-0: Keep-warm buffer physical base address [35:4], must be 4K aligned
1315 */
1316 #define IWM_FH_KW_MEM_ADDR_REG (IWM_FH_MEM_LOWER_BOUND + 0x97C)
1317
1318
1319 /**
1320 * TFD Circular Buffers Base (CBBC) addresses
1321 *
1322 * Device has 16 base pointer registers, one for each of 16 host-DRAM-resident
1323 * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs)
1324 * (see struct iwm_tfd_frame). These 16 pointer registers are offset by 0x04
1325 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte
1326 * aligned (address bits 0-7 must be 0).
1327 * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers
1328 * for them are in different places.
1329 *
1330 * Bit fields in each pointer register:
1331 * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned
1332 */
1333 #define IWM_FH_MEM_CBBC_0_15_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x9D0)
1334 #define IWM_FH_MEM_CBBC_0_15_UPPER_BOUN (IWM_FH_MEM_LOWER_BOUND + 0xA10)
1335 #define IWM_FH_MEM_CBBC_16_19_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xBF0)
1336 #define IWM_FH_MEM_CBBC_16_19_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xC00)
1337 #define IWM_FH_MEM_CBBC_20_31_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xB20)
1338 #define IWM_FH_MEM_CBBC_20_31_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xB80)
1339
1340 /* Find TFD CB base pointer for given queue */
IWM_FH_MEM_CBBC_QUEUE(unsigned int chnl)1341 static inline unsigned int IWM_FH_MEM_CBBC_QUEUE(unsigned int chnl)
1342 {
1343 if (chnl < 16)
1344 return IWM_FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl;
1345 if (chnl < 20)
1346 return IWM_FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16);
1347 return IWM_FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20);
1348 }
1349
1350
1351 /**
1352 * Rx SRAM Control and Status Registers (RSCSR)
1353 *
1354 * These registers provide handshake between driver and device for the Rx queue
1355 * (this queue handles *all* command responses, notifications, Rx data, etc.
1356 * sent from uCode to host driver). Unlike Tx, there is only one Rx
1357 * queue, and only one Rx DMA/FIFO channel. Also unlike Tx, which can
1358 * concatenate up to 20 DRAM buffers to form a Tx frame, each Receive Buffer
1359 * Descriptor (RBD) points to only one Rx Buffer (RB); there is a 1:1
1360 * mapping between RBDs and RBs.
1361 *
1362 * Driver must allocate host DRAM memory for the following, and set the
1363 * physical address of each into device registers:
1364 *
1365 * 1) Receive Buffer Descriptor (RBD) circular buffer (CB), typically with 256
1366 * entries (although any power of 2, up to 4096, is selectable by driver).
1367 * Each entry (1 dword) points to a receive buffer (RB) of consistent size
1368 * (typically 4K, although 8K or 16K are also selectable by driver).
1369 * Driver sets up RB size and number of RBDs in the CB via Rx config
1370 * register IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG.
1371 *
1372 * Bit fields within one RBD:
1373 * 27-0: Receive Buffer physical address bits [35:8], 256-byte aligned
1374 *
1375 * Driver sets physical address [35:8] of base of RBD circular buffer
1376 * into IWM_FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0].
1377 *
1378 * 2) Rx status buffer, 8 bytes, in which uCode indicates which Rx Buffers
1379 * (RBs) have been filled, via a "write pointer", actually the index of
1380 * the RB's corresponding RBD within the circular buffer. Driver sets
1381 * physical address [35:4] into IWM_FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0].
1382 *
1383 * Bit fields in lower dword of Rx status buffer (upper dword not used
1384 * by driver:
1385 * 31-12: Not used by driver
1386 * 11- 0: Index of last filled Rx buffer descriptor
1387 * (device writes, driver reads this value)
1388 *
1389 * As the driver prepares Receive Buffers (RBs) for device to fill, driver must
1390 * enter pointers to these RBs into contiguous RBD circular buffer entries,
1391 * and update the device's "write" index register,
1392 * IWM_FH_RSCSR_CHNL0_RBDCB_WPTR_REG.
1393 *
1394 * This "write" index corresponds to the *next* RBD that the driver will make
1395 * available, i.e. one RBD past the tail of the ready-to-fill RBDs within
1396 * the circular buffer. This value should initially be 0 (before preparing any
1397 * RBs), should be 8 after preparing the first 8 RBs (for example), and must
1398 * wrap back to 0 at the end of the circular buffer (but don't wrap before
1399 * "read" index has advanced past 1! See below).
1400 * NOTE: DEVICE EXPECTS THE WRITE INDEX TO BE INCREMENTED IN MULTIPLES OF 8.
1401 *
1402 * As the device fills RBs (referenced from contiguous RBDs within the circular
1403 * buffer), it updates the Rx status buffer in host DRAM, 2) described above,
1404 * to tell the driver the index of the latest filled RBD. The driver must
1405 * read this "read" index from DRAM after receiving an Rx interrupt from device
1406 *
1407 * The driver must also internally keep track of a third index, which is the
1408 * next RBD to process. When receiving an Rx interrupt, driver should process
1409 * all filled but unprocessed RBs up to, but not including, the RB
1410 * corresponding to the "read" index. For example, if "read" index becomes "1",
1411 * driver may process the RB pointed to by RBD 0. Depending on volume of
1412 * traffic, there may be many RBs to process.
1413 *
1414 * If read index == write index, device thinks there is no room to put new data.
1415 * Due to this, the maximum number of filled RBs is 255, instead of 256. To
1416 * be safe, make sure that there is a gap of at least 2 RBDs between "write"
1417 * and "read" indexes; that is, make sure that there are no more than 254
1418 * buffers waiting to be filled.
1419 */
1420 #define IWM_FH_MEM_RSCSR_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xBC0)
1421 #define IWM_FH_MEM_RSCSR_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xC00)
1422 #define IWM_FH_MEM_RSCSR_CHNL0 (IWM_FH_MEM_RSCSR_LOWER_BOUND)
1423
1424 /**
1425 * Physical base address of 8-byte Rx Status buffer.
1426 * Bit fields:
1427 * 31-0: Rx status buffer physical base address [35:4], must 16-byte aligned.
1428 */
1429 #define IWM_FH_RSCSR_CHNL0_STTS_WPTR_REG (IWM_FH_MEM_RSCSR_CHNL0)
1430
1431 /**
1432 * Physical base address of Rx Buffer Descriptor Circular Buffer.
1433 * Bit fields:
1434 * 27-0: RBD CD physical base address [35:8], must be 256-byte aligned.
1435 */
1436 #define IWM_FH_RSCSR_CHNL0_RBDCB_BASE_REG (IWM_FH_MEM_RSCSR_CHNL0 + 0x004)
1437
1438 /**
1439 * Rx write pointer (index, really!).
1440 * Bit fields:
1441 * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1.
1442 * NOTE: For 256-entry circular buffer, use only bits [7:0].
1443 */
1444 #define IWM_FH_RSCSR_CHNL0_RBDCB_WPTR_REG (IWM_FH_MEM_RSCSR_CHNL0 + 0x008)
1445 #define IWM_FH_RSCSR_CHNL0_WPTR (IWM_FH_RSCSR_CHNL0_RBDCB_WPTR_REG)
1446
1447 #define IWM_FW_RSCSR_CHNL0_RXDCB_RDPTR_REG (IWM_FH_MEM_RSCSR_CHNL0 + 0x00c)
1448 #define IWM_FH_RSCSR_CHNL0_RDPTR IWM_FW_RSCSR_CHNL0_RXDCB_RDPTR_REG
1449
1450 /**
1451 * Rx Config/Status Registers (RCSR)
1452 * Rx Config Reg for channel 0 (only channel used)
1453 *
1454 * Driver must initialize IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG as follows for
1455 * normal operation (see bit fields).
1456 *
1457 * Clearing IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA.
1458 * Driver should poll IWM_FH_MEM_RSSR_RX_STATUS_REG for
1459 * IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing.
1460 *
1461 * Bit fields:
1462 * 31-30: Rx DMA channel enable: '00' off/pause, '01' pause at end of frame,
1463 * '10' operate normally
1464 * 29-24: reserved
1465 * 23-20: # RBDs in circular buffer = 2^value; use "8" for 256 RBDs (normal),
1466 * min "5" for 32 RBDs, max "12" for 4096 RBDs.
1467 * 19-18: reserved
1468 * 17-16: size of each receive buffer; '00' 4K (normal), '01' 8K,
1469 * '10' 12K, '11' 16K.
1470 * 15-14: reserved
1471 * 13-12: IRQ destination; '00' none, '01' host driver (normal operation)
1472 * 11- 4: timeout for closing Rx buffer and interrupting host (units 32 usec)
1473 * typical value 0x10 (about 1/2 msec)
1474 * 3- 0: reserved
1475 */
1476 #define IWM_FH_MEM_RCSR_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xC00)
1477 #define IWM_FH_MEM_RCSR_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xCC0)
1478 #define IWM_FH_MEM_RCSR_CHNL0 (IWM_FH_MEM_RCSR_LOWER_BOUND)
1479
1480 #define IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG (IWM_FH_MEM_RCSR_CHNL0)
1481 #define IWM_FH_MEM_RCSR_CHNL0_RBDCB_WPTR (IWM_FH_MEM_RCSR_CHNL0 + 0x8)
1482 #define IWM_FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ (IWM_FH_MEM_RCSR_CHNL0 + 0x10)
1483
1484 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MSK (0x00000FF0) /* bits 4-11 */
1485 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MSK (0x00001000) /* bits 12 */
1486 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK (0x00008000) /* bit 15 */
1487 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MSK (0x00030000) /* bits 16-17 */
1488 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */
1489 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31*/
1490
1491 #define IWM_FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20)
1492 #define IWM_FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4)
1493 #define IWM_RX_RB_TIMEOUT (0x11)
1494
1495 #define IWM_FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000)
1496 #define IWM_FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000)
1497 #define IWM_FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000)
1498
1499 #define IWM_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000)
1500 #define IWM_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000)
1501 #define IWM_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000)
1502 #define IWM_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000)
1503
1504 #define IWM_FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY (0x00000004)
1505 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000)
1506 #define IWM_FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000)
1507
1508 /**
1509 * Rx Shared Status Registers (RSSR)
1510 *
1511 * After stopping Rx DMA channel (writing 0 to
1512 * IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG), driver must poll
1513 * IWM_FH_MEM_RSSR_RX_STATUS_REG until Rx channel is idle.
1514 *
1515 * Bit fields:
1516 * 24: 1 = Channel 0 is idle
1517 *
1518 * IWM_FH_MEM_RSSR_SHARED_CTRL_REG and IWM_FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV
1519 * contain default values that should not be altered by the driver.
1520 */
1521 #define IWM_FH_MEM_RSSR_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xC40)
1522 #define IWM_FH_MEM_RSSR_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xD00)
1523
1524 #define IWM_FH_MEM_RSSR_SHARED_CTRL_REG (IWM_FH_MEM_RSSR_LOWER_BOUND)
1525 #define IWM_FH_MEM_RSSR_RX_STATUS_REG (IWM_FH_MEM_RSSR_LOWER_BOUND + 0x004)
1526 #define IWM_FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV\
1527 (IWM_FH_MEM_RSSR_LOWER_BOUND + 0x008)
1528
1529 #define IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
1530
1531 #define IWM_FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28
1532
1533 /* 9000 rx series registers */
1534
1535 #define IWM_RFH_Q0_FRBDCB_BA_LSB 0xa08000
1536 #define IWM_RFH_Q_FRBDCB_BA_LSB (IWM_RFH_Q0_FRBDCB_BA_LSB + (q) * 8)
1537 /* Write index table */
1538 #define IWM_RFH_Q0_FRBDCB_WIDX 0xa08080
1539 #define IWM_RFH_Q_FRBDCB_WIDX (IWM_RFH_Q0_FRBDCB_WIDX + (q) * 4)
1540 /* Write index table - shadow registers */
1541 #define IWM_RFH_Q0_FRBDCB_WIDX_TRG 0x1c80
1542 #define IWM_RFH_Q_FRBDCB_WIDX_TRG (IWM_RFH_Q0_FRBDCB_WIDX_TRG + (q) * 4)
1543 /* Read index table */
1544 #define IWM_RFH_Q0_FRBDCB_RIDX 0xa080c0
1545 #define IWM_RFH_Q_FRBDCB_RIDX (IWM_RFH_Q0_FRBDCB_RIDX + (q) * 4)
1546 /* Used list table */
1547 #define IWM_RFH_Q0_URBDCB_BA_LSB 0xa08100
1548 #define IWM_RFH_Q_URBDCB_BA_LSB (IWM_RFH_Q0_URBDCB_BA_LSB + (q) * 8)
1549 /* Write index table */
1550 #define IWM_RFH_Q0_URBDCB_WIDX 0xa08180
1551 #define IWM_RFH_Q_URBDCB_WIDX (IWM_RFH_Q0_URBDCB_WIDX + (q) * 4)
1552 /* stts */
1553 #define IWM_RFH_Q0_URBD_STTS_WPTR_LSB 0xa08200
1554 #define IWM_RFH_Q_URBD_STTS_WPTR_LSB (IWM_RFH_Q0_URBD_STTS_WPTR_LSB + (q) * 8)
1555
1556 #define IWM_RFH_GEN_STATUS 0xa09808
1557 #define IWM_RXF_DMA_IDLE 0x80000000
1558
1559 /* DMA configuration */
1560 #define IWM_RFH_RXF_DMA_CFG 0xa09820
1561 #define IWM_RFH_RXF_DMA_RB_SIZE_1K 0x00010000
1562 #define IWM_RFH_RXF_DMA_RB_SIZE_2K 0x00020000
1563 #define IWM_RFH_RXF_DMA_RB_SIZE_4K 0x00040000
1564 #define IWM_RFH_RXF_DMA_RBDCB_SIZE_512 0x00900000
1565 #define IWM_RFH_RXF_DMA_MIN_RB_4_8 0x03000000
1566 #define IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK 0x04000000
1567 #define IWM_RFH_DMA_EN_ENABLE_VAL 0x80000000
1568
1569 #define IWM_RFH_GEN_CFG 0xa09800
1570 #define IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP 0x00000001
1571 #define IWM_RFH_GEN_CFG_RFH_DMA_SNOOP 0x00000002
1572 #define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128 0x00000010
1573 #define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 0x00000000
1574
1575 #define IWM_RFH_RXF_RXQ_ACTIVE 0xa0980c
1576
1577 /* end of 9000 rx series registers */
1578
1579 /* TFDB Area - TFDs buffer table */
1580 #define IWM_FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF)
1581 #define IWM_FH_TFDIB_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x900)
1582 #define IWM_FH_TFDIB_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x958)
1583 #define IWM_FH_TFDIB_CTRL0_REG(_chnl) (IWM_FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl))
1584 #define IWM_FH_TFDIB_CTRL1_REG(_chnl) (IWM_FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4)
1585
1586 /**
1587 * Transmit DMA Channel Control/Status Registers (TCSR)
1588 *
1589 * Device has one configuration register for each of 8 Tx DMA/FIFO channels
1590 * supported in hardware (don't confuse these with the 16 Tx queues in DRAM,
1591 * which feed the DMA/FIFO channels); config regs are separated by 0x20 bytes.
1592 *
1593 * To use a Tx DMA channel, driver must initialize its
1594 * IWM_FH_TCSR_CHNL_TX_CONFIG_REG(chnl) with:
1595 *
1596 * IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
1597 * IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL
1598 *
1599 * All other bits should be 0.
1600 *
1601 * Bit fields:
1602 * 31-30: Tx DMA channel enable: '00' off/pause, '01' pause at end of frame,
1603 * '10' operate normally
1604 * 29- 4: Reserved, set to "0"
1605 * 3: Enable internal DMA requests (1, normal operation), disable (0)
1606 * 2- 0: Reserved, set to "0"
1607 */
1608 #define IWM_FH_TCSR_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xD00)
1609 #define IWM_FH_TCSR_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xE60)
1610
1611 /* Find Control/Status reg for given Tx DMA/FIFO channel */
1612 #define IWM_FH_TCSR_CHNL_NUM (8)
1613
1614 /* TCSR: tx_config register values */
1615 #define IWM_FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \
1616 (IWM_FH_TCSR_LOWER_BOUND + 0x20 * (_chnl))
1617 #define IWM_FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \
1618 (IWM_FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4)
1619 #define IWM_FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \
1620 (IWM_FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8)
1621
1622 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
1623 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001)
1624
1625 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000)
1626 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008)
1627
1628 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000)
1629 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000)
1630 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
1631
1632 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
1633 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000)
1634 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000)
1635
1636 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
1637 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000)
1638 #define IWM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
1639
1640 #define IWM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000)
1641 #define IWM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000)
1642 #define IWM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003)
1643
1644 #define IWM_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20)
1645 #define IWM_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12)
1646
1647 /**
1648 * Tx Shared Status Registers (TSSR)
1649 *
1650 * After stopping Tx DMA channel (writing 0 to
1651 * IWM_FH_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll
1652 * IWM_FH_TSSR_TX_STATUS_REG until selected Tx channel is idle
1653 * (channel's buffers empty | no pending requests).
1654 *
1655 * Bit fields:
1656 * 31-24: 1 = Channel buffers empty (channel 7:0)
1657 * 23-16: 1 = No pending requests (channel 7:0)
1658 */
1659 #define IWM_FH_TSSR_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xEA0)
1660 #define IWM_FH_TSSR_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0xEC0)
1661
1662 #define IWM_FH_TSSR_TX_STATUS_REG (IWM_FH_TSSR_LOWER_BOUND + 0x010)
1663
1664 /**
1665 * Bit fields for TSSR(Tx Shared Status & Control) error status register:
1666 * 31: Indicates an address error when accessed to internal memory
1667 * uCode/driver must write "1" in order to clear this flag
1668 * 30: Indicates that Host did not send the expected number of dwords to FH
1669 * uCode/driver must write "1" in order to clear this flag
1670 * 16-9:Each status bit is for one channel. Indicates that an (Error) ActDMA
1671 * command was received from the scheduler while the TRB was already full
1672 * with previous command
1673 * uCode/driver must write "1" in order to clear this flag
1674 * 7-0: Each status bit indicates a channel's TxCredit error. When an error
1675 * bit is set, it indicates that the FH has received a full indication
1676 * from the RTC TxFIFO and the current value of the TxCredit counter was
1677 * not equal to zero. This mean that the credit mechanism was not
1678 * synchronized to the TxFIFO status
1679 * uCode/driver must write "1" in order to clear this flag
1680 */
1681 #define IWM_FH_TSSR_TX_ERROR_REG (IWM_FH_TSSR_LOWER_BOUND + 0x018)
1682 #define IWM_FH_TSSR_TX_MSG_CONFIG_REG (IWM_FH_TSSR_LOWER_BOUND + 0x008)
1683
1684 #define IWM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) ((1 << (_chnl)) << 16)
1685
1686 /* Tx service channels */
1687 #define IWM_FH_SRVC_CHNL (9)
1688 #define IWM_FH_SRVC_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x9C8)
1689 #define IWM_FH_SRVC_UPPER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x9D0)
1690 #define IWM_FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \
1691 (IWM_FH_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4)
1692
1693 #define IWM_FH_TX_CHICKEN_BITS_REG (IWM_FH_MEM_LOWER_BOUND + 0xE98)
1694 #define IWM_FH_TX_TRB_REG(_chan) (IWM_FH_MEM_LOWER_BOUND + 0x958 + \
1695 (_chan) * 4)
1696
1697 /* Instruct FH to increment the retry count of a packet when
1698 * it is brought from the memory to TX-FIFO
1699 */
1700 #define IWM_FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN (0x00000002)
1701
1702 #define IWM_RX_QUEUE_SIZE 256
1703 #define IWM_RX_QUEUE_MASK 255
1704 #define IWM_RX_QUEUE_SIZE_LOG 8
1705
1706 /*
1707 * RX related structures and functions
1708 */
1709 #define IWM_RX_FREE_BUFFERS 64
1710 #define IWM_RX_LOW_WATERMARK 8
1711
1712 /**
1713 * struct iwm_rb_status - reseve buffer status
1714 * host memory mapped FH registers
1715 * @closed_rb_num [0:11] - Indicates the index of the RB which was closed
1716 * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed
1717 * @finished_rb_num [0:11] - Indicates the index of the current RB
1718 * in which the last frame was written to
1719 * @finished_fr_num [0:11] - Indicates the index of the RX Frame
1720 * which was transferred
1721 */
1722 struct iwm_rb_status {
1723 uint16_t closed_rb_num;
1724 uint16_t closed_fr_num;
1725 uint16_t finished_rb_num;
1726 uint16_t finished_fr_nam;
1727 uint32_t unused;
1728 } __packed;
1729
1730
1731 #define IWM_TFD_QUEUE_SIZE_MAX (256)
1732 #define IWM_TFD_QUEUE_SIZE_BC_DUP (64)
1733 #define IWM_TFD_QUEUE_BC_SIZE (IWM_TFD_QUEUE_SIZE_MAX + \
1734 IWM_TFD_QUEUE_SIZE_BC_DUP)
1735 #define IWM_TX_DMA_MASK DMA_BIT_MASK(36)
1736 #define IWM_NUM_OF_TBS 20
1737
iwm_get_dma_hi_addr(bus_addr_t addr)1738 static inline uint8_t iwm_get_dma_hi_addr(bus_addr_t addr)
1739 {
1740 return (sizeof(addr) > sizeof(uint32_t) ? (addr >> 16) >> 16 : 0) & 0xF;
1741 }
1742 /**
1743 * struct iwm_tfd_tb transmit buffer descriptor within transmit frame descriptor
1744 *
1745 * This structure contains dma address and length of transmission address
1746 *
1747 * @lo: low [31:0] portion of the dma address of TX buffer
1748 * every even is unaligned on 16 bit boundary
1749 * @hi_n_len 0-3 [35:32] portion of dma
1750 * 4-15 length of the tx buffer
1751 */
1752 struct iwm_tfd_tb {
1753 uint32_t lo;
1754 uint16_t hi_n_len;
1755 } __packed;
1756
1757 /**
1758 * struct iwm_tfd
1759 *
1760 * Transmit Frame Descriptor (TFD)
1761 *
1762 * @ __reserved1[3] reserved
1763 * @ num_tbs 0-4 number of active tbs
1764 * 5 reserved
1765 * 6-7 padding (not used)
1766 * @ tbs[20] transmit frame buffer descriptors
1767 * @ __pad padding
1768 *
1769 * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM.
1770 * Both driver and device share these circular buffers, each of which must be
1771 * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes
1772 *
1773 * Driver must indicate the physical address of the base of each
1774 * circular buffer via the IWM_FH_MEM_CBBC_QUEUE registers.
1775 *
1776 * Each TFD contains pointer/size information for up to 20 data buffers
1777 * in host DRAM. These buffers collectively contain the (one) frame described
1778 * by the TFD. Each buffer must be a single contiguous block of memory within
1779 * itself, but buffers may be scattered in host DRAM. Each buffer has max size
1780 * of (4K - 4). The concatenates all of a TFD's buffers into a single
1781 * Tx frame, up to 8 KBytes in size.
1782 *
1783 * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx.
1784 */
1785 struct iwm_tfd {
1786 uint8_t __reserved1[3];
1787 uint8_t num_tbs;
1788 struct iwm_tfd_tb tbs[IWM_NUM_OF_TBS];
1789 uint32_t __pad;
1790 } __packed;
1791
1792 /* Keep Warm Size */
1793 #define IWM_KW_SIZE 0x1000 /* 4k */
1794
1795 /* Fixed (non-configurable) rx data from phy */
1796
1797 /**
1798 * struct iwm_agn_schedq_bc_tbl scheduler byte count table
1799 * base physical address provided by IWM_SCD_DRAM_BASE_ADDR
1800 * @tfd_offset 0-12 - tx command byte count
1801 * 12-16 - station index
1802 */
1803 struct iwm_agn_scd_bc_tbl {
1804 uint16_t tfd_offset[IWM_TFD_QUEUE_BC_SIZE];
1805 } __packed;
1806
1807 /*
1808 * END iwl-fh.h
1809 */
1810
1811 /*
1812 * BEGIN mvm/fw-api.h
1813 */
1814
1815 /* Maximum number of Tx queues. */
1816 #define IWM_MAX_QUEUES 31
1817
1818 /* Tx queue numbers */
1819 enum {
1820 IWM_OFFCHANNEL_QUEUE = 8,
1821 IWM_CMD_QUEUE = 9,
1822 IWM_AUX_QUEUE = 15,
1823 };
1824
1825 enum iwm_tx_fifo {
1826 IWM_TX_FIFO_BK = 0,
1827 IWM_TX_FIFO_BE,
1828 IWM_TX_FIFO_VI,
1829 IWM_TX_FIFO_VO,
1830 IWM_TX_FIFO_MCAST = 5,
1831 IWM_TX_FIFO_CMD = 7,
1832 };
1833
1834 #define IWM_STATION_COUNT 16
1835
1836 /* commands */
1837 enum {
1838 IWM_ALIVE = 0x1,
1839 IWM_REPLY_ERROR = 0x2,
1840
1841 IWM_INIT_COMPLETE_NOTIF = 0x4,
1842
1843 /* PHY context commands */
1844 IWM_PHY_CONTEXT_CMD = 0x8,
1845 IWM_DBG_CFG = 0x9,
1846
1847 /* UMAC scan commands */
1848 IWM_SCAN_ITERATION_COMPLETE_UMAC = 0xb5,
1849 IWM_SCAN_CFG_CMD = 0xc,
1850 IWM_SCAN_REQ_UMAC = 0xd,
1851 IWM_SCAN_ABORT_UMAC = 0xe,
1852 IWM_SCAN_COMPLETE_UMAC = 0xf,
1853
1854 /* station table */
1855 IWM_ADD_STA_KEY = 0x17,
1856 IWM_ADD_STA = 0x18,
1857 IWM_REMOVE_STA = 0x19,
1858
1859 /* TX */
1860 IWM_TX_CMD = 0x1c,
1861 IWM_TXPATH_FLUSH = 0x1e,
1862 IWM_MGMT_MCAST_KEY = 0x1f,
1863
1864 /* scheduler config */
1865 IWM_SCD_QUEUE_CFG = 0x1d,
1866
1867 /* global key */
1868 IWM_WEP_KEY = 0x20,
1869
1870 /* MAC and Binding commands */
1871 IWM_MAC_CONTEXT_CMD = 0x28,
1872 IWM_TIME_EVENT_CMD = 0x29, /* both CMD and response */
1873 IWM_TIME_EVENT_NOTIFICATION = 0x2a,
1874 IWM_BINDING_CONTEXT_CMD = 0x2b,
1875 IWM_TIME_QUOTA_CMD = 0x2c,
1876 IWM_NON_QOS_TX_COUNTER_CMD = 0x2d,
1877
1878 IWM_LQ_CMD = 0x4e,
1879
1880 /* paging block to FW cpu2 */
1881 IWM_FW_PAGING_BLOCK_CMD = 0x4f,
1882
1883 /* Scan offload */
1884 IWM_SCAN_OFFLOAD_REQUEST_CMD = 0x51,
1885 IWM_SCAN_OFFLOAD_ABORT_CMD = 0x52,
1886 IWM_HOT_SPOT_CMD = 0x53,
1887 IWM_SCAN_OFFLOAD_COMPLETE = 0x6d,
1888 IWM_SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6e,
1889 IWM_SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
1890 IWM_MATCH_FOUND_NOTIFICATION = 0xd9,
1891 IWM_SCAN_ITERATION_COMPLETE = 0xe7,
1892
1893 /* Phy */
1894 IWM_PHY_CONFIGURATION_CMD = 0x6a,
1895 IWM_CALIB_RES_NOTIF_PHY_DB = 0x6b,
1896 IWM_PHY_DB_CMD = 0x6c,
1897
1898 /* Power - legacy power table command */
1899 IWM_POWER_TABLE_CMD = 0x77,
1900 IWM_PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
1901 IWM_LTR_CONFIG = 0xee,
1902
1903 /* Thermal Throttling*/
1904 IWM_REPLY_THERMAL_MNG_BACKOFF = 0x7e,
1905
1906 /* NVM */
1907 IWM_NVM_ACCESS_CMD = 0x88,
1908
1909 IWM_SET_CALIB_DEFAULT_CMD = 0x8e,
1910
1911 IWM_BEACON_NOTIFICATION = 0x90,
1912 IWM_BEACON_TEMPLATE_CMD = 0x91,
1913 IWM_TX_ANT_CONFIGURATION_CMD = 0x98,
1914 IWM_BT_CONFIG = 0x9b,
1915 IWM_STATISTICS_NOTIFICATION = 0x9d,
1916 IWM_REDUCE_TX_POWER_CMD = 0x9f,
1917
1918 /* RF-KILL commands and notifications */
1919 IWM_CARD_STATE_CMD = 0xa0,
1920 IWM_CARD_STATE_NOTIFICATION = 0xa1,
1921
1922 IWM_MISSED_BEACONS_NOTIFICATION = 0xa2,
1923
1924 IWM_MFUART_LOAD_NOTIFICATION = 0xb1,
1925
1926 /* Power - new power table command */
1927 IWM_MAC_PM_POWER_TABLE = 0xa9,
1928
1929 IWM_REPLY_RX_PHY_CMD = 0xc0,
1930 IWM_REPLY_RX_MPDU_CMD = 0xc1,
1931 IWM_BA_NOTIF = 0xc5,
1932
1933 /* Location Aware Regulatory */
1934 IWM_MCC_UPDATE_CMD = 0xc8,
1935 IWM_MCC_CHUB_UPDATE_CMD = 0xc9,
1936
1937 /* BT Coex */
1938 IWM_BT_COEX_PRIO_TABLE = 0xcc,
1939 IWM_BT_COEX_PROT_ENV = 0xcd,
1940 IWM_BT_PROFILE_NOTIFICATION = 0xce,
1941 IWM_BT_COEX_CI = 0x5d,
1942
1943 IWM_REPLY_SF_CFG_CMD = 0xd1,
1944 IWM_REPLY_BEACON_FILTERING_CMD = 0xd2,
1945
1946 /* DTS measurements */
1947 IWM_CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
1948 IWM_DTS_MEASUREMENT_NOTIFICATION = 0xdd,
1949
1950 IWM_REPLY_DEBUG_CMD = 0xf0,
1951 IWM_DEBUG_LOG_MSG = 0xf7,
1952
1953 IWM_MCAST_FILTER_CMD = 0xd0,
1954
1955 /* D3 commands/notifications */
1956 IWM_D3_CONFIG_CMD = 0xd3,
1957 IWM_PROT_OFFLOAD_CONFIG_CMD = 0xd4,
1958 IWM_OFFLOADS_QUERY_CMD = 0xd5,
1959 IWM_REMOTE_WAKE_CONFIG_CMD = 0xd6,
1960
1961 /* for WoWLAN in particular */
1962 IWM_WOWLAN_PATTERNS = 0xe0,
1963 IWM_WOWLAN_CONFIGURATION = 0xe1,
1964 IWM_WOWLAN_TSC_RSC_PARAM = 0xe2,
1965 IWM_WOWLAN_TKIP_PARAM = 0xe3,
1966 IWM_WOWLAN_KEK_KCK_MATERIAL = 0xe4,
1967 IWM_WOWLAN_GET_STATUSES = 0xe5,
1968 IWM_WOWLAN_TX_POWER_PER_DB = 0xe6,
1969
1970 /* and for NetDetect */
1971 IWM_NET_DETECT_CONFIG_CMD = 0x54,
1972 IWM_NET_DETECT_PROFILES_QUERY_CMD = 0x56,
1973 IWM_NET_DETECT_PROFILES_CMD = 0x57,
1974 IWM_NET_DETECT_HOTSPOTS_CMD = 0x58,
1975 IWM_NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59,
1976 };
1977
1978 enum iwm_phy_ops_subcmd_ids {
1979 IWM_CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
1980 IWM_CTDP_CONFIG_CMD = 0x03,
1981 IWM_TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
1982 IWM_CT_KILL_NOTIFICATION = 0xFE,
1983 IWM_DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
1984 };
1985
1986 /* command groups */
1987 enum {
1988 IWM_LEGACY_GROUP = 0x0,
1989 IWM_LONG_GROUP = 0x1,
1990 IWM_SYSTEM_GROUP = 0x2,
1991 IWM_MAC_CONF_GROUP = 0x3,
1992 IWM_PHY_OPS_GROUP = 0x4,
1993 IWM_DATA_PATH_GROUP = 0x5,
1994 IWM_PROT_OFFLOAD_GROUP = 0xb,
1995 };
1996
1997 /**
1998 * struct iwm_cmd_response - generic response struct for most commands
1999 * @status: status of the command asked, changes for each one
2000 */
2001 struct iwm_cmd_response {
2002 uint32_t status;
2003 };
2004
2005 /*
2006 * struct iwm_tx_ant_cfg_cmd
2007 * @valid: valid antenna configuration
2008 */
2009 struct iwm_tx_ant_cfg_cmd {
2010 uint32_t valid;
2011 } __packed;
2012
2013 /**
2014 * struct iwm_reduce_tx_power_cmd - TX power reduction command
2015 * IWM_REDUCE_TX_POWER_CMD = 0x9f
2016 * @flags: (reserved for future implementation)
2017 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
2018 * @pwr_restriction: TX power restriction in dBms.
2019 */
2020 struct iwm_reduce_tx_power_cmd {
2021 uint8_t flags;
2022 uint8_t mac_context_id;
2023 uint16_t pwr_restriction;
2024 } __packed; /* IWM_TX_REDUCED_POWER_API_S_VER_1 */
2025
2026 enum iwm_dev_tx_power_cmd_mode {
2027 IWM_TX_POWER_MODE_SET_MAC = 0,
2028 IWM_TX_POWER_MODE_SET_DEVICE = 1,
2029 IWM_TX_POWER_MODE_SET_CHAINS = 2,
2030 IWM_TX_POWER_MODE_SET_ACK = 3,
2031 }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_4 */;
2032
2033 #define IWM_NUM_CHAIN_LIMITS 2
2034 #define IWM_NUM_SUB_BANDS 5
2035
2036 /**
2037 * struct iwm_dev_tx_power_cmd - TX power reduction command
2038 * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
2039 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
2040 * @pwr_restriction: TX power restriction in 1/8 dBms.
2041 * @dev_24: device TX power restriction in 1/8 dBms
2042 * @dev_52_low: device TX power restriction upper band - low
2043 * @dev_52_high: device TX power restriction upper band - high
2044 * @per_chain_restriction: per chain restrictions
2045 */
2046 struct iwm_dev_tx_power_cmd_v3 {
2047 uint32_t set_mode;
2048 uint32_t mac_context_id;
2049 uint16_t pwr_restriction;
2050 uint16_t dev_24;
2051 uint16_t dev_52_low;
2052 uint16_t dev_52_high;
2053 uint16_t per_chain_restriction[IWM_NUM_CHAIN_LIMITS][IWM_NUM_SUB_BANDS];
2054 } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
2055
2056 #define IWM_DEV_MAX_TX_POWER 0x7FFF
2057
2058 /**
2059 * struct iwm_dev_tx_power_cmd - TX power reduction command
2060 * @v3: version 3 of the command, embedded here for easier software handling
2061 * @enable_ack_reduction: enable or disable close range ack TX power
2062 * reduction.
2063 */
2064 struct iwm_dev_tx_power_cmd {
2065 /* v4 is just an extension of v3 - keep this here */
2066 struct iwm_dev_tx_power_cmd_v3 v3;
2067 uint8_t enable_ack_reduction;
2068 uint8_t reserved[3];
2069 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
2070
2071 /*
2072 * Calibration control struct.
2073 * Sent as part of the phy configuration command.
2074 * @flow_trigger: bitmap for which calibrations to perform according to
2075 * flow triggers.
2076 * @event_trigger: bitmap for which calibrations to perform according to
2077 * event triggers.
2078 */
2079 struct iwm_calib_ctrl {
2080 uint32_t flow_trigger;
2081 uint32_t event_trigger;
2082 } __packed;
2083
2084 /* This enum defines the bitmap of various calibrations to enable in both
2085 * init ucode and runtime ucode through IWM_CALIBRATION_CFG_CMD.
2086 */
2087 enum iwm_calib_cfg {
2088 IWM_CALIB_CFG_XTAL_IDX = (1 << 0),
2089 IWM_CALIB_CFG_TEMPERATURE_IDX = (1 << 1),
2090 IWM_CALIB_CFG_VOLTAGE_READ_IDX = (1 << 2),
2091 IWM_CALIB_CFG_PAPD_IDX = (1 << 3),
2092 IWM_CALIB_CFG_TX_PWR_IDX = (1 << 4),
2093 IWM_CALIB_CFG_DC_IDX = (1 << 5),
2094 IWM_CALIB_CFG_BB_FILTER_IDX = (1 << 6),
2095 IWM_CALIB_CFG_LO_LEAKAGE_IDX = (1 << 7),
2096 IWM_CALIB_CFG_TX_IQ_IDX = (1 << 8),
2097 IWM_CALIB_CFG_TX_IQ_SKEW_IDX = (1 << 9),
2098 IWM_CALIB_CFG_RX_IQ_IDX = (1 << 10),
2099 IWM_CALIB_CFG_RX_IQ_SKEW_IDX = (1 << 11),
2100 IWM_CALIB_CFG_SENSITIVITY_IDX = (1 << 12),
2101 IWM_CALIB_CFG_CHAIN_NOISE_IDX = (1 << 13),
2102 IWM_CALIB_CFG_DISCONNECTED_ANT_IDX = (1 << 14),
2103 IWM_CALIB_CFG_ANT_COUPLING_IDX = (1 << 15),
2104 IWM_CALIB_CFG_DAC_IDX = (1 << 16),
2105 IWM_CALIB_CFG_ABS_IDX = (1 << 17),
2106 IWM_CALIB_CFG_AGC_IDX = (1 << 18),
2107 };
2108
2109 /*
2110 * Phy configuration command.
2111 */
2112 struct iwm_phy_cfg_cmd {
2113 uint32_t phy_cfg;
2114 struct iwm_calib_ctrl calib_control;
2115 } __packed;
2116
2117 #define IWM_PHY_CFG_RADIO_TYPE ((1 << 0) | (1 << 1))
2118 #define IWM_PHY_CFG_RADIO_STEP ((1 << 2) | (1 << 3))
2119 #define IWM_PHY_CFG_RADIO_DASH ((1 << 4) | (1 << 5))
2120 #define IWM_PHY_CFG_PRODUCT_NUMBER ((1 << 6) | (1 << 7))
2121 #define IWM_PHY_CFG_TX_CHAIN_A (1 << 8)
2122 #define IWM_PHY_CFG_TX_CHAIN_B (1 << 9)
2123 #define IWM_PHY_CFG_TX_CHAIN_C (1 << 10)
2124 #define IWM_PHY_CFG_RX_CHAIN_A (1 << 12)
2125 #define IWM_PHY_CFG_RX_CHAIN_B (1 << 13)
2126 #define IWM_PHY_CFG_RX_CHAIN_C (1 << 14)
2127
2128
2129 /* Target of the IWM_NVM_ACCESS_CMD */
2130 enum {
2131 IWM_NVM_ACCESS_TARGET_CACHE = 0,
2132 IWM_NVM_ACCESS_TARGET_OTP = 1,
2133 IWM_NVM_ACCESS_TARGET_EEPROM = 2,
2134 };
2135
2136 /* Section types for IWM_NVM_ACCESS_CMD */
2137 enum {
2138 IWM_NVM_SECTION_TYPE_SW = 1,
2139 IWM_NVM_SECTION_TYPE_REGULATORY = 3,
2140 IWM_NVM_SECTION_TYPE_CALIBRATION = 4,
2141 IWM_NVM_SECTION_TYPE_PRODUCTION = 5,
2142 IWM_NVM_SECTION_TYPE_REGULATORY_SDP = 8,
2143 IWM_NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
2144 IWM_NVM_SECTION_TYPE_PHY_SKU = 12,
2145 IWM_NVM_MAX_NUM_SECTIONS = 13,
2146 };
2147
2148 /**
2149 * struct iwm_nvm_access_cmd_ver2 - Request the device to send an NVM section
2150 * @op_code: 0 - read, 1 - write
2151 * @target: IWM_NVM_ACCESS_TARGET_*
2152 * @type: IWM_NVM_SECTION_TYPE_*
2153 * @offset: offset in bytes into the section
2154 * @length: in bytes, to read/write
2155 * @data: if write operation, the data to write. On read its empty
2156 */
2157 struct iwm_nvm_access_cmd {
2158 uint8_t op_code;
2159 uint8_t target;
2160 uint16_t type;
2161 uint16_t offset;
2162 uint16_t length;
2163 uint8_t data[];
2164 } __packed; /* IWM_NVM_ACCESS_CMD_API_S_VER_2 */
2165
2166 #define IWM_NUM_OF_FW_PAGING_BLOCKS 33 /* 32 for data and 1 block for CSS */
2167
2168 /*
2169 * struct iwm_fw_paging_cmd - paging layout
2170 *
2171 * (IWM_FW_PAGING_BLOCK_CMD = 0x4f)
2172 *
2173 * Send to FW the paging layout in the driver.
2174 *
2175 * @flags: various flags for the command
2176 * @block_size: the block size in powers of 2
2177 * @block_num: number of blocks specified in the command.
2178 * @device_phy_addr: virtual addresses from device side
2179 */
2180 struct iwm_fw_paging_cmd {
2181 uint32_t flags;
2182 uint32_t block_size;
2183 uint32_t block_num;
2184 uint32_t device_phy_addr[IWM_NUM_OF_FW_PAGING_BLOCKS];
2185 } __packed; /* IWM_FW_PAGING_BLOCK_CMD_API_S_VER_1 */
2186
2187 /*
2188 * Fw items ID's
2189 *
2190 * @IWM_FW_ITEM_ID_PAGING: Address of the pages that the FW will upload
2191 * download
2192 */
2193 enum iwm_fw_item_id {
2194 IWM_FW_ITEM_ID_PAGING = 3,
2195 };
2196
2197 /*
2198 * struct iwm_fw_get_item_cmd - get an item from the fw
2199 */
2200 struct iwm_fw_get_item_cmd {
2201 uint32_t item_id;
2202 } __packed; /* IWM_FW_GET_ITEM_CMD_API_S_VER_1 */
2203
2204 /**
2205 * struct iwm_nvm_access_resp_ver2 - response to IWM_NVM_ACCESS_CMD
2206 * @offset: offset in bytes into the section
2207 * @length: in bytes, either how much was written or read
2208 * @type: IWM_NVM_SECTION_TYPE_*
2209 * @status: 0 for success, fail otherwise
2210 * @data: if read operation, the data returned. Empty on write.
2211 */
2212 struct iwm_nvm_access_resp {
2213 uint16_t offset;
2214 uint16_t length;
2215 uint16_t type;
2216 uint16_t status;
2217 uint8_t data[];
2218 } __packed; /* IWM_NVM_ACCESS_CMD_RESP_API_S_VER_2 */
2219
2220 /* IWM_ALIVE 0x1 */
2221
2222 /* alive response is_valid values */
2223 #define IWM_ALIVE_RESP_UCODE_OK (1 << 0)
2224 #define IWM_ALIVE_RESP_RFKILL (1 << 1)
2225
2226 /* alive response ver_type values */
2227 enum {
2228 IWM_FW_TYPE_HW = 0,
2229 IWM_FW_TYPE_PROT = 1,
2230 IWM_FW_TYPE_AP = 2,
2231 IWM_FW_TYPE_WOWLAN = 3,
2232 IWM_FW_TYPE_TIMING = 4,
2233 IWM_FW_TYPE_WIPAN = 5
2234 };
2235
2236 /* alive response ver_subtype values */
2237 enum {
2238 IWM_FW_SUBTYPE_FULL_FEATURE = 0,
2239 IWM_FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
2240 IWM_FW_SUBTYPE_REDUCED = 2,
2241 IWM_FW_SUBTYPE_ALIVE_ONLY = 3,
2242 IWM_FW_SUBTYPE_WOWLAN = 4,
2243 IWM_FW_SUBTYPE_AP_SUBTYPE = 5,
2244 IWM_FW_SUBTYPE_WIPAN = 6,
2245 IWM_FW_SUBTYPE_INITIALIZE = 9
2246 };
2247
2248 #define IWM_ALIVE_STATUS_ERR 0xDEAD
2249 #define IWM_ALIVE_STATUS_OK 0xCAFE
2250
2251 #define IWM_ALIVE_FLG_RFKILL (1 << 0)
2252
2253 struct iwm_lmac_alive {
2254 uint32_t ucode_major;
2255 uint32_t ucode_minor;
2256 uint8_t ver_subtype;
2257 uint8_t ver_type;
2258 uint8_t mac;
2259 uint8_t opt;
2260 uint32_t timestamp;
2261 uint32_t error_event_table_ptr; /* SRAM address for error log */
2262 uint32_t log_event_table_ptr; /* SRAM address for LMAC event log */
2263 uint32_t cpu_register_ptr;
2264 uint32_t dbgm_config_ptr;
2265 uint32_t alive_counter_ptr;
2266 uint32_t scd_base_ptr; /* SRAM address for SCD */
2267 uint32_t st_fwrd_addr; /* pointer to Store and forward */
2268 uint32_t st_fwrd_size;
2269 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
2270
2271 struct iwm_umac_alive {
2272 uint32_t umac_major; /* UMAC version: major */
2273 uint32_t umac_minor; /* UMAC version: minor */
2274 uint32_t error_info_addr; /* SRAM address for UMAC error log */
2275 uint32_t dbg_print_buff_addr;
2276 } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
2277
2278 struct iwm_alive_resp_v3 {
2279 uint16_t status;
2280 uint16_t flags;
2281 struct iwm_lmac_alive lmac_data;
2282 struct iwm_umac_alive umac_data;
2283 } __packed; /* ALIVE_RES_API_S_VER_3 */
2284
2285 struct iwm_alive_resp {
2286 uint16_t status;
2287 uint16_t flags;
2288 struct iwm_lmac_alive lmac_data[2];
2289 struct iwm_umac_alive umac_data;
2290 } __packed; /* ALIVE_RES_API_S_VER_4 */
2291
2292 /* Error response/notification */
2293 enum {
2294 IWM_FW_ERR_UNKNOWN_CMD = 0x0,
2295 IWM_FW_ERR_INVALID_CMD_PARAM = 0x1,
2296 IWM_FW_ERR_SERVICE = 0x2,
2297 IWM_FW_ERR_ARC_MEMORY = 0x3,
2298 IWM_FW_ERR_ARC_CODE = 0x4,
2299 IWM_FW_ERR_WATCH_DOG = 0x5,
2300 IWM_FW_ERR_WEP_GRP_KEY_INDX = 0x10,
2301 IWM_FW_ERR_WEP_KEY_SIZE = 0x11,
2302 IWM_FW_ERR_OBSOLETE_FUNC = 0x12,
2303 IWM_FW_ERR_UNEXPECTED = 0xFE,
2304 IWM_FW_ERR_FATAL = 0xFF
2305 };
2306
2307 /**
2308 * struct iwm_error_resp - FW error indication
2309 * ( IWM_REPLY_ERROR = 0x2 )
2310 * @error_type: one of IWM_FW_ERR_*
2311 * @cmd_id: the command ID for which the error occurred
2312 * @bad_cmd_seq_num: sequence number of the erroneous command
2313 * @error_service: which service created the error, applicable only if
2314 * error_type = 2, otherwise 0
2315 * @timestamp: TSF in usecs.
2316 */
2317 struct iwm_error_resp {
2318 uint32_t error_type;
2319 uint8_t cmd_id;
2320 uint8_t reserved1;
2321 uint16_t bad_cmd_seq_num;
2322 uint32_t error_service;
2323 uint64_t timestamp;
2324 } __packed;
2325
2326
2327 /* Common PHY, MAC and Bindings definitions */
2328
2329 #define IWM_MAX_MACS_IN_BINDING (3)
2330 #define IWM_MAX_BINDINGS (4)
2331 #define IWM_AUX_BINDING_INDEX (3)
2332 #define IWM_MAX_PHYS (4)
2333
2334 /* Used to extract ID and color from the context dword */
2335 #define IWM_FW_CTXT_ID_POS (0)
2336 #define IWM_FW_CTXT_ID_MSK (0xff << IWM_FW_CTXT_ID_POS)
2337 #define IWM_FW_CTXT_COLOR_POS (8)
2338 #define IWM_FW_CTXT_COLOR_MSK (0xff << IWM_FW_CTXT_COLOR_POS)
2339 #define IWM_FW_CTXT_INVALID (0xffffffff)
2340
2341 #define IWM_FW_CMD_ID_AND_COLOR(_id, _color) ((_id << IWM_FW_CTXT_ID_POS) |\
2342 (_color << IWM_FW_CTXT_COLOR_POS))
2343
2344 /* Possible actions on PHYs, MACs and Bindings */
2345 enum {
2346 IWM_FW_CTXT_ACTION_STUB = 0,
2347 IWM_FW_CTXT_ACTION_ADD,
2348 IWM_FW_CTXT_ACTION_MODIFY,
2349 IWM_FW_CTXT_ACTION_REMOVE,
2350 IWM_FW_CTXT_ACTION_NUM
2351 }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
2352
2353 /* Time Events */
2354
2355 /* Time Event types, according to MAC type */
2356 enum iwm_time_event_type {
2357 /* BSS Station Events */
2358 IWM_TE_BSS_STA_AGGRESSIVE_ASSOC,
2359 IWM_TE_BSS_STA_ASSOC,
2360 IWM_TE_BSS_EAP_DHCP_PROT,
2361 IWM_TE_BSS_QUIET_PERIOD,
2362
2363 /* P2P Device Events */
2364 IWM_TE_P2P_DEVICE_DISCOVERABLE,
2365 IWM_TE_P2P_DEVICE_LISTEN,
2366 IWM_TE_P2P_DEVICE_ACTION_SCAN,
2367 IWM_TE_P2P_DEVICE_FULL_SCAN,
2368
2369 /* P2P Client Events */
2370 IWM_TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
2371 IWM_TE_P2P_CLIENT_ASSOC,
2372 IWM_TE_P2P_CLIENT_QUIET_PERIOD,
2373
2374 /* P2P GO Events */
2375 IWM_TE_P2P_GO_ASSOC_PROT,
2376 IWM_TE_P2P_GO_REPETITIVE_NOA,
2377 IWM_TE_P2P_GO_CT_WINDOW,
2378
2379 /* WiDi Sync Events */
2380 IWM_TE_WIDI_TX_SYNC,
2381
2382 IWM_TE_MAX
2383 }; /* IWM_MAC_EVENT_TYPE_API_E_VER_1 */
2384
2385
2386
2387 /* Time event - defines for command API v1 */
2388
2389 /*
2390 * @IWM_TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
2391 * @IWM_TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
2392 * the first fragment is scheduled.
2393 * @IWM_TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
2394 * the first 2 fragments are scheduled.
2395 * @IWM_TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
2396 * number of fragments are valid.
2397 *
2398 * Other than the constant defined above, specifying a fragmentation value 'x'
2399 * means that the event can be fragmented but only the first 'x' will be
2400 * scheduled.
2401 */
2402 enum {
2403 IWM_TE_V1_FRAG_NONE = 0,
2404 IWM_TE_V1_FRAG_SINGLE = 1,
2405 IWM_TE_V1_FRAG_DUAL = 2,
2406 IWM_TE_V1_FRAG_ENDLESS = 0xffffffff
2407 };
2408
2409 /* If a Time Event can be fragmented, this is the max number of fragments */
2410 #define IWM_TE_V1_FRAG_MAX_MSK 0x0fffffff
2411 /* Repeat the time event endlessly (until removed) */
2412 #define IWM_TE_V1_REPEAT_ENDLESS 0xffffffff
2413 /* If a Time Event has bounded repetitions, this is the maximal value */
2414 #define IWM_TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
2415
2416 /* Time Event dependencies: none, on another TE, or in a specific time */
2417 enum {
2418 IWM_TE_V1_INDEPENDENT = 0,
2419 IWM_TE_V1_DEP_OTHER = (1 << 0),
2420 IWM_TE_V1_DEP_TSF = (1 << 1),
2421 IWM_TE_V1_EVENT_SOCIOPATHIC = (1 << 2),
2422 }; /* IWM_MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
2423
2424 /*
2425 * @IWM_TE_V1_NOTIF_NONE: no notifications
2426 * @IWM_TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
2427 * @IWM_TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
2428 * @IWM_TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
2429 * @IWM_TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
2430 * @IWM_TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
2431 * @IWM_TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
2432 * @IWM_TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
2433 * @IWM_TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
2434 *
2435 * Supported Time event notifications configuration.
2436 * A notification (both event and fragment) includes a status indicating weather
2437 * the FW was able to schedule the event or not. For fragment start/end
2438 * notification the status is always success. There is no start/end fragment
2439 * notification for monolithic events.
2440 */
2441 enum {
2442 IWM_TE_V1_NOTIF_NONE = 0,
2443 IWM_TE_V1_NOTIF_HOST_EVENT_START = (1 << 0),
2444 IWM_TE_V1_NOTIF_HOST_EVENT_END = (1 << 1),
2445 IWM_TE_V1_NOTIF_INTERNAL_EVENT_START = (1 << 2),
2446 IWM_TE_V1_NOTIF_INTERNAL_EVENT_END = (1 << 3),
2447 IWM_TE_V1_NOTIF_HOST_FRAG_START = (1 << 4),
2448 IWM_TE_V1_NOTIF_HOST_FRAG_END = (1 << 5),
2449 IWM_TE_V1_NOTIF_INTERNAL_FRAG_START = (1 << 6),
2450 IWM_TE_V1_NOTIF_INTERNAL_FRAG_END = (1 << 7),
2451 IWM_T2_V2_START_IMMEDIATELY = (1 << 11),
2452 }; /* IWM_MAC_EVENT_ACTION_API_E_VER_2 */
2453
2454 /* Time event - defines for command API */
2455
2456 /*
2457 * @IWM_TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
2458 * @IWM_TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
2459 * the first fragment is scheduled.
2460 * @IWM_TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
2461 * the first 2 fragments are scheduled.
2462 * @IWM_TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
2463 * number of fragments are valid.
2464 *
2465 * Other than the constant defined above, specifying a fragmentation value 'x'
2466 * means that the event can be fragmented but only the first 'x' will be
2467 * scheduled.
2468 */
2469 enum {
2470 IWM_TE_V2_FRAG_NONE = 0,
2471 IWM_TE_V2_FRAG_SINGLE = 1,
2472 IWM_TE_V2_FRAG_DUAL = 2,
2473 IWM_TE_V2_FRAG_MAX = 0xfe,
2474 IWM_TE_V2_FRAG_ENDLESS = 0xff
2475 };
2476
2477 /* Repeat the time event endlessly (until removed) */
2478 #define IWM_TE_V2_REPEAT_ENDLESS 0xff
2479 /* If a Time Event has bounded repetitions, this is the maximal value */
2480 #define IWM_TE_V2_REPEAT_MAX 0xfe
2481
2482 #define IWM_TE_V2_PLACEMENT_POS 12
2483 #define IWM_TE_V2_ABSENCE_POS 15
2484
2485 /* Time event policy values
2486 * A notification (both event and fragment) includes a status indicating weather
2487 * the FW was able to schedule the event or not. For fragment start/end
2488 * notification the status is always success. There is no start/end fragment
2489 * notification for monolithic events.
2490 *
2491 * @IWM_TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
2492 * @IWM_TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
2493 * @IWM_TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
2494 * @IWM_TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
2495 * @IWM_TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
2496 * @IWM_TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
2497 * @IWM_TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
2498 * @IWM_TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
2499 * @IWM_TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
2500 * @IWM_TE_V2_DEP_OTHER: depends on another time event
2501 * @IWM_TE_V2_DEP_TSF: depends on a specific time
2502 * @IWM_TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
2503 * @IWM_TE_V2_ABSENCE: are we present or absent during the Time Event.
2504 */
2505 enum {
2506 IWM_TE_V2_DEFAULT_POLICY = 0x0,
2507
2508 /* notifications (event start/stop, fragment start/stop) */
2509 IWM_TE_V2_NOTIF_HOST_EVENT_START = (1 << 0),
2510 IWM_TE_V2_NOTIF_HOST_EVENT_END = (1 << 1),
2511 IWM_TE_V2_NOTIF_INTERNAL_EVENT_START = (1 << 2),
2512 IWM_TE_V2_NOTIF_INTERNAL_EVENT_END = (1 << 3),
2513
2514 IWM_TE_V2_NOTIF_HOST_FRAG_START = (1 << 4),
2515 IWM_TE_V2_NOTIF_HOST_FRAG_END = (1 << 5),
2516 IWM_TE_V2_NOTIF_INTERNAL_FRAG_START = (1 << 6),
2517 IWM_TE_V2_NOTIF_INTERNAL_FRAG_END = (1 << 7),
2518
2519 IWM_TE_V2_NOTIF_MSK = 0xff,
2520
2521 /* placement characteristics */
2522 IWM_TE_V2_DEP_OTHER = (1 << IWM_TE_V2_PLACEMENT_POS),
2523 IWM_TE_V2_DEP_TSF = (1 << (IWM_TE_V2_PLACEMENT_POS + 1)),
2524 IWM_TE_V2_EVENT_SOCIOPATHIC = (1 << (IWM_TE_V2_PLACEMENT_POS + 2)),
2525
2526 /* are we present or absent during the Time Event. */
2527 IWM_TE_V2_ABSENCE = (1 << IWM_TE_V2_ABSENCE_POS),
2528 };
2529
2530 /**
2531 * struct iwm_time_event_cmd_api - configuring Time Events
2532 * with struct IWM_MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
2533 * with version 1. determined by IWM_UCODE_TLV_FLAGS)
2534 * ( IWM_TIME_EVENT_CMD = 0x29 )
2535 * @id_and_color: ID and color of the relevant MAC
2536 * @action: action to perform, one of IWM_FW_CTXT_ACTION_*
2537 * @id: this field has two meanings, depending on the action:
2538 * If the action is ADD, then it means the type of event to add.
2539 * For all other actions it is the unique event ID assigned when the
2540 * event was added by the FW.
2541 * @apply_time: When to start the Time Event (in GP2)
2542 * @max_delay: maximum delay to event's start (apply time), in TU
2543 * @depends_on: the unique ID of the event we depend on (if any)
2544 * @interval: interval between repetitions, in TU
2545 * @duration: duration of event in TU
2546 * @repeat: how many repetitions to do, can be IWM_TE_REPEAT_ENDLESS
2547 * @max_frags: maximal number of fragments the Time Event can be divided to
2548 * @policy: defines whether uCode shall notify the host or other uCode modules
2549 * on event and/or fragment start and/or end
2550 * using one of IWM_TE_INDEPENDENT, IWM_TE_DEP_OTHER, IWM_TE_DEP_TSF
2551 * IWM_TE_EVENT_SOCIOPATHIC
2552 * using IWM_TE_ABSENCE and using IWM_TE_NOTIF_*
2553 */
2554 struct iwm_time_event_cmd {
2555 /* COMMON_INDEX_HDR_API_S_VER_1 */
2556 uint32_t id_and_color;
2557 uint32_t action;
2558 uint32_t id;
2559 /* IWM_MAC_TIME_EVENT_DATA_API_S_VER_2 */
2560 uint32_t apply_time;
2561 uint32_t max_delay;
2562 uint32_t depends_on;
2563 uint32_t interval;
2564 uint32_t duration;
2565 uint8_t repeat;
2566 uint8_t max_frags;
2567 uint16_t policy;
2568 } __packed; /* IWM_MAC_TIME_EVENT_CMD_API_S_VER_2 */
2569
2570 /**
2571 * struct iwm_time_event_resp - response structure to iwm_time_event_cmd
2572 * @status: bit 0 indicates success, all others specify errors
2573 * @id: the Time Event type
2574 * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
2575 * @id_and_color: ID and color of the relevant MAC
2576 */
2577 struct iwm_time_event_resp {
2578 uint32_t status;
2579 uint32_t id;
2580 uint32_t unique_id;
2581 uint32_t id_and_color;
2582 } __packed; /* IWM_MAC_TIME_EVENT_RSP_API_S_VER_1 */
2583
2584 /**
2585 * struct iwm_time_event_notif - notifications of time event start/stop
2586 * ( IWM_TIME_EVENT_NOTIFICATION = 0x2a )
2587 * @timestamp: action timestamp in GP2
2588 * @session_id: session's unique id
2589 * @unique_id: unique id of the Time Event itself
2590 * @id_and_color: ID and color of the relevant MAC
2591 * @action: one of IWM_TE_NOTIF_START or IWM_TE_NOTIF_END
2592 * @status: true if scheduled, false otherwise (not executed)
2593 */
2594 struct iwm_time_event_notif {
2595 uint32_t timestamp;
2596 uint32_t session_id;
2597 uint32_t unique_id;
2598 uint32_t id_and_color;
2599 uint32_t action;
2600 uint32_t status;
2601 } __packed; /* IWM_MAC_TIME_EVENT_NTFY_API_S_VER_1 */
2602
2603
2604 /* Bindings and Time Quota */
2605
2606 /**
2607 * struct iwm_binding_cmd - configuring bindings
2608 * ( IWM_BINDING_CONTEXT_CMD = 0x2b )
2609 * @id_and_color: ID and color of the relevant Binding
2610 * @action: action to perform, one of IWM_FW_CTXT_ACTION_*
2611 * @macs: array of MAC id and colors which belong to the binding
2612 * @phy: PHY id and color which belongs to the binding
2613 */
2614 struct iwm_binding_cmd {
2615 /* COMMON_INDEX_HDR_API_S_VER_1 */
2616 uint32_t id_and_color;
2617 uint32_t action;
2618 /* IWM_BINDING_DATA_API_S_VER_1 */
2619 uint32_t macs[IWM_MAX_MACS_IN_BINDING];
2620 uint32_t phy;
2621 } __packed; /* IWM_BINDING_CMD_API_S_VER_1 */
2622
2623 /* The maximal number of fragments in the FW's schedule session */
2624 #define IWM_MAX_QUOTA 128
2625
2626 /**
2627 * struct iwm_time_quota_data - configuration of time quota per binding
2628 * @id_and_color: ID and color of the relevant Binding
2629 * @quota: absolute time quota in TU. The scheduler will try to divide the
2630 * remainig quota (after Time Events) according to this quota.
2631 * @max_duration: max uninterrupted context duration in TU
2632 */
2633 struct iwm_time_quota_data {
2634 uint32_t id_and_color;
2635 uint32_t quota;
2636 uint32_t max_duration;
2637 } __packed; /* IWM_TIME_QUOTA_DATA_API_S_VER_1 */
2638
2639 /**
2640 * struct iwm_time_quota_cmd - configuration of time quota between bindings
2641 * ( IWM_TIME_QUOTA_CMD = 0x2c )
2642 * @quotas: allocations per binding
2643 */
2644 struct iwm_time_quota_cmd {
2645 struct iwm_time_quota_data quotas[IWM_MAX_BINDINGS];
2646 } __packed; /* IWM_TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
2647
2648
2649 /* PHY context */
2650
2651 /* Supported bands */
2652 #define IWM_PHY_BAND_5 (0)
2653 #define IWM_PHY_BAND_24 (1)
2654
2655 /* Supported channel width, vary if there is VHT support */
2656 #define IWM_PHY_VHT_CHANNEL_MODE20 (0x0)
2657 #define IWM_PHY_VHT_CHANNEL_MODE40 (0x1)
2658 #define IWM_PHY_VHT_CHANNEL_MODE80 (0x2)
2659 #define IWM_PHY_VHT_CHANNEL_MODE160 (0x3)
2660
2661 /*
2662 * Control channel position:
2663 * For legacy set bit means upper channel, otherwise lower.
2664 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
2665 * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
2666 * center_freq
2667 * |
2668 * 40Mhz |_______|_______|
2669 * 80Mhz |_______|_______|_______|_______|
2670 * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
2671 * code 011 010 001 000 | 100 101 110 111
2672 */
2673 #define IWM_PHY_VHT_CTRL_POS_1_BELOW (0x0)
2674 #define IWM_PHY_VHT_CTRL_POS_2_BELOW (0x1)
2675 #define IWM_PHY_VHT_CTRL_POS_3_BELOW (0x2)
2676 #define IWM_PHY_VHT_CTRL_POS_4_BELOW (0x3)
2677 #define IWM_PHY_VHT_CTRL_POS_1_ABOVE (0x4)
2678 #define IWM_PHY_VHT_CTRL_POS_2_ABOVE (0x5)
2679 #define IWM_PHY_VHT_CTRL_POS_3_ABOVE (0x6)
2680 #define IWM_PHY_VHT_CTRL_POS_4_ABOVE (0x7)
2681
2682 /*
2683 * @band: IWM_PHY_BAND_*
2684 * @channel: channel number
2685 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
2686 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
2687 */
2688 struct iwm_fw_channel_info {
2689 uint8_t band;
2690 uint8_t channel;
2691 uint8_t width;
2692 uint8_t ctrl_pos;
2693 } __packed;
2694
2695 #define IWM_PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
2696 #define IWM_PHY_RX_CHAIN_DRIVER_FORCE_MSK \
2697 (0x1 << IWM_PHY_RX_CHAIN_DRIVER_FORCE_POS)
2698 #define IWM_PHY_RX_CHAIN_VALID_POS (1)
2699 #define IWM_PHY_RX_CHAIN_VALID_MSK \
2700 (0x7 << IWM_PHY_RX_CHAIN_VALID_POS)
2701 #define IWM_PHY_RX_CHAIN_FORCE_SEL_POS (4)
2702 #define IWM_PHY_RX_CHAIN_FORCE_SEL_MSK \
2703 (0x7 << IWM_PHY_RX_CHAIN_FORCE_SEL_POS)
2704 #define IWM_PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
2705 #define IWM_PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
2706 (0x7 << IWM_PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
2707 #define IWM_PHY_RX_CHAIN_CNT_POS (10)
2708 #define IWM_PHY_RX_CHAIN_CNT_MSK \
2709 (0x3 << IWM_PHY_RX_CHAIN_CNT_POS)
2710 #define IWM_PHY_RX_CHAIN_MIMO_CNT_POS (12)
2711 #define IWM_PHY_RX_CHAIN_MIMO_CNT_MSK \
2712 (0x3 << IWM_PHY_RX_CHAIN_MIMO_CNT_POS)
2713 #define IWM_PHY_RX_CHAIN_MIMO_FORCE_POS (14)
2714 #define IWM_PHY_RX_CHAIN_MIMO_FORCE_MSK \
2715 (0x1 << IWM_PHY_RX_CHAIN_MIMO_FORCE_POS)
2716
2717 /* TODO: fix the value, make it depend on firmware at runtime? */
2718 #define IWM_NUM_PHY_CTX 3
2719
2720 /* TODO: complete missing documentation */
2721 /**
2722 * struct iwm_phy_context_cmd - config of the PHY context
2723 * ( IWM_PHY_CONTEXT_CMD = 0x8 )
2724 * @id_and_color: ID and color of the relevant Binding
2725 * @action: action to perform, one of IWM_FW_CTXT_ACTION_*
2726 * @apply_time: 0 means immediate apply and context switch.
2727 * other value means apply new params after X usecs
2728 * @tx_param_color: ???
2729 * @channel_info:
2730 * @txchain_info: ???
2731 * @rxchain_info: ???
2732 * @acquisition_data: ???
2733 * @dsp_cfg_flags: set to 0
2734 */
2735 struct iwm_phy_context_cmd {
2736 /* COMMON_INDEX_HDR_API_S_VER_1 */
2737 uint32_t id_and_color;
2738 uint32_t action;
2739 /* IWM_PHY_CONTEXT_DATA_API_S_VER_1 */
2740 uint32_t apply_time;
2741 uint32_t tx_param_color;
2742 struct iwm_fw_channel_info ci;
2743 uint32_t txchain_info;
2744 uint32_t rxchain_info;
2745 uint32_t acquisition_data;
2746 uint32_t dsp_cfg_flags;
2747 } __packed; /* IWM_PHY_CONTEXT_CMD_API_VER_1 */
2748
2749 #define IWM_RX_INFO_PHY_CNT 8
2750 #define IWM_RX_INFO_ENERGY_ANT_ABC_IDX 1
2751 #define IWM_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
2752 #define IWM_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
2753 #define IWM_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
2754 #define IWM_RX_INFO_ENERGY_ANT_A_POS 0
2755 #define IWM_RX_INFO_ENERGY_ANT_B_POS 8
2756 #define IWM_RX_INFO_ENERGY_ANT_C_POS 16
2757
2758 #define IWM_RX_INFO_AGC_IDX 1
2759 #define IWM_RX_INFO_RSSI_AB_IDX 2
2760 #define IWM_OFDM_AGC_A_MSK 0x0000007f
2761 #define IWM_OFDM_AGC_A_POS 0
2762 #define IWM_OFDM_AGC_B_MSK 0x00003f80
2763 #define IWM_OFDM_AGC_B_POS 7
2764 #define IWM_OFDM_AGC_CODE_MSK 0x3fe00000
2765 #define IWM_OFDM_AGC_CODE_POS 20
2766 #define IWM_OFDM_RSSI_INBAND_A_MSK 0x00ff
2767 #define IWM_OFDM_RSSI_A_POS 0
2768 #define IWM_OFDM_RSSI_ALLBAND_A_MSK 0xff00
2769 #define IWM_OFDM_RSSI_ALLBAND_A_POS 8
2770 #define IWM_OFDM_RSSI_INBAND_B_MSK 0xff0000
2771 #define IWM_OFDM_RSSI_B_POS 16
2772 #define IWM_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
2773 #define IWM_OFDM_RSSI_ALLBAND_B_POS 24
2774
2775 /**
2776 * struct iwm_rx_phy_info - phy info
2777 * (IWM_REPLY_RX_PHY_CMD = 0xc0)
2778 * @non_cfg_phy_cnt: non configurable DSP phy data byte count
2779 * @cfg_phy_cnt: configurable DSP phy data byte count
2780 * @stat_id: configurable DSP phy data set ID
2781 * @reserved1:
2782 * @system_timestamp: GP2 at on air rise
2783 * @timestamp: TSF at on air rise
2784 * @beacon_time_stamp: beacon at on-air rise
2785 * @phy_flags: general phy flags: band, modulation, ...
2786 * @channel: channel number
2787 * @non_cfg_phy_buf: for various implementations of non_cfg_phy
2788 * @rate_n_flags: IWM_RATE_MCS_*
2789 * @byte_count: frame's byte-count
2790 * @frame_time: frame's time on the air, based on byte count and frame rate
2791 * calculation
2792 * @mac_active_msk: what MACs were active when the frame was received
2793 *
2794 * Before each Rx, the device sends this data. It contains PHY information
2795 * about the reception of the packet.
2796 */
2797 struct iwm_rx_phy_info {
2798 uint8_t non_cfg_phy_cnt;
2799 uint8_t cfg_phy_cnt;
2800 uint8_t stat_id;
2801 uint8_t reserved1;
2802 uint32_t system_timestamp;
2803 uint64_t timestamp;
2804 uint32_t beacon_time_stamp;
2805 uint16_t phy_flags;
2806 #define IWM_PHY_INFO_FLAG_SHPREAMBLE (1 << 2)
2807 uint16_t channel;
2808 uint32_t non_cfg_phy[IWM_RX_INFO_PHY_CNT];
2809 uint8_t rate;
2810 uint8_t rflags;
2811 uint16_t xrflags;
2812 uint32_t byte_count;
2813 uint16_t mac_active_msk;
2814 uint16_t frame_time;
2815 } __packed;
2816
2817 struct iwm_rx_mpdu_res_start {
2818 uint16_t byte_count;
2819 uint16_t reserved;
2820 } __packed;
2821
2822 /**
2823 * enum iwm_rx_phy_flags - to parse %iwm_rx_phy_info phy_flags
2824 * @IWM_RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
2825 * @IWM_RX_RES_PHY_FLAGS_MOD_CCK:
2826 * @IWM_RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
2827 * @IWM_RX_RES_PHY_FLAGS_NARROW_BAND:
2828 * @IWM_RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
2829 * @IWM_RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
2830 * @IWM_RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
2831 * @IWM_RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
2832 * @IWM_RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
2833 */
2834 enum iwm_rx_phy_flags {
2835 IWM_RX_RES_PHY_FLAGS_BAND_24 = (1 << 0),
2836 IWM_RX_RES_PHY_FLAGS_MOD_CCK = (1 << 1),
2837 IWM_RX_RES_PHY_FLAGS_SHORT_PREAMBLE = (1 << 2),
2838 IWM_RX_RES_PHY_FLAGS_NARROW_BAND = (1 << 3),
2839 IWM_RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
2840 IWM_RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
2841 IWM_RX_RES_PHY_FLAGS_AGG = (1 << 7),
2842 IWM_RX_RES_PHY_FLAGS_OFDM_HT = (1 << 8),
2843 IWM_RX_RES_PHY_FLAGS_OFDM_GF = (1 << 9),
2844 IWM_RX_RES_PHY_FLAGS_OFDM_VHT = (1 << 10),
2845 };
2846
2847 /**
2848 * enum iwm_rx_status - written by fw for each Rx packet
2849 * @IWM_RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
2850 * @IWM_RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
2851 * @IWM_RX_MPDU_RES_STATUS_SRC_STA_FOUND:
2852 * @IWM_RX_MPDU_RES_STATUS_KEY_VALID:
2853 * @IWM_RX_MPDU_RES_STATUS_KEY_PARAM_OK:
2854 * @IWM_RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
2855 * @IWM_RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
2856 * in the driver.
2857 * @IWM_RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
2858 * @IWM_RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
2859 * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
2860 * %IWM_RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
2861 * @IWM_RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
2862 * @IWM_RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
2863 * @IWM_RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
2864 * @IWM_RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
2865 * @IWM_RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
2866 * @IWM_RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
2867 * @IWM_RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
2868 * @IWM_RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
2869 * @IWM_RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
2870 * @IWM_RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
2871 * @IWM_RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
2872 * @IWM_RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
2873 * @IWM_RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
2874 * @IWM_RX_MPDU_RES_STATUS_STA_ID_MSK:
2875 * @IWM_RX_MPDU_RES_STATUS_RRF_KILL:
2876 * @IWM_RX_MPDU_RES_STATUS_FILTERING_MSK:
2877 * @IWM_RX_MPDU_RES_STATUS2_FILTERING_MSK:
2878 */
2879 enum iwm_rx_status {
2880 IWM_RX_MPDU_RES_STATUS_CRC_OK = (1 << 0),
2881 IWM_RX_MPDU_RES_STATUS_OVERRUN_OK = (1 << 1),
2882 IWM_RX_MPDU_RES_STATUS_SRC_STA_FOUND = (1 << 2),
2883 IWM_RX_MPDU_RES_STATUS_KEY_VALID = (1 << 3),
2884 IWM_RX_MPDU_RES_STATUS_KEY_PARAM_OK = (1 << 4),
2885 IWM_RX_MPDU_RES_STATUS_ICV_OK = (1 << 5),
2886 IWM_RX_MPDU_RES_STATUS_MIC_OK = (1 << 6),
2887 IWM_RX_MPDU_RES_STATUS_TTAK_OK = (1 << 7),
2888 IWM_RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = (1 << 7),
2889 IWM_RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
2890 IWM_RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
2891 IWM_RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
2892 IWM_RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
2893 IWM_RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
2894 IWM_RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
2895 IWM_RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
2896 IWM_RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
2897 IWM_RX_MPDU_RES_STATUS_DEC_DONE = (1 << 11),
2898 IWM_RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = (1 << 12),
2899 IWM_RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = (1 << 13),
2900 IWM_RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = (1 << 14),
2901 IWM_RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = (1 << 15),
2902 IWM_RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
2903 IWM_RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
2904 IWM_RX_MPDU_RES_STATUS_RRF_KILL = (1 << 29),
2905 IWM_RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
2906 IWM_RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
2907 };
2908
2909 enum iwm_rx_mpdu_mac_flags1 {
2910 IWM_RX_MPDU_MFLG1_ADDRTYPE_MASK = 0x03,
2911 IWM_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK = 0xf0,
2912 IWM_RX_MPDU_MFLG1_MIC_CRC_LEN_SHIFT = 3,
2913 };
2914
2915 enum iwm_rx_mpdu_mac_flags2 {
2916 IWM_RX_MPDU_MFLG2_HDR_LEN_MASK = 0x1f,
2917 IWM_RX_MPDU_MFLG2_PAD = 0x20,
2918 IWM_RX_MPDU_MFLG2_AMSDU = 0x40,
2919 };
2920
2921 enum iwm_rx_mpdu_phy_info {
2922 IWM_RX_MPDU_PHY_AMPDU = (1 << 5),
2923 IWM_RX_MPDU_PHY_AMPDU_TOGGLE = (1 << 6),
2924 IWM_RX_MPDU_PHY_SHORT_PREAMBLE = (1 << 7),
2925 IWM_RX_MPDU_PHY_NCCK_ADDTL_NTFY = (1 << 7),
2926 IWM_RX_MPDU_PHY_TSF_OVERLOAD = (1 << 8),
2927 };
2928
2929 struct iwm_rx_mpdu_desc_v1 {
2930 union {
2931 uint32_t rss_hash;
2932 uint32_t phy_data2;
2933 };
2934 union {
2935 uint32_t filter_match;
2936 uint32_t phy_data3;
2937 };
2938 uint32_t rate_n_flags;
2939 uint8_t energy_a;
2940 uint8_t energy_b;
2941 uint8_t channel;
2942 uint8_t mac_context;
2943 uint32_t gp2_on_air_rise;
2944 union {
2945 uint64_t tsf_on_air_rise;
2946 struct {
2947 uint32_t phy_data0;
2948 uint32_t phy_data1;
2949 };
2950 };
2951 } __packed;
2952
2953 struct iwm_rx_mpdu_desc {
2954 uint16_t mpdu_len;
2955 uint8_t mac_flags1;
2956 uint8_t mac_flags2;
2957 uint8_t amsdu_info;
2958 uint16_t phy_info;
2959 uint8_t mac_phy_idx;
2960 uint16_t raw_csum;
2961 union {
2962 uint16_t l3l4_flags;
2963 uint16_t phy_data4;
2964 };
2965 uint16_t status;
2966 uint8_t hash_filter;
2967 uint8_t sta_id_flags;
2968 uint32_t reorder_data;
2969 struct iwm_rx_mpdu_desc_v1 v1;
2970 } __packed;
2971
2972 /**
2973 * struct iwm_radio_version_notif - information on the radio version
2974 * ( IWM_RADIO_VERSION_NOTIFICATION = 0x68 )
2975 * @radio_flavor:
2976 * @radio_step:
2977 * @radio_dash:
2978 */
2979 struct iwm_radio_version_notif {
2980 uint32_t radio_flavor;
2981 uint32_t radio_step;
2982 uint32_t radio_dash;
2983 } __packed; /* IWM_RADIO_VERSION_NOTOFICATION_S_VER_1 */
2984
2985 enum iwm_card_state_flags {
2986 IWM_CARD_ENABLED = 0x00,
2987 IWM_HW_CARD_DISABLED = 0x01,
2988 IWM_SW_CARD_DISABLED = 0x02,
2989 IWM_CT_KILL_CARD_DISABLED = 0x04,
2990 IWM_HALT_CARD_DISABLED = 0x08,
2991 IWM_CARD_DISABLED_MSK = 0x0f,
2992 IWM_CARD_IS_RX_ON = 0x10,
2993 };
2994
2995 /**
2996 * struct iwm_radio_version_notif - information on the radio version
2997 * (IWM_CARD_STATE_NOTIFICATION = 0xa1 )
2998 * @flags: %iwm_card_state_flags
2999 */
3000 struct iwm_card_state_notif {
3001 uint32_t flags;
3002 } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
3003
3004 /**
3005 * struct iwm_missed_beacons_notif - information on missed beacons
3006 * ( IWM_MISSED_BEACONS_NOTIFICATION = 0xa2 )
3007 * @mac_id: interface ID
3008 * @consec_missed_beacons_since_last_rx: number of consecutive missed
3009 * beacons since last RX.
3010 * @consec_missed_beacons: number of consecutive missed beacons
3011 * @num_expected_beacons:
3012 * @num_recvd_beacons:
3013 */
3014 struct iwm_missed_beacons_notif {
3015 uint32_t mac_id;
3016 uint32_t consec_missed_beacons_since_last_rx;
3017 uint32_t consec_missed_beacons;
3018 uint32_t num_expected_beacons;
3019 uint32_t num_recvd_beacons;
3020 } __packed; /* IWM_MISSED_BEACON_NTFY_API_S_VER_3 */
3021
3022 /**
3023 * struct iwm_mfuart_load_notif - mfuart image version & status
3024 * ( IWM_MFUART_LOAD_NOTIFICATION = 0xb1 )
3025 * @installed_ver: installed image version
3026 * @external_ver: external image version
3027 * @status: MFUART loading status
3028 * @duration: MFUART loading time
3029 */
3030 struct iwm_mfuart_load_notif {
3031 uint32_t installed_ver;
3032 uint32_t external_ver;
3033 uint32_t status;
3034 uint32_t duration;
3035 } __packed; /*MFU_LOADER_NTFY_API_S_VER_1*/
3036
3037 /**
3038 * struct iwm_set_calib_default_cmd - set default value for calibration.
3039 * ( IWM_SET_CALIB_DEFAULT_CMD = 0x8e )
3040 * @calib_index: the calibration to set value for
3041 * @length: of data
3042 * @data: the value to set for the calibration result
3043 */
3044 struct iwm_set_calib_default_cmd {
3045 uint16_t calib_index;
3046 uint16_t length;
3047 uint8_t data[0];
3048 } __packed; /* IWM_PHY_CALIB_OVERRIDE_VALUES_S */
3049
3050 #define IWM_MAX_PORT_ID_NUM 2
3051 #define IWM_MAX_MCAST_FILTERING_ADDRESSES 256
3052
3053 /**
3054 * struct iwm_mcast_filter_cmd - configure multicast filter.
3055 * @filter_own: Set 1 to filter out multicast packets sent by station itself
3056 * @port_id: Multicast MAC addresses array specifier. This is a strange way
3057 * to identify network interface adopted in host-device IF.
3058 * It is used by FW as index in array of addresses. This array has
3059 * IWM_MAX_PORT_ID_NUM members.
3060 * @count: Number of MAC addresses in the array
3061 * @pass_all: Set 1 to pass all multicast packets.
3062 * @bssid: current association BSSID.
3063 * @addr_list: Place holder for array of MAC addresses.
3064 * IMPORTANT: add padding if necessary to ensure DWORD alignment.
3065 */
3066 struct iwm_mcast_filter_cmd {
3067 uint8_t filter_own;
3068 uint8_t port_id;
3069 uint8_t count;
3070 uint8_t pass_all;
3071 uint8_t bssid[6];
3072 uint8_t reserved[2];
3073 uint8_t addr_list[0];
3074 } __packed; /* IWM_MCAST_FILTERING_CMD_API_S_VER_1 */
3075
3076 /*
3077 * The first MAC indices (starting from 0)
3078 * are available to the driver, AUX follows
3079 */
3080 #define IWM_MAC_INDEX_AUX 4
3081 #define IWM_MAC_INDEX_MIN_DRIVER 0
3082 #define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX
3083 #define IWM_NUM_MAC_INDEX (IWM_MAC_INDEX_AUX + 1)
3084
3085 /***********************************
3086 * Statistics API
3087 ***********************************/
3088 struct iwm_statistics_dbg {
3089 uint32_t burst_check;
3090 uint32_t burst_count;
3091 uint32_t wait_for_silence_timeout_cnt;
3092 uint32_t reserved[3];
3093 } __packed; /* IWM_STATISTICS_DEBUG_API_S_VER_2 */
3094
3095 struct iwm_statistics_div {
3096 uint32_t tx_on_a;
3097 uint32_t tx_on_b;
3098 uint32_t exec_time;
3099 uint32_t probe_time;
3100 uint32_t rssi_ant;
3101 uint32_t reserved2;
3102 } __packed; /* IWM_STATISTICS_SLOW_DIV_API_S_VER_2 */
3103
3104 struct iwm_statistics_rx_non_phy {
3105 uint32_t bogus_cts; /* CTS received when not expecting CTS */
3106 uint32_t bogus_ack; /* ACK received when not expecting ACK */
3107 uint32_t non_bssid_frames; /* number of frames with BSSID that
3108 * doesn't belong to the STA BSSID */
3109 uint32_t filtered_frames; /* count frames that were dumped in the
3110 * filtering process */
3111 uint32_t non_channel_beacons; /* beacons with our bss id but not on
3112 * our serving channel */
3113 uint32_t channel_beacons; /* beacons with our bss id and in our
3114 * serving channel */
3115 uint32_t num_missed_bcon; /* number of missed beacons */
3116 uint32_t adc_rx_saturation_time; /* count in 0.8us units the time the
3117 * ADC was in saturation */
3118 uint32_t ina_detection_search_time;/* total time (in 0.8us) searched
3119 * for INA */
3120 uint32_t beacon_silence_rssi[3];/* RSSI silence after beacon frame */
3121 uint32_t interference_data_flag; /* flag for interference data
3122 * availability. 1 when data is
3123 * available. */
3124 uint32_t channel_load; /* counts RX Enable time in uSec */
3125 uint32_t dsp_false_alarms; /* DSP false alarm (both OFDM
3126 * and CCK) counter */
3127 uint32_t beacon_rssi_a;
3128 uint32_t beacon_rssi_b;
3129 uint32_t beacon_rssi_c;
3130 uint32_t beacon_energy_a;
3131 uint32_t beacon_energy_b;
3132 uint32_t beacon_energy_c;
3133 uint32_t num_bt_kills;
3134 uint32_t mac_id;
3135 uint32_t directed_data_mpdu;
3136 } __packed; /* IWM_STATISTICS_RX_NON_PHY_API_S_VER_3 */
3137
3138 struct iwm_statistics_rx_phy {
3139 uint32_t ina_cnt;
3140 uint32_t fina_cnt;
3141 uint32_t plcp_err;
3142 uint32_t crc32_err;
3143 uint32_t overrun_err;
3144 uint32_t early_overrun_err;
3145 uint32_t crc32_good;
3146 uint32_t false_alarm_cnt;
3147 uint32_t fina_sync_err_cnt;
3148 uint32_t sfd_timeout;
3149 uint32_t fina_timeout;
3150 uint32_t unresponded_rts;
3151 uint32_t rxe_frame_limit_overrun;
3152 uint32_t sent_ack_cnt;
3153 uint32_t sent_cts_cnt;
3154 uint32_t sent_ba_rsp_cnt;
3155 uint32_t dsp_self_kill;
3156 uint32_t mh_format_err;
3157 uint32_t re_acq_main_rssi_sum;
3158 uint32_t reserved;
3159 } __packed; /* IWM_STATISTICS_RX_PHY_API_S_VER_2 */
3160
3161 struct iwm_statistics_rx_ht_phy {
3162 uint32_t plcp_err;
3163 uint32_t overrun_err;
3164 uint32_t early_overrun_err;
3165 uint32_t crc32_good;
3166 uint32_t crc32_err;
3167 uint32_t mh_format_err;
3168 uint32_t agg_crc32_good;
3169 uint32_t agg_mpdu_cnt;
3170 uint32_t agg_cnt;
3171 uint32_t unsupport_mcs;
3172 } __packed; /* IWM_STATISTICS_HT_RX_PHY_API_S_VER_1 */
3173
3174 struct iwm_statistics_tx_non_phy {
3175 uint32_t preamble_cnt;
3176 uint32_t rx_detected_cnt;
3177 uint32_t bt_prio_defer_cnt;
3178 uint32_t bt_prio_kill_cnt;
3179 uint32_t few_bytes_cnt;
3180 uint32_t cts_timeout;
3181 uint32_t ack_timeout;
3182 uint32_t expected_ack_cnt;
3183 uint32_t actual_ack_cnt;
3184 uint32_t dump_msdu_cnt;
3185 uint32_t burst_abort_next_frame_mismatch_cnt;
3186 uint32_t burst_abort_missing_next_frame_cnt;
3187 uint32_t cts_timeout_collision;
3188 uint32_t ack_or_ba_timeout_collision;
3189 } __packed; /* IWM_STATISTICS_TX_NON_PHY_API_S_VER_3 */
3190
3191 #define IWM_MAX_CHAINS 3
3192
3193 struct iwm_statistics_tx_non_phy_agg {
3194 uint32_t ba_timeout;
3195 uint32_t ba_reschedule_frames;
3196 uint32_t scd_query_agg_frame_cnt;
3197 uint32_t scd_query_no_agg;
3198 uint32_t scd_query_agg;
3199 uint32_t scd_query_mismatch;
3200 uint32_t frame_not_ready;
3201 uint32_t underrun;
3202 uint32_t bt_prio_kill;
3203 uint32_t rx_ba_rsp_cnt;
3204 int8_t txpower[IWM_MAX_CHAINS];
3205 int8_t reserved;
3206 uint32_t reserved2;
3207 } __packed; /* IWM_STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
3208
3209 struct iwm_statistics_tx_channel_width {
3210 uint32_t ext_cca_narrow_ch20[1];
3211 uint32_t ext_cca_narrow_ch40[2];
3212 uint32_t ext_cca_narrow_ch80[3];
3213 uint32_t ext_cca_narrow_ch160[4];
3214 uint32_t last_tx_ch_width_indx;
3215 uint32_t rx_detected_per_ch_width[4];
3216 uint32_t success_per_ch_width[4];
3217 uint32_t fail_per_ch_width[4];
3218 }; /* IWM_STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
3219
3220 struct iwm_statistics_tx {
3221 struct iwm_statistics_tx_non_phy general;
3222 struct iwm_statistics_tx_non_phy_agg agg;
3223 struct iwm_statistics_tx_channel_width channel_width;
3224 } __packed; /* IWM_STATISTICS_TX_API_S_VER_4 */
3225
3226
3227 struct iwm_statistics_bt_activity {
3228 uint32_t hi_priority_tx_req_cnt;
3229 uint32_t hi_priority_tx_denied_cnt;
3230 uint32_t lo_priority_tx_req_cnt;
3231 uint32_t lo_priority_tx_denied_cnt;
3232 uint32_t hi_priority_rx_req_cnt;
3233 uint32_t hi_priority_rx_denied_cnt;
3234 uint32_t lo_priority_rx_req_cnt;
3235 uint32_t lo_priority_rx_denied_cnt;
3236 } __packed; /* IWM_STATISTICS_BT_ACTIVITY_API_S_VER_1 */
3237
3238 struct iwm_statistics_general_v8 {
3239 uint32_t radio_temperature;
3240 uint32_t radio_voltage;
3241 struct iwm_statistics_dbg dbg;
3242 uint32_t sleep_time;
3243 uint32_t slots_out;
3244 uint32_t slots_idle;
3245 uint32_t ttl_timestamp;
3246 struct iwm_statistics_div slow_div;
3247 uint32_t rx_enable_counter;
3248 /*
3249 * num_of_sos_states:
3250 * count the number of times we have to re-tune
3251 * in order to get out of bad PHY status
3252 */
3253 uint32_t num_of_sos_states;
3254 uint32_t beacon_filtered;
3255 uint32_t missed_beacons;
3256 uint8_t beacon_filter_average_energy;
3257 uint8_t beacon_filter_reason;
3258 uint8_t beacon_filter_current_energy;
3259 uint8_t beacon_filter_reserved;
3260 uint32_t beacon_filter_delta_time;
3261 struct iwm_statistics_bt_activity bt_activity;
3262 uint64_t rx_time;
3263 uint64_t on_time_rf;
3264 uint64_t on_time_scan;
3265 uint64_t tx_time;
3266 uint32_t beacon_counter[IWM_NUM_MAC_INDEX];
3267 uint8_t beacon_average_energy[IWM_NUM_MAC_INDEX];
3268 uint8_t reserved[4 - (IWM_NUM_MAC_INDEX % 4)];
3269 } __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_8 */
3270
3271 struct iwm_statistics_rx {
3272 struct iwm_statistics_rx_phy ofdm;
3273 struct iwm_statistics_rx_phy cck;
3274 struct iwm_statistics_rx_non_phy general;
3275 struct iwm_statistics_rx_ht_phy ofdm_ht;
3276 } __packed; /* IWM_STATISTICS_RX_API_S_VER_3 */
3277
3278 /*
3279 * IWM_STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
3280 *
3281 * By default, uCode issues this notification after receiving a beacon
3282 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
3283 * IWM_STATISTICS_CMD (0x9c), below.
3284 */
3285
3286 struct iwm_notif_statistics_v10 {
3287 uint32_t flag;
3288 struct iwm_statistics_rx rx;
3289 struct iwm_statistics_tx tx;
3290 struct iwm_statistics_general_v8 general;
3291 } __packed; /* IWM_STATISTICS_NTFY_API_S_VER_10 */
3292
3293 #define IWM_STATISTICS_FLG_CLEAR 0x1
3294 #define IWM_STATISTICS_FLG_DISABLE_NOTIF 0x2
3295
3296 struct iwm_statistics_cmd {
3297 uint32_t flags;
3298 } __packed; /* IWM_STATISTICS_CMD_API_S_VER_1 */
3299
3300 /***********************************
3301 * Smart Fifo API
3302 ***********************************/
3303 /* Smart Fifo state */
3304 enum iwm_sf_state {
3305 IWM_SF_LONG_DELAY_ON = 0, /* should never be called by driver */
3306 IWM_SF_FULL_ON,
3307 IWM_SF_UNINIT,
3308 IWM_SF_INIT_OFF,
3309 IWM_SF_HW_NUM_STATES
3310 };
3311
3312 /* Smart Fifo possible scenario */
3313 enum iwm_sf_scenario {
3314 IWM_SF_SCENARIO_SINGLE_UNICAST,
3315 IWM_SF_SCENARIO_AGG_UNICAST,
3316 IWM_SF_SCENARIO_MULTICAST,
3317 IWM_SF_SCENARIO_BA_RESP,
3318 IWM_SF_SCENARIO_TX_RESP,
3319 IWM_SF_NUM_SCENARIO
3320 };
3321
3322 #define IWM_SF_TRANSIENT_STATES_NUMBER 2 /* IWM_SF_LONG_DELAY_ON and IWM_SF_FULL_ON */
3323 #define IWM_SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */
3324
3325 /* smart FIFO default values */
3326 #define IWM_SF_W_MARK_SISO 4096
3327 #define IWM_SF_W_MARK_MIMO2 8192
3328 #define IWM_SF_W_MARK_MIMO3 6144
3329 #define IWM_SF_W_MARK_LEGACY 4096
3330 #define IWM_SF_W_MARK_SCAN 4096
3331
3332 /* SF Scenarios timers for default configuration (aligned to 32 uSec) */
3333 #define IWM_SF_SINGLE_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
3334 #define IWM_SF_SINGLE_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
3335 #define IWM_SF_AGG_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
3336 #define IWM_SF_AGG_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
3337 #define IWM_SF_MCAST_IDLE_TIMER_DEF 160 /* 150 uSec */
3338 #define IWM_SF_MCAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
3339 #define IWM_SF_BA_IDLE_TIMER_DEF 160 /* 150 uSec */
3340 #define IWM_SF_BA_AGING_TIMER_DEF 400 /* 0.4 mSec */
3341 #define IWM_SF_TX_RE_IDLE_TIMER_DEF 160 /* 150 uSec */
3342 #define IWM_SF_TX_RE_AGING_TIMER_DEF 400 /* 0.4 mSec */
3343
3344 /* SF Scenarios timers for FULL_ON state (aligned to 32 uSec) */
3345 #define IWM_SF_SINGLE_UNICAST_IDLE_TIMER 320 /* 300 uSec */
3346 #define IWM_SF_SINGLE_UNICAST_AGING_TIMER 2016 /* 2 mSec */
3347 #define IWM_SF_AGG_UNICAST_IDLE_TIMER 320 /* 300 uSec */
3348 #define IWM_SF_AGG_UNICAST_AGING_TIMER 2016 /* 2 mSec */
3349 #define IWM_SF_MCAST_IDLE_TIMER 2016 /* 2 mSec */
3350 #define IWM_SF_MCAST_AGING_TIMER 10016 /* 10 mSec */
3351 #define IWM_SF_BA_IDLE_TIMER 320 /* 300 uSec */
3352 #define IWM_SF_BA_AGING_TIMER 2016 /* 2 mSec */
3353 #define IWM_SF_TX_RE_IDLE_TIMER 320 /* 300 uSec */
3354 #define IWM_SF_TX_RE_AGING_TIMER 2016 /* 2 mSec */
3355
3356 #define IWM_SF_LONG_DELAY_AGING_TIMER 1000000 /* 1 Sec */
3357
3358 #define IWM_SF_CFG_DUMMY_NOTIF_OFF (1 << 16)
3359
3360 /**
3361 * Smart Fifo configuration command.
3362 * @state: smart fifo state, types listed in iwm_sf_state.
3363 * @watermark: Minimum allowed available free space in RXF for transient state.
3364 * @long_delay_timeouts: aging and idle timer values for each scenario
3365 * in long delay state.
3366 * @full_on_timeouts: timer values for each scenario in full on state.
3367 */
3368 struct iwm_sf_cfg_cmd {
3369 uint32_t state;
3370 uint32_t watermark[IWM_SF_TRANSIENT_STATES_NUMBER];
3371 uint32_t long_delay_timeouts[IWM_SF_NUM_SCENARIO][IWM_SF_NUM_TIMEOUT_TYPES];
3372 uint32_t full_on_timeouts[IWM_SF_NUM_SCENARIO][IWM_SF_NUM_TIMEOUT_TYPES];
3373 } __packed; /* IWM_SF_CFG_API_S_VER_2 */
3374
3375 /*
3376 * END mvm/fw-api.h
3377 */
3378
3379 /*
3380 * BEGIN mvm/fw-api-mac.h
3381 */
3382
3383 enum iwm_ac {
3384 IWM_AC_BK,
3385 IWM_AC_BE,
3386 IWM_AC_VI,
3387 IWM_AC_VO,
3388 IWM_AC_NUM,
3389 };
3390
3391 /**
3392 * enum iwm_mac_protection_flags - MAC context flags
3393 * @IWM_MAC_PROT_FLG_TGG_PROTECT: 11g protection when transmitting OFDM frames,
3394 * this will require CCK RTS/CTS2self.
3395 * RTS/CTS will protect full burst time.
3396 * @IWM_MAC_PROT_FLG_HT_PROT: enable HT protection
3397 * @IWM_MAC_PROT_FLG_FAT_PROT: protect 40 MHz transmissions
3398 * @IWM_MAC_PROT_FLG_SELF_CTS_EN: allow CTS2self
3399 */
3400 enum iwm_mac_protection_flags {
3401 IWM_MAC_PROT_FLG_TGG_PROTECT = (1 << 3),
3402 IWM_MAC_PROT_FLG_HT_PROT = (1 << 23),
3403 IWM_MAC_PROT_FLG_FAT_PROT = (1 << 24),
3404 IWM_MAC_PROT_FLG_SELF_CTS_EN = (1 << 30),
3405 };
3406
3407 #define IWM_MAC_FLG_SHORT_SLOT (1 << 4)
3408 #define IWM_MAC_FLG_SHORT_PREAMBLE (1 << 5)
3409
3410 /**
3411 * enum iwm_mac_types - Supported MAC types
3412 * @IWM_FW_MAC_TYPE_FIRST: lowest supported MAC type
3413 * @IWM_FW_MAC_TYPE_AUX: Auxiliary MAC (internal)
3414 * @IWM_FW_MAC_TYPE_LISTENER: monitor MAC type (?)
3415 * @IWM_FW_MAC_TYPE_PIBSS: Pseudo-IBSS
3416 * @IWM_FW_MAC_TYPE_IBSS: IBSS
3417 * @IWM_FW_MAC_TYPE_BSS_STA: BSS (managed) station
3418 * @IWM_FW_MAC_TYPE_P2P_DEVICE: P2P Device
3419 * @IWM_FW_MAC_TYPE_P2P_STA: P2P client
3420 * @IWM_FW_MAC_TYPE_GO: P2P GO
3421 * @IWM_FW_MAC_TYPE_TEST: ?
3422 * @IWM_FW_MAC_TYPE_MAX: highest support MAC type
3423 */
3424 enum iwm_mac_types {
3425 IWM_FW_MAC_TYPE_FIRST = 1,
3426 IWM_FW_MAC_TYPE_AUX = IWM_FW_MAC_TYPE_FIRST,
3427 IWM_FW_MAC_TYPE_LISTENER,
3428 IWM_FW_MAC_TYPE_PIBSS,
3429 IWM_FW_MAC_TYPE_IBSS,
3430 IWM_FW_MAC_TYPE_BSS_STA,
3431 IWM_FW_MAC_TYPE_P2P_DEVICE,
3432 IWM_FW_MAC_TYPE_P2P_STA,
3433 IWM_FW_MAC_TYPE_GO,
3434 IWM_FW_MAC_TYPE_TEST,
3435 IWM_FW_MAC_TYPE_MAX = IWM_FW_MAC_TYPE_TEST
3436 }; /* IWM_MAC_CONTEXT_TYPE_API_E_VER_1 */
3437
3438 /**
3439 * enum iwm_tsf_id - TSF hw timer ID
3440 * @IWM_TSF_ID_A: use TSF A
3441 * @IWM_TSF_ID_B: use TSF B
3442 * @IWM_TSF_ID_C: use TSF C
3443 * @IWM_TSF_ID_D: use TSF D
3444 * @IWM_NUM_TSF_IDS: number of TSF timers available
3445 */
3446 enum iwm_tsf_id {
3447 IWM_TSF_ID_A = 0,
3448 IWM_TSF_ID_B = 1,
3449 IWM_TSF_ID_C = 2,
3450 IWM_TSF_ID_D = 3,
3451 IWM_NUM_TSF_IDS = 4,
3452 }; /* IWM_TSF_ID_API_E_VER_1 */
3453
3454 /**
3455 * struct iwm_mac_data_ap - configuration data for AP MAC context
3456 * @beacon_time: beacon transmit time in system time
3457 * @beacon_tsf: beacon transmit time in TSF
3458 * @bi: beacon interval in TU
3459 * @bi_reciprocal: 2^32 / bi
3460 * @dtim_interval: dtim transmit time in TU
3461 * @dtim_reciprocal: 2^32 / dtim_interval
3462 * @mcast_qid: queue ID for multicast traffic
3463 * @beacon_template: beacon template ID
3464 */
3465 struct iwm_mac_data_ap {
3466 uint32_t beacon_time;
3467 uint64_t beacon_tsf;
3468 uint32_t bi;
3469 uint32_t bi_reciprocal;
3470 uint32_t dtim_interval;
3471 uint32_t dtim_reciprocal;
3472 uint32_t mcast_qid;
3473 uint32_t beacon_template;
3474 } __packed; /* AP_MAC_DATA_API_S_VER_1 */
3475
3476 /**
3477 * struct iwm_mac_data_ibss - configuration data for IBSS MAC context
3478 * @beacon_time: beacon transmit time in system time
3479 * @beacon_tsf: beacon transmit time in TSF
3480 * @bi: beacon interval in TU
3481 * @bi_reciprocal: 2^32 / bi
3482 * @beacon_template: beacon template ID
3483 */
3484 struct iwm_mac_data_ibss {
3485 uint32_t beacon_time;
3486 uint64_t beacon_tsf;
3487 uint32_t bi;
3488 uint32_t bi_reciprocal;
3489 uint32_t beacon_template;
3490 } __packed; /* IBSS_MAC_DATA_API_S_VER_1 */
3491
3492 /**
3493 * struct iwm_mac_data_sta - configuration data for station MAC context
3494 * @is_assoc: 1 for associated state, 0 otherwise
3495 * @dtim_time: DTIM arrival time in system time
3496 * @dtim_tsf: DTIM arrival time in TSF
3497 * @bi: beacon interval in TU, applicable only when associated
3498 * @bi_reciprocal: 2^32 / bi , applicable only when associated
3499 * @dtim_interval: DTIM interval in TU, applicable only when associated
3500 * @dtim_reciprocal: 2^32 / dtim_interval , applicable only when associated
3501 * @listen_interval: in beacon intervals, applicable only when associated
3502 * @assoc_id: unique ID assigned by the AP during association
3503 */
3504 struct iwm_mac_data_sta {
3505 uint32_t is_assoc;
3506 uint32_t dtim_time;
3507 uint64_t dtim_tsf;
3508 uint32_t bi;
3509 uint32_t bi_reciprocal;
3510 uint32_t dtim_interval;
3511 uint32_t dtim_reciprocal;
3512 uint32_t listen_interval;
3513 uint32_t assoc_id;
3514 uint32_t assoc_beacon_arrive_time;
3515 } __packed; /* IWM_STA_MAC_DATA_API_S_VER_1 */
3516
3517 /**
3518 * struct iwm_mac_data_go - configuration data for P2P GO MAC context
3519 * @ap: iwm_mac_data_ap struct with most config data
3520 * @ctwin: client traffic window in TU (period after TBTT when GO is present).
3521 * 0 indicates that there is no CT window.
3522 * @opp_ps_enabled: indicate that opportunistic PS allowed
3523 */
3524 struct iwm_mac_data_go {
3525 struct iwm_mac_data_ap ap;
3526 uint32_t ctwin;
3527 uint32_t opp_ps_enabled;
3528 } __packed; /* GO_MAC_DATA_API_S_VER_1 */
3529
3530 /**
3531 * struct iwm_mac_data_p2p_sta - configuration data for P2P client MAC context
3532 * @sta: iwm_mac_data_sta struct with most config data
3533 * @ctwin: client traffic window in TU (period after TBTT when GO is present).
3534 * 0 indicates that there is no CT window.
3535 */
3536 struct iwm_mac_data_p2p_sta {
3537 struct iwm_mac_data_sta sta;
3538 uint32_t ctwin;
3539 } __packed; /* P2P_STA_MAC_DATA_API_S_VER_1 */
3540
3541 /**
3542 * struct iwm_mac_data_pibss - Pseudo IBSS config data
3543 * @stats_interval: interval in TU between statistics notifications to host.
3544 */
3545 struct iwm_mac_data_pibss {
3546 uint32_t stats_interval;
3547 } __packed; /* PIBSS_MAC_DATA_API_S_VER_1 */
3548
3549 /*
3550 * struct iwm_mac_data_p2p_dev - configuration data for the P2P Device MAC
3551 * context.
3552 * @is_disc_extended: if set to true, P2P Device discoverability is enabled on
3553 * other channels as well. This should be to true only in case that the
3554 * device is discoverable and there is an active GO. Note that setting this
3555 * field when not needed, will increase the number of interrupts and have
3556 * effect on the platform power, as this setting opens the Rx filters on
3557 * all macs.
3558 */
3559 struct iwm_mac_data_p2p_dev {
3560 uint32_t is_disc_extended;
3561 } __packed; /* _P2P_DEV_MAC_DATA_API_S_VER_1 */
3562
3563 /**
3564 * enum iwm_mac_filter_flags - MAC context filter flags
3565 * @IWM_MAC_FILTER_IN_PROMISC: accept all data frames
3566 * @IWM_MAC_FILTER_IN_CONTROL_AND_MGMT: pass all mangement and
3567 * control frames to the host
3568 * @IWM_MAC_FILTER_ACCEPT_GRP: accept multicast frames
3569 * @IWM_MAC_FILTER_DIS_DECRYPT: don't decrypt unicast frames
3570 * @IWM_MAC_FILTER_DIS_GRP_DECRYPT: don't decrypt multicast frames
3571 * @IWM_MAC_FILTER_IN_BEACON: transfer foreign BSS's beacons to host
3572 * (in station mode when associated)
3573 * @IWM_MAC_FILTER_OUT_BCAST: filter out all broadcast frames
3574 * @IWM_MAC_FILTER_IN_CRC32: extract FCS and append it to frames
3575 * @IWM_MAC_FILTER_IN_PROBE_REQUEST: pass probe requests to host
3576 */
3577 enum iwm_mac_filter_flags {
3578 IWM_MAC_FILTER_IN_PROMISC = (1 << 0),
3579 IWM_MAC_FILTER_IN_CONTROL_AND_MGMT = (1 << 1),
3580 IWM_MAC_FILTER_ACCEPT_GRP = (1 << 2),
3581 IWM_MAC_FILTER_DIS_DECRYPT = (1 << 3),
3582 IWM_MAC_FILTER_DIS_GRP_DECRYPT = (1 << 4),
3583 IWM_MAC_FILTER_IN_BEACON = (1 << 6),
3584 IWM_MAC_FILTER_OUT_BCAST = (1 << 8),
3585 IWM_MAC_FILTER_IN_CRC32 = (1 << 11),
3586 IWM_MAC_FILTER_IN_PROBE_REQUEST = (1 << 12),
3587 };
3588
3589 /**
3590 * enum iwm_mac_qos_flags - QoS flags
3591 * @IWM_MAC_QOS_FLG_UPDATE_EDCA: ?
3592 * @IWM_MAC_QOS_FLG_TGN: HT is enabled
3593 * @IWM_MAC_QOS_FLG_TXOP_TYPE: ?
3594 *
3595 */
3596 enum iwm_mac_qos_flags {
3597 IWM_MAC_QOS_FLG_UPDATE_EDCA = (1 << 0),
3598 IWM_MAC_QOS_FLG_TGN = (1 << 1),
3599 IWM_MAC_QOS_FLG_TXOP_TYPE = (1 << 4),
3600 };
3601
3602 /**
3603 * struct iwm_ac_qos - QOS timing params for IWM_MAC_CONTEXT_CMD
3604 * @cw_min: Contention window, start value in numbers of slots.
3605 * Should be a power-of-2, minus 1. Device's default is 0x0f.
3606 * @cw_max: Contention window, max value in numbers of slots.
3607 * Should be a power-of-2, minus 1. Device's default is 0x3f.
3608 * @aifsn: Number of slots in Arbitration Interframe Space (before
3609 * performing random backoff timing prior to Tx). Device default 1.
3610 * @fifos_mask: FIFOs used by this MAC for this AC
3611 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
3612 *
3613 * One instance of this config struct for each of 4 EDCA access categories
3614 * in struct iwm_qosparam_cmd.
3615 *
3616 * Device will automatically increase contention window by (2*CW) + 1 for each
3617 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
3618 * value, to cap the CW value.
3619 */
3620 struct iwm_ac_qos {
3621 uint16_t cw_min;
3622 uint16_t cw_max;
3623 uint8_t aifsn;
3624 uint8_t fifos_mask;
3625 uint16_t edca_txop;
3626 } __packed; /* IWM_AC_QOS_API_S_VER_2 */
3627
3628 /**
3629 * struct iwm_mac_ctx_cmd - command structure to configure MAC contexts
3630 * ( IWM_MAC_CONTEXT_CMD = 0x28 )
3631 * @id_and_color: ID and color of the MAC
3632 * @action: action to perform, one of IWM_FW_CTXT_ACTION_*
3633 * @mac_type: one of IWM_FW_MAC_TYPE_*
3634 * @tsd_id: TSF HW timer, one of IWM_TSF_ID_*
3635 * @node_addr: MAC address
3636 * @bssid_addr: BSSID
3637 * @cck_rates: basic rates available for CCK
3638 * @ofdm_rates: basic rates available for OFDM
3639 * @protection_flags: combination of IWM_MAC_PROT_FLG_FLAG_*
3640 * @cck_short_preamble: 0x20 for enabling short preamble, 0 otherwise
3641 * @short_slot: 0x10 for enabling short slots, 0 otherwise
3642 * @filter_flags: combination of IWM_MAC_FILTER_*
3643 * @qos_flags: from IWM_MAC_QOS_FLG_*
3644 * @ac: one iwm_mac_qos configuration for each AC
3645 * @mac_specific: one of struct iwm_mac_data_*, according to mac_type
3646 */
3647 struct iwm_mac_ctx_cmd {
3648 /* COMMON_INDEX_HDR_API_S_VER_1 */
3649 uint32_t id_and_color;
3650 uint32_t action;
3651 /* IWM_MAC_CONTEXT_COMMON_DATA_API_S_VER_1 */
3652 uint32_t mac_type;
3653 uint32_t tsf_id;
3654 uint8_t node_addr[6];
3655 uint16_t reserved_for_node_addr;
3656 uint8_t bssid_addr[6];
3657 uint16_t reserved_for_bssid_addr;
3658 uint32_t cck_rates;
3659 uint32_t ofdm_rates;
3660 uint32_t protection_flags;
3661 uint32_t cck_short_preamble;
3662 uint32_t short_slot;
3663 uint32_t filter_flags;
3664 /* IWM_MAC_QOS_PARAM_API_S_VER_1 */
3665 uint32_t qos_flags;
3666 struct iwm_ac_qos ac[IWM_AC_NUM+1];
3667 /* IWM_MAC_CONTEXT_COMMON_DATA_API_S */
3668 union {
3669 struct iwm_mac_data_ap ap;
3670 struct iwm_mac_data_go go;
3671 struct iwm_mac_data_sta sta;
3672 struct iwm_mac_data_p2p_sta p2p_sta;
3673 struct iwm_mac_data_p2p_dev p2p_dev;
3674 struct iwm_mac_data_pibss pibss;
3675 struct iwm_mac_data_ibss ibss;
3676 };
3677 } __packed; /* IWM_MAC_CONTEXT_CMD_API_S_VER_1 */
3678
iwm_reciprocal(uint32_t v)3679 static inline uint32_t iwm_reciprocal(uint32_t v)
3680 {
3681 if (!v)
3682 return 0;
3683 return 0xFFFFFFFF / v;
3684 }
3685
3686 #define IWM_NONQOS_SEQ_GET 0x1
3687 #define IWM_NONQOS_SEQ_SET 0x2
3688 struct iwm_nonqos_seq_query_cmd {
3689 uint32_t get_set_flag;
3690 uint32_t mac_id_n_color;
3691 uint16_t value;
3692 uint16_t reserved;
3693 } __packed; /* IWM_NON_QOS_TX_COUNTER_GET_SET_API_S_VER_1 */
3694
3695 /*
3696 * END mvm/fw-api-mac.h
3697 */
3698
3699 /*
3700 * BEGIN mvm/fw-api-power.h
3701 */
3702
3703 /* Power Management Commands, Responses, Notifications */
3704
3705 /**
3706 * enum iwm_ltr_config_flags - masks for LTR config command flags
3707 * @IWM_LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
3708 * @IWM_LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
3709 * memory access
3710 * @IWM_LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
3711 * reg change
3712 * @IWM_LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
3713 * D0 to D3
3714 * @IWM_LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
3715 * @IWM_LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
3716 * @IWM_LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
3717 */
3718 enum iwm_ltr_config_flags {
3719 IWM_LTR_CFG_FLAG_FEATURE_ENABLE = (1 << 0),
3720 IWM_LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = (1 << 1),
3721 IWM_LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = (1 << 2),
3722 IWM_LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = (1 << 3),
3723 IWM_LTR_CFG_FLAG_SW_SET_SHORT = (1 << 4),
3724 IWM_LTR_CFG_FLAG_SW_SET_LONG = (1 << 5),
3725 IWM_LTR_CFG_FLAG_DENIE_C10_ON_PD = (1 << 6),
3726 };
3727
3728 /**
3729 * struct iwm_ltr_config_cmd_v1 - configures the LTR
3730 * @flags: See %enum iwm_ltr_config_flags
3731 */
3732 struct iwm_ltr_config_cmd_v1 {
3733 uint32_t flags;
3734 uint32_t static_long;
3735 uint32_t static_short;
3736 } __packed; /* LTR_CAPABLE_API_S_VER_1 */
3737
3738 #define IWM_LTR_VALID_STATES_NUM 4
3739
3740 /**
3741 * struct iwm_ltr_config_cmd - configures the LTR
3742 * @flags: See %enum iwm_ltr_config_flags
3743 * @static_long:
3744 * @static_short:
3745 * @ltr_cfg_values:
3746 * @ltr_short_idle_timeout:
3747 */
3748 struct iwm_ltr_config_cmd {
3749 uint32_t flags;
3750 uint32_t static_long;
3751 uint32_t static_short;
3752 uint32_t ltr_cfg_values[IWM_LTR_VALID_STATES_NUM];
3753 uint32_t ltr_short_idle_timeout;
3754 } __packed; /* LTR_CAPABLE_API_S_VER_2 */
3755
3756 /* Radio LP RX Energy Threshold measured in dBm */
3757 #define IWM_POWER_LPRX_RSSI_THRESHOLD 75
3758 #define IWM_POWER_LPRX_RSSI_THRESHOLD_MAX 94
3759 #define IWM_POWER_LPRX_RSSI_THRESHOLD_MIN 30
3760
3761 /**
3762 * enum iwm_scan_flags - masks for power table command flags
3763 * @IWM_POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
3764 * receiver and transmitter. '0' - does not allow.
3765 * @IWM_POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
3766 * '1' Driver enables PM (use rest of parameters)
3767 * @IWM_POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
3768 * '1' PM could sleep over DTIM till listen Interval.
3769 * @IWM_POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
3770 * access categories are both delivery and trigger enabled.
3771 * @IWM_POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
3772 * PBW Snoozing enabled
3773 * @IWM_POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
3774 * @IWM_POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
3775 * @IWM_POWER_FLAGS_AP_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
3776 * detection enablement
3777 */
3778 enum iwm_power_flags {
3779 IWM_POWER_FLAGS_POWER_SAVE_ENA_MSK = (1 << 0),
3780 IWM_POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = (1 << 1),
3781 IWM_POWER_FLAGS_SKIP_OVER_DTIM_MSK = (1 << 2),
3782 IWM_POWER_FLAGS_SNOOZE_ENA_MSK = (1 << 5),
3783 IWM_POWER_FLAGS_BT_SCO_ENA = (1 << 8),
3784 IWM_POWER_FLAGS_ADVANCE_PM_ENA_MSK = (1 << 9),
3785 IWM_POWER_FLAGS_LPRX_ENA_MSK = (1 << 11),
3786 IWM_POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK = (1 << 12),
3787 };
3788
3789 #define IWM_POWER_VEC_SIZE 5
3790
3791 /**
3792 * struct iwm_powertable_cmd - legacy power command. Beside old API support this
3793 * is used also with a new power API for device wide power settings.
3794 * IWM_POWER_TABLE_CMD = 0x77 (command, has simple generic response)
3795 *
3796 * @flags: Power table command flags from IWM_POWER_FLAGS_*
3797 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
3798 * Minimum allowed:- 3 * DTIM. Keep alive period must be
3799 * set regardless of power scheme or current power state.
3800 * FW use this value also when PM is disabled.
3801 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
3802 * PSM transition - legacy PM
3803 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
3804 * PSM transition - legacy PM
3805 * @sleep_interval: not in use
3806 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
3807 * is set. For example, if it is required to skip over
3808 * one DTIM, this value need to be set to 2 (DTIM periods).
3809 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
3810 * Default: 80dbm
3811 */
3812 struct iwm_powertable_cmd {
3813 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
3814 uint16_t flags;
3815 uint8_t keep_alive_seconds;
3816 uint8_t debug_flags;
3817 uint32_t rx_data_timeout;
3818 uint32_t tx_data_timeout;
3819 uint32_t sleep_interval[IWM_POWER_VEC_SIZE];
3820 uint32_t skip_dtim_periods;
3821 uint32_t lprx_rssi_threshold;
3822 } __packed;
3823
3824 /**
3825 * enum iwm_device_power_flags - masks for device power command flags
3826 * @IWM_DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
3827 * receiver and transmitter. '0' - does not allow.
3828 */
3829 enum iwm_device_power_flags {
3830 IWM_DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = (1 << 0),
3831 };
3832
3833 /**
3834 * struct iwm_device_power_cmd - device wide power command.
3835 * IWM_DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
3836 *
3837 * @flags: Power table command flags from IWM_DEVICE_POWER_FLAGS_*
3838 */
3839 struct iwm_device_power_cmd {
3840 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
3841 uint16_t flags;
3842 uint16_t reserved;
3843 } __packed;
3844
3845 /**
3846 * struct iwm_mac_power_cmd - New power command containing uAPSD support
3847 * IWM_MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
3848 * @id_and_color: MAC contex identifier
3849 * @flags: Power table command flags from POWER_FLAGS_*
3850 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
3851 * Minimum allowed:- 3 * DTIM. Keep alive period must be
3852 * set regardless of power scheme or current power state.
3853 * FW use this value also when PM is disabled.
3854 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
3855 * PSM transition - legacy PM
3856 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
3857 * PSM transition - legacy PM
3858 * @sleep_interval: not in use
3859 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
3860 * is set. For example, if it is required to skip over
3861 * one DTIM, this value need to be set to 2 (DTIM periods).
3862 * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
3863 * PSM transition - uAPSD
3864 * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
3865 * PSM transition - uAPSD
3866 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
3867 * Default: 80dbm
3868 * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
3869 * @snooze_interval: Maximum time between attempts to retrieve buffered data
3870 * from the AP [msec]
3871 * @snooze_window: A window of time in which PBW snoozing insures that all
3872 * packets received. It is also the minimum time from last
3873 * received unicast RX packet, before client stops snoozing
3874 * for data. [msec]
3875 * @snooze_step: TBD
3876 * @qndp_tid: TID client shall use for uAPSD QNDP triggers
3877 * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
3878 * each corresponding AC.
3879 * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
3880 * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
3881 * values.
3882 * @heavy_tx_thld_packets: TX threshold measured in number of packets
3883 * @heavy_rx_thld_packets: RX threshold measured in number of packets
3884 * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
3885 * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
3886 * @limited_ps_threshold:
3887 */
3888 struct iwm_mac_power_cmd {
3889 /* CONTEXT_DESC_API_T_VER_1 */
3890 uint32_t id_and_color;
3891
3892 /* CLIENT_PM_POWER_TABLE_S_VER_1 */
3893 uint16_t flags;
3894 uint16_t keep_alive_seconds;
3895 uint32_t rx_data_timeout;
3896 uint32_t tx_data_timeout;
3897 uint32_t rx_data_timeout_uapsd;
3898 uint32_t tx_data_timeout_uapsd;
3899 uint8_t lprx_rssi_threshold;
3900 uint8_t skip_dtim_periods;
3901 uint16_t snooze_interval;
3902 uint16_t snooze_window;
3903 uint8_t snooze_step;
3904 uint8_t qndp_tid;
3905 uint8_t uapsd_ac_flags;
3906 uint8_t uapsd_max_sp;
3907 uint8_t heavy_tx_thld_packets;
3908 uint8_t heavy_rx_thld_packets;
3909 uint8_t heavy_tx_thld_percentage;
3910 uint8_t heavy_rx_thld_percentage;
3911 uint8_t limited_ps_threshold;
3912 uint8_t reserved;
3913 } __packed;
3914
3915 /*
3916 * struct iwm_uapsd_misbehaving_ap_notif - FW sends this notification when
3917 * associated AP is identified as improperly implementing uAPSD protocol.
3918 * IWM_PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
3919 * @sta_id: index of station in uCode's station table - associated AP ID in
3920 * this context.
3921 */
3922 struct iwm_uapsd_misbehaving_ap_notif {
3923 uint32_t sta_id;
3924 uint8_t mac_id;
3925 uint8_t reserved[3];
3926 } __packed;
3927
3928 /**
3929 * struct iwm_beacon_filter_cmd
3930 * IWM_REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
3931 * @id_and_color: MAC contex identifier
3932 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
3933 * to driver if delta in Energy values calculated for this and last
3934 * passed beacon is greater than this threshold. Zero value means that
3935 * the Energy change is ignored for beacon filtering, and beacon will
3936 * not be forced to be sent to driver regardless of this delta. Typical
3937 * energy delta 5dB.
3938 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
3939 * Send beacon to driver if delta in Energy values calculated for this
3940 * and last passed beacon is greater than this threshold. Zero value
3941 * means that the Energy change is ignored for beacon filtering while in
3942 * Roaming state, typical energy delta 1dB.
3943 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
3944 * calculated for current beacon is less than the threshold, use
3945 * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
3946 * Threshold. Typical energy threshold is -72dBm.
3947 * @bf_temp_threshold: This threshold determines the type of temperature
3948 * filtering (Slow or Fast) that is selected (Units are in Celsuis):
3949 * If the current temperature is above this threshold - Fast filter
3950 * will be used, If the current temperature is below this threshold -
3951 * Slow filter will be used.
3952 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
3953 * calculated for this and the last passed beacon is greater than this
3954 * threshold. Zero value means that the temperature change is ignored for
3955 * beacon filtering; beacons will not be forced to be sent to driver
3956 * regardless of whether its temperature has been changed.
3957 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
3958 * calculated for this and the last passed beacon is greater than this
3959 * threshold. Zero value means that the temperature change is ignored for
3960 * beacon filtering; beacons will not be forced to be sent to driver
3961 * regardless of whether its temperature has been changed.
3962 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
3963 * @bf_filter_escape_timer: Send beacons to the driver if no beacons were passed
3964 * for a specific period of time. Units: Beacons.
3965 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
3966 * for a longer period of time then this escape-timeout. Units: Beacons.
3967 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
3968 */
3969 struct iwm_beacon_filter_cmd {
3970 uint32_t bf_energy_delta;
3971 uint32_t bf_roaming_energy_delta;
3972 uint32_t bf_roaming_state;
3973 uint32_t bf_temp_threshold;
3974 uint32_t bf_temp_fast_filter;
3975 uint32_t bf_temp_slow_filter;
3976 uint32_t bf_enable_beacon_filter;
3977 uint32_t bf_debug_flag;
3978 uint32_t bf_escape_timer;
3979 uint32_t ba_escape_timer;
3980 uint32_t ba_enable_beacon_abort;
3981 } __packed;
3982
3983 /* Beacon filtering and beacon abort */
3984 #define IWM_BF_ENERGY_DELTA_DEFAULT 5
3985 #define IWM_BF_ENERGY_DELTA_MAX 255
3986 #define IWM_BF_ENERGY_DELTA_MIN 0
3987
3988 #define IWM_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
3989 #define IWM_BF_ROAMING_ENERGY_DELTA_MAX 255
3990 #define IWM_BF_ROAMING_ENERGY_DELTA_MIN 0
3991
3992 #define IWM_BF_ROAMING_STATE_DEFAULT 72
3993 #define IWM_BF_ROAMING_STATE_MAX 255
3994 #define IWM_BF_ROAMING_STATE_MIN 0
3995
3996 #define IWM_BF_TEMP_THRESHOLD_DEFAULT 112
3997 #define IWM_BF_TEMP_THRESHOLD_MAX 255
3998 #define IWM_BF_TEMP_THRESHOLD_MIN 0
3999
4000 #define IWM_BF_TEMP_FAST_FILTER_DEFAULT 1
4001 #define IWM_BF_TEMP_FAST_FILTER_MAX 255
4002 #define IWM_BF_TEMP_FAST_FILTER_MIN 0
4003
4004 #define IWM_BF_TEMP_SLOW_FILTER_DEFAULT 5
4005 #define IWM_BF_TEMP_SLOW_FILTER_MAX 255
4006 #define IWM_BF_TEMP_SLOW_FILTER_MIN 0
4007
4008 #define IWM_BF_ENABLE_BEACON_FILTER_DEFAULT 1
4009
4010 #define IWM_BF_DEBUG_FLAG_DEFAULT 0
4011
4012 #define IWM_BF_ESCAPE_TIMER_DEFAULT 50
4013 #define IWM_BF_ESCAPE_TIMER_MAX 1024
4014 #define IWM_BF_ESCAPE_TIMER_MIN 0
4015
4016 #define IWM_BA_ESCAPE_TIMER_DEFAULT 6
4017 #define IWM_BA_ESCAPE_TIMER_D3 9
4018 #define IWM_BA_ESCAPE_TIMER_MAX 1024
4019 #define IWM_BA_ESCAPE_TIMER_MIN 0
4020
4021 #define IWM_BA_ENABLE_BEACON_ABORT_DEFAULT 1
4022
4023 #define IWM_BF_CMD_CONFIG_DEFAULTS \
4024 .bf_energy_delta = htole32(IWM_BF_ENERGY_DELTA_DEFAULT), \
4025 .bf_roaming_energy_delta = \
4026 htole32(IWM_BF_ROAMING_ENERGY_DELTA_DEFAULT), \
4027 .bf_roaming_state = htole32(IWM_BF_ROAMING_STATE_DEFAULT), \
4028 .bf_temp_threshold = htole32(IWM_BF_TEMP_THRESHOLD_DEFAULT), \
4029 .bf_temp_fast_filter = htole32(IWM_BF_TEMP_FAST_FILTER_DEFAULT), \
4030 .bf_temp_slow_filter = htole32(IWM_BF_TEMP_SLOW_FILTER_DEFAULT), \
4031 .bf_debug_flag = htole32(IWM_BF_DEBUG_FLAG_DEFAULT), \
4032 .bf_escape_timer = htole32(IWM_BF_ESCAPE_TIMER_DEFAULT), \
4033 .ba_escape_timer = htole32(IWM_BA_ESCAPE_TIMER_DEFAULT)
4034
4035 /*
4036 * END mvm/fw-api-power.h
4037 */
4038
4039 /*
4040 * BEGIN mvm/fw-api-rs.h
4041 */
4042
4043 /*
4044 * These serve as indexes into
4045 * struct iwm_rate_info fw_rate_idx_to_plcp[IWM_RATE_COUNT];
4046 * TODO: avoid overlap between legacy and HT rates
4047 */
4048 enum {
4049 IWM_RATE_1M_INDEX = 0,
4050 IWM_FIRST_CCK_RATE = IWM_RATE_1M_INDEX,
4051 IWM_RATE_2M_INDEX,
4052 IWM_RATE_5M_INDEX,
4053 IWM_RATE_11M_INDEX,
4054 IWM_LAST_CCK_RATE = IWM_RATE_11M_INDEX,
4055 IWM_RATE_6M_INDEX,
4056 IWM_FIRST_OFDM_RATE = IWM_RATE_6M_INDEX,
4057 IWM_RATE_MCS_0_INDEX = IWM_RATE_6M_INDEX,
4058 IWM_FIRST_HT_RATE = IWM_RATE_MCS_0_INDEX,
4059 IWM_FIRST_VHT_RATE = IWM_RATE_MCS_0_INDEX,
4060 IWM_RATE_9M_INDEX,
4061 IWM_RATE_12M_INDEX,
4062 IWM_RATE_MCS_1_INDEX = IWM_RATE_12M_INDEX,
4063 IWM_RATE_18M_INDEX,
4064 IWM_RATE_MCS_2_INDEX = IWM_RATE_18M_INDEX,
4065 IWM_RATE_24M_INDEX,
4066 IWM_RATE_MCS_3_INDEX = IWM_RATE_24M_INDEX,
4067 IWM_RATE_36M_INDEX,
4068 IWM_RATE_MCS_4_INDEX = IWM_RATE_36M_INDEX,
4069 IWM_RATE_48M_INDEX,
4070 IWM_RATE_MCS_5_INDEX = IWM_RATE_48M_INDEX,
4071 IWM_RATE_54M_INDEX,
4072 IWM_RATE_MCS_6_INDEX = IWM_RATE_54M_INDEX,
4073 IWM_LAST_NON_HT_RATE = IWM_RATE_54M_INDEX,
4074 IWM_RATE_60M_INDEX,
4075 IWM_RATE_MCS_7_INDEX = IWM_RATE_60M_INDEX,
4076 IWM_LAST_HT_RATE = IWM_RATE_MCS_7_INDEX,
4077 IWM_RATE_MCS_8_INDEX,
4078 IWM_RATE_MCS_9_INDEX,
4079 IWM_LAST_VHT_RATE = IWM_RATE_MCS_9_INDEX,
4080 IWM_RATE_COUNT_LEGACY = IWM_LAST_NON_HT_RATE + 1,
4081 IWM_RATE_COUNT = IWM_LAST_VHT_RATE + 1,
4082 };
4083
4084 #define IWM_RATE_BIT_MSK(r) (1 << (IWM_RATE_##r##M_INDEX))
4085
4086 /* fw API values for legacy bit rates, both OFDM and CCK */
4087 enum {
4088 IWM_RATE_6M_PLCP = 13,
4089 IWM_RATE_9M_PLCP = 15,
4090 IWM_RATE_12M_PLCP = 5,
4091 IWM_RATE_18M_PLCP = 7,
4092 IWM_RATE_24M_PLCP = 9,
4093 IWM_RATE_36M_PLCP = 11,
4094 IWM_RATE_48M_PLCP = 1,
4095 IWM_RATE_54M_PLCP = 3,
4096 IWM_RATE_1M_PLCP = 10,
4097 IWM_RATE_2M_PLCP = 20,
4098 IWM_RATE_5M_PLCP = 55,
4099 IWM_RATE_11M_PLCP = 110,
4100 IWM_RATE_INVM_PLCP = -1,
4101 };
4102
4103 /*
4104 * rate_n_flags bit fields
4105 *
4106 * The 32-bit value has different layouts in the low 8 bites depending on the
4107 * format. There are three formats, HT, VHT and legacy (11abg, with subformats
4108 * for CCK and OFDM).
4109 *
4110 * High-throughput (HT) rate format
4111 * bit 8 is 1, bit 26 is 0, bit 9 is 0 (OFDM)
4112 * Very High-throughput (VHT) rate format
4113 * bit 8 is 0, bit 26 is 1, bit 9 is 0 (OFDM)
4114 * Legacy OFDM rate format for bits 7:0
4115 * bit 8 is 0, bit 26 is 0, bit 9 is 0 (OFDM)
4116 * Legacy CCK rate format for bits 7:0:
4117 * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK)
4118 */
4119
4120 /* Bit 8: (1) HT format, (0) legacy or VHT format */
4121 #define IWM_RATE_MCS_HT_POS 8
4122 #define IWM_RATE_MCS_HT_MSK (1 << IWM_RATE_MCS_HT_POS)
4123
4124 /* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
4125 #define IWM_RATE_MCS_CCK_POS 9
4126 #define IWM_RATE_MCS_CCK_MSK (1 << IWM_RATE_MCS_CCK_POS)
4127
4128 /* Bit 26: (1) VHT format, (0) legacy format in bits 8:0 */
4129 #define IWM_RATE_MCS_VHT_POS 26
4130 #define IWM_RATE_MCS_VHT_MSK (1 << IWM_RATE_MCS_VHT_POS)
4131
4132
4133 /*
4134 * High-throughput (HT) rate format for bits 7:0
4135 *
4136 * 2-0: MCS rate base
4137 * 0) 6 Mbps
4138 * 1) 12 Mbps
4139 * 2) 18 Mbps
4140 * 3) 24 Mbps
4141 * 4) 36 Mbps
4142 * 5) 48 Mbps
4143 * 6) 54 Mbps
4144 * 7) 60 Mbps
4145 * 4-3: 0) Single stream (SISO)
4146 * 1) Dual stream (MIMO)
4147 * 2) Triple stream (MIMO)
4148 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
4149 * (bits 7-6 are zero)
4150 *
4151 * Together the low 5 bits work out to the MCS index because we don't
4152 * support MCSes above 15/23, and 0-7 have one stream, 8-15 have two
4153 * streams and 16-23 have three streams. We could also support MCS 32
4154 * which is the duplicate 20 MHz MCS (bit 5 set, all others zero.)
4155 */
4156 #define IWM_RATE_HT_MCS_RATE_CODE_MSK 0x7
4157 #define IWM_RATE_HT_MCS_NSS_POS 3
4158 #define IWM_RATE_HT_MCS_NSS_MSK (3 << IWM_RATE_HT_MCS_NSS_POS)
4159
4160 /* Bit 10: (1) Use Green Field preamble */
4161 #define IWM_RATE_HT_MCS_GF_POS 10
4162 #define IWM_RATE_HT_MCS_GF_MSK (1 << IWM_RATE_HT_MCS_GF_POS)
4163
4164 #define IWM_RATE_HT_MCS_INDEX_MSK 0x3f
4165
4166 /*
4167 * Very High-throughput (VHT) rate format for bits 7:0
4168 *
4169 * 3-0: VHT MCS (0-9)
4170 * 5-4: number of streams - 1:
4171 * 0) Single stream (SISO)
4172 * 1) Dual stream (MIMO)
4173 * 2) Triple stream (MIMO)
4174 */
4175
4176 /* Bit 4-5: (0) SISO, (1) MIMO2 (2) MIMO3 */
4177 #define IWM_RATE_VHT_MCS_RATE_CODE_MSK 0xf
4178 #define IWM_RATE_VHT_MCS_NSS_POS 4
4179 #define IWM_RATE_VHT_MCS_NSS_MSK (3 << IWM_RATE_VHT_MCS_NSS_POS)
4180
4181 /*
4182 * Legacy OFDM rate format for bits 7:0
4183 *
4184 * 3-0: 0xD) 6 Mbps
4185 * 0xF) 9 Mbps
4186 * 0x5) 12 Mbps
4187 * 0x7) 18 Mbps
4188 * 0x9) 24 Mbps
4189 * 0xB) 36 Mbps
4190 * 0x1) 48 Mbps
4191 * 0x3) 54 Mbps
4192 * (bits 7-4 are 0)
4193 *
4194 * Legacy CCK rate format for bits 7:0:
4195 * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK):
4196 *
4197 * 6-0: 10) 1 Mbps
4198 * 20) 2 Mbps
4199 * 55) 5.5 Mbps
4200 * 110) 11 Mbps
4201 * (bit 7 is 0)
4202 */
4203 #define IWM_RATE_LEGACY_RATE_MSK 0xff
4204
4205
4206 /*
4207 * Bit 11-12: (0) 20MHz, (1) 40MHz, (2) 80MHz, (3) 160MHz
4208 * 0 and 1 are valid for HT and VHT, 2 and 3 only for VHT
4209 */
4210 #define IWM_RATE_MCS_CHAN_WIDTH_POS 11
4211 #define IWM_RATE_MCS_CHAN_WIDTH_MSK (3 << IWM_RATE_MCS_CHAN_WIDTH_POS)
4212 #define IWM_RATE_MCS_CHAN_WIDTH_20 (0 << IWM_RATE_MCS_CHAN_WIDTH_POS)
4213 #define IWM_RATE_MCS_CHAN_WIDTH_40 (1 << IWM_RATE_MCS_CHAN_WIDTH_POS)
4214 #define IWM_RATE_MCS_CHAN_WIDTH_80 (2 << IWM_RATE_MCS_CHAN_WIDTH_POS)
4215 #define IWM_RATE_MCS_CHAN_WIDTH_160 (3 << IWM_RATE_MCS_CHAN_WIDTH_POS)
4216
4217 /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
4218 #define IWM_RATE_MCS_SGI_POS 13
4219 #define IWM_RATE_MCS_SGI_MSK (1 << IWM_RATE_MCS_SGI_POS)
4220
4221 /* Bit 14-16: Antenna selection (1) Ant A, (2) Ant B, (4) Ant C */
4222 #define IWM_RATE_MCS_ANT_POS 14
4223 #define IWM_RATE_MCS_ANT_A_MSK (1 << IWM_RATE_MCS_ANT_POS)
4224 #define IWM_RATE_MCS_ANT_B_MSK (2 << IWM_RATE_MCS_ANT_POS)
4225 #define IWM_RATE_MCS_ANT_C_MSK (4 << IWM_RATE_MCS_ANT_POS)
4226 #define IWM_RATE_MCS_ANT_AB_MSK (IWM_RATE_MCS_ANT_A_MSK | \
4227 IWM_RATE_MCS_ANT_B_MSK)
4228 #define IWM_RATE_MCS_ANT_ABC_MSK (IWM_RATE_MCS_ANT_AB_MSK | \
4229 IWM_RATE_MCS_ANT_C_MSK)
4230 #define IWM_RATE_MCS_ANT_MSK IWM_RATE_MCS_ANT_ABC_MSK
4231 #define IWM_RATE_MCS_ANT_NUM 3
4232
4233 /* Bit 17-18: (0) SS, (1) SS*2 */
4234 #define IWM_RATE_MCS_STBC_POS 17
4235 #define IWM_RATE_MCS_STBC_MSK (1 << IWM_RATE_MCS_STBC_POS)
4236
4237 /* Bit 19: (0) Beamforming is off, (1) Beamforming is on */
4238 #define IWM_RATE_MCS_BF_POS 19
4239 #define IWM_RATE_MCS_BF_MSK (1 << IWM_RATE_MCS_BF_POS)
4240
4241 /* Bit 20: (0) ZLF is off, (1) ZLF is on */
4242 #define IWM_RATE_MCS_ZLF_POS 20
4243 #define IWM_RATE_MCS_ZLF_MSK (1 << IWM_RATE_MCS_ZLF_POS)
4244
4245 /* Bit 24-25: (0) 20MHz (no dup), (1) 2x20MHz, (2) 4x20MHz, 3 8x20MHz */
4246 #define IWM_RATE_MCS_DUP_POS 24
4247 #define IWM_RATE_MCS_DUP_MSK (3 << IWM_RATE_MCS_DUP_POS)
4248
4249 /* Bit 27: (1) LDPC enabled, (0) LDPC disabled */
4250 #define IWM_RATE_MCS_LDPC_POS 27
4251 #define IWM_RATE_MCS_LDPC_MSK (1 << IWM_RATE_MCS_LDPC_POS)
4252
4253
4254 /* Link Quality definitions */
4255
4256 /* # entries in rate scale table to support Tx retries */
4257 #define IWM_LQ_MAX_RETRY_NUM 16
4258
4259 /* Link quality command flags bit fields */
4260
4261 /* Bit 0: (0) Don't use RTS (1) Use RTS */
4262 #define IWM_LQ_FLAG_USE_RTS_POS 0
4263 #define IWM_LQ_FLAG_USE_RTS_MSK (1 << IWM_LQ_FLAG_USE_RTS_POS)
4264
4265 /* Bit 1-3: LQ command color. Used to match responses to LQ commands */
4266 #define IWM_LQ_FLAG_COLOR_POS 1
4267 #define IWM_LQ_FLAG_COLOR_MSK (7 << IWM_LQ_FLAG_COLOR_POS)
4268
4269 /* Bit 4-5: Tx RTS BW Signalling
4270 * (0) No RTS BW signalling
4271 * (1) Static BW signalling
4272 * (2) Dynamic BW signalling
4273 */
4274 #define IWM_LQ_FLAG_RTS_BW_SIG_POS 4
4275 #define IWM_LQ_FLAG_RTS_BW_SIG_NONE (0 << IWM_LQ_FLAG_RTS_BW_SIG_POS)
4276 #define IWM_LQ_FLAG_RTS_BW_SIG_STATIC (1 << IWM_LQ_FLAG_RTS_BW_SIG_POS)
4277 #define IWM_LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << IWM_LQ_FLAG_RTS_BW_SIG_POS)
4278
4279 /* Bit 6: (0) No dynamic BW selection (1) Allow dynamic BW selection
4280 * Dyanmic BW selection allows Tx with narrower BW then requested in rates
4281 */
4282 #define IWM_LQ_FLAG_DYNAMIC_BW_POS 6
4283 #define IWM_LQ_FLAG_DYNAMIC_BW_MSK (1 << IWM_LQ_FLAG_DYNAMIC_BW_POS)
4284
4285 /* Single Stream Tx Parameters (lq_cmd->ss_params)
4286 * Flags to control a smart FW decision about whether BFER/STBC/SISO will be
4287 * used for single stream Tx.
4288 */
4289
4290 /* Bit 0-1: Max STBC streams allowed. Can be 0-3.
4291 * (0) - No STBC allowed
4292 * (1) - 2x1 STBC allowed (HT/VHT)
4293 * (2) - 4x2 STBC allowed (HT/VHT)
4294 * (3) - 3x2 STBC allowed (HT only)
4295 * All our chips are at most 2 antennas so only (1) is valid for now.
4296 */
4297 #define IWM_LQ_SS_STBC_ALLOWED_POS 0
4298 #define IWM_LQ_SS_STBC_ALLOWED_MSK (3 << IWM_LQ_SS_STBC_ALLOWED_MSK)
4299
4300 /* 2x1 STBC is allowed */
4301 #define IWM_LQ_SS_STBC_1SS_ALLOWED (1 << IWM_LQ_SS_STBC_ALLOWED_POS)
4302
4303 /* Bit 2: Beamformer (VHT only) is allowed */
4304 #define IWM_LQ_SS_BFER_ALLOWED_POS 2
4305 #define IWM_LQ_SS_BFER_ALLOWED (1 << IWM_LQ_SS_BFER_ALLOWED_POS)
4306
4307 /* Bit 3: Force BFER or STBC for testing
4308 * If this is set:
4309 * If BFER is allowed then force the ucode to choose BFER else
4310 * If STBC is allowed then force the ucode to choose STBC over SISO
4311 */
4312 #define IWM_LQ_SS_FORCE_POS 3
4313 #define IWM_LQ_SS_FORCE (1 << IWM_LQ_SS_FORCE_POS)
4314
4315 /* Bit 31: ss_params field is valid. Used for FW backward compatibility
4316 * with other drivers which don't support the ss_params API yet
4317 */
4318 #define IWM_LQ_SS_PARAMS_VALID_POS 31
4319 #define IWM_LQ_SS_PARAMS_VALID (1 << IWM_LQ_SS_PARAMS_VALID_POS)
4320
4321 /**
4322 * struct iwm_lq_cmd - link quality command
4323 * @sta_id: station to update
4324 * @control: not used
4325 * @flags: combination of IWM_LQ_FLAG_*
4326 * @mimo_delim: the first SISO index in rs_table, which separates MIMO
4327 * and SISO rates
4328 * @single_stream_ant_msk: best antenna for SISO (can be dual in CDD).
4329 * Should be ANT_[ABC]
4330 * @dual_stream_ant_msk: best antennas for MIMO, combination of ANT_[ABC]
4331 * @initial_rate_index: first index from rs_table per AC category
4332 * @agg_time_limit: aggregation max time threshold in usec/100, meaning
4333 * value of 100 is one usec. Range is 100 to 8000
4334 * @agg_disable_start_th: try-count threshold for starting aggregation.
4335 * If a frame has higher try-count, it should not be selected for
4336 * starting an aggregation sequence.
4337 * @agg_frame_cnt_limit: max frame count in an aggregation.
4338 * 0: no limit
4339 * 1: no aggregation (one frame per aggregation)
4340 * 2 - 0x3f: maximal number of frames (up to 3f == 63)
4341 * @rs_table: array of rates for each TX try, each is rate_n_flags,
4342 * meaning it is a combination of IWM_RATE_MCS_* and IWM_RATE_*_PLCP
4343 * @ss_params: single stream features. declare whether STBC or BFER are allowed.
4344 */
4345 struct iwm_lq_cmd {
4346 uint8_t sta_id;
4347 uint8_t reduced_tpc;
4348 uint16_t control;
4349 /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */
4350 uint8_t flags;
4351 uint8_t mimo_delim;
4352 uint8_t single_stream_ant_msk;
4353 uint8_t dual_stream_ant_msk;
4354 uint8_t initial_rate_index[IWM_AC_NUM];
4355 /* LINK_QUAL_AGG_PARAMS_API_S_VER_1 */
4356 uint16_t agg_time_limit;
4357 uint8_t agg_disable_start_th;
4358 uint8_t agg_frame_cnt_limit;
4359 uint32_t reserved2;
4360 uint32_t rs_table[IWM_LQ_MAX_RETRY_NUM];
4361 uint32_t ss_params;
4362 }; /* LINK_QUALITY_CMD_API_S_VER_1 */
4363
4364 /*
4365 * END mvm/fw-api-rs.h
4366 */
4367
4368 /*
4369 * BEGIN mvm/fw-api-tx.h
4370 */
4371
4372 /**
4373 * enum iwm_tx_flags - bitmasks for tx_flags in TX command
4374 * @IWM_TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame
4375 * @IWM_TX_CMD_FLG_ACK: expect ACK from receiving station
4376 * @IWM_TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command.
4377 * Otherwise, use rate_n_flags from the TX command
4378 * @IWM_TX_CMD_FLG_BA: this frame is a block ack
4379 * @IWM_TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected
4380 * Must set IWM_TX_CMD_FLG_ACK with this flag.
4381 * @IWM_TX_CMD_FLG_TXOP_PROT: protect frame with full TXOP protection
4382 * @IWM_TX_CMD_FLG_VHT_NDPA: mark frame is NDPA for VHT beamformer sequence
4383 * @IWM_TX_CMD_FLG_HT_NDPA: mark frame is NDPA for HT beamformer sequence
4384 * @IWM_TX_CMD_FLG_CSI_FDBK2HOST: mark to send feedback to host (only if good CRC)
4385 * @IWM_TX_CMD_FLG_BT_DIS: disable BT priority for this frame
4386 * @IWM_TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control.
4387 * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command
4388 * @IWM_TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU
4389 * @IWM_TX_CMD_FLG_NEXT_FRAME: this frame includes information of the next frame
4390 * @IWM_TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame
4391 * Should be set for beacons and probe responses
4392 * @IWM_TX_CMD_FLG_CALIB: activate PA TX power calibrations
4393 * @IWM_TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count
4394 * @IWM_TX_CMD_FLG_AGG_START: allow this frame to start aggregation
4395 * @IWM_TX_CMD_FLG_MH_PAD: driver inserted 2 byte padding after MAC header.
4396 * Should be set for 26/30 length MAC headers
4397 * @IWM_TX_CMD_FLG_RESP_TO_DRV: zero this if the response should go only to FW
4398 * @IWM_TX_CMD_FLG_TKIP_MIC_DONE: FW already performed TKIP MIC calculation
4399 * @IWM_TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id
4400 * @IWM_TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped
4401 * @IWM_TX_CMD_FLG_EXEC_PAPD: execute PAPD
4402 * @IWM_TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power
4403 * @IWM_TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk
4404 */
4405 enum iwm_tx_flags {
4406 IWM_TX_CMD_FLG_PROT_REQUIRE = (1 << 0),
4407 IWM_TX_CMD_FLG_ACK = (1 << 3),
4408 IWM_TX_CMD_FLG_STA_RATE = (1 << 4),
4409 IWM_TX_CMD_FLG_BA = (1 << 5),
4410 IWM_TX_CMD_FLG_BAR = (1 << 6),
4411 IWM_TX_CMD_FLG_TXOP_PROT = (1 << 7),
4412 IWM_TX_CMD_FLG_VHT_NDPA = (1 << 8),
4413 IWM_TX_CMD_FLG_HT_NDPA = (1 << 9),
4414 IWM_TX_CMD_FLG_CSI_FDBK2HOST = (1 << 10),
4415 IWM_TX_CMD_FLG_BT_DIS = (1 << 12),
4416 IWM_TX_CMD_FLG_SEQ_CTL = (1 << 13),
4417 IWM_TX_CMD_FLG_MORE_FRAG = (1 << 14),
4418 IWM_TX_CMD_FLG_NEXT_FRAME = (1 << 15),
4419 IWM_TX_CMD_FLG_TSF = (1 << 16),
4420 IWM_TX_CMD_FLG_CALIB = (1 << 17),
4421 IWM_TX_CMD_FLG_KEEP_SEQ_CTL = (1 << 18),
4422 IWM_TX_CMD_FLG_AGG_START = (1 << 19),
4423 IWM_TX_CMD_FLG_MH_PAD = (1 << 20),
4424 IWM_TX_CMD_FLG_RESP_TO_DRV = (1 << 21),
4425 IWM_TX_CMD_FLG_TKIP_MIC_DONE = (1 << 23),
4426 IWM_TX_CMD_FLG_DUR = (1 << 25),
4427 IWM_TX_CMD_FLG_FW_DROP = (1 << 26),
4428 IWM_TX_CMD_FLG_EXEC_PAPD = (1 << 27),
4429 IWM_TX_CMD_FLG_PAPD_TYPE = (1 << 28),
4430 IWM_TX_CMD_FLG_HCCA_CHUNK = (1 << 31)
4431 }; /* IWM_TX_FLAGS_BITS_API_S_VER_1 */
4432
4433 /**
4434 * enum iwm_tx_pm_timeouts - pm timeout values in TX command
4435 * @IWM_PM_FRAME_NONE: no need to suspend sleep mode
4436 * @IWM_PM_FRAME_MGMT: fw suspend sleep mode for 100TU
4437 * @IWM_PM_FRAME_ASSOC: fw suspend sleep mode for 10sec
4438 */
4439 enum iwm_tx_pm_timeouts {
4440 IWM_PM_FRAME_NONE = 0,
4441 IWM_PM_FRAME_MGMT = 2,
4442 IWM_PM_FRAME_ASSOC = 3,
4443 };
4444
4445 /*
4446 * TX command security control
4447 */
4448 #define IWM_TX_CMD_SEC_WEP 0x01
4449 #define IWM_TX_CMD_SEC_CCM 0x02
4450 #define IWM_TX_CMD_SEC_TKIP 0x03
4451 #define IWM_TX_CMD_SEC_EXT 0x04
4452 #define IWM_TX_CMD_SEC_MSK 0x07
4453 #define IWM_TX_CMD_SEC_WEP_KEY_IDX_POS 6
4454 #define IWM_TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0
4455 #define IWM_TX_CMD_SEC_KEY128 0x08
4456
4457 /*
4458 * TX command Frame life time in us - to be written in pm_frame_timeout
4459 */
4460 #define IWM_TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF
4461 #define IWM_TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/
4462 #define IWM_TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */
4463 #define IWM_TX_CMD_LIFE_TIME_EXPIRED_FRAME 0
4464
4465 /*
4466 * TID for non QoS frames - to be written in tid_tspec
4467 */
4468 #define IWM_TID_NON_QOS IWM_MAX_TID_COUNT
4469
4470 /*
4471 * Limits on the retransmissions - to be written in {data,rts}_retry_limit
4472 */
4473 #define IWM_DEFAULT_TX_RETRY 15
4474 #define IWM_MGMT_DFAULT_RETRY_LIMIT 3
4475 #define IWM_RTS_DFAULT_RETRY_LIMIT 60
4476 #define IWM_BAR_DFAULT_RETRY_LIMIT 60
4477 #define IWM_LOW_RETRY_LIMIT 7
4478
4479 /**
4480 * enum iwm_tx_offload_assist_flags_pos - set %iwm_tx_cmd offload_assist values
4481 * @IWM_TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words)
4482 * from mac header end. For normal case it is 4 words for SNAP.
4483 * note: tx_cmd, mac header and pad are not counted in the offset.
4484 * This is used to help the offload in case there is tunneling such as
4485 * IPv6 in IPv4, in such case the ip header offset should point to the
4486 * inner ip header and IPv4 checksum of the external header should be
4487 * calculated by driver.
4488 * @IWM_TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum
4489 * @IWM_TX_CMD_OFFLD_L3_EN: enable IP header checksum
4490 * @IWM_TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV
4491 * field. Doesn't include the pad.
4492 * @IWM_TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for
4493 * alignment
4494 * @IWM_TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU
4495 */
4496 enum iwm_tx_offload_assist_flags_pos {
4497 IWM_TX_CMD_OFFLD_IP_HDR = 0,
4498 IWM_TX_CMD_OFFLD_L4_EN = 6,
4499 IWM_TX_CMD_OFFLD_L3_EN = 7,
4500 IWM_TX_CMD_OFFLD_MH_SIZE = 8,
4501 IWM_TX_CMD_OFFLD_PAD = 13,
4502 IWM_TX_CMD_OFFLD_AMSDU = 14,
4503 };
4504
4505 #define IWM_TX_CMD_OFFLD_MH_MASK 0x1f
4506 #define IWM_TX_CMD_OFFLD_IP_HDR_MASK 0x3f
4507
4508 /* TODO: complete documentation for try_cnt and btkill_cnt */
4509 /**
4510 * struct iwm_tx_cmd - TX command struct to FW
4511 * ( IWM_TX_CMD = 0x1c )
4512 * @len: in bytes of the payload, see below for details
4513 * @offload_assist: TX offload configuration
4514 * @tx_flags: combination of IWM_TX_CMD_FLG_*
4515 * @rate_n_flags: rate for *all* Tx attempts, if IWM_TX_CMD_FLG_STA_RATE_MSK is
4516 * cleared. Combination of IWM_RATE_MCS_*
4517 * @sta_id: index of destination station in FW station table
4518 * @sec_ctl: security control, IWM_TX_CMD_SEC_*
4519 * @initial_rate_index: index into the rate table for initial TX attempt.
4520 * Applied if IWM_TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames.
4521 * @key: security key
4522 * @reserved3: reserved
4523 * @life_time: frame life time (usecs??)
4524 * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt +
4525 * btkill_cnd + reserved), first 32 bits. "0" disables usage.
4526 * @dram_msb_ptr: upper bits of the scratch physical address
4527 * @rts_retry_limit: max attempts for RTS
4528 * @data_retry_limit: max attempts to send the data packet
4529 * @tid_spec: TID/tspec
4530 * @pm_frame_timeout: PM TX frame timeout
4531 * @driver_txop: duration od EDCA TXOP, in 32-usec units. Set this if not
4532 * specified by HCCA protocol
4533 *
4534 * The byte count (both len and next_frame_len) includes MAC header
4535 * (24/26/30/32 bytes)
4536 * + 2 bytes pad if 26/30 header size
4537 * + 8 byte IV for CCM or TKIP (not used for WEP)
4538 * + Data payload
4539 * + 8-byte MIC (not used for CCM/WEP)
4540 * It does not include post-MAC padding, i.e.,
4541 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.
4542 * Range of len: 14-2342 bytes.
4543 *
4544 * After the struct fields the MAC header is placed, plus any padding,
4545 * and then the actial payload.
4546 */
4547 struct iwm_tx_cmd {
4548 uint16_t len;
4549 uint16_t offload_assist;
4550 uint32_t tx_flags;
4551 struct {
4552 uint8_t try_cnt;
4553 uint8_t btkill_cnt;
4554 uint16_t reserved;
4555 } scratch; /* DRAM_SCRATCH_API_U_VER_1 */
4556 uint32_t rate_n_flags;
4557 uint8_t sta_id;
4558 uint8_t sec_ctl;
4559 uint8_t initial_rate_index;
4560 uint8_t reserved2;
4561 uint8_t key[16];
4562 uint32_t reserved3;
4563 uint32_t life_time;
4564 uint32_t dram_lsb_ptr;
4565 uint8_t dram_msb_ptr;
4566 uint8_t rts_retry_limit;
4567 uint8_t data_retry_limit;
4568 uint8_t tid_tspec;
4569 uint16_t pm_frame_timeout;
4570 uint16_t reserved4;
4571 uint8_t payload[0];
4572 struct ieee80211_frame hdr[0];
4573 } __packed; /* IWM_TX_CMD_API_S_VER_3 */
4574
4575 /*
4576 * TX response related data
4577 */
4578
4579 /*
4580 * enum iwm_tx_status - status that is returned by the fw after attempts to Tx
4581 * @IWM_TX_STATUS_SUCCESS:
4582 * @IWM_TX_STATUS_DIRECT_DONE:
4583 * @IWM_TX_STATUS_POSTPONE_DELAY:
4584 * @IWM_TX_STATUS_POSTPONE_FEW_BYTES:
4585 * @IWM_TX_STATUS_POSTPONE_BT_PRIO:
4586 * @IWM_TX_STATUS_POSTPONE_QUIET_PERIOD:
4587 * @IWM_TX_STATUS_POSTPONE_CALC_TTAK:
4588 * @IWM_TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:
4589 * @IWM_TX_STATUS_FAIL_SHORT_LIMIT:
4590 * @IWM_TX_STATUS_FAIL_LONG_LIMIT:
4591 * @IWM_TX_STATUS_FAIL_UNDERRUN:
4592 * @IWM_TX_STATUS_FAIL_DRAIN_FLOW:
4593 * @IWM_TX_STATUS_FAIL_RFKILL_FLUSH:
4594 * @IWM_TX_STATUS_FAIL_LIFE_EXPIRE:
4595 * @IWM_TX_STATUS_FAIL_DEST_PS:
4596 * @IWM_TX_STATUS_FAIL_HOST_ABORTED:
4597 * @IWM_TX_STATUS_FAIL_BT_RETRY:
4598 * @IWM_TX_STATUS_FAIL_STA_INVALID:
4599 * @IWM_TX_TATUS_FAIL_FRAG_DROPPED:
4600 * @IWM_TX_STATUS_FAIL_TID_DISABLE:
4601 * @IWM_TX_STATUS_FAIL_FIFO_FLUSHED:
4602 * @IWM_TX_STATUS_FAIL_SMALL_CF_POLL:
4603 * @IWM_TX_STATUS_FAIL_FW_DROP:
4604 * @IWM_TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and
4605 * STA table
4606 * @IWM_TX_FRAME_STATUS_INTERNAL_ABORT:
4607 * @IWM_TX_MODE_MSK:
4608 * @IWM_TX_MODE_NO_BURST:
4609 * @IWM_TX_MODE_IN_BURST_SEQ:
4610 * @IWM_TX_MODE_FIRST_IN_BURST:
4611 * @IWM_TX_QUEUE_NUM_MSK:
4612 *
4613 * Valid only if frame_count =1
4614 * TODO: complete documentation
4615 */
4616 enum iwm_tx_status {
4617 IWM_TX_STATUS_MSK = 0x000000ff,
4618 IWM_TX_STATUS_SUCCESS = 0x01,
4619 IWM_TX_STATUS_DIRECT_DONE = 0x02,
4620 /* postpone TX */
4621 IWM_TX_STATUS_POSTPONE_DELAY = 0x40,
4622 IWM_TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
4623 IWM_TX_STATUS_POSTPONE_BT_PRIO = 0x42,
4624 IWM_TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
4625 IWM_TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
4626 /* abort TX */
4627 IWM_TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
4628 IWM_TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
4629 IWM_TX_STATUS_FAIL_LONG_LIMIT = 0x83,
4630 IWM_TX_STATUS_FAIL_UNDERRUN = 0x84,
4631 IWM_TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
4632 IWM_TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
4633 IWM_TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
4634 IWM_TX_STATUS_FAIL_DEST_PS = 0x88,
4635 IWM_TX_STATUS_FAIL_HOST_ABORTED = 0x89,
4636 IWM_TX_STATUS_FAIL_BT_RETRY = 0x8a,
4637 IWM_TX_STATUS_FAIL_STA_INVALID = 0x8b,
4638 IWM_TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
4639 IWM_TX_STATUS_FAIL_TID_DISABLE = 0x8d,
4640 IWM_TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
4641 IWM_TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f,
4642 IWM_TX_STATUS_FAIL_FW_DROP = 0x90,
4643 IWM_TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91,
4644 IWM_TX_STATUS_INTERNAL_ABORT = 0x92,
4645 IWM_TX_MODE_MSK = 0x00000f00,
4646 IWM_TX_MODE_NO_BURST = 0x00000000,
4647 IWM_TX_MODE_IN_BURST_SEQ = 0x00000100,
4648 IWM_TX_MODE_FIRST_IN_BURST = 0x00000200,
4649 IWM_TX_QUEUE_NUM_MSK = 0x0001f000,
4650 IWM_TX_NARROW_BW_MSK = 0x00060000,
4651 IWM_TX_NARROW_BW_1DIV2 = 0x00020000,
4652 IWM_TX_NARROW_BW_1DIV4 = 0x00040000,
4653 IWM_TX_NARROW_BW_1DIV8 = 0x00060000,
4654 };
4655
4656 /*
4657 * enum iwm_tx_agg_status - TX aggregation status
4658 * @IWM_AGG_TX_STATE_STATUS_MSK:
4659 * @IWM_AGG_TX_STATE_TRANSMITTED:
4660 * @IWM_AGG_TX_STATE_UNDERRUN:
4661 * @IWM_AGG_TX_STATE_BT_PRIO:
4662 * @IWM_AGG_TX_STATE_FEW_BYTES:
4663 * @IWM_AGG_TX_STATE_ABORT:
4664 * @IWM_AGG_TX_STATE_LAST_SENT_TTL:
4665 * @IWM_AGG_TX_STATE_LAST_SENT_TRY_CNT:
4666 * @IWM_AGG_TX_STATE_LAST_SENT_BT_KILL:
4667 * @IWM_AGG_TX_STATE_SCD_QUERY:
4668 * @IWM_AGG_TX_STATE_TEST_BAD_CRC32:
4669 * @IWM_AGG_TX_STATE_RESPONSE:
4670 * @IWM_AGG_TX_STATE_DUMP_TX:
4671 * @IWM_AGG_TX_STATE_DELAY_TX:
4672 * @IWM_AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries
4673 * occur if tx failed for this frame when it was a member of a previous
4674 * aggregation block). If rate scaling is used, retry count indicates the
4675 * rate table entry used for all frames in the new agg.
4676 *@ IWM_AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for
4677 * this frame
4678 *
4679 * TODO: complete documentation
4680 */
4681 enum iwm_tx_agg_status {
4682 IWM_AGG_TX_STATE_STATUS_MSK = 0x00fff,
4683 IWM_AGG_TX_STATE_TRANSMITTED = 0x000,
4684 IWM_AGG_TX_STATE_UNDERRUN = 0x001,
4685 IWM_AGG_TX_STATE_BT_PRIO = 0x002,
4686 IWM_AGG_TX_STATE_FEW_BYTES = 0x004,
4687 IWM_AGG_TX_STATE_ABORT = 0x008,
4688 IWM_AGG_TX_STATE_LAST_SENT_TTL = 0x010,
4689 IWM_AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020,
4690 IWM_AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040,
4691 IWM_AGG_TX_STATE_SCD_QUERY = 0x080,
4692 IWM_AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100,
4693 IWM_AGG_TX_STATE_RESPONSE = 0x1ff,
4694 IWM_AGG_TX_STATE_DUMP_TX = 0x200,
4695 IWM_AGG_TX_STATE_DELAY_TX = 0x400,
4696 IWM_AGG_TX_STATE_TRY_CNT_POS = 12,
4697 IWM_AGG_TX_STATE_TRY_CNT_MSK = 0xf << IWM_AGG_TX_STATE_TRY_CNT_POS,
4698 };
4699
4700 #define IWM_AGG_TX_STATE_LAST_SENT_MSK (IWM_AGG_TX_STATE_LAST_SENT_TTL| \
4701 IWM_AGG_TX_STATE_LAST_SENT_TRY_CNT| \
4702 IWM_AGG_TX_STATE_LAST_SENT_BT_KILL)
4703
4704 /*
4705 * The mask below describes a status where we are absolutely sure that the MPDU
4706 * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've
4707 * written the bytes to the TXE, but we know nothing about what the DSP did.
4708 */
4709 #define IWM_AGG_TX_STAT_FRAME_NOT_SENT (IWM_AGG_TX_STATE_FEW_BYTES | \
4710 IWM_AGG_TX_STATE_ABORT | \
4711 IWM_AGG_TX_STATE_SCD_QUERY)
4712
4713 /*
4714 * IWM_REPLY_TX = 0x1c (response)
4715 *
4716 * This response may be in one of two slightly different formats, indicated
4717 * by the frame_count field:
4718 *
4719 * 1) No aggregation (frame_count == 1). This reports Tx results for a single
4720 * frame. Multiple attempts, at various bit rates, may have been made for
4721 * this frame.
4722 *
4723 * 2) Aggregation (frame_count > 1). This reports Tx results for two or more
4724 * frames that used block-acknowledge. All frames were transmitted at
4725 * same rate. Rate scaling may have been used if first frame in this new
4726 * agg block failed in previous agg block(s).
4727 *
4728 * Note that, for aggregation, ACK (block-ack) status is not delivered
4729 * here; block-ack has not been received by the time the device records
4730 * this status.
4731 * This status relates to reasons the tx might have been blocked or aborted
4732 * within the device, rather than whether it was received successfully by
4733 * the destination station.
4734 */
4735
4736 /**
4737 * struct iwm_agg_tx_status - per packet TX aggregation status
4738 * @status: enum iwm_tx_agg_status
4739 * @sequence: Sequence # for this frame's Tx cmd (not SSN!)
4740 */
4741 struct iwm_agg_tx_status {
4742 uint16_t status;
4743 uint16_t sequence;
4744 } __packed;
4745
4746 /*
4747 * definitions for initial rate index field
4748 * bits [3:0] initial rate index
4749 * bits [6:4] rate table color, used for the initial rate
4750 * bit-7 invalid rate indication
4751 */
4752 #define IWM_TX_RES_INIT_RATE_INDEX_MSK 0x0f
4753 #define IWM_TX_RES_RATE_TABLE_COLOR_MSK 0x70
4754 #define IWM_TX_RES_INV_RATE_INDEX_MSK 0x80
4755
4756 #define IWM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f)
4757 #define IWM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)
4758
4759 /**
4760 * struct iwm_tx_resp - notifies that fw is TXing a packet
4761 * ( IWM_REPLY_TX = 0x1c )
4762 * @frame_count: 1 no aggregation, >1 aggregation
4763 * @bt_kill_count: num of times blocked by bluetooth (unused for agg)
4764 * @failure_rts: num of failures due to unsuccessful RTS
4765 * @failure_frame: num failures due to no ACK (unused for agg)
4766 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the
4767 * Tx of all the batch. IWM_RATE_MCS_*
4768 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.
4769 * for agg: RTS + CTS + aggregation tx time + block-ack time.
4770 * in usec.
4771 * @pa_status: tx power info
4772 * @pa_integ_res_a: tx power info
4773 * @pa_integ_res_b: tx power info
4774 * @pa_integ_res_c: tx power info
4775 * @measurement_req_id: tx power info
4776 * @tfd_info: TFD information set by the FH
4777 * @seq_ctl: sequence control from the Tx cmd
4778 * @byte_cnt: byte count from the Tx cmd
4779 * @tlc_info: TLC rate info
4780 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid
4781 * @frame_ctrl: frame control
4782 * @status: for non-agg: frame status IWM_TX_STATUS_*
4783 * for agg: status of 1st frame, IWM_AGG_TX_STATE_*; other frame status fields
4784 * follow this one, up to frame_count.
4785 *
4786 * After the array of statuses comes the SSN of the SCD. Look at
4787 * %iwm_get_scd_ssn for more details.
4788 */
4789 struct iwm_tx_resp {
4790 uint8_t frame_count;
4791 uint8_t bt_kill_count;
4792 uint8_t failure_rts;
4793 uint8_t failure_frame;
4794 uint32_t initial_rate;
4795 uint16_t wireless_media_time;
4796
4797 uint8_t pa_status;
4798 uint8_t pa_integ_res_a[3];
4799 uint8_t pa_integ_res_b[3];
4800 uint8_t pa_integ_res_c[3];
4801 uint16_t measurement_req_id;
4802 uint8_t reduced_tpc;
4803 uint8_t reserved;
4804
4805 uint32_t tfd_info;
4806 uint16_t seq_ctl;
4807 uint16_t byte_cnt;
4808 uint8_t tlc_info;
4809 uint8_t ra_tid;
4810 uint16_t frame_ctrl;
4811
4812 struct iwm_agg_tx_status status;
4813 } __packed; /* IWM_TX_RSP_API_S_VER_3 */
4814
4815 /**
4816 * struct iwm_ba_notif - notifies about reception of BA
4817 * ( IWM_BA_NOTIF = 0xc5 )
4818 * @sta_addr_lo32: lower 32 bits of the MAC address
4819 * @sta_addr_hi16: upper 16 bits of the MAC address
4820 * @sta_id: Index of recipient (BA-sending) station in fw's station table
4821 * @tid: tid of the session
4822 * @seq_ctl:
4823 * @bitmap: the bitmap of the BA notification as seen in the air
4824 * @scd_flow: the tx queue this BA relates to
4825 * @scd_ssn: the index of the last contiguously sent packet
4826 * @txed: number of Txed frames in this batch
4827 * @txed_2_done: number of Acked frames in this batch
4828 */
4829 struct iwm_ba_notif {
4830 uint32_t sta_addr_lo32;
4831 uint16_t sta_addr_hi16;
4832 uint16_t reserved;
4833
4834 uint8_t sta_id;
4835 uint8_t tid;
4836 uint16_t seq_ctl;
4837 uint64_t bitmap;
4838 uint16_t scd_flow;
4839 uint16_t scd_ssn;
4840 uint8_t txed;
4841 uint8_t txed_2_done;
4842 uint16_t reserved1;
4843 } __packed;
4844
4845 /*
4846 * struct iwm_mac_beacon_cmd - beacon template command
4847 * @tx: the tx commands associated with the beacon frame
4848 * @template_id: currently equal to the mac context id of the corresponding
4849 * mac.
4850 * @tim_idx: the offset of the tim IE in the beacon
4851 * @tim_size: the length of the tim IE
4852 * @frame: the template of the beacon frame
4853 */
4854 struct iwm_mac_beacon_cmd {
4855 struct iwm_tx_cmd tx;
4856 uint32_t template_id;
4857 uint32_t tim_idx;
4858 uint32_t tim_size;
4859 struct ieee80211_frame frame[0];
4860 } __packed;
4861
4862 struct iwm_beacon_notif {
4863 struct iwm_tx_resp beacon_notify_hdr;
4864 uint64_t tsf;
4865 uint32_t ibss_mgr_status;
4866 } __packed;
4867
4868 /**
4869 * enum iwm_dump_control - dump (flush) control flags
4870 * @IWM_DUMP_TX_FIFO_FLUSH: Dump MSDUs until the FIFO is empty
4871 * and the TFD queues are empty.
4872 */
4873 enum iwm_dump_control {
4874 IWM_DUMP_TX_FIFO_FLUSH = (1 << 1),
4875 };
4876
4877 /**
4878 * struct iwm_tx_path_flush_cmd -- queue/FIFO flush command
4879 * @queues_ctl: bitmap of queues to flush
4880 * @flush_ctl: control flags
4881 * @reserved: reserved
4882 */
4883 struct iwm_tx_path_flush_cmd {
4884 uint32_t queues_ctl;
4885 uint16_t flush_ctl;
4886 uint16_t reserved;
4887 } __packed; /* IWM_TX_PATH_FLUSH_CMD_API_S_VER_1 */
4888
4889 /**
4890 * iwm_get_scd_ssn - returns the SSN of the SCD
4891 * @tx_resp: the Tx response from the fw (agg or non-agg)
4892 *
4893 * When the fw sends an AMPDU, it fetches the MPDUs one after the other. Since
4894 * it can't know that everything will go well until the end of the AMPDU, it
4895 * can't know in advance the number of MPDUs that will be sent in the current
4896 * batch. This is why it writes the agg Tx response while it fetches the MPDUs.
4897 * Hence, it can't know in advance what the SSN of the SCD will be at the end
4898 * of the batch. This is why the SSN of the SCD is written at the end of the
4899 * whole struct at a variable offset. This function knows how to cope with the
4900 * variable offset and returns the SSN of the SCD.
4901 */
iwm_get_scd_ssn(struct iwm_tx_resp * tx_resp)4902 static inline uint32_t iwm_get_scd_ssn(struct iwm_tx_resp *tx_resp)
4903 {
4904 return le32_to_cpup((uint32_t *)&tx_resp->status +
4905 tx_resp->frame_count) & 0xfff;
4906 }
4907
4908 /*
4909 * END mvm/fw-api-tx.h
4910 */
4911
4912 /*
4913 * BEGIN mvm/fw-api-scan.h
4914 */
4915
4916 /**
4917 * struct iwm_scd_txq_cfg_cmd - New txq hw scheduler config command
4918 * @token:
4919 * @sta_id: station id
4920 * @tid:
4921 * @scd_queue: scheduler queue to confiug
4922 * @enable: 1 queue enable, 0 queue disable
4923 * @aggregate: 1 aggregated queue, 0 otherwise
4924 * @tx_fifo: %enum iwm_tx_fifo
4925 * @window: BA window size
4926 * @ssn: SSN for the BA agreement
4927 */
4928 struct iwm_scd_txq_cfg_cmd {
4929 uint8_t token;
4930 uint8_t sta_id;
4931 uint8_t tid;
4932 uint8_t scd_queue;
4933 uint8_t enable;
4934 uint8_t aggregate;
4935 uint8_t tx_fifo;
4936 uint8_t window;
4937 uint16_t ssn;
4938 uint16_t reserved;
4939 } __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */
4940
4941 /**
4942 * struct iwm_scd_txq_cfg_rsp
4943 * @token: taken from the command
4944 * @sta_id: station id from the command
4945 * @tid: tid from the command
4946 * @scd_queue: scd_queue from the command
4947 */
4948 struct iwm_scd_txq_cfg_rsp {
4949 uint8_t token;
4950 uint8_t sta_id;
4951 uint8_t tid;
4952 uint8_t scd_queue;
4953 } __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */
4954
4955
4956 /* Scan Commands, Responses, Notifications */
4957
4958 /* Masks for iwm_scan_channel.type flags */
4959 #define IWM_SCAN_CHANNEL_TYPE_ACTIVE (1 << 0)
4960 #define IWM_SCAN_CHANNEL_NSSIDS(x) (((1 << (x)) - 1) << 1)
4961
4962 /* Max number of IEs for direct SSID scans in a command */
4963 #define IWM_PROBE_OPTION_MAX 20
4964
4965 /**
4966 * struct iwm_ssid_ie - directed scan network information element
4967 *
4968 * Up to 20 of these may appear in IWM_REPLY_SCAN_CMD,
4969 * selected by "type" bit field in struct iwm_scan_channel;
4970 * each channel may select different ssids from among the 20 entries.
4971 * SSID IEs get transmitted in reverse order of entry.
4972 */
4973 struct iwm_ssid_ie {
4974 uint8_t id;
4975 uint8_t len;
4976 uint8_t ssid[IEEE80211_NWID_LEN];
4977 } __packed; /* IWM_SCAN_DIRECT_SSID_IE_API_S_VER_1 */
4978
4979 /* scan offload */
4980 #define IWM_SCAN_MAX_BLACKLIST_LEN 64
4981 #define IWM_SCAN_SHORT_BLACKLIST_LEN 16
4982 #define IWM_SCAN_MAX_PROFILES 11
4983 #define IWM_SCAN_OFFLOAD_PROBE_REQ_SIZE 512
4984
4985 /* Default watchdog (in MS) for scheduled scan iteration */
4986 #define IWM_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
4987
4988 #define IWM_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
4989 #define IWM_CAN_ABORT_STATUS 1
4990
4991 #define IWM_FULL_SCAN_MULTIPLIER 5
4992 #define IWM_FAST_SCHED_SCAN_ITERATIONS 3
4993 #define IWM_MAX_SCHED_SCAN_PLANS 2
4994
4995 /**
4996 * iwm_scan_schedule_lmac - schedule of scan offload
4997 * @delay: delay between iterations, in seconds.
4998 * @iterations: num of scan iterations
4999 * @full_scan_mul: number of partial scans before each full scan
5000 */
5001 struct iwm_scan_schedule_lmac {
5002 uint16_t delay;
5003 uint8_t iterations;
5004 uint8_t full_scan_mul;
5005 } __packed; /* SCAN_SCHEDULE_API_S */
5006
5007 /**
5008 * iwm_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
5009 * @tx_flags: combination of TX_CMD_FLG_*
5010 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
5011 * cleared. Combination of RATE_MCS_*
5012 * @sta_id: index of destination station in FW station table
5013 * @reserved: for alignment and future use
5014 */
5015 struct iwm_scan_req_tx_cmd {
5016 uint32_t tx_flags;
5017 uint32_t rate_n_flags;
5018 uint8_t sta_id;
5019 uint8_t reserved[3];
5020 } __packed;
5021
5022 enum iwm_scan_channel_flags_lmac {
5023 IWM_UNIFIED_SCAN_CHANNEL_FULL = (1 << 27),
5024 IWM_UNIFIED_SCAN_CHANNEL_PARTIAL = (1 << 28),
5025 };
5026
5027 /**
5028 * iwm_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
5029 * @flags: bits 1-20: directed scan to i'th ssid
5030 * other bits &enum iwm_scan_channel_flags_lmac
5031 * @channel_number: channel number 1-13 etc
5032 * @iter_count: scan iteration on this channel
5033 * @iter_interval: interval in seconds between iterations on one channel
5034 */
5035 struct iwm_scan_channel_cfg_lmac {
5036 uint32_t flags;
5037 uint16_t channel_num;
5038 uint16_t iter_count;
5039 uint32_t iter_interval;
5040 } __packed;
5041
5042 /*
5043 * iwm_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
5044 * @offset: offset in the data block
5045 * @len: length of the segment
5046 */
5047 struct iwm_scan_probe_segment {
5048 uint16_t offset;
5049 uint16_t len;
5050 } __packed;
5051
5052 /* iwm_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
5053 * @mac_header: first (and common) part of the probe
5054 * @band_data: band specific data
5055 * @common_data: last (and common) part of the probe
5056 * @buf: raw data block
5057 */
5058 struct iwm_scan_probe_req {
5059 struct iwm_scan_probe_segment mac_header;
5060 struct iwm_scan_probe_segment band_data[2];
5061 struct iwm_scan_probe_segment common_data;
5062 uint8_t buf[IWM_SCAN_OFFLOAD_PROBE_REQ_SIZE];
5063 } __packed;
5064
5065 enum iwm_scan_channel_flags {
5066 IWM_SCAN_CHANNEL_FLAG_EBS = (1 << 0),
5067 IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE = (1 << 1),
5068 IWM_SCAN_CHANNEL_FLAG_CACHE_ADD = (1 << 2),
5069 };
5070
5071 /* iwm_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
5072 * @flags: enum iwm_scan_channel_flags
5073 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
5074 * involved.
5075 * 1 - EBS is disabled.
5076 * 2 - every second scan will be full scan(and so on).
5077 */
5078 struct iwm_scan_channel_opt {
5079 uint16_t flags;
5080 uint16_t non_ebs_ratio;
5081 } __packed;
5082
5083 /**
5084 * iwm_lmac_scan_flags
5085 * @IWM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
5086 * without filtering.
5087 * @IWM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
5088 * @IWM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
5089 * @IWM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
5090 * @IWM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
5091 * @IWM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
5092 * @IWM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
5093 * and DS parameter set IEs into probe requests.
5094 * @IWM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
5095 * 1, 6 and 11.
5096 * @IWM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
5097 */
5098 enum iwm_lmac_scan_flags {
5099 IWM_LMAC_SCAN_FLAG_PASS_ALL = (1 << 0),
5100 IWM_LMAC_SCAN_FLAG_PASSIVE = (1 << 1),
5101 IWM_LMAC_SCAN_FLAG_PRE_CONNECTION = (1 << 2),
5102 IWM_LMAC_SCAN_FLAG_ITER_COMPLETE = (1 << 3),
5103 IWM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = (1 << 4),
5104 IWM_LMAC_SCAN_FLAG_FRAGMENTED = (1 << 5),
5105 IWM_LMAC_SCAN_FLAGS_RRM_ENABLED = (1 << 6),
5106 IWM_LMAC_SCAN_FLAG_EXTENDED_DWELL = (1 << 7),
5107 IWM_LMAC_SCAN_FLAG_MATCH = (1 << 9),
5108 };
5109
5110 enum iwm_scan_priority {
5111 IWM_SCAN_PRIORITY_LOW,
5112 IWM_SCAN_PRIORITY_MEDIUM,
5113 IWM_SCAN_PRIORITY_HIGH,
5114 };
5115
5116 /**
5117 * iwm_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
5118 * @reserved1: for alignment and future use
5119 * @channel_num: num of channels to scan
5120 * @active-dwell: dwell time for active channels
5121 * @passive-dwell: dwell time for passive channels
5122 * @fragmented-dwell: dwell time for fragmented passive scan
5123 * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
5124 * @reserved2: for alignment and future use
5125 * @rx_chain_selct: PHY_RX_CHAIN_* flags
5126 * @scan_flags: &enum iwm_lmac_scan_flags
5127 * @max_out_time: max time (in TU) to be out of associated channel
5128 * @suspend_time: pause scan this long (TUs) when returning to service channel
5129 * @flags: RXON flags
5130 * @filter_flags: RXON filter
5131 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
5132 * @direct_scan: list of SSIDs for directed active scan
5133 * @scan_prio: enum iwm_scan_priority
5134 * @iter_num: number of scan iterations
5135 * @delay: delay in seconds before first iteration
5136 * @schedule: two scheduling plans. The first one is finite, the second one can
5137 * be infinite.
5138 * @channel_opt: channel optimization options, for full and partial scan
5139 * @data: channel configuration and probe request packet.
5140 */
5141 struct iwm_scan_req_lmac {
5142 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
5143 uint32_t reserved1;
5144 uint8_t n_channels;
5145 uint8_t active_dwell;
5146 uint8_t passive_dwell;
5147 uint8_t fragmented_dwell;
5148 uint8_t extended_dwell;
5149 uint8_t reserved2;
5150 uint16_t rx_chain_select;
5151 uint32_t scan_flags;
5152 uint32_t max_out_time;
5153 uint32_t suspend_time;
5154 /* RX_ON_FLAGS_API_S_VER_1 */
5155 uint32_t flags;
5156 uint32_t filter_flags;
5157 struct iwm_scan_req_tx_cmd tx_cmd[2];
5158 struct iwm_ssid_ie direct_scan[IWM_PROBE_OPTION_MAX];
5159 uint32_t scan_prio;
5160 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
5161 uint32_t iter_num;
5162 uint32_t delay;
5163 struct iwm_scan_schedule_lmac schedule[IWM_MAX_SCHED_SCAN_PLANS];
5164 struct iwm_scan_channel_opt channel_opt[2];
5165 uint8_t data[];
5166 } __packed;
5167
5168 /**
5169 * iwm_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
5170 * @last_schedule_line: last schedule line executed (fast or regular)
5171 * @last_schedule_iteration: last scan iteration executed before scan abort
5172 * @status: enum iwm_scan_offload_complete_status
5173 * @ebs_status: EBS success status &enum iwm_scan_ebs_status
5174 * @time_after_last_iter; time in seconds elapsed after last iteration
5175 */
5176 struct iwm_periodic_scan_complete {
5177 uint8_t last_schedule_line;
5178 uint8_t last_schedule_iteration;
5179 uint8_t status;
5180 uint8_t ebs_status;
5181 uint32_t time_after_last_iter;
5182 uint32_t reserved;
5183 } __packed;
5184
5185 /**
5186 * struct iwm_scan_results_notif - scan results for one channel -
5187 * SCAN_RESULT_NTF_API_S_VER_3
5188 * @channel: which channel the results are from
5189 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
5190 * @probe_status: IWM_SCAN_PROBE_STATUS_*, indicates success of probe request
5191 * @num_probe_not_sent: # of request that weren't sent due to not enough time
5192 * @duration: duration spent in channel, in usecs
5193 */
5194 struct iwm_scan_results_notif {
5195 uint8_t channel;
5196 uint8_t band;
5197 uint8_t probe_status;
5198 uint8_t num_probe_not_sent;
5199 uint32_t duration;
5200 } __packed;
5201
5202 enum iwm_scan_framework_client {
5203 IWM_SCAN_CLIENT_SCHED_SCAN = (1 << 0),
5204 IWM_SCAN_CLIENT_NETDETECT = (1 << 1),
5205 IWM_SCAN_CLIENT_ASSET_TRACKING = (1 << 2),
5206 };
5207
5208 /**
5209 * iwm_scan_offload_blacklist - IWM_SCAN_OFFLOAD_BLACKLIST_S
5210 * @ssid: MAC address to filter out
5211 * @reported_rssi: AP rssi reported to the host
5212 * @client_bitmap: clients ignore this entry - enum scan_framework_client
5213 */
5214 struct iwm_scan_offload_blacklist {
5215 uint8_t ssid[IEEE80211_ADDR_LEN];
5216 uint8_t reported_rssi;
5217 uint8_t client_bitmap;
5218 } __packed;
5219
5220 enum iwm_scan_offload_network_type {
5221 IWM_NETWORK_TYPE_BSS = 1,
5222 IWM_NETWORK_TYPE_IBSS = 2,
5223 IWM_NETWORK_TYPE_ANY = 3,
5224 };
5225
5226 enum iwm_scan_offload_band_selection {
5227 IWM_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
5228 IWM_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
5229 IWM_SCAN_OFFLOAD_SELECT_ANY = 0xc,
5230 };
5231
5232 /**
5233 * iwm_scan_offload_profile - IWM_SCAN_OFFLOAD_PROFILE_S
5234 * @ssid_index: index to ssid list in fixed part
5235 * @unicast_cipher: encryption olgorithm to match - bitmap
5236 * @aut_alg: authentication olgorithm to match - bitmap
5237 * @network_type: enum iwm_scan_offload_network_type
5238 * @band_selection: enum iwm_scan_offload_band_selection
5239 * @client_bitmap: clients waiting for match - enum scan_framework_client
5240 */
5241 struct iwm_scan_offload_profile {
5242 uint8_t ssid_index;
5243 uint8_t unicast_cipher;
5244 uint8_t auth_alg;
5245 uint8_t network_type;
5246 uint8_t band_selection;
5247 uint8_t client_bitmap;
5248 uint8_t reserved[2];
5249 } __packed;
5250
5251 /**
5252 * iwm_scan_offload_profile_cfg - IWM_SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
5253 * @blaclist: AP list to filter off from scan results
5254 * @profiles: profiles to search for match
5255 * @blacklist_len: length of blacklist
5256 * @num_profiles: num of profiles in the list
5257 * @match_notify: clients waiting for match found notification
5258 * @pass_match: clients waiting for the results
5259 * @active_clients: active clients bitmap - enum scan_framework_client
5260 * @any_beacon_notify: clients waiting for match notification without match
5261 */
5262 struct iwm_scan_offload_profile_cfg {
5263 struct iwm_scan_offload_profile profiles[IWM_SCAN_MAX_PROFILES];
5264 uint8_t blacklist_len;
5265 uint8_t num_profiles;
5266 uint8_t match_notify;
5267 uint8_t pass_match;
5268 uint8_t active_clients;
5269 uint8_t any_beacon_notify;
5270 uint8_t reserved[2];
5271 } __packed;
5272
5273 enum iwm_scan_offload_complete_status {
5274 IWM_SCAN_OFFLOAD_COMPLETED = 1,
5275 IWM_SCAN_OFFLOAD_ABORTED = 2,
5276 };
5277
5278 enum iwm_scan_ebs_status {
5279 IWM_SCAN_EBS_SUCCESS,
5280 IWM_SCAN_EBS_FAILED,
5281 IWM_SCAN_EBS_CHAN_NOT_FOUND,
5282 IWM_SCAN_EBS_INACTIVE,
5283 };
5284
5285 /**
5286 * struct iwm_lmac_scan_complete_notif - notifies end of scanning (all channels)
5287 * SCAN_COMPLETE_NTF_API_S_VER_3
5288 * @scanned_channels: number of channels scanned (and number of valid results)
5289 * @status: one of SCAN_COMP_STATUS_*
5290 * @bt_status: BT on/off status
5291 * @last_channel: last channel that was scanned
5292 * @tsf_low: TSF timer (lower half) in usecs
5293 * @tsf_high: TSF timer (higher half) in usecs
5294 * @results: an array of scan results, only "scanned_channels" of them are valid
5295 */
5296 struct iwm_lmac_scan_complete_notif {
5297 uint8_t scanned_channels;
5298 uint8_t status;
5299 uint8_t bt_status;
5300 uint8_t last_channel;
5301 uint32_t tsf_low;
5302 uint32_t tsf_high;
5303 struct iwm_scan_results_notif results[];
5304 } __packed;
5305
5306
5307 /*
5308 * END mvm/fw-api-scan.h
5309 */
5310
5311 /*
5312 * BEGIN mvm/fw-api-sta.h
5313 */
5314
5315 /* UMAC Scan API */
5316
5317 /* The maximum of either of these cannot exceed 8, because we use an
5318 * 8-bit mask (see IWM_SCAN_MASK).
5319 */
5320 #define IWM_MAX_UMAC_SCANS 8
5321 #define IWM_MAX_LMAC_SCANS 1
5322
5323 enum iwm_scan_config_flags {
5324 IWM_SCAN_CONFIG_FLAG_ACTIVATE = (1 << 0),
5325 IWM_SCAN_CONFIG_FLAG_DEACTIVATE = (1 << 1),
5326 IWM_SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = (1 << 2),
5327 IWM_SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = (1 << 3),
5328 IWM_SCAN_CONFIG_FLAG_SET_TX_CHAINS = (1 << 8),
5329 IWM_SCAN_CONFIG_FLAG_SET_RX_CHAINS = (1 << 9),
5330 IWM_SCAN_CONFIG_FLAG_SET_AUX_STA_ID = (1 << 10),
5331 IWM_SCAN_CONFIG_FLAG_SET_ALL_TIMES = (1 << 11),
5332 IWM_SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = (1 << 12),
5333 IWM_SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = (1 << 13),
5334 IWM_SCAN_CONFIG_FLAG_SET_LEGACY_RATES = (1 << 14),
5335 IWM_SCAN_CONFIG_FLAG_SET_MAC_ADDR = (1 << 15),
5336 IWM_SCAN_CONFIG_FLAG_SET_FRAGMENTED = (1 << 16),
5337 IWM_SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = (1 << 17),
5338 IWM_SCAN_CONFIG_FLAG_SET_CAM_MODE = (1 << 18),
5339 IWM_SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = (1 << 19),
5340 IWM_SCAN_CONFIG_FLAG_SET_PROMISC_MODE = (1 << 20),
5341 IWM_SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = (1 << 21),
5342
5343 /* Bits 26-31 are for num of channels in channel_array */
5344 #define IWM_SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
5345 };
5346
5347 enum iwm_scan_config_rates {
5348 /* OFDM basic rates */
5349 IWM_SCAN_CONFIG_RATE_6M = (1 << 0),
5350 IWM_SCAN_CONFIG_RATE_9M = (1 << 1),
5351 IWM_SCAN_CONFIG_RATE_12M = (1 << 2),
5352 IWM_SCAN_CONFIG_RATE_18M = (1 << 3),
5353 IWM_SCAN_CONFIG_RATE_24M = (1 << 4),
5354 IWM_SCAN_CONFIG_RATE_36M = (1 << 5),
5355 IWM_SCAN_CONFIG_RATE_48M = (1 << 6),
5356 IWM_SCAN_CONFIG_RATE_54M = (1 << 7),
5357 /* CCK basic rates */
5358 IWM_SCAN_CONFIG_RATE_1M = (1 << 8),
5359 IWM_SCAN_CONFIG_RATE_2M = (1 << 9),
5360 IWM_SCAN_CONFIG_RATE_5M = (1 << 10),
5361 IWM_SCAN_CONFIG_RATE_11M = (1 << 11),
5362
5363 /* Bits 16-27 are for supported rates */
5364 #define IWM_SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
5365 };
5366
5367 enum iwm_channel_flags {
5368 IWM_CHANNEL_FLAG_EBS = (1 << 0),
5369 IWM_CHANNEL_FLAG_ACCURATE_EBS = (1 << 1),
5370 IWM_CHANNEL_FLAG_EBS_ADD = (1 << 2),
5371 IWM_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = (1 << 3),
5372 };
5373
5374 /**
5375 * struct iwm_scan_config
5376 * @flags: enum scan_config_flags
5377 * @tx_chains: valid_tx antenna - ANT_* definitions
5378 * @rx_chains: valid_rx antenna - ANT_* definitions
5379 * @legacy_rates: default legacy rates - enum scan_config_rates
5380 * @out_of_channel_time: default max out of serving channel time
5381 * @suspend_time: default max suspend time
5382 * @dwell_active: default dwell time for active scan
5383 * @dwell_passive: default dwell time for passive scan
5384 * @dwell_fragmented: default dwell time for fragmented scan
5385 * @dwell_extended: default dwell time for channels 1, 6 and 11
5386 * @mac_addr: default mac address to be used in probes
5387 * @bcast_sta_id: the index of the station in the fw
5388 * @channel_flags: default channel flags - enum iwm_channel_flags
5389 * scan_config_channel_flag
5390 * @channel_array: default supported channels
5391 */
5392 struct iwm_scan_config {
5393 uint32_t flags;
5394 uint32_t tx_chains;
5395 uint32_t rx_chains;
5396 uint32_t legacy_rates;
5397 uint32_t out_of_channel_time;
5398 uint32_t suspend_time;
5399 uint8_t dwell_active;
5400 uint8_t dwell_passive;
5401 uint8_t dwell_fragmented;
5402 uint8_t dwell_extended;
5403 uint8_t mac_addr[IEEE80211_ADDR_LEN];
5404 uint8_t bcast_sta_id;
5405 uint8_t channel_flags;
5406 uint8_t channel_array[];
5407 } __packed; /* SCAN_CONFIG_DB_CMD_API_S */
5408
5409 /**
5410 * iwm_umac_scan_flags
5411 *@IWM_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
5412 * can be preempted by other scan requests with higher priority.
5413 * The low priority scan will be resumed when the higher proirity scan is
5414 * completed.
5415 *@IWM_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
5416 * when scan starts.
5417 */
5418 enum iwm_umac_scan_flags {
5419 IWM_UMAC_SCAN_FLAG_PREEMPTIVE = (1 << 0),
5420 IWM_UMAC_SCAN_FLAG_START_NOTIF = (1 << 1),
5421 };
5422
5423 enum iwm_umac_scan_uid_offsets {
5424 IWM_UMAC_SCAN_UID_TYPE_OFFSET = 0,
5425 IWM_UMAC_SCAN_UID_SEQ_OFFSET = 8,
5426 };
5427
5428 enum iwm_umac_scan_general_flags {
5429 IWM_UMAC_SCAN_GEN_FLAGS_PERIODIC = (1 << 0),
5430 IWM_UMAC_SCAN_GEN_FLAGS_OVER_BT = (1 << 1),
5431 IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL = (1 << 2),
5432 IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE = (1 << 3),
5433 IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = (1 << 4),
5434 IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = (1 << 5),
5435 IWM_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = (1 << 6),
5436 IWM_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = (1 << 7),
5437 IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = (1 << 8),
5438 IWM_UMAC_SCAN_GEN_FLAGS_MATCH = (1 << 9),
5439 IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL = (1 << 10),
5440 };
5441
5442 /**
5443 * struct iwm_scan_channel_cfg_umac
5444 * @flags: bitmap - 0-19: directed scan to i'th ssid.
5445 * @channel_num: channel number 1-13 etc.
5446 * @iter_count: repetition count for the channel.
5447 * @iter_interval: interval between two scan iterations on one channel.
5448 */
5449 struct iwm_scan_channel_cfg_umac {
5450 uint32_t flags;
5451 #define IWM_SCAN_CHANNEL_UMAC_NSSIDS(x) ((1 << (x)) - 1)
5452
5453 uint8_t channel_num;
5454 uint8_t iter_count;
5455 uint16_t iter_interval;
5456 } __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
5457
5458 /**
5459 * struct iwm_scan_umac_schedule
5460 * @interval: interval in seconds between scan iterations
5461 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
5462 * @reserved: for alignment and future use
5463 */
5464 struct iwm_scan_umac_schedule {
5465 uint16_t interval;
5466 uint8_t iter_count;
5467 uint8_t reserved;
5468 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
5469
5470 /**
5471 * struct iwm_scan_req_umac_tail - the rest of the UMAC scan request command
5472 * parameters following channels configuration array.
5473 * @schedule: two scheduling plans.
5474 * @delay: delay in TUs before starting the first scan iteration
5475 * @reserved: for future use and alignment
5476 * @preq: probe request with IEs blocks
5477 * @direct_scan: list of SSIDs for directed active scan
5478 */
5479 struct iwm_scan_req_umac_tail {
5480 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
5481 struct iwm_scan_umac_schedule schedule[IWM_MAX_SCHED_SCAN_PLANS];
5482 uint16_t delay;
5483 uint16_t reserved;
5484 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
5485 struct iwm_scan_probe_req preq;
5486 struct iwm_ssid_ie direct_scan[IWM_PROBE_OPTION_MAX];
5487 } __packed;
5488
5489 /**
5490 * struct iwm_scan_uma_chan_param
5491 * @flags: channel flags &enum iwm_scan_channel_flags
5492 * @count: num of channels in scan request
5493 * @reserved: for future use and alignment
5494 */
5495 struct iwm_scan_umac_chan_param {
5496 uint8_t flags;
5497 uint8_t count;
5498 uint16_t reserved;
5499 } __packed;
5500
5501 /**
5502 * struct iwm_scan_req_umac
5503 * @flags: &enum iwm_umac_scan_flags
5504 * @uid: scan id, &enum iwm_umac_scan_uid_offsets
5505 * @ooc_priority: out of channel priority - &enum iwm_scan_priority
5506 * @general_flags: &enum iwm_umac_scan_general_flags
5507 * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
5508 * @extended_dwell: dwell time for channels 1, 6 and 11
5509 * @active_dwell: dwell time for active scan per LMAC
5510 * @passive_dwell: dwell time for passive scan per LMAC
5511 * @fragmented_dwell: dwell time for fragmented passive scan
5512 * @adwell_default_n_aps: for adaptive dwell the default number of APs
5513 * per channel
5514 * @adwell_default_n_aps_social: for adaptive dwell the default
5515 * number of APs per social (1,6,11) channel
5516 * @general_flags2: &enum iwl_umac_scan_general_flags2
5517 * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added
5518 * to total scan time
5519 * @max_out_time: max out of serving channel time, per LMAC - for CDB there
5520 * are 2 LMACs
5521 * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
5522 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
5523 * @num_of_fragments: Number of fragments needed for full coverage per band.
5524 * Relevant only for fragmented scan.
5525 * @channel: &struct iwl_scan_umac_chan_param
5526 * @reserved: for future use and alignment
5527 * @reserved3: for future use and alignment
5528 * @data: &struct iwm_scan_channel_cfg_umac and
5529 * &struct iwm_scan_req_umac_tail
5530 */
5531 struct iwm_scan_req_umac {
5532 uint32_t flags;
5533 uint32_t uid;
5534 uint32_t ooc_priority;
5535 uint16_t general_flags;
5536 uint8_t reserved;
5537 uint8_t scan_start_mac_id;
5538 union {
5539 struct {
5540 uint8_t extended_dwell;
5541 uint8_t active_dwell;
5542 uint8_t passive_dwell;
5543 uint8_t fragmented_dwell;
5544 uint32_t max_out_time;
5545 uint32_t suspend_time;
5546 uint32_t scan_priority;
5547 struct iwm_scan_umac_chan_param channel;
5548 uint8_t data[];
5549 } v1;
5550 struct {
5551 uint8_t active_dwell;
5552 uint8_t passive_dwell;
5553 uint8_t fragmented_dwell;
5554 uint8_t adwell_default_n_aps;
5555 uint8_t adwell_default_n_aps_social;
5556 uint8_t reserved3;
5557 uint16_t adwell_max_budget;
5558 uint32_t max_out_time[2];
5559 uint32_t suspend_time[2];
5560 uint32_t scan_priority;
5561 struct iwm_scan_umac_chan_param channel;
5562 uint8_t data[];
5563 } v7;
5564 };
5565 } __packed;
5566
5567 #define IWM_SCAN_REQ_UMAC_SIZE_V7 48
5568 #define IWM_SCAN_REQ_UMAC_SIZE_V1 36
5569
5570 /**
5571 * struct iwm_umac_scan_abort
5572 * @uid: scan id, &enum iwm_umac_scan_uid_offsets
5573 * @flags: reserved
5574 */
5575 struct iwm_umac_scan_abort {
5576 uint32_t uid;
5577 uint32_t flags;
5578 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
5579
5580 /**
5581 * struct iwm_umac_scan_complete
5582 * @uid: scan id, &enum iwm_umac_scan_uid_offsets
5583 * @last_schedule: last scheduling line
5584 * @last_iter: last scan iteration number
5585 * @scan status: &enum iwm_scan_offload_complete_status
5586 * @ebs_status: &enum iwm_scan_ebs_status
5587 * @time_from_last_iter: time elapsed from last iteration
5588 * @reserved: for future use
5589 */
5590 struct iwm_umac_scan_complete {
5591 uint32_t uid;
5592 uint8_t last_schedule;
5593 uint8_t last_iter;
5594 uint8_t status;
5595 uint8_t ebs_status;
5596 uint32_t time_from_last_iter;
5597 uint32_t reserved;
5598 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
5599
5600 #define IWM_SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
5601 /**
5602 * struct iwm_scan_offload_profile_match - match information
5603 * @bssid: matched bssid
5604 * @channel: channel where the match occurred
5605 * @energy:
5606 * @matching_feature:
5607 * @matching_channels: bitmap of channels that matched, referencing
5608 * the channels passed in tue scan offload request
5609 */
5610 struct iwm_scan_offload_profile_match {
5611 uint8_t bssid[IEEE80211_ADDR_LEN];
5612 uint16_t reserved;
5613 uint8_t channel;
5614 uint8_t energy;
5615 uint8_t matching_feature;
5616 uint8_t matching_channels[IWM_SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
5617 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
5618
5619 /**
5620 * struct iwm_scan_offload_profiles_query - match results query response
5621 * @matched_profiles: bitmap of matched profiles, referencing the
5622 * matches passed in the scan offload request
5623 * @last_scan_age: age of the last offloaded scan
5624 * @n_scans_done: number of offloaded scans done
5625 * @gp2_d0u: GP2 when D0U occurred
5626 * @gp2_invoked: GP2 when scan offload was invoked
5627 * @resume_while_scanning: not used
5628 * @self_recovery: obsolete
5629 * @reserved: reserved
5630 * @matches: array of match information, one for each match
5631 */
5632 struct iwm_scan_offload_profiles_query {
5633 uint32_t matched_profiles;
5634 uint32_t last_scan_age;
5635 uint32_t n_scans_done;
5636 uint32_t gp2_d0u;
5637 uint32_t gp2_invoked;
5638 uint8_t resume_while_scanning;
5639 uint8_t self_recovery;
5640 uint16_t reserved;
5641 struct iwm_scan_offload_profile_match matches[IWM_SCAN_MAX_PROFILES];
5642 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
5643
5644 /**
5645 * struct iwm_umac_scan_iter_complete_notif - notifies end of scanning iteration
5646 * @uid: scan id, &enum iwm_umac_scan_uid_offsets
5647 * @scanned_channels: number of channels scanned and number of valid elements in
5648 * results array
5649 * @status: one of SCAN_COMP_STATUS_*
5650 * @bt_status: BT on/off status
5651 * @last_channel: last channel that was scanned
5652 * @tsf_low: TSF timer (lower half) in usecs
5653 * @tsf_high: TSF timer (higher half) in usecs
5654 * @results: array of scan results, only "scanned_channels" of them are valid
5655 */
5656 struct iwm_umac_scan_iter_complete_notif {
5657 uint32_t uid;
5658 uint8_t scanned_channels;
5659 uint8_t status;
5660 uint8_t bt_status;
5661 uint8_t last_channel;
5662 uint32_t tsf_low;
5663 uint32_t tsf_high;
5664 struct iwm_scan_results_notif results[];
5665 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */
5666
5667 /* Please keep this enum *SORTED* by hex value.
5668 * Needed for binary search, otherwise a warning will be triggered.
5669 */
5670 enum iwm_scan_subcmd_ids {
5671 IWM_GSCAN_START_CMD = 0x0,
5672 IWM_GSCAN_STOP_CMD = 0x1,
5673 IWM_GSCAN_SET_HOTLIST_CMD = 0x2,
5674 IWM_GSCAN_RESET_HOTLIST_CMD = 0x3,
5675 IWM_GSCAN_SET_SIGNIFICANT_CHANGE_CMD = 0x4,
5676 IWM_GSCAN_RESET_SIGNIFICANT_CHANGE_CMD = 0x5,
5677 IWM_GSCAN_SIGNIFICANT_CHANGE_EVENT = 0xFD,
5678 IWM_GSCAN_HOTLIST_CHANGE_EVENT = 0xFE,
5679 IWM_GSCAN_RESULTS_AVAILABLE_EVENT = 0xFF,
5680 };
5681
5682 /* STA API */
5683
5684 /**
5685 * enum iwm_sta_flags - flags for the ADD_STA host command
5686 * @IWM_STA_FLG_REDUCED_TX_PWR_CTRL:
5687 * @IWM_STA_FLG_REDUCED_TX_PWR_DATA:
5688 * @IWM_STA_FLG_DISABLE_TX: set if TX should be disabled
5689 * @IWM_STA_FLG_PS: set if STA is in Power Save
5690 * @IWM_STA_FLG_INVALID: set if STA is invalid
5691 * @IWM_STA_FLG_DLP_EN: Direct Link Protocol is enabled
5692 * @IWM_STA_FLG_SET_ALL_KEYS: the current key applies to all key IDs
5693 * @IWM_STA_FLG_DRAIN_FLOW: drain flow
5694 * @IWM_STA_FLG_PAN: STA is for PAN interface
5695 * @IWM_STA_FLG_CLASS_AUTH:
5696 * @IWM_STA_FLG_CLASS_ASSOC:
5697 * @IWM_STA_FLG_CLASS_MIMO_PROT:
5698 * @IWM_STA_FLG_MAX_AGG_SIZE_MSK: maximal size for A-MPDU
5699 * @IWM_STA_FLG_AGG_MPDU_DENS_MSK: maximal MPDU density for Tx aggregation
5700 * @IWM_STA_FLG_FAT_EN_MSK: support for channel width (for Tx). This flag is
5701 * initialised by driver and can be updated by fw upon reception of
5702 * action frames that can change the channel width. When cleared the fw
5703 * will send all the frames in 20MHz even when FAT channel is requested.
5704 * @IWM_STA_FLG_MIMO_EN_MSK: support for MIMO. This flag is initialised by the
5705 * driver and can be updated by fw upon reception of action frames.
5706 * @IWM_STA_FLG_MFP_EN: Management Frame Protection
5707 */
5708 enum iwm_sta_flags {
5709 IWM_STA_FLG_REDUCED_TX_PWR_CTRL = (1 << 3),
5710 IWM_STA_FLG_REDUCED_TX_PWR_DATA = (1 << 6),
5711
5712 IWM_STA_FLG_DISABLE_TX = (1 << 4),
5713
5714 IWM_STA_FLG_PS = (1 << 8),
5715 IWM_STA_FLG_DRAIN_FLOW = (1 << 12),
5716 IWM_STA_FLG_PAN = (1 << 13),
5717 IWM_STA_FLG_CLASS_AUTH = (1 << 14),
5718 IWM_STA_FLG_CLASS_ASSOC = (1 << 15),
5719 IWM_STA_FLG_RTS_MIMO_PROT = (1 << 17),
5720
5721 IWM_STA_FLG_MAX_AGG_SIZE_SHIFT = 19,
5722 IWM_STA_FLG_MAX_AGG_SIZE_8K = (0 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5723 IWM_STA_FLG_MAX_AGG_SIZE_16K = (1 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5724 IWM_STA_FLG_MAX_AGG_SIZE_32K = (2 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5725 IWM_STA_FLG_MAX_AGG_SIZE_64K = (3 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5726 IWM_STA_FLG_MAX_AGG_SIZE_128K = (4 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5727 IWM_STA_FLG_MAX_AGG_SIZE_256K = (5 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5728 IWM_STA_FLG_MAX_AGG_SIZE_512K = (6 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5729 IWM_STA_FLG_MAX_AGG_SIZE_1024K = (7 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5730 IWM_STA_FLG_MAX_AGG_SIZE_MSK = (7 << IWM_STA_FLG_MAX_AGG_SIZE_SHIFT),
5731
5732 IWM_STA_FLG_AGG_MPDU_DENS_SHIFT = 23,
5733 IWM_STA_FLG_AGG_MPDU_DENS_2US = (4 << IWM_STA_FLG_AGG_MPDU_DENS_SHIFT),
5734 IWM_STA_FLG_AGG_MPDU_DENS_4US = (5 << IWM_STA_FLG_AGG_MPDU_DENS_SHIFT),
5735 IWM_STA_FLG_AGG_MPDU_DENS_8US = (6 << IWM_STA_FLG_AGG_MPDU_DENS_SHIFT),
5736 IWM_STA_FLG_AGG_MPDU_DENS_16US = (7 << IWM_STA_FLG_AGG_MPDU_DENS_SHIFT),
5737 IWM_STA_FLG_AGG_MPDU_DENS_MSK = (7 << IWM_STA_FLG_AGG_MPDU_DENS_SHIFT),
5738
5739 IWM_STA_FLG_FAT_EN_20MHZ = (0 << 26),
5740 IWM_STA_FLG_FAT_EN_40MHZ = (1 << 26),
5741 IWM_STA_FLG_FAT_EN_80MHZ = (2 << 26),
5742 IWM_STA_FLG_FAT_EN_160MHZ = (3 << 26),
5743 IWM_STA_FLG_FAT_EN_MSK = (3 << 26),
5744
5745 IWM_STA_FLG_MIMO_EN_SISO = (0 << 28),
5746 IWM_STA_FLG_MIMO_EN_MIMO2 = (1 << 28),
5747 IWM_STA_FLG_MIMO_EN_MIMO3 = (2 << 28),
5748 IWM_STA_FLG_MIMO_EN_MSK = (3 << 28),
5749 };
5750
5751 /**
5752 * enum iwm_sta_key_flag - key flags for the ADD_STA host command
5753 * @IWM_STA_KEY_FLG_NO_ENC: no encryption
5754 * @IWM_STA_KEY_FLG_WEP: WEP encryption algorithm
5755 * @IWM_STA_KEY_FLG_CCM: CCMP encryption algorithm
5756 * @IWM_STA_KEY_FLG_TKIP: TKIP encryption algorithm
5757 * @IWM_STA_KEY_FLG_EXT: extended cipher algorithm (depends on the FW support)
5758 * @IWM_STA_KEY_FLG_CMAC: CMAC encryption algorithm
5759 * @IWM_STA_KEY_FLG_ENC_UNKNOWN: unknown encryption algorithm
5760 * @IWM_STA_KEY_FLG_EN_MSK: mask for encryption algorithmi value
5761 * @IWM_STA_KEY_FLG_WEP_KEY_MAP: wep is either a group key (0 - legacy WEP) or from
5762 * station info array (1 - n 1X mode)
5763 * @IWM_STA_KEY_FLG_KEYID_MSK: the index of the key
5764 * @IWM_STA_KEY_NOT_VALID: key is invalid
5765 * @IWM_STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key
5766 * @IWM_STA_KEY_MULTICAST: set for multical key
5767 * @IWM_STA_KEY_MFP: key is used for Management Frame Protection
5768 */
5769 enum iwm_sta_key_flag {
5770 IWM_STA_KEY_FLG_NO_ENC = (0 << 0),
5771 IWM_STA_KEY_FLG_WEP = (1 << 0),
5772 IWM_STA_KEY_FLG_CCM = (2 << 0),
5773 IWM_STA_KEY_FLG_TKIP = (3 << 0),
5774 IWM_STA_KEY_FLG_EXT = (4 << 0),
5775 IWM_STA_KEY_FLG_CMAC = (6 << 0),
5776 IWM_STA_KEY_FLG_ENC_UNKNOWN = (7 << 0),
5777 IWM_STA_KEY_FLG_EN_MSK = (7 << 0),
5778
5779 IWM_STA_KEY_FLG_WEP_KEY_MAP = (1 << 3),
5780 IWM_STA_KEY_FLG_KEYID_POS = 8,
5781 IWM_STA_KEY_FLG_KEYID_MSK = (3 << IWM_STA_KEY_FLG_KEYID_POS),
5782 IWM_STA_KEY_NOT_VALID = (1 << 11),
5783 IWM_STA_KEY_FLG_WEP_13BYTES = (1 << 12),
5784 IWM_STA_KEY_MULTICAST = (1 << 14),
5785 IWM_STA_KEY_MFP = (1 << 15),
5786 };
5787
5788 /**
5789 * enum iwm_sta_modify_flag - indicate to the fw what flag are being changed
5790 * @IWM_STA_MODIFY_QUEUE_REMOVAL: this command removes a queue
5791 * @IWM_STA_MODIFY_TID_DISABLE_TX: this command modifies %tid_disable_tx
5792 * @IWM_STA_MODIFY_TX_RATE: unused
5793 * @IWM_STA_MODIFY_ADD_BA_TID: this command modifies %add_immediate_ba_tid
5794 * @IWM_STA_MODIFY_REMOVE_BA_TID: this command modifies %remove_immediate_ba_tid
5795 * @IWM_STA_MODIFY_SLEEPING_STA_TX_COUNT: this command modifies %sleep_tx_count
5796 * @IWM_STA_MODIFY_PROT_TH:
5797 * @IWM_STA_MODIFY_QUEUES: modify the queues used by this station
5798 */
5799 enum iwm_sta_modify_flag {
5800 IWM_STA_MODIFY_QUEUE_REMOVAL = (1 << 0),
5801 IWM_STA_MODIFY_TID_DISABLE_TX = (1 << 1),
5802 IWM_STA_MODIFY_TX_RATE = (1 << 2),
5803 IWM_STA_MODIFY_ADD_BA_TID = (1 << 3),
5804 IWM_STA_MODIFY_REMOVE_BA_TID = (1 << 4),
5805 IWM_STA_MODIFY_SLEEPING_STA_TX_COUNT = (1 << 5),
5806 IWM_STA_MODIFY_PROT_TH = (1 << 6),
5807 IWM_STA_MODIFY_QUEUES = (1 << 7),
5808 };
5809
5810 #define IWM_STA_MODE_MODIFY 1
5811
5812 /**
5813 * enum iwm_sta_sleep_flag - type of sleep of the station
5814 * @IWM_STA_SLEEP_STATE_AWAKE:
5815 * @IWM_STA_SLEEP_STATE_PS_POLL:
5816 * @IWM_STA_SLEEP_STATE_UAPSD:
5817 * @IWM_STA_SLEEP_STATE_MOREDATA: set more-data bit on
5818 * (last) released frame
5819 */
5820 enum iwm_sta_sleep_flag {
5821 IWM_STA_SLEEP_STATE_AWAKE = 0,
5822 IWM_STA_SLEEP_STATE_PS_POLL = (1 << 0),
5823 IWM_STA_SLEEP_STATE_UAPSD = (1 << 1),
5824 IWM_STA_SLEEP_STATE_MOREDATA = (1 << 2),
5825 };
5826
5827 /* STA ID and color bits definitions */
5828 #define IWM_STA_ID_SEED (0x0f)
5829 #define IWM_STA_ID_POS (0)
5830 #define IWM_STA_ID_MSK (IWM_STA_ID_SEED << IWM_STA_ID_POS)
5831
5832 #define IWM_STA_COLOR_SEED (0x7)
5833 #define IWM_STA_COLOR_POS (4)
5834 #define IWM_STA_COLOR_MSK (IWM_STA_COLOR_SEED << IWM_STA_COLOR_POS)
5835
5836 #define IWM_STA_ID_N_COLOR_GET_COLOR(id_n_color) \
5837 (((id_n_color) & IWM_STA_COLOR_MSK) >> IWM_STA_COLOR_POS)
5838 #define IWM_STA_ID_N_COLOR_GET_ID(id_n_color) \
5839 (((id_n_color) & IWM_STA_ID_MSK) >> IWM_STA_ID_POS)
5840
5841 #define IWM_STA_KEY_MAX_NUM (16)
5842 #define IWM_STA_KEY_IDX_INVALID (0xff)
5843 #define IWM_STA_KEY_MAX_DATA_KEY_NUM (4)
5844 #define IWM_MAX_GLOBAL_KEYS (4)
5845 #define IWM_STA_KEY_LEN_WEP40 (5)
5846 #define IWM_STA_KEY_LEN_WEP104 (13)
5847
5848 /**
5849 * struct iwm_keyinfo - key information
5850 * @key_flags: type %iwm_sta_key_flag
5851 * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
5852 * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
5853 * @key_offset: key offset in the fw's key table
5854 * @key: 16-byte unicast decryption key
5855 * @tx_secur_seq_cnt: initial RSC / PN needed for replay check
5856 * @hw_tkip_mic_rx_key: byte: MIC Rx Key - used for TKIP only
5857 * @hw_tkip_mic_tx_key: byte: MIC Tx Key - used for TKIP only
5858 */
5859 struct iwm_keyinfo {
5860 uint16_t key_flags;
5861 uint8_t tkip_rx_tsc_byte2;
5862 uint8_t reserved1;
5863 uint16_t tkip_rx_ttak[5];
5864 uint8_t key_offset;
5865 uint8_t reserved2;
5866 uint8_t key[16];
5867 uint64_t tx_secur_seq_cnt;
5868 uint64_t hw_tkip_mic_rx_key;
5869 uint64_t hw_tkip_mic_tx_key;
5870 } __packed;
5871
5872 #define IWM_ADD_STA_STATUS_MASK 0xFF
5873 #define IWM_ADD_STA_BAID_VALID_MASK 0x8000
5874 #define IWM_ADD_STA_BAID_MASK 0x7F00
5875 #define IWM_ADD_STA_BAID_SHIFT 8
5876
5877 /**
5878 * struct iwl_add_sta_cmd_v7 - Add/modify a station in the fw's sta table.
5879 * ( REPLY_ADD_STA = 0x18 )
5880 * @add_modify: see &enum iwl_sta_mode
5881 * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
5882 * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
5883 * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
5884 * @mac_id_n_color: the Mac context this station belongs to,
5885 * see &enum iwl_ctxt_id_and_color
5886 * @addr: station's MAC address
5887 * @reserved2: reserved
5888 * @sta_id: index of station in uCode's station table
5889 * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
5890 * alone. 1 - modify, 0 - don't change.
5891 * @reserved3: reserved
5892 * @station_flags: look at &enum iwl_sta_flags
5893 * @station_flags_msk: what of %station_flags have changed,
5894 * also &enum iwl_sta_flags
5895 * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
5896 * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
5897 * add_immediate_ba_ssn.
5898 * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
5899 * Set %STA_MODIFY_REMOVE_BA_TID to use this field
5900 * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
5901 * add_immediate_ba_tid.
5902 * @sleep_tx_count: number of packets to transmit to station even though it is
5903 * asleep. Used to synchronise PS-poll and u-APSD responses while ucode
5904 * keeps track of STA sleep state.
5905 * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
5906 * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
5907 * mac-addr.
5908 * @beamform_flags: beam forming controls
5909 * @tfd_queue_msk: tfd queues used by this station
5910 *
5911 * The device contains an internal table of per-station information, with info
5912 * on security keys, aggregation parameters, and Tx rates for initial Tx
5913 * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
5914 *
5915 * ADD_STA sets up the table entry for one station, either creating a new
5916 * entry, or modifying a pre-existing one.
5917 */
5918 struct iwm_add_sta_cmd_v7 {
5919 uint8_t add_modify;
5920 uint8_t awake_acs;
5921 uint16_t tid_disable_tx;
5922 uint32_t mac_id_n_color;
5923 uint8_t addr[IEEE80211_ADDR_LEN]; /* _STA_ID_MODIFY_INFO_API_S_VER_1 */
5924 uint16_t reserved2;
5925 uint8_t sta_id;
5926 uint8_t modify_mask;
5927 uint16_t reserved3;
5928 uint32_t station_flags;
5929 uint32_t station_flags_msk;
5930 uint8_t add_immediate_ba_tid;
5931 uint8_t remove_immediate_ba_tid;
5932 uint16_t add_immediate_ba_ssn;
5933 uint16_t sleep_tx_count;
5934 uint16_t sleep_state_flags;
5935 uint16_t assoc_id;
5936 uint16_t beamform_flags;
5937 uint32_t tfd_queue_msk;
5938 } __packed; /* ADD_STA_CMD_API_S_VER_7 */
5939
5940 /**
5941 * enum iwm_sta_type - FW station types
5942 * ( REPLY_ADD_STA = 0x18 )
5943 * @IWM_STA_LINK: Link station - normal RX and TX traffic.
5944 * @IWM_STA_GENERAL_PURPOSE: General purpose. In AP mode used for beacons
5945 * and probe responses.
5946 * @IWM_STA_MULTICAST: multicast traffic,
5947 * @IWM_STA_TDLS_LINK: TDLS link station
5948 * @IWM_STA_AUX_ACTIVITY: auxilary station (scan, ROC and so on).
5949 */
5950 enum iwm_sta_type {
5951 IWM_STA_LINK,
5952 IWM_STA_GENERAL_PURPOSE,
5953 IWM_STA_MULTICAST,
5954 IWM_STA_TDLS_LINK,
5955 IWM_STA_AUX_ACTIVITY,
5956 };
5957
5958 /**
5959 * struct iwm_add_sta_cmd - Add/modify a station in the fw's sta table.
5960 * ( REPLY_ADD_STA = 0x18 )
5961 * @add_modify: see &enum iwm_sta_mode
5962 * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
5963 * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
5964 * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
5965 * @mac_id_n_color: the Mac context this station belongs to,
5966 * see &enum iwl_ctxt_id_and_color
5967 * @addr: station's MAC address
5968 * @reserved2: reserved
5969 * @sta_id: index of station in uCode's station table
5970 * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
5971 * alone. 1 - modify, 0 - don't change.
5972 * @reserved3: reserved
5973 * @station_flags: look at &enum iwm_sta_flags
5974 * @station_flags_msk: what of %station_flags have changed,
5975 * also &enum iwm_sta_flags
5976 * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
5977 * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
5978 * add_immediate_ba_ssn.
5979 * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
5980 * Set %STA_MODIFY_REMOVE_BA_TID to use this field
5981 * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
5982 * add_immediate_ba_tid.
5983 * @sleep_tx_count: number of packets to transmit to station even though it is
5984 * asleep. Used to synchronise PS-poll and u-APSD responses while ucode
5985 * keeps track of STA sleep state.
5986 * @station_type: type of this station. See &enum iwl_sta_type.
5987 * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
5988 * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
5989 * mac-addr.
5990 * @beamform_flags: beam forming controls
5991 * @tfd_queue_msk: tfd queues used by this station.
5992 * Obselete for new TX API (9 and above).
5993 * @rx_ba_window: aggregation window size
5994 * @sp_length: the size of the SP in actual number of frames
5995 * @uapsd_acs: 4 LS bits are trigger enabled ACs, 4 MS bits are the deliver
5996 * enabled ACs.
5997 *
5998 * The device contains an internal table of per-station information, with info
5999 * on security keys, aggregation parameters, and Tx rates for initial Tx
6000 * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
6001 *
6002 * ADD_STA sets up the table entry for one station, either creating a new
6003 * entry, or modifying a pre-existing one.
6004 */
6005 struct iwm_add_sta_cmd {
6006 uint8_t add_modify;
6007 uint8_t awake_acs;
6008 uint16_t tid_disable_tx;
6009 uint32_t mac_id_n_color;
6010 uint8_t addr[IEEE80211_ADDR_LEN]; /* _STA_ID_MODIFY_INFO_API_S_VER_1 */
6011 uint16_t reserved2;
6012 uint8_t sta_id;
6013 uint8_t modify_mask;
6014 uint16_t reserved3;
6015 uint32_t station_flags;
6016 uint32_t station_flags_msk;
6017 uint8_t add_immediate_ba_tid;
6018 uint8_t remove_immediate_ba_tid;
6019 uint16_t add_immediate_ba_ssn;
6020 uint16_t sleep_tx_count;
6021 uint8_t sleep_state_flags;
6022 uint8_t station_type;
6023 uint16_t assoc_id;
6024 uint16_t beamform_flags;
6025 uint32_t tfd_queue_msk;
6026 uint16_t rx_ba_window;
6027 uint8_t sp_length;
6028 uint8_t uapsd_acs;
6029 } __packed; /* ADD_STA_CMD_API_S_VER_10 */
6030
6031 /**
6032 * struct iwm_add_sta_key_cmd - add/modify sta key
6033 * ( IWM_REPLY_ADD_STA_KEY = 0x17 )
6034 * @sta_id: index of station in uCode's station table
6035 * @key_offset: key offset in key storage
6036 * @key_flags: type %iwm_sta_key_flag
6037 * @key: key material data
6038 * @key2: key material data
6039 * @rx_secur_seq_cnt: RX security sequence counter for the key
6040 * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
6041 * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
6042 */
6043 struct iwm_add_sta_key_cmd {
6044 uint8_t sta_id;
6045 uint8_t key_offset;
6046 uint16_t key_flags;
6047 uint8_t key[16];
6048 uint8_t key2[16];
6049 uint8_t rx_secur_seq_cnt[16];
6050 uint8_t tkip_rx_tsc_byte2;
6051 uint8_t reserved;
6052 uint16_t tkip_rx_ttak[5];
6053 } __packed; /* IWM_ADD_MODIFY_STA_KEY_API_S_VER_1 */
6054
6055 /**
6056 * enum iwm_add_sta_rsp_status - status in the response to ADD_STA command
6057 * @IWM_ADD_STA_SUCCESS: operation was executed successfully
6058 * @IWM_ADD_STA_STATIONS_OVERLOAD: no room left in the fw's station table
6059 * @IWM_ADD_STA_IMMEDIATE_BA_FAILURE: can't add Rx block ack session
6060 * @IWM_ADD_STA_MODIFY_NON_EXISTING_STA: driver requested to modify a station
6061 * that doesn't exist.
6062 */
6063 enum iwm_add_sta_rsp_status {
6064 IWM_ADD_STA_SUCCESS = 0x1,
6065 IWM_ADD_STA_STATIONS_OVERLOAD = 0x2,
6066 IWM_ADD_STA_IMMEDIATE_BA_FAILURE = 0x4,
6067 IWM_ADD_STA_MODIFY_NON_EXISTING_STA = 0x8,
6068 };
6069
6070 /**
6071 * struct iwm_rm_sta_cmd - Add / modify a station in the fw's station table
6072 * ( IWM_REMOVE_STA = 0x19 )
6073 * @sta_id: the station id of the station to be removed
6074 */
6075 struct iwm_rm_sta_cmd {
6076 uint8_t sta_id;
6077 uint8_t reserved[3];
6078 } __packed; /* IWM_REMOVE_STA_CMD_API_S_VER_2 */
6079
6080 /**
6081 * struct iwm_mgmt_mcast_key_cmd
6082 * ( IWM_MGMT_MCAST_KEY = 0x1f )
6083 * @ctrl_flags: %iwm_sta_key_flag
6084 * @IGTK:
6085 * @K1: IGTK master key
6086 * @K2: IGTK sub key
6087 * @sta_id: station ID that support IGTK
6088 * @key_id:
6089 * @receive_seq_cnt: initial RSC/PN needed for replay check
6090 */
6091 struct iwm_mgmt_mcast_key_cmd {
6092 uint32_t ctrl_flags;
6093 uint8_t IGTK[16];
6094 uint8_t K1[16];
6095 uint8_t K2[16];
6096 uint32_t key_id;
6097 uint32_t sta_id;
6098 uint64_t receive_seq_cnt;
6099 } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_1 */
6100
6101 struct iwm_wep_key {
6102 uint8_t key_index;
6103 uint8_t key_offset;
6104 uint16_t reserved1;
6105 uint8_t key_size;
6106 uint8_t reserved2[3];
6107 uint8_t key[16];
6108 } __packed;
6109
6110 struct iwm_wep_key_cmd {
6111 uint32_t mac_id_n_color;
6112 uint8_t num_keys;
6113 uint8_t decryption_type;
6114 uint8_t flags;
6115 uint8_t reserved;
6116 struct iwm_wep_key wep_key[0];
6117 } __packed; /* SEC_CURR_WEP_KEY_CMD_API_S_VER_2 */
6118
6119 /*
6120 * END mvm/fw-api-sta.h
6121 */
6122
6123 /*
6124 * BT coex
6125 */
6126
6127 enum iwm_bt_coex_mode {
6128 IWM_BT_COEX_DISABLE = 0x0,
6129 IWM_BT_COEX_NW = 0x1,
6130 IWM_BT_COEX_BT = 0x2,
6131 IWM_BT_COEX_WIFI = 0x3,
6132 }; /* BT_COEX_MODES_E */
6133
6134 enum iwm_bt_coex_enabled_modules {
6135 IWM_BT_COEX_MPLUT_ENABLED = (1 << 0),
6136 IWM_BT_COEX_MPLUT_BOOST_ENABLED = (1 << 1),
6137 IWM_BT_COEX_SYNC2SCO_ENABLED = (1 << 2),
6138 IWM_BT_COEX_CORUN_ENABLED = (1 << 3),
6139 IWM_BT_COEX_HIGH_BAND_RET = (1 << 4),
6140 }; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
6141
6142 /**
6143 * struct iwm_bt_coex_cmd - bt coex configuration command
6144 * @mode: enum %iwm_bt_coex_mode
6145 * @enabled_modules: enum %iwm_bt_coex_enabled_modules
6146 *
6147 * The structure is used for the BT_COEX command.
6148 */
6149 struct iwm_bt_coex_cmd {
6150 uint32_t mode;
6151 uint32_t enabled_modules;
6152 } __packed; /* BT_COEX_CMD_API_S_VER_6 */
6153
6154
6155 /*
6156 * Location Aware Regulatory (LAR) API - MCC updates
6157 */
6158
6159 /**
6160 * struct iwm_mcc_update_cmd_v1 - Request the device to update geographic
6161 * regulatory profile according to the given MCC (Mobile Country Code).
6162 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
6163 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
6164 * MCC in the cmd response will be the relevant MCC in the NVM.
6165 * @mcc: given mobile country code
6166 * @source_id: the source from where we got the MCC, see iwm_mcc_source
6167 * @reserved: reserved for alignment
6168 */
6169 struct iwm_mcc_update_cmd_v1 {
6170 uint16_t mcc;
6171 uint8_t source_id;
6172 uint8_t reserved;
6173 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
6174
6175 /**
6176 * struct iwm_mcc_update_cmd - Request the device to update geographic
6177 * regulatory profile according to the given MCC (Mobile Country Code).
6178 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
6179 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
6180 * MCC in the cmd response will be the relevant MCC in the NVM.
6181 * @mcc: given mobile country code
6182 * @source_id: the source from where we got the MCC, see iwm_mcc_source
6183 * @reserved: reserved for alignment
6184 * @key: integrity key for MCC API OEM testing
6185 * @reserved2: reserved
6186 */
6187 struct iwm_mcc_update_cmd {
6188 uint16_t mcc;
6189 uint8_t source_id;
6190 uint8_t reserved;
6191 uint32_t key;
6192 uint32_t reserved2[5];
6193 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
6194
6195 /**
6196 * iwm_mcc_update_resp_v1 - response to MCC_UPDATE_CMD.
6197 * Contains the new channel control profile map, if changed, and the new MCC
6198 * (mobile country code).
6199 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
6200 * @status: see &enum iwm_mcc_update_status
6201 * @mcc: the new applied MCC
6202 * @cap: capabilities for all channels which matches the MCC
6203 * @source_id: the MCC source, see iwm_mcc_source
6204 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
6205 * channels, depending on platform)
6206 * @channels: channel control data map, DWORD for each channel. Only the first
6207 * 16bits are used.
6208 */
6209 struct iwm_mcc_update_resp_v1 {
6210 uint32_t status;
6211 uint16_t mcc;
6212 uint8_t cap;
6213 uint8_t source_id;
6214 uint32_t n_channels;
6215 uint32_t channels[0];
6216 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
6217
6218 /**
6219 * iwm_mcc_update_resp - response to MCC_UPDATE_CMD.
6220 * Contains the new channel control profile map, if changed, and the new MCC
6221 * (mobile country code).
6222 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
6223 * @status: see &enum iwm_mcc_update_status
6224 * @mcc: the new applied MCC
6225 * @cap: capabilities for all channels which matches the MCC
6226 * @source_id: the MCC source, see iwm_mcc_source
6227 * @time: time elapsed from the MCC test start (in 30 seconds TU)
6228 * @reserved: reserved.
6229 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
6230 * channels, depending on platform)
6231 * @channels: channel control data map, DWORD for each channel. Only the first
6232 * 16bits are used.
6233 */
6234 struct iwm_mcc_update_resp {
6235 uint32_t status;
6236 uint16_t mcc;
6237 uint8_t cap;
6238 uint8_t source_id;
6239 uint16_t time;
6240 uint16_t reserved;
6241 uint32_t n_channels;
6242 uint32_t channels[0];
6243 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
6244
6245 /**
6246 * struct iwm_mcc_chub_notif - chub notifies of mcc change
6247 * (MCC_CHUB_UPDATE_CMD = 0xc9)
6248 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
6249 * the cellular and connectivity cores that gets updates of the mcc, and
6250 * notifies the ucode directly of any mcc change.
6251 * The ucode requests the driver to request the device to update geographic
6252 * regulatory profile according to the given MCC (Mobile Country Code).
6253 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
6254 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
6255 * MCC in the cmd response will be the relevant MCC in the NVM.
6256 * @mcc: given mobile country code
6257 * @source_id: identity of the change originator, see iwm_mcc_source
6258 * @reserved1: reserved for alignment
6259 */
6260 struct iwm_mcc_chub_notif {
6261 uint16_t mcc;
6262 uint8_t source_id;
6263 uint8_t reserved1;
6264 } __packed; /* LAR_MCC_NOTIFY_S */
6265
6266 enum iwm_mcc_update_status {
6267 IWM_MCC_RESP_NEW_CHAN_PROFILE,
6268 IWM_MCC_RESP_SAME_CHAN_PROFILE,
6269 IWM_MCC_RESP_INVALID,
6270 IWM_MCC_RESP_NVM_DISABLED,
6271 IWM_MCC_RESP_ILLEGAL,
6272 IWM_MCC_RESP_LOW_PRIORITY,
6273 IWM_MCC_RESP_TEST_MODE_ACTIVE,
6274 IWM_MCC_RESP_TEST_MODE_NOT_ACTIVE,
6275 IWM_MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
6276 };
6277
6278 enum iwm_mcc_source {
6279 IWM_MCC_SOURCE_OLD_FW = 0,
6280 IWM_MCC_SOURCE_ME = 1,
6281 IWM_MCC_SOURCE_BIOS = 2,
6282 IWM_MCC_SOURCE_3G_LTE_HOST = 3,
6283 IWM_MCC_SOURCE_3G_LTE_DEVICE = 4,
6284 IWM_MCC_SOURCE_WIFI = 5,
6285 IWM_MCC_SOURCE_RESERVED = 6,
6286 IWM_MCC_SOURCE_DEFAULT = 7,
6287 IWM_MCC_SOURCE_UNINITIALIZED = 8,
6288 IWM_MCC_SOURCE_MCC_API = 9,
6289 IWM_MCC_SOURCE_GET_CURRENT = 0x10,
6290 IWM_MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
6291 };
6292
6293 /**
6294 * struct iwm_dts_measurement_notif_v1 - measurements notification
6295 *
6296 * @temp: the measured temperature
6297 * @voltage: the measured voltage
6298 */
6299 struct iwm_dts_measurement_notif_v1 {
6300 int32_t temp;
6301 int32_t voltage;
6302 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
6303
6304 /**
6305 * struct iwm_dts_measurement_notif_v2 - measurements notification
6306 *
6307 * @temp: the measured temperature
6308 * @voltage: the measured voltage
6309 * @threshold_idx: the trip index that was crossed
6310 */
6311 struct iwm_dts_measurement_notif_v2 {
6312 int32_t temp;
6313 int32_t voltage;
6314 int32_t threshold_idx;
6315 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
6316
6317 /*
6318 * Some cherry-picked definitions
6319 */
6320
6321 #define IWM_FRAME_LIMIT 64
6322
6323 /*
6324 * These functions retrieve specific information from the id field in
6325 * the iwm_host_cmd struct which contains the command id, the group id,
6326 * and the version of the command and vice versa.
6327 */
6328 static inline uint8_t
iwm_cmd_opcode(uint32_t cmdid)6329 iwm_cmd_opcode(uint32_t cmdid)
6330 {
6331 return cmdid & 0xff;
6332 }
6333
6334 static inline uint8_t
iwm_cmd_groupid(uint32_t cmdid)6335 iwm_cmd_groupid(uint32_t cmdid)
6336 {
6337 return ((cmdid & 0xff00) >> 8);
6338 }
6339
6340 static inline uint8_t
iwm_cmd_version(uint32_t cmdid)6341 iwm_cmd_version(uint32_t cmdid)
6342 {
6343 return ((cmdid & 0xff0000) >> 16);
6344 }
6345
6346 static inline uint32_t
iwm_cmd_id(uint8_t opcode,uint8_t groupid,uint8_t version)6347 iwm_cmd_id(uint8_t opcode, uint8_t groupid, uint8_t version)
6348 {
6349 return opcode + (groupid << 8) + (version << 16);
6350 }
6351
6352 /* make uint16_t wide id out of uint8_t group and opcode */
6353 #define IWM_WIDE_ID(grp, opcode) ((grp << 8) | opcode)
6354
6355 /* due to the conversion, this group is special */
6356 #define IWM_ALWAYS_LONG_GROUP 1
6357
6358 struct iwm_cmd_header {
6359 uint8_t code;
6360 uint8_t flags;
6361 uint8_t idx;
6362 uint8_t qid;
6363 } __packed;
6364
6365 struct iwm_cmd_header_wide {
6366 uint8_t opcode;
6367 uint8_t group_id;
6368 uint8_t idx;
6369 uint8_t qid;
6370 uint16_t length;
6371 uint8_t reserved;
6372 uint8_t version;
6373 } __packed;
6374
6375 /**
6376 * enum iwm_power_scheme
6377 * @IWM_POWER_LEVEL_CAM - Continuously Active Mode
6378 * @IWM_POWER_LEVEL_BPS - Balanced Power Save (default)
6379 * @IWM_POWER_LEVEL_LP - Low Power
6380 */
6381 enum iwm_power_scheme {
6382 IWM_POWER_SCHEME_CAM = 1,
6383 IWM_POWER_SCHEME_BPS,
6384 IWM_POWER_SCHEME_LP
6385 };
6386
6387 #define IWM_DEF_CMD_PAYLOAD_SIZE 320
6388 #define IWM_MAX_CMD_PAYLOAD_SIZE ((4096 - 4) - sizeof(struct iwm_cmd_header))
6389 #define IWM_CMD_FAILED_MSK 0x40
6390
6391 /**
6392 * struct iwm_device_cmd
6393 *
6394 * For allocation of the command and tx queues, this establishes the overall
6395 * size of the largest command we send to uCode, except for commands that
6396 * aren't fully copied and use other TFD space.
6397 */
6398 struct iwm_device_cmd {
6399 union {
6400 struct {
6401 struct iwm_cmd_header hdr;
6402 uint8_t data[IWM_DEF_CMD_PAYLOAD_SIZE];
6403 };
6404 struct {
6405 struct iwm_cmd_header_wide hdr_wide;
6406 uint8_t data_wide[IWM_DEF_CMD_PAYLOAD_SIZE -
6407 sizeof(struct iwm_cmd_header_wide) +
6408 sizeof(struct iwm_cmd_header)];
6409 };
6410 };
6411 } __packed;
6412
6413 struct iwm_rx_packet {
6414 /*
6415 * The first 4 bytes of the RX frame header contain both the RX frame
6416 * size and some flags.
6417 * Bit fields:
6418 * 31: flag flush RB request
6419 * 30: flag ignore TC (terminal counter) request
6420 * 29: flag fast IRQ request
6421 * 28-14: Reserved
6422 * 13-00: RX frame size
6423 */
6424 uint32_t len_n_flags;
6425 struct iwm_cmd_header hdr;
6426 uint8_t data[];
6427 } __packed;
6428
6429 #define IWM_FH_RSCSR_FRAME_SIZE_MSK 0x00003fff
6430 #define IWM_FH_RSCSR_FRAME_INVALID 0x55550000
6431 #define IWM_FH_RSCSR_FRAME_ALIGN 0x40
6432
6433 static inline uint32_t
iwm_rx_packet_len(const struct iwm_rx_packet * pkt)6434 iwm_rx_packet_len(const struct iwm_rx_packet *pkt)
6435 {
6436
6437 return le32toh(pkt->len_n_flags) & IWM_FH_RSCSR_FRAME_SIZE_MSK;
6438 }
6439
6440 static inline uint32_t
iwm_rx_packet_payload_len(const struct iwm_rx_packet * pkt)6441 iwm_rx_packet_payload_len(const struct iwm_rx_packet *pkt)
6442 {
6443
6444 return iwm_rx_packet_len(pkt) - sizeof(pkt->hdr);
6445 }
6446
6447
6448 #define IWM_MIN_DBM -100
6449 #define IWM_MAX_DBM -33 /* realistic guess */
6450
6451 #define IWM_READ(sc, reg) \
6452 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
6453
6454 #define IWM_WRITE(sc, reg, val) \
6455 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
6456
6457 #define IWM_WRITE_1(sc, reg, val) \
6458 bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val))
6459
6460 #define IWM_SETBITS(sc, reg, mask) \
6461 IWM_WRITE(sc, reg, IWM_READ(sc, reg) | (mask))
6462
6463 #define IWM_CLRBITS(sc, reg, mask) \
6464 IWM_WRITE(sc, reg, IWM_READ(sc, reg) & ~(mask))
6465
6466 #define IWM_BARRIER_WRITE(sc) \
6467 bus_space_barrier((sc)->sc_st, (sc)->sc_sh, 0, (sc)->sc_sz, \
6468 BUS_SPACE_BARRIER_WRITE)
6469
6470 #define IWM_BARRIER_READ_WRITE(sc) \
6471 bus_space_barrier((sc)->sc_st, (sc)->sc_sh, 0, (sc)->sc_sz, \
6472 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE)
6473
6474 #endif /* __IF_IWM_REG_H__ */
6475