blob: fe71e0aa37158296b856c7ea94a102c77b4ee558 [file] [log] [blame]
Zhu Yib481de92007-09-25 17:54:57 -07001/******************************************************************************
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 Chatreeb7ae892008-03-11 16:17:17 -07008 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
Zhu Yib481de92007-09-25 17:54:57 -07009 *
10 * This program is free software; you can redistribute it and/or modify
Ian Schram01ebd062007-10-25 17:15:22 +080011 * it under the terms of version 2 of the GNU General Public License as
Zhu Yib481de92007-09-25 17:54:57 -070012 * 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:
Winkler, Tomas759ef892008-12-09 11:28:58 -080028 * Intel Linux Wireless <ilw@linux.intel.com>
Zhu Yib481de92007-09-25 17:54:57 -070029 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
Reinette Chatreeb7ae892008-03-11 16:17:17 -070033 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
Zhu Yib481de92007-09-25 17:54:57 -070034 * 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 Cahillfcd427b2007-11-29 11:10:00 +080063/*
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 Yib481de92007-09-25 17:54:57 -070068
Christoph Hellwig5d08cd12007-10-25 17:15:50 +080069#ifndef __iwl_3945_commands_h__
70#define __iwl_3945_commands_h__
Zhu Yib481de92007-09-25 17:54:57 -070071
Zhu Yib481de92007-09-25 17:54:57 -070072/******************************************************************************
73 * (0)
Ben Cahill80cc0c32007-11-29 11:10:09 +080074 * Commonly used structures and definitions:
75 * Command header, txpower
Zhu Yib481de92007-09-25 17:54:57 -070076 *
77 *****************************************************************************/
Ben Cahill80cc0c32007-11-29 11:10:09 +080078/**
79 * struct iwl3945_tx_power
80 *
81 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
82 *
83 * Each entry contains two values:
84 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
85 * linear value that multiplies the output of the digital signal processor,
86 * before being sent to the analog radio.
87 * 2) Radio gain. This sets the analog gain of the radio Tx path.
88 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
89 *
90 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
91 */
92struct iwl3945_tx_power {
93 u8 tx_gain; /* gain for analog radio */
94 u8 dsp_atten; /* gain for DSP */
95} __attribute__ ((packed));
96
97/**
98 * struct iwl3945_power_per_rate
99 *
100 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
101 */
102struct iwl3945_power_per_rate {
103 u8 rate; /* plcp */
104 struct iwl3945_tx_power tpc;
105 u8 reserved;
106} __attribute__ ((packed));
107
Zhu Yib481de92007-09-25 17:54:57 -0700108/******************************************************************************
109 * (0a)
110 * Alive and Error Commands & Responses:
111 *
112 *****************************************************************************/
113
Zhu Yib481de92007-09-25 17:54:57 -0700114
115/*
Ben Cahill075416c2007-11-29 11:10:08 +0800116 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
117 *
118 * uCode issues this "initialize alive" notification once the initialization
119 * uCode image has completed its work, and is ready to load the runtime image.
120 * This is the *first* "alive" notification that the driver will receive after
121 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
122 *
123 * See comments documenting "BSM" (bootstrap state machine).
Zhu Yib481de92007-09-25 17:54:57 -0700124 */
Ben Cahill075416c2007-11-29 11:10:08 +0800125struct iwl3945_init_alive_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700126 u8 ucode_minor;
127 u8 ucode_major;
128 __le16 reserved1;
129 u8 sw_rev[8];
130 u8 ver_type;
Ben Cahill075416c2007-11-29 11:10:08 +0800131 u8 ver_subtype; /* "9" for initialize alive */
Zhu Yib481de92007-09-25 17:54:57 -0700132 __le16 reserved2;
133 __le32 log_event_table_ptr;
134 __le32 error_event_table_ptr;
135 __le32 timestamp;
136 __le32 is_valid;
137} __attribute__ ((packed));
138
Ben Cahill075416c2007-11-29 11:10:08 +0800139
140/**
141 * REPLY_ALIVE = 0x1 (response only, not a command)
142 *
143 * uCode issues this "alive" notification once the runtime image is ready
144 * to receive commands from the driver. This is the *second* "alive"
145 * notification that the driver will receive after rebooting uCode;
146 * this "alive" is indicated by subtype field != 9.
147 *
148 * See comments documenting "BSM" (bootstrap state machine).
149 *
150 * This response includes two pointers to structures within the device's
151 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
152 *
153 * 1) log_event_table_ptr indicates base of the event log. This traces
154 * a 256-entry history of uCode execution within a circular buffer.
155 *
156 * 2) error_event_table_ptr indicates base of the error log. This contains
157 * information about any uCode error that occurs.
158 *
159 * The Linux driver can print both logs to the system log when a uCode error
160 * occurs.
161 */
162struct iwl3945_alive_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700163 u8 ucode_minor;
164 u8 ucode_major;
165 __le16 reserved1;
166 u8 sw_rev[8];
167 u8 ver_type;
Ben Cahill075416c2007-11-29 11:10:08 +0800168 u8 ver_subtype; /* not "9" for runtime alive */
Zhu Yib481de92007-09-25 17:54:57 -0700169 __le16 reserved2;
Ben Cahill075416c2007-11-29 11:10:08 +0800170 __le32 log_event_table_ptr; /* SRAM address for event log */
171 __le32 error_event_table_ptr; /* SRAM address for error log */
Zhu Yib481de92007-09-25 17:54:57 -0700172 __le32 timestamp;
173 __le32 is_valid;
Zhu Yib481de92007-09-25 17:54:57 -0700174} __attribute__ ((packed));
175
176union tsf {
177 u8 byte[8];
178 __le16 word[4];
179 __le32 dw[2];
180};
181
182/*
183 * REPLY_ERROR = 0x2 (response only, not a command)
184 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800185struct iwl3945_error_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700186 __le32 error_type;
187 u8 cmd_id;
188 u8 reserved1;
189 __le16 bad_cmd_seq_num;
Zhu Yib481de92007-09-25 17:54:57 -0700190 __le16 reserved2;
Zhu Yib481de92007-09-25 17:54:57 -0700191 __le32 error_info;
192 union tsf timestamp;
193} __attribute__ ((packed));
194
195/******************************************************************************
196 * (1)
197 * RXON Commands & Responses:
198 *
199 *****************************************************************************/
200
Ben Cahill80cc0c32007-11-29 11:10:09 +0800201/**
Zhu Yib481de92007-09-25 17:54:57 -0700202 * REPLY_RXON = 0x10 (command, has simple generic response)
Ben Cahill80cc0c32007-11-29 11:10:09 +0800203 *
204 * RXON tunes the radio tuner to a service channel, and sets up a number
205 * of parameters that are used primarily for Rx, but also for Tx operations.
206 *
207 * NOTE: When tuning to a new channel, driver must set the
208 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
209 * info within the device, including the station tables, tx retry
210 * rate tables, and txpower tables. Driver must build a new station
211 * table and txpower table before transmitting anything on the RXON
212 * channel.
213 *
214 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
215 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
216 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
Zhu Yib481de92007-09-25 17:54:57 -0700217 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800218struct iwl3945_rxon_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700219 u8 node_addr[6];
220 __le16 reserved1;
221 u8 bssid_addr[6];
222 __le16 reserved2;
223 u8 wlap_bssid_addr[6];
224 __le16 reserved3;
225 u8 dev_type;
226 u8 air_propagation;
Zhu Yib481de92007-09-25 17:54:57 -0700227 __le16 reserved4;
Zhu Yib481de92007-09-25 17:54:57 -0700228 u8 ofdm_basic_rates;
229 u8 cck_basic_rates;
230 __le16 assoc_id;
231 __le32 flags;
232 __le32 filter_flags;
233 __le16 channel;
Zhu Yib481de92007-09-25 17:54:57 -0700234 __le16 reserved5;
Zhu Yib481de92007-09-25 17:54:57 -0700235} __attribute__ ((packed));
236
237/*
238 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
239 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800240struct iwl3945_rxon_assoc_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700241 __le32 flags;
242 __le32 filter_flags;
243 u8 ofdm_basic_rates;
244 u8 cck_basic_rates;
Zhu Yib481de92007-09-25 17:54:57 -0700245 __le16 reserved;
246} __attribute__ ((packed));
247
248/*
249 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
250 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800251struct iwl3945_rxon_time_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700252 union tsf timestamp;
253 __le16 beacon_interval;
254 __le16 atim_window;
255 __le32 beacon_init_val;
256 __le16 listen_interval;
257 __le16 reserved;
258} __attribute__ ((packed));
259
Zhu Yib481de92007-09-25 17:54:57 -0700260/*
261 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
262 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800263struct iwl3945_channel_switch_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700264 u8 band;
265 u8 expect_beacon;
266 __le16 channel;
267 __le32 rxon_flags;
268 __le32 rxon_filter_flags;
269 __le32 switch_time;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800270 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
Zhu Yib481de92007-09-25 17:54:57 -0700271} __attribute__ ((packed));
272
Zhu Yib481de92007-09-25 17:54:57 -0700273/******************************************************************************
274 * (3)
275 * Add/Modify Stations Commands & Responses:
276 *
277 *****************************************************************************/
278/*
Zhu Yib481de92007-09-25 17:54:57 -0700279 * REPLY_ADD_STA = 0x18 (command)
Ben Cahill2054a002007-11-29 11:10:10 +0800280 *
281 * The device contains an internal table of per-station information,
282 * with info on security keys, aggregation parameters, and Tx rates for
283 * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
284 * 3945 uses REPLY_RATE_SCALE to set up rate tables).
285 *
286 * REPLY_ADD_STA sets up the table entry for one station, either creating
287 * a new entry, or modifying a pre-existing one.
288 *
289 * NOTE: RXON command (without "associated" bit set) wipes the station table
290 * clean. Moving into RF_KILL state does this also. Driver must set up
291 * new station table before transmitting anything on the RXON channel
292 * (except active scans or active measurements; those commands carry
293 * their own txpower/rate setup data).
294 *
295 * When getting started on a new channel, driver must set up the
296 * IWL_BROADCAST_ID entry (last entry in the table). For a client
297 * station in a BSS, once an AP is selected, driver sets up the AP STA
298 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
299 * are all that are needed for a BSS client station. If the device is
300 * used as AP, or in an IBSS network, driver must set up station table
301 * entries for all STAs in network, starting with index IWL_STA_ID.
Zhu Yib481de92007-09-25 17:54:57 -0700302 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800303struct iwl3945_addsta_cmd {
Ben Cahill2054a002007-11-29 11:10:10 +0800304 u8 mode; /* 1: modify existing, 0: add new station */
Zhu Yib481de92007-09-25 17:54:57 -0700305 u8 reserved[3];
306 struct sta_id_modify sta;
Tomas Winkler4c897252008-12-19 10:37:05 +0800307 struct iwl4965_keyinfo key;
Ben Cahill2054a002007-11-29 11:10:10 +0800308 __le32 station_flags; /* STA_FLG_* */
309 __le32 station_flags_msk; /* STA_FLG_* */
310
311 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
312 * corresponding to bit (e.g. bit 5 controls TID 5).
313 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700314 __le16 tid_disable_tx;
Ben Cahill2054a002007-11-29 11:10:10 +0800315
Zhu Yib481de92007-09-25 17:54:57 -0700316 __le16 rate_n_flags;
Ben Cahill2054a002007-11-29 11:10:10 +0800317
318 /* TID for which to add block-ack support.
319 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700320 u8 add_immediate_ba_tid;
Ben Cahill2054a002007-11-29 11:10:10 +0800321
322 /* TID for which to remove block-ack support.
323 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700324 u8 remove_immediate_ba_tid;
Ben Cahill2054a002007-11-29 11:10:10 +0800325
326 /* Starting Sequence Number for added block-ack support.
327 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700328 __le16 add_immediate_ba_ssn;
Zhu Yib481de92007-09-25 17:54:57 -0700329} __attribute__ ((packed));
330
Zhu Yib481de92007-09-25 17:54:57 -0700331
332/******************************************************************************
333 * (4)
334 * Rx Responses:
335 *
336 *****************************************************************************/
337
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800338struct iwl3945_rx_frame_stats {
Zhu Yib481de92007-09-25 17:54:57 -0700339 u8 phy_count;
340 u8 id;
341 u8 rssi;
342 u8 agc;
343 __le16 sig_avg;
344 __le16 noise_diff;
345 u8 payload[0];
346} __attribute__ ((packed));
347
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800348struct iwl3945_rx_frame_hdr {
Zhu Yib481de92007-09-25 17:54:57 -0700349 __le16 channel;
350 __le16 phy_flags;
351 u8 reserved1;
352 u8 rate;
353 __le16 len;
354 u8 payload[0];
355} __attribute__ ((packed));
356
Zhu Yib481de92007-09-25 17:54:57 -0700357
Zhu Yib481de92007-09-25 17:54:57 -0700358
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800359struct iwl3945_rx_frame_end {
Zhu Yib481de92007-09-25 17:54:57 -0700360 __le32 status;
361 __le64 timestamp;
362 __le32 beacon_timestamp;
363} __attribute__ ((packed));
364
365/*
366 * REPLY_3945_RX = 0x1b (response only, not a command)
367 *
368 * NOTE: DO NOT dereference from casts to this structure
369 * It is provided only for calculating minimum data set size.
370 * The actual offsets of the hdr and end are dynamic based on
371 * stats.phy_count
372 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800373struct iwl3945_rx_frame {
374 struct iwl3945_rx_frame_stats stats;
375 struct iwl3945_rx_frame_hdr hdr;
376 struct iwl3945_rx_frame_end end;
Zhu Yib481de92007-09-25 17:54:57 -0700377} __attribute__ ((packed));
378
Zhu Yib481de92007-09-25 17:54:57 -0700379/******************************************************************************
380 * (5)
381 * Tx Commands & Responses:
382 *
Ben Cahill52969982007-11-29 11:10:11 +0800383 * Driver must place each REPLY_TX command into one of the prioritized Tx
384 * queues in host DRAM, shared between driver and device. When the device's
385 * Tx scheduler and uCode are preparing to transmit, the device pulls the
386 * Tx command over the PCI bus via one of the device's Tx DMA channels,
387 * to fill an internal FIFO from which data will be transmitted.
388 *
389 * uCode handles all timing and protocol related to control frames
390 * (RTS/CTS/ACK), based on flags in the Tx command.
391 *
392 * uCode handles retrying Tx when an ACK is expected but not received.
393 * This includes trying lower data rates than the one requested in the Tx
394 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
395 * REPLY_TX_LINK_QUALITY_CMD (4965).
396 *
397 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
398 * This command must be executed after every RXON command, before Tx can occur.
Zhu Yib481de92007-09-25 17:54:57 -0700399 *****************************************************************************/
400
Zhu Yib481de92007-09-25 17:54:57 -0700401/*
Zhu Yib481de92007-09-25 17:54:57 -0700402 * REPLY_TX = 0x1c (command)
403 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800404struct iwl3945_tx_cmd {
Ben Cahill52969982007-11-29 11:10:11 +0800405 /*
406 * MPDU byte count:
407 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
408 * + 8 byte IV for CCM or TKIP (not used for WEP)
409 * + Data payload
410 * + 8-byte MIC (not used for CCM/WEP)
411 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
412 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
413 * Range: 14-2342 bytes.
414 */
Zhu Yib481de92007-09-25 17:54:57 -0700415 __le16 len;
Ben Cahill52969982007-11-29 11:10:11 +0800416
417 /*
418 * MPDU or MSDU byte count for next frame.
419 * Used for fragmentation and bursting, but not 11n aggregation.
420 * Same as "len", but for next frame. Set to 0 if not applicable.
421 */
Zhu Yib481de92007-09-25 17:54:57 -0700422 __le16 next_frame_len;
Ben Cahill52969982007-11-29 11:10:11 +0800423
424 __le32 tx_flags; /* TX_CMD_FLG_* */
425
Zhu Yib481de92007-09-25 17:54:57 -0700426 u8 rate;
Ben Cahill52969982007-11-29 11:10:11 +0800427
428 /* Index of recipient station in uCode's station table */
Zhu Yib481de92007-09-25 17:54:57 -0700429 u8 sta_id;
430 u8 tid_tspec;
Zhu Yib481de92007-09-25 17:54:57 -0700431 u8 sec_ctl;
Zhu Yib481de92007-09-25 17:54:57 -0700432 u8 key[16];
Zhu Yib481de92007-09-25 17:54:57 -0700433 union {
434 u8 byte[8];
435 __le16 word[4];
436 __le32 dw[2];
437 } tkip_mic;
438 __le32 next_frame_info;
Zhu Yib481de92007-09-25 17:54:57 -0700439 union {
440 __le32 life_time;
441 __le32 attempt;
442 } stop_time;
Zhu Yib481de92007-09-25 17:54:57 -0700443 u8 supp_rates[2];
Zhu Yib481de92007-09-25 17:54:57 -0700444 u8 rts_retry_limit; /*byte 50 */
445 u8 data_retry_limit; /*byte 51 */
Zhu Yib481de92007-09-25 17:54:57 -0700446 union {
447 __le16 pm_frame_timeout;
448 __le16 attempt_duration;
449 } timeout;
Ben Cahill52969982007-11-29 11:10:11 +0800450
451 /*
452 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
453 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
454 */
Zhu Yib481de92007-09-25 17:54:57 -0700455 __le16 driver_txop;
Ben Cahill52969982007-11-29 11:10:11 +0800456
457 /*
458 * MAC header goes here, followed by 2 bytes padding if MAC header
459 * length is 26 or 30 bytes, followed by payload data
460 */
Zhu Yib481de92007-09-25 17:54:57 -0700461 u8 payload[0];
462 struct ieee80211_hdr hdr[0];
463} __attribute__ ((packed));
464
Zhu Yib481de92007-09-25 17:54:57 -0700465/*
466 * REPLY_TX = 0x1c (response)
467 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800468struct iwl3945_tx_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700469 u8 failure_rts;
470 u8 failure_frame;
471 u8 bt_kill_count;
472 u8 rate;
473 __le32 wireless_media_time;
Ben Cahill52969982007-11-29 11:10:11 +0800474 __le32 status; /* TX status */
Zhu Yib481de92007-09-25 17:54:57 -0700475} __attribute__ ((packed));
476
477/*
478 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
479 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800480struct iwl3945_txpowertable_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700481 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
482 u8 reserved;
483 __le16 channel;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800484 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
Zhu Yib481de92007-09-25 17:54:57 -0700485} __attribute__ ((packed));
486
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800487struct iwl3945_rate_scaling_info {
Zhu Yib481de92007-09-25 17:54:57 -0700488 __le16 rate_n_flags;
489 u8 try_cnt;
490 u8 next_rate_index;
491} __attribute__ ((packed));
492
493/**
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800494 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
Zhu Yib481de92007-09-25 17:54:57 -0700495 *
496 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
497 *
498 * NOTE: The table of rates passed to the uCode via the
499 * RATE_SCALE command sets up the corresponding order of
500 * rates used for all related commands, including rate
501 * masks, etc.
502 *
503 * For example, if you set 9MB (PLCP 0x0f) as the first
504 * rate in the rate table, the bit mask for that rate
505 * when passed through ofdm_basic_rates on the REPLY_RXON
Reinette Chatre8a1b0242008-01-14 17:46:25 -0800506 * command would be bit 0 (1 << 0)
Zhu Yib481de92007-09-25 17:54:57 -0700507 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800508struct iwl3945_rate_scaling_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700509 u8 table_id;
510 u8 reserved[3];
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800511 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
Zhu Yib481de92007-09-25 17:54:57 -0700512} __attribute__ ((packed));
513
Zhu Yib481de92007-09-25 17:54:57 -0700514/******************************************************************************
515 * (8)
516 * Scan Commands, Responses, Notifications:
517 *
518 *****************************************************************************/
519
Ben Cahill3058f022008-01-14 17:46:17 -0800520/**
521 * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
522 *
523 * One for each channel in the scan list.
524 * Each channel can independently select:
525 * 1) SSID for directed active scans
526 * 2) Txpower setting (for rate specified within Tx command)
527 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
528 * quiet_plcp_th, good_CRC_th)
529 *
530 * To avoid uCode errors, make sure the following are true (see comments
531 * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
532 * 1) If using passive_dwell (i.e. passive_dwell != 0):
533 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
534 * 2) quiet_time <= active_dwell
535 * 3) If restricting off-channel time (i.e. max_out_time !=0):
536 * passive_dwell < max_out_time
537 * active_dwell < max_out_time
538 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800539struct iwl3945_scan_channel {
Ben Cahill3058f022008-01-14 17:46:17 -0800540 /*
541 * type is defined as:
542 * 0:0 1 = active, 0 = passive
543 * 1:4 SSID direct bit map; if a bit is set, then corresponding
544 * SSID IE is transmitted in probe request.
Zhu Yib481de92007-09-25 17:54:57 -0700545 * 5:7 reserved
546 */
547 u8 type;
Ben Cahill3058f022008-01-14 17:46:17 -0800548 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800549 struct iwl3945_tx_power tpc;
Ben Cahill3058f022008-01-14 17:46:17 -0800550 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
551 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
Zhu Yib481de92007-09-25 17:54:57 -0700552} __attribute__ ((packed));
553
Zhu Yib481de92007-09-25 17:54:57 -0700554
555/*
556 * REPLY_SCAN_CMD = 0x80 (command)
Ben Cahill3058f022008-01-14 17:46:17 -0800557 *
558 * The hardware scan command is very powerful; the driver can set it up to
559 * maintain (relatively) normal network traffic while doing a scan in the
560 * background. The max_out_time and suspend_time control the ratio of how
561 * long the device stays on an associated network channel ("service channel")
562 * vs. how long it's away from the service channel, tuned to other channels
563 * for scanning.
564 *
565 * max_out_time is the max time off-channel (in usec), and suspend_time
566 * is how long (in "extended beacon" format) that the scan is "suspended"
567 * after returning to the service channel. That is, suspend_time is the
568 * time that we stay on the service channel, doing normal work, between
569 * scan segments. The driver may set these parameters differently to support
570 * scanning when associated vs. not associated, and light vs. heavy traffic
571 * loads when associated.
572 *
573 * After receiving this command, the device's scan engine does the following;
574 *
575 * 1) Sends SCAN_START notification to driver
576 * 2) Checks to see if it has time to do scan for one channel
577 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
578 * to tell AP that we're going off-channel
579 * 4) Tunes to first channel in scan list, does active or passive scan
580 * 5) Sends SCAN_RESULT notification to driver
581 * 6) Checks to see if it has time to do scan on *next* channel in list
582 * 7) Repeats 4-6 until it no longer has time to scan the next channel
583 * before max_out_time expires
584 * 8) Returns to service channel
585 * 9) Sends NULL packet with PS=0 to tell AP that we're back
586 * 10) Stays on service channel until suspend_time expires
587 * 11) Repeats entire process 2-10 until list is complete
588 * 12) Sends SCAN_COMPLETE notification
589 *
590 * For fast, efficient scans, the scan command also has support for staying on
591 * a channel for just a short time, if doing active scanning and getting no
592 * responses to the transmitted probe request. This time is controlled by
593 * quiet_time, and the number of received packets below which a channel is
594 * considered "quiet" is controlled by quiet_plcp_threshold.
595 *
596 * For active scanning on channels that have regulatory restrictions against
597 * blindly transmitting, the scan can listen before transmitting, to make sure
598 * that there is already legitimate activity on the channel. If enough
599 * packets are cleanly received on the channel (controlled by good_CRC_th,
600 * typical value 1), the scan engine starts transmitting probe requests.
601 *
602 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
603 *
604 * To avoid uCode errors, see timing restrictions described under
605 * struct iwl3945_scan_channel.
Zhu Yib481de92007-09-25 17:54:57 -0700606 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800607struct iwl3945_scan_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700608 __le16 len;
609 u8 reserved0;
Ben Cahill3058f022008-01-14 17:46:17 -0800610 u8 channel_count; /* # channels in channel list */
611 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
612 * (only for active scan) */
613 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
614 __le16 good_CRC_th; /* passive -> active promotion threshold */
Zhu Yib481de92007-09-25 17:54:57 -0700615 __le16 reserved1;
Ben Cahill3058f022008-01-14 17:46:17 -0800616 __le32 max_out_time; /* max usec to be away from associated (service)
617 * channel */
618 __le32 suspend_time; /* pause scan this long (in "extended beacon
619 * format") when returning to service channel:
620 * 3945; 31:24 # beacons, 19:0 additional usec,
621 * 4965; 31:22 # beacons, 21:0 additional usec.
622 */
623 __le32 flags; /* RXON_FLG_* */
624 __le32 filter_flags; /* RXON_FILTER_* */
Zhu Yib481de92007-09-25 17:54:57 -0700625
Ben Cahill3058f022008-01-14 17:46:17 -0800626 /* For active scans (set to all-0s for passive scans).
627 * Does not include payload. Must specify Tx rate; no rate scaling. */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800628 struct iwl3945_tx_cmd tx_cmd;
Ben Cahill3058f022008-01-14 17:46:17 -0800629
630 /* For directed active scans (set to all-0s otherwise) */
Tomas Winkler4c897252008-12-19 10:37:05 +0800631 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
Zhu Yib481de92007-09-25 17:54:57 -0700632
Zhu Yib481de92007-09-25 17:54:57 -0700633 /*
Ben Cahill3058f022008-01-14 17:46:17 -0800634 * Probe request frame, followed by channel list.
635 *
636 * Size of probe request frame is specified by byte count in tx_cmd.
637 * Channel list follows immediately after probe request frame.
638 * Number of channels in list is specified by channel_count.
639 * Each channel in list is of type:
Zhu Yib481de92007-09-25 17:54:57 -0700640 *
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800641 * struct iwl3945_scan_channel channels[0];
Zhu Yib481de92007-09-25 17:54:57 -0700642 *
643 * NOTE: Only one band of channels can be scanned per pass. You
Ben Cahill3058f022008-01-14 17:46:17 -0800644 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
645 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
646 * before requesting another scan.
Zhu Yib481de92007-09-25 17:54:57 -0700647 */
Ben Cahill3058f022008-01-14 17:46:17 -0800648 u8 data[0];
Zhu Yib481de92007-09-25 17:54:57 -0700649} __attribute__ ((packed));
650
Zhu Yib481de92007-09-25 17:54:57 -0700651/******************************************************************************
652 * (9)
653 * IBSS/AP Commands and Notifications:
654 *
655 *****************************************************************************/
656
657/*
658 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
659 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800660struct iwl3945_beacon_notif {
661 struct iwl3945_tx_resp beacon_notify_hdr;
Zhu Yib481de92007-09-25 17:54:57 -0700662 __le32 low_tsf;
663 __le32 high_tsf;
664 __le32 ibss_mgr_status;
665} __attribute__ ((packed));
666
667/*
668 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
669 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800670struct iwl3945_tx_beacon_cmd {
671 struct iwl3945_tx_cmd tx;
Zhu Yib481de92007-09-25 17:54:57 -0700672 __le16 tim_idx;
673 u8 tim_size;
674 u8 reserved1;
675 struct ieee80211_hdr frame[0]; /* beacon frame */
676} __attribute__ ((packed));
677
678/******************************************************************************
679 * (10)
680 * Statistics Commands and Notifications:
681 *
682 *****************************************************************************/
683
Tomas Winkler600c0e12008-12-19 10:37:04 +0800684struct iwl39_statistics_rx_phy {
Zhu Yib481de92007-09-25 17:54:57 -0700685 __le32 ina_cnt;
686 __le32 fina_cnt;
687 __le32 plcp_err;
688 __le32 crc32_err;
689 __le32 overrun_err;
690 __le32 early_overrun_err;
691 __le32 crc32_good;
692 __le32 false_alarm_cnt;
693 __le32 fina_sync_err_cnt;
694 __le32 sfd_timeout;
695 __le32 fina_timeout;
696 __le32 unresponded_rts;
697 __le32 rxe_frame_limit_overrun;
698 __le32 sent_ack_cnt;
699 __le32 sent_cts_cnt;
Zhu Yib481de92007-09-25 17:54:57 -0700700} __attribute__ ((packed));
701
Tomas Winkler600c0e12008-12-19 10:37:04 +0800702struct iwl39_statistics_rx_non_phy {
Zhu Yib481de92007-09-25 17:54:57 -0700703 __le32 bogus_cts; /* CTS received when not expecting CTS */
704 __le32 bogus_ack; /* ACK received when not expecting ACK */
705 __le32 non_bssid_frames; /* number of frames with BSSID that
706 * doesn't belong to the STA BSSID */
707 __le32 filtered_frames; /* count frames that were dumped in the
708 * filtering process */
709 __le32 non_channel_beacons; /* beacons with our bss id but not on
710 * our serving channel */
Zhu Yib481de92007-09-25 17:54:57 -0700711} __attribute__ ((packed));
712
Tomas Winkler600c0e12008-12-19 10:37:04 +0800713struct iwl39_statistics_rx {
714 struct iwl39_statistics_rx_phy ofdm;
715 struct iwl39_statistics_rx_phy cck;
716 struct iwl39_statistics_rx_non_phy general;
Zhu Yib481de92007-09-25 17:54:57 -0700717} __attribute__ ((packed));
718
Tomas Winkler600c0e12008-12-19 10:37:04 +0800719struct iwl39_statistics_tx {
Zhu Yib481de92007-09-25 17:54:57 -0700720 __le32 preamble_cnt;
721 __le32 rx_detected_cnt;
722 __le32 bt_prio_defer_cnt;
723 __le32 bt_prio_kill_cnt;
724 __le32 few_bytes_cnt;
725 __le32 cts_timeout;
726 __le32 ack_timeout;
727 __le32 expected_ack_cnt;
728 __le32 actual_ack_cnt;
Zhu Yib481de92007-09-25 17:54:57 -0700729} __attribute__ ((packed));
730
Tomas Winkler600c0e12008-12-19 10:37:04 +0800731struct iwl39_statistics_div {
Zhu Yib481de92007-09-25 17:54:57 -0700732 __le32 tx_on_a;
733 __le32 tx_on_b;
734 __le32 exec_time;
735 __le32 probe_time;
Zhu Yib481de92007-09-25 17:54:57 -0700736} __attribute__ ((packed));
737
Tomas Winkler600c0e12008-12-19 10:37:04 +0800738struct iwl39_statistics_general {
Zhu Yib481de92007-09-25 17:54:57 -0700739 __le32 temperature;
Zhu Yib481de92007-09-25 17:54:57 -0700740 struct statistics_dbg dbg;
741 __le32 sleep_time;
742 __le32 slots_out;
743 __le32 slots_idle;
744 __le32 ttl_timestamp;
Tomas Winkler600c0e12008-12-19 10:37:04 +0800745 struct iwl39_statistics_div div;
Zhu Yib481de92007-09-25 17:54:57 -0700746} __attribute__ ((packed));
747
748/*
Zhu Yib481de92007-09-25 17:54:57 -0700749 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
750 *
751 * By default, uCode issues this notification after receiving a beacon
752 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
753 * REPLY_STATISTICS_CMD 0x9c, above.
754 *
755 * Statistics counters continue to increment beacon after beacon, but are
756 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
757 * 0x9c with CLEAR_STATS bit set (see above).
758 *
759 * uCode also issues this notification during scans. uCode clears statistics
760 * appropriately so that each notification contains statistics for only the
761 * one channel that has just been scanned.
762 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800763struct iwl3945_notif_statistics {
Zhu Yib481de92007-09-25 17:54:57 -0700764 __le32 flag;
765 struct statistics_rx rx;
766 struct statistics_tx tx;
767 struct statistics_general general;
768} __attribute__ ((packed));
769
770
Zhu Yib481de92007-09-25 17:54:57 -0700771/******************************************************************************
772 * (13)
773 * Union of all expected notifications/responses:
774 *
775 *****************************************************************************/
776
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800777struct iwl3945_rx_packet {
Zhu Yib481de92007-09-25 17:54:57 -0700778 __le32 len;
Tomas Winkler4c897252008-12-19 10:37:05 +0800779 struct iwl_cmd_header hdr;
Zhu Yib481de92007-09-25 17:54:57 -0700780 union {
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800781 struct iwl3945_alive_resp alive_frame;
782 struct iwl3945_rx_frame rx_frame;
783 struct iwl3945_tx_resp tx_resp;
Tomas Winkler600c0e12008-12-19 10:37:04 +0800784 struct iwl_spectrum_notification spectrum_notif;
785 struct iwl_csa_notification csa_notif;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800786 struct iwl3945_error_resp err_resp;
Tomas Winkler600c0e12008-12-19 10:37:04 +0800787 struct iwl_card_state_notif card_state_notif;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800788 struct iwl3945_beacon_notif beacon_status;
Tomas Winkler4c897252008-12-19 10:37:05 +0800789 struct iwl_add_sta_resp add_sta;
Tomas Winkler600c0e12008-12-19 10:37:04 +0800790 struct iwl_sleep_notification sleep_notif;
791 struct iwl_spectrum_resp spectrum;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800792 struct iwl3945_notif_statistics stats;
Zhu Yib481de92007-09-25 17:54:57 -0700793 __le32 status;
794 u8 raw[0];
795 } u;
796} __attribute__ ((packed));
797
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800798#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
Zhu Yib481de92007-09-25 17:54:57 -0700799
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800800#endif /* __iwl3945_3945_commands_h__ */