spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / drivers / net / wireless / iwmc3200wifi / umac.h
blob4a137d334a42b67c541ebde00c6c56c279d8353a
1 /*
2 * Intel Wireless Multicomm 3200 WiFi driver
4 * Copyright (C) 2009 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Intel Corporation <ilw@linux.intel.com>
34 * Samuel Ortiz <samuel.ortiz@intel.com>
35 * Zhu Yi <yi.zhu@intel.com>
39 #ifndef __IWM_UMAC_H__
40 #define __IWM_UMAC_H__
42 struct iwm_udma_in_hdr {
43 __le32 cmd;
44 __le32 size;
45 } __packed;
47 struct iwm_udma_out_nonwifi_hdr {
48 __le32 cmd;
49 __le32 addr;
50 __le32 op1_sz;
51 __le32 op2;
52 } __packed;
54 struct iwm_udma_out_wifi_hdr {
55 __le32 cmd;
56 __le32 meta_data;
57 } __packed;
59 /* Sequence numbering */
60 #define UMAC_WIFI_SEQ_NUM_BASE 1
61 #define UMAC_WIFI_SEQ_NUM_MAX 0x4000
62 #define UMAC_NONWIFI_SEQ_NUM_BASE 1
63 #define UMAC_NONWIFI_SEQ_NUM_MAX 0x10
65 /* MAC address address */
66 #define WICO_MAC_ADDRESS_ADDR 0x604008F8
68 /* RA / TID */
69 #define UMAC_HDI_ACT_TBL_IDX_TID_POS 0
70 #define UMAC_HDI_ACT_TBL_IDX_TID_SEED 0xF
72 #define UMAC_HDI_ACT_TBL_IDX_RA_POS 4
73 #define UMAC_HDI_ACT_TBL_IDX_RA_SEED 0xF
75 #define UMAC_HDI_ACT_TBL_IDX_RA_UMAC 0xF
76 #define UMAC_HDI_ACT_TBL_IDX_TID_UMAC 0x9
77 #define UMAC_HDI_ACT_TBL_IDX_TID_LMAC 0xA
79 #define UMAC_HDI_ACT_TBL_IDX_HOST_CMD \
80 ((UMAC_HDI_ACT_TBL_IDX_RA_UMAC << UMAC_HDI_ACT_TBL_IDX_RA_POS) |\
81 (UMAC_HDI_ACT_TBL_IDX_TID_UMAC << UMAC_HDI_ACT_TBL_IDX_TID_POS))
82 #define UMAC_HDI_ACT_TBL_IDX_UMAC_CMD \
83 ((UMAC_HDI_ACT_TBL_IDX_RA_UMAC << UMAC_HDI_ACT_TBL_IDX_RA_POS) |\
84 (UMAC_HDI_ACT_TBL_IDX_TID_LMAC << UMAC_HDI_ACT_TBL_IDX_TID_POS))
86 /* STA ID and color */
87 #define STA_ID_SEED (0x0f)
88 #define STA_ID_POS (0)
89 #define STA_ID_MSK (STA_ID_SEED << STA_ID_POS)
91 #define STA_COLOR_SEED (0x7)
92 #define STA_COLOR_POS (4)
93 #define STA_COLOR_MSK (STA_COLOR_SEED << STA_COLOR_POS)
95 #define STA_ID_N_COLOR_COLOR(id_n_color) \
96 (((id_n_color) & STA_COLOR_MSK) >> STA_COLOR_POS)
97 #define STA_ID_N_COLOR_ID(id_n_color) \
98 (((id_n_color) & STA_ID_MSK) >> STA_ID_POS)
100 /* iwm_umac_notif_alive.page_grp_state Group number -- bits [3:0] */
101 #define UMAC_ALIVE_PAGE_STS_GRP_NUM_POS 0
102 #define UMAC_ALIVE_PAGE_STS_GRP_NUM_SEED 0xF
104 /* iwm_umac_notif_alive.page_grp_state Super group number -- bits [7:4] */
105 #define UMAC_ALIVE_PAGE_STS_SGRP_NUM_POS 4
106 #define UMAC_ALIVE_PAGE_STS_SGRP_NUM_SEED 0xF
108 /* iwm_umac_notif_alive.page_grp_state Group min size -- bits [15:8] */
109 #define UMAC_ALIVE_PAGE_STS_GRP_MIN_SIZE_POS 8
110 #define UMAC_ALIVE_PAGE_STS_GRP_MIN_SIZE_SEED 0xFF
112 /* iwm_umac_notif_alive.page_grp_state Group max size -- bits [23:16] */
113 #define UMAC_ALIVE_PAGE_STS_GRP_MAX_SIZE_POS 16
114 #define UMAC_ALIVE_PAGE_STS_GRP_MAX_SIZE_SEED 0xFF
116 /* iwm_umac_notif_alive.page_grp_state Super group max size -- bits [31:24] */
117 #define UMAC_ALIVE_PAGE_STS_SGRP_MAX_SIZE_POS 24
118 #define UMAC_ALIVE_PAGE_STS_SGRP_MAX_SIZE_SEED 0xFF
120 /* Barkers */
121 #define UMAC_REBOOT_BARKER 0xdeadbeef
122 #define UMAC_ACK_BARKER 0xfeedbabe
123 #define UMAC_PAD_TERMINAL 0xadadadad
125 /* UMAC JMP address */
126 #define UMAC_MU_FW_INST_DATA_12_ADDR 0xBF0000
128 /* iwm_umac_hdi_out_hdr.cmd OP code -- bits [3:0] */
129 #define UMAC_HDI_OUT_CMD_OPCODE_POS 0
130 #define UMAC_HDI_OUT_CMD_OPCODE_SEED 0xF
132 /* iwm_umac_hdi_out_hdr.cmd End-Of-Transfer -- bits [10:10] */
133 #define UMAC_HDI_OUT_CMD_EOT_POS 10
134 #define UMAC_HDI_OUT_CMD_EOT_SEED 0x1
136 /* iwm_umac_hdi_out_hdr.cmd UTFD only usage -- bits [11:11] */
137 #define UMAC_HDI_OUT_CMD_UTFD_ONLY_POS 11
138 #define UMAC_HDI_OUT_CMD_UTFD_ONLY_SEED 0x1
140 /* iwm_umac_hdi_out_hdr.cmd Non-WiFi HW sequence number -- bits [12:15] */
141 #define UDMA_HDI_OUT_CMD_NON_WIFI_HW_SEQ_NUM_POS 12
142 #define UDMA_HDI_OUT_CMD_NON_WIFI_HW_SEQ_NUM_SEED 0xF
144 /* iwm_umac_hdi_out_hdr.cmd Signature -- bits [31:16] */
145 #define UMAC_HDI_OUT_CMD_SIGNATURE_POS 16
146 #define UMAC_HDI_OUT_CMD_SIGNATURE_SEED 0xFFFF
148 /* iwm_umac_hdi_out_hdr.meta_data Byte count -- bits [11:0] */
149 #define UMAC_HDI_OUT_BYTE_COUNT_POS 0
150 #define UMAC_HDI_OUT_BYTE_COUNT_SEED 0xFFF
152 /* iwm_umac_hdi_out_hdr.meta_data Credit group -- bits [15:12] */
153 #define UMAC_HDI_OUT_CREDIT_GRP_POS 12
154 #define UMAC_HDI_OUT_CREDIT_GRP_SEED 0xF
156 /* iwm_umac_hdi_out_hdr.meta_data RA/TID -- bits [23:16] */
157 #define UMAC_HDI_OUT_RATID_POS 16
158 #define UMAC_HDI_OUT_RATID_SEED 0xFF
160 /* iwm_umac_hdi_out_hdr.meta_data LMAC offset -- bits [31:24] */
161 #define UMAC_HDI_OUT_LMAC_OFFSET_POS 24
162 #define UMAC_HDI_OUT_LMAC_OFFSET_SEED 0xFF
164 /* Signature */
165 #define UMAC_HDI_OUT_SIGNATURE 0xCBBC
167 /* buffer alignment */
168 #define UMAC_HDI_BUF_ALIGN_MSK 0xF
170 /* iwm_umac_hdi_in_hdr.cmd OP code -- bits [3:0] */
171 #define UMAC_HDI_IN_CMD_OPCODE_POS 0
172 #define UMAC_HDI_IN_CMD_OPCODE_SEED 0xF
174 /* iwm_umac_hdi_in_hdr.cmd Non-WiFi API response -- bits [6:4] */
175 #define UMAC_HDI_IN_CMD_NON_WIFI_RESP_POS 4
176 #define UMAC_HDI_IN_CMD_NON_WIFI_RESP_SEED 0x7
178 /* iwm_umac_hdi_in_hdr.cmd WiFi API source -- bits [5:4] */
179 #define UMAC_HDI_IN_CMD_SOURCE_POS 4
180 #define UMAC_HDI_IN_CMD_SOURCE_SEED 0x3
182 /* iwm_umac_hdi_in_hdr.cmd WiFi API EOT -- bits [6:6] */
183 #define UMAC_HDI_IN_CMD_EOT_POS 6
184 #define UMAC_HDI_IN_CMD_EOT_SEED 0x1
186 /* iwm_umac_hdi_in_hdr.cmd timestamp present -- bits [7:7] */
187 #define UMAC_HDI_IN_CMD_TIME_STAMP_PRESENT_POS 7
188 #define UMAC_HDI_IN_CMD_TIME_STAMP_PRESENT_SEED 0x1
190 /* iwm_umac_hdi_in_hdr.cmd WiFi Non-last AMSDU -- bits [8:8] */
191 #define UMAC_HDI_IN_CMD_NON_LAST_AMSDU_POS 8
192 #define UMAC_HDI_IN_CMD_NON_LAST_AMSDU_SEED 0x1
194 /* iwm_umac_hdi_in_hdr.cmd WiFi HW sequence number -- bits [31:9] */
195 #define UMAC_HDI_IN_CMD_HW_SEQ_NUM_POS 9
196 #define UMAC_HDI_IN_CMD_HW_SEQ_NUM_SEED 0x7FFFFF
198 /* iwm_umac_hdi_in_hdr.cmd Non-WiFi HW sequence number -- bits [12:15] */
199 #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SEQ_NUM_POS 12
200 #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SEQ_NUM_SEED 0xF
202 /* iwm_umac_hdi_in_hdr.cmd Non-WiFi HW signature -- bits [16:31] */
203 #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SIG_POS 16
204 #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SIG_SEED 0xFFFF
206 /* Fixed Non-WiFi signature */
207 #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SIG 0xCBBC
209 /* IN NTFY op-codes */
210 #define UMAC_NOTIFY_OPCODE_ALIVE 0xA1
211 #define UMAC_NOTIFY_OPCODE_INIT_COMPLETE 0xA2
212 #define UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS 0xA3
213 #define UMAC_NOTIFY_OPCODE_ERROR 0xA4
214 #define UMAC_NOTIFY_OPCODE_DEBUG 0xA5
215 #define UMAC_NOTIFY_OPCODE_WIFI_IF_WRAPPER 0xB0
216 #define UMAC_NOTIFY_OPCODE_STATS 0xB1
217 #define UMAC_NOTIFY_OPCODE_PAGE_DEALLOC 0xB3
218 #define UMAC_NOTIFY_OPCODE_RX_TICKET 0xB4
219 #define UMAC_NOTIFY_OPCODE_MAX (UMAC_NOTIFY_OPCODE_RX_TICKET -\
220 UMAC_NOTIFY_OPCODE_ALIVE + 1)
221 #define UMAC_NOTIFY_OPCODE_FIRST (UMAC_NOTIFY_OPCODE_ALIVE)
223 /* HDI OUT OP CODE */
224 #define UMAC_HDI_OUT_OPCODE_PING 0x0
225 #define UMAC_HDI_OUT_OPCODE_READ 0x1
226 #define UMAC_HDI_OUT_OPCODE_WRITE 0x2
227 #define UMAC_HDI_OUT_OPCODE_JUMP 0x3
228 #define UMAC_HDI_OUT_OPCODE_REBOOT 0x4
229 #define UMAC_HDI_OUT_OPCODE_WRITE_PERSISTENT 0x5
230 #define UMAC_HDI_OUT_OPCODE_READ_PERSISTENT 0x6
231 #define UMAC_HDI_OUT_OPCODE_READ_MODIFY_WRITE 0x7
232 /* #define UMAC_HDI_OUT_OPCODE_RESERVED 0x8..0xA */
233 #define UMAC_HDI_OUT_OPCODE_WRITE_AUX_REG 0xB
234 #define UMAC_HDI_OUT_OPCODE_WIFI 0xF
236 /* HDI IN OP CODE -- Non WiFi*/
237 #define UMAC_HDI_IN_OPCODE_PING 0x0
238 #define UMAC_HDI_IN_OPCODE_READ 0x1
239 #define UMAC_HDI_IN_OPCODE_WRITE 0x2
240 #define UMAC_HDI_IN_OPCODE_WRITE_PERSISTENT 0x5
241 #define UMAC_HDI_IN_OPCODE_READ_PERSISTENT 0x6
242 #define UMAC_HDI_IN_OPCODE_READ_MODIFY_WRITE 0x7
243 #define UMAC_HDI_IN_OPCODE_EP_MGMT 0x8
244 #define UMAC_HDI_IN_OPCODE_CREDIT_CHANGE 0x9
245 #define UMAC_HDI_IN_OPCODE_CTRL_DATABASE 0xA
246 #define UMAC_HDI_IN_OPCODE_WRITE_AUX_REG 0xB
247 #define UMAC_HDI_IN_OPCODE_NONWIFI_MAX \
248 (UMAC_HDI_IN_OPCODE_WRITE_AUX_REG + 1)
249 #define UMAC_HDI_IN_OPCODE_WIFI 0xF
251 /* HDI IN SOURCE */
252 #define UMAC_HDI_IN_SOURCE_FHRX 0x0
253 #define UMAC_HDI_IN_SOURCE_UDMA 0x1
254 #define UMAC_HDI_IN_SOURCE_FW 0x2
255 #define UMAC_HDI_IN_SOURCE_RESERVED 0x3
257 /* OUT CMD op-codes */
258 #define UMAC_CMD_OPCODE_ECHO 0x01
259 #define UMAC_CMD_OPCODE_HALT 0x02
260 #define UMAC_CMD_OPCODE_RESET 0x03
261 #define UMAC_CMD_OPCODE_BULK_EP_INACT_TIMEOUT 0x09
262 #define UMAC_CMD_OPCODE_URB_CANCEL_ACK 0x0A
263 #define UMAC_CMD_OPCODE_DCACHE_FLUSH 0x0B
264 #define UMAC_CMD_OPCODE_EEPROM_PROXY 0x0C
265 #define UMAC_CMD_OPCODE_TX_ECHO 0x0D
266 #define UMAC_CMD_OPCODE_DBG_MON 0x0E
267 #define UMAC_CMD_OPCODE_INTERNAL_TX 0x0F
268 #define UMAC_CMD_OPCODE_SET_PARAM_FIX 0x10
269 #define UMAC_CMD_OPCODE_SET_PARAM_VAR 0x11
270 #define UMAC_CMD_OPCODE_GET_PARAM 0x12
271 #define UMAC_CMD_OPCODE_DBG_EVENT_WRAPPER 0x13
272 #define UMAC_CMD_OPCODE_TARGET 0x14
273 #define UMAC_CMD_OPCODE_STATISTIC_REQUEST 0x15
274 #define UMAC_CMD_OPCODE_GET_CHAN_INFO_LIST 0x16
275 #define UMAC_CMD_OPCODE_SET_PARAM_LIST 0x17
276 #define UMAC_CMD_OPCODE_GET_PARAM_LIST 0x18
277 #define UMAC_CMD_OPCODE_STOP_RESUME_STA_TX 0x19
278 #define UMAC_CMD_OPCODE_TEST_BLOCK_ACK 0x1A
280 #define UMAC_CMD_OPCODE_BASE_WRAPPER 0xFA
281 #define UMAC_CMD_OPCODE_LMAC_WRAPPER 0xFB
282 #define UMAC_CMD_OPCODE_HW_TEST_WRAPPER 0xFC
283 #define UMAC_CMD_OPCODE_WIFI_IF_WRAPPER 0xFD
284 #define UMAC_CMD_OPCODE_WIFI_WRAPPER 0xFE
285 #define UMAC_CMD_OPCODE_WIFI_PASS_THROUGH 0xFF
287 /* UMAC WiFi interface op-codes */
288 #define UMAC_WIFI_IF_CMD_SET_PROFILE 0x11
289 #define UMAC_WIFI_IF_CMD_INVALIDATE_PROFILE 0x12
290 #define UMAC_WIFI_IF_CMD_SET_EXCLUDE_LIST 0x13
291 #define UMAC_WIFI_IF_CMD_SCAN_REQUEST 0x14
292 #define UMAC_WIFI_IF_CMD_SCAN_CONFIG 0x15
293 #define UMAC_WIFI_IF_CMD_ADD_WEP40_KEY 0x16
294 #define UMAC_WIFI_IF_CMD_ADD_WEP104_KEY 0x17
295 #define UMAC_WIFI_IF_CMD_ADD_TKIP_KEY 0x18
296 #define UMAC_WIFI_IF_CMD_ADD_CCMP_KEY 0x19
297 #define UMAC_WIFI_IF_CMD_REMOVE_KEY 0x1A
298 #define UMAC_WIFI_IF_CMD_GLOBAL_TX_KEY_ID 0x1B
299 #define UMAC_WIFI_IF_CMD_SET_HOST_EXTENDED_IE 0x1C
300 #define UMAC_WIFI_IF_CMD_GET_SUPPORTED_CHANNELS 0x1E
301 #define UMAC_WIFI_IF_CMD_PMKID_UPDATE 0x1F
302 #define UMAC_WIFI_IF_CMD_TX_PWR_TRIGGER 0x20
304 /* UMAC WiFi interface ports */
305 #define UMAC_WIFI_IF_FLG_PORT_DEF 0x00
306 #define UMAC_WIFI_IF_FLG_PORT_PAN 0x01
307 #define UMAC_WIFI_IF_FLG_PORT_PAN_INVALID WIFI_IF_FLG_PORT_DEF
309 /* UMAC WiFi interface actions */
310 #define UMAC_WIFI_IF_FLG_ACT_GET 0x10
311 #define UMAC_WIFI_IF_FLG_ACT_SET 0x20
313 /* iwm_umac_fw_cmd_hdr.meta_data byte count -- bits [11:0] */
314 #define UMAC_FW_CMD_BYTE_COUNT_POS 0
315 #define UMAC_FW_CMD_BYTE_COUNT_SEED 0xFFF
317 /* iwm_umac_fw_cmd_hdr.meta_data status -- bits [15:12] */
318 #define UMAC_FW_CMD_STATUS_POS 12
319 #define UMAC_FW_CMD_STATUS_SEED 0xF
321 /* iwm_umac_fw_cmd_hdr.meta_data full TX command by Driver -- bits [16:16] */
322 #define UMAC_FW_CMD_TX_DRV_FULL_CMD_POS 16
323 #define UMAC_FW_CMD_TX_DRV_FULL_CMD_SEED 0x1
325 /* iwm_umac_fw_cmd_hdr.meta_data TX command by FW -- bits [17:17] */
326 #define UMAC_FW_CMD_TX_FW_CMD_POS 17
327 #define UMAC_FW_CMD_TX_FW_CMD_SEED 0x1
329 /* iwm_umac_fw_cmd_hdr.meta_data TX plaintext mode -- bits [18:18] */
330 #define UMAC_FW_CMD_TX_PLAINTEXT_POS 18
331 #define UMAC_FW_CMD_TX_PLAINTEXT_SEED 0x1
333 /* iwm_umac_fw_cmd_hdr.meta_data STA color -- bits [22:20] */
334 #define UMAC_FW_CMD_TX_STA_COLOR_POS 20
335 #define UMAC_FW_CMD_TX_STA_COLOR_SEED 0x7
337 /* iwm_umac_fw_cmd_hdr.meta_data TX life time (TU) -- bits [31:24] */
338 #define UMAC_FW_CMD_TX_LIFETIME_TU_POS 24
339 #define UMAC_FW_CMD_TX_LIFETIME_TU_SEED 0xFF
341 /* iwm_dev_cmd_hdr.flags Response required -- bits [5:5] */
342 #define UMAC_DEV_CMD_FLAGS_RESP_REQ_POS 5
343 #define UMAC_DEV_CMD_FLAGS_RESP_REQ_SEED 0x1
345 /* iwm_dev_cmd_hdr.flags Aborted command -- bits [6:6] */
346 #define UMAC_DEV_CMD_FLAGS_ABORT_POS 6
347 #define UMAC_DEV_CMD_FLAGS_ABORT_SEED 0x1
349 /* iwm_dev_cmd_hdr.flags Internal command -- bits [7:7] */
350 #define DEV_CMD_FLAGS_FLD_INTERNAL_POS 7
351 #define DEV_CMD_FLAGS_FLD_INTERNAL_SEED 0x1
353 /* Rx */
354 /* Rx actions */
355 #define IWM_RX_TICKET_DROP 0x0
356 #define IWM_RX_TICKET_RELEASE 0x1
357 #define IWM_RX_TICKET_SNIFFER 0x2
358 #define IWM_RX_TICKET_ENQUEUE 0x3
360 /* Rx flags */
361 #define IWM_RX_TICKET_PAD_SIZE_MSK 0x2
362 #define IWM_RX_TICKET_SPECIAL_SNAP_MSK 0x4
363 #define IWM_RX_TICKET_AMSDU_MSK 0x8
364 #define IWM_RX_TICKET_DROP_REASON_POS 4
365 #define IWM_RX_TICKET_DROP_REASON_MSK (0x1F << IWM_RX_TICKET_DROP_REASON_POS)
367 #define IWM_RX_DROP_NO_DROP 0x0
368 #define IWM_RX_DROP_BAD_CRC 0x1
369 /* L2P no address match */
370 #define IWM_RX_DROP_LMAC_ADDR_FILTER 0x2
371 /* Multicast address not in list */
372 #define IWM_RX_DROP_MCAST_ADDR_FILTER 0x3
373 /* Control frames are not sent to the driver */
374 #define IWM_RX_DROP_CTL_FRAME 0x4
375 /* Our frame is back */
376 #define IWM_RX_DROP_OUR_TX 0x5
377 /* Association class filtering */
378 #define IWM_RX_DROP_CLASS_FILTER 0x6
379 /* Duplicated frame */
380 #define IWM_RX_DROP_DUPLICATE_FILTER 0x7
381 /* Decryption error */
382 #define IWM_RX_DROP_SEC_ERR 0x8
383 /* Unencrypted frame while encryption is on */
384 #define IWM_RX_DROP_SEC_NO_ENCRYPTION 0x9
385 /* Replay check failure */
386 #define IWM_RX_DROP_SEC_REPLAY_ERR 0xa
387 /* uCode and FW key color mismatch, check before replay */
388 #define IWM_RX_DROP_SEC_KEY_COLOR_MISMATCH 0xb
389 #define IWM_RX_DROP_SEC_TKIP_COUNTER_MEASURE 0xc
390 /* No fragmentations Db is found */
391 #define IWM_RX_DROP_FRAG_NO_RESOURCE 0xd
392 /* Fragmention Db has seqCtl mismatch Vs. non-1st frag */
393 #define IWM_RX_DROP_FRAG_ERR 0xe
394 #define IWM_RX_DROP_FRAG_LOST 0xf
395 #define IWM_RX_DROP_FRAG_COMPLETE 0x10
396 /* Should be handled by UMAC */
397 #define IWM_RX_DROP_MANAGEMENT 0x11
398 /* STA not found by UMAC */
399 #define IWM_RX_DROP_NO_STATION 0x12
400 /* NULL or QoS NULL */
401 #define IWM_RX_DROP_NULL_DATA 0x13
402 #define IWM_RX_DROP_BA_REORDER_OLD_SEQCTL 0x14
403 #define IWM_RX_DROP_BA_REORDER_DUPLICATE 0x15
405 struct iwm_rx_ticket {
406 __le16 action;
407 __le16 id;
408 __le16 flags;
409 u8 payload_offset; /* includes: MAC header, pad, IV */
410 u8 tail_len; /* includes: MIC, ICV, CRC (w/o STATUS) */
411 } __packed;
413 struct iwm_rx_mpdu_hdr {
414 __le16 len;
415 __le16 reserved;
416 } __packed;
418 /* UMAC SW WIFI API */
420 struct iwm_dev_cmd_hdr {
421 u8 cmd;
422 u8 flags;
423 __le16 seq_num;
424 } __packed;
426 struct iwm_umac_fw_cmd_hdr {
427 __le32 meta_data;
428 struct iwm_dev_cmd_hdr cmd;
429 } __packed;
431 struct iwm_umac_wifi_out_hdr {
432 struct iwm_udma_out_wifi_hdr hw_hdr;
433 struct iwm_umac_fw_cmd_hdr sw_hdr;
434 } __packed;
436 struct iwm_umac_nonwifi_out_hdr {
437 struct iwm_udma_out_nonwifi_hdr hw_hdr;
438 } __packed;
440 struct iwm_umac_wifi_in_hdr {
441 struct iwm_udma_in_hdr hw_hdr;
442 struct iwm_umac_fw_cmd_hdr sw_hdr;
443 } __packed;
445 struct iwm_umac_nonwifi_in_hdr {
446 struct iwm_udma_in_hdr hw_hdr;
447 __le32 time_stamp;
448 } __packed;
450 #define IWM_UMAC_PAGE_SIZE 0x200
452 /* Notify structures */
453 struct iwm_fw_version {
454 u8 minor;
455 u8 major;
456 __le16 id;
459 struct iwm_fw_build {
460 u8 type;
461 u8 subtype;
462 u8 platform;
463 u8 opt;
466 struct iwm_fw_alive_hdr {
467 struct iwm_fw_version ver;
468 struct iwm_fw_build build;
469 __le32 os_build;
470 __le32 log_hdr_addr;
471 __le32 log_buf_addr;
472 __le32 sys_timer_addr;
475 #define WAIT_NOTIF_TIMEOUT (2 * HZ)
476 #define SCAN_COMPLETE_TIMEOUT (3 * HZ)
478 #define UMAC_NTFY_ALIVE_STATUS_ERR 0xDEAD
479 #define UMAC_NTFY_ALIVE_STATUS_OK 0xCAFE
481 #define UMAC_NTFY_INIT_COMPLETE_STATUS_ERR 0xDEAD
482 #define UMAC_NTFY_INIT_COMPLETE_STATUS_OK 0xCAFE
484 #define UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN 0x40
485 #define UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN 0x80
487 #define IWM_MACS_OUT_GROUPS 6
488 #define IWM_MACS_OUT_SGROUPS 1
491 #define WIFI_IF_NTFY_ASSOC_START 0x80
492 #define WIFI_IF_NTFY_ASSOC_COMPLETE 0x81
493 #define WIFI_IF_NTFY_PROFILE_INVALIDATE_COMPLETE 0x82
494 #define WIFI_IF_NTFY_CONNECTION_TERMINATED 0x83
495 #define WIFI_IF_NTFY_SCAN_COMPLETE 0x84
496 #define WIFI_IF_NTFY_STA_TABLE_CHANGE 0x85
497 #define WIFI_IF_NTFY_EXTENDED_IE_REQUIRED 0x86
498 #define WIFI_IF_NTFY_RADIO_PREEMPTION 0x87
499 #define WIFI_IF_NTFY_BSS_TRK_TABLE_CHANGED 0x88
500 #define WIFI_IF_NTFY_BSS_TRK_ENTRIES_REMOVED 0x89
501 #define WIFI_IF_NTFY_LINK_QUALITY_STATISTICS 0x8A
502 #define WIFI_IF_NTFY_MGMT_FRAME 0x8B
504 /* DEBUG INDICATIONS */
505 #define WIFI_DBG_IF_NTFY_SCAN_SUPER_JOB_START 0xE0
506 #define WIFI_DBG_IF_NTFY_SCAN_SUPER_JOB_COMPLETE 0xE1
507 #define WIFI_DBG_IF_NTFY_SCAN_CHANNEL_START 0xE2
508 #define WIFI_DBG_IF_NTFY_SCAN_CHANNEL_RESULT 0xE3
509 #define WIFI_DBG_IF_NTFY_SCAN_MINI_JOB_START 0xE4
510 #define WIFI_DBG_IF_NTFY_SCAN_MINI_JOB_COMPLETE 0xE5
511 #define WIFI_DBG_IF_NTFY_CNCT_ATC_START 0xE6
512 #define WIFI_DBG_IF_NTFY_COEX_NOTIFICATION 0xE7
513 #define WIFI_DBG_IF_NTFY_COEX_HANDLE_ENVELOP 0xE8
514 #define WIFI_DBG_IF_NTFY_COEX_HANDLE_RELEASE_ENVELOP 0xE9
516 #define WIFI_IF_NTFY_MAX 0xff
518 /* Notification structures */
519 struct iwm_umac_notif_wifi_if {
520 struct iwm_umac_wifi_in_hdr hdr;
521 u8 status;
522 u8 flags;
523 __le16 buf_size;
524 } __packed;
526 #define UMAC_ROAM_REASON_FIRST_SELECTION 0x1
527 #define UMAC_ROAM_REASON_AP_DEAUTH 0x2
528 #define UMAC_ROAM_REASON_AP_CONNECT_LOST 0x3
529 #define UMAC_ROAM_REASON_RSSI 0x4
530 #define UMAC_ROAM_REASON_AP_ASSISTED_ROAM 0x5
531 #define UMAC_ROAM_REASON_IBSS_COALESCING 0x6
533 struct iwm_umac_notif_assoc_start {
534 struct iwm_umac_notif_wifi_if mlme_hdr;
535 __le32 roam_reason;
536 u8 bssid[ETH_ALEN];
537 u8 reserved[2];
538 } __packed;
540 #define UMAC_ASSOC_COMPLETE_SUCCESS 0x0
541 #define UMAC_ASSOC_COMPLETE_FAILURE 0x1
543 struct iwm_umac_notif_assoc_complete {
544 struct iwm_umac_notif_wifi_if mlme_hdr;
545 __le32 status;
546 u8 bssid[ETH_ALEN];
547 u8 band;
548 u8 channel;
549 } __packed;
551 #define UMAC_PROFILE_INVALID_ASSOC_TIMEOUT 0x0
552 #define UMAC_PROFILE_INVALID_ROAM_TIMEOUT 0x1
553 #define UMAC_PROFILE_INVALID_REQUEST 0x2
554 #define UMAC_PROFILE_INVALID_RF_PREEMPTED 0x3
556 struct iwm_umac_notif_profile_invalidate {
557 struct iwm_umac_notif_wifi_if mlme_hdr;
558 __le32 reason;
559 } __packed;
561 #define UMAC_SCAN_RESULT_SUCCESS 0x0
562 #define UMAC_SCAN_RESULT_ABORTED 0x1
563 #define UMAC_SCAN_RESULT_REJECTED 0x2
564 #define UMAC_SCAN_RESULT_FAILED 0x3
566 struct iwm_umac_notif_scan_complete {
567 struct iwm_umac_notif_wifi_if mlme_hdr;
568 __le32 type;
569 __le32 result;
570 u8 seq_num;
571 } __packed;
573 #define UMAC_OPCODE_ADD_MODIFY 0x0
574 #define UMAC_OPCODE_REMOVE 0x1
575 #define UMAC_OPCODE_CLEAR_ALL 0x2
577 #define UMAC_STA_FLAG_QOS 0x1
579 struct iwm_umac_notif_sta_info {
580 struct iwm_umac_notif_wifi_if mlme_hdr;
581 __le32 opcode;
582 u8 mac_addr[ETH_ALEN];
583 u8 sta_id; /* bits 0-3: station ID, bits 4-7: station color */
584 u8 flags;
585 } __packed;
587 #define UMAC_BAND_2GHZ 0
588 #define UMAC_BAND_5GHZ 1
590 #define UMAC_CHANNEL_WIDTH_20MHZ 0
591 #define UMAC_CHANNEL_WIDTH_40MHZ 1
593 struct iwm_umac_notif_bss_info {
594 struct iwm_umac_notif_wifi_if mlme_hdr;
595 __le32 type;
596 __le32 timestamp;
597 __le16 table_idx;
598 __le16 frame_len;
599 u8 band;
600 u8 channel;
601 s8 rssi;
602 u8 reserved;
603 u8 frame_buf[1];
604 } __packed;
606 #define IWM_BSS_REMOVE_INDEX_MSK 0x0fff
607 #define IWM_BSS_REMOVE_FLAGS_MSK 0xfc00
609 #define IWM_BSS_REMOVE_FLG_AGE 0x1000
610 #define IWM_BSS_REMOVE_FLG_TIMEOUT 0x2000
611 #define IWM_BSS_REMOVE_FLG_TABLE_FULL 0x4000
613 struct iwm_umac_notif_bss_removed {
614 struct iwm_umac_notif_wifi_if mlme_hdr;
615 __le32 count;
616 __le16 entries[0];
617 } __packed;
619 struct iwm_umac_notif_mgt_frame {
620 struct iwm_umac_notif_wifi_if mlme_hdr;
621 __le16 len;
622 u8 frame[1];
623 } __packed;
625 struct iwm_umac_notif_alive {
626 struct iwm_umac_wifi_in_hdr hdr;
627 __le16 status;
628 __le16 reserved1;
629 struct iwm_fw_alive_hdr alive_data;
630 __le16 reserved2;
631 __le16 page_grp_count;
632 __le32 page_grp_state[IWM_MACS_OUT_GROUPS];
633 } __packed;
635 struct iwm_umac_notif_init_complete {
636 struct iwm_umac_wifi_in_hdr hdr;
637 __le16 status;
638 __le16 reserved;
639 } __packed;
641 /* error categories */
642 enum {
643 UMAC_SYS_ERR_CAT_NONE = 0,
644 UMAC_SYS_ERR_CAT_BOOT,
645 UMAC_SYS_ERR_CAT_UMAC,
646 UMAC_SYS_ERR_CAT_UAXM,
647 UMAC_SYS_ERR_CAT_LMAC,
648 UMAC_SYS_ERR_CAT_MAX
651 struct iwm_fw_error_hdr {
652 __le32 category;
653 __le32 status;
654 __le32 pc;
655 __le32 blink1;
656 __le32 blink2;
657 __le32 ilink1;
658 __le32 ilink2;
659 __le32 data1;
660 __le32 data2;
661 __le32 line_num;
662 __le32 umac_status;
663 __le32 lmac_status;
664 __le32 sdio_status;
665 __le32 dbm_sample_ctrl;
666 __le32 dbm_buf_base;
667 __le32 dbm_buf_end;
668 __le32 dbm_buf_write_ptr;
669 __le32 dbm_buf_cycle_cnt;
670 } __packed;
672 struct iwm_umac_notif_error {
673 struct iwm_umac_wifi_in_hdr hdr;
674 struct iwm_fw_error_hdr err;
675 } __packed;
677 #define UMAC_DEALLOC_NTFY_CHANGES_CNT_POS 0
678 #define UMAC_DEALLOC_NTFY_CHANGES_CNT_SEED 0xff
679 #define UMAC_DEALLOC_NTFY_CHANGES_MSK_POS 8
680 #define UMAC_DEALLOC_NTFY_CHANGES_MSK_SEED 0xffffff
681 #define UMAC_DEALLOC_NTFY_PAGE_CNT_POS 0
682 #define UMAC_DEALLOC_NTFY_PAGE_CNT_SEED 0xffffff
683 #define UMAC_DEALLOC_NTFY_GROUP_NUM_POS 24
684 #define UMAC_DEALLOC_NTFY_GROUP_NUM_SEED 0xf
686 struct iwm_umac_notif_page_dealloc {
687 struct iwm_umac_wifi_in_hdr hdr;
688 __le32 changes;
689 __le32 grp_info[IWM_MACS_OUT_GROUPS];
690 } __packed;
692 struct iwm_umac_notif_wifi_status {
693 struct iwm_umac_wifi_in_hdr hdr;
694 __le16 status;
695 __le16 reserved;
696 } __packed;
698 struct iwm_umac_notif_rx_ticket {
699 struct iwm_umac_wifi_in_hdr hdr;
700 u8 num_tickets;
701 u8 reserved[3];
702 struct iwm_rx_ticket tickets[1];
703 } __packed;
705 /* Tx/Rx rates window (number of max of last update window per second) */
706 #define UMAC_NTF_RATE_SAMPLE_NR 4
708 /* Max numbers of bits required to go through all antennae in bitmasks */
709 #define UMAC_PHY_NUM_CHAINS 3
711 #define IWM_UMAC_MGMT_TID 8
712 #define IWM_UMAC_TID_NR 9 /* 8 TIDs + MGMT */
714 struct iwm_umac_notif_stats {
715 struct iwm_umac_wifi_in_hdr hdr;
716 __le32 flags;
717 __le32 timestamp;
718 __le16 tid_load[IWM_UMAC_TID_NR + 1]; /* 1 non-QoS + 1 dword align */
719 __le16 tx_rate[UMAC_NTF_RATE_SAMPLE_NR];
720 __le16 rx_rate[UMAC_NTF_RATE_SAMPLE_NR];
721 __le32 chain_energy[UMAC_PHY_NUM_CHAINS];
722 s32 rssi_dbm;
723 s32 noise_dbm;
724 __le32 supp_rates;
725 __le32 supp_ht_rates;
726 __le32 missed_beacons;
727 __le32 rx_beacons;
728 __le32 rx_dir_pkts;
729 __le32 rx_nondir_pkts;
730 __le32 rx_multicast;
731 __le32 rx_errors;
732 __le32 rx_drop_other_bssid;
733 __le32 rx_drop_decode;
734 __le32 rx_drop_reassembly;
735 __le32 rx_drop_bad_len;
736 __le32 rx_drop_overflow;
737 __le32 rx_drop_crc;
738 __le32 rx_drop_missed;
739 __le32 tx_dir_pkts;
740 __le32 tx_nondir_pkts;
741 __le32 tx_failure;
742 __le32 tx_errors;
743 __le32 tx_drop_max_retry;
744 __le32 tx_err_abort;
745 __le32 tx_err_carrier;
746 __le32 rx_bytes;
747 __le32 tx_bytes;
748 __le32 tx_power;
749 __le32 tx_max_power;
750 __le32 roam_threshold;
751 __le32 ap_assoc_nr;
752 __le32 scan_full;
753 __le32 scan_abort;
754 __le32 ap_nr;
755 __le32 roam_nr;
756 __le32 roam_missed_beacons;
757 __le32 roam_rssi;
758 __le32 roam_unassoc;
759 __le32 roam_deauth;
760 __le32 roam_ap_loadblance;
761 } __packed;
763 #define UMAC_STOP_TX_FLAG 0x1
764 #define UMAC_RESUME_TX_FLAG 0x2
766 #define LAST_SEQ_NUM_INVALID 0xFFFF
768 struct iwm_umac_notif_stop_resume_tx {
769 struct iwm_umac_wifi_in_hdr hdr;
770 u8 flags; /* UMAC_*_TX_FLAG_* */
771 u8 sta_id;
772 __le16 stop_resume_tid_msk; /* tid bitmask */
773 } __packed;
775 #define UMAC_MAX_NUM_PMKIDS 4
777 /* WiFi interface wrapper header */
778 struct iwm_umac_wifi_if {
779 u8 oid;
780 u8 flags;
781 __le16 buf_size;
782 } __packed;
784 #define IWM_SEQ_NUM_HOST_MSK 0x0000
785 #define IWM_SEQ_NUM_UMAC_MSK 0x4000
786 #define IWM_SEQ_NUM_LMAC_MSK 0x8000
787 #define IWM_SEQ_NUM_MSK 0xC000
789 #endif