blob: acc584f4377b0742e5dd32ca703e8987b01d022a [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
Chatre, Reinettec02b3ac2008-12-02 12:14:05 -080072/* uCode version contains 4 values: Major/Minor/API/Serial */
73#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
74#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
75#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
76#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
77
Zhu Yib481de92007-09-25 17:54:57 -070078
Tomas Winkler69d00d22008-12-19 10:37:02 +080079/* 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
Zhu Yib481de92007-09-25 17:54:57 -070084/******************************************************************************
85 * (0)
Ben Cahill80cc0c32007-11-29 11:10:09 +080086 * Commonly used structures and definitions:
87 * Command header, txpower
Zhu Yib481de92007-09-25 17:54:57 -070088 *
89 *****************************************************************************/
90
Ben Cahill075416c2007-11-29 11:10:08 +080091/* iwl3945_cmd_header flags value */
Zhu Yib481de92007-09-25 17:54:57 -070092#define IWL_CMD_FAILED_MSK 0x40
93
Ben Cahill075416c2007-11-29 11:10:08 +080094/**
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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800100struct iwl3945_cmd_header {
Ben Cahill075416c2007-11-29 11:10:08 +0800101 u8 cmd; /* Command ID: REPLY_RXON, etc. */
102 u8 flags; /* IWL_CMD_* */
103 /*
Tomas Winklera96a27f2008-10-23 23:48:56 -0700104 * The driver sets up the sequence number to values of its choosing.
Ben Cahill075416c2007-11-29 11:10:08 +0800105 * 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.
Zhu Yib481de92007-09-25 17:54:57 -0700109 *
Ben Cahill075416c2007-11-29 11:10:08 +0800110 * 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.
Zhu Yib481de92007-09-25 17:54:57 -0700115 *
Ben Cahill075416c2007-11-29 11:10:08 +0800116 * The Linux driver uses the following format:
117 *
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
Zhu Yib481de92007-09-25 17:54:57 -0700123 */
124 __le16 sequence;
125
Ben Cahill075416c2007-11-29 11:10:08 +0800126 /* command or response/notification data follows immediately */
Zhu Yib481de92007-09-25 17:54:57 -0700127 u8 data[0];
128} __attribute__ ((packed));
129
Ben Cahill80cc0c32007-11-29 11:10:09 +0800130/**
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 */
144struct 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 */
154struct iwl3945_power_per_rate {
155 u8 rate; /* plcp */
156 struct iwl3945_tx_power tpc;
157 u8 reserved;
158} __attribute__ ((packed));
159
Zhu Yib481de92007-09-25 17:54:57 -0700160/******************************************************************************
161 * (0a)
162 * Alive and Error Commands & Responses:
163 *
164 *****************************************************************************/
165
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800166#define UCODE_VALID_OK cpu_to_le32(0x1)
Zhu Yib481de92007-09-25 17:54:57 -0700167#define INITIALIZE_SUBTYPE (9)
168
169/*
Ben Cahill075416c2007-11-29 11:10:08 +0800170 * ("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).
Zhu Yib481de92007-09-25 17:54:57 -0700178 */
Ben Cahill075416c2007-11-29 11:10:08 +0800179struct iwl3945_init_alive_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700180 u8 ucode_minor;
181 u8 ucode_major;
182 __le16 reserved1;
183 u8 sw_rev[8];
184 u8 ver_type;
Ben Cahill075416c2007-11-29 11:10:08 +0800185 u8 ver_subtype; /* "9" for initialize alive */
Zhu Yib481de92007-09-25 17:54:57 -0700186 __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
Ben Cahill075416c2007-11-29 11:10:08 +0800193
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 */
216struct iwl3945_alive_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700217 u8 ucode_minor;
218 u8 ucode_major;
219 __le16 reserved1;
220 u8 sw_rev[8];
221 u8 ver_type;
Ben Cahill075416c2007-11-29 11:10:08 +0800222 u8 ver_subtype; /* not "9" for runtime alive */
Zhu Yib481de92007-09-25 17:54:57 -0700223 __le16 reserved2;
Ben Cahill075416c2007-11-29 11:10:08 +0800224 __le32 log_event_table_ptr; /* SRAM address for event log */
225 __le32 error_event_table_ptr; /* SRAM address for error log */
Zhu Yib481de92007-09-25 17:54:57 -0700226 __le32 timestamp;
227 __le32 is_valid;
Zhu Yib481de92007-09-25 17:54:57 -0700228} __attribute__ ((packed));
229
230union 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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800239struct iwl3945_error_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700240 __le32 error_type;
241 u8 cmd_id;
242 u8 reserved1;
243 __le16 bad_cmd_seq_num;
Zhu Yib481de92007-09-25 17:54:57 -0700244 __le16 reserved2;
Zhu Yib481de92007-09-25 17:54:57 -0700245 __le32 error_info;
246 union tsf timestamp;
247} __attribute__ ((packed));
248
249/******************************************************************************
250 * (1)
251 * RXON Commands & Responses:
252 *
253 *****************************************************************************/
254
Zhu Yib481de92007-09-25 17:54:57 -0700255/* rx_config flags */
256/* band & modulation selection */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800257#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
258#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
Zhu Yib481de92007-09-25 17:54:57 -0700259/* auto detection enable */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800260#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
Zhu Yib481de92007-09-25 17:54:57 -0700261/* TGg protection when tx */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800262#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
Zhu Yib481de92007-09-25 17:54:57 -0700263/* cck short slot & preamble */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800264#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
265#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
Zhu Yib481de92007-09-25 17:54:57 -0700266/* antenna selection */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800267#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)
Zhu Yib481de92007-09-25 17:54:57 -0700271/* radar detection enable */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800272#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
273#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
Zhu Yib481de92007-09-25 17:54:57 -0700274/* rx response to host with 8-byte TSF
275* (according to ON_AIR deassertion) */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800276#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
Zhu Yib481de92007-09-25 17:54:57 -0700277
278/* rx_config filter flags */
279/* accept all data frames */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800280#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
Zhu Yib481de92007-09-25 17:54:57 -0700281/* pass control & management to host */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800282#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
Zhu Yib481de92007-09-25 17:54:57 -0700283/* accept multi-cast */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800284#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
Zhu Yib481de92007-09-25 17:54:57 -0700285/* don't decrypt uni-cast frames */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800286#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
Zhu Yib481de92007-09-25 17:54:57 -0700287/* don't decrypt multi-cast frames */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800288#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
Zhu Yib481de92007-09-25 17:54:57 -0700289/* STA is associated */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800290#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
Zhu Yib481de92007-09-25 17:54:57 -0700291/* transfer to host non bssid beacons in associated state */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800292#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
Zhu Yib481de92007-09-25 17:54:57 -0700293
Ben Cahill80cc0c32007-11-29 11:10:09 +0800294/**
Zhu Yib481de92007-09-25 17:54:57 -0700295 * REPLY_RXON = 0x10 (command, has simple generic response)
Ben Cahill80cc0c32007-11-29 11:10:09 +0800296 *
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.
Zhu Yib481de92007-09-25 17:54:57 -0700310 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800311struct iwl3945_rxon_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700312 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;
Zhu Yib481de92007-09-25 17:54:57 -0700320 __le16 reserved4;
Zhu Yib481de92007-09-25 17:54:57 -0700321 u8 ofdm_basic_rates;
322 u8 cck_basic_rates;
323 __le16 assoc_id;
324 __le32 flags;
325 __le32 filter_flags;
326 __le16 channel;
Zhu Yib481de92007-09-25 17:54:57 -0700327 __le16 reserved5;
Zhu Yib481de92007-09-25 17:54:57 -0700328} __attribute__ ((packed));
329
330/*
331 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
332 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800333struct iwl3945_rxon_assoc_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700334 __le32 flags;
335 __le32 filter_flags;
336 u8 ofdm_basic_rates;
337 u8 cck_basic_rates;
Zhu Yib481de92007-09-25 17:54:57 -0700338 __le16 reserved;
339} __attribute__ ((packed));
340
341/*
342 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
343 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800344struct iwl3945_rxon_time_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700345 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
Zhu Yib481de92007-09-25 17:54:57 -0700353/*
354 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
355 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800356struct iwl3945_channel_switch_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700357 u8 band;
358 u8 expect_beacon;
359 __le16 channel;
360 __le32 rxon_flags;
361 __le32 rxon_filter_flags;
362 __le32 switch_time;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800363 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
Zhu Yib481de92007-09-25 17:54:57 -0700364} __attribute__ ((packed));
365
366/*
367 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
368 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800369struct iwl3945_csa_notification {
Zhu Yib481de92007-09-25 17:54:57 -0700370 __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 *****************************************************************************/
Ben Cahill2054a002007-11-29 11:10:10 +0800380
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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800397struct iwl3945_ac_qos {
Zhu Yib481de92007-09-25 17:54:57 -0700398 __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 */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800406#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)
Zhu Yib481de92007-09-25 17:54:57 -0700409
Ben Cahill2054a002007-11-29 11:10:10 +0800410/* Number of Access Categories (AC) (EDCA), queues 0..3 */
Zhu Yib481de92007-09-25 17:54:57 -0700411#define AC_NUM 4
412
413/*
414 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
Ben Cahill2054a002007-11-29 11:10:10 +0800415 *
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.
Zhu Yib481de92007-09-25 17:54:57 -0700418 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800419struct iwl3945_qosparam_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700420 __le32 qos_flags;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800421 struct iwl3945_ac_qos ac[AC_NUM];
Zhu Yib481de92007-09-25 17:54:57 -0700422} __attribute__ ((packed));
423
424/******************************************************************************
425 * (3)
426 * Add/Modify Stations Commands & Responses:
427 *
428 *****************************************************************************/
429/*
430 * Multi station support
431 */
Ben Cahill2054a002007-11-29 11:10:10 +0800432
433/* Special, dedicated locations within device's station table */
Zhu Yib481de92007-09-25 17:54:57 -0700434#define IWL_AP_ID 0
435#define IWL_MULTICAST_ID 1
436#define IWL_STA_ID 2
Zhu Yib481de92007-09-25 17:54:57 -0700437#define IWL3945_BROADCAST_ID 24
438#define IWL3945_STATION_COUNT 25
439
Zhu Yib481de92007-09-25 17:54:57 -0700440#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
441#define IWL_INVALID_STATION 255
442
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800443#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2);
444#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8);
Zhu Yib481de92007-09-25 17:54:57 -0700445
Ben Cahill2054a002007-11-29 11:10:10 +0800446/* Use in mode field. 1: modify existing entry, 0: add new station entry */
Zhu Yib481de92007-09-25 17:54:57 -0700447#define STA_CONTROL_MODIFY_MSK 0x01
448
449/* key flags __le16*/
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800450#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)
Zhu Yib481de92007-09-25 17:54:57 -0700455
456#define STA_KEY_FLG_KEYID_POS 8
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800457#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
Emmanuel Grumbacheaaf7892008-02-13 11:32:29 -0800458/* wep key is either from global key (0) or from station info array (1) */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800459#define STA_KEY_FLG_WEP_KEY_MAP_MSK cpu_to_le16(0x0008)
Emmanuel Grumbacheaaf7892008-02-13 11:32:29 -0800460
461/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800462#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
463#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
Zhu Yib481de92007-09-25 17:54:57 -0700464
Ben Cahill2054a002007-11-29 11:10:10 +0800465/* Flags indicate whether to modify vs. don't change various station params */
Zhu Yib481de92007-09-25 17:54:57 -0700466#define STA_MODIFY_KEY_MASK 0x01
467#define STA_MODIFY_TID_DISABLE_TX 0x02
468#define STA_MODIFY_TX_RATE_MSK 0x04
Zhu Yib481de92007-09-25 17:54:57 -0700469
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800470struct iwl3945_keyinfo {
Zhu Yib481de92007-09-25 17:54:57 -0700471 __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 */
Emmanuel Grumbacheaaf7892008-02-13 11:32:29 -0800475 u8 key_offset;
476 u8 reserved2;
Zhu Yib481de92007-09-25 17:54:57 -0700477 u8 key[16]; /* 16-byte unicast decryption key */
478} __attribute__ ((packed));
479
Zhu Yib481de92007-09-25 17:54:57 -0700480/*
481 * REPLY_ADD_STA = 0x18 (command)
Ben Cahill2054a002007-11-29 11:10:10 +0800482 *
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.
Zhu Yib481de92007-09-25 17:54:57 -0700504 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800505struct iwl3945_addsta_cmd {
Ben Cahill2054a002007-11-29 11:10:10 +0800506 u8 mode; /* 1: modify existing, 0: add new station */
Zhu Yib481de92007-09-25 17:54:57 -0700507 u8 reserved[3];
508 struct sta_id_modify sta;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800509 struct iwl3945_keyinfo key;
Ben Cahill2054a002007-11-29 11:10:10 +0800510 __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. */
Zhu Yib481de92007-09-25 17:54:57 -0700516 __le16 tid_disable_tx;
Ben Cahill2054a002007-11-29 11:10:10 +0800517
Zhu Yib481de92007-09-25 17:54:57 -0700518 __le16 rate_n_flags;
Ben Cahill2054a002007-11-29 11:10:10 +0800519
520 /* TID for which to add block-ack support.
521 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700522 u8 add_immediate_ba_tid;
Ben Cahill2054a002007-11-29 11:10:10 +0800523
524 /* TID for which to remove block-ack support.
525 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700526 u8 remove_immediate_ba_tid;
Ben Cahill2054a002007-11-29 11:10:10 +0800527
528 /* Starting Sequence Number for added block-ack support.
529 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
Zhu Yib481de92007-09-25 17:54:57 -0700530 __le16 add_immediate_ba_ssn;
Zhu Yib481de92007-09-25 17:54:57 -0700531} __attribute__ ((packed));
532
Ben Cahill2054a002007-11-29 11:10:10 +0800533#define ADD_STA_SUCCESS_MSK 0x1
534#define ADD_STA_NO_ROOM_IN_TABLE 0x2
535#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
Zhu Yib481de92007-09-25 17:54:57 -0700536/*
537 * REPLY_ADD_STA = 0x18 (response)
538 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800539struct iwl3945_add_sta_resp {
Ben Cahill2054a002007-11-29 11:10:10 +0800540 u8 status; /* ADD_STA_* */
Zhu Yib481de92007-09-25 17:54:57 -0700541} __attribute__ ((packed));
542
Zhu Yib481de92007-09-25 17:54:57 -0700543
544/******************************************************************************
545 * (4)
546 * Rx Responses:
547 *
548 *****************************************************************************/
549
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800550struct iwl3945_rx_frame_stats {
Zhu Yib481de92007-09-25 17:54:57 -0700551 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
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800560struct iwl3945_rx_frame_hdr {
Zhu Yib481de92007-09-25 17:54:57 -0700561 __le16 channel;
562 __le16 phy_flags;
563 u8 reserved1;
564 u8 rate;
565 __le16 len;
566 u8 payload[0];
567} __attribute__ ((packed));
568
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800569#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)
Zhu Yib481de92007-09-25 17:54:57 -0700571
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800572#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)
Zhu Yib481de92007-09-25 17:54:57 -0700577
Tomas Winkler8211ef72008-03-02 01:36:04 +0200578#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)
Zhu Yib481de92007-09-25 17:54:57 -0700583
Tomas Winkler8211ef72008-03-02 01:36:04 +0200584#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)
Zhu Yib481de92007-09-25 17:54:57 -0700589
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800590struct iwl3945_rx_frame_end {
Zhu Yib481de92007-09-25 17:54:57 -0700591 __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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800604struct iwl3945_rx_frame {
605 struct iwl3945_rx_frame_stats stats;
606 struct iwl3945_rx_frame_hdr hdr;
607 struct iwl3945_rx_frame_end end;
Zhu Yib481de92007-09-25 17:54:57 -0700608} __attribute__ ((packed));
609
Zhu Yib481de92007-09-25 17:54:57 -0700610/******************************************************************************
611 * (5)
612 * Tx Commands & Responses:
613 *
Ben Cahill52969982007-11-29 11:10:11 +0800614 * 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.
Zhu Yib481de92007-09-25 17:54:57 -0700630 *****************************************************************************/
631
Ben Cahill52969982007-11-29 11:10:11 +0800632/* 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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800636#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
Ben Cahill52969982007-11-29 11:10:11 +0800637
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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800641#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
Ben Cahill52969982007-11-29 11:10:11 +0800642
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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800646#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
Ben Cahill52969982007-11-29 11:10:11 +0800647
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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800653#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
Ben Cahill52969982007-11-29 11:10:11 +0800654
655/* 1: Expect immediate block-ack.
656 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800657#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
Ben Cahill52969982007-11-29 11:10:11 +0800658
659/* 1: Frame requires full Tx-Op protection.
660 * Set this if either RTS or CTS Tx Flag gets set. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800661#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
Ben Cahill52969982007-11-29 11:10:11 +0800662
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). */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800665#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)
Zhu Yib481de92007-09-25 17:54:57 -0700668
Ben Cahill52969982007-11-29 11:10:11 +0800669/* 1: Ignore Bluetooth priority for this frame.
670 * 0: Delay Tx until Bluetooth device is done (normal usage). */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800671#define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12)
Zhu Yib481de92007-09-25 17:54:57 -0700672
Ben Cahill52969982007-11-29 11:10:11 +0800673/* 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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800677#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
Zhu Yib481de92007-09-25 17:54:57 -0700678
Ben Cahill52969982007-11-29 11:10:11 +0800679/* 1: This frame is non-last MPDU; more fragments are coming.
680 * 0: Last fragment, or not using fragmentation. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800681#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
Zhu Yib481de92007-09-25 17:54:57 -0700682
Ben Cahill52969982007-11-29 11:10:11 +0800683/* 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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800686#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
Zhu Yib481de92007-09-25 17:54:57 -0700687
Ben Cahill52969982007-11-29 11:10:11 +0800688/* 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. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800694#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
Zhu Yib481de92007-09-25 17:54:57 -0700695
696/* HCCA-AP - disable duration overwriting. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800697#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
Zhu Yib481de92007-09-25 17:54:57 -0700698
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
709/*
Zhu Yib481de92007-09-25 17:54:57 -0700710 * REPLY_TX = 0x1c (command)
711 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800712struct iwl3945_tx_cmd {
Ben Cahill52969982007-11-29 11:10:11 +0800713 /*
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 */
Zhu Yib481de92007-09-25 17:54:57 -0700723 __le16 len;
Ben Cahill52969982007-11-29 11:10:11 +0800724
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 */
Zhu Yib481de92007-09-25 17:54:57 -0700730 __le16 next_frame_len;
Ben Cahill52969982007-11-29 11:10:11 +0800731
732 __le32 tx_flags; /* TX_CMD_FLG_* */
733
Zhu Yib481de92007-09-25 17:54:57 -0700734 u8 rate;
Ben Cahill52969982007-11-29 11:10:11 +0800735
736 /* Index of recipient station in uCode's station table */
Zhu Yib481de92007-09-25 17:54:57 -0700737 u8 sta_id;
738 u8 tid_tspec;
Zhu Yib481de92007-09-25 17:54:57 -0700739 u8 sec_ctl;
Zhu Yib481de92007-09-25 17:54:57 -0700740 u8 key[16];
Zhu Yib481de92007-09-25 17:54:57 -0700741 union {
742 u8 byte[8];
743 __le16 word[4];
744 __le32 dw[2];
745 } tkip_mic;
746 __le32 next_frame_info;
Zhu Yib481de92007-09-25 17:54:57 -0700747 union {
748 __le32 life_time;
749 __le32 attempt;
750 } stop_time;
Zhu Yib481de92007-09-25 17:54:57 -0700751 u8 supp_rates[2];
Zhu Yib481de92007-09-25 17:54:57 -0700752 u8 rts_retry_limit; /*byte 50 */
753 u8 data_retry_limit; /*byte 51 */
Zhu Yib481de92007-09-25 17:54:57 -0700754 union {
755 __le16 pm_frame_timeout;
756 __le16 attempt_duration;
757 } timeout;
Ben Cahill52969982007-11-29 11:10:11 +0800758
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 */
Zhu Yib481de92007-09-25 17:54:57 -0700763 __le16 driver_txop;
Ben Cahill52969982007-11-29 11:10:11 +0800764
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 */
Zhu Yib481de92007-09-25 17:54:57 -0700769 u8 payload[0];
770 struct ieee80211_hdr hdr[0];
771} __attribute__ ((packed));
772
Zhu Yib481de92007-09-25 17:54:57 -0700773/*
774 * REPLY_TX = 0x1c (response)
775 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800776struct iwl3945_tx_resp {
Zhu Yib481de92007-09-25 17:54:57 -0700777 u8 failure_rts;
778 u8 failure_frame;
779 u8 bt_kill_count;
780 u8 rate;
781 __le32 wireless_media_time;
Ben Cahill52969982007-11-29 11:10:11 +0800782 __le32 status; /* TX status */
Zhu Yib481de92007-09-25 17:54:57 -0700783} __attribute__ ((packed));
784
785/*
786 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
787 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800788struct iwl3945_txpowertable_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700789 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
790 u8 reserved;
791 __le16 channel;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800792 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
Zhu Yib481de92007-09-25 17:54:57 -0700793} __attribute__ ((packed));
794
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800795struct iwl3945_rate_scaling_info {
Zhu Yib481de92007-09-25 17:54:57 -0700796 __le16 rate_n_flags;
797 u8 try_cnt;
798 u8 next_rate_index;
799} __attribute__ ((packed));
800
801/**
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800802 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
Zhu Yib481de92007-09-25 17:54:57 -0700803 *
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
Reinette Chatre8a1b0242008-01-14 17:46:25 -0800814 * command would be bit 0 (1 << 0)
Zhu Yib481de92007-09-25 17:54:57 -0700815 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800816struct iwl3945_rate_scaling_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700817 u8 table_id;
818 u8 reserved[3];
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800819 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
Zhu Yib481de92007-09-25 17:54:57 -0700820} __attribute__ ((packed));
821
Zhu Yib481de92007-09-25 17:54:57 -0700822/*
823 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
Ben Cahill3058f022008-01-14 17:46:17 -0800824 *
825 * 3945 and 4965 support hardware handshake with Bluetooth device on
826 * same platform. Bluetooth device alerts wireless device when it will Tx;
Tomas Winklera96a27f2008-10-23 23:48:56 -0700827 * wireless device can delay or kill its own Tx to accommodate.
Zhu Yib481de92007-09-25 17:54:57 -0700828 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800829struct iwl3945_bt_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700830 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
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800855struct iwl3945_measure_channel {
Zhu Yib481de92007-09-25 17:54:57 -0700856 __le32 duration; /* measurement duration in extended beacon
857 * format */
858 u8 channel; /* channel to measure */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800859 u8 type; /* see enum iwl3945_measure_type */
Zhu Yib481de92007-09-25 17:54:57 -0700860 __le16 reserved;
861} __attribute__ ((packed));
862
Zhu Yib481de92007-09-25 17:54:57 -0700863
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
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800869struct iwl3945_ct_kill_config {
Zhu Yib481de92007-09-25 17:54:57 -0700870 __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
Ben Cahill3058f022008-01-14 17:46:17 -0800881/**
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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800900struct iwl3945_scan_channel {
Ben Cahill3058f022008-01-14 17:46:17 -0800901 /*
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.
Zhu Yib481de92007-09-25 17:54:57 -0700906 * 5:7 reserved
907 */
908 u8 type;
Ben Cahill3058f022008-01-14 17:46:17 -0800909 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800910 struct iwl3945_tx_power tpc;
Ben Cahill3058f022008-01-14 17:46:17 -0800911 __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 */
Zhu Yib481de92007-09-25 17:54:57 -0700913} __attribute__ ((packed));
914
Ben Cahill3058f022008-01-14 17:46:17 -0800915/**
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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800922struct iwl3945_ssid_ie {
Zhu Yib481de92007-09-25 17:54:57 -0700923 u8 id;
924 u8 len;
925 u8 ssid[32];
926} __attribute__ ((packed));
927
Tomas Winkler600c0e12008-12-19 10:37:04 +0800928/* uCode API-1 take 4 probes */
929#define PROBE_OPTION_MAX_API1 0x4
Harvey Harrison51e9bf52008-11-26 13:12:52 -0800930#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
931#define IWL_GOOD_CRC_TH cpu_to_le16(1)
Zhu Yib481de92007-09-25 17:54:57 -0700932#define IWL_MAX_SCAN_SIZE 1024
933
934/*
935 * REPLY_SCAN_CMD = 0x80 (command)
Ben Cahill3058f022008-01-14 17:46:17 -0800936 *
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.
Zhu Yib481de92007-09-25 17:54:57 -0700985 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -0800986struct iwl3945_scan_cmd {
Zhu Yib481de92007-09-25 17:54:57 -0700987 __le16 len;
988 u8 reserved0;
Ben Cahill3058f022008-01-14 17:46:17 -0800989 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 */
Zhu Yib481de92007-09-25 17:54:57 -0700994 __le16 reserved1;
Ben Cahill3058f022008-01-14 17:46:17 -0800995 __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_* */
Zhu Yib481de92007-09-25 17:54:57 -07001004
Ben Cahill3058f022008-01-14 17:46:17 -08001005 /* For active scans (set to all-0s for passive scans).
1006 * Does not include payload. Must specify Tx rate; no rate scaling. */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001007 struct iwl3945_tx_cmd tx_cmd;
Ben Cahill3058f022008-01-14 17:46:17 -08001008
1009 /* For directed active scans (set to all-0s otherwise) */
Tomas Winkler600c0e12008-12-19 10:37:04 +08001010 struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
Zhu Yib481de92007-09-25 17:54:57 -07001011
Zhu Yib481de92007-09-25 17:54:57 -07001012 /*
Ben Cahill3058f022008-01-14 17:46:17 -08001013 * 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:
Zhu Yib481de92007-09-25 17:54:57 -07001019 *
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001020 * struct iwl3945_scan_channel channels[0];
Zhu Yib481de92007-09-25 17:54:57 -07001021 *
1022 * NOTE: Only one band of channels can be scanned per pass. You
Ben Cahill3058f022008-01-14 17:46:17 -08001023 * 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.
Zhu Yib481de92007-09-25 17:54:57 -07001026 */
Ben Cahill3058f022008-01-14 17:46:17 -08001027 u8 data[0];
Zhu Yib481de92007-09-25 17:54:57 -07001028} __attribute__ ((packed));
1029
1030/* Can abort will notify by complete notification with abort status. */
Harvey Harrison51e9bf52008-11-26 13:12:52 -08001031#define CAN_ABORT_STATUS cpu_to_le32(0x1)
Zhu Yib481de92007-09-25 17:54:57 -07001032/* complete notification statuses */
1033#define ABORT_STATUS 0x2
1034
1035/*
1036 * REPLY_SCAN_CMD = 0x80 (response)
1037 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001038struct iwl3945_scanreq_notification {
Zhu Yib481de92007-09-25 17:54:57 -07001039 __le32 status; /* 1: okay, 2: cannot fulfill request */
1040} __attribute__ ((packed));
1041
1042/*
1043 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1044 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001045struct iwl3945_scanstart_notification {
Zhu Yib481de92007-09-25 17:54:57 -07001046 __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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001062struct iwl3945_scanresults_notification {
Zhu Yib481de92007-09-25 17:54:57 -07001063 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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001074struct iwl3945_scancomplete_notification {
Zhu Yib481de92007-09-25 17:54:57 -07001075 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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001093struct iwl3945_beacon_notif {
1094 struct iwl3945_tx_resp beacon_notify_hdr;
Zhu Yib481de92007-09-25 17:54:57 -07001095 __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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001103struct iwl3945_tx_beacon_cmd {
1104 struct iwl3945_tx_cmd tx;
Zhu Yib481de92007-09-25 17:54:57 -07001105 __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
Tomas Winkler600c0e12008-12-19 10:37:04 +08001117struct iwl39_statistics_rx_phy {
Zhu Yib481de92007-09-25 17:54:57 -07001118 __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;
Zhu Yib481de92007-09-25 17:54:57 -07001133} __attribute__ ((packed));
1134
Tomas Winkler600c0e12008-12-19 10:37:04 +08001135struct iwl39_statistics_rx_non_phy {
Zhu Yib481de92007-09-25 17:54:57 -07001136 __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 */
Zhu Yib481de92007-09-25 17:54:57 -07001144} __attribute__ ((packed));
1145
Tomas Winkler600c0e12008-12-19 10:37:04 +08001146struct 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;
Zhu Yib481de92007-09-25 17:54:57 -07001150} __attribute__ ((packed));
1151
Tomas Winkler600c0e12008-12-19 10:37:04 +08001152struct iwl39_statistics_tx {
Zhu Yib481de92007-09-25 17:54:57 -07001153 __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;
Zhu Yib481de92007-09-25 17:54:57 -07001162} __attribute__ ((packed));
1163
Tomas Winkler600c0e12008-12-19 10:37:04 +08001164struct iwl39_statistics_div {
Zhu Yib481de92007-09-25 17:54:57 -07001165 __le32 tx_on_a;
1166 __le32 tx_on_b;
1167 __le32 exec_time;
1168 __le32 probe_time;
Zhu Yib481de92007-09-25 17:54:57 -07001169} __attribute__ ((packed));
1170
Tomas Winkler600c0e12008-12-19 10:37:04 +08001171struct iwl39_statistics_general {
Zhu Yib481de92007-09-25 17:54:57 -07001172 __le32 temperature;
Zhu Yib481de92007-09-25 17:54:57 -07001173 struct statistics_dbg dbg;
1174 __le32 sleep_time;
1175 __le32 slots_out;
1176 __le32 slots_idle;
1177 __le32 ttl_timestamp;
Tomas Winkler600c0e12008-12-19 10:37:04 +08001178 struct iwl39_statistics_div div;
Zhu Yib481de92007-09-25 17:54:57 -07001179} __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 */
Harvey Harrison51e9bf52008-11-26 13:12:52 -08001196#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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001198struct iwl3945_statistics_cmd {
Zhu Yib481de92007-09-25 17:54:57 -07001199 __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 */
Harvey Harrison51e9bf52008-11-26 13:12:52 -08001217#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
1218#define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8)
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001219struct iwl3945_notif_statistics {
Zhu Yib481de92007-09-25 17:54:57 -07001220 __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
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001234struct iwl3945_missed_beacon_notif {
Zhu Yib481de92007-09-25 17:54:57 -07001235 __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
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001250struct iwl3945_sensitivity_cmd {
Zhu Yib481de92007-09-25 17:54:57 -07001251 __le16 control;
1252 __le16 table[HD_TABLE_SIZE];
1253} __attribute__ ((packed));
1254
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001255struct iwl3945_calibration_cmd {
Zhu Yib481de92007-09-25 17:54:57 -07001256 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 */
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001278struct iwl3945_led_cmd {
Zhu Yib481de92007-09-25 17:54:57 -07001279 __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
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001294struct iwl3945_rx_packet {
Zhu Yib481de92007-09-25 17:54:57 -07001295 __le32 len;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001296 struct iwl3945_cmd_header hdr;
Zhu Yib481de92007-09-25 17:54:57 -07001297 union {
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001298 struct iwl3945_alive_resp alive_frame;
1299 struct iwl3945_rx_frame rx_frame;
1300 struct iwl3945_tx_resp tx_resp;
Tomas Winkler600c0e12008-12-19 10:37:04 +08001301 struct iwl_spectrum_notification spectrum_notif;
1302 struct iwl_csa_notification csa_notif;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001303 struct iwl3945_error_resp err_resp;
Tomas Winkler600c0e12008-12-19 10:37:04 +08001304 struct iwl_card_state_notif card_state_notif;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001305 struct iwl3945_beacon_notif beacon_status;
1306 struct iwl3945_add_sta_resp add_sta;
Tomas Winkler600c0e12008-12-19 10:37:04 +08001307 struct iwl_sleep_notification sleep_notif;
1308 struct iwl_spectrum_resp spectrum;
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001309 struct iwl3945_notif_statistics stats;
Zhu Yib481de92007-09-25 17:54:57 -07001310 __le32 status;
1311 u8 raw[0];
1312 } u;
1313} __attribute__ ((packed));
1314
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001315#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
Zhu Yib481de92007-09-25 17:54:57 -07001316
Christoph Hellwigbb8c0932008-01-27 16:41:47 -08001317#endif /* __iwl3945_3945_commands_h__ */