Commit | Line | Data |
---|---|---|
b481de9c ZY |
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 | * | |
eb7ae89c | 8 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. |
b481de9c ZY |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify | |
01ebd063 | 11 | * it under the terms of version 2 of the GNU General Public License as |
b481de9c ZY |
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: | |
759ef89f | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
b481de9c ZY |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | |
31 | * BSD LICENSE | |
32 | * | |
eb7ae89c | 33 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. |
b481de9c ZY |
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 | *****************************************************************************/ | |
fcd427bb BC |
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 | */ | |
b481de9c | 68 | |
5d08cd1d CH |
69 | #ifndef __iwl_3945_commands_h__ |
70 | #define __iwl_3945_commands_h__ | |
b481de9c | 71 | |
c02b3acd CR |
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 | ||
b481de9c | 78 | |
69d00d27 TW |
79 | /* Tx rates */ |
80 | #define IWL_CCK_RATES 4 | |
81 | #define IWL_OFDM_RATES 8 | |
82 | #define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES) | |
83 | ||
b481de9c ZY |
84 | /****************************************************************************** |
85 | * (0) | |
80cc0c38 BC |
86 | * Commonly used structures and definitions: |
87 | * Command header, txpower | |
b481de9c ZY |
88 | * |
89 | *****************************************************************************/ | |
90 | ||
075416cd | 91 | /* iwl3945_cmd_header flags value */ |
b481de9c ZY |
92 | #define IWL_CMD_FAILED_MSK 0x40 |
93 | ||
075416cd BC |
94 | /** |
95 | * struct iwl3945_cmd_header | |
96 | * | |
97 | * This header format appears in the beginning of each command sent from the | |
98 | * driver, and each response/notification received from uCode. | |
99 | */ | |
bb8c093b | 100 | struct iwl3945_cmd_header { |
075416cd BC |
101 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
102 | u8 flags; /* IWL_CMD_* */ | |
103 | /* | |
a96a27f9 | 104 | * The driver sets up the sequence number to values of its choosing. |
075416cd BC |
105 | * uCode does not use this value, but passes it back to the driver |
106 | * when sending the response to each driver-originated command, so | |
107 | * the driver can match the response to the command. Since the values | |
108 | * don't get used by uCode, the driver may set up an arbitrary format. | |
109 | * | |
110 | * There is one exception: uCode sets bit 15 when it originates | |
111 | * the response/notification, i.e. when the response/notification | |
112 | * is not a direct response to a command sent by the driver. For | |
113 | * example, uCode issues REPLY_3945_RX when it sends a received frame | |
114 | * to the driver; it is not a direct response to any driver command. | |
b481de9c | 115 | * |
075416cd | 116 | * The Linux driver uses the following format: |
b481de9c | 117 | * |
075416cd BC |
118 | * 0:7 index/position within Tx queue |
119 | * 8:13 Tx queue selection | |
120 | * 14:14 driver sets this to indicate command is in the 'huge' | |
121 | * storage at the end of the command buffers, i.e. scan cmd | |
122 | * 15:15 uCode sets this in uCode-originated response/notification | |
b481de9c ZY |
123 | */ |
124 | __le16 sequence; | |
125 | ||
075416cd | 126 | /* command or response/notification data follows immediately */ |
b481de9c ZY |
127 | u8 data[0]; |
128 | } __attribute__ ((packed)); | |
129 | ||
80cc0c38 BC |
130 | /** |
131 | * struct iwl3945_tx_power | |
132 | * | |
133 | * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH | |
134 | * | |
135 | * Each entry contains two values: | |
136 | * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained | |
137 | * linear value that multiplies the output of the digital signal processor, | |
138 | * before being sent to the analog radio. | |
139 | * 2) Radio gain. This sets the analog gain of the radio Tx path. | |
140 | * It is a coarser setting, and behaves in a logarithmic (dB) fashion. | |
141 | * | |
142 | * Driver obtains values from struct iwl3945_tx_power power_gain_table[][]. | |
143 | */ | |
144 | struct iwl3945_tx_power { | |
145 | u8 tx_gain; /* gain for analog radio */ | |
146 | u8 dsp_atten; /* gain for DSP */ | |
147 | } __attribute__ ((packed)); | |
148 | ||
149 | /** | |
150 | * struct iwl3945_power_per_rate | |
151 | * | |
152 | * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH | |
153 | */ | |
154 | struct iwl3945_power_per_rate { | |
155 | u8 rate; /* plcp */ | |
156 | struct iwl3945_tx_power tpc; | |
157 | u8 reserved; | |
158 | } __attribute__ ((packed)); | |
159 | ||
b481de9c ZY |
160 | /****************************************************************************** |
161 | * (0a) | |
162 | * Alive and Error Commands & Responses: | |
163 | * | |
164 | *****************************************************************************/ | |
165 | ||
51e9bf5d | 166 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
b481de9c ZY |
167 | #define INITIALIZE_SUBTYPE (9) |
168 | ||
169 | /* | |
075416cd BC |
170 | * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command) |
171 | * | |
172 | * uCode issues this "initialize alive" notification once the initialization | |
173 | * uCode image has completed its work, and is ready to load the runtime image. | |
174 | * This is the *first* "alive" notification that the driver will receive after | |
175 | * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. | |
176 | * | |
177 | * See comments documenting "BSM" (bootstrap state machine). | |
b481de9c | 178 | */ |
075416cd | 179 | struct iwl3945_init_alive_resp { |
b481de9c ZY |
180 | u8 ucode_minor; |
181 | u8 ucode_major; | |
182 | __le16 reserved1; | |
183 | u8 sw_rev[8]; | |
184 | u8 ver_type; | |
075416cd | 185 | u8 ver_subtype; /* "9" for initialize alive */ |
b481de9c ZY |
186 | __le16 reserved2; |
187 | __le32 log_event_table_ptr; | |
188 | __le32 error_event_table_ptr; | |
189 | __le32 timestamp; | |
190 | __le32 is_valid; | |
191 | } __attribute__ ((packed)); | |
192 | ||
075416cd BC |
193 | |
194 | /** | |
195 | * REPLY_ALIVE = 0x1 (response only, not a command) | |
196 | * | |
197 | * uCode issues this "alive" notification once the runtime image is ready | |
198 | * to receive commands from the driver. This is the *second* "alive" | |
199 | * notification that the driver will receive after rebooting uCode; | |
200 | * this "alive" is indicated by subtype field != 9. | |
201 | * | |
202 | * See comments documenting "BSM" (bootstrap state machine). | |
203 | * | |
204 | * This response includes two pointers to structures within the device's | |
205 | * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: | |
206 | * | |
207 | * 1) log_event_table_ptr indicates base of the event log. This traces | |
208 | * a 256-entry history of uCode execution within a circular buffer. | |
209 | * | |
210 | * 2) error_event_table_ptr indicates base of the error log. This contains | |
211 | * information about any uCode error that occurs. | |
212 | * | |
213 | * The Linux driver can print both logs to the system log when a uCode error | |
214 | * occurs. | |
215 | */ | |
216 | struct iwl3945_alive_resp { | |
b481de9c ZY |
217 | u8 ucode_minor; |
218 | u8 ucode_major; | |
219 | __le16 reserved1; | |
220 | u8 sw_rev[8]; | |
221 | u8 ver_type; | |
075416cd | 222 | u8 ver_subtype; /* not "9" for runtime alive */ |
b481de9c | 223 | __le16 reserved2; |
075416cd BC |
224 | __le32 log_event_table_ptr; /* SRAM address for event log */ |
225 | __le32 error_event_table_ptr; /* SRAM address for error log */ | |
b481de9c ZY |
226 | __le32 timestamp; |
227 | __le32 is_valid; | |
b481de9c ZY |
228 | } __attribute__ ((packed)); |
229 | ||
230 | union tsf { | |
231 | u8 byte[8]; | |
232 | __le16 word[4]; | |
233 | __le32 dw[2]; | |
234 | }; | |
235 | ||
236 | /* | |
237 | * REPLY_ERROR = 0x2 (response only, not a command) | |
238 | */ | |
bb8c093b | 239 | struct iwl3945_error_resp { |
b481de9c ZY |
240 | __le32 error_type; |
241 | u8 cmd_id; | |
242 | u8 reserved1; | |
243 | __le16 bad_cmd_seq_num; | |
b481de9c | 244 | __le16 reserved2; |
b481de9c ZY |
245 | __le32 error_info; |
246 | union tsf timestamp; | |
247 | } __attribute__ ((packed)); | |
248 | ||
249 | /****************************************************************************** | |
250 | * (1) | |
251 | * RXON Commands & Responses: | |
252 | * | |
253 | *****************************************************************************/ | |
254 | ||
b481de9c ZY |
255 | /* rx_config flags */ |
256 | /* band & modulation selection */ | |
51e9bf5d HH |
257 | #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) |
258 | #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) | |
b481de9c | 259 | /* auto detection enable */ |
51e9bf5d | 260 | #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) |
b481de9c | 261 | /* TGg protection when tx */ |
51e9bf5d | 262 | #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) |
b481de9c | 263 | /* cck short slot & preamble */ |
51e9bf5d HH |
264 | #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) |
265 | #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) | |
b481de9c | 266 | /* antenna selection */ |
51e9bf5d HH |
267 | #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) |
268 | #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) | |
269 | #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) | |
270 | #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) | |
b481de9c | 271 | /* radar detection enable */ |
51e9bf5d HH |
272 | #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) |
273 | #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) | |
b481de9c ZY |
274 | /* rx response to host with 8-byte TSF |
275 | * (according to ON_AIR deassertion) */ | |
51e9bf5d | 276 | #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) |
b481de9c ZY |
277 | |
278 | /* rx_config filter flags */ | |
279 | /* accept all data frames */ | |
51e9bf5d | 280 | #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) |
b481de9c | 281 | /* pass control & management to host */ |
51e9bf5d | 282 | #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) |
b481de9c | 283 | /* accept multi-cast */ |
51e9bf5d | 284 | #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) |
b481de9c | 285 | /* don't decrypt uni-cast frames */ |
51e9bf5d | 286 | #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) |
b481de9c | 287 | /* don't decrypt multi-cast frames */ |
51e9bf5d | 288 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) |
b481de9c | 289 | /* STA is associated */ |
51e9bf5d | 290 | #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) |
b481de9c | 291 | /* transfer to host non bssid beacons in associated state */ |
51e9bf5d | 292 | #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) |
b481de9c | 293 | |
80cc0c38 | 294 | /** |
b481de9c | 295 | * REPLY_RXON = 0x10 (command, has simple generic response) |
80cc0c38 BC |
296 | * |
297 | * RXON tunes the radio tuner to a service channel, and sets up a number | |
298 | * of parameters that are used primarily for Rx, but also for Tx operations. | |
299 | * | |
300 | * NOTE: When tuning to a new channel, driver must set the | |
301 | * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent | |
302 | * info within the device, including the station tables, tx retry | |
303 | * rate tables, and txpower tables. Driver must build a new station | |
304 | * table and txpower table before transmitting anything on the RXON | |
305 | * channel. | |
306 | * | |
307 | * NOTE: All RXONs wipe clean the internal txpower table. Driver must | |
308 | * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), | |
309 | * regardless of whether RXON_FILTER_ASSOC_MSK is set. | |
b481de9c | 310 | */ |
bb8c093b | 311 | struct iwl3945_rxon_cmd { |
b481de9c ZY |
312 | u8 node_addr[6]; |
313 | __le16 reserved1; | |
314 | u8 bssid_addr[6]; | |
315 | __le16 reserved2; | |
316 | u8 wlap_bssid_addr[6]; | |
317 | __le16 reserved3; | |
318 | u8 dev_type; | |
319 | u8 air_propagation; | |
b481de9c | 320 | __le16 reserved4; |
b481de9c ZY |
321 | u8 ofdm_basic_rates; |
322 | u8 cck_basic_rates; | |
323 | __le16 assoc_id; | |
324 | __le32 flags; | |
325 | __le32 filter_flags; | |
326 | __le16 channel; | |
b481de9c | 327 | __le16 reserved5; |
b481de9c ZY |
328 | } __attribute__ ((packed)); |
329 | ||
330 | /* | |
331 | * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) | |
332 | */ | |
bb8c093b | 333 | struct iwl3945_rxon_assoc_cmd { |
b481de9c ZY |
334 | __le32 flags; |
335 | __le32 filter_flags; | |
336 | u8 ofdm_basic_rates; | |
337 | u8 cck_basic_rates; | |
b481de9c ZY |
338 | __le16 reserved; |
339 | } __attribute__ ((packed)); | |
340 | ||
341 | /* | |
342 | * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) | |
343 | */ | |
bb8c093b | 344 | struct iwl3945_rxon_time_cmd { |
b481de9c ZY |
345 | union tsf timestamp; |
346 | __le16 beacon_interval; | |
347 | __le16 atim_window; | |
348 | __le32 beacon_init_val; | |
349 | __le16 listen_interval; | |
350 | __le16 reserved; | |
351 | } __attribute__ ((packed)); | |
352 | ||
b481de9c ZY |
353 | /* |
354 | * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) | |
355 | */ | |
bb8c093b | 356 | struct iwl3945_channel_switch_cmd { |
b481de9c ZY |
357 | u8 band; |
358 | u8 expect_beacon; | |
359 | __le16 channel; | |
360 | __le32 rxon_flags; | |
361 | __le32 rxon_filter_flags; | |
362 | __le32 switch_time; | |
bb8c093b | 363 | struct iwl3945_power_per_rate power[IWL_MAX_RATES]; |
b481de9c ZY |
364 | } __attribute__ ((packed)); |
365 | ||
366 | /* | |
367 | * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) | |
368 | */ | |
bb8c093b | 369 | struct iwl3945_csa_notification { |
b481de9c ZY |
370 | __le16 band; |
371 | __le16 channel; | |
372 | __le32 status; /* 0 - OK, 1 - fail */ | |
373 | } __attribute__ ((packed)); | |
374 | ||
375 | /****************************************************************************** | |
376 | * (2) | |
377 | * Quality-of-Service (QOS) Commands & Responses: | |
378 | * | |
379 | *****************************************************************************/ | |
2054a00b BC |
380 | |
381 | /** | |
382 | * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM | |
383 | * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd | |
384 | * | |
385 | * @cw_min: Contention window, start value in numbers of slots. | |
386 | * Should be a power-of-2, minus 1. Device's default is 0x0f. | |
387 | * @cw_max: Contention window, max value in numbers of slots. | |
388 | * Should be a power-of-2, minus 1. Device's default is 0x3f. | |
389 | * @aifsn: Number of slots in Arbitration Interframe Space (before | |
390 | * performing random backoff timing prior to Tx). Device default 1. | |
391 | * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. | |
392 | * | |
393 | * Device will automatically increase contention window by (2*CW) + 1 for each | |
394 | * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW | |
395 | * value, to cap the CW value. | |
396 | */ | |
bb8c093b | 397 | struct iwl3945_ac_qos { |
b481de9c ZY |
398 | __le16 cw_min; |
399 | __le16 cw_max; | |
400 | u8 aifsn; | |
401 | u8 reserved1; | |
402 | __le16 edca_txop; | |
403 | } __attribute__ ((packed)); | |
404 | ||
405 | /* QoS flags defines */ | |
51e9bf5d HH |
406 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) |
407 | #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) | |
408 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) | |
b481de9c | 409 | |
2054a00b | 410 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ |
b481de9c ZY |
411 | #define AC_NUM 4 |
412 | ||
413 | /* | |
414 | * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) | |
2054a00b BC |
415 | * |
416 | * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs | |
417 | * 0: Background, 1: Best Effort, 2: Video, 3: Voice. | |
b481de9c | 418 | */ |
bb8c093b | 419 | struct iwl3945_qosparam_cmd { |
b481de9c | 420 | __le32 qos_flags; |
bb8c093b | 421 | struct iwl3945_ac_qos ac[AC_NUM]; |
b481de9c ZY |
422 | } __attribute__ ((packed)); |
423 | ||
424 | /****************************************************************************** | |
425 | * (3) | |
426 | * Add/Modify Stations Commands & Responses: | |
427 | * | |
428 | *****************************************************************************/ | |
429 | /* | |
430 | * Multi station support | |
431 | */ | |
2054a00b BC |
432 | |
433 | /* Special, dedicated locations within device's station table */ | |
b481de9c ZY |
434 | #define IWL_AP_ID 0 |
435 | #define IWL_MULTICAST_ID 1 | |
436 | #define IWL_STA_ID 2 | |
b481de9c ZY |
437 | #define IWL3945_BROADCAST_ID 24 |
438 | #define IWL3945_STATION_COUNT 25 | |
439 | ||
b481de9c ZY |
440 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
441 | #define IWL_INVALID_STATION 255 | |
442 | ||
51e9bf5d HH |
443 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2); |
444 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); | |
b481de9c | 445 | |
2054a00b | 446 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ |
b481de9c ZY |
447 | #define STA_CONTROL_MODIFY_MSK 0x01 |
448 | ||
449 | /* key flags __le16*/ | |
51e9bf5d HH |
450 | #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) |
451 | #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) | |
452 | #define STA_KEY_FLG_WEP cpu_to_le16(0x0001) | |
453 | #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) | |
454 | #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) | |
b481de9c ZY |
455 | |
456 | #define STA_KEY_FLG_KEYID_POS 8 | |
51e9bf5d | 457 | #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) |
eaaf7894 | 458 | /* wep key is either from global key (0) or from station info array (1) */ |
51e9bf5d | 459 | #define STA_KEY_FLG_WEP_KEY_MAP_MSK cpu_to_le16(0x0008) |
eaaf7894 EG |
460 | |
461 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ | |
51e9bf5d HH |
462 | #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) |
463 | #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) | |
b481de9c | 464 | |
2054a00b | 465 | /* Flags indicate whether to modify vs. don't change various station params */ |
b481de9c ZY |
466 | #define STA_MODIFY_KEY_MASK 0x01 |
467 | #define STA_MODIFY_TID_DISABLE_TX 0x02 | |
468 | #define STA_MODIFY_TX_RATE_MSK 0x04 | |
b481de9c | 469 | |
bb8c093b | 470 | struct iwl3945_keyinfo { |
b481de9c ZY |
471 | __le16 key_flags; |
472 | u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ | |
473 | u8 reserved1; | |
474 | __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ | |
eaaf7894 EG |
475 | u8 key_offset; |
476 | u8 reserved2; | |
b481de9c ZY |
477 | u8 key[16]; /* 16-byte unicast decryption key */ |
478 | } __attribute__ ((packed)); | |
479 | ||
b481de9c ZY |
480 | /* |
481 | * REPLY_ADD_STA = 0x18 (command) | |
2054a00b BC |
482 | * |
483 | * The device contains an internal table of per-station information, | |
484 | * with info on security keys, aggregation parameters, and Tx rates for | |
485 | * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD, | |
486 | * 3945 uses REPLY_RATE_SCALE to set up rate tables). | |
487 | * | |
488 | * REPLY_ADD_STA sets up the table entry for one station, either creating | |
489 | * a new entry, or modifying a pre-existing one. | |
490 | * | |
491 | * NOTE: RXON command (without "associated" bit set) wipes the station table | |
492 | * clean. Moving into RF_KILL state does this also. Driver must set up | |
493 | * new station table before transmitting anything on the RXON channel | |
494 | * (except active scans or active measurements; those commands carry | |
495 | * their own txpower/rate setup data). | |
496 | * | |
497 | * When getting started on a new channel, driver must set up the | |
498 | * IWL_BROADCAST_ID entry (last entry in the table). For a client | |
499 | * station in a BSS, once an AP is selected, driver sets up the AP STA | |
500 | * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP | |
501 | * are all that are needed for a BSS client station. If the device is | |
502 | * used as AP, or in an IBSS network, driver must set up station table | |
503 | * entries for all STAs in network, starting with index IWL_STA_ID. | |
b481de9c | 504 | */ |
bb8c093b | 505 | struct iwl3945_addsta_cmd { |
2054a00b | 506 | u8 mode; /* 1: modify existing, 0: add new station */ |
b481de9c ZY |
507 | u8 reserved[3]; |
508 | struct sta_id_modify sta; | |
bb8c093b | 509 | struct iwl3945_keyinfo key; |
2054a00b BC |
510 | __le32 station_flags; /* STA_FLG_* */ |
511 | __le32 station_flags_msk; /* STA_FLG_* */ | |
512 | ||
513 | /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) | |
514 | * corresponding to bit (e.g. bit 5 controls TID 5). | |
515 | * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ | |
b481de9c | 516 | __le16 tid_disable_tx; |
2054a00b | 517 | |
b481de9c | 518 | __le16 rate_n_flags; |
2054a00b BC |
519 | |
520 | /* TID for which to add block-ack support. | |
521 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | |
b481de9c | 522 | u8 add_immediate_ba_tid; |
2054a00b BC |
523 | |
524 | /* TID for which to remove block-ack support. | |
525 | * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ | |
b481de9c | 526 | u8 remove_immediate_ba_tid; |
2054a00b BC |
527 | |
528 | /* Starting Sequence Number for added block-ack support. | |
529 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | |
b481de9c | 530 | __le16 add_immediate_ba_ssn; |
b481de9c ZY |
531 | } __attribute__ ((packed)); |
532 | ||
2054a00b BC |
533 | #define ADD_STA_SUCCESS_MSK 0x1 |
534 | #define ADD_STA_NO_ROOM_IN_TABLE 0x2 | |
535 | #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 | |
b481de9c ZY |
536 | /* |
537 | * REPLY_ADD_STA = 0x18 (response) | |
538 | */ | |
bb8c093b | 539 | struct iwl3945_add_sta_resp { |
2054a00b | 540 | u8 status; /* ADD_STA_* */ |
b481de9c ZY |
541 | } __attribute__ ((packed)); |
542 | ||
b481de9c ZY |
543 | |
544 | /****************************************************************************** | |
545 | * (4) | |
546 | * Rx Responses: | |
547 | * | |
548 | *****************************************************************************/ | |
549 | ||
bb8c093b | 550 | struct iwl3945_rx_frame_stats { |
b481de9c ZY |
551 | u8 phy_count; |
552 | u8 id; | |
553 | u8 rssi; | |
554 | u8 agc; | |
555 | __le16 sig_avg; | |
556 | __le16 noise_diff; | |
557 | u8 payload[0]; | |
558 | } __attribute__ ((packed)); | |
559 | ||
bb8c093b | 560 | struct iwl3945_rx_frame_hdr { |
b481de9c ZY |
561 | __le16 channel; |
562 | __le16 phy_flags; | |
563 | u8 reserved1; | |
564 | u8 rate; | |
565 | __le16 len; | |
566 | u8 payload[0]; | |
567 | } __attribute__ ((packed)); | |
568 | ||
51e9bf5d HH |
569 | #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) |
570 | #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) | |
8211ef78 | 571 | |
51e9bf5d HH |
572 | #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) |
573 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) | |
574 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) | |
575 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) | |
576 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) | |
8211ef78 TW |
577 | |
578 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) | |
579 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) | |
580 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) | |
581 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) | |
582 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) | |
583 | ||
584 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) | |
585 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) | |
586 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) | |
587 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) | |
588 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) | |
b481de9c | 589 | |
bb8c093b | 590 | struct iwl3945_rx_frame_end { |
b481de9c ZY |
591 | __le32 status; |
592 | __le64 timestamp; | |
593 | __le32 beacon_timestamp; | |
594 | } __attribute__ ((packed)); | |
595 | ||
596 | /* | |
597 | * REPLY_3945_RX = 0x1b (response only, not a command) | |
598 | * | |
599 | * NOTE: DO NOT dereference from casts to this structure | |
600 | * It is provided only for calculating minimum data set size. | |
601 | * The actual offsets of the hdr and end are dynamic based on | |
602 | * stats.phy_count | |
603 | */ | |
bb8c093b CH |
604 | struct iwl3945_rx_frame { |
605 | struct iwl3945_rx_frame_stats stats; | |
606 | struct iwl3945_rx_frame_hdr hdr; | |
607 | struct iwl3945_rx_frame_end end; | |
b481de9c ZY |
608 | } __attribute__ ((packed)); |
609 | ||
b481de9c ZY |
610 | /****************************************************************************** |
611 | * (5) | |
612 | * Tx Commands & Responses: | |
613 | * | |
52969981 BC |
614 | * Driver must place each REPLY_TX command into one of the prioritized Tx |
615 | * queues in host DRAM, shared between driver and device. When the device's | |
616 | * Tx scheduler and uCode are preparing to transmit, the device pulls the | |
617 | * Tx command over the PCI bus via one of the device's Tx DMA channels, | |
618 | * to fill an internal FIFO from which data will be transmitted. | |
619 | * | |
620 | * uCode handles all timing and protocol related to control frames | |
621 | * (RTS/CTS/ACK), based on flags in the Tx command. | |
622 | * | |
623 | * uCode handles retrying Tx when an ACK is expected but not received. | |
624 | * This includes trying lower data rates than the one requested in the Tx | |
625 | * command, as set up by the REPLY_RATE_SCALE (for 3945) or | |
626 | * REPLY_TX_LINK_QUALITY_CMD (4965). | |
627 | * | |
628 | * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. | |
629 | * This command must be executed after every RXON command, before Tx can occur. | |
b481de9c ZY |
630 | *****************************************************************************/ |
631 | ||
52969981 BC |
632 | /* REPLY_TX Tx flags field */ |
633 | ||
634 | /* 1: Use Request-To-Send protocol before this frame. | |
635 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ | |
51e9bf5d | 636 | #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) |
52969981 BC |
637 | |
638 | /* 1: Transmit Clear-To-Send to self before this frame. | |
639 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. | |
640 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ | |
51e9bf5d | 641 | #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) |
52969981 BC |
642 | |
643 | /* 1: Expect ACK from receiving station | |
644 | * 0: Don't expect ACK (MAC header's duration field s/b 0) | |
645 | * Set this for unicast frames, but not broadcast/multicast. */ | |
51e9bf5d | 646 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) |
52969981 BC |
647 | |
648 | /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). | |
649 | * Tx command's initial_rate_index indicates first rate to try; | |
650 | * uCode walks through table for additional Tx attempts. | |
651 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. | |
652 | * This rate will be used for all Tx attempts; it will not be scaled. */ | |
51e9bf5d | 653 | #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) |
52969981 BC |
654 | |
655 | /* 1: Expect immediate block-ack. | |
656 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ | |
51e9bf5d | 657 | #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) |
52969981 BC |
658 | |
659 | /* 1: Frame requires full Tx-Op protection. | |
660 | * Set this if either RTS or CTS Tx Flag gets set. */ | |
51e9bf5d | 661 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) |
52969981 BC |
662 | |
663 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. | |
664 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ | |
51e9bf5d HH |
665 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) |
666 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) | |
667 | #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) | |
b481de9c | 668 | |
52969981 BC |
669 | /* 1: Ignore Bluetooth priority for this frame. |
670 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ | |
51e9bf5d | 671 | #define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12) |
b481de9c | 672 | |
52969981 BC |
673 | /* 1: uCode overrides sequence control field in MAC header. |
674 | * 0: Driver provides sequence control field in MAC header. | |
675 | * Set this for management frames, non-QOS data frames, non-unicast frames, | |
676 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ | |
51e9bf5d | 677 | #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) |
b481de9c | 678 | |
52969981 BC |
679 | /* 1: This frame is non-last MPDU; more fragments are coming. |
680 | * 0: Last fragment, or not using fragmentation. */ | |
51e9bf5d | 681 | #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) |
b481de9c | 682 | |
52969981 BC |
683 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. |
684 | * 0: No TSF required in outgoing frame. | |
685 | * Set this for transmitting beacons and probe responses. */ | |
51e9bf5d | 686 | #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) |
b481de9c | 687 | |
52969981 BC |
688 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword |
689 | * alignment of frame's payload data field. | |
690 | * 0: No pad | |
691 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 | |
692 | * field (but not both). Driver must align frame data (i.e. data following | |
693 | * MAC header) to DWORD boundary. */ | |
51e9bf5d | 694 | #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) |
b481de9c ZY |
695 | |
696 | /* HCCA-AP - disable duration overwriting. */ | |
51e9bf5d | 697 | #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) |
b481de9c ZY |
698 | |
699 | /* | |
700 | * TX command security control | |
701 | */ | |
702 | #define TX_CMD_SEC_WEP 0x01 | |
703 | #define TX_CMD_SEC_CCM 0x02 | |
704 | #define TX_CMD_SEC_TKIP 0x03 | |
705 | #define TX_CMD_SEC_MSK 0x03 | |
706 | #define TX_CMD_SEC_SHIFT 6 | |
707 | #define TX_CMD_SEC_KEY128 0x08 | |
708 | ||
b481de9c ZY |
709 | /* |
710 | * REPLY_TX = 0x1c (command) | |
711 | */ | |
bb8c093b | 712 | struct iwl3945_tx_cmd { |
52969981 BC |
713 | /* |
714 | * MPDU byte count: | |
715 | * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, | |
716 | * + 8 byte IV for CCM or TKIP (not used for WEP) | |
717 | * + Data payload | |
718 | * + 8-byte MIC (not used for CCM/WEP) | |
719 | * NOTE: Does not include Tx command bytes, post-MAC pad bytes, | |
720 | * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i | |
721 | * Range: 14-2342 bytes. | |
722 | */ | |
b481de9c | 723 | __le16 len; |
52969981 BC |
724 | |
725 | /* | |
726 | * MPDU or MSDU byte count for next frame. | |
727 | * Used for fragmentation and bursting, but not 11n aggregation. | |
728 | * Same as "len", but for next frame. Set to 0 if not applicable. | |
729 | */ | |
b481de9c | 730 | __le16 next_frame_len; |
52969981 BC |
731 | |
732 | __le32 tx_flags; /* TX_CMD_FLG_* */ | |
733 | ||
b481de9c | 734 | u8 rate; |
52969981 BC |
735 | |
736 | /* Index of recipient station in uCode's station table */ | |
b481de9c ZY |
737 | u8 sta_id; |
738 | u8 tid_tspec; | |
b481de9c | 739 | u8 sec_ctl; |
b481de9c | 740 | u8 key[16]; |
b481de9c ZY |
741 | union { |
742 | u8 byte[8]; | |
743 | __le16 word[4]; | |
744 | __le32 dw[2]; | |
745 | } tkip_mic; | |
746 | __le32 next_frame_info; | |
b481de9c ZY |
747 | union { |
748 | __le32 life_time; | |
749 | __le32 attempt; | |
750 | } stop_time; | |
b481de9c | 751 | u8 supp_rates[2]; |
b481de9c ZY |
752 | u8 rts_retry_limit; /*byte 50 */ |
753 | u8 data_retry_limit; /*byte 51 */ | |
b481de9c ZY |
754 | union { |
755 | __le16 pm_frame_timeout; | |
756 | __le16 attempt_duration; | |
757 | } timeout; | |
52969981 BC |
758 | |
759 | /* | |
760 | * Duration of EDCA burst Tx Opportunity, in 32-usec units. | |
761 | * Set this if txop time is not specified by HCCA protocol (e.g. by AP). | |
762 | */ | |
b481de9c | 763 | __le16 driver_txop; |
52969981 BC |
764 | |
765 | /* | |
766 | * MAC header goes here, followed by 2 bytes padding if MAC header | |
767 | * length is 26 or 30 bytes, followed by payload data | |
768 | */ | |
b481de9c ZY |
769 | u8 payload[0]; |
770 | struct ieee80211_hdr hdr[0]; | |
771 | } __attribute__ ((packed)); | |
772 | ||
b481de9c ZY |
773 | /* |
774 | * REPLY_TX = 0x1c (response) | |
775 | */ | |
bb8c093b | 776 | struct iwl3945_tx_resp { |
b481de9c ZY |
777 | u8 failure_rts; |
778 | u8 failure_frame; | |
779 | u8 bt_kill_count; | |
780 | u8 rate; | |
781 | __le32 wireless_media_time; | |
52969981 | 782 | __le32 status; /* TX status */ |
b481de9c ZY |
783 | } __attribute__ ((packed)); |
784 | ||
785 | /* | |
786 | * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) | |
787 | */ | |
bb8c093b | 788 | struct iwl3945_txpowertable_cmd { |
b481de9c ZY |
789 | u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ |
790 | u8 reserved; | |
791 | __le16 channel; | |
bb8c093b | 792 | struct iwl3945_power_per_rate power[IWL_MAX_RATES]; |
b481de9c ZY |
793 | } __attribute__ ((packed)); |
794 | ||
bb8c093b | 795 | struct iwl3945_rate_scaling_info { |
b481de9c ZY |
796 | __le16 rate_n_flags; |
797 | u8 try_cnt; | |
798 | u8 next_rate_index; | |
799 | } __attribute__ ((packed)); | |
800 | ||
801 | /** | |
bb8c093b | 802 | * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response |
b481de9c ZY |
803 | * |
804 | * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) | |
805 | * | |
806 | * NOTE: The table of rates passed to the uCode via the | |
807 | * RATE_SCALE command sets up the corresponding order of | |
808 | * rates used for all related commands, including rate | |
809 | * masks, etc. | |
810 | * | |
811 | * For example, if you set 9MB (PLCP 0x0f) as the first | |
812 | * rate in the rate table, the bit mask for that rate | |
813 | * when passed through ofdm_basic_rates on the REPLY_RXON | |
8a1b0245 | 814 | * command would be bit 0 (1 << 0) |
b481de9c | 815 | */ |
bb8c093b | 816 | struct iwl3945_rate_scaling_cmd { |
b481de9c ZY |
817 | u8 table_id; |
818 | u8 reserved[3]; | |
bb8c093b | 819 | struct iwl3945_rate_scaling_info table[IWL_MAX_RATES]; |
b481de9c ZY |
820 | } __attribute__ ((packed)); |
821 | ||
b481de9c ZY |
822 | /* |
823 | * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) | |
3058f021 BC |
824 | * |
825 | * 3945 and 4965 support hardware handshake with Bluetooth device on | |
826 | * same platform. Bluetooth device alerts wireless device when it will Tx; | |
a96a27f9 | 827 | * wireless device can delay or kill its own Tx to accommodate. |
b481de9c | 828 | */ |
bb8c093b | 829 | struct iwl3945_bt_cmd { |
b481de9c ZY |
830 | u8 flags; |
831 | u8 lead_time; | |
832 | u8 max_kill; | |
833 | u8 reserved; | |
834 | __le32 kill_ack_mask; | |
835 | __le32 kill_cts_mask; | |
836 | } __attribute__ ((packed)); | |
837 | ||
838 | /****************************************************************************** | |
839 | * (6) | |
840 | * Spectrum Management (802.11h) Commands, Responses, Notifications: | |
841 | * | |
842 | *****************************************************************************/ | |
843 | ||
844 | /* | |
845 | * Spectrum Management | |
846 | */ | |
847 | #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ | |
848 | RXON_FILTER_CTL2HOST_MSK | \ | |
849 | RXON_FILTER_ACCEPT_GRP_MSK | \ | |
850 | RXON_FILTER_DIS_DECRYPT_MSK | \ | |
851 | RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ | |
852 | RXON_FILTER_ASSOC_MSK | \ | |
853 | RXON_FILTER_BCON_AWARE_MSK) | |
854 | ||
bb8c093b | 855 | struct iwl3945_measure_channel { |
b481de9c ZY |
856 | __le32 duration; /* measurement duration in extended beacon |
857 | * format */ | |
858 | u8 channel; /* channel to measure */ | |
bb8c093b | 859 | u8 type; /* see enum iwl3945_measure_type */ |
b481de9c ZY |
860 | __le16 reserved; |
861 | } __attribute__ ((packed)); | |
862 | ||
b481de9c ZY |
863 | |
864 | #define HW_CARD_DISABLED 0x01 | |
865 | #define SW_CARD_DISABLED 0x02 | |
866 | #define RF_CARD_DISABLED 0x04 | |
867 | #define RXON_CARD_DISABLED 0x10 | |
868 | ||
bb8c093b | 869 | struct iwl3945_ct_kill_config { |
b481de9c ZY |
870 | __le32 reserved; |
871 | __le32 critical_temperature_M; | |
872 | __le32 critical_temperature_R; | |
873 | } __attribute__ ((packed)); | |
874 | ||
875 | /****************************************************************************** | |
876 | * (8) | |
877 | * Scan Commands, Responses, Notifications: | |
878 | * | |
879 | *****************************************************************************/ | |
880 | ||
3058f021 BC |
881 | /** |
882 | * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table | |
883 | * | |
884 | * One for each channel in the scan list. | |
885 | * Each channel can independently select: | |
886 | * 1) SSID for directed active scans | |
887 | * 2) Txpower setting (for rate specified within Tx command) | |
888 | * 3) How long to stay on-channel (behavior may be modified by quiet_time, | |
889 | * quiet_plcp_th, good_CRC_th) | |
890 | * | |
891 | * To avoid uCode errors, make sure the following are true (see comments | |
892 | * under struct iwl3945_scan_cmd about max_out_time and quiet_time): | |
893 | * 1) If using passive_dwell (i.e. passive_dwell != 0): | |
894 | * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) | |
895 | * 2) quiet_time <= active_dwell | |
896 | * 3) If restricting off-channel time (i.e. max_out_time !=0): | |
897 | * passive_dwell < max_out_time | |
898 | * active_dwell < max_out_time | |
899 | */ | |
bb8c093b | 900 | struct iwl3945_scan_channel { |
3058f021 BC |
901 | /* |
902 | * type is defined as: | |
903 | * 0:0 1 = active, 0 = passive | |
904 | * 1:4 SSID direct bit map; if a bit is set, then corresponding | |
905 | * SSID IE is transmitted in probe request. | |
b481de9c ZY |
906 | * 5:7 reserved |
907 | */ | |
908 | u8 type; | |
3058f021 | 909 | u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */ |
bb8c093b | 910 | struct iwl3945_tx_power tpc; |
3058f021 BC |
911 | __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ |
912 | __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ | |
b481de9c ZY |
913 | } __attribute__ ((packed)); |
914 | ||
3058f021 BC |
915 | /** |
916 | * struct iwl3945_ssid_ie - directed scan network information element | |
917 | * | |
918 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field | |
919 | * in struct iwl3945_scan_channel; each channel may select different ssids from | |
920 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. | |
921 | */ | |
bb8c093b | 922 | struct iwl3945_ssid_ie { |
b481de9c ZY |
923 | u8 id; |
924 | u8 len; | |
925 | u8 ssid[32]; | |
926 | } __attribute__ ((packed)); | |
927 | ||
600c0e11 TW |
928 | /* uCode API-1 take 4 probes */ |
929 | #define PROBE_OPTION_MAX_API1 0x4 | |
51e9bf5d HH |
930 | #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) |
931 | #define IWL_GOOD_CRC_TH cpu_to_le16(1) | |
b481de9c ZY |
932 | #define IWL_MAX_SCAN_SIZE 1024 |
933 | ||
934 | /* | |
935 | * REPLY_SCAN_CMD = 0x80 (command) | |
3058f021 BC |
936 | * |
937 | * The hardware scan command is very powerful; the driver can set it up to | |
938 | * maintain (relatively) normal network traffic while doing a scan in the | |
939 | * background. The max_out_time and suspend_time control the ratio of how | |
940 | * long the device stays on an associated network channel ("service channel") | |
941 | * vs. how long it's away from the service channel, tuned to other channels | |
942 | * for scanning. | |
943 | * | |
944 | * max_out_time is the max time off-channel (in usec), and suspend_time | |
945 | * is how long (in "extended beacon" format) that the scan is "suspended" | |
946 | * after returning to the service channel. That is, suspend_time is the | |
947 | * time that we stay on the service channel, doing normal work, between | |
948 | * scan segments. The driver may set these parameters differently to support | |
949 | * scanning when associated vs. not associated, and light vs. heavy traffic | |
950 | * loads when associated. | |
951 | * | |
952 | * After receiving this command, the device's scan engine does the following; | |
953 | * | |
954 | * 1) Sends SCAN_START notification to driver | |
955 | * 2) Checks to see if it has time to do scan for one channel | |
956 | * 3) Sends NULL packet, with power-save (PS) bit set to 1, | |
957 | * to tell AP that we're going off-channel | |
958 | * 4) Tunes to first channel in scan list, does active or passive scan | |
959 | * 5) Sends SCAN_RESULT notification to driver | |
960 | * 6) Checks to see if it has time to do scan on *next* channel in list | |
961 | * 7) Repeats 4-6 until it no longer has time to scan the next channel | |
962 | * before max_out_time expires | |
963 | * 8) Returns to service channel | |
964 | * 9) Sends NULL packet with PS=0 to tell AP that we're back | |
965 | * 10) Stays on service channel until suspend_time expires | |
966 | * 11) Repeats entire process 2-10 until list is complete | |
967 | * 12) Sends SCAN_COMPLETE notification | |
968 | * | |
969 | * For fast, efficient scans, the scan command also has support for staying on | |
970 | * a channel for just a short time, if doing active scanning and getting no | |
971 | * responses to the transmitted probe request. This time is controlled by | |
972 | * quiet_time, and the number of received packets below which a channel is | |
973 | * considered "quiet" is controlled by quiet_plcp_threshold. | |
974 | * | |
975 | * For active scanning on channels that have regulatory restrictions against | |
976 | * blindly transmitting, the scan can listen before transmitting, to make sure | |
977 | * that there is already legitimate activity on the channel. If enough | |
978 | * packets are cleanly received on the channel (controlled by good_CRC_th, | |
979 | * typical value 1), the scan engine starts transmitting probe requests. | |
980 | * | |
981 | * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. | |
982 | * | |
983 | * To avoid uCode errors, see timing restrictions described under | |
984 | * struct iwl3945_scan_channel. | |
b481de9c | 985 | */ |
bb8c093b | 986 | struct iwl3945_scan_cmd { |
b481de9c ZY |
987 | __le16 len; |
988 | u8 reserved0; | |
3058f021 BC |
989 | u8 channel_count; /* # channels in channel list */ |
990 | __le16 quiet_time; /* dwell only this # millisecs on quiet channel | |
991 | * (only for active scan) */ | |
992 | __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ | |
993 | __le16 good_CRC_th; /* passive -> active promotion threshold */ | |
b481de9c | 994 | __le16 reserved1; |
3058f021 BC |
995 | __le32 max_out_time; /* max usec to be away from associated (service) |
996 | * channel */ | |
997 | __le32 suspend_time; /* pause scan this long (in "extended beacon | |
998 | * format") when returning to service channel: | |
999 | * 3945; 31:24 # beacons, 19:0 additional usec, | |
1000 | * 4965; 31:22 # beacons, 21:0 additional usec. | |
1001 | */ | |
1002 | __le32 flags; /* RXON_FLG_* */ | |
1003 | __le32 filter_flags; /* RXON_FILTER_* */ | |
1004 | ||
1005 | /* For active scans (set to all-0s for passive scans). | |
1006 | * Does not include payload. Must specify Tx rate; no rate scaling. */ | |
bb8c093b | 1007 | struct iwl3945_tx_cmd tx_cmd; |
3058f021 BC |
1008 | |
1009 | /* For directed active scans (set to all-0s otherwise) */ | |
600c0e11 | 1010 | struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX_API1]; |
b481de9c | 1011 | |
b481de9c | 1012 | /* |
3058f021 BC |
1013 | * Probe request frame, followed by channel list. |
1014 | * | |
1015 | * Size of probe request frame is specified by byte count in tx_cmd. | |
1016 | * Channel list follows immediately after probe request frame. | |
1017 | * Number of channels in list is specified by channel_count. | |
1018 | * Each channel in list is of type: | |
b481de9c | 1019 | * |
bb8c093b | 1020 | * struct iwl3945_scan_channel channels[0]; |
b481de9c ZY |
1021 | * |
1022 | * NOTE: Only one band of channels can be scanned per pass. You | |
3058f021 BC |
1023 | * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait |
1024 | * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) | |
1025 | * before requesting another scan. | |
b481de9c | 1026 | */ |
3058f021 | 1027 | u8 data[0]; |
b481de9c ZY |
1028 | } __attribute__ ((packed)); |
1029 | ||
1030 | /* Can abort will notify by complete notification with abort status. */ | |
51e9bf5d | 1031 | #define CAN_ABORT_STATUS cpu_to_le32(0x1) |
b481de9c ZY |
1032 | /* complete notification statuses */ |
1033 | #define ABORT_STATUS 0x2 | |
1034 | ||
1035 | /* | |
1036 | * REPLY_SCAN_CMD = 0x80 (response) | |
1037 | */ | |
bb8c093b | 1038 | struct iwl3945_scanreq_notification { |
b481de9c ZY |
1039 | __le32 status; /* 1: okay, 2: cannot fulfill request */ |
1040 | } __attribute__ ((packed)); | |
1041 | ||
1042 | /* | |
1043 | * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) | |
1044 | */ | |
bb8c093b | 1045 | struct iwl3945_scanstart_notification { |
b481de9c ZY |
1046 | __le32 tsf_low; |
1047 | __le32 tsf_high; | |
1048 | __le32 beacon_timer; | |
1049 | u8 channel; | |
1050 | u8 band; | |
1051 | u8 reserved[2]; | |
1052 | __le32 status; | |
1053 | } __attribute__ ((packed)); | |
1054 | ||
1055 | #define SCAN_OWNER_STATUS 0x1; | |
1056 | #define MEASURE_OWNER_STATUS 0x2; | |
1057 | ||
1058 | #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ | |
1059 | /* | |
1060 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) | |
1061 | */ | |
bb8c093b | 1062 | struct iwl3945_scanresults_notification { |
b481de9c ZY |
1063 | u8 channel; |
1064 | u8 band; | |
1065 | u8 reserved[2]; | |
1066 | __le32 tsf_low; | |
1067 | __le32 tsf_high; | |
1068 | __le32 statistics[NUMBER_OF_STATISTICS]; | |
1069 | } __attribute__ ((packed)); | |
1070 | ||
1071 | /* | |
1072 | * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) | |
1073 | */ | |
bb8c093b | 1074 | struct iwl3945_scancomplete_notification { |
b481de9c ZY |
1075 | u8 scanned_channels; |
1076 | u8 status; | |
1077 | u8 reserved; | |
1078 | u8 last_channel; | |
1079 | __le32 tsf_low; | |
1080 | __le32 tsf_high; | |
1081 | } __attribute__ ((packed)); | |
1082 | ||
1083 | ||
1084 | /****************************************************************************** | |
1085 | * (9) | |
1086 | * IBSS/AP Commands and Notifications: | |
1087 | * | |
1088 | *****************************************************************************/ | |
1089 | ||
1090 | /* | |
1091 | * BEACON_NOTIFICATION = 0x90 (notification only, not a command) | |
1092 | */ | |
bb8c093b CH |
1093 | struct iwl3945_beacon_notif { |
1094 | struct iwl3945_tx_resp beacon_notify_hdr; | |
b481de9c ZY |
1095 | __le32 low_tsf; |
1096 | __le32 high_tsf; | |
1097 | __le32 ibss_mgr_status; | |
1098 | } __attribute__ ((packed)); | |
1099 | ||
1100 | /* | |
1101 | * REPLY_TX_BEACON = 0x91 (command, has simple generic response) | |
1102 | */ | |
bb8c093b CH |
1103 | struct iwl3945_tx_beacon_cmd { |
1104 | struct iwl3945_tx_cmd tx; | |
b481de9c ZY |
1105 | __le16 tim_idx; |
1106 | u8 tim_size; | |
1107 | u8 reserved1; | |
1108 | struct ieee80211_hdr frame[0]; /* beacon frame */ | |
1109 | } __attribute__ ((packed)); | |
1110 | ||
1111 | /****************************************************************************** | |
1112 | * (10) | |
1113 | * Statistics Commands and Notifications: | |
1114 | * | |
1115 | *****************************************************************************/ | |
1116 | ||
600c0e11 | 1117 | struct iwl39_statistics_rx_phy { |
b481de9c ZY |
1118 | __le32 ina_cnt; |
1119 | __le32 fina_cnt; | |
1120 | __le32 plcp_err; | |
1121 | __le32 crc32_err; | |
1122 | __le32 overrun_err; | |
1123 | __le32 early_overrun_err; | |
1124 | __le32 crc32_good; | |
1125 | __le32 false_alarm_cnt; | |
1126 | __le32 fina_sync_err_cnt; | |
1127 | __le32 sfd_timeout; | |
1128 | __le32 fina_timeout; | |
1129 | __le32 unresponded_rts; | |
1130 | __le32 rxe_frame_limit_overrun; | |
1131 | __le32 sent_ack_cnt; | |
1132 | __le32 sent_cts_cnt; | |
b481de9c | 1133 | } __attribute__ ((packed)); |
b481de9c | 1134 | |
600c0e11 | 1135 | struct iwl39_statistics_rx_non_phy { |
b481de9c ZY |
1136 | __le32 bogus_cts; /* CTS received when not expecting CTS */ |
1137 | __le32 bogus_ack; /* ACK received when not expecting ACK */ | |
1138 | __le32 non_bssid_frames; /* number of frames with BSSID that | |
1139 | * doesn't belong to the STA BSSID */ | |
1140 | __le32 filtered_frames; /* count frames that were dumped in the | |
1141 | * filtering process */ | |
1142 | __le32 non_channel_beacons; /* beacons with our bss id but not on | |
1143 | * our serving channel */ | |
b481de9c ZY |
1144 | } __attribute__ ((packed)); |
1145 | ||
600c0e11 TW |
1146 | struct iwl39_statistics_rx { |
1147 | struct iwl39_statistics_rx_phy ofdm; | |
1148 | struct iwl39_statistics_rx_phy cck; | |
1149 | struct iwl39_statistics_rx_non_phy general; | |
b481de9c | 1150 | } __attribute__ ((packed)); |
b481de9c | 1151 | |
600c0e11 | 1152 | struct iwl39_statistics_tx { |
b481de9c ZY |
1153 | __le32 preamble_cnt; |
1154 | __le32 rx_detected_cnt; | |
1155 | __le32 bt_prio_defer_cnt; | |
1156 | __le32 bt_prio_kill_cnt; | |
1157 | __le32 few_bytes_cnt; | |
1158 | __le32 cts_timeout; | |
1159 | __le32 ack_timeout; | |
1160 | __le32 expected_ack_cnt; | |
1161 | __le32 actual_ack_cnt; | |
b481de9c ZY |
1162 | } __attribute__ ((packed)); |
1163 | ||
600c0e11 | 1164 | struct iwl39_statistics_div { |
b481de9c ZY |
1165 | __le32 tx_on_a; |
1166 | __le32 tx_on_b; | |
1167 | __le32 exec_time; | |
1168 | __le32 probe_time; | |
b481de9c ZY |
1169 | } __attribute__ ((packed)); |
1170 | ||
600c0e11 | 1171 | struct iwl39_statistics_general { |
b481de9c | 1172 | __le32 temperature; |
b481de9c ZY |
1173 | struct statistics_dbg dbg; |
1174 | __le32 sleep_time; | |
1175 | __le32 slots_out; | |
1176 | __le32 slots_idle; | |
1177 | __le32 ttl_timestamp; | |
600c0e11 | 1178 | struct iwl39_statistics_div div; |
b481de9c ZY |
1179 | } __attribute__ ((packed)); |
1180 | ||
1181 | /* | |
1182 | * REPLY_STATISTICS_CMD = 0x9c, | |
1183 | * 3945 and 4965 identical. | |
1184 | * | |
1185 | * This command triggers an immediate response containing uCode statistics. | |
1186 | * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. | |
1187 | * | |
1188 | * If the CLEAR_STATS configuration flag is set, uCode will clear its | |
1189 | * internal copy of the statistics (counters) after issuing the response. | |
1190 | * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). | |
1191 | * | |
1192 | * If the DISABLE_NOTIF configuration flag is set, uCode will not issue | |
1193 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag | |
1194 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. | |
1195 | */ | |
51e9bf5d HH |
1196 | #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ |
1197 | #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ | |
bb8c093b | 1198 | struct iwl3945_statistics_cmd { |
b481de9c ZY |
1199 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ |
1200 | } __attribute__ ((packed)); | |
1201 | ||
1202 | /* | |
1203 | * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) | |
1204 | * | |
1205 | * By default, uCode issues this notification after receiving a beacon | |
1206 | * while associated. To disable this behavior, set DISABLE_NOTIF flag in the | |
1207 | * REPLY_STATISTICS_CMD 0x9c, above. | |
1208 | * | |
1209 | * Statistics counters continue to increment beacon after beacon, but are | |
1210 | * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD | |
1211 | * 0x9c with CLEAR_STATS bit set (see above). | |
1212 | * | |
1213 | * uCode also issues this notification during scans. uCode clears statistics | |
1214 | * appropriately so that each notification contains statistics for only the | |
1215 | * one channel that has just been scanned. | |
1216 | */ | |
51e9bf5d HH |
1217 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) |
1218 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8) | |
bb8c093b | 1219 | struct iwl3945_notif_statistics { |
b481de9c ZY |
1220 | __le32 flag; |
1221 | struct statistics_rx rx; | |
1222 | struct statistics_tx tx; | |
1223 | struct statistics_general general; | |
1224 | } __attribute__ ((packed)); | |
1225 | ||
1226 | ||
1227 | /* | |
1228 | * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) | |
1229 | */ | |
1230 | /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, | |
1231 | * then this notification will be sent. */ | |
1232 | #define CONSECUTIVE_MISSED_BCONS_TH 20 | |
1233 | ||
bb8c093b | 1234 | struct iwl3945_missed_beacon_notif { |
b481de9c ZY |
1235 | __le32 consequtive_missed_beacons; |
1236 | __le32 total_missed_becons; | |
1237 | __le32 num_expected_beacons; | |
1238 | __le32 num_recvd_beacons; | |
1239 | } __attribute__ ((packed)); | |
1240 | ||
1241 | /****************************************************************************** | |
1242 | * (11) | |
1243 | * Rx Calibration Commands: | |
1244 | * | |
1245 | *****************************************************************************/ | |
1246 | ||
1247 | #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) | |
1248 | #define HD_TABLE_SIZE (11) | |
1249 | ||
bb8c093b | 1250 | struct iwl3945_sensitivity_cmd { |
b481de9c ZY |
1251 | __le16 control; |
1252 | __le16 table[HD_TABLE_SIZE]; | |
1253 | } __attribute__ ((packed)); | |
1254 | ||
bb8c093b | 1255 | struct iwl3945_calibration_cmd { |
b481de9c ZY |
1256 | u8 opCode; |
1257 | u8 flags; | |
1258 | __le16 reserved; | |
1259 | s8 diff_gain_a; | |
1260 | s8 diff_gain_b; | |
1261 | s8 diff_gain_c; | |
1262 | u8 reserved1; | |
1263 | } __attribute__ ((packed)); | |
1264 | ||
1265 | /****************************************************************************** | |
1266 | * (12) | |
1267 | * Miscellaneous Commands: | |
1268 | * | |
1269 | *****************************************************************************/ | |
1270 | ||
1271 | /* | |
1272 | * LEDs Command & Response | |
1273 | * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) | |
1274 | * | |
1275 | * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), | |
1276 | * this command turns it on or off, or sets up a periodic blinking cycle. | |
1277 | */ | |
bb8c093b | 1278 | struct iwl3945_led_cmd { |
b481de9c ZY |
1279 | __le32 interval; /* "interval" in uSec */ |
1280 | u8 id; /* 1: Activity, 2: Link, 3: Tech */ | |
1281 | u8 off; /* # intervals off while blinking; | |
1282 | * "0", with >0 "on" value, turns LED on */ | |
1283 | u8 on; /* # intervals on while blinking; | |
1284 | * "0", regardless of "off", turns LED off */ | |
1285 | u8 reserved; | |
1286 | } __attribute__ ((packed)); | |
1287 | ||
1288 | /****************************************************************************** | |
1289 | * (13) | |
1290 | * Union of all expected notifications/responses: | |
1291 | * | |
1292 | *****************************************************************************/ | |
1293 | ||
bb8c093b | 1294 | struct iwl3945_rx_packet { |
b481de9c | 1295 | __le32 len; |
bb8c093b | 1296 | struct iwl3945_cmd_header hdr; |
b481de9c | 1297 | union { |
bb8c093b CH |
1298 | struct iwl3945_alive_resp alive_frame; |
1299 | struct iwl3945_rx_frame rx_frame; | |
1300 | struct iwl3945_tx_resp tx_resp; | |
600c0e11 TW |
1301 | struct iwl_spectrum_notification spectrum_notif; |
1302 | struct iwl_csa_notification csa_notif; | |
bb8c093b | 1303 | struct iwl3945_error_resp err_resp; |
600c0e11 | 1304 | struct iwl_card_state_notif card_state_notif; |
bb8c093b CH |
1305 | struct iwl3945_beacon_notif beacon_status; |
1306 | struct iwl3945_add_sta_resp add_sta; | |
600c0e11 TW |
1307 | struct iwl_sleep_notification sleep_notif; |
1308 | struct iwl_spectrum_resp spectrum; | |
bb8c093b | 1309 | struct iwl3945_notif_statistics stats; |
b481de9c ZY |
1310 | __le32 status; |
1311 | u8 raw[0]; | |
1312 | } u; | |
1313 | } __attribute__ ((packed)); | |
1314 | ||
bb8c093b | 1315 | #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame)) |
b481de9c | 1316 | |
bb8c093b | 1317 | #endif /* __iwl3945_3945_commands_h__ */ |