1 /******************************************************************************
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.
8 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
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.
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.
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,
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
27 * Contact Information:
28 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
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
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.
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.
62 *****************************************************************************/
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.
69 #ifndef __iwl_3945_commands_h__
70 #define __iwl_3945_commands_h__
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)
82 /* RXON and QOS commands */
84 REPLY_RXON_ASSOC = 0x11,
85 REPLY_QOS_PARAM = 0x13,
86 REPLY_RXON_TIMING = 0x14,
88 /* Multi-Station support */
90 REPLY_REMOVE_STA = 0x19, /* not used */
91 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
94 REPLY_3945_RX = 0x1b, /* 3945 only */
96 REPLY_RATE_SCALE = 0x47, /* 3945 only */
97 REPLY_LEDS_CMD = 0x48,
98 REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
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,
108 /* Power Management */
109 POWER_TABLE_CMD = 0x77,
110 PM_SLEEP_NOTIFICATION = 0x7A,
111 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
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,
120 /* IBSS/AP commands */
121 BEACON_NOTIFICATION = 0x90,
122 REPLY_TX_BEACON = 0x91,
123 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
125 /* Miscellaneous commands */
126 QUIET_NOTIFICATION = 0x96, /* not used */
127 REPLY_TX_PWR_TABLE_CMD = 0x97,
128 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
130 /* Bluetooth device coexistence config command */
131 REPLY_BT_CONFIG = 0x9b,
134 REPLY_STATISTICS_CMD = 0x9c,
135 STATISTICS_NOTIFICATION = 0x9d,
137 /* RF-KILL commands and notifications */
138 REPLY_CARD_STATE_CMD = 0xa0,
139 CARD_STATE_NOTIFICATION = 0xa1,
141 /* Missed beacons notification */
142 MISSED_BEACONS_NOTIFICATION = 0xa2,
147 /******************************************************************************
149 * Commonly used structures and definitions:
150 * Command header, txpower
152 *****************************************************************************/
154 /* iwl3945_cmd_header flags value */
155 #define IWL_CMD_FAILED_MSK 0x40
158 * struct iwl3945_cmd_header
160 * This header format appears in the beginning of each command sent from the
161 * driver, and each response/notification received from uCode.
163 struct iwl3945_cmd_header {
164 u8 cmd; /* Command ID: REPLY_RXON, etc. */
165 u8 flags; /* IWL_CMD_* */
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.
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.
179 * The Linux driver uses the following format:
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
189 /* command or response/notification data follows immediately */
191 } __attribute__ ((packed));
194 * struct iwl3945_tx_power
196 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
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.
205 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
207 struct iwl3945_tx_power {
208 u8 tx_gain; /* gain for analog radio */
209 u8 dsp_atten; /* gain for DSP */
210 } __attribute__ ((packed));
213 * struct iwl3945_power_per_rate
215 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
217 struct iwl3945_power_per_rate {
219 struct iwl3945_tx_power tpc;
221 } __attribute__ ((packed));
223 /******************************************************************************
225 * Alive and Error Commands & Responses:
227 *****************************************************************************/
229 #define UCODE_VALID_OK cpu_to_le32(0x1)
230 #define INITIALIZE_SUBTYPE (9)
233 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
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.
240 * See comments documenting "BSM" (bootstrap state machine).
242 struct iwl3945_init_alive_resp {
248 u8 ver_subtype; /* "9" for initialize alive */
250 __le32 log_event_table_ptr;
251 __le32 error_event_table_ptr;
254 } __attribute__ ((packed));
258 * REPLY_ALIVE = 0x1 (response only, not a command)
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.
265 * See comments documenting "BSM" (bootstrap state machine).
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:
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.
273 * 2) error_event_table_ptr indicates base of the error log. This contains
274 * information about any uCode error that occurs.
276 * The Linux driver can print both logs to the system log when a uCode error
279 struct iwl3945_alive_resp {
285 u8 ver_subtype; /* not "9" for runtime alive */
287 __le32 log_event_table_ptr; /* SRAM address for event log */
288 __le32 error_event_table_ptr; /* SRAM address for error log */
291 } __attribute__ ((packed));
300 * REPLY_ERROR = 0x2 (response only, not a command)
302 struct iwl3945_error_resp {
306 __le16 bad_cmd_seq_num;
310 } __attribute__ ((packed));
312 /******************************************************************************
314 * RXON Commands & Responses:
316 *****************************************************************************/
319 * Rx config defines & structure
321 /* rx_config device types */
323 RXON_DEV_TYPE_AP = 1,
324 RXON_DEV_TYPE_ESS = 3,
325 RXON_DEV_TYPE_IBSS = 4,
326 RXON_DEV_TYPE_SNIFFER = 6,
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)
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)
369 * REPLY_RXON = 0x10 (command, has simple generic response)
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.
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
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.
385 struct iwl3945_rxon_cmd {
390 u8 wlap_bssid_addr[6];
402 } __attribute__ ((packed));
405 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
407 struct iwl3945_rxon_assoc_cmd {
413 } __attribute__ ((packed));
416 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
418 struct iwl3945_rxon_time_cmd {
420 __le16 beacon_interval;
422 __le32 beacon_init_val;
423 __le16 listen_interval;
425 } __attribute__ ((packed));
428 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
430 struct iwl3945_channel_switch_cmd {
435 __le32 rxon_filter_flags;
437 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
438 } __attribute__ ((packed));
441 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
443 struct iwl3945_csa_notification {
446 __le32 status; /* 0 - OK, 1 - fail */
447 } __attribute__ ((packed));
449 /******************************************************************************
451 * Quality-of-Service (QOS) Commands & Responses:
453 *****************************************************************************/
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
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.
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.
471 struct iwl3945_ac_qos {
477 } __attribute__ ((packed));
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)
484 /* Number of Access Categories (AC) (EDCA), queues 0..3 */
488 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
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.
493 struct iwl3945_qosparam_cmd {
495 struct iwl3945_ac_qos ac[AC_NUM];
496 } __attribute__ ((packed));
498 /******************************************************************************
500 * Add/Modify Stations Commands & Responses:
502 *****************************************************************************/
504 * Multi station support
507 /* Special, dedicated locations within device's station table */
509 #define IWL_MULTICAST_ID 1
511 #define IWL3945_BROADCAST_ID 24
512 #define IWL3945_STATION_COUNT 25
514 #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
515 #define IWL_INVALID_STATION 255
517 #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2);
518 #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8);
520 /* Use in mode field. 1: modify existing entry, 0: add new station entry */
521 #define STA_CONTROL_MODIFY_MSK 0x01
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)
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)
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)
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
546 * bit14:15 01 B inactive, A active
547 * 10 B active, A inactive
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
556 struct iwl3945_keyinfo {
558 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
560 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
563 u8 key[16]; /* 16-byte unicast decryption key */
564 } __attribute__ ((packed));
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
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).
576 * modify_mask flags select which parameters to modify vs. leave alone.
578 struct sta_id_modify {
584 } __attribute__ ((packed));
587 * REPLY_ADD_STA = 0x18 (command)
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).
594 * REPLY_ADD_STA sets up the table entry for one station, either creating
595 * a new entry, or modifying a pre-existing one.
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).
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.
611 struct iwl3945_addsta_cmd {
612 u8 mode; /* 1: modify existing, 0: add new station */
614 struct sta_id_modify sta;
615 struct iwl3945_keyinfo key;
616 __le32 station_flags; /* STA_FLG_* */
617 __le32 station_flags_msk; /* STA_FLG_* */
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;
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;
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;
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));
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
643 * REPLY_ADD_STA = 0x18 (response)
645 struct iwl3945_add_sta_resp {
646 u8 status; /* ADD_STA_* */
647 } __attribute__ ((packed));
650 /******************************************************************************
654 *****************************************************************************/
656 struct iwl3945_rx_frame_stats {
664 } __attribute__ ((packed));
666 struct iwl3945_rx_frame_hdr {
673 } __attribute__ ((packed));
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)
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)
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)
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)
696 struct iwl3945_rx_frame_end {
699 __le32 beacon_timestamp;
700 } __attribute__ ((packed));
703 * REPLY_3945_RX = 0x1b (response only, not a command)
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
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));
716 /******************************************************************************
718 * Tx Commands & Responses:
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.
726 * uCode handles all timing and protocol related to control frames
727 * (RTS/CTS/ACK), based on flags in the Tx command.
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).
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 *****************************************************************************/
738 /* REPLY_TX Tx flags field */
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
794 /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
795 * alignment of frame's payload data field.
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)
802 /* HCCA-AP - disable duration overwriting. */
803 #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
806 * TX command security control
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
816 * REPLY_TX = 0x1c (command)
818 struct iwl3945_tx_cmd {
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)
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.
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.
836 __le16 next_frame_len;
838 __le32 tx_flags; /* TX_CMD_FLG_* */
842 /* Index of recipient station in uCode's station table */
852 __le32 next_frame_info;
858 u8 rts_retry_limit; /*byte 50 */
859 u8 data_retry_limit; /*byte 51 */
861 __le16 pm_frame_timeout;
862 __le16 attempt_duration;
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).
872 * MAC header goes here, followed by 2 bytes padding if MAC header
873 * length is 26 or 30 bytes, followed by payload data
876 struct ieee80211_hdr hdr[0];
877 } __attribute__ ((packed));
879 /* TX command response is sent after *all* transmission attempts.
883 * TX_STATUS_FAIL_NEXT_FRAG
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'.
889 * TX_STATUS_FIFO_UNDERRUN
891 * Indicates the host did not provide bytes to the FIFO fast enough while
892 * a TX was in progress.
894 * TX_STATUS_FAIL_MGMNT_ABORT
896 * This status is only possible if the ABORT ON MGMT RX parameter was
897 * set to true with the TX command.
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.
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,
927 #define TX_PACKET_MODE_REGULAR 0x0000
928 #define TX_PACKET_MODE_BURST_SEQ 0x0100
929 #define TX_PACKET_MODE_BURST_FIRST 0x0200
932 TX_POWER_PA_NOT_ACTIVE = 0x0,
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 */
947 * REPLY_TX = 0x1c (response)
949 struct iwl3945_tx_resp {
954 __le32 wireless_media_time;
955 __le32 status; /* TX status */
956 } __attribute__ ((packed));
959 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
961 struct iwl3945_txpowertable_cmd {
962 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
965 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
966 } __attribute__ ((packed));
968 struct iwl3945_rate_scaling_info {
972 } __attribute__ ((packed));
975 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
977 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
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
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)
989 struct iwl3945_rate_scaling_cmd {
992 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
993 } __attribute__ ((packed));
996 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
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.
1002 struct iwl3945_bt_cmd {
1007 __le32 kill_ack_mask;
1008 __le32 kill_cts_mask;
1009 } __attribute__ ((packed));
1011 /******************************************************************************
1013 * Spectrum Management (802.11h) Commands, Responses, Notifications:
1015 *****************************************************************************/
1018 * Spectrum Management
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)
1028 struct iwl3945_measure_channel {
1029 __le32 duration; /* measurement duration in extended beacon
1031 u8 channel; /* channel to measure */
1032 u8 type; /* see enum iwl3945_measure_type */
1034 } __attribute__ ((packed));
1037 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
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 */
1048 __le32 flags; /* rxon flags */
1049 __le32 filter_flags; /* rxon filter flags */
1050 __le16 channel_count; /* minimum 1, maximum 10 */
1052 struct iwl3945_measure_channel channels[10];
1053 } __attribute__ ((packed));
1056 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
1058 struct iwl3945_spectrum_resp {
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
1064 } __attribute__ ((packed));
1066 enum iwl3945_measurement_state {
1067 IWL_MEASUREMENT_START = 0,
1068 IWL_MEASUREMENT_STOP = 1,
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,
1077 IWL_MEASUREMENT_STOPPED = 6,
1078 IWL_MEASUREMENT_TIMEOUT = 7,
1079 IWL_MEASUREMENT_PERIODIC_FAILED = 8,
1082 #define NUM_ELEMENTS_IN_HISTOGRAM 8
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));
1089 /* clear channel availability counters */
1090 struct iwl3945_measurement_cca_counters {
1093 } __attribute__ ((packed));
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),
1106 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
1108 struct iwl3945_spectrum_notification {
1109 u8 id; /* measurement id -- 0 or 1 */
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 */
1116 u8 type; /* see enum iwl3945_measurement_type */
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 -
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));
1131 /******************************************************************************
1133 * Power Management Commands, Responses, Notifications:
1135 *****************************************************************************/
1138 * struct iwl3945_powertable_cmd - Power Table Command
1139 * @flags: See below:
1141 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
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)
1150 * bit 2 - '0' PM have to walk up every DTIM
1151 * '1' PM could sleep over DTIM till listen Interval.
1153 * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
1154 * '1' !(PCI_LINK_CTRL & 0x1)
1156 * bit 31/30- '00' use both mac/xtal sleeps
1157 * '01' force Mac sleep
1158 * '10' force xtal sleep
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
1165 #define IWL_POWER_VEC_SIZE 5
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 {
1172 __le32 rx_data_timeout;
1173 __le32 tx_data_timeout;
1174 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
1175 } __attribute__((packed));
1178 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1179 * 3945 and 4965 identical.
1181 struct iwl3945_sleep_notification {
1188 } __attribute__ ((packed));
1190 /* Sleep states. 3945 and 4965 identical. */
1192 IWL_PM_NO_SLEEP = 0,
1194 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
1195 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
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,
1202 IWL_PM_NUM_OF_MODES = 12,
1206 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
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));
1216 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1218 struct iwl3945_card_state_notif {
1220 } __attribute__ ((packed));
1222 #define HW_CARD_DISABLED 0x01
1223 #define SW_CARD_DISABLED 0x02
1224 #define RF_CARD_DISABLED 0x04
1225 #define RXON_CARD_DISABLED 0x10
1227 struct iwl3945_ct_kill_config {
1229 __le32 critical_temperature_M;
1230 __le32 critical_temperature_R;
1231 } __attribute__ ((packed));
1233 /******************************************************************************
1235 * Scan Commands, Responses, Notifications:
1237 *****************************************************************************/
1240 * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
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)
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
1258 struct iwl3945_scan_channel {
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.
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));
1274 * struct iwl3945_ssid_ie - directed scan network information element
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.
1280 struct iwl3945_ssid_ie {
1284 } __attribute__ ((packed));
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
1292 * REPLY_SCAN_CMD = 0x80 (command)
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
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.
1309 * After receiving this command, the device's scan engine does the following;
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
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.
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.
1338 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
1340 * To avoid uCode errors, see timing restrictions described under
1341 * struct iwl3945_scan_channel.
1343 struct iwl3945_scan_cmd {
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 */
1352 __le32 max_out_time; /* max usec to be away from associated (service)
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.
1359 __le32 flags; /* RXON_FLG_* */
1360 __le32 filter_flags; /* RXON_FILTER_* */
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;
1366 /* For directed active scans (set to all-0s otherwise) */
1367 struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
1370 * Probe request frame, followed by channel list.
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:
1377 * struct iwl3945_scan_channel channels[0];
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.
1385 } __attribute__ ((packed));
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
1393 * REPLY_SCAN_CMD = 0x80 (response)
1395 struct iwl3945_scanreq_notification {
1396 __le32 status; /* 1: okay, 2: cannot fulfill request */
1397 } __attribute__ ((packed));
1400 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1402 struct iwl3945_scanstart_notification {
1405 __le32 beacon_timer;
1410 } __attribute__ ((packed));
1412 #define SCAN_OWNER_STATUS 0x1;
1413 #define MEASURE_OWNER_STATUS 0x2;
1415 #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
1417 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1419 struct iwl3945_scanresults_notification {
1425 __le32 statistics[NUMBER_OF_STATISTICS];
1426 } __attribute__ ((packed));
1429 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1431 struct iwl3945_scancomplete_notification {
1432 u8 scanned_channels;
1438 } __attribute__ ((packed));
1441 /******************************************************************************
1443 * IBSS/AP Commands and Notifications:
1445 *****************************************************************************/
1448 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1450 struct iwl3945_beacon_notif {
1451 struct iwl3945_tx_resp beacon_notify_hdr;
1454 __le32 ibss_mgr_status;
1455 } __attribute__ ((packed));
1458 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1460 struct iwl3945_tx_beacon_cmd {
1461 struct iwl3945_tx_cmd tx;
1465 struct ieee80211_hdr frame[0]; /* beacon frame */
1466 } __attribute__ ((packed));
1468 /******************************************************************************
1470 * Statistics Commands and Notifications:
1472 *****************************************************************************/
1474 #define IWL_TEMP_CONVERT 260
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
1480 /* Used for passing to driver number of successes and failures per rate */
1481 struct rate_histogram {
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];
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];
1492 } __attribute__ ((packed));
1494 /* statistics command response */
1496 struct statistics_rx_phy {
1502 __le32 early_overrun_err;
1504 __le32 false_alarm_cnt;
1505 __le32 fina_sync_err_cnt;
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));
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));
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));
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;
1539 __le32 expected_ack_cnt;
1540 __le32 actual_ack_cnt;
1541 } __attribute__ ((packed));
1543 struct statistics_dbg {
1547 } __attribute__ ((packed));
1549 struct statistics_div {
1554 } __attribute__ ((packed));
1556 struct statistics_general {
1558 struct statistics_dbg dbg;
1562 __le32 ttl_timestamp;
1563 struct statistics_div div;
1564 } __attribute__ ((packed));
1567 * REPLY_STATISTICS_CMD = 0x9c,
1568 * 3945 and 4965 identical.
1570 * This command triggers an immediate response containing uCode statistics.
1571 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
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).
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.
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));
1588 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
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.
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).
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.
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 {
1606 struct statistics_rx rx;
1607 struct statistics_tx tx;
1608 struct statistics_general general;
1609 } __attribute__ ((packed));
1613 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
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
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));
1626 /******************************************************************************
1628 * Rx Calibration Commands:
1630 *****************************************************************************/
1632 #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1633 #define HD_TABLE_SIZE (11)
1635 struct iwl3945_sensitivity_cmd {
1637 __le16 table[HD_TABLE_SIZE];
1638 } __attribute__ ((packed));
1640 struct iwl3945_calibration_cmd {
1648 } __attribute__ ((packed));
1650 /******************************************************************************
1652 * Miscellaneous Commands:
1654 *****************************************************************************/
1657 * LEDs Command & Response
1658 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
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.
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 */
1671 } __attribute__ ((packed));
1673 /******************************************************************************
1675 * Union of all expected notifications/responses:
1677 *****************************************************************************/
1679 struct iwl3945_rx_packet {
1681 struct iwl3945_cmd_header hdr;
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;
1698 } __attribute__ ((packed));
1700 #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1702 #endif /* __iwl3945_3945_commands_h__ */