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