Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Intel Wireless Multicomm 3200 WiFi driver |
| 3 | * |
| 4 | * Copyright (C) 2009 Intel Corporation. All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * |
| 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. |
| 19 | * |
| 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. |
| 31 | * |
| 32 | * |
| 33 | * Intel Corporation <ilw@linux.intel.com> |
| 34 | * Samuel Ortiz <samuel.ortiz@intel.com> |
| 35 | * Zhu Yi <yi.zhu@intel.com> |
| 36 | * |
| 37 | */ |
| 38 | |
| 39 | #ifndef __IWM_UMAC_H__ |
| 40 | #define __IWM_UMAC_H__ |
| 41 | |
| 42 | struct iwm_udma_in_hdr { |
| 43 | __le32 cmd; |
| 44 | __le32 size; |
| 45 | } __attribute__ ((packed)); |
| 46 | |
| 47 | struct iwm_udma_out_nonwifi_hdr { |
| 48 | __le32 cmd; |
| 49 | __le32 addr; |
| 50 | __le32 op1_sz; |
| 51 | __le32 op2; |
| 52 | } __attribute__ ((packed)); |
| 53 | |
| 54 | struct iwm_udma_out_wifi_hdr { |
| 55 | __le32 cmd; |
| 56 | __le32 meta_data; |
| 57 | } __attribute__ ((packed)); |
| 58 | |
| 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 |
| 64 | |
| 65 | /* MAC address address */ |
| 66 | #define WICO_MAC_ADDRESS_ADDR 0x604008F8 |
| 67 | |
| 68 | /* RA / TID */ |
| 69 | #define UMAC_HDI_ACT_TBL_IDX_TID_POS 0 |
| 70 | #define UMAC_HDI_ACT_TBL_IDX_TID_SEED 0xF |
| 71 | |
| 72 | #define UMAC_HDI_ACT_TBL_IDX_RA_POS 4 |
| 73 | #define UMAC_HDI_ACT_TBL_IDX_RA_SEED 0xF |
| 74 | |
| 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 |
| 78 | |
| 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)) |
| 85 | |
| 86 | /* iwm_umac_notif_alive.page_grp_state Group number -- bits [3:0] */ |
| 87 | #define UMAC_ALIVE_PAGE_STS_GRP_NUM_POS 0 |
| 88 | #define UMAC_ALIVE_PAGE_STS_GRP_NUM_SEED 0xF |
| 89 | |
| 90 | /* iwm_umac_notif_alive.page_grp_state Super group number -- bits [7:4] */ |
| 91 | #define UMAC_ALIVE_PAGE_STS_SGRP_NUM_POS 4 |
| 92 | #define UMAC_ALIVE_PAGE_STS_SGRP_NUM_SEED 0xF |
| 93 | |
| 94 | /* iwm_umac_notif_alive.page_grp_state Group min size -- bits [15:8] */ |
| 95 | #define UMAC_ALIVE_PAGE_STS_GRP_MIN_SIZE_POS 8 |
| 96 | #define UMAC_ALIVE_PAGE_STS_GRP_MIN_SIZE_SEED 0xFF |
| 97 | |
| 98 | /* iwm_umac_notif_alive.page_grp_state Group max size -- bits [23:16] */ |
| 99 | #define UMAC_ALIVE_PAGE_STS_GRP_MAX_SIZE_POS 16 |
| 100 | #define UMAC_ALIVE_PAGE_STS_GRP_MAX_SIZE_SEED 0xFF |
| 101 | |
| 102 | /* iwm_umac_notif_alive.page_grp_state Super group max size -- bits [31:24] */ |
| 103 | #define UMAC_ALIVE_PAGE_STS_SGRP_MAX_SIZE_POS 24 |
| 104 | #define UMAC_ALIVE_PAGE_STS_SGRP_MAX_SIZE_SEED 0xFF |
| 105 | |
| 106 | /* Barkers */ |
| 107 | #define UMAC_REBOOT_BARKER 0xdeadbeef |
| 108 | #define UMAC_ACK_BARKER 0xfeedbabe |
| 109 | #define UMAC_PAD_TERMINAL 0xadadadad |
| 110 | |
| 111 | /* UMAC JMP address */ |
| 112 | #define UMAC_MU_FW_INST_DATA_12_ADDR 0xBF0000 |
| 113 | |
| 114 | /* iwm_umac_hdi_out_hdr.cmd OP code -- bits [3:0] */ |
| 115 | #define UMAC_HDI_OUT_CMD_OPCODE_POS 0 |
| 116 | #define UMAC_HDI_OUT_CMD_OPCODE_SEED 0xF |
| 117 | |
| 118 | /* iwm_umac_hdi_out_hdr.cmd End-Of-Transfer -- bits [10:10] */ |
| 119 | #define UMAC_HDI_OUT_CMD_EOT_POS 10 |
| 120 | #define UMAC_HDI_OUT_CMD_EOT_SEED 0x1 |
| 121 | |
| 122 | /* iwm_umac_hdi_out_hdr.cmd UTFD only usage -- bits [11:11] */ |
| 123 | #define UMAC_HDI_OUT_CMD_UTFD_ONLY_POS 11 |
| 124 | #define UMAC_HDI_OUT_CMD_UTFD_ONLY_SEED 0x1 |
| 125 | |
| 126 | /* iwm_umac_hdi_out_hdr.cmd Non-WiFi HW sequence number -- bits [12:15] */ |
| 127 | #define UDMA_HDI_OUT_CMD_NON_WIFI_HW_SEQ_NUM_POS 12 |
| 128 | #define UDMA_HDI_OUT_CMD_NON_WIFI_HW_SEQ_NUM_SEED 0xF |
| 129 | |
| 130 | /* iwm_umac_hdi_out_hdr.cmd Signature -- bits [31:16] */ |
| 131 | #define UMAC_HDI_OUT_CMD_SIGNATURE_POS 16 |
| 132 | #define UMAC_HDI_OUT_CMD_SIGNATURE_SEED 0xFFFF |
| 133 | |
| 134 | /* iwm_umac_hdi_out_hdr.meta_data Byte count -- bits [11:0] */ |
| 135 | #define UMAC_HDI_OUT_BYTE_COUNT_POS 0 |
| 136 | #define UMAC_HDI_OUT_BYTE_COUNT_SEED 0xFFF |
| 137 | |
| 138 | /* iwm_umac_hdi_out_hdr.meta_data Credit group -- bits [15:12] */ |
| 139 | #define UMAC_HDI_OUT_CREDIT_GRP_POS 12 |
| 140 | #define UMAC_HDI_OUT_CREDIT_GRP_SEED 0xF |
| 141 | |
| 142 | /* iwm_umac_hdi_out_hdr.meta_data RA/TID -- bits [23:16] */ |
| 143 | #define UMAC_HDI_OUT_RATID_POS 16 |
| 144 | #define UMAC_HDI_OUT_RATID_SEED 0xFF |
| 145 | |
| 146 | /* iwm_umac_hdi_out_hdr.meta_data LMAC offset -- bits [31:24] */ |
| 147 | #define UMAC_HDI_OUT_LMAC_OFFSET_POS 24 |
| 148 | #define UMAC_HDI_OUT_LMAC_OFFSET_SEED 0xFF |
| 149 | |
| 150 | /* Signature */ |
| 151 | #define UMAC_HDI_OUT_SIGNATURE 0xCBBC |
| 152 | |
| 153 | /* buffer alignment */ |
| 154 | #define UMAC_HDI_BUF_ALIGN_MSK 0xF |
| 155 | |
| 156 | /* iwm_umac_hdi_in_hdr.cmd OP code -- bits [3:0] */ |
| 157 | #define UMAC_HDI_IN_CMD_OPCODE_POS 0 |
| 158 | #define UMAC_HDI_IN_CMD_OPCODE_SEED 0xF |
| 159 | |
| 160 | /* iwm_umac_hdi_in_hdr.cmd Non-WiFi API response -- bits [6:4] */ |
| 161 | #define UMAC_HDI_IN_CMD_NON_WIFI_RESP_POS 4 |
| 162 | #define UMAC_HDI_IN_CMD_NON_WIFI_RESP_SEED 0x7 |
| 163 | |
| 164 | /* iwm_umac_hdi_in_hdr.cmd WiFi API source -- bits [5:4] */ |
| 165 | #define UMAC_HDI_IN_CMD_SOURCE_POS 4 |
| 166 | #define UMAC_HDI_IN_CMD_SOURCE_SEED 0x3 |
| 167 | |
| 168 | /* iwm_umac_hdi_in_hdr.cmd WiFi API EOT -- bits [6:6] */ |
| 169 | #define UMAC_HDI_IN_CMD_EOT_POS 6 |
| 170 | #define UMAC_HDI_IN_CMD_EOT_SEED 0x1 |
| 171 | |
| 172 | /* iwm_umac_hdi_in_hdr.cmd timestamp present -- bits [7:7] */ |
| 173 | #define UMAC_HDI_IN_CMD_TIME_STAMP_PRESENT_POS 7 |
| 174 | #define UMAC_HDI_IN_CMD_TIME_STAMP_PRESENT_SEED 0x1 |
| 175 | |
| 176 | /* iwm_umac_hdi_in_hdr.cmd WiFi Non-last AMSDU -- bits [8:8] */ |
| 177 | #define UMAC_HDI_IN_CMD_NON_LAST_AMSDU_POS 8 |
| 178 | #define UMAC_HDI_IN_CMD_NON_LAST_AMSDU_SEED 0x1 |
| 179 | |
| 180 | /* iwm_umac_hdi_in_hdr.cmd WiFi HW sequence number -- bits [31:9] */ |
| 181 | #define UMAC_HDI_IN_CMD_HW_SEQ_NUM_POS 9 |
| 182 | #define UMAC_HDI_IN_CMD_HW_SEQ_NUM_SEED 0x7FFFFF |
| 183 | |
| 184 | /* iwm_umac_hdi_in_hdr.cmd Non-WiFi HW sequence number -- bits [12:15] */ |
| 185 | #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SEQ_NUM_POS 12 |
| 186 | #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SEQ_NUM_SEED 0xF |
| 187 | |
| 188 | /* iwm_umac_hdi_in_hdr.cmd Non-WiFi HW signature -- bits [16:31] */ |
| 189 | #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SIG_POS 16 |
| 190 | #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SIG_SEED 0xFFFF |
| 191 | |
| 192 | /* Fixed Non-WiFi signature */ |
| 193 | #define UDMA_HDI_IN_CMD_NON_WIFI_HW_SIG 0xCBBC |
| 194 | |
| 195 | /* IN NTFY op-codes */ |
| 196 | #define UMAC_NOTIFY_OPCODE_ALIVE 0xA1 |
| 197 | #define UMAC_NOTIFY_OPCODE_INIT_COMPLETE 0xA2 |
| 198 | #define UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS 0xA3 |
| 199 | #define UMAC_NOTIFY_OPCODE_ERROR 0xA4 |
| 200 | #define UMAC_NOTIFY_OPCODE_DEBUG 0xA5 |
| 201 | #define UMAC_NOTIFY_OPCODE_WIFI_IF_WRAPPER 0xB0 |
| 202 | #define UMAC_NOTIFY_OPCODE_STATS 0xB1 |
| 203 | #define UMAC_NOTIFY_OPCODE_PAGE_DEALLOC 0xB3 |
| 204 | #define UMAC_NOTIFY_OPCODE_RX_TICKET 0xB4 |
| 205 | #define UMAC_NOTIFY_OPCODE_MAX (UMAC_NOTIFY_OPCODE_RX_TICKET -\ |
| 206 | UMAC_NOTIFY_OPCODE_ALIVE + 1) |
| 207 | #define UMAC_NOTIFY_OPCODE_FIRST (UMAC_NOTIFY_OPCODE_ALIVE) |
| 208 | |
| 209 | /* HDI OUT OP CODE */ |
| 210 | #define UMAC_HDI_OUT_OPCODE_PING 0x0 |
| 211 | #define UMAC_HDI_OUT_OPCODE_READ 0x1 |
| 212 | #define UMAC_HDI_OUT_OPCODE_WRITE 0x2 |
| 213 | #define UMAC_HDI_OUT_OPCODE_JUMP 0x3 |
| 214 | #define UMAC_HDI_OUT_OPCODE_REBOOT 0x4 |
| 215 | #define UMAC_HDI_OUT_OPCODE_WRITE_PERSISTENT 0x5 |
| 216 | #define UMAC_HDI_OUT_OPCODE_READ_PERSISTENT 0x6 |
| 217 | #define UMAC_HDI_OUT_OPCODE_READ_MODIFY_WRITE 0x7 |
| 218 | /* #define UMAC_HDI_OUT_OPCODE_RESERVED 0x8..0xA */ |
| 219 | #define UMAC_HDI_OUT_OPCODE_WRITE_AUX_REG 0xB |
| 220 | #define UMAC_HDI_OUT_OPCODE_WIFI 0xF |
| 221 | |
| 222 | /* HDI IN OP CODE -- Non WiFi*/ |
| 223 | #define UMAC_HDI_IN_OPCODE_PING 0x0 |
| 224 | #define UMAC_HDI_IN_OPCODE_READ 0x1 |
| 225 | #define UMAC_HDI_IN_OPCODE_WRITE 0x2 |
| 226 | #define UMAC_HDI_IN_OPCODE_WRITE_PERSISTENT 0x5 |
| 227 | #define UMAC_HDI_IN_OPCODE_READ_PERSISTENT 0x6 |
| 228 | #define UMAC_HDI_IN_OPCODE_READ_MODIFY_WRITE 0x7 |
| 229 | #define UMAC_HDI_IN_OPCODE_EP_MGMT 0x8 |
| 230 | #define UMAC_HDI_IN_OPCODE_CREDIT_CHANGE 0x9 |
| 231 | #define UMAC_HDI_IN_OPCODE_CTRL_DATABASE 0xA |
| 232 | #define UMAC_HDI_IN_OPCODE_WRITE_AUX_REG 0xB |
| 233 | #define UMAC_HDI_IN_OPCODE_NONWIFI_MAX \ |
| 234 | (UMAC_HDI_IN_OPCODE_WRITE_AUX_REG + 1) |
| 235 | #define UMAC_HDI_IN_OPCODE_WIFI 0xF |
| 236 | |
| 237 | /* HDI IN SOURCE */ |
| 238 | #define UMAC_HDI_IN_SOURCE_FHRX 0x0 |
| 239 | #define UMAC_HDI_IN_SOURCE_UDMA 0x1 |
| 240 | #define UMAC_HDI_IN_SOURCE_FW 0x2 |
| 241 | #define UMAC_HDI_IN_SOURCE_RESERVED 0x3 |
| 242 | |
| 243 | /* OUT CMD op-codes */ |
| 244 | #define UMAC_CMD_OPCODE_ECHO 0x01 |
| 245 | #define UMAC_CMD_OPCODE_HALT 0x02 |
| 246 | #define UMAC_CMD_OPCODE_RESET 0x03 |
| 247 | #define UMAC_CMD_OPCODE_BULK_EP_INACT_TIMEOUT 0x09 |
| 248 | #define UMAC_CMD_OPCODE_URB_CANCEL_ACK 0x0A |
| 249 | #define UMAC_CMD_OPCODE_DCACHE_FLUSH 0x0B |
| 250 | #define UMAC_CMD_OPCODE_EEPROM_PROXY 0x0C |
| 251 | #define UMAC_CMD_OPCODE_TX_ECHO 0x0D |
| 252 | #define UMAC_CMD_OPCODE_DBG_MON 0x0E |
| 253 | #define UMAC_CMD_OPCODE_INTERNAL_TX 0x0F |
| 254 | #define UMAC_CMD_OPCODE_SET_PARAM_FIX 0x10 |
| 255 | #define UMAC_CMD_OPCODE_SET_PARAM_VAR 0x11 |
| 256 | #define UMAC_CMD_OPCODE_GET_PARAM 0x12 |
| 257 | #define UMAC_CMD_OPCODE_DBG_EVENT_WRAPPER 0x13 |
| 258 | #define UMAC_CMD_OPCODE_TARGET 0x14 |
| 259 | #define UMAC_CMD_OPCODE_STATISTIC_REQUEST 0x15 |
| 260 | #define UMAC_CMD_OPCODE_GET_CHAN_INFO_LIST 0x16 |
| 261 | #define UMAC_CMD_OPCODE_SET_PARAM_LIST 0x17 |
| 262 | #define UMAC_CMD_OPCODE_GET_PARAM_LIST 0x18 |
| 263 | #define UMAC_CMD_OPCODE_BASE_WRAPPER 0xFA |
| 264 | #define UMAC_CMD_OPCODE_LMAC_WRAPPER 0xFB |
| 265 | #define UMAC_CMD_OPCODE_HW_TEST_WRAPPER 0xFC |
| 266 | #define UMAC_CMD_OPCODE_WIFI_IF_WRAPPER 0xFD |
| 267 | #define UMAC_CMD_OPCODE_WIFI_WRAPPER 0xFE |
| 268 | #define UMAC_CMD_OPCODE_WIFI_PASS_THROUGH 0xFF |
| 269 | |
| 270 | /* UMAC WiFi interface op-codes */ |
| 271 | #define UMAC_WIFI_IF_CMD_SET_PROFILE 0x11 |
| 272 | #define UMAC_WIFI_IF_CMD_INVALIDATE_PROFILE 0x12 |
| 273 | #define UMAC_WIFI_IF_CMD_SET_EXCLUDE_LIST 0x13 |
| 274 | #define UMAC_WIFI_IF_CMD_SCAN_REQUEST 0x14 |
| 275 | #define UMAC_WIFI_IF_CMD_SCAN_CONFIG 0x15 |
| 276 | #define UMAC_WIFI_IF_CMD_ADD_WEP40_KEY 0x16 |
| 277 | #define UMAC_WIFI_IF_CMD_ADD_WEP104_KEY 0x17 |
| 278 | #define UMAC_WIFI_IF_CMD_ADD_TKIP_KEY 0x18 |
| 279 | #define UMAC_WIFI_IF_CMD_ADD_CCMP_KEY 0x19 |
| 280 | #define UMAC_WIFI_IF_CMD_REMOVE_KEY 0x1A |
| 281 | #define UMAC_WIFI_IF_CMD_GLOBAL_TX_KEY_ID 0x1B |
| 282 | #define UMAC_WIFI_IF_CMD_SET_HOST_EXTENDED_IE 0x1C |
| 283 | #define UMAC_WIFI_IF_CMD_GET_SUPPORTED_CHANNELS 0x1E |
| 284 | #define UMAC_WIFI_IF_CMD_TX_PWR_TRIGGER 0x20 |
| 285 | |
| 286 | /* UMAC WiFi interface ports */ |
| 287 | #define UMAC_WIFI_IF_FLG_PORT_DEF 0x00 |
| 288 | #define UMAC_WIFI_IF_FLG_PORT_PAN 0x01 |
| 289 | #define UMAC_WIFI_IF_FLG_PORT_PAN_INVALID WIFI_IF_FLG_PORT_DEF |
| 290 | |
| 291 | /* UMAC WiFi interface actions */ |
| 292 | #define UMAC_WIFI_IF_FLG_ACT_GET 0x10 |
| 293 | #define UMAC_WIFI_IF_FLG_ACT_SET 0x20 |
| 294 | |
| 295 | /* iwm_umac_fw_cmd_hdr.meta_data byte count -- bits [11:0] */ |
| 296 | #define UMAC_FW_CMD_BYTE_COUNT_POS 0 |
| 297 | #define UMAC_FW_CMD_BYTE_COUNT_SEED 0xFFF |
| 298 | |
| 299 | /* iwm_umac_fw_cmd_hdr.meta_data status -- bits [15:12] */ |
| 300 | #define UMAC_FW_CMD_STATUS_POS 12 |
| 301 | #define UMAC_FW_CMD_STATUS_SEED 0xF |
| 302 | |
| 303 | /* iwm_umac_fw_cmd_hdr.meta_data full TX command by Driver -- bits [16:16] */ |
| 304 | #define UMAC_FW_CMD_TX_DRV_FULL_CMD_POS 16 |
| 305 | #define UMAC_FW_CMD_TX_DRV_FULL_CMD_SEED 0x1 |
| 306 | |
| 307 | /* iwm_umac_fw_cmd_hdr.meta_data TX command by FW -- bits [17:17] */ |
| 308 | #define UMAC_FW_CMD_TX_FW_CMD_POS 17 |
| 309 | #define UMAC_FW_CMD_TX_FW_CMD_SEED 0x1 |
| 310 | |
| 311 | /* iwm_umac_fw_cmd_hdr.meta_data TX plaintext mode -- bits [18:18] */ |
| 312 | #define UMAC_FW_CMD_TX_PLAINTEXT_POS 18 |
| 313 | #define UMAC_FW_CMD_TX_PLAINTEXT_SEED 0x1 |
| 314 | |
| 315 | /* iwm_umac_fw_cmd_hdr.meta_data STA color -- bits [22:20] */ |
| 316 | #define UMAC_FW_CMD_TX_STA_COLOR_POS 20 |
| 317 | #define UMAC_FW_CMD_TX_STA_COLOR_SEED 0x7 |
| 318 | |
| 319 | /* iwm_umac_fw_cmd_hdr.meta_data TX life time (TU) -- bits [31:24] */ |
| 320 | #define UMAC_FW_CMD_TX_LIFETIME_TU_POS 24 |
| 321 | #define UMAC_FW_CMD_TX_LIFETIME_TU_SEED 0xFF |
| 322 | |
| 323 | /* iwm_dev_cmd_hdr.flags Response required -- bits [5:5] */ |
| 324 | #define UMAC_DEV_CMD_FLAGS_RESP_REQ_POS 5 |
| 325 | #define UMAC_DEV_CMD_FLAGS_RESP_REQ_SEED 0x1 |
| 326 | |
| 327 | /* iwm_dev_cmd_hdr.flags Aborted command -- bits [6:6] */ |
| 328 | #define UMAC_DEV_CMD_FLAGS_ABORT_POS 6 |
| 329 | #define UMAC_DEV_CMD_FLAGS_ABORT_SEED 0x1 |
| 330 | |
| 331 | /* iwm_dev_cmd_hdr.flags Internal command -- bits [7:7] */ |
| 332 | #define DEV_CMD_FLAGS_FLD_INTERNAL_POS 7 |
| 333 | #define DEV_CMD_FLAGS_FLD_INTERNAL_SEED 0x1 |
| 334 | |
| 335 | /* Rx */ |
| 336 | /* Rx actions */ |
| 337 | #define IWM_RX_TICKET_DROP 0x0 |
| 338 | #define IWM_RX_TICKET_RELEASE 0x1 |
| 339 | #define IWM_RX_TICKET_SNIFFER 0x2 |
| 340 | #define IWM_RX_TICKET_ENQUEUE 0x3 |
| 341 | |
| 342 | /* Rx flags */ |
| 343 | #define IWM_RX_TICKET_PAD_SIZE_MSK 0x2 |
| 344 | #define IWM_RX_TICKET_SPECIAL_SNAP_MSK 0x4 |
| 345 | #define IWM_RX_TICKET_AMSDU_MSK 0x8 |
| 346 | #define IWM_RX_TICKET_DROP_REASON_POS 4 |
| 347 | #define IWM_RX_TICKET_DROP_REASON_MSK (0x1F << RX_TICKET_FLAGS_DROP_REASON_POS) |
| 348 | |
| 349 | #define IWM_RX_DROP_NO_DROP 0x0 |
| 350 | #define IWM_RX_DROP_BAD_CRC 0x1 |
| 351 | /* L2P no address match */ |
| 352 | #define IWM_RX_DROP_LMAC_ADDR_FILTER 0x2 |
| 353 | /* Multicast address not in list */ |
| 354 | #define IWM_RX_DROP_MCAST_ADDR_FILTER 0x3 |
| 355 | /* Control frames are not sent to the driver */ |
| 356 | #define IWM_RX_DROP_CTL_FRAME 0x4 |
| 357 | /* Our frame is back */ |
| 358 | #define IWM_RX_DROP_OUR_TX 0x5 |
| 359 | /* Association class filtering */ |
| 360 | #define IWM_RX_DROP_CLASS_FILTER 0x6 |
| 361 | /* Duplicated frame */ |
| 362 | #define IWM_RX_DROP_DUPLICATE_FILTER 0x7 |
| 363 | /* Decryption error */ |
| 364 | #define IWM_RX_DROP_SEC_ERR 0x8 |
| 365 | /* Unencrypted frame while encryption is on */ |
| 366 | #define IWM_RX_DROP_SEC_NO_ENCRYPTION 0x9 |
| 367 | /* Replay check failure */ |
| 368 | #define IWM_RX_DROP_SEC_REPLAY_ERR 0xa |
| 369 | /* uCode and FW key color mismatch, check before replay */ |
| 370 | #define IWM_RX_DROP_SEC_KEY_COLOR_MISMATCH 0xb |
| 371 | #define IWM_RX_DROP_SEC_TKIP_COUNTER_MEASURE 0xc |
| 372 | /* No fragmentations Db is found */ |
| 373 | #define IWM_RX_DROP_FRAG_NO_RESOURCE 0xd |
| 374 | /* Fragmention Db has seqCtl mismatch Vs. non-1st frag */ |
| 375 | #define IWM_RX_DROP_FRAG_ERR 0xe |
| 376 | #define IWM_RX_DROP_FRAG_LOST 0xf |
| 377 | #define IWM_RX_DROP_FRAG_COMPLETE 0x10 |
| 378 | /* Should be handled by UMAC */ |
| 379 | #define IWM_RX_DROP_MANAGEMENT 0x11 |
| 380 | /* STA not found by UMAC */ |
| 381 | #define IWM_RX_DROP_NO_STATION 0x12 |
| 382 | /* NULL or QoS NULL */ |
| 383 | #define IWM_RX_DROP_NULL_DATA 0x13 |
| 384 | #define IWM_RX_DROP_BA_REORDER_OLD_SEQCTL 0x14 |
| 385 | #define IWM_RX_DROP_BA_REORDER_DUPLICATE 0x15 |
| 386 | |
| 387 | struct iwm_rx_ticket { |
| 388 | __le16 action; |
| 389 | __le16 id; |
| 390 | __le16 flags; |
| 391 | u8 payload_offset; /* includes: MAC header, pad, IV */ |
| 392 | u8 tail_len; /* includes: MIC, ICV, CRC (w/o STATUS) */ |
| 393 | } __attribute__ ((packed)); |
| 394 | |
| 395 | struct iwm_rx_mpdu_hdr { |
| 396 | __le16 len; |
| 397 | __le16 reserved; |
| 398 | } __attribute__ ((packed)); |
| 399 | |
| 400 | /* UMAC SW WIFI API */ |
| 401 | |
| 402 | struct iwm_dev_cmd_hdr { |
| 403 | u8 cmd; |
| 404 | u8 flags; |
| 405 | __le16 seq_num; |
| 406 | } __attribute__ ((packed)); |
| 407 | |
| 408 | struct iwm_umac_fw_cmd_hdr { |
| 409 | __le32 meta_data; |
| 410 | struct iwm_dev_cmd_hdr cmd; |
| 411 | } __attribute__ ((packed)); |
| 412 | |
| 413 | struct iwm_umac_wifi_out_hdr { |
| 414 | struct iwm_udma_out_wifi_hdr hw_hdr; |
| 415 | struct iwm_umac_fw_cmd_hdr sw_hdr; |
| 416 | } __attribute__ ((packed)); |
| 417 | |
| 418 | struct iwm_umac_nonwifi_out_hdr { |
| 419 | struct iwm_udma_out_nonwifi_hdr hw_hdr; |
| 420 | } __attribute__ ((packed)); |
| 421 | |
| 422 | struct iwm_umac_wifi_in_hdr { |
| 423 | struct iwm_udma_in_hdr hw_hdr; |
| 424 | struct iwm_umac_fw_cmd_hdr sw_hdr; |
| 425 | } __attribute__ ((packed)); |
| 426 | |
| 427 | struct iwm_umac_nonwifi_in_hdr { |
| 428 | struct iwm_udma_in_hdr hw_hdr; |
| 429 | __le32 time_stamp; |
| 430 | } __attribute__ ((packed)); |
| 431 | |
| 432 | #define IWM_UMAC_PAGE_SIZE 0x200 |
| 433 | |
| 434 | /* Notify structures */ |
| 435 | struct iwm_fw_version { |
| 436 | u8 minor; |
| 437 | u8 major; |
| 438 | __le16 id; |
| 439 | }; |
| 440 | |
| 441 | struct iwm_fw_build { |
| 442 | u8 type; |
| 443 | u8 subtype; |
| 444 | u8 platform; |
| 445 | u8 opt; |
| 446 | }; |
| 447 | |
| 448 | struct iwm_fw_alive_hdr { |
| 449 | struct iwm_fw_version ver; |
| 450 | struct iwm_fw_build build; |
| 451 | __le32 os_build; |
| 452 | __le32 log_hdr_addr; |
| 453 | __le32 log_buf_addr; |
| 454 | __le32 sys_timer_addr; |
| 455 | }; |
| 456 | |
| 457 | #define WAIT_NOTIF_TIMEOUT (2 * HZ) |
| 458 | #define SCAN_COMPLETE_TIMEOUT (3 * HZ) |
| 459 | |
| 460 | #define UMAC_NTFY_ALIVE_STATUS_ERR 0xDEAD |
| 461 | #define UMAC_NTFY_ALIVE_STATUS_OK 0xCAFE |
| 462 | |
| 463 | #define UMAC_NTFY_INIT_COMPLETE_STATUS_ERR 0xDEAD |
| 464 | #define UMAC_NTFY_INIT_COMPLETE_STATUS_OK 0xCAFE |
| 465 | |
| 466 | #define UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN 0x40 |
| 467 | #define UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN 0x80 |
| 468 | |
| 469 | #define IWM_MACS_OUT_GROUPS 6 |
| 470 | #define IWM_MACS_OUT_SGROUPS 1 |
| 471 | |
| 472 | |
| 473 | #define WIFI_IF_NTFY_ASSOC_START 0x80 |
| 474 | #define WIFI_IF_NTFY_ASSOC_COMPLETE 0x81 |
| 475 | #define WIFI_IF_NTFY_PROFILE_INVALIDATE_COMPLETE 0x82 |
| 476 | #define WIFI_IF_NTFY_CONNECTION_TERMINATED 0x83 |
| 477 | #define WIFI_IF_NTFY_SCAN_COMPLETE 0x84 |
| 478 | #define WIFI_IF_NTFY_STA_TABLE_CHANGE 0x85 |
| 479 | #define WIFI_IF_NTFY_EXTENDED_IE_REQUIRED 0x86 |
| 480 | #define WIFI_IF_NTFY_RADIO_PREEMPTION 0x87 |
| 481 | #define WIFI_IF_NTFY_BSS_TRK_TABLE_CHANGED 0x88 |
| 482 | #define WIFI_IF_NTFY_BSS_TRK_ENTRIES_REMOVED 0x89 |
| 483 | #define WIFI_IF_NTFY_LINK_QUALITY_STATISTICS 0x8A |
| 484 | #define WIFI_IF_NTFY_MGMT_FRAME 0x8B |
| 485 | |
| 486 | /* DEBUG INDICATIONS */ |
| 487 | #define WIFI_DBG_IF_NTFY_SCAN_SUPER_JOB_START 0xE0 |
| 488 | #define WIFI_DBG_IF_NTFY_SCAN_SUPER_JOB_COMPLETE 0xE1 |
| 489 | #define WIFI_DBG_IF_NTFY_SCAN_CHANNEL_START 0xE2 |
| 490 | #define WIFI_DBG_IF_NTFY_SCAN_CHANNEL_RESULT 0xE3 |
| 491 | #define WIFI_DBG_IF_NTFY_SCAN_MINI_JOB_START 0xE4 |
| 492 | #define WIFI_DBG_IF_NTFY_SCAN_MINI_JOB_COMPLETE 0xE5 |
| 493 | #define WIFI_DBG_IF_NTFY_CNCT_ATC_START 0xE6 |
| 494 | #define WIFI_DBG_IF_NTFY_COEX_NOTIFICATION 0xE7 |
| 495 | #define WIFI_DBG_IF_NTFY_COEX_HANDLE_ENVELOP 0xE8 |
| 496 | #define WIFI_DBG_IF_NTFY_COEX_HANDLE_RELEASE_ENVELOP 0xE9 |
| 497 | |
| 498 | /* Notification structures */ |
| 499 | struct iwm_umac_notif_wifi_if { |
| 500 | struct iwm_umac_wifi_in_hdr hdr; |
| 501 | u8 status; |
| 502 | u8 flags; |
| 503 | __le16 buf_size; |
| 504 | } __attribute__ ((packed)); |
| 505 | |
| 506 | #define UMAC_ROAM_REASON_FIRST_SELECTION 0x1 |
| 507 | #define UMAC_ROAM_REASON_AP_DEAUTH 0x2 |
| 508 | #define UMAC_ROAM_REASON_AP_CONNECT_LOST 0x3 |
| 509 | #define UMAC_ROAM_REASON_RSSI 0x4 |
| 510 | #define UMAC_ROAM_REASON_AP_ASSISTED_ROAM 0x5 |
| 511 | #define UMAC_ROAM_REASON_IBSS_COALESCING 0x6 |
| 512 | |
| 513 | struct iwm_umac_notif_assoc_start { |
| 514 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 515 | __le32 roam_reason; |
| 516 | u8 bssid[ETH_ALEN]; |
| 517 | u8 reserved[2]; |
| 518 | } __attribute__ ((packed)); |
| 519 | |
| 520 | #define UMAC_ASSOC_COMPLETE_SUCCESS 0x0 |
| 521 | #define UMAC_ASSOC_COMPLETE_FAILURE 0x1 |
| 522 | |
| 523 | struct iwm_umac_notif_assoc_complete { |
| 524 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 525 | __le32 status; |
| 526 | u8 bssid[ETH_ALEN]; |
| 527 | u8 band; |
| 528 | u8 channel; |
| 529 | } __attribute__ ((packed)); |
| 530 | |
| 531 | #define UMAC_PROFILE_INVALID_ASSOC_TIMEOUT 0x0 |
| 532 | #define UMAC_PROFILE_INVALID_ROAM_TIMEOUT 0x1 |
| 533 | #define UMAC_PROFILE_INVALID_REQUEST 0x2 |
| 534 | #define UMAC_PROFILE_INVALID_RF_PREEMPTED 0x3 |
| 535 | |
| 536 | struct iwm_umac_notif_profile_invalidate { |
| 537 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 538 | __le32 reason; |
| 539 | } __attribute__ ((packed)); |
| 540 | |
| 541 | #define UMAC_SCAN_RESULT_SUCCESS 0x0 |
| 542 | #define UMAC_SCAN_RESULT_ABORTED 0x1 |
| 543 | #define UMAC_SCAN_RESULT_REJECTED 0x2 |
| 544 | #define UMAC_SCAN_RESULT_FAILED 0x3 |
| 545 | |
| 546 | struct iwm_umac_notif_scan_complete { |
| 547 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 548 | __le32 type; |
| 549 | __le32 result; |
| 550 | u8 seq_num; |
| 551 | } __attribute__ ((packed)); |
| 552 | |
| 553 | #define UMAC_OPCODE_ADD_MODIFY 0x0 |
| 554 | #define UMAC_OPCODE_REMOVE 0x1 |
| 555 | #define UMAC_OPCODE_CLEAR_ALL 0x2 |
| 556 | |
| 557 | #define UMAC_STA_FLAG_QOS 0x1 |
| 558 | |
| 559 | struct iwm_umac_notif_sta_info { |
| 560 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 561 | __le32 opcode; |
| 562 | u8 mac_addr[ETH_ALEN]; |
| 563 | u8 sta_id; /* bits 0-3: station ID, bits 4-7: station color */ |
| 564 | u8 flags; |
| 565 | } __attribute__ ((packed)); |
| 566 | |
| 567 | #define UMAC_BAND_2GHZ 0 |
| 568 | #define UMAC_BAND_5GHZ 1 |
| 569 | |
| 570 | #define UMAC_CHANNEL_WIDTH_20MHZ 0 |
| 571 | #define UMAC_CHANNEL_WIDTH_40MHZ 1 |
| 572 | |
| 573 | struct iwm_umac_notif_bss_info { |
| 574 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 575 | __le32 type; |
| 576 | __le32 timestamp; |
| 577 | __le16 table_idx; |
| 578 | __le16 frame_len; |
| 579 | u8 band; |
| 580 | u8 channel; |
| 581 | s8 rssi; |
| 582 | u8 reserved; |
| 583 | u8 frame_buf[1]; |
| 584 | } __attribute__ ((packed)); |
| 585 | |
| 586 | #define IWM_BSS_REMOVE_INDEX_MSK 0x0fff |
| 587 | #define IWM_BSS_REMOVE_FLAGS_MSK 0xfc00 |
| 588 | |
| 589 | #define IWM_BSS_REMOVE_FLG_AGE 0x1000 |
| 590 | #define IWM_BSS_REMOVE_FLG_TIMEOUT 0x2000 |
| 591 | #define IWM_BSS_REMOVE_FLG_TABLE_FULL 0x4000 |
| 592 | |
| 593 | struct iwm_umac_notif_bss_removed { |
| 594 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 595 | __le32 count; |
| 596 | __le16 entries[0]; |
| 597 | } __attribute__ ((packed)); |
| 598 | |
| 599 | struct iwm_umac_notif_mgt_frame { |
| 600 | struct iwm_umac_notif_wifi_if mlme_hdr; |
| 601 | __le16 len; |
| 602 | u8 frame[1]; |
| 603 | } __attribute__ ((packed)); |
| 604 | |
| 605 | struct iwm_umac_notif_alive { |
| 606 | struct iwm_umac_wifi_in_hdr hdr; |
| 607 | __le16 status; |
| 608 | __le16 reserved1; |
| 609 | struct iwm_fw_alive_hdr alive_data; |
| 610 | __le16 reserved2; |
| 611 | __le16 page_grp_count; |
| 612 | __le32 page_grp_state[IWM_MACS_OUT_GROUPS]; |
| 613 | } __attribute__ ((packed)); |
| 614 | |
| 615 | struct iwm_umac_notif_init_complete { |
| 616 | __le16 status; |
| 617 | __le16 reserved; |
| 618 | } __attribute__ ((packed)); |
| 619 | |
| 620 | /* error categories */ |
| 621 | enum { |
| 622 | UMAC_SYS_ERR_CAT_NONE = 0, |
| 623 | UMAC_SYS_ERR_CAT_BOOT, |
| 624 | UMAC_SYS_ERR_CAT_UMAC, |
| 625 | UMAC_SYS_ERR_CAT_UAXM, |
| 626 | UMAC_SYS_ERR_CAT_LMAC, |
| 627 | UMAC_SYS_ERR_CAT_MAX |
| 628 | }; |
| 629 | |
| 630 | struct iwm_fw_error_hdr { |
| 631 | __le32 category; |
| 632 | __le32 status; |
| 633 | __le32 pc; |
| 634 | __le32 blink1; |
| 635 | __le32 blink2; |
| 636 | __le32 ilink1; |
| 637 | __le32 ilink2; |
| 638 | __le32 data1; |
| 639 | __le32 data2; |
| 640 | __le32 line_num; |
| 641 | __le32 umac_status; |
| 642 | __le32 lmac_status; |
| 643 | __le32 sdio_status; |
| 644 | } __attribute__ ((packed)); |
| 645 | |
| 646 | struct iwm_umac_notif_error { |
| 647 | struct iwm_umac_wifi_in_hdr hdr; |
| 648 | struct iwm_fw_error_hdr err; |
| 649 | } __attribute__ ((packed)); |
| 650 | |
| 651 | #define UMAC_DEALLOC_NTFY_CHANGES_CNT_POS 0 |
| 652 | #define UMAC_DEALLOC_NTFY_CHANGES_CNT_SEED 0xff |
| 653 | #define UMAC_DEALLOC_NTFY_CHANGES_MSK_POS 8 |
| 654 | #define UMAC_DEALLOC_NTFY_CHANGES_MSK_SEED 0xffffff |
| 655 | #define UMAC_DEALLOC_NTFY_PAGE_CNT_POS 0 |
| 656 | #define UMAC_DEALLOC_NTFY_PAGE_CNT_SEED 0xffffff |
| 657 | #define UMAC_DEALLOC_NTFY_GROUP_NUM_POS 24 |
| 658 | #define UMAC_DEALLOC_NTFY_GROUP_NUM_SEED 0xf |
| 659 | |
| 660 | struct iwm_umac_notif_page_dealloc { |
| 661 | struct iwm_umac_wifi_in_hdr hdr; |
| 662 | __le32 changes; |
| 663 | __le32 grp_info[IWM_MACS_OUT_GROUPS]; |
| 664 | } __attribute__ ((packed)); |
| 665 | |
| 666 | struct iwm_umac_notif_wifi_status { |
| 667 | struct iwm_umac_wifi_in_hdr hdr; |
| 668 | __le16 status; |
| 669 | __le16 reserved; |
| 670 | } __attribute__ ((packed)); |
| 671 | |
| 672 | struct iwm_umac_notif_rx_ticket { |
| 673 | struct iwm_umac_wifi_in_hdr hdr; |
| 674 | u8 num_tickets; |
| 675 | u8 reserved[3]; |
| 676 | struct iwm_rx_ticket tickets[1]; |
| 677 | } __attribute__ ((packed)); |
| 678 | |
| 679 | /* Tx/Rx rates window (number of max of last update window per second) */ |
| 680 | #define UMAC_NTF_RATE_SAMPLE_NR 4 |
| 681 | |
| 682 | #define IWM_UMAC_MGMT_TID 8 |
| 683 | #define IWM_UMAC_TID_NR 8 |
| 684 | |
| 685 | struct iwm_umac_notif_stats { |
| 686 | struct iwm_umac_wifi_in_hdr hdr; |
| 687 | __le32 flags; |
| 688 | __le32 timestamp; |
| 689 | __le16 tid_load[IWM_UMAC_TID_NR + 2]; /* 1 non-QoS + 1 dword align */ |
| 690 | __le16 tx_rate[UMAC_NTF_RATE_SAMPLE_NR]; |
| 691 | __le16 rx_rate[UMAC_NTF_RATE_SAMPLE_NR]; |
| 692 | s32 rssi_dbm; |
| 693 | s32 noise_dbm; |
| 694 | __le32 supp_rates; |
| 695 | __le32 missed_beacons; |
| 696 | __le32 rx_beacons; |
| 697 | __le32 rx_dir_pkts; |
| 698 | __le32 rx_nondir_pkts; |
| 699 | __le32 rx_multicast; |
| 700 | __le32 rx_errors; |
| 701 | __le32 rx_drop_other_bssid; |
| 702 | __le32 rx_drop_decode; |
| 703 | __le32 rx_drop_reassembly; |
| 704 | __le32 rx_drop_bad_len; |
| 705 | __le32 rx_drop_overflow; |
| 706 | __le32 rx_drop_crc; |
| 707 | __le32 rx_drop_missed; |
| 708 | __le32 tx_dir_pkts; |
| 709 | __le32 tx_nondir_pkts; |
| 710 | __le32 tx_failure; |
| 711 | __le32 tx_errors; |
| 712 | __le32 tx_drop_max_retry; |
| 713 | __le32 tx_err_abort; |
| 714 | __le32 tx_err_carrier; |
| 715 | __le32 rx_bytes; |
| 716 | __le32 tx_bytes; |
| 717 | __le32 tx_power; |
| 718 | __le32 tx_max_power; |
| 719 | __le32 roam_threshold; |
| 720 | __le32 ap_assoc_nr; |
| 721 | __le32 scan_full; |
| 722 | __le32 scan_abort; |
| 723 | __le32 ap_nr; |
| 724 | __le32 roam_nr; |
| 725 | __le32 roam_missed_beacons; |
| 726 | __le32 roam_rssi; |
| 727 | __le32 roam_unassoc; |
| 728 | __le32 roam_deauth; |
| 729 | __le32 roam_ap_loadblance; |
| 730 | } __attribute__ ((packed)); |
| 731 | |
| 732 | /* WiFi interface wrapper header */ |
| 733 | struct iwm_umac_wifi_if { |
| 734 | u8 oid; |
| 735 | u8 flags; |
| 736 | __le16 buf_size; |
| 737 | } __attribute__ ((packed)); |
| 738 | |
| 739 | #define IWM_SEQ_NUM_HOST_MSK 0x0000 |
| 740 | #define IWM_SEQ_NUM_UMAC_MSK 0x4000 |
| 741 | #define IWM_SEQ_NUM_LMAC_MSK 0x8000 |
| 742 | #define IWM_SEQ_NUM_MSK 0xC000 |
| 743 | |
| 744 | #endif |