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 | * |
Reinette Chatre | eb7ae89 | 2008-03-11 16:17:17 -0700 | [diff] [blame] | 8 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 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 | * |
Reinette Chatre | eb7ae89 | 2008-03-11 16:17:17 -0700 | [diff] [blame] | 33 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 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 | *****************************************************************************/ |
Ben Cahill | fcd427b | 2007-11-29 11:10:00 +0800 | [diff] [blame] | 63 | /* |
| 64 | * Please use this file (iwl-3945-commands.h) only for uCode API definitions. |
| 65 | * Please use iwl-3945-hw.h for hardware-related definitions. |
| 66 | * Please use iwl-3945.h for driver implementation definitions. |
| 67 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 68 | |
Christoph Hellwig | 5d08cd1 | 2007-10-25 17:15:50 +0800 | [diff] [blame] | 69 | #ifndef __iwl_3945_commands_h__ |
| 70 | #define __iwl_3945_commands_h__ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 71 | |
Chatre, Reinette | c02b3ac | 2008-12-02 12:14:05 -0800 | [diff] [blame^] | 72 | /* uCode version contains 4 values: Major/Minor/API/Serial */ |
| 73 | #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) |
| 74 | #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) |
| 75 | #define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) |
| 76 | #define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) |
| 77 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 78 | enum { |
| 79 | REPLY_ALIVE = 0x1, |
| 80 | REPLY_ERROR = 0x2, |
| 81 | |
| 82 | /* RXON and QOS commands */ |
| 83 | REPLY_RXON = 0x10, |
| 84 | REPLY_RXON_ASSOC = 0x11, |
| 85 | REPLY_QOS_PARAM = 0x13, |
| 86 | REPLY_RXON_TIMING = 0x14, |
| 87 | |
| 88 | /* Multi-Station support */ |
| 89 | REPLY_ADD_STA = 0x18, |
| 90 | REPLY_REMOVE_STA = 0x19, /* not used */ |
| 91 | REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ |
| 92 | |
| 93 | /* RX, TX, LEDs */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 94 | REPLY_3945_RX = 0x1b, /* 3945 only */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 95 | REPLY_TX = 0x1c, |
| 96 | REPLY_RATE_SCALE = 0x47, /* 3945 only */ |
| 97 | REPLY_LEDS_CMD = 0x48, |
| 98 | REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ |
| 99 | |
| 100 | /* 802.11h related */ |
| 101 | RADAR_NOTIFICATION = 0x70, /* not used */ |
| 102 | REPLY_QUIET_CMD = 0x71, /* not used */ |
| 103 | REPLY_CHANNEL_SWITCH = 0x72, |
| 104 | CHANNEL_SWITCH_NOTIFICATION = 0x73, |
| 105 | REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, |
| 106 | SPECTRUM_MEASURE_NOTIFICATION = 0x75, |
| 107 | |
| 108 | /* Power Management */ |
| 109 | POWER_TABLE_CMD = 0x77, |
| 110 | PM_SLEEP_NOTIFICATION = 0x7A, |
| 111 | PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, |
| 112 | |
| 113 | /* Scan commands and notifications */ |
| 114 | REPLY_SCAN_CMD = 0x80, |
| 115 | REPLY_SCAN_ABORT_CMD = 0x81, |
| 116 | SCAN_START_NOTIFICATION = 0x82, |
| 117 | SCAN_RESULTS_NOTIFICATION = 0x83, |
| 118 | SCAN_COMPLETE_NOTIFICATION = 0x84, |
| 119 | |
| 120 | /* IBSS/AP commands */ |
| 121 | BEACON_NOTIFICATION = 0x90, |
| 122 | REPLY_TX_BEACON = 0x91, |
| 123 | WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ |
| 124 | |
| 125 | /* Miscellaneous commands */ |
| 126 | QUIET_NOTIFICATION = 0x96, /* not used */ |
| 127 | REPLY_TX_PWR_TABLE_CMD = 0x97, |
| 128 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ |
| 129 | |
Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 130 | /* Bluetooth device coexistence config command */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 131 | REPLY_BT_CONFIG = 0x9b, |
| 132 | |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 133 | /* Statistics */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 134 | REPLY_STATISTICS_CMD = 0x9c, |
| 135 | STATISTICS_NOTIFICATION = 0x9d, |
| 136 | |
| 137 | /* RF-KILL commands and notifications */ |
| 138 | REPLY_CARD_STATE_CMD = 0xa0, |
| 139 | CARD_STATE_NOTIFICATION = 0xa1, |
| 140 | |
| 141 | /* Missed beacons notification */ |
| 142 | MISSED_BEACONS_NOTIFICATION = 0xa2, |
| 143 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 144 | REPLY_MAX = 0xff |
| 145 | }; |
| 146 | |
| 147 | /****************************************************************************** |
| 148 | * (0) |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 149 | * Commonly used structures and definitions: |
| 150 | * Command header, txpower |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 151 | * |
| 152 | *****************************************************************************/ |
| 153 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 154 | /* iwl3945_cmd_header flags value */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 155 | #define IWL_CMD_FAILED_MSK 0x40 |
| 156 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 157 | /** |
| 158 | * struct iwl3945_cmd_header |
| 159 | * |
| 160 | * This header format appears in the beginning of each command sent from the |
| 161 | * driver, and each response/notification received from uCode. |
| 162 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 163 | struct iwl3945_cmd_header { |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 164 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
| 165 | u8 flags; /* IWL_CMD_* */ |
| 166 | /* |
Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 167 | * The driver sets up the sequence number to values of its choosing. |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 168 | * uCode does not use this value, but passes it back to the driver |
| 169 | * when sending the response to each driver-originated command, so |
| 170 | * the driver can match the response to the command. Since the values |
| 171 | * don't get used by uCode, the driver may set up an arbitrary format. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 172 | * |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 173 | * There is one exception: uCode sets bit 15 when it originates |
| 174 | * the response/notification, i.e. when the response/notification |
| 175 | * is not a direct response to a command sent by the driver. For |
| 176 | * example, uCode issues REPLY_3945_RX when it sends a received frame |
| 177 | * to the driver; it is not a direct response to any driver command. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 178 | * |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 179 | * The Linux driver uses the following format: |
| 180 | * |
| 181 | * 0:7 index/position within Tx queue |
| 182 | * 8:13 Tx queue selection |
| 183 | * 14:14 driver sets this to indicate command is in the 'huge' |
| 184 | * storage at the end of the command buffers, i.e. scan cmd |
| 185 | * 15:15 uCode sets this in uCode-originated response/notification |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 186 | */ |
| 187 | __le16 sequence; |
| 188 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 189 | /* command or response/notification data follows immediately */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 190 | u8 data[0]; |
| 191 | } __attribute__ ((packed)); |
| 192 | |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 193 | /** |
| 194 | * struct iwl3945_tx_power |
| 195 | * |
| 196 | * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH |
| 197 | * |
| 198 | * Each entry contains two values: |
| 199 | * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained |
| 200 | * linear value that multiplies the output of the digital signal processor, |
| 201 | * before being sent to the analog radio. |
| 202 | * 2) Radio gain. This sets the analog gain of the radio Tx path. |
| 203 | * It is a coarser setting, and behaves in a logarithmic (dB) fashion. |
| 204 | * |
| 205 | * Driver obtains values from struct iwl3945_tx_power power_gain_table[][]. |
| 206 | */ |
| 207 | struct iwl3945_tx_power { |
| 208 | u8 tx_gain; /* gain for analog radio */ |
| 209 | u8 dsp_atten; /* gain for DSP */ |
| 210 | } __attribute__ ((packed)); |
| 211 | |
| 212 | /** |
| 213 | * struct iwl3945_power_per_rate |
| 214 | * |
| 215 | * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH |
| 216 | */ |
| 217 | struct iwl3945_power_per_rate { |
| 218 | u8 rate; /* plcp */ |
| 219 | struct iwl3945_tx_power tpc; |
| 220 | u8 reserved; |
| 221 | } __attribute__ ((packed)); |
| 222 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 223 | /****************************************************************************** |
| 224 | * (0a) |
| 225 | * Alive and Error Commands & Responses: |
| 226 | * |
| 227 | *****************************************************************************/ |
| 228 | |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 229 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 230 | #define INITIALIZE_SUBTYPE (9) |
| 231 | |
| 232 | /* |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 233 | * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command) |
| 234 | * |
| 235 | * uCode issues this "initialize alive" notification once the initialization |
| 236 | * uCode image has completed its work, and is ready to load the runtime image. |
| 237 | * This is the *first* "alive" notification that the driver will receive after |
| 238 | * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. |
| 239 | * |
| 240 | * See comments documenting "BSM" (bootstrap state machine). |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 241 | */ |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 242 | struct iwl3945_init_alive_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 243 | u8 ucode_minor; |
| 244 | u8 ucode_major; |
| 245 | __le16 reserved1; |
| 246 | u8 sw_rev[8]; |
| 247 | u8 ver_type; |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 248 | u8 ver_subtype; /* "9" for initialize alive */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 249 | __le16 reserved2; |
| 250 | __le32 log_event_table_ptr; |
| 251 | __le32 error_event_table_ptr; |
| 252 | __le32 timestamp; |
| 253 | __le32 is_valid; |
| 254 | } __attribute__ ((packed)); |
| 255 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 256 | |
| 257 | /** |
| 258 | * REPLY_ALIVE = 0x1 (response only, not a command) |
| 259 | * |
| 260 | * uCode issues this "alive" notification once the runtime image is ready |
| 261 | * to receive commands from the driver. This is the *second* "alive" |
| 262 | * notification that the driver will receive after rebooting uCode; |
| 263 | * this "alive" is indicated by subtype field != 9. |
| 264 | * |
| 265 | * See comments documenting "BSM" (bootstrap state machine). |
| 266 | * |
| 267 | * This response includes two pointers to structures within the device's |
| 268 | * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: |
| 269 | * |
| 270 | * 1) log_event_table_ptr indicates base of the event log. This traces |
| 271 | * a 256-entry history of uCode execution within a circular buffer. |
| 272 | * |
| 273 | * 2) error_event_table_ptr indicates base of the error log. This contains |
| 274 | * information about any uCode error that occurs. |
| 275 | * |
| 276 | * The Linux driver can print both logs to the system log when a uCode error |
| 277 | * occurs. |
| 278 | */ |
| 279 | struct iwl3945_alive_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 280 | u8 ucode_minor; |
| 281 | u8 ucode_major; |
| 282 | __le16 reserved1; |
| 283 | u8 sw_rev[8]; |
| 284 | u8 ver_type; |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 285 | u8 ver_subtype; /* not "9" for runtime alive */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 286 | __le16 reserved2; |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 287 | __le32 log_event_table_ptr; /* SRAM address for event log */ |
| 288 | __le32 error_event_table_ptr; /* SRAM address for error log */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 289 | __le32 timestamp; |
| 290 | __le32 is_valid; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 291 | } __attribute__ ((packed)); |
| 292 | |
| 293 | union tsf { |
| 294 | u8 byte[8]; |
| 295 | __le16 word[4]; |
| 296 | __le32 dw[2]; |
| 297 | }; |
| 298 | |
| 299 | /* |
| 300 | * REPLY_ERROR = 0x2 (response only, not a command) |
| 301 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 302 | struct iwl3945_error_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 303 | __le32 error_type; |
| 304 | u8 cmd_id; |
| 305 | u8 reserved1; |
| 306 | __le16 bad_cmd_seq_num; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 307 | __le16 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 308 | __le32 error_info; |
| 309 | union tsf timestamp; |
| 310 | } __attribute__ ((packed)); |
| 311 | |
| 312 | /****************************************************************************** |
| 313 | * (1) |
| 314 | * RXON Commands & Responses: |
| 315 | * |
| 316 | *****************************************************************************/ |
| 317 | |
| 318 | /* |
| 319 | * Rx config defines & structure |
| 320 | */ |
| 321 | /* rx_config device types */ |
| 322 | enum { |
| 323 | RXON_DEV_TYPE_AP = 1, |
| 324 | RXON_DEV_TYPE_ESS = 3, |
| 325 | RXON_DEV_TYPE_IBSS = 4, |
| 326 | RXON_DEV_TYPE_SNIFFER = 6, |
| 327 | }; |
| 328 | |
| 329 | /* rx_config flags */ |
| 330 | /* band & modulation selection */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 331 | #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) |
| 332 | #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 333 | /* auto detection enable */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 334 | #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 335 | /* TGg protection when tx */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 336 | #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 337 | /* cck short slot & preamble */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 338 | #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) |
| 339 | #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 340 | /* antenna selection */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 341 | #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) |
| 342 | #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) |
| 343 | #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
| 344 | #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 345 | /* radar detection enable */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 346 | #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) |
| 347 | #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 348 | /* rx response to host with 8-byte TSF |
| 349 | * (according to ON_AIR deassertion) */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 350 | #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 351 | |
| 352 | /* rx_config filter flags */ |
| 353 | /* accept all data frames */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 354 | #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 355 | /* pass control & management to host */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 356 | #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 357 | /* accept multi-cast */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 358 | #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 359 | /* don't decrypt uni-cast frames */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 360 | #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 361 | /* don't decrypt multi-cast frames */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 362 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 363 | /* STA is associated */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 364 | #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 365 | /* transfer to host non bssid beacons in associated state */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 366 | #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 367 | |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 368 | /** |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 369 | * REPLY_RXON = 0x10 (command, has simple generic response) |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 370 | * |
| 371 | * RXON tunes the radio tuner to a service channel, and sets up a number |
| 372 | * of parameters that are used primarily for Rx, but also for Tx operations. |
| 373 | * |
| 374 | * NOTE: When tuning to a new channel, driver must set the |
| 375 | * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent |
| 376 | * info within the device, including the station tables, tx retry |
| 377 | * rate tables, and txpower tables. Driver must build a new station |
| 378 | * table and txpower table before transmitting anything on the RXON |
| 379 | * channel. |
| 380 | * |
| 381 | * NOTE: All RXONs wipe clean the internal txpower table. Driver must |
| 382 | * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), |
| 383 | * regardless of whether RXON_FILTER_ASSOC_MSK is set. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 384 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 385 | struct iwl3945_rxon_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 386 | u8 node_addr[6]; |
| 387 | __le16 reserved1; |
| 388 | u8 bssid_addr[6]; |
| 389 | __le16 reserved2; |
| 390 | u8 wlap_bssid_addr[6]; |
| 391 | __le16 reserved3; |
| 392 | u8 dev_type; |
| 393 | u8 air_propagation; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 394 | __le16 reserved4; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 395 | u8 ofdm_basic_rates; |
| 396 | u8 cck_basic_rates; |
| 397 | __le16 assoc_id; |
| 398 | __le32 flags; |
| 399 | __le32 filter_flags; |
| 400 | __le16 channel; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 401 | __le16 reserved5; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 402 | } __attribute__ ((packed)); |
| 403 | |
| 404 | /* |
| 405 | * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) |
| 406 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 407 | struct iwl3945_rxon_assoc_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 408 | __le32 flags; |
| 409 | __le32 filter_flags; |
| 410 | u8 ofdm_basic_rates; |
| 411 | u8 cck_basic_rates; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 412 | __le16 reserved; |
| 413 | } __attribute__ ((packed)); |
| 414 | |
| 415 | /* |
| 416 | * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) |
| 417 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 418 | struct iwl3945_rxon_time_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 419 | union tsf timestamp; |
| 420 | __le16 beacon_interval; |
| 421 | __le16 atim_window; |
| 422 | __le32 beacon_init_val; |
| 423 | __le16 listen_interval; |
| 424 | __le16 reserved; |
| 425 | } __attribute__ ((packed)); |
| 426 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 427 | /* |
| 428 | * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) |
| 429 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 430 | struct iwl3945_channel_switch_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 431 | u8 band; |
| 432 | u8 expect_beacon; |
| 433 | __le16 channel; |
| 434 | __le32 rxon_flags; |
| 435 | __le32 rxon_filter_flags; |
| 436 | __le32 switch_time; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 437 | struct iwl3945_power_per_rate power[IWL_MAX_RATES]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 438 | } __attribute__ ((packed)); |
| 439 | |
| 440 | /* |
| 441 | * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) |
| 442 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 443 | struct iwl3945_csa_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 444 | __le16 band; |
| 445 | __le16 channel; |
| 446 | __le32 status; /* 0 - OK, 1 - fail */ |
| 447 | } __attribute__ ((packed)); |
| 448 | |
| 449 | /****************************************************************************** |
| 450 | * (2) |
| 451 | * Quality-of-Service (QOS) Commands & Responses: |
| 452 | * |
| 453 | *****************************************************************************/ |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 454 | |
| 455 | /** |
| 456 | * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM |
| 457 | * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd |
| 458 | * |
| 459 | * @cw_min: Contention window, start value in numbers of slots. |
| 460 | * Should be a power-of-2, minus 1. Device's default is 0x0f. |
| 461 | * @cw_max: Contention window, max value in numbers of slots. |
| 462 | * Should be a power-of-2, minus 1. Device's default is 0x3f. |
| 463 | * @aifsn: Number of slots in Arbitration Interframe Space (before |
| 464 | * performing random backoff timing prior to Tx). Device default 1. |
| 465 | * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. |
| 466 | * |
| 467 | * Device will automatically increase contention window by (2*CW) + 1 for each |
| 468 | * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW |
| 469 | * value, to cap the CW value. |
| 470 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 471 | struct iwl3945_ac_qos { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 472 | __le16 cw_min; |
| 473 | __le16 cw_max; |
| 474 | u8 aifsn; |
| 475 | u8 reserved1; |
| 476 | __le16 edca_txop; |
| 477 | } __attribute__ ((packed)); |
| 478 | |
| 479 | /* QoS flags defines */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 480 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) |
| 481 | #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) |
| 482 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 483 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 484 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 485 | #define AC_NUM 4 |
| 486 | |
| 487 | /* |
| 488 | * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 489 | * |
| 490 | * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs |
| 491 | * 0: Background, 1: Best Effort, 2: Video, 3: Voice. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 492 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 493 | struct iwl3945_qosparam_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 494 | __le32 qos_flags; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 495 | struct iwl3945_ac_qos ac[AC_NUM]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 496 | } __attribute__ ((packed)); |
| 497 | |
| 498 | /****************************************************************************** |
| 499 | * (3) |
| 500 | * Add/Modify Stations Commands & Responses: |
| 501 | * |
| 502 | *****************************************************************************/ |
| 503 | /* |
| 504 | * Multi station support |
| 505 | */ |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 506 | |
| 507 | /* Special, dedicated locations within device's station table */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 508 | #define IWL_AP_ID 0 |
| 509 | #define IWL_MULTICAST_ID 1 |
| 510 | #define IWL_STA_ID 2 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 511 | #define IWL3945_BROADCAST_ID 24 |
| 512 | #define IWL3945_STATION_COUNT 25 |
| 513 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 514 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
| 515 | #define IWL_INVALID_STATION 255 |
| 516 | |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 517 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2); |
| 518 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 519 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 520 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 521 | #define STA_CONTROL_MODIFY_MSK 0x01 |
| 522 | |
| 523 | /* key flags __le16*/ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 524 | #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) |
| 525 | #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) |
| 526 | #define STA_KEY_FLG_WEP cpu_to_le16(0x0001) |
| 527 | #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) |
| 528 | #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 529 | |
| 530 | #define STA_KEY_FLG_KEYID_POS 8 |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 531 | #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) |
Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 532 | /* wep key is either from global key (0) or from station info array (1) */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 533 | #define STA_KEY_FLG_WEP_KEY_MAP_MSK cpu_to_le16(0x0008) |
Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 534 | |
| 535 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 536 | #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) |
| 537 | #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 538 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 539 | /* Flags indicate whether to modify vs. don't change various station params */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 540 | #define STA_MODIFY_KEY_MASK 0x01 |
| 541 | #define STA_MODIFY_TID_DISABLE_TX 0x02 |
| 542 | #define STA_MODIFY_TX_RATE_MSK 0x04 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 543 | |
| 544 | /* |
| 545 | * Antenna masks: |
| 546 | * bit14:15 01 B inactive, A active |
| 547 | * 10 B active, A inactive |
| 548 | * 11 Both active |
| 549 | */ |
| 550 | #define RATE_MCS_ANT_A_POS 14 |
| 551 | #define RATE_MCS_ANT_B_POS 15 |
| 552 | #define RATE_MCS_ANT_A_MSK 0x4000 |
| 553 | #define RATE_MCS_ANT_B_MSK 0x8000 |
| 554 | #define RATE_MCS_ANT_AB_MSK 0xc000 |
| 555 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 556 | struct iwl3945_keyinfo { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 557 | __le16 key_flags; |
| 558 | u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ |
| 559 | u8 reserved1; |
| 560 | __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ |
Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 561 | u8 key_offset; |
| 562 | u8 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 563 | u8 key[16]; /* 16-byte unicast decryption key */ |
| 564 | } __attribute__ ((packed)); |
| 565 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 566 | /** |
| 567 | * struct sta_id_modify |
| 568 | * @addr[ETH_ALEN]: station's MAC address |
| 569 | * @sta_id: index of station in uCode's station table |
| 570 | * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change |
| 571 | * |
| 572 | * Driver selects unused table index when adding new station, |
| 573 | * or the index to a pre-existing station entry when modifying that station. |
| 574 | * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). |
| 575 | * |
| 576 | * modify_mask flags select which parameters to modify vs. leave alone. |
| 577 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 578 | struct sta_id_modify { |
| 579 | u8 addr[ETH_ALEN]; |
| 580 | __le16 reserved1; |
| 581 | u8 sta_id; |
| 582 | u8 modify_mask; |
| 583 | __le16 reserved2; |
| 584 | } __attribute__ ((packed)); |
| 585 | |
| 586 | /* |
| 587 | * REPLY_ADD_STA = 0x18 (command) |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 588 | * |
| 589 | * The device contains an internal table of per-station information, |
| 590 | * with info on security keys, aggregation parameters, and Tx rates for |
| 591 | * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD, |
| 592 | * 3945 uses REPLY_RATE_SCALE to set up rate tables). |
| 593 | * |
| 594 | * REPLY_ADD_STA sets up the table entry for one station, either creating |
| 595 | * a new entry, or modifying a pre-existing one. |
| 596 | * |
| 597 | * NOTE: RXON command (without "associated" bit set) wipes the station table |
| 598 | * clean. Moving into RF_KILL state does this also. Driver must set up |
| 599 | * new station table before transmitting anything on the RXON channel |
| 600 | * (except active scans or active measurements; those commands carry |
| 601 | * their own txpower/rate setup data). |
| 602 | * |
| 603 | * When getting started on a new channel, driver must set up the |
| 604 | * IWL_BROADCAST_ID entry (last entry in the table). For a client |
| 605 | * station in a BSS, once an AP is selected, driver sets up the AP STA |
| 606 | * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP |
| 607 | * are all that are needed for a BSS client station. If the device is |
| 608 | * used as AP, or in an IBSS network, driver must set up station table |
| 609 | * entries for all STAs in network, starting with index IWL_STA_ID. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 610 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 611 | struct iwl3945_addsta_cmd { |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 612 | u8 mode; /* 1: modify existing, 0: add new station */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 613 | u8 reserved[3]; |
| 614 | struct sta_id_modify sta; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 615 | struct iwl3945_keyinfo key; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 616 | __le32 station_flags; /* STA_FLG_* */ |
| 617 | __le32 station_flags_msk; /* STA_FLG_* */ |
| 618 | |
| 619 | /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) |
| 620 | * corresponding to bit (e.g. bit 5 controls TID 5). |
| 621 | * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 622 | __le16 tid_disable_tx; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 623 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 624 | __le16 rate_n_flags; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 625 | |
| 626 | /* TID for which to add block-ack support. |
| 627 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 628 | u8 add_immediate_ba_tid; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 629 | |
| 630 | /* TID for which to remove block-ack support. |
| 631 | * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 632 | u8 remove_immediate_ba_tid; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 633 | |
| 634 | /* Starting Sequence Number for added block-ack support. |
| 635 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 636 | __le16 add_immediate_ba_ssn; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 637 | } __attribute__ ((packed)); |
| 638 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 639 | #define ADD_STA_SUCCESS_MSK 0x1 |
| 640 | #define ADD_STA_NO_ROOM_IN_TABLE 0x2 |
| 641 | #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 642 | /* |
| 643 | * REPLY_ADD_STA = 0x18 (response) |
| 644 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 645 | struct iwl3945_add_sta_resp { |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 646 | u8 status; /* ADD_STA_* */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 647 | } __attribute__ ((packed)); |
| 648 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 649 | |
| 650 | /****************************************************************************** |
| 651 | * (4) |
| 652 | * Rx Responses: |
| 653 | * |
| 654 | *****************************************************************************/ |
| 655 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 656 | struct iwl3945_rx_frame_stats { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 657 | u8 phy_count; |
| 658 | u8 id; |
| 659 | u8 rssi; |
| 660 | u8 agc; |
| 661 | __le16 sig_avg; |
| 662 | __le16 noise_diff; |
| 663 | u8 payload[0]; |
| 664 | } __attribute__ ((packed)); |
| 665 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 666 | struct iwl3945_rx_frame_hdr { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 667 | __le16 channel; |
| 668 | __le16 phy_flags; |
| 669 | u8 reserved1; |
| 670 | u8 rate; |
| 671 | __le16 len; |
| 672 | u8 payload[0]; |
| 673 | } __attribute__ ((packed)); |
| 674 | |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 675 | #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) |
| 676 | #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 677 | |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 678 | #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) |
| 679 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) |
| 680 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) |
| 681 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) |
| 682 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 683 | |
Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 684 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
| 685 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
| 686 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) |
| 687 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) |
| 688 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 689 | |
Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 690 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) |
| 691 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) |
| 692 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) |
| 693 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) |
| 694 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 695 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 696 | struct iwl3945_rx_frame_end { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 697 | __le32 status; |
| 698 | __le64 timestamp; |
| 699 | __le32 beacon_timestamp; |
| 700 | } __attribute__ ((packed)); |
| 701 | |
| 702 | /* |
| 703 | * REPLY_3945_RX = 0x1b (response only, not a command) |
| 704 | * |
| 705 | * NOTE: DO NOT dereference from casts to this structure |
| 706 | * It is provided only for calculating minimum data set size. |
| 707 | * The actual offsets of the hdr and end are dynamic based on |
| 708 | * stats.phy_count |
| 709 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 710 | struct iwl3945_rx_frame { |
| 711 | struct iwl3945_rx_frame_stats stats; |
| 712 | struct iwl3945_rx_frame_hdr hdr; |
| 713 | struct iwl3945_rx_frame_end end; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 714 | } __attribute__ ((packed)); |
| 715 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 716 | /****************************************************************************** |
| 717 | * (5) |
| 718 | * Tx Commands & Responses: |
| 719 | * |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 720 | * Driver must place each REPLY_TX command into one of the prioritized Tx |
| 721 | * queues in host DRAM, shared between driver and device. When the device's |
| 722 | * Tx scheduler and uCode are preparing to transmit, the device pulls the |
| 723 | * Tx command over the PCI bus via one of the device's Tx DMA channels, |
| 724 | * to fill an internal FIFO from which data will be transmitted. |
| 725 | * |
| 726 | * uCode handles all timing and protocol related to control frames |
| 727 | * (RTS/CTS/ACK), based on flags in the Tx command. |
| 728 | * |
| 729 | * uCode handles retrying Tx when an ACK is expected but not received. |
| 730 | * This includes trying lower data rates than the one requested in the Tx |
| 731 | * command, as set up by the REPLY_RATE_SCALE (for 3945) or |
| 732 | * REPLY_TX_LINK_QUALITY_CMD (4965). |
| 733 | * |
| 734 | * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. |
| 735 | * This command must be executed after every RXON command, before Tx can occur. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 736 | *****************************************************************************/ |
| 737 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 738 | /* REPLY_TX Tx flags field */ |
| 739 | |
| 740 | /* 1: Use Request-To-Send protocol before this frame. |
| 741 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 742 | #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 743 | |
| 744 | /* 1: Transmit Clear-To-Send to self before this frame. |
| 745 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. |
| 746 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 747 | #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 748 | |
| 749 | /* 1: Expect ACK from receiving station |
| 750 | * 0: Don't expect ACK (MAC header's duration field s/b 0) |
| 751 | * Set this for unicast frames, but not broadcast/multicast. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 752 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 753 | |
| 754 | /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). |
| 755 | * Tx command's initial_rate_index indicates first rate to try; |
| 756 | * uCode walks through table for additional Tx attempts. |
| 757 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. |
| 758 | * This rate will be used for all Tx attempts; it will not be scaled. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 759 | #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 760 | |
| 761 | /* 1: Expect immediate block-ack. |
| 762 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 763 | #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 764 | |
| 765 | /* 1: Frame requires full Tx-Op protection. |
| 766 | * Set this if either RTS or CTS Tx Flag gets set. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 767 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 768 | |
| 769 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. |
| 770 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 771 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) |
| 772 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
| 773 | #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 774 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 775 | /* 1: Ignore Bluetooth priority for this frame. |
| 776 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 777 | #define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 778 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 779 | /* 1: uCode overrides sequence control field in MAC header. |
| 780 | * 0: Driver provides sequence control field in MAC header. |
| 781 | * Set this for management frames, non-QOS data frames, non-unicast frames, |
| 782 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 783 | #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 784 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 785 | /* 1: This frame is non-last MPDU; more fragments are coming. |
| 786 | * 0: Last fragment, or not using fragmentation. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 787 | #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 788 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 789 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. |
| 790 | * 0: No TSF required in outgoing frame. |
| 791 | * Set this for transmitting beacons and probe responses. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 792 | #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 793 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 794 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword |
| 795 | * alignment of frame's payload data field. |
| 796 | * 0: No pad |
| 797 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 |
| 798 | * field (but not both). Driver must align frame data (i.e. data following |
| 799 | * MAC header) to DWORD boundary. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 800 | #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 801 | |
| 802 | /* HCCA-AP - disable duration overwriting. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 803 | #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 804 | |
| 805 | /* |
| 806 | * TX command security control |
| 807 | */ |
| 808 | #define TX_CMD_SEC_WEP 0x01 |
| 809 | #define TX_CMD_SEC_CCM 0x02 |
| 810 | #define TX_CMD_SEC_TKIP 0x03 |
| 811 | #define TX_CMD_SEC_MSK 0x03 |
| 812 | #define TX_CMD_SEC_SHIFT 6 |
| 813 | #define TX_CMD_SEC_KEY128 0x08 |
| 814 | |
| 815 | /* |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 816 | * REPLY_TX = 0x1c (command) |
| 817 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 818 | struct iwl3945_tx_cmd { |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 819 | /* |
| 820 | * MPDU byte count: |
| 821 | * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, |
| 822 | * + 8 byte IV for CCM or TKIP (not used for WEP) |
| 823 | * + Data payload |
| 824 | * + 8-byte MIC (not used for CCM/WEP) |
| 825 | * NOTE: Does not include Tx command bytes, post-MAC pad bytes, |
| 826 | * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i |
| 827 | * Range: 14-2342 bytes. |
| 828 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 829 | __le16 len; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 830 | |
| 831 | /* |
| 832 | * MPDU or MSDU byte count for next frame. |
| 833 | * Used for fragmentation and bursting, but not 11n aggregation. |
| 834 | * Same as "len", but for next frame. Set to 0 if not applicable. |
| 835 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 836 | __le16 next_frame_len; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 837 | |
| 838 | __le32 tx_flags; /* TX_CMD_FLG_* */ |
| 839 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 840 | u8 rate; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 841 | |
| 842 | /* Index of recipient station in uCode's station table */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 843 | u8 sta_id; |
| 844 | u8 tid_tspec; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 845 | u8 sec_ctl; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 846 | u8 key[16]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 847 | union { |
| 848 | u8 byte[8]; |
| 849 | __le16 word[4]; |
| 850 | __le32 dw[2]; |
| 851 | } tkip_mic; |
| 852 | __le32 next_frame_info; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 853 | union { |
| 854 | __le32 life_time; |
| 855 | __le32 attempt; |
| 856 | } stop_time; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 857 | u8 supp_rates[2]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 858 | u8 rts_retry_limit; /*byte 50 */ |
| 859 | u8 data_retry_limit; /*byte 51 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 860 | union { |
| 861 | __le16 pm_frame_timeout; |
| 862 | __le16 attempt_duration; |
| 863 | } timeout; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 864 | |
| 865 | /* |
| 866 | * Duration of EDCA burst Tx Opportunity, in 32-usec units. |
| 867 | * Set this if txop time is not specified by HCCA protocol (e.g. by AP). |
| 868 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 869 | __le16 driver_txop; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 870 | |
| 871 | /* |
| 872 | * MAC header goes here, followed by 2 bytes padding if MAC header |
| 873 | * length is 26 or 30 bytes, followed by payload data |
| 874 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 875 | u8 payload[0]; |
| 876 | struct ieee80211_hdr hdr[0]; |
| 877 | } __attribute__ ((packed)); |
| 878 | |
| 879 | /* TX command response is sent after *all* transmission attempts. |
| 880 | * |
| 881 | * NOTES: |
| 882 | * |
| 883 | * TX_STATUS_FAIL_NEXT_FRAG |
| 884 | * |
| 885 | * If the fragment flag in the MAC header for the frame being transmitted |
| 886 | * is set and there is insufficient time to transmit the next frame, the |
| 887 | * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. |
| 888 | * |
| 889 | * TX_STATUS_FIFO_UNDERRUN |
| 890 | * |
| 891 | * Indicates the host did not provide bytes to the FIFO fast enough while |
| 892 | * a TX was in progress. |
| 893 | * |
| 894 | * TX_STATUS_FAIL_MGMNT_ABORT |
| 895 | * |
| 896 | * This status is only possible if the ABORT ON MGMT RX parameter was |
| 897 | * set to true with the TX command. |
| 898 | * |
| 899 | * If the MSB of the status parameter is set then an abort sequence is |
| 900 | * required. This sequence consists of the host activating the TX Abort |
| 901 | * control line, and then waiting for the TX Abort command response. This |
| 902 | * indicates that a the device is no longer in a transmit state, and that the |
| 903 | * command FIFO has been cleared. The host must then deactivate the TX Abort |
| 904 | * control line. Receiving is still allowed in this case. |
| 905 | */ |
| 906 | enum { |
| 907 | TX_STATUS_SUCCESS = 0x01, |
| 908 | TX_STATUS_DIRECT_DONE = 0x02, |
| 909 | TX_STATUS_FAIL_SHORT_LIMIT = 0x82, |
| 910 | TX_STATUS_FAIL_LONG_LIMIT = 0x83, |
| 911 | TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, |
| 912 | TX_STATUS_FAIL_MGMNT_ABORT = 0x85, |
| 913 | TX_STATUS_FAIL_NEXT_FRAG = 0x86, |
| 914 | TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, |
| 915 | TX_STATUS_FAIL_DEST_PS = 0x88, |
| 916 | TX_STATUS_FAIL_ABORTED = 0x89, |
| 917 | TX_STATUS_FAIL_BT_RETRY = 0x8a, |
| 918 | TX_STATUS_FAIL_STA_INVALID = 0x8b, |
| 919 | TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, |
| 920 | TX_STATUS_FAIL_TID_DISABLE = 0x8d, |
| 921 | TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, |
| 922 | TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, |
| 923 | TX_STATUS_FAIL_TX_LOCKED = 0x90, |
| 924 | TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, |
| 925 | }; |
| 926 | |
| 927 | #define TX_PACKET_MODE_REGULAR 0x0000 |
| 928 | #define TX_PACKET_MODE_BURST_SEQ 0x0100 |
| 929 | #define TX_PACKET_MODE_BURST_FIRST 0x0200 |
| 930 | |
| 931 | enum { |
| 932 | TX_POWER_PA_NOT_ACTIVE = 0x0, |
| 933 | }; |
| 934 | |
| 935 | enum { |
| 936 | TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ |
| 937 | TX_STATUS_DELAY_MSK = 0x00000040, |
| 938 | TX_STATUS_ABORT_MSK = 0x00000080, |
| 939 | TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ |
| 940 | TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ |
| 941 | TX_RESERVED = 0x00780000, /* bits 19:22 */ |
| 942 | TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ |
| 943 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ |
| 944 | }; |
| 945 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 946 | /* |
| 947 | * REPLY_TX = 0x1c (response) |
| 948 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 949 | struct iwl3945_tx_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 950 | u8 failure_rts; |
| 951 | u8 failure_frame; |
| 952 | u8 bt_kill_count; |
| 953 | u8 rate; |
| 954 | __le32 wireless_media_time; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 955 | __le32 status; /* TX status */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 956 | } __attribute__ ((packed)); |
| 957 | |
| 958 | /* |
| 959 | * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) |
| 960 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 961 | struct iwl3945_txpowertable_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 962 | u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ |
| 963 | u8 reserved; |
| 964 | __le16 channel; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 965 | struct iwl3945_power_per_rate power[IWL_MAX_RATES]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 966 | } __attribute__ ((packed)); |
| 967 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 968 | struct iwl3945_rate_scaling_info { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 969 | __le16 rate_n_flags; |
| 970 | u8 try_cnt; |
| 971 | u8 next_rate_index; |
| 972 | } __attribute__ ((packed)); |
| 973 | |
| 974 | /** |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 975 | * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 976 | * |
| 977 | * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) |
| 978 | * |
| 979 | * NOTE: The table of rates passed to the uCode via the |
| 980 | * RATE_SCALE command sets up the corresponding order of |
| 981 | * rates used for all related commands, including rate |
| 982 | * masks, etc. |
| 983 | * |
| 984 | * For example, if you set 9MB (PLCP 0x0f) as the first |
| 985 | * rate in the rate table, the bit mask for that rate |
| 986 | * when passed through ofdm_basic_rates on the REPLY_RXON |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 987 | * command would be bit 0 (1 << 0) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 988 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 989 | struct iwl3945_rate_scaling_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 990 | u8 table_id; |
| 991 | u8 reserved[3]; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 992 | struct iwl3945_rate_scaling_info table[IWL_MAX_RATES]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 993 | } __attribute__ ((packed)); |
| 994 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 995 | /* |
| 996 | * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 997 | * |
| 998 | * 3945 and 4965 support hardware handshake with Bluetooth device on |
| 999 | * same platform. Bluetooth device alerts wireless device when it will Tx; |
Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 1000 | * wireless device can delay or kill its own Tx to accommodate. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1001 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1002 | struct iwl3945_bt_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1003 | u8 flags; |
| 1004 | u8 lead_time; |
| 1005 | u8 max_kill; |
| 1006 | u8 reserved; |
| 1007 | __le32 kill_ack_mask; |
| 1008 | __le32 kill_cts_mask; |
| 1009 | } __attribute__ ((packed)); |
| 1010 | |
| 1011 | /****************************************************************************** |
| 1012 | * (6) |
| 1013 | * Spectrum Management (802.11h) Commands, Responses, Notifications: |
| 1014 | * |
| 1015 | *****************************************************************************/ |
| 1016 | |
| 1017 | /* |
| 1018 | * Spectrum Management |
| 1019 | */ |
| 1020 | #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ |
| 1021 | RXON_FILTER_CTL2HOST_MSK | \ |
| 1022 | RXON_FILTER_ACCEPT_GRP_MSK | \ |
| 1023 | RXON_FILTER_DIS_DECRYPT_MSK | \ |
| 1024 | RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ |
| 1025 | RXON_FILTER_ASSOC_MSK | \ |
| 1026 | RXON_FILTER_BCON_AWARE_MSK) |
| 1027 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1028 | struct iwl3945_measure_channel { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1029 | __le32 duration; /* measurement duration in extended beacon |
| 1030 | * format */ |
| 1031 | u8 channel; /* channel to measure */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1032 | u8 type; /* see enum iwl3945_measure_type */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1033 | __le16 reserved; |
| 1034 | } __attribute__ ((packed)); |
| 1035 | |
| 1036 | /* |
| 1037 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) |
| 1038 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1039 | struct iwl3945_spectrum_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1040 | __le16 len; /* number of bytes starting from token */ |
| 1041 | u8 token; /* token id */ |
| 1042 | u8 id; /* measurement id -- 0 or 1 */ |
| 1043 | u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ |
| 1044 | u8 periodic; /* 1 = periodic */ |
| 1045 | __le16 path_loss_timeout; |
| 1046 | __le32 start_time; /* start time in extended beacon format */ |
| 1047 | __le32 reserved2; |
| 1048 | __le32 flags; /* rxon flags */ |
| 1049 | __le32 filter_flags; /* rxon filter flags */ |
| 1050 | __le16 channel_count; /* minimum 1, maximum 10 */ |
| 1051 | __le16 reserved3; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1052 | struct iwl3945_measure_channel channels[10]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1053 | } __attribute__ ((packed)); |
| 1054 | |
| 1055 | /* |
| 1056 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) |
| 1057 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1058 | struct iwl3945_spectrum_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1059 | u8 token; |
| 1060 | u8 id; /* id of the prior command replaced, or 0xff */ |
| 1061 | __le16 status; /* 0 - command will be handled |
| 1062 | * 1 - cannot handle (conflicts with another |
| 1063 | * measurement) */ |
| 1064 | } __attribute__ ((packed)); |
| 1065 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1066 | enum iwl3945_measurement_state { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1067 | IWL_MEASUREMENT_START = 0, |
| 1068 | IWL_MEASUREMENT_STOP = 1, |
| 1069 | }; |
| 1070 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1071 | enum iwl3945_measurement_status { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1072 | IWL_MEASUREMENT_OK = 0, |
| 1073 | IWL_MEASUREMENT_CONCURRENT = 1, |
| 1074 | IWL_MEASUREMENT_CSA_CONFLICT = 2, |
| 1075 | IWL_MEASUREMENT_TGH_CONFLICT = 3, |
| 1076 | /* 4-5 reserved */ |
| 1077 | IWL_MEASUREMENT_STOPPED = 6, |
| 1078 | IWL_MEASUREMENT_TIMEOUT = 7, |
| 1079 | IWL_MEASUREMENT_PERIODIC_FAILED = 8, |
| 1080 | }; |
| 1081 | |
| 1082 | #define NUM_ELEMENTS_IN_HISTOGRAM 8 |
| 1083 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1084 | struct iwl3945_measurement_histogram { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1085 | __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ |
| 1086 | __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ |
| 1087 | } __attribute__ ((packed)); |
| 1088 | |
| 1089 | /* clear channel availability counters */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1090 | struct iwl3945_measurement_cca_counters { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1091 | __le32 ofdm; |
| 1092 | __le32 cck; |
| 1093 | } __attribute__ ((packed)); |
| 1094 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1095 | enum iwl3945_measure_type { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1096 | IWL_MEASURE_BASIC = (1 << 0), |
| 1097 | IWL_MEASURE_CHANNEL_LOAD = (1 << 1), |
| 1098 | IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), |
| 1099 | IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), |
| 1100 | IWL_MEASURE_FRAME = (1 << 4), |
| 1101 | /* bits 5:6 are reserved */ |
| 1102 | IWL_MEASURE_IDLE = (1 << 7), |
| 1103 | }; |
| 1104 | |
| 1105 | /* |
| 1106 | * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) |
| 1107 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1108 | struct iwl3945_spectrum_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1109 | u8 id; /* measurement id -- 0 or 1 */ |
| 1110 | u8 token; |
| 1111 | u8 channel_index; /* index in measurement channel list */ |
| 1112 | u8 state; /* 0 - start, 1 - stop */ |
| 1113 | __le32 start_time; /* lower 32-bits of TSF */ |
| 1114 | u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ |
| 1115 | u8 channel; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1116 | u8 type; /* see enum iwl3945_measurement_type */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1117 | u8 reserved1; |
| 1118 | /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only |
| 1119 | * valid if applicable for measurement type requested. */ |
| 1120 | __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ |
| 1121 | __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ |
| 1122 | __le32 cca_time; /* channel load time in usecs */ |
| 1123 | u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - |
| 1124 | * unidentified */ |
| 1125 | u8 reserved2[3]; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1126 | struct iwl3945_measurement_histogram histogram; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1127 | __le32 stop_time; /* lower 32-bits of TSF */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1128 | __le32 status; /* see iwl3945_measurement_status */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1129 | } __attribute__ ((packed)); |
| 1130 | |
| 1131 | /****************************************************************************** |
| 1132 | * (7) |
| 1133 | * Power Management Commands, Responses, Notifications: |
| 1134 | * |
| 1135 | *****************************************************************************/ |
| 1136 | |
| 1137 | /** |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1138 | * struct iwl3945_powertable_cmd - Power Table Command |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1139 | * @flags: See below: |
| 1140 | * |
| 1141 | * POWER_TABLE_CMD = 0x77 (command, has simple generic response) |
| 1142 | * |
| 1143 | * PM allow: |
| 1144 | * bit 0 - '0' Driver not allow power management |
| 1145 | * '1' Driver allow PM (use rest of parameters) |
| 1146 | * uCode send sleep notifications: |
| 1147 | * bit 1 - '0' Don't send sleep notification |
| 1148 | * '1' send sleep notification (SEND_PM_NOTIFICATION) |
| 1149 | * Sleep over DTIM |
| 1150 | * bit 2 - '0' PM have to walk up every DTIM |
| 1151 | * '1' PM could sleep over DTIM till listen Interval. |
| 1152 | * PCI power managed |
| 1153 | * bit 3 - '0' (PCI_LINK_CTRL & 0x1) |
| 1154 | * '1' !(PCI_LINK_CTRL & 0x1) |
| 1155 | * Force sleep Modes |
| 1156 | * bit 31/30- '00' use both mac/xtal sleeps |
| 1157 | * '01' force Mac sleep |
| 1158 | * '10' force xtal sleep |
| 1159 | * '11' Illegal set |
| 1160 | * |
| 1161 | * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then |
| 1162 | * ucode assume sleep over DTIM is allowed and we don't need to wakeup |
| 1163 | * for every DTIM. |
| 1164 | */ |
| 1165 | #define IWL_POWER_VEC_SIZE 5 |
| 1166 | |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1167 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le32(1 << 0) |
| 1168 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le32(1 << 2) |
| 1169 | #define IWL_POWER_PCI_PM_MSK cpu_to_le32(1 << 3) |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1170 | struct iwl3945_powertable_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1171 | __le32 flags; |
| 1172 | __le32 rx_data_timeout; |
| 1173 | __le32 tx_data_timeout; |
| 1174 | __le32 sleep_interval[IWL_POWER_VEC_SIZE]; |
| 1175 | } __attribute__((packed)); |
| 1176 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1177 | /* |
| 1178 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) |
| 1179 | * 3945 and 4965 identical. |
| 1180 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1181 | struct iwl3945_sleep_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1182 | u8 pm_sleep_mode; |
| 1183 | u8 pm_wakeup_src; |
| 1184 | __le16 reserved; |
| 1185 | __le32 sleep_time; |
| 1186 | __le32 tsf_low; |
| 1187 | __le32 bcon_timer; |
| 1188 | } __attribute__ ((packed)); |
| 1189 | |
| 1190 | /* Sleep states. 3945 and 4965 identical. */ |
| 1191 | enum { |
| 1192 | IWL_PM_NO_SLEEP = 0, |
| 1193 | IWL_PM_SLP_MAC = 1, |
| 1194 | IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, |
| 1195 | IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, |
| 1196 | IWL_PM_SLP_PHY = 4, |
| 1197 | IWL_PM_SLP_REPENT = 5, |
| 1198 | IWL_PM_WAKEUP_BY_TIMER = 6, |
| 1199 | IWL_PM_WAKEUP_BY_DRIVER = 7, |
| 1200 | IWL_PM_WAKEUP_BY_RFKILL = 8, |
| 1201 | /* 3 reserved */ |
| 1202 | IWL_PM_NUM_OF_MODES = 12, |
| 1203 | }; |
| 1204 | |
| 1205 | /* |
| 1206 | * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) |
| 1207 | */ |
| 1208 | #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ |
| 1209 | #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ |
| 1210 | #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1211 | struct iwl3945_card_state_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1212 | __le32 status; /* CARD_STATE_CMD_* request new power state */ |
| 1213 | } __attribute__ ((packed)); |
| 1214 | |
| 1215 | /* |
| 1216 | * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) |
| 1217 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1218 | struct iwl3945_card_state_notif { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1219 | __le32 flags; |
| 1220 | } __attribute__ ((packed)); |
| 1221 | |
| 1222 | #define HW_CARD_DISABLED 0x01 |
| 1223 | #define SW_CARD_DISABLED 0x02 |
| 1224 | #define RF_CARD_DISABLED 0x04 |
| 1225 | #define RXON_CARD_DISABLED 0x10 |
| 1226 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1227 | struct iwl3945_ct_kill_config { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1228 | __le32 reserved; |
| 1229 | __le32 critical_temperature_M; |
| 1230 | __le32 critical_temperature_R; |
| 1231 | } __attribute__ ((packed)); |
| 1232 | |
| 1233 | /****************************************************************************** |
| 1234 | * (8) |
| 1235 | * Scan Commands, Responses, Notifications: |
| 1236 | * |
| 1237 | *****************************************************************************/ |
| 1238 | |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1239 | /** |
| 1240 | * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table |
| 1241 | * |
| 1242 | * One for each channel in the scan list. |
| 1243 | * Each channel can independently select: |
| 1244 | * 1) SSID for directed active scans |
| 1245 | * 2) Txpower setting (for rate specified within Tx command) |
| 1246 | * 3) How long to stay on-channel (behavior may be modified by quiet_time, |
| 1247 | * quiet_plcp_th, good_CRC_th) |
| 1248 | * |
| 1249 | * To avoid uCode errors, make sure the following are true (see comments |
| 1250 | * under struct iwl3945_scan_cmd about max_out_time and quiet_time): |
| 1251 | * 1) If using passive_dwell (i.e. passive_dwell != 0): |
| 1252 | * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) |
| 1253 | * 2) quiet_time <= active_dwell |
| 1254 | * 3) If restricting off-channel time (i.e. max_out_time !=0): |
| 1255 | * passive_dwell < max_out_time |
| 1256 | * active_dwell < max_out_time |
| 1257 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1258 | struct iwl3945_scan_channel { |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1259 | /* |
| 1260 | * type is defined as: |
| 1261 | * 0:0 1 = active, 0 = passive |
| 1262 | * 1:4 SSID direct bit map; if a bit is set, then corresponding |
| 1263 | * SSID IE is transmitted in probe request. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1264 | * 5:7 reserved |
| 1265 | */ |
| 1266 | u8 type; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1267 | u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1268 | struct iwl3945_tx_power tpc; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1269 | __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ |
| 1270 | __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1271 | } __attribute__ ((packed)); |
| 1272 | |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1273 | /** |
| 1274 | * struct iwl3945_ssid_ie - directed scan network information element |
| 1275 | * |
| 1276 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field |
| 1277 | * in struct iwl3945_scan_channel; each channel may select different ssids from |
| 1278 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. |
| 1279 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1280 | struct iwl3945_ssid_ie { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1281 | u8 id; |
| 1282 | u8 len; |
| 1283 | u8 ssid[32]; |
| 1284 | } __attribute__ ((packed)); |
| 1285 | |
| 1286 | #define PROBE_OPTION_MAX 0x4 |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1287 | #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) |
| 1288 | #define IWL_GOOD_CRC_TH cpu_to_le16(1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1289 | #define IWL_MAX_SCAN_SIZE 1024 |
| 1290 | |
| 1291 | /* |
| 1292 | * REPLY_SCAN_CMD = 0x80 (command) |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1293 | * |
| 1294 | * The hardware scan command is very powerful; the driver can set it up to |
| 1295 | * maintain (relatively) normal network traffic while doing a scan in the |
| 1296 | * background. The max_out_time and suspend_time control the ratio of how |
| 1297 | * long the device stays on an associated network channel ("service channel") |
| 1298 | * vs. how long it's away from the service channel, tuned to other channels |
| 1299 | * for scanning. |
| 1300 | * |
| 1301 | * max_out_time is the max time off-channel (in usec), and suspend_time |
| 1302 | * is how long (in "extended beacon" format) that the scan is "suspended" |
| 1303 | * after returning to the service channel. That is, suspend_time is the |
| 1304 | * time that we stay on the service channel, doing normal work, between |
| 1305 | * scan segments. The driver may set these parameters differently to support |
| 1306 | * scanning when associated vs. not associated, and light vs. heavy traffic |
| 1307 | * loads when associated. |
| 1308 | * |
| 1309 | * After receiving this command, the device's scan engine does the following; |
| 1310 | * |
| 1311 | * 1) Sends SCAN_START notification to driver |
| 1312 | * 2) Checks to see if it has time to do scan for one channel |
| 1313 | * 3) Sends NULL packet, with power-save (PS) bit set to 1, |
| 1314 | * to tell AP that we're going off-channel |
| 1315 | * 4) Tunes to first channel in scan list, does active or passive scan |
| 1316 | * 5) Sends SCAN_RESULT notification to driver |
| 1317 | * 6) Checks to see if it has time to do scan on *next* channel in list |
| 1318 | * 7) Repeats 4-6 until it no longer has time to scan the next channel |
| 1319 | * before max_out_time expires |
| 1320 | * 8) Returns to service channel |
| 1321 | * 9) Sends NULL packet with PS=0 to tell AP that we're back |
| 1322 | * 10) Stays on service channel until suspend_time expires |
| 1323 | * 11) Repeats entire process 2-10 until list is complete |
| 1324 | * 12) Sends SCAN_COMPLETE notification |
| 1325 | * |
| 1326 | * For fast, efficient scans, the scan command also has support for staying on |
| 1327 | * a channel for just a short time, if doing active scanning and getting no |
| 1328 | * responses to the transmitted probe request. This time is controlled by |
| 1329 | * quiet_time, and the number of received packets below which a channel is |
| 1330 | * considered "quiet" is controlled by quiet_plcp_threshold. |
| 1331 | * |
| 1332 | * For active scanning on channels that have regulatory restrictions against |
| 1333 | * blindly transmitting, the scan can listen before transmitting, to make sure |
| 1334 | * that there is already legitimate activity on the channel. If enough |
| 1335 | * packets are cleanly received on the channel (controlled by good_CRC_th, |
| 1336 | * typical value 1), the scan engine starts transmitting probe requests. |
| 1337 | * |
| 1338 | * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. |
| 1339 | * |
| 1340 | * To avoid uCode errors, see timing restrictions described under |
| 1341 | * struct iwl3945_scan_channel. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1342 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1343 | struct iwl3945_scan_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1344 | __le16 len; |
| 1345 | u8 reserved0; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1346 | u8 channel_count; /* # channels in channel list */ |
| 1347 | __le16 quiet_time; /* dwell only this # millisecs on quiet channel |
| 1348 | * (only for active scan) */ |
| 1349 | __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ |
| 1350 | __le16 good_CRC_th; /* passive -> active promotion threshold */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1351 | __le16 reserved1; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1352 | __le32 max_out_time; /* max usec to be away from associated (service) |
| 1353 | * channel */ |
| 1354 | __le32 suspend_time; /* pause scan this long (in "extended beacon |
| 1355 | * format") when returning to service channel: |
| 1356 | * 3945; 31:24 # beacons, 19:0 additional usec, |
| 1357 | * 4965; 31:22 # beacons, 21:0 additional usec. |
| 1358 | */ |
| 1359 | __le32 flags; /* RXON_FLG_* */ |
| 1360 | __le32 filter_flags; /* RXON_FILTER_* */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1361 | |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1362 | /* For active scans (set to all-0s for passive scans). |
| 1363 | * Does not include payload. Must specify Tx rate; no rate scaling. */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1364 | struct iwl3945_tx_cmd tx_cmd; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1365 | |
| 1366 | /* For directed active scans (set to all-0s otherwise) */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1367 | struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1368 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1369 | /* |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1370 | * Probe request frame, followed by channel list. |
| 1371 | * |
| 1372 | * Size of probe request frame is specified by byte count in tx_cmd. |
| 1373 | * Channel list follows immediately after probe request frame. |
| 1374 | * Number of channels in list is specified by channel_count. |
| 1375 | * Each channel in list is of type: |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1376 | * |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1377 | * struct iwl3945_scan_channel channels[0]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1378 | * |
| 1379 | * NOTE: Only one band of channels can be scanned per pass. You |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1380 | * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait |
| 1381 | * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) |
| 1382 | * before requesting another scan. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1383 | */ |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1384 | u8 data[0]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1385 | } __attribute__ ((packed)); |
| 1386 | |
| 1387 | /* Can abort will notify by complete notification with abort status. */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1388 | #define CAN_ABORT_STATUS cpu_to_le32(0x1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1389 | /* complete notification statuses */ |
| 1390 | #define ABORT_STATUS 0x2 |
| 1391 | |
| 1392 | /* |
| 1393 | * REPLY_SCAN_CMD = 0x80 (response) |
| 1394 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1395 | struct iwl3945_scanreq_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1396 | __le32 status; /* 1: okay, 2: cannot fulfill request */ |
| 1397 | } __attribute__ ((packed)); |
| 1398 | |
| 1399 | /* |
| 1400 | * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) |
| 1401 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1402 | struct iwl3945_scanstart_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1403 | __le32 tsf_low; |
| 1404 | __le32 tsf_high; |
| 1405 | __le32 beacon_timer; |
| 1406 | u8 channel; |
| 1407 | u8 band; |
| 1408 | u8 reserved[2]; |
| 1409 | __le32 status; |
| 1410 | } __attribute__ ((packed)); |
| 1411 | |
| 1412 | #define SCAN_OWNER_STATUS 0x1; |
| 1413 | #define MEASURE_OWNER_STATUS 0x2; |
| 1414 | |
| 1415 | #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ |
| 1416 | /* |
| 1417 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) |
| 1418 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1419 | struct iwl3945_scanresults_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1420 | u8 channel; |
| 1421 | u8 band; |
| 1422 | u8 reserved[2]; |
| 1423 | __le32 tsf_low; |
| 1424 | __le32 tsf_high; |
| 1425 | __le32 statistics[NUMBER_OF_STATISTICS]; |
| 1426 | } __attribute__ ((packed)); |
| 1427 | |
| 1428 | /* |
| 1429 | * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) |
| 1430 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1431 | struct iwl3945_scancomplete_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1432 | u8 scanned_channels; |
| 1433 | u8 status; |
| 1434 | u8 reserved; |
| 1435 | u8 last_channel; |
| 1436 | __le32 tsf_low; |
| 1437 | __le32 tsf_high; |
| 1438 | } __attribute__ ((packed)); |
| 1439 | |
| 1440 | |
| 1441 | /****************************************************************************** |
| 1442 | * (9) |
| 1443 | * IBSS/AP Commands and Notifications: |
| 1444 | * |
| 1445 | *****************************************************************************/ |
| 1446 | |
| 1447 | /* |
| 1448 | * BEACON_NOTIFICATION = 0x90 (notification only, not a command) |
| 1449 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1450 | struct iwl3945_beacon_notif { |
| 1451 | struct iwl3945_tx_resp beacon_notify_hdr; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1452 | __le32 low_tsf; |
| 1453 | __le32 high_tsf; |
| 1454 | __le32 ibss_mgr_status; |
| 1455 | } __attribute__ ((packed)); |
| 1456 | |
| 1457 | /* |
| 1458 | * REPLY_TX_BEACON = 0x91 (command, has simple generic response) |
| 1459 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1460 | struct iwl3945_tx_beacon_cmd { |
| 1461 | struct iwl3945_tx_cmd tx; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1462 | __le16 tim_idx; |
| 1463 | u8 tim_size; |
| 1464 | u8 reserved1; |
| 1465 | struct ieee80211_hdr frame[0]; /* beacon frame */ |
| 1466 | } __attribute__ ((packed)); |
| 1467 | |
| 1468 | /****************************************************************************** |
| 1469 | * (10) |
| 1470 | * Statistics Commands and Notifications: |
| 1471 | * |
| 1472 | *****************************************************************************/ |
| 1473 | |
| 1474 | #define IWL_TEMP_CONVERT 260 |
| 1475 | |
| 1476 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 |
| 1477 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 |
| 1478 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 |
| 1479 | |
| 1480 | /* Used for passing to driver number of successes and failures per rate */ |
| 1481 | struct rate_histogram { |
| 1482 | union { |
| 1483 | __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
| 1484 | __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
| 1485 | __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; |
| 1486 | } success; |
| 1487 | union { |
| 1488 | __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
| 1489 | __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
| 1490 | __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; |
| 1491 | } failed; |
| 1492 | } __attribute__ ((packed)); |
| 1493 | |
| 1494 | /* statistics command response */ |
| 1495 | |
| 1496 | struct statistics_rx_phy { |
| 1497 | __le32 ina_cnt; |
| 1498 | __le32 fina_cnt; |
| 1499 | __le32 plcp_err; |
| 1500 | __le32 crc32_err; |
| 1501 | __le32 overrun_err; |
| 1502 | __le32 early_overrun_err; |
| 1503 | __le32 crc32_good; |
| 1504 | __le32 false_alarm_cnt; |
| 1505 | __le32 fina_sync_err_cnt; |
| 1506 | __le32 sfd_timeout; |
| 1507 | __le32 fina_timeout; |
| 1508 | __le32 unresponded_rts; |
| 1509 | __le32 rxe_frame_limit_overrun; |
| 1510 | __le32 sent_ack_cnt; |
| 1511 | __le32 sent_cts_cnt; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1512 | } __attribute__ ((packed)); |
| 1513 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1514 | struct statistics_rx_non_phy { |
| 1515 | __le32 bogus_cts; /* CTS received when not expecting CTS */ |
| 1516 | __le32 bogus_ack; /* ACK received when not expecting ACK */ |
| 1517 | __le32 non_bssid_frames; /* number of frames with BSSID that |
| 1518 | * doesn't belong to the STA BSSID */ |
| 1519 | __le32 filtered_frames; /* count frames that were dumped in the |
| 1520 | * filtering process */ |
| 1521 | __le32 non_channel_beacons; /* beacons with our bss id but not on |
| 1522 | * our serving channel */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1523 | } __attribute__ ((packed)); |
| 1524 | |
| 1525 | struct statistics_rx { |
| 1526 | struct statistics_rx_phy ofdm; |
| 1527 | struct statistics_rx_phy cck; |
| 1528 | struct statistics_rx_non_phy general; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1529 | } __attribute__ ((packed)); |
| 1530 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1531 | struct statistics_tx { |
| 1532 | __le32 preamble_cnt; |
| 1533 | __le32 rx_detected_cnt; |
| 1534 | __le32 bt_prio_defer_cnt; |
| 1535 | __le32 bt_prio_kill_cnt; |
| 1536 | __le32 few_bytes_cnt; |
| 1537 | __le32 cts_timeout; |
| 1538 | __le32 ack_timeout; |
| 1539 | __le32 expected_ack_cnt; |
| 1540 | __le32 actual_ack_cnt; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1541 | } __attribute__ ((packed)); |
| 1542 | |
| 1543 | struct statistics_dbg { |
| 1544 | __le32 burst_check; |
| 1545 | __le32 burst_count; |
| 1546 | __le32 reserved[4]; |
| 1547 | } __attribute__ ((packed)); |
| 1548 | |
| 1549 | struct statistics_div { |
| 1550 | __le32 tx_on_a; |
| 1551 | __le32 tx_on_b; |
| 1552 | __le32 exec_time; |
| 1553 | __le32 probe_time; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1554 | } __attribute__ ((packed)); |
| 1555 | |
| 1556 | struct statistics_general { |
| 1557 | __le32 temperature; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1558 | struct statistics_dbg dbg; |
| 1559 | __le32 sleep_time; |
| 1560 | __le32 slots_out; |
| 1561 | __le32 slots_idle; |
| 1562 | __le32 ttl_timestamp; |
| 1563 | struct statistics_div div; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1564 | } __attribute__ ((packed)); |
| 1565 | |
| 1566 | /* |
| 1567 | * REPLY_STATISTICS_CMD = 0x9c, |
| 1568 | * 3945 and 4965 identical. |
| 1569 | * |
| 1570 | * This command triggers an immediate response containing uCode statistics. |
| 1571 | * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. |
| 1572 | * |
| 1573 | * If the CLEAR_STATS configuration flag is set, uCode will clear its |
| 1574 | * internal copy of the statistics (counters) after issuing the response. |
| 1575 | * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). |
| 1576 | * |
| 1577 | * If the DISABLE_NOTIF configuration flag is set, uCode will not issue |
| 1578 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag |
| 1579 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. |
| 1580 | */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1581 | #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ |
| 1582 | #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1583 | struct iwl3945_statistics_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1584 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ |
| 1585 | } __attribute__ ((packed)); |
| 1586 | |
| 1587 | /* |
| 1588 | * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) |
| 1589 | * |
| 1590 | * By default, uCode issues this notification after receiving a beacon |
| 1591 | * while associated. To disable this behavior, set DISABLE_NOTIF flag in the |
| 1592 | * REPLY_STATISTICS_CMD 0x9c, above. |
| 1593 | * |
| 1594 | * Statistics counters continue to increment beacon after beacon, but are |
| 1595 | * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD |
| 1596 | * 0x9c with CLEAR_STATS bit set (see above). |
| 1597 | * |
| 1598 | * uCode also issues this notification during scans. uCode clears statistics |
| 1599 | * appropriately so that each notification contains statistics for only the |
| 1600 | * one channel that has just been scanned. |
| 1601 | */ |
Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1602 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) |
| 1603 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8) |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1604 | struct iwl3945_notif_statistics { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1605 | __le32 flag; |
| 1606 | struct statistics_rx rx; |
| 1607 | struct statistics_tx tx; |
| 1608 | struct statistics_general general; |
| 1609 | } __attribute__ ((packed)); |
| 1610 | |
| 1611 | |
| 1612 | /* |
| 1613 | * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) |
| 1614 | */ |
| 1615 | /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, |
| 1616 | * then this notification will be sent. */ |
| 1617 | #define CONSECUTIVE_MISSED_BCONS_TH 20 |
| 1618 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1619 | struct iwl3945_missed_beacon_notif { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1620 | __le32 consequtive_missed_beacons; |
| 1621 | __le32 total_missed_becons; |
| 1622 | __le32 num_expected_beacons; |
| 1623 | __le32 num_recvd_beacons; |
| 1624 | } __attribute__ ((packed)); |
| 1625 | |
| 1626 | /****************************************************************************** |
| 1627 | * (11) |
| 1628 | * Rx Calibration Commands: |
| 1629 | * |
| 1630 | *****************************************************************************/ |
| 1631 | |
| 1632 | #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) |
| 1633 | #define HD_TABLE_SIZE (11) |
| 1634 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1635 | struct iwl3945_sensitivity_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1636 | __le16 control; |
| 1637 | __le16 table[HD_TABLE_SIZE]; |
| 1638 | } __attribute__ ((packed)); |
| 1639 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1640 | struct iwl3945_calibration_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1641 | u8 opCode; |
| 1642 | u8 flags; |
| 1643 | __le16 reserved; |
| 1644 | s8 diff_gain_a; |
| 1645 | s8 diff_gain_b; |
| 1646 | s8 diff_gain_c; |
| 1647 | u8 reserved1; |
| 1648 | } __attribute__ ((packed)); |
| 1649 | |
| 1650 | /****************************************************************************** |
| 1651 | * (12) |
| 1652 | * Miscellaneous Commands: |
| 1653 | * |
| 1654 | *****************************************************************************/ |
| 1655 | |
| 1656 | /* |
| 1657 | * LEDs Command & Response |
| 1658 | * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) |
| 1659 | * |
| 1660 | * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), |
| 1661 | * this command turns it on or off, or sets up a periodic blinking cycle. |
| 1662 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1663 | struct iwl3945_led_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1664 | __le32 interval; /* "interval" in uSec */ |
| 1665 | u8 id; /* 1: Activity, 2: Link, 3: Tech */ |
| 1666 | u8 off; /* # intervals off while blinking; |
| 1667 | * "0", with >0 "on" value, turns LED on */ |
| 1668 | u8 on; /* # intervals on while blinking; |
| 1669 | * "0", regardless of "off", turns LED off */ |
| 1670 | u8 reserved; |
| 1671 | } __attribute__ ((packed)); |
| 1672 | |
| 1673 | /****************************************************************************** |
| 1674 | * (13) |
| 1675 | * Union of all expected notifications/responses: |
| 1676 | * |
| 1677 | *****************************************************************************/ |
| 1678 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1679 | struct iwl3945_rx_packet { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1680 | __le32 len; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1681 | struct iwl3945_cmd_header hdr; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1682 | union { |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1683 | struct iwl3945_alive_resp alive_frame; |
| 1684 | struct iwl3945_rx_frame rx_frame; |
| 1685 | struct iwl3945_tx_resp tx_resp; |
| 1686 | struct iwl3945_spectrum_notification spectrum_notif; |
| 1687 | struct iwl3945_csa_notification csa_notif; |
| 1688 | struct iwl3945_error_resp err_resp; |
| 1689 | struct iwl3945_card_state_notif card_state_notif; |
| 1690 | struct iwl3945_beacon_notif beacon_status; |
| 1691 | struct iwl3945_add_sta_resp add_sta; |
| 1692 | struct iwl3945_sleep_notification sleep_notif; |
| 1693 | struct iwl3945_spectrum_resp spectrum; |
| 1694 | struct iwl3945_notif_statistics stats; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1695 | __le32 status; |
| 1696 | u8 raw[0]; |
| 1697 | } u; |
| 1698 | } __attribute__ ((packed)); |
| 1699 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1700 | #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame)) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1701 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1702 | #endif /* __iwl3945_3945_commands_h__ */ |