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