Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 4 | * redistributing this file, you may do so under either license. |
| 5 | * |
| 6 | * GPL LICENSE SUMMARY |
| 7 | * |
| 8 | * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
Ian Schram | 01ebd06 | 2007-10-25 17:15:22 +0800 | [diff] [blame] | 11 | * it under the terms of version 2 of the GNU General Public License as |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 22 | * USA |
| 23 | * |
| 24 | * The full GNU General Public License is included in this distribution |
| 25 | * in the file called LICENSE.GPL. |
| 26 | * |
| 27 | * Contact Information: |
| 28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> |
| 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 30 | * |
| 31 | * BSD LICENSE |
| 32 | * |
| 33 | * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. |
| 34 | * All rights reserved. |
| 35 | * |
| 36 | * Redistribution and use in source and binary forms, with or without |
| 37 | * modification, are permitted provided that the following conditions |
| 38 | * are met: |
| 39 | * |
| 40 | * * Redistributions of source code must retain the above copyright |
| 41 | * notice, this list of conditions and the following disclaimer. |
| 42 | * * Redistributions in binary form must reproduce the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer in |
| 44 | * the documentation and/or other materials provided with the |
| 45 | * distribution. |
| 46 | * * Neither the name Intel Corporation nor the names of its |
| 47 | * contributors may be used to endorse or promote products derived |
| 48 | * from this software without specific prior written permission. |
| 49 | * |
| 50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 61 | * |
| 62 | *****************************************************************************/ |
| 63 | |
Christoph Hellwig | 5d08cd1 | 2007-10-25 17:15:50 +0800 | [diff] [blame^] | 64 | #ifndef __iwl_3945_commands_h__ |
| 65 | #define __iwl_3945_commands_h__ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 66 | |
| 67 | enum { |
| 68 | REPLY_ALIVE = 0x1, |
| 69 | REPLY_ERROR = 0x2, |
| 70 | |
| 71 | /* RXON and QOS commands */ |
| 72 | REPLY_RXON = 0x10, |
| 73 | REPLY_RXON_ASSOC = 0x11, |
| 74 | REPLY_QOS_PARAM = 0x13, |
| 75 | REPLY_RXON_TIMING = 0x14, |
| 76 | |
| 77 | /* Multi-Station support */ |
| 78 | REPLY_ADD_STA = 0x18, |
| 79 | REPLY_REMOVE_STA = 0x19, /* not used */ |
| 80 | REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ |
| 81 | |
| 82 | /* RX, TX, LEDs */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 83 | REPLY_3945_RX = 0x1b, /* 3945 only */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 84 | REPLY_TX = 0x1c, |
| 85 | REPLY_RATE_SCALE = 0x47, /* 3945 only */ |
| 86 | REPLY_LEDS_CMD = 0x48, |
| 87 | REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ |
| 88 | |
| 89 | /* 802.11h related */ |
| 90 | RADAR_NOTIFICATION = 0x70, /* not used */ |
| 91 | REPLY_QUIET_CMD = 0x71, /* not used */ |
| 92 | REPLY_CHANNEL_SWITCH = 0x72, |
| 93 | CHANNEL_SWITCH_NOTIFICATION = 0x73, |
| 94 | REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, |
| 95 | SPECTRUM_MEASURE_NOTIFICATION = 0x75, |
| 96 | |
| 97 | /* Power Management */ |
| 98 | POWER_TABLE_CMD = 0x77, |
| 99 | PM_SLEEP_NOTIFICATION = 0x7A, |
| 100 | PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, |
| 101 | |
| 102 | /* Scan commands and notifications */ |
| 103 | REPLY_SCAN_CMD = 0x80, |
| 104 | REPLY_SCAN_ABORT_CMD = 0x81, |
| 105 | SCAN_START_NOTIFICATION = 0x82, |
| 106 | SCAN_RESULTS_NOTIFICATION = 0x83, |
| 107 | SCAN_COMPLETE_NOTIFICATION = 0x84, |
| 108 | |
| 109 | /* IBSS/AP commands */ |
| 110 | BEACON_NOTIFICATION = 0x90, |
| 111 | REPLY_TX_BEACON = 0x91, |
| 112 | WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ |
| 113 | |
| 114 | /* Miscellaneous commands */ |
| 115 | QUIET_NOTIFICATION = 0x96, /* not used */ |
| 116 | REPLY_TX_PWR_TABLE_CMD = 0x97, |
| 117 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ |
| 118 | |
| 119 | /* BT config command */ |
| 120 | REPLY_BT_CONFIG = 0x9b, |
| 121 | |
| 122 | /* 4965 Statistics */ |
| 123 | REPLY_STATISTICS_CMD = 0x9c, |
| 124 | STATISTICS_NOTIFICATION = 0x9d, |
| 125 | |
| 126 | /* RF-KILL commands and notifications */ |
| 127 | REPLY_CARD_STATE_CMD = 0xa0, |
| 128 | CARD_STATE_NOTIFICATION = 0xa1, |
| 129 | |
| 130 | /* Missed beacons notification */ |
| 131 | MISSED_BEACONS_NOTIFICATION = 0xa2, |
| 132 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 133 | REPLY_MAX = 0xff |
| 134 | }; |
| 135 | |
| 136 | /****************************************************************************** |
| 137 | * (0) |
| 138 | * Header |
| 139 | * |
| 140 | *****************************************************************************/ |
| 141 | |
| 142 | #define IWL_CMD_FAILED_MSK 0x40 |
| 143 | |
| 144 | struct iwl_cmd_header { |
| 145 | u8 cmd; |
| 146 | u8 flags; |
| 147 | /* We have 15 LSB to use as we please (MSB indicates |
| 148 | * a frame Rx'd from the HW). We encode the following |
| 149 | * information into the sequence field: |
| 150 | * |
| 151 | * 0:7 index in fifo |
| 152 | * 8:13 fifo selection |
| 153 | * 14:14 bit indicating if this packet references the 'extra' |
| 154 | * storage at the end of the memory queue |
| 155 | * 15:15 (Rx indication) |
| 156 | * |
| 157 | */ |
| 158 | __le16 sequence; |
| 159 | |
| 160 | /* command data follows immediately */ |
| 161 | u8 data[0]; |
| 162 | } __attribute__ ((packed)); |
| 163 | |
| 164 | /****************************************************************************** |
| 165 | * (0a) |
| 166 | * Alive and Error Commands & Responses: |
| 167 | * |
| 168 | *****************************************************************************/ |
| 169 | |
| 170 | #define UCODE_VALID_OK __constant_cpu_to_le32(0x1) |
| 171 | #define INITIALIZE_SUBTYPE (9) |
| 172 | |
| 173 | /* |
| 174 | * REPLY_ALIVE = 0x1 (response only, not a command) |
| 175 | */ |
| 176 | struct iwl_alive_resp { |
| 177 | u8 ucode_minor; |
| 178 | u8 ucode_major; |
| 179 | __le16 reserved1; |
| 180 | u8 sw_rev[8]; |
| 181 | u8 ver_type; |
| 182 | u8 ver_subtype; |
| 183 | __le16 reserved2; |
| 184 | __le32 log_event_table_ptr; |
| 185 | __le32 error_event_table_ptr; |
| 186 | __le32 timestamp; |
| 187 | __le32 is_valid; |
| 188 | } __attribute__ ((packed)); |
| 189 | |
| 190 | struct iwl_init_alive_resp { |
| 191 | u8 ucode_minor; |
| 192 | u8 ucode_major; |
| 193 | __le16 reserved1; |
| 194 | u8 sw_rev[8]; |
| 195 | u8 ver_type; |
| 196 | u8 ver_subtype; |
| 197 | __le16 reserved2; |
| 198 | __le32 log_event_table_ptr; |
| 199 | __le32 error_event_table_ptr; |
| 200 | __le32 timestamp; |
| 201 | __le32 is_valid; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 202 | } __attribute__ ((packed)); |
| 203 | |
| 204 | union tsf { |
| 205 | u8 byte[8]; |
| 206 | __le16 word[4]; |
| 207 | __le32 dw[2]; |
| 208 | }; |
| 209 | |
| 210 | /* |
| 211 | * REPLY_ERROR = 0x2 (response only, not a command) |
| 212 | */ |
| 213 | struct iwl_error_resp { |
| 214 | __le32 error_type; |
| 215 | u8 cmd_id; |
| 216 | u8 reserved1; |
| 217 | __le16 bad_cmd_seq_num; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 218 | __le16 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 219 | __le32 error_info; |
| 220 | union tsf timestamp; |
| 221 | } __attribute__ ((packed)); |
| 222 | |
| 223 | /****************************************************************************** |
| 224 | * (1) |
| 225 | * RXON Commands & Responses: |
| 226 | * |
| 227 | *****************************************************************************/ |
| 228 | |
| 229 | /* |
| 230 | * Rx config defines & structure |
| 231 | */ |
| 232 | /* rx_config device types */ |
| 233 | enum { |
| 234 | RXON_DEV_TYPE_AP = 1, |
| 235 | RXON_DEV_TYPE_ESS = 3, |
| 236 | RXON_DEV_TYPE_IBSS = 4, |
| 237 | RXON_DEV_TYPE_SNIFFER = 6, |
| 238 | }; |
| 239 | |
| 240 | /* rx_config flags */ |
| 241 | /* band & modulation selection */ |
| 242 | #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) |
| 243 | #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) |
| 244 | /* auto detection enable */ |
| 245 | #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) |
| 246 | /* TGg protection when tx */ |
| 247 | #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) |
| 248 | /* cck short slot & preamble */ |
| 249 | #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) |
| 250 | #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) |
| 251 | /* antenna selection */ |
| 252 | #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) |
| 253 | #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) |
| 254 | #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) |
| 255 | #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) |
| 256 | /* radar detection enable */ |
| 257 | #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) |
| 258 | #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) |
| 259 | /* rx response to host with 8-byte TSF |
| 260 | * (according to ON_AIR deassertion) */ |
| 261 | #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) |
| 262 | |
| 263 | /* rx_config filter flags */ |
| 264 | /* accept all data frames */ |
| 265 | #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) |
| 266 | /* pass control & management to host */ |
| 267 | #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) |
| 268 | /* accept multi-cast */ |
| 269 | #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) |
| 270 | /* don't decrypt uni-cast frames */ |
| 271 | #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) |
| 272 | /* don't decrypt multi-cast frames */ |
| 273 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) |
| 274 | /* STA is associated */ |
| 275 | #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) |
| 276 | /* transfer to host non bssid beacons in associated state */ |
| 277 | #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) |
| 278 | |
| 279 | /* |
| 280 | * REPLY_RXON = 0x10 (command, has simple generic response) |
| 281 | */ |
| 282 | struct iwl_rxon_cmd { |
| 283 | u8 node_addr[6]; |
| 284 | __le16 reserved1; |
| 285 | u8 bssid_addr[6]; |
| 286 | __le16 reserved2; |
| 287 | u8 wlap_bssid_addr[6]; |
| 288 | __le16 reserved3; |
| 289 | u8 dev_type; |
| 290 | u8 air_propagation; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 291 | __le16 reserved4; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 292 | u8 ofdm_basic_rates; |
| 293 | u8 cck_basic_rates; |
| 294 | __le16 assoc_id; |
| 295 | __le32 flags; |
| 296 | __le32 filter_flags; |
| 297 | __le16 channel; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 298 | __le16 reserved5; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 299 | } __attribute__ ((packed)); |
| 300 | |
| 301 | /* |
| 302 | * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) |
| 303 | */ |
| 304 | struct iwl_rxon_assoc_cmd { |
| 305 | __le32 flags; |
| 306 | __le32 filter_flags; |
| 307 | u8 ofdm_basic_rates; |
| 308 | u8 cck_basic_rates; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 309 | __le16 reserved; |
| 310 | } __attribute__ ((packed)); |
| 311 | |
| 312 | /* |
| 313 | * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) |
| 314 | */ |
| 315 | struct iwl_rxon_time_cmd { |
| 316 | union tsf timestamp; |
| 317 | __le16 beacon_interval; |
| 318 | __le16 atim_window; |
| 319 | __le32 beacon_init_val; |
| 320 | __le16 listen_interval; |
| 321 | __le16 reserved; |
| 322 | } __attribute__ ((packed)); |
| 323 | |
| 324 | struct iwl_tx_power { |
| 325 | u8 tx_gain; /* gain for analog radio */ |
| 326 | u8 dsp_atten; /* gain for DSP */ |
| 327 | } __attribute__ ((packed)); |
| 328 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 329 | struct iwl_power_per_rate { |
| 330 | u8 rate; /* plcp */ |
| 331 | struct iwl_tx_power tpc; |
| 332 | u8 reserved; |
| 333 | } __attribute__ ((packed)); |
| 334 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 335 | /* |
| 336 | * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) |
| 337 | */ |
| 338 | struct iwl_channel_switch_cmd { |
| 339 | u8 band; |
| 340 | u8 expect_beacon; |
| 341 | __le16 channel; |
| 342 | __le32 rxon_flags; |
| 343 | __le32 rxon_filter_flags; |
| 344 | __le32 switch_time; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 345 | struct iwl_power_per_rate power[IWL_MAX_RATES]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 346 | } __attribute__ ((packed)); |
| 347 | |
| 348 | /* |
| 349 | * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) |
| 350 | */ |
| 351 | struct iwl_csa_notification { |
| 352 | __le16 band; |
| 353 | __le16 channel; |
| 354 | __le32 status; /* 0 - OK, 1 - fail */ |
| 355 | } __attribute__ ((packed)); |
| 356 | |
| 357 | /****************************************************************************** |
| 358 | * (2) |
| 359 | * Quality-of-Service (QOS) Commands & Responses: |
| 360 | * |
| 361 | *****************************************************************************/ |
| 362 | struct iwl_ac_qos { |
| 363 | __le16 cw_min; |
| 364 | __le16 cw_max; |
| 365 | u8 aifsn; |
| 366 | u8 reserved1; |
| 367 | __le16 edca_txop; |
| 368 | } __attribute__ ((packed)); |
| 369 | |
| 370 | /* QoS flags defines */ |
| 371 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) |
| 372 | #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) |
| 373 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) |
| 374 | |
| 375 | /* |
| 376 | * TXFIFO Queue number defines |
| 377 | */ |
| 378 | /* number of Access categories (AC) (EDCA), queues 0..3 */ |
| 379 | #define AC_NUM 4 |
| 380 | |
| 381 | /* |
| 382 | * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) |
| 383 | */ |
| 384 | struct iwl_qosparam_cmd { |
| 385 | __le32 qos_flags; |
| 386 | struct iwl_ac_qos ac[AC_NUM]; |
| 387 | } __attribute__ ((packed)); |
| 388 | |
| 389 | /****************************************************************************** |
| 390 | * (3) |
| 391 | * Add/Modify Stations Commands & Responses: |
| 392 | * |
| 393 | *****************************************************************************/ |
| 394 | /* |
| 395 | * Multi station support |
| 396 | */ |
| 397 | #define IWL_AP_ID 0 |
| 398 | #define IWL_MULTICAST_ID 1 |
| 399 | #define IWL_STA_ID 2 |
| 400 | |
| 401 | #define IWL3945_BROADCAST_ID 24 |
| 402 | #define IWL3945_STATION_COUNT 25 |
| 403 | |
| 404 | #define IWL4965_BROADCAST_ID 31 |
| 405 | #define IWL4965_STATION_COUNT 32 |
| 406 | |
| 407 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
| 408 | #define IWL_INVALID_STATION 255 |
| 409 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 410 | #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 411 | #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8); |
| 412 | |
| 413 | #define STA_CONTROL_MODIFY_MSK 0x01 |
| 414 | |
| 415 | /* key flags __le16*/ |
| 416 | #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7) |
| 417 | #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0) |
| 418 | #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1) |
| 419 | #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2) |
| 420 | #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3) |
| 421 | |
| 422 | #define STA_KEY_FLG_KEYID_POS 8 |
| 423 | #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) |
| 424 | |
| 425 | /* modify flags */ |
| 426 | #define STA_MODIFY_KEY_MASK 0x01 |
| 427 | #define STA_MODIFY_TID_DISABLE_TX 0x02 |
| 428 | #define STA_MODIFY_TX_RATE_MSK 0x04 |
| 429 | #define STA_MODIFY_ADDBA_TID_MSK 0x08 |
| 430 | #define STA_MODIFY_DELBA_TID_MSK 0x10 |
| 431 | #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) |
| 432 | |
| 433 | /* |
| 434 | * Antenna masks: |
| 435 | * bit14:15 01 B inactive, A active |
| 436 | * 10 B active, A inactive |
| 437 | * 11 Both active |
| 438 | */ |
| 439 | #define RATE_MCS_ANT_A_POS 14 |
| 440 | #define RATE_MCS_ANT_B_POS 15 |
| 441 | #define RATE_MCS_ANT_A_MSK 0x4000 |
| 442 | #define RATE_MCS_ANT_B_MSK 0x8000 |
| 443 | #define RATE_MCS_ANT_AB_MSK 0xc000 |
| 444 | |
| 445 | struct iwl_keyinfo { |
| 446 | __le16 key_flags; |
| 447 | u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ |
| 448 | u8 reserved1; |
| 449 | __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ |
| 450 | __le16 reserved2; |
| 451 | u8 key[16]; /* 16-byte unicast decryption key */ |
| 452 | } __attribute__ ((packed)); |
| 453 | |
| 454 | struct sta_id_modify { |
| 455 | u8 addr[ETH_ALEN]; |
| 456 | __le16 reserved1; |
| 457 | u8 sta_id; |
| 458 | u8 modify_mask; |
| 459 | __le16 reserved2; |
| 460 | } __attribute__ ((packed)); |
| 461 | |
| 462 | /* |
| 463 | * REPLY_ADD_STA = 0x18 (command) |
| 464 | */ |
| 465 | struct iwl_addsta_cmd { |
| 466 | u8 mode; |
| 467 | u8 reserved[3]; |
| 468 | struct sta_id_modify sta; |
| 469 | struct iwl_keyinfo key; |
| 470 | __le32 station_flags; |
| 471 | __le32 station_flags_msk; |
| 472 | __le16 tid_disable_tx; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 473 | __le16 rate_n_flags; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 474 | u8 add_immediate_ba_tid; |
| 475 | u8 remove_immediate_ba_tid; |
| 476 | __le16 add_immediate_ba_ssn; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 477 | } __attribute__ ((packed)); |
| 478 | |
| 479 | /* |
| 480 | * REPLY_ADD_STA = 0x18 (response) |
| 481 | */ |
| 482 | struct iwl_add_sta_resp { |
| 483 | u8 status; |
| 484 | } __attribute__ ((packed)); |
| 485 | |
| 486 | #define ADD_STA_SUCCESS_MSK 0x1 |
| 487 | |
| 488 | /****************************************************************************** |
| 489 | * (4) |
| 490 | * Rx Responses: |
| 491 | * |
| 492 | *****************************************************************************/ |
| 493 | |
| 494 | struct iwl_rx_frame_stats { |
| 495 | u8 phy_count; |
| 496 | u8 id; |
| 497 | u8 rssi; |
| 498 | u8 agc; |
| 499 | __le16 sig_avg; |
| 500 | __le16 noise_diff; |
| 501 | u8 payload[0]; |
| 502 | } __attribute__ ((packed)); |
| 503 | |
| 504 | struct iwl_rx_frame_hdr { |
| 505 | __le16 channel; |
| 506 | __le16 phy_flags; |
| 507 | u8 reserved1; |
| 508 | u8 rate; |
| 509 | __le16 len; |
| 510 | u8 payload[0]; |
| 511 | } __attribute__ ((packed)); |
| 512 | |
| 513 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) |
| 514 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) |
| 515 | |
| 516 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) |
| 517 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) |
| 518 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) |
| 519 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) |
| 520 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) |
| 521 | |
| 522 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
| 523 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
| 524 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) |
| 525 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) |
| 526 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) |
| 527 | |
| 528 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) |
| 529 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) |
| 530 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) |
| 531 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) |
| 532 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) |
| 533 | |
| 534 | struct iwl_rx_frame_end { |
| 535 | __le32 status; |
| 536 | __le64 timestamp; |
| 537 | __le32 beacon_timestamp; |
| 538 | } __attribute__ ((packed)); |
| 539 | |
| 540 | /* |
| 541 | * REPLY_3945_RX = 0x1b (response only, not a command) |
| 542 | * |
| 543 | * NOTE: DO NOT dereference from casts to this structure |
| 544 | * It is provided only for calculating minimum data set size. |
| 545 | * The actual offsets of the hdr and end are dynamic based on |
| 546 | * stats.phy_count |
| 547 | */ |
| 548 | struct iwl_rx_frame { |
| 549 | struct iwl_rx_frame_stats stats; |
| 550 | struct iwl_rx_frame_hdr hdr; |
| 551 | struct iwl_rx_frame_end end; |
| 552 | } __attribute__ ((packed)); |
| 553 | |
| 554 | /* Fixed (non-configurable) rx data from phy */ |
| 555 | #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) |
| 556 | #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) |
| 557 | #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ |
| 558 | #define IWL_AGC_DB_POS (7) |
| 559 | struct iwl4965_rx_non_cfg_phy { |
| 560 | __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ |
| 561 | __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ |
| 562 | u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ |
| 563 | u8 pad[0]; |
| 564 | } __attribute__ ((packed)); |
| 565 | |
| 566 | /* |
| 567 | * REPLY_4965_RX = 0xc3 (response only, not a command) |
| 568 | * Used only for legacy (non 11n) frames. |
| 569 | */ |
| 570 | #define RX_RES_PHY_CNT 14 |
| 571 | struct iwl4965_rx_phy_res { |
| 572 | u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ |
| 573 | u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ |
| 574 | u8 stat_id; /* configurable DSP phy data set ID */ |
| 575 | u8 reserved1; |
| 576 | __le64 timestamp; /* TSF at on air rise */ |
| 577 | __le32 beacon_time_stamp; /* beacon at on-air rise */ |
| 578 | __le16 phy_flags; /* general phy flags: band, modulation, ... */ |
| 579 | __le16 channel; /* channel number */ |
| 580 | __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ |
| 581 | __le32 reserved2; |
| 582 | __le32 rate_n_flags; |
| 583 | __le16 byte_count; /* frame's byte-count */ |
| 584 | __le16 reserved3; |
| 585 | } __attribute__ ((packed)); |
| 586 | |
| 587 | struct iwl4965_rx_mpdu_res_start { |
| 588 | __le16 byte_count; |
| 589 | __le16 reserved; |
| 590 | } __attribute__ ((packed)); |
| 591 | |
| 592 | |
| 593 | /****************************************************************************** |
| 594 | * (5) |
| 595 | * Tx Commands & Responses: |
| 596 | * |
| 597 | *****************************************************************************/ |
| 598 | |
| 599 | /* Tx flags */ |
| 600 | #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) |
| 601 | #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) |
| 602 | #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) |
| 603 | #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) |
| 604 | #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) |
| 605 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) |
| 606 | #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) |
| 607 | #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) |
| 608 | #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) |
| 609 | |
| 610 | /* ucode ignores BT priority for this frame */ |
| 611 | #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) |
| 612 | |
| 613 | /* ucode overrides sequence control */ |
| 614 | #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) |
| 615 | |
| 616 | /* signal that this frame is non-last MPDU */ |
| 617 | #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) |
| 618 | |
| 619 | /* calculate TSF in outgoing frame */ |
| 620 | #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) |
| 621 | |
| 622 | /* activate TX calibration. */ |
| 623 | #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17) |
| 624 | |
| 625 | /* signals that 2 bytes pad was inserted |
| 626 | after the MAC header */ |
| 627 | #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) |
| 628 | |
| 629 | /* HCCA-AP - disable duration overwriting. */ |
| 630 | #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) |
| 631 | |
| 632 | /* |
| 633 | * TX command security control |
| 634 | */ |
| 635 | #define TX_CMD_SEC_WEP 0x01 |
| 636 | #define TX_CMD_SEC_CCM 0x02 |
| 637 | #define TX_CMD_SEC_TKIP 0x03 |
| 638 | #define TX_CMD_SEC_MSK 0x03 |
| 639 | #define TX_CMD_SEC_SHIFT 6 |
| 640 | #define TX_CMD_SEC_KEY128 0x08 |
| 641 | |
| 642 | /* |
| 643 | * TX command Frame life time |
| 644 | */ |
| 645 | |
| 646 | struct iwl_dram_scratch { |
| 647 | u8 try_cnt; |
| 648 | u8 bt_kill_cnt; |
| 649 | __le16 reserved; |
| 650 | } __attribute__ ((packed)); |
| 651 | |
| 652 | /* |
| 653 | * REPLY_TX = 0x1c (command) |
| 654 | */ |
| 655 | struct iwl_tx_cmd { |
| 656 | __le16 len; |
| 657 | __le16 next_frame_len; |
| 658 | __le32 tx_flags; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 659 | u8 rate; |
| 660 | u8 sta_id; |
| 661 | u8 tid_tspec; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 662 | u8 sec_ctl; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 663 | u8 key[16]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 664 | union { |
| 665 | u8 byte[8]; |
| 666 | __le16 word[4]; |
| 667 | __le32 dw[2]; |
| 668 | } tkip_mic; |
| 669 | __le32 next_frame_info; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 670 | union { |
| 671 | __le32 life_time; |
| 672 | __le32 attempt; |
| 673 | } stop_time; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 674 | u8 supp_rates[2]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 675 | u8 rts_retry_limit; /*byte 50 */ |
| 676 | u8 data_retry_limit; /*byte 51 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 677 | union { |
| 678 | __le16 pm_frame_timeout; |
| 679 | __le16 attempt_duration; |
| 680 | } timeout; |
| 681 | __le16 driver_txop; |
| 682 | u8 payload[0]; |
| 683 | struct ieee80211_hdr hdr[0]; |
| 684 | } __attribute__ ((packed)); |
| 685 | |
| 686 | /* TX command response is sent after *all* transmission attempts. |
| 687 | * |
| 688 | * NOTES: |
| 689 | * |
| 690 | * TX_STATUS_FAIL_NEXT_FRAG |
| 691 | * |
| 692 | * If the fragment flag in the MAC header for the frame being transmitted |
| 693 | * is set and there is insufficient time to transmit the next frame, the |
| 694 | * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. |
| 695 | * |
| 696 | * TX_STATUS_FIFO_UNDERRUN |
| 697 | * |
| 698 | * Indicates the host did not provide bytes to the FIFO fast enough while |
| 699 | * a TX was in progress. |
| 700 | * |
| 701 | * TX_STATUS_FAIL_MGMNT_ABORT |
| 702 | * |
| 703 | * This status is only possible if the ABORT ON MGMT RX parameter was |
| 704 | * set to true with the TX command. |
| 705 | * |
| 706 | * If the MSB of the status parameter is set then an abort sequence is |
| 707 | * required. This sequence consists of the host activating the TX Abort |
| 708 | * control line, and then waiting for the TX Abort command response. This |
| 709 | * indicates that a the device is no longer in a transmit state, and that the |
| 710 | * command FIFO has been cleared. The host must then deactivate the TX Abort |
| 711 | * control line. Receiving is still allowed in this case. |
| 712 | */ |
| 713 | enum { |
| 714 | TX_STATUS_SUCCESS = 0x01, |
| 715 | TX_STATUS_DIRECT_DONE = 0x02, |
| 716 | TX_STATUS_FAIL_SHORT_LIMIT = 0x82, |
| 717 | TX_STATUS_FAIL_LONG_LIMIT = 0x83, |
| 718 | TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, |
| 719 | TX_STATUS_FAIL_MGMNT_ABORT = 0x85, |
| 720 | TX_STATUS_FAIL_NEXT_FRAG = 0x86, |
| 721 | TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, |
| 722 | TX_STATUS_FAIL_DEST_PS = 0x88, |
| 723 | TX_STATUS_FAIL_ABORTED = 0x89, |
| 724 | TX_STATUS_FAIL_BT_RETRY = 0x8a, |
| 725 | TX_STATUS_FAIL_STA_INVALID = 0x8b, |
| 726 | TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, |
| 727 | TX_STATUS_FAIL_TID_DISABLE = 0x8d, |
| 728 | TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, |
| 729 | TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, |
| 730 | TX_STATUS_FAIL_TX_LOCKED = 0x90, |
| 731 | TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, |
| 732 | }; |
| 733 | |
| 734 | #define TX_PACKET_MODE_REGULAR 0x0000 |
| 735 | #define TX_PACKET_MODE_BURST_SEQ 0x0100 |
| 736 | #define TX_PACKET_MODE_BURST_FIRST 0x0200 |
| 737 | |
| 738 | enum { |
| 739 | TX_POWER_PA_NOT_ACTIVE = 0x0, |
| 740 | }; |
| 741 | |
| 742 | enum { |
| 743 | TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ |
| 744 | TX_STATUS_DELAY_MSK = 0x00000040, |
| 745 | TX_STATUS_ABORT_MSK = 0x00000080, |
| 746 | TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ |
| 747 | TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ |
| 748 | TX_RESERVED = 0x00780000, /* bits 19:22 */ |
| 749 | TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ |
| 750 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ |
| 751 | }; |
| 752 | |
| 753 | /* ******************************* |
| 754 | * TX aggregation state |
| 755 | ******************************* */ |
| 756 | |
| 757 | enum { |
| 758 | AGG_TX_STATE_TRANSMITTED = 0x00, |
| 759 | AGG_TX_STATE_UNDERRUN_MSK = 0x01, |
| 760 | AGG_TX_STATE_BT_PRIO_MSK = 0x02, |
| 761 | AGG_TX_STATE_FEW_BYTES_MSK = 0x04, |
| 762 | AGG_TX_STATE_ABORT_MSK = 0x08, |
| 763 | AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, |
| 764 | AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, |
| 765 | AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, |
| 766 | AGG_TX_STATE_SCD_QUERY_MSK = 0x80, |
| 767 | AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, |
| 768 | AGG_TX_STATE_RESPONSE_MSK = 0x1ff, |
| 769 | AGG_TX_STATE_DUMP_TX_MSK = 0x200, |
| 770 | AGG_TX_STATE_DELAY_TX_MSK = 0x400 |
| 771 | }; |
| 772 | |
| 773 | #define AGG_TX_STATE_LAST_SENT_MSK \ |
| 774 | (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ |
| 775 | AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ |
| 776 | AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) |
| 777 | |
| 778 | #define AGG_TX_STATE_TRY_CNT_POS 12 |
| 779 | #define AGG_TX_STATE_TRY_CNT_MSK 0xf000 |
| 780 | |
| 781 | #define AGG_TX_STATE_SEQ_NUM_POS 16 |
| 782 | #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 |
| 783 | |
| 784 | /* |
| 785 | * REPLY_TX = 0x1c (response) |
| 786 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 787 | struct iwl_tx_resp { |
| 788 | u8 failure_rts; |
| 789 | u8 failure_frame; |
| 790 | u8 bt_kill_count; |
| 791 | u8 rate; |
| 792 | __le32 wireless_media_time; |
| 793 | __le32 status; /* TX status (for aggregation status of 1st frame) */ |
| 794 | } __attribute__ ((packed)); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 795 | |
| 796 | /* |
| 797 | * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) |
| 798 | */ |
| 799 | struct iwl_compressed_ba_resp { |
| 800 | __le32 sta_addr_lo32; |
| 801 | __le16 sta_addr_hi16; |
| 802 | __le16 reserved; |
| 803 | u8 sta_id; |
| 804 | u8 tid; |
| 805 | __le16 ba_seq_ctl; |
| 806 | __le32 ba_bitmap0; |
| 807 | __le32 ba_bitmap1; |
| 808 | __le16 scd_flow; |
| 809 | __le16 scd_ssn; |
| 810 | } __attribute__ ((packed)); |
| 811 | |
| 812 | /* |
| 813 | * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) |
| 814 | */ |
| 815 | struct iwl_txpowertable_cmd { |
| 816 | u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ |
| 817 | u8 reserved; |
| 818 | __le16 channel; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 819 | struct iwl_power_per_rate power[IWL_MAX_RATES]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 820 | } __attribute__ ((packed)); |
| 821 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 822 | struct iwl_rate_scaling_info { |
| 823 | __le16 rate_n_flags; |
| 824 | u8 try_cnt; |
| 825 | u8 next_rate_index; |
| 826 | } __attribute__ ((packed)); |
| 827 | |
| 828 | /** |
| 829 | * struct iwl_rate_scaling_cmd - Rate Scaling Command & Response |
| 830 | * |
| 831 | * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) |
| 832 | * |
| 833 | * NOTE: The table of rates passed to the uCode via the |
| 834 | * RATE_SCALE command sets up the corresponding order of |
| 835 | * rates used for all related commands, including rate |
| 836 | * masks, etc. |
| 837 | * |
| 838 | * For example, if you set 9MB (PLCP 0x0f) as the first |
| 839 | * rate in the rate table, the bit mask for that rate |
| 840 | * when passed through ofdm_basic_rates on the REPLY_RXON |
| 841 | * command would be bit 0 (1<<0) |
| 842 | */ |
| 843 | struct iwl_rate_scaling_cmd { |
| 844 | u8 table_id; |
| 845 | u8 reserved[3]; |
| 846 | struct iwl_rate_scaling_info table[IWL_MAX_RATES]; |
| 847 | } __attribute__ ((packed)); |
| 848 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 849 | /* |
| 850 | * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) |
| 851 | */ |
| 852 | struct iwl_bt_cmd { |
| 853 | u8 flags; |
| 854 | u8 lead_time; |
| 855 | u8 max_kill; |
| 856 | u8 reserved; |
| 857 | __le32 kill_ack_mask; |
| 858 | __le32 kill_cts_mask; |
| 859 | } __attribute__ ((packed)); |
| 860 | |
| 861 | /****************************************************************************** |
| 862 | * (6) |
| 863 | * Spectrum Management (802.11h) Commands, Responses, Notifications: |
| 864 | * |
| 865 | *****************************************************************************/ |
| 866 | |
| 867 | /* |
| 868 | * Spectrum Management |
| 869 | */ |
| 870 | #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ |
| 871 | RXON_FILTER_CTL2HOST_MSK | \ |
| 872 | RXON_FILTER_ACCEPT_GRP_MSK | \ |
| 873 | RXON_FILTER_DIS_DECRYPT_MSK | \ |
| 874 | RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ |
| 875 | RXON_FILTER_ASSOC_MSK | \ |
| 876 | RXON_FILTER_BCON_AWARE_MSK) |
| 877 | |
| 878 | struct iwl_measure_channel { |
| 879 | __le32 duration; /* measurement duration in extended beacon |
| 880 | * format */ |
| 881 | u8 channel; /* channel to measure */ |
| 882 | u8 type; /* see enum iwl_measure_type */ |
| 883 | __le16 reserved; |
| 884 | } __attribute__ ((packed)); |
| 885 | |
| 886 | /* |
| 887 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) |
| 888 | */ |
| 889 | struct iwl_spectrum_cmd { |
| 890 | __le16 len; /* number of bytes starting from token */ |
| 891 | u8 token; /* token id */ |
| 892 | u8 id; /* measurement id -- 0 or 1 */ |
| 893 | u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ |
| 894 | u8 periodic; /* 1 = periodic */ |
| 895 | __le16 path_loss_timeout; |
| 896 | __le32 start_time; /* start time in extended beacon format */ |
| 897 | __le32 reserved2; |
| 898 | __le32 flags; /* rxon flags */ |
| 899 | __le32 filter_flags; /* rxon filter flags */ |
| 900 | __le16 channel_count; /* minimum 1, maximum 10 */ |
| 901 | __le16 reserved3; |
| 902 | struct iwl_measure_channel channels[10]; |
| 903 | } __attribute__ ((packed)); |
| 904 | |
| 905 | /* |
| 906 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) |
| 907 | */ |
| 908 | struct iwl_spectrum_resp { |
| 909 | u8 token; |
| 910 | u8 id; /* id of the prior command replaced, or 0xff */ |
| 911 | __le16 status; /* 0 - command will be handled |
| 912 | * 1 - cannot handle (conflicts with another |
| 913 | * measurement) */ |
| 914 | } __attribute__ ((packed)); |
| 915 | |
| 916 | enum iwl_measurement_state { |
| 917 | IWL_MEASUREMENT_START = 0, |
| 918 | IWL_MEASUREMENT_STOP = 1, |
| 919 | }; |
| 920 | |
| 921 | enum iwl_measurement_status { |
| 922 | IWL_MEASUREMENT_OK = 0, |
| 923 | IWL_MEASUREMENT_CONCURRENT = 1, |
| 924 | IWL_MEASUREMENT_CSA_CONFLICT = 2, |
| 925 | IWL_MEASUREMENT_TGH_CONFLICT = 3, |
| 926 | /* 4-5 reserved */ |
| 927 | IWL_MEASUREMENT_STOPPED = 6, |
| 928 | IWL_MEASUREMENT_TIMEOUT = 7, |
| 929 | IWL_MEASUREMENT_PERIODIC_FAILED = 8, |
| 930 | }; |
| 931 | |
| 932 | #define NUM_ELEMENTS_IN_HISTOGRAM 8 |
| 933 | |
| 934 | struct iwl_measurement_histogram { |
| 935 | __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ |
| 936 | __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ |
| 937 | } __attribute__ ((packed)); |
| 938 | |
| 939 | /* clear channel availability counters */ |
| 940 | struct iwl_measurement_cca_counters { |
| 941 | __le32 ofdm; |
| 942 | __le32 cck; |
| 943 | } __attribute__ ((packed)); |
| 944 | |
| 945 | enum iwl_measure_type { |
| 946 | IWL_MEASURE_BASIC = (1 << 0), |
| 947 | IWL_MEASURE_CHANNEL_LOAD = (1 << 1), |
| 948 | IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), |
| 949 | IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), |
| 950 | IWL_MEASURE_FRAME = (1 << 4), |
| 951 | /* bits 5:6 are reserved */ |
| 952 | IWL_MEASURE_IDLE = (1 << 7), |
| 953 | }; |
| 954 | |
| 955 | /* |
| 956 | * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) |
| 957 | */ |
| 958 | struct iwl_spectrum_notification { |
| 959 | u8 id; /* measurement id -- 0 or 1 */ |
| 960 | u8 token; |
| 961 | u8 channel_index; /* index in measurement channel list */ |
| 962 | u8 state; /* 0 - start, 1 - stop */ |
| 963 | __le32 start_time; /* lower 32-bits of TSF */ |
| 964 | u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ |
| 965 | u8 channel; |
| 966 | u8 type; /* see enum iwl_measurement_type */ |
| 967 | u8 reserved1; |
| 968 | /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only |
| 969 | * valid if applicable for measurement type requested. */ |
| 970 | __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ |
| 971 | __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ |
| 972 | __le32 cca_time; /* channel load time in usecs */ |
| 973 | u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - |
| 974 | * unidentified */ |
| 975 | u8 reserved2[3]; |
| 976 | struct iwl_measurement_histogram histogram; |
| 977 | __le32 stop_time; /* lower 32-bits of TSF */ |
| 978 | __le32 status; /* see iwl_measurement_status */ |
| 979 | } __attribute__ ((packed)); |
| 980 | |
| 981 | /****************************************************************************** |
| 982 | * (7) |
| 983 | * Power Management Commands, Responses, Notifications: |
| 984 | * |
| 985 | *****************************************************************************/ |
| 986 | |
| 987 | /** |
| 988 | * struct iwl_powertable_cmd - Power Table Command |
| 989 | * @flags: See below: |
| 990 | * |
| 991 | * POWER_TABLE_CMD = 0x77 (command, has simple generic response) |
| 992 | * |
| 993 | * PM allow: |
| 994 | * bit 0 - '0' Driver not allow power management |
| 995 | * '1' Driver allow PM (use rest of parameters) |
| 996 | * uCode send sleep notifications: |
| 997 | * bit 1 - '0' Don't send sleep notification |
| 998 | * '1' send sleep notification (SEND_PM_NOTIFICATION) |
| 999 | * Sleep over DTIM |
| 1000 | * bit 2 - '0' PM have to walk up every DTIM |
| 1001 | * '1' PM could sleep over DTIM till listen Interval. |
| 1002 | * PCI power managed |
| 1003 | * bit 3 - '0' (PCI_LINK_CTRL & 0x1) |
| 1004 | * '1' !(PCI_LINK_CTRL & 0x1) |
| 1005 | * Force sleep Modes |
| 1006 | * bit 31/30- '00' use both mac/xtal sleeps |
| 1007 | * '01' force Mac sleep |
| 1008 | * '10' force xtal sleep |
| 1009 | * '11' Illegal set |
| 1010 | * |
| 1011 | * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then |
| 1012 | * ucode assume sleep over DTIM is allowed and we don't need to wakeup |
| 1013 | * for every DTIM. |
| 1014 | */ |
| 1015 | #define IWL_POWER_VEC_SIZE 5 |
| 1016 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1017 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0) |
| 1018 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2) |
| 1019 | #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3) |
| 1020 | struct iwl_powertable_cmd { |
| 1021 | __le32 flags; |
| 1022 | __le32 rx_data_timeout; |
| 1023 | __le32 tx_data_timeout; |
| 1024 | __le32 sleep_interval[IWL_POWER_VEC_SIZE]; |
| 1025 | } __attribute__((packed)); |
| 1026 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1027 | /* |
| 1028 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) |
| 1029 | * 3945 and 4965 identical. |
| 1030 | */ |
| 1031 | struct iwl_sleep_notification { |
| 1032 | u8 pm_sleep_mode; |
| 1033 | u8 pm_wakeup_src; |
| 1034 | __le16 reserved; |
| 1035 | __le32 sleep_time; |
| 1036 | __le32 tsf_low; |
| 1037 | __le32 bcon_timer; |
| 1038 | } __attribute__ ((packed)); |
| 1039 | |
| 1040 | /* Sleep states. 3945 and 4965 identical. */ |
| 1041 | enum { |
| 1042 | IWL_PM_NO_SLEEP = 0, |
| 1043 | IWL_PM_SLP_MAC = 1, |
| 1044 | IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, |
| 1045 | IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, |
| 1046 | IWL_PM_SLP_PHY = 4, |
| 1047 | IWL_PM_SLP_REPENT = 5, |
| 1048 | IWL_PM_WAKEUP_BY_TIMER = 6, |
| 1049 | IWL_PM_WAKEUP_BY_DRIVER = 7, |
| 1050 | IWL_PM_WAKEUP_BY_RFKILL = 8, |
| 1051 | /* 3 reserved */ |
| 1052 | IWL_PM_NUM_OF_MODES = 12, |
| 1053 | }; |
| 1054 | |
| 1055 | /* |
| 1056 | * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) |
| 1057 | */ |
| 1058 | #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ |
| 1059 | #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ |
| 1060 | #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ |
| 1061 | struct iwl_card_state_cmd { |
| 1062 | __le32 status; /* CARD_STATE_CMD_* request new power state */ |
| 1063 | } __attribute__ ((packed)); |
| 1064 | |
| 1065 | /* |
| 1066 | * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) |
| 1067 | */ |
| 1068 | struct iwl_card_state_notif { |
| 1069 | __le32 flags; |
| 1070 | } __attribute__ ((packed)); |
| 1071 | |
| 1072 | #define HW_CARD_DISABLED 0x01 |
| 1073 | #define SW_CARD_DISABLED 0x02 |
| 1074 | #define RF_CARD_DISABLED 0x04 |
| 1075 | #define RXON_CARD_DISABLED 0x10 |
| 1076 | |
| 1077 | struct iwl_ct_kill_config { |
| 1078 | __le32 reserved; |
| 1079 | __le32 critical_temperature_M; |
| 1080 | __le32 critical_temperature_R; |
| 1081 | } __attribute__ ((packed)); |
| 1082 | |
| 1083 | /****************************************************************************** |
| 1084 | * (8) |
| 1085 | * Scan Commands, Responses, Notifications: |
| 1086 | * |
| 1087 | *****************************************************************************/ |
| 1088 | |
| 1089 | struct iwl_scan_channel { |
| 1090 | /* type is defined as: |
| 1091 | * 0:0 active (0 - passive) |
| 1092 | * 1:4 SSID direct |
| 1093 | * If 1 is set then corresponding SSID IE is transmitted in probe |
| 1094 | * 5:7 reserved |
| 1095 | */ |
| 1096 | u8 type; |
| 1097 | u8 channel; |
| 1098 | struct iwl_tx_power tpc; |
| 1099 | __le16 active_dwell; |
| 1100 | __le16 passive_dwell; |
| 1101 | } __attribute__ ((packed)); |
| 1102 | |
| 1103 | struct iwl_ssid_ie { |
| 1104 | u8 id; |
| 1105 | u8 len; |
| 1106 | u8 ssid[32]; |
| 1107 | } __attribute__ ((packed)); |
| 1108 | |
| 1109 | #define PROBE_OPTION_MAX 0x4 |
| 1110 | #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) |
| 1111 | #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) |
| 1112 | #define IWL_MAX_SCAN_SIZE 1024 |
| 1113 | |
| 1114 | /* |
| 1115 | * REPLY_SCAN_CMD = 0x80 (command) |
| 1116 | */ |
| 1117 | struct iwl_scan_cmd { |
| 1118 | __le16 len; |
| 1119 | u8 reserved0; |
| 1120 | u8 channel_count; |
| 1121 | __le16 quiet_time; /* dwell only this long on quiet chnl |
| 1122 | * (active scan) */ |
| 1123 | __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ |
| 1124 | __le16 good_CRC_th; /* passive -> active promotion threshold */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1125 | __le16 reserved1; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1126 | __le32 max_out_time; /* max usec to be out of associated (service) |
| 1127 | * chnl */ |
| 1128 | __le32 suspend_time; /* pause scan this long when returning to svc |
| 1129 | * chnl. |
| 1130 | * 3945 -- 31:24 # beacons, 19:0 additional usec, |
| 1131 | * 4965 -- 31:22 # beacons, 21:0 additional usec. |
| 1132 | */ |
| 1133 | __le32 flags; |
| 1134 | __le32 filter_flags; |
| 1135 | |
| 1136 | struct iwl_tx_cmd tx_cmd; |
| 1137 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
| 1138 | |
| 1139 | u8 data[0]; |
| 1140 | /* |
| 1141 | * The channels start after the probe request payload and are of type: |
| 1142 | * |
| 1143 | * struct iwl_scan_channel channels[0]; |
| 1144 | * |
| 1145 | * NOTE: Only one band of channels can be scanned per pass. You |
| 1146 | * can not mix 2.4GHz channels and 5.2GHz channels and must |
| 1147 | * request a scan multiple times (not concurrently) |
| 1148 | * |
| 1149 | */ |
| 1150 | } __attribute__ ((packed)); |
| 1151 | |
| 1152 | /* Can abort will notify by complete notification with abort status. */ |
| 1153 | #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) |
| 1154 | /* complete notification statuses */ |
| 1155 | #define ABORT_STATUS 0x2 |
| 1156 | |
| 1157 | /* |
| 1158 | * REPLY_SCAN_CMD = 0x80 (response) |
| 1159 | */ |
| 1160 | struct iwl_scanreq_notification { |
| 1161 | __le32 status; /* 1: okay, 2: cannot fulfill request */ |
| 1162 | } __attribute__ ((packed)); |
| 1163 | |
| 1164 | /* |
| 1165 | * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) |
| 1166 | */ |
| 1167 | struct iwl_scanstart_notification { |
| 1168 | __le32 tsf_low; |
| 1169 | __le32 tsf_high; |
| 1170 | __le32 beacon_timer; |
| 1171 | u8 channel; |
| 1172 | u8 band; |
| 1173 | u8 reserved[2]; |
| 1174 | __le32 status; |
| 1175 | } __attribute__ ((packed)); |
| 1176 | |
| 1177 | #define SCAN_OWNER_STATUS 0x1; |
| 1178 | #define MEASURE_OWNER_STATUS 0x2; |
| 1179 | |
| 1180 | #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ |
| 1181 | /* |
| 1182 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) |
| 1183 | */ |
| 1184 | struct iwl_scanresults_notification { |
| 1185 | u8 channel; |
| 1186 | u8 band; |
| 1187 | u8 reserved[2]; |
| 1188 | __le32 tsf_low; |
| 1189 | __le32 tsf_high; |
| 1190 | __le32 statistics[NUMBER_OF_STATISTICS]; |
| 1191 | } __attribute__ ((packed)); |
| 1192 | |
| 1193 | /* |
| 1194 | * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) |
| 1195 | */ |
| 1196 | struct iwl_scancomplete_notification { |
| 1197 | u8 scanned_channels; |
| 1198 | u8 status; |
| 1199 | u8 reserved; |
| 1200 | u8 last_channel; |
| 1201 | __le32 tsf_low; |
| 1202 | __le32 tsf_high; |
| 1203 | } __attribute__ ((packed)); |
| 1204 | |
| 1205 | |
| 1206 | /****************************************************************************** |
| 1207 | * (9) |
| 1208 | * IBSS/AP Commands and Notifications: |
| 1209 | * |
| 1210 | *****************************************************************************/ |
| 1211 | |
| 1212 | /* |
| 1213 | * BEACON_NOTIFICATION = 0x90 (notification only, not a command) |
| 1214 | */ |
| 1215 | struct iwl_beacon_notif { |
| 1216 | struct iwl_tx_resp beacon_notify_hdr; |
| 1217 | __le32 low_tsf; |
| 1218 | __le32 high_tsf; |
| 1219 | __le32 ibss_mgr_status; |
| 1220 | } __attribute__ ((packed)); |
| 1221 | |
| 1222 | /* |
| 1223 | * REPLY_TX_BEACON = 0x91 (command, has simple generic response) |
| 1224 | */ |
| 1225 | struct iwl_tx_beacon_cmd { |
| 1226 | struct iwl_tx_cmd tx; |
| 1227 | __le16 tim_idx; |
| 1228 | u8 tim_size; |
| 1229 | u8 reserved1; |
| 1230 | struct ieee80211_hdr frame[0]; /* beacon frame */ |
| 1231 | } __attribute__ ((packed)); |
| 1232 | |
| 1233 | /****************************************************************************** |
| 1234 | * (10) |
| 1235 | * Statistics Commands and Notifications: |
| 1236 | * |
| 1237 | *****************************************************************************/ |
| 1238 | |
| 1239 | #define IWL_TEMP_CONVERT 260 |
| 1240 | |
| 1241 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 |
| 1242 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 |
| 1243 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 |
| 1244 | |
| 1245 | /* Used for passing to driver number of successes and failures per rate */ |
| 1246 | struct rate_histogram { |
| 1247 | union { |
| 1248 | __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
| 1249 | __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
| 1250 | __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; |
| 1251 | } success; |
| 1252 | union { |
| 1253 | __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
| 1254 | __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
| 1255 | __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; |
| 1256 | } failed; |
| 1257 | } __attribute__ ((packed)); |
| 1258 | |
| 1259 | /* statistics command response */ |
| 1260 | |
| 1261 | struct statistics_rx_phy { |
| 1262 | __le32 ina_cnt; |
| 1263 | __le32 fina_cnt; |
| 1264 | __le32 plcp_err; |
| 1265 | __le32 crc32_err; |
| 1266 | __le32 overrun_err; |
| 1267 | __le32 early_overrun_err; |
| 1268 | __le32 crc32_good; |
| 1269 | __le32 false_alarm_cnt; |
| 1270 | __le32 fina_sync_err_cnt; |
| 1271 | __le32 sfd_timeout; |
| 1272 | __le32 fina_timeout; |
| 1273 | __le32 unresponded_rts; |
| 1274 | __le32 rxe_frame_limit_overrun; |
| 1275 | __le32 sent_ack_cnt; |
| 1276 | __le32 sent_cts_cnt; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1277 | } __attribute__ ((packed)); |
| 1278 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1279 | struct statistics_rx_non_phy { |
| 1280 | __le32 bogus_cts; /* CTS received when not expecting CTS */ |
| 1281 | __le32 bogus_ack; /* ACK received when not expecting ACK */ |
| 1282 | __le32 non_bssid_frames; /* number of frames with BSSID that |
| 1283 | * doesn't belong to the STA BSSID */ |
| 1284 | __le32 filtered_frames; /* count frames that were dumped in the |
| 1285 | * filtering process */ |
| 1286 | __le32 non_channel_beacons; /* beacons with our bss id but not on |
| 1287 | * our serving channel */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1288 | } __attribute__ ((packed)); |
| 1289 | |
| 1290 | struct statistics_rx { |
| 1291 | struct statistics_rx_phy ofdm; |
| 1292 | struct statistics_rx_phy cck; |
| 1293 | struct statistics_rx_non_phy general; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1294 | } __attribute__ ((packed)); |
| 1295 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1296 | struct statistics_tx { |
| 1297 | __le32 preamble_cnt; |
| 1298 | __le32 rx_detected_cnt; |
| 1299 | __le32 bt_prio_defer_cnt; |
| 1300 | __le32 bt_prio_kill_cnt; |
| 1301 | __le32 few_bytes_cnt; |
| 1302 | __le32 cts_timeout; |
| 1303 | __le32 ack_timeout; |
| 1304 | __le32 expected_ack_cnt; |
| 1305 | __le32 actual_ack_cnt; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1306 | } __attribute__ ((packed)); |
| 1307 | |
| 1308 | struct statistics_dbg { |
| 1309 | __le32 burst_check; |
| 1310 | __le32 burst_count; |
| 1311 | __le32 reserved[4]; |
| 1312 | } __attribute__ ((packed)); |
| 1313 | |
| 1314 | struct statistics_div { |
| 1315 | __le32 tx_on_a; |
| 1316 | __le32 tx_on_b; |
| 1317 | __le32 exec_time; |
| 1318 | __le32 probe_time; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1319 | } __attribute__ ((packed)); |
| 1320 | |
| 1321 | struct statistics_general { |
| 1322 | __le32 temperature; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1323 | struct statistics_dbg dbg; |
| 1324 | __le32 sleep_time; |
| 1325 | __le32 slots_out; |
| 1326 | __le32 slots_idle; |
| 1327 | __le32 ttl_timestamp; |
| 1328 | struct statistics_div div; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1329 | } __attribute__ ((packed)); |
| 1330 | |
| 1331 | /* |
| 1332 | * REPLY_STATISTICS_CMD = 0x9c, |
| 1333 | * 3945 and 4965 identical. |
| 1334 | * |
| 1335 | * This command triggers an immediate response containing uCode statistics. |
| 1336 | * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. |
| 1337 | * |
| 1338 | * If the CLEAR_STATS configuration flag is set, uCode will clear its |
| 1339 | * internal copy of the statistics (counters) after issuing the response. |
| 1340 | * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). |
| 1341 | * |
| 1342 | * If the DISABLE_NOTIF configuration flag is set, uCode will not issue |
| 1343 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag |
| 1344 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. |
| 1345 | */ |
| 1346 | #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ |
| 1347 | #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ |
| 1348 | struct iwl_statistics_cmd { |
| 1349 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ |
| 1350 | } __attribute__ ((packed)); |
| 1351 | |
| 1352 | /* |
| 1353 | * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) |
| 1354 | * |
| 1355 | * By default, uCode issues this notification after receiving a beacon |
| 1356 | * while associated. To disable this behavior, set DISABLE_NOTIF flag in the |
| 1357 | * REPLY_STATISTICS_CMD 0x9c, above. |
| 1358 | * |
| 1359 | * Statistics counters continue to increment beacon after beacon, but are |
| 1360 | * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD |
| 1361 | * 0x9c with CLEAR_STATS bit set (see above). |
| 1362 | * |
| 1363 | * uCode also issues this notification during scans. uCode clears statistics |
| 1364 | * appropriately so that each notification contains statistics for only the |
| 1365 | * one channel that has just been scanned. |
| 1366 | */ |
| 1367 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) |
| 1368 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) |
| 1369 | struct iwl_notif_statistics { |
| 1370 | __le32 flag; |
| 1371 | struct statistics_rx rx; |
| 1372 | struct statistics_tx tx; |
| 1373 | struct statistics_general general; |
| 1374 | } __attribute__ ((packed)); |
| 1375 | |
| 1376 | |
| 1377 | /* |
| 1378 | * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) |
| 1379 | */ |
| 1380 | /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, |
| 1381 | * then this notification will be sent. */ |
| 1382 | #define CONSECUTIVE_MISSED_BCONS_TH 20 |
| 1383 | |
| 1384 | struct iwl_missed_beacon_notif { |
| 1385 | __le32 consequtive_missed_beacons; |
| 1386 | __le32 total_missed_becons; |
| 1387 | __le32 num_expected_beacons; |
| 1388 | __le32 num_recvd_beacons; |
| 1389 | } __attribute__ ((packed)); |
| 1390 | |
| 1391 | /****************************************************************************** |
| 1392 | * (11) |
| 1393 | * Rx Calibration Commands: |
| 1394 | * |
| 1395 | *****************************************************************************/ |
| 1396 | |
| 1397 | #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) |
| 1398 | #define HD_TABLE_SIZE (11) |
| 1399 | |
| 1400 | struct iwl_sensitivity_cmd { |
| 1401 | __le16 control; |
| 1402 | __le16 table[HD_TABLE_SIZE]; |
| 1403 | } __attribute__ ((packed)); |
| 1404 | |
| 1405 | struct iwl_calibration_cmd { |
| 1406 | u8 opCode; |
| 1407 | u8 flags; |
| 1408 | __le16 reserved; |
| 1409 | s8 diff_gain_a; |
| 1410 | s8 diff_gain_b; |
| 1411 | s8 diff_gain_c; |
| 1412 | u8 reserved1; |
| 1413 | } __attribute__ ((packed)); |
| 1414 | |
| 1415 | /****************************************************************************** |
| 1416 | * (12) |
| 1417 | * Miscellaneous Commands: |
| 1418 | * |
| 1419 | *****************************************************************************/ |
| 1420 | |
| 1421 | /* |
| 1422 | * LEDs Command & Response |
| 1423 | * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) |
| 1424 | * |
| 1425 | * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), |
| 1426 | * this command turns it on or off, or sets up a periodic blinking cycle. |
| 1427 | */ |
| 1428 | struct iwl_led_cmd { |
| 1429 | __le32 interval; /* "interval" in uSec */ |
| 1430 | u8 id; /* 1: Activity, 2: Link, 3: Tech */ |
| 1431 | u8 off; /* # intervals off while blinking; |
| 1432 | * "0", with >0 "on" value, turns LED on */ |
| 1433 | u8 on; /* # intervals on while blinking; |
| 1434 | * "0", regardless of "off", turns LED off */ |
| 1435 | u8 reserved; |
| 1436 | } __attribute__ ((packed)); |
| 1437 | |
| 1438 | /****************************************************************************** |
| 1439 | * (13) |
| 1440 | * Union of all expected notifications/responses: |
| 1441 | * |
| 1442 | *****************************************************************************/ |
| 1443 | |
| 1444 | struct iwl_rx_packet { |
| 1445 | __le32 len; |
| 1446 | struct iwl_cmd_header hdr; |
| 1447 | union { |
| 1448 | struct iwl_alive_resp alive_frame; |
| 1449 | struct iwl_rx_frame rx_frame; |
| 1450 | struct iwl_tx_resp tx_resp; |
| 1451 | struct iwl_spectrum_notification spectrum_notif; |
| 1452 | struct iwl_csa_notification csa_notif; |
| 1453 | struct iwl_error_resp err_resp; |
| 1454 | struct iwl_card_state_notif card_state_notif; |
| 1455 | struct iwl_beacon_notif beacon_status; |
| 1456 | struct iwl_add_sta_resp add_sta; |
| 1457 | struct iwl_sleep_notification sleep_notif; |
| 1458 | struct iwl_spectrum_resp spectrum; |
| 1459 | struct iwl_notif_statistics stats; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1460 | __le32 status; |
| 1461 | u8 raw[0]; |
| 1462 | } u; |
| 1463 | } __attribute__ ((packed)); |
| 1464 | |
| 1465 | #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) |
| 1466 | |
Christoph Hellwig | 5d08cd1 | 2007-10-25 17:15:50 +0800 | [diff] [blame^] | 1467 | #endif /* __iwl_3945_commands_h__ */ |