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 - 2010 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 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33 * Copyright(c) 2005 - 2010 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-commands.h) only for uCode API definitions.
65 * Please use iwl-xxxx-hw.h for hardware-related definitions.
66 * Please use iwl-dev.h for driver implementation definitions.
69 #ifndef __iwl_commands_h__
70 #define __iwl_commands_h__
74 /* uCode version contains 4 values: Major/Minor/API/Serial */
75 #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
76 #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
77 #define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
78 #define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
82 #define IWL_CCK_RATES 4
83 #define IWL_OFDM_RATES 8
84 #define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES)
90 /* RXON and QOS commands */
92 REPLY_RXON_ASSOC = 0x11,
93 REPLY_QOS_PARAM = 0x13,
94 REPLY_RXON_TIMING = 0x14,
96 /* Multi-Station support */
98 REPLY_REMOVE_STA = 0x19,
99 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
100 REPLY_TXFIFO_FLUSH = 0x1e,
106 REPLY_3945_RX = 0x1b, /* 3945 only */
108 REPLY_RATE_SCALE = 0x47, /* 3945 only */
109 REPLY_LEDS_CMD = 0x48,
110 REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */
112 /* WiMAX coexistence */
113 COEX_PRIORITY_TABLE_CMD = 0x5a, /* for 5000 series and up */
114 COEX_MEDIUM_NOTIFICATION = 0x5b,
115 COEX_EVENT_CMD = 0x5c,
118 TEMPERATURE_NOTIFICATION = 0x62,
119 CALIBRATION_CFG_CMD = 0x65,
120 CALIBRATION_RES_NOTIFICATION = 0x66,
121 CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
123 /* 802.11h related */
124 REPLY_QUIET_CMD = 0x71, /* not used */
125 REPLY_CHANNEL_SWITCH = 0x72,
126 CHANNEL_SWITCH_NOTIFICATION = 0x73,
127 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
128 SPECTRUM_MEASURE_NOTIFICATION = 0x75,
130 /* Power Management */
131 POWER_TABLE_CMD = 0x77,
132 PM_SLEEP_NOTIFICATION = 0x7A,
133 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
135 /* Scan commands and notifications */
136 REPLY_SCAN_CMD = 0x80,
137 REPLY_SCAN_ABORT_CMD = 0x81,
138 SCAN_START_NOTIFICATION = 0x82,
139 SCAN_RESULTS_NOTIFICATION = 0x83,
140 SCAN_COMPLETE_NOTIFICATION = 0x84,
142 /* IBSS/AP commands */
143 BEACON_NOTIFICATION = 0x90,
144 REPLY_TX_BEACON = 0x91,
145 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
147 /* Miscellaneous commands */
148 REPLY_TX_POWER_DBM_CMD = 0x95,
149 QUIET_NOTIFICATION = 0x96, /* not used */
150 REPLY_TX_PWR_TABLE_CMD = 0x97,
151 REPLY_TX_POWER_DBM_CMD_V1 = 0x98, /* old version of API */
152 TX_ANT_CONFIGURATION_CMD = 0x98,
153 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
155 /* Bluetooth device coexistence config command */
156 REPLY_BT_CONFIG = 0x9b,
159 REPLY_STATISTICS_CMD = 0x9c,
160 STATISTICS_NOTIFICATION = 0x9d,
162 /* RF-KILL commands and notifications */
163 REPLY_CARD_STATE_CMD = 0xa0,
164 CARD_STATE_NOTIFICATION = 0xa1,
166 /* Missed beacons notification */
167 MISSED_BEACONS_NOTIFICATION = 0xa2,
169 REPLY_CT_KILL_CONFIG_CMD = 0xa4,
170 SENSITIVITY_CMD = 0xa8,
171 REPLY_PHY_CALIBRATION_CMD = 0xb0,
172 REPLY_RX_PHY_CMD = 0xc0,
173 REPLY_RX_MPDU_CMD = 0xc1,
175 REPLY_COMPRESSED_BA = 0xc5,
178 REPLY_BT_COEX_PRIO_TABLE = 0xcc,
179 REPLY_BT_COEX_PROT_ENV = 0xcd,
180 REPLY_BT_COEX_PROFILE_NOTIF = 0xce,
185 /******************************************************************************
187 * Commonly used structures and definitions:
188 * Command header, rate_n_flags, txpower
190 *****************************************************************************/
192 /* iwl_cmd_header flags value */
193 #define IWL_CMD_FAILED_MSK 0x40
195 #define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
196 #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
197 #define SEQ_TO_INDEX(s) ((s) & 0xff)
198 #define INDEX_TO_SEQ(i) ((i) & 0xff)
199 #define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
200 #define SEQ_RX_FRAME cpu_to_le16(0x8000)
203 * struct iwl_cmd_header
205 * This header format appears in the beginning of each command sent from the
206 * driver, and each response/notification received from uCode.
208 struct iwl_cmd_header {
209 u8 cmd; /* Command ID: REPLY_RXON, etc. */
210 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
212 * The driver sets up the sequence number to values of its choosing.
213 * uCode does not use this value, but passes it back to the driver
214 * when sending the response to each driver-originated command, so
215 * the driver can match the response to the command. Since the values
216 * don't get used by uCode, the driver may set up an arbitrary format.
218 * There is one exception: uCode sets bit 15 when it originates
219 * the response/notification, i.e. when the response/notification
220 * is not a direct response to a command sent by the driver. For
221 * example, uCode issues REPLY_3945_RX when it sends a received frame
222 * to the driver; it is not a direct response to any driver command.
224 * The Linux driver uses the following format:
226 * 0:7 tfd index - position within TX queue
229 * 14 huge - driver sets this to indicate command is in the
230 * 'huge' storage at the end of the command buffers
231 * 15 unsolicited RX or uCode-originated notification
235 /* command or response/notification data follows immediately */
241 * struct iwl3945_tx_power
243 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
245 * Each entry contains two values:
246 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
247 * linear value that multiplies the output of the digital signal processor,
248 * before being sent to the analog radio.
249 * 2) Radio gain. This sets the analog gain of the radio Tx path.
250 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
252 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
254 struct iwl3945_tx_power {
255 u8 tx_gain; /* gain for analog radio */
256 u8 dsp_atten; /* gain for DSP */
260 * struct iwl3945_power_per_rate
262 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
264 struct iwl3945_power_per_rate {
266 struct iwl3945_tx_power tpc;
271 * iwlagn rate_n_flags bit fields
273 * rate_n_flags format is used in following iwlagn commands:
274 * REPLY_RX (response only)
275 * REPLY_RX_MPDU (response only)
276 * REPLY_TX (both command and response)
277 * REPLY_TX_LINK_QUALITY_CMD
279 * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
289 * 4-3: 0) Single stream (SISO)
290 * 1) Dual stream (MIMO)
291 * 2) Triple stream (MIMO)
293 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
295 * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
305 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
311 #define RATE_MCS_CODE_MSK 0x7
312 #define RATE_MCS_SPATIAL_POS 3
313 #define RATE_MCS_SPATIAL_MSK 0x18
314 #define RATE_MCS_HT_DUP_POS 5
315 #define RATE_MCS_HT_DUP_MSK 0x20
317 /* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
318 #define RATE_MCS_FLAGS_POS 8
319 #define RATE_MCS_HT_POS 8
320 #define RATE_MCS_HT_MSK 0x100
322 /* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
323 #define RATE_MCS_CCK_POS 9
324 #define RATE_MCS_CCK_MSK 0x200
326 /* Bit 10: (1) Use Green Field preamble */
327 #define RATE_MCS_GF_POS 10
328 #define RATE_MCS_GF_MSK 0x400
330 /* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
331 #define RATE_MCS_HT40_POS 11
332 #define RATE_MCS_HT40_MSK 0x800
334 /* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
335 #define RATE_MCS_DUP_POS 12
336 #define RATE_MCS_DUP_MSK 0x1000
338 /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
339 #define RATE_MCS_SGI_POS 13
340 #define RATE_MCS_SGI_MSK 0x2000
343 * rate_n_flags Tx antenna masks
344 * 4965 has 2 transmitters
345 * 5100 has 1 transmitter B
346 * 5150 has 1 transmitter A
347 * 5300 has 3 transmitters
348 * 5350 has 3 transmitters
351 #define RATE_MCS_ANT_POS 14
352 #define RATE_MCS_ANT_A_MSK 0x04000
353 #define RATE_MCS_ANT_B_MSK 0x08000
354 #define RATE_MCS_ANT_C_MSK 0x10000
355 #define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
356 #define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
357 #define RATE_ANT_NUM 3
359 #define POWER_TABLE_NUM_ENTRIES 33
360 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
361 #define POWER_TABLE_CCK_ENTRY 32
363 #define IWL_PWR_NUM_HT_OFDM_ENTRIES 24
364 #define IWL_PWR_CCK_ENTRIES 2
367 * union iwl4965_tx_power_dual_stream
369 * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
370 * Use __le32 version (struct tx_power_dual_stream) when building command.
372 * Driver provides radio gain and DSP attenuation settings to device in pairs,
373 * one value for each transmitter chain. The first value is for transmitter A,
374 * second for transmitter B.
376 * For SISO bit rates, both values in a pair should be identical.
377 * For MIMO rates, one value may be different from the other,
378 * in order to balance the Tx output between the two transmitters.
380 * See more details in doc for TXPOWER in iwl-4965-hw.h.
382 union iwl4965_tx_power_dual_stream {
385 u8 dsp_predis_atten[2];
391 * struct tx_power_dual_stream
393 * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
395 * Same format as iwl_tx_power_dual_stream, but __le32
397 struct tx_power_dual_stream {
402 * struct iwl4965_tx_power_db
404 * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
406 struct iwl4965_tx_power_db {
407 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
411 * Command REPLY_TX_POWER_DBM_CMD = 0x98
412 * struct iwl5000_tx_power_dbm_cmd
414 #define IWL50_TX_POWER_AUTO 0x7f
415 #define IWL50_TX_POWER_NO_CLOSED (0x1 << 6)
417 struct iwl5000_tx_power_dbm_cmd {
418 s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
420 s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
425 * Command TX_ANT_CONFIGURATION_CMD = 0x98
426 * This command is used to configure valid Tx antenna.
427 * By default uCode concludes the valid antenna according to the radio flavor.
428 * This command enables the driver to override/modify this conclusion.
430 struct iwl_tx_ant_config_cmd {
434 /******************************************************************************
436 * Alive and Error Commands & Responses:
438 *****************************************************************************/
440 #define UCODE_VALID_OK cpu_to_le32(0x1)
441 #define INITIALIZE_SUBTYPE (9)
444 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
446 * uCode issues this "initialize alive" notification once the initialization
447 * uCode image has completed its work, and is ready to load the runtime image.
448 * This is the *first* "alive" notification that the driver will receive after
449 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
451 * See comments documenting "BSM" (bootstrap state machine).
453 * For 4965, this notification contains important calibration data for
454 * calculating txpower settings:
456 * 1) Power supply voltage indication. The voltage sensor outputs higher
457 * values for lower voltage, and vice verse.
459 * 2) Temperature measurement parameters, for each of two channel widths
460 * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
461 * is done via one of the receiver chains, and channel width influences
464 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
465 * for each of 5 frequency ranges.
467 struct iwl_init_alive_resp {
473 u8 ver_subtype; /* "9" for initialize alive */
475 __le32 log_event_table_ptr;
476 __le32 error_event_table_ptr;
480 /* calibration values from "initialize" uCode */
481 __le32 voltage; /* signed, higher value is lower voltage */
482 __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */
483 __le32 therm_r2[2]; /* signed */
484 __le32 therm_r3[2]; /* signed */
485 __le32 therm_r4[2]; /* signed */
486 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
492 * REPLY_ALIVE = 0x1 (response only, not a command)
494 * uCode issues this "alive" notification once the runtime image is ready
495 * to receive commands from the driver. This is the *second* "alive"
496 * notification that the driver will receive after rebooting uCode;
497 * this "alive" is indicated by subtype field != 9.
499 * See comments documenting "BSM" (bootstrap state machine).
501 * This response includes two pointers to structures within the device's
502 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
504 * 1) log_event_table_ptr indicates base of the event log. This traces
505 * a 256-entry history of uCode execution within a circular buffer.
506 * Its header format is:
508 * __le32 log_size; log capacity (in number of entries)
509 * __le32 type; (1) timestamp with each entry, (0) no timestamp
510 * __le32 wraps; # times uCode has wrapped to top of circular buffer
511 * __le32 write_index; next circular buffer entry that uCode would fill
513 * The header is followed by the circular buffer of log entries. Entries
514 * with timestamps have the following format:
516 * __le32 event_id; range 0 - 1500
517 * __le32 timestamp; low 32 bits of TSF (of network, if associated)
518 * __le32 data; event_id-specific data value
520 * Entries without timestamps contain only event_id and data.
523 * 2) error_event_table_ptr indicates base of the error log. This contains
524 * information about any uCode error that occurs. For agn, the format
525 * of the error log is:
527 * __le32 valid; (nonzero) valid, (0) log is empty
528 * __le32 error_id; type of error
529 * __le32 pc; program counter
530 * __le32 blink1; branch link
531 * __le32 blink2; branch link
532 * __le32 ilink1; interrupt link
533 * __le32 ilink2; interrupt link
534 * __le32 data1; error-specific data
535 * __le32 data2; error-specific data
536 * __le32 line; source code line of error
537 * __le32 bcon_time; beacon timer
538 * __le32 tsf_low; network timestamp function timer
539 * __le32 tsf_hi; network timestamp function timer
540 * __le32 gp1; GP1 timer register
541 * __le32 gp2; GP2 timer register
542 * __le32 gp3; GP3 timer register
543 * __le32 ucode_ver; uCode version
544 * __le32 hw_ver; HW Silicon version
545 * __le32 brd_ver; HW board version
546 * __le32 log_pc; log program counter
547 * __le32 frame_ptr; frame pointer
548 * __le32 stack_ptr; stack pointer
549 * __le32 hcmd; last host command
550 * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
551 * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
552 * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
553 * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
554 * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
555 * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
556 * __le32 wait_event; wait event() caller address
557 * __le32 l2p_control; L2pControlField
558 * __le32 l2p_duration; L2pDurationField
559 * __le32 l2p_mhvalid; L2pMhValidBits
560 * __le32 l2p_addr_match; L2pAddrMatchStat
561 * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
562 * __le32 u_timestamp; indicate when the date and time of the compilation
565 * The Linux driver can print both logs to the system log when a uCode error
568 struct iwl_alive_resp {
574 u8 ver_subtype; /* not "9" for runtime alive */
576 __le32 log_event_table_ptr; /* SRAM address for event log */
577 __le32 error_event_table_ptr; /* SRAM address for error log */
583 * REPLY_ERROR = 0x2 (response only, not a command)
585 struct iwl_error_resp {
589 __le16 bad_cmd_seq_num;
594 /******************************************************************************
596 * RXON Commands & Responses:
598 *****************************************************************************/
601 * Rx config defines & structure
603 /* rx_config device types */
605 RXON_DEV_TYPE_AP = 1,
606 RXON_DEV_TYPE_ESS = 3,
607 RXON_DEV_TYPE_IBSS = 4,
608 RXON_DEV_TYPE_SNIFFER = 6,
612 #define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
613 #define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
614 #define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
615 #define RXON_RX_CHAIN_VALID_POS (1)
616 #define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
617 #define RXON_RX_CHAIN_FORCE_SEL_POS (4)
618 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
619 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
620 #define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
621 #define RXON_RX_CHAIN_CNT_POS (10)
622 #define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
623 #define RXON_RX_CHAIN_MIMO_CNT_POS (12)
624 #define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
625 #define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
627 /* rx_config flags */
628 /* band & modulation selection */
629 #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
630 #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
631 /* auto detection enable */
632 #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
633 /* TGg protection when tx */
634 #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
635 /* cck short slot & preamble */
636 #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
637 #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
638 /* antenna selection */
639 #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
640 #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
641 #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
642 #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
643 /* radar detection enable */
644 #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
645 #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
646 /* rx response to host with 8-byte TSF
647 * (according to ON_AIR deassertion) */
648 #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
652 #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
653 #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
655 #define RXON_FLG_HT_OPERATING_MODE_POS (23)
657 #define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
658 #define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
660 #define RXON_FLG_CHANNEL_MODE_POS (25)
661 #define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
665 CHANNEL_MODE_LEGACY = 0,
666 CHANNEL_MODE_PURE_40 = 1,
667 CHANNEL_MODE_MIXED = 2,
668 CHANNEL_MODE_RESERVED = 3,
670 #define RXON_FLG_CHANNEL_MODE_LEGACY cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
671 #define RXON_FLG_CHANNEL_MODE_PURE_40 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
672 #define RXON_FLG_CHANNEL_MODE_MIXED cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
674 /* CTS to self (if spec allows) flag */
675 #define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
677 /* rx_config filter flags */
678 /* accept all data frames */
679 #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
680 /* pass control & management to host */
681 #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
682 /* accept multi-cast */
683 #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
684 /* don't decrypt uni-cast frames */
685 #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
686 /* don't decrypt multi-cast frames */
687 #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
688 /* STA is associated */
689 #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
690 /* transfer to host non bssid beacons in associated state */
691 #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
694 * REPLY_RXON = 0x10 (command, has simple generic response)
696 * RXON tunes the radio tuner to a service channel, and sets up a number
697 * of parameters that are used primarily for Rx, but also for Tx operations.
699 * NOTE: When tuning to a new channel, driver must set the
700 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
701 * info within the device, including the station tables, tx retry
702 * rate tables, and txpower tables. Driver must build a new station
703 * table and txpower table before transmitting anything on the RXON
706 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
707 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
708 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
711 struct iwl3945_rxon_cmd {
716 u8 wlap_bssid_addr[6];
730 struct iwl4965_rxon_cmd {
735 u8 wlap_bssid_addr[6];
746 u8 ofdm_ht_single_stream_basic_rates;
747 u8 ofdm_ht_dual_stream_basic_rates;
750 /* 5000 HW just extend this command */
751 struct iwl_rxon_cmd {
756 u8 wlap_bssid_addr[6];
767 u8 ofdm_ht_single_stream_basic_rates;
768 u8 ofdm_ht_dual_stream_basic_rates;
769 u8 ofdm_ht_triple_stream_basic_rates;
771 __le16 acquisition_data;
776 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
778 struct iwl3945_rxon_assoc_cmd {
786 struct iwl4965_rxon_assoc_cmd {
791 u8 ofdm_ht_single_stream_basic_rates;
792 u8 ofdm_ht_dual_stream_basic_rates;
793 __le16 rx_chain_select_flags;
797 struct iwl5000_rxon_assoc_cmd {
803 u8 ofdm_ht_single_stream_basic_rates;
804 u8 ofdm_ht_dual_stream_basic_rates;
805 u8 ofdm_ht_triple_stream_basic_rates;
807 __le16 rx_chain_select_flags;
808 __le16 acquisition_data;
812 #define IWL_CONN_MAX_LISTEN_INTERVAL 10
813 #define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
814 #define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
817 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
819 struct iwl_rxon_time_cmd {
821 __le16 beacon_interval;
823 __le32 beacon_init_val;
824 __le16 listen_interval;
829 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
831 struct iwl3945_channel_switch_cmd {
836 __le32 rxon_filter_flags;
838 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
841 struct iwl4965_channel_switch_cmd {
846 __le32 rxon_filter_flags;
848 struct iwl4965_tx_power_db tx_power;
852 * struct iwl5000_channel_switch_cmd
853 * @band: 0- 5.2GHz, 1- 2.4GHz
854 * @expect_beacon: 0- resume transmits after channel switch
855 * 1- wait for beacon to resume transmits
856 * @channel: new channel number
857 * @rxon_flags: Rx on flags
858 * @rxon_filter_flags: filtering parameters
859 * @switch_time: switch time in extended beacon format
860 * @reserved: reserved bytes
862 struct iwl5000_channel_switch_cmd {
867 __le32 rxon_filter_flags;
869 __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
873 * struct iwl6000_channel_switch_cmd
874 * @band: 0- 5.2GHz, 1- 2.4GHz
875 * @expect_beacon: 0- resume transmits after channel switch
876 * 1- wait for beacon to resume transmits
877 * @channel: new channel number
878 * @rxon_flags: Rx on flags
879 * @rxon_filter_flags: filtering parameters
880 * @switch_time: switch time in extended beacon format
881 * @reserved: reserved bytes
883 struct iwl6000_channel_switch_cmd {
888 __le32 rxon_filter_flags;
890 __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
894 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
896 struct iwl_csa_notification {
899 __le32 status; /* 0 - OK, 1 - fail */
902 /******************************************************************************
904 * Quality-of-Service (QOS) Commands & Responses:
906 *****************************************************************************/
909 * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
910 * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
912 * @cw_min: Contention window, start value in numbers of slots.
913 * Should be a power-of-2, minus 1. Device's default is 0x0f.
914 * @cw_max: Contention window, max value in numbers of slots.
915 * Should be a power-of-2, minus 1. Device's default is 0x3f.
916 * @aifsn: Number of slots in Arbitration Interframe Space (before
917 * performing random backoff timing prior to Tx). Device default 1.
918 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
920 * Device will automatically increase contention window by (2*CW) + 1 for each
921 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
922 * value, to cap the CW value.
932 /* QoS flags defines */
933 #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
934 #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
935 #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
937 /* Number of Access Categories (AC) (EDCA), queues 0..3 */
941 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
943 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
944 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
946 struct iwl_qosparam_cmd {
948 struct iwl_ac_qos ac[AC_NUM];
951 /******************************************************************************
953 * Add/Modify Stations Commands & Responses:
955 *****************************************************************************/
957 * Multi station support
960 /* Special, dedicated locations within device's station table */
963 #define IWL3945_BROADCAST_ID 24
964 #define IWL3945_STATION_COUNT 25
965 #define IWL4965_BROADCAST_ID 31
966 #define IWL4965_STATION_COUNT 32
967 #define IWLAGN_BROADCAST_ID 15
968 #define IWLAGN_STATION_COUNT 16
970 #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
971 #define IWL_INVALID_STATION 255
973 #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
974 #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
975 #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
976 #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
977 #define STA_FLG_MAX_AGG_SIZE_POS (19)
978 #define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
979 #define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
980 #define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
981 #define STA_FLG_AGG_MPDU_DENSITY_POS (23)
982 #define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
984 /* Use in mode field. 1: modify existing entry, 0: add new station entry */
985 #define STA_CONTROL_MODIFY_MSK 0x01
987 /* key flags __le16*/
988 #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
989 #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
990 #define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
991 #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
992 #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
994 #define STA_KEY_FLG_KEYID_POS 8
995 #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
996 /* wep key is either from global key (0) or from station info array (1) */
997 #define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
999 /* wep key in STA: 5-bytes (0) or 13-bytes (1) */
1000 #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
1001 #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
1002 #define STA_KEY_MAX_NUM 8
1004 /* Flags indicate whether to modify vs. don't change various station params */
1005 #define STA_MODIFY_KEY_MASK 0x01
1006 #define STA_MODIFY_TID_DISABLE_TX 0x02
1007 #define STA_MODIFY_TX_RATE_MSK 0x04
1008 #define STA_MODIFY_ADDBA_TID_MSK 0x08
1009 #define STA_MODIFY_DELBA_TID_MSK 0x10
1010 #define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
1012 /* Receiver address (actually, Rx station's index into station table),
1013 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
1014 #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
1016 struct iwl4965_keyinfo {
1018 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
1020 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
1023 u8 key[16]; /* 16-byte unicast decryption key */
1027 struct iwl_keyinfo {
1029 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
1031 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
1034 u8 key[16]; /* 16-byte unicast decryption key */
1035 __le64 tx_secur_seq_cnt;
1036 __le64 hw_tkip_mic_rx_key;
1037 __le64 hw_tkip_mic_tx_key;
1041 * struct sta_id_modify
1042 * @addr[ETH_ALEN]: station's MAC address
1043 * @sta_id: index of station in uCode's station table
1044 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
1046 * Driver selects unused table index when adding new station,
1047 * or the index to a pre-existing station entry when modifying that station.
1048 * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
1050 * modify_mask flags select which parameters to modify vs. leave alone.
1052 struct sta_id_modify {
1061 * REPLY_ADD_STA = 0x18 (command)
1063 * The device contains an internal table of per-station information,
1064 * with info on security keys, aggregation parameters, and Tx rates for
1065 * initial Tx attempt and any retries (agn devices uses
1066 * REPLY_TX_LINK_QUALITY_CMD,
1067 * 3945 uses REPLY_RATE_SCALE to set up rate tables).
1069 * REPLY_ADD_STA sets up the table entry for one station, either creating
1070 * a new entry, or modifying a pre-existing one.
1072 * NOTE: RXON command (without "associated" bit set) wipes the station table
1073 * clean. Moving into RF_KILL state does this also. Driver must set up
1074 * new station table before transmitting anything on the RXON channel
1075 * (except active scans or active measurements; those commands carry
1076 * their own txpower/rate setup data).
1078 * When getting started on a new channel, driver must set up the
1079 * IWL_BROADCAST_ID entry (last entry in the table). For a client
1080 * station in a BSS, once an AP is selected, driver sets up the AP STA
1081 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
1082 * are all that are needed for a BSS client station. If the device is
1083 * used as AP, or in an IBSS network, driver must set up station table
1084 * entries for all STAs in network, starting with index IWL_STA_ID.
1087 struct iwl3945_addsta_cmd {
1088 u8 mode; /* 1: modify existing, 0: add new station */
1090 struct sta_id_modify sta;
1091 struct iwl4965_keyinfo key;
1092 __le32 station_flags; /* STA_FLG_* */
1093 __le32 station_flags_msk; /* STA_FLG_* */
1095 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1096 * corresponding to bit (e.g. bit 5 controls TID 5).
1097 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1098 __le16 tid_disable_tx;
1100 __le16 rate_n_flags;
1102 /* TID for which to add block-ack support.
1103 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1104 u8 add_immediate_ba_tid;
1106 /* TID for which to remove block-ack support.
1107 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1108 u8 remove_immediate_ba_tid;
1110 /* Starting Sequence Number for added block-ack support.
1111 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1112 __le16 add_immediate_ba_ssn;
1115 struct iwl4965_addsta_cmd {
1116 u8 mode; /* 1: modify existing, 0: add new station */
1118 struct sta_id_modify sta;
1119 struct iwl4965_keyinfo key;
1120 __le32 station_flags; /* STA_FLG_* */
1121 __le32 station_flags_msk; /* STA_FLG_* */
1123 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1124 * corresponding to bit (e.g. bit 5 controls TID 5).
1125 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1126 __le16 tid_disable_tx;
1130 /* TID for which to add block-ack support.
1131 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1132 u8 add_immediate_ba_tid;
1134 /* TID for which to remove block-ack support.
1135 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1136 u8 remove_immediate_ba_tid;
1138 /* Starting Sequence Number for added block-ack support.
1139 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1140 __le16 add_immediate_ba_ssn;
1143 * Number of packets OK to transmit to station even though
1144 * it is asleep -- used to synchronise PS-poll and u-APSD
1145 * responses while ucode keeps track of STA sleep state.
1147 __le16 sleep_tx_count;
1153 struct iwl_addsta_cmd {
1154 u8 mode; /* 1: modify existing, 0: add new station */
1156 struct sta_id_modify sta;
1157 struct iwl_keyinfo key;
1158 __le32 station_flags; /* STA_FLG_* */
1159 __le32 station_flags_msk; /* STA_FLG_* */
1161 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1162 * corresponding to bit (e.g. bit 5 controls TID 5).
1163 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1164 __le16 tid_disable_tx;
1166 __le16 rate_n_flags; /* 3945 only */
1168 /* TID for which to add block-ack support.
1169 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1170 u8 add_immediate_ba_tid;
1172 /* TID for which to remove block-ack support.
1173 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1174 u8 remove_immediate_ba_tid;
1176 /* Starting Sequence Number for added block-ack support.
1177 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1178 __le16 add_immediate_ba_ssn;
1181 * Number of packets OK to transmit to station even though
1182 * it is asleep -- used to synchronise PS-poll and u-APSD
1183 * responses while ucode keeps track of STA sleep state.
1185 __le16 sleep_tx_count;
1191 #define ADD_STA_SUCCESS_MSK 0x1
1192 #define ADD_STA_NO_ROOM_IN_TABLE 0x2
1193 #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
1194 #define ADD_STA_MODIFY_NON_EXIST_STA 0x8
1196 * REPLY_ADD_STA = 0x18 (response)
1198 struct iwl_add_sta_resp {
1199 u8 status; /* ADD_STA_* */
1202 #define REM_STA_SUCCESS_MSK 0x1
1204 * REPLY_REM_STA = 0x19 (response)
1206 struct iwl_rem_sta_resp {
1211 * REPLY_REM_STA = 0x19 (command)
1213 struct iwl_rem_sta_cmd {
1214 u8 num_sta; /* number of removed stations */
1216 u8 addr[ETH_ALEN]; /* MAC addr of the first station */
1220 #define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
1221 #define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
1222 #define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
1223 #define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
1224 #define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
1226 #define IWL_DROP_SINGLE 0
1227 #define IWL_DROP_SELECTED 1
1228 #define IWL_DROP_ALL 2
1231 * REPLY_TXFIFO_FLUSH = 0x1e(command and response)
1233 * When using full FIFO flush this command checks the scheduler HW block WR/RD
1234 * pointers to check if all the frames were transferred by DMA into the
1235 * relevant TX FIFO queue. Only when the DMA is finished and the queue is
1236 * empty the command can finish.
1237 * This command is used to flush the TXFIFO from transmit commands, it may
1238 * operate on single or multiple queues, the command queue can't be flushed by
1239 * this command. The command response is returned when all the queue flush
1240 * operations are done. Each TX command flushed return response with the FLUSH
1241 * status set in the TX response status. When FIFO flush operation is used,
1242 * the flush operation ends when both the scheduler DMA done and TXFIFO empty
1245 * @fifo_control: bit mask for which queues to flush
1246 * @flush_control: flush controls
1247 * 0: Dump single MSDU
1248 * 1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable.
1251 struct iwl_txfifo_flush_cmd {
1252 __le32 fifo_control;
1253 __le16 flush_control;
1258 * REPLY_WEP_KEY = 0x20
1260 struct iwl_wep_key {
1269 struct iwl_wep_cmd {
1274 struct iwl_wep_key key[0];
1277 #define WEP_KEY_WEP_TYPE 1
1278 #define WEP_KEYS_MAX 4
1279 #define WEP_INVALID_OFFSET 0xff
1280 #define WEP_KEY_LEN_64 5
1281 #define WEP_KEY_LEN_128 13
1283 /******************************************************************************
1287 *****************************************************************************/
1289 #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
1290 #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
1292 #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
1293 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
1294 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
1295 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
1296 #define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
1297 #define RX_RES_PHY_FLAGS_ANTENNA_POS 4
1299 #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
1300 #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
1301 #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
1302 #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
1303 #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
1304 #define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
1306 #define RX_RES_STATUS_STATION_FOUND (1<<6)
1307 #define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
1309 #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
1310 #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
1311 #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
1312 #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
1313 #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
1315 #define RX_MPDU_RES_STATUS_ICV_OK (0x20)
1316 #define RX_MPDU_RES_STATUS_MIC_OK (0x40)
1317 #define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
1318 #define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1321 struct iwl3945_rx_frame_stats {
1331 struct iwl3945_rx_frame_hdr {
1340 struct iwl3945_rx_frame_end {
1343 __le32 beacon_timestamp;
1347 * REPLY_3945_RX = 0x1b (response only, not a command)
1349 * NOTE: DO NOT dereference from casts to this structure
1350 * It is provided only for calculating minimum data set size.
1351 * The actual offsets of the hdr and end are dynamic based on
1354 struct iwl3945_rx_frame {
1355 struct iwl3945_rx_frame_stats stats;
1356 struct iwl3945_rx_frame_hdr hdr;
1357 struct iwl3945_rx_frame_end end;
1360 #define IWL39_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1362 /* Fixed (non-configurable) rx data from phy */
1364 #define IWL49_RX_RES_PHY_CNT 14
1365 #define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
1366 #define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
1367 #define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
1368 #define IWL49_AGC_DB_POS (7)
1369 struct iwl4965_rx_non_cfg_phy {
1370 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
1371 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
1372 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
1377 #define IWLAGN_RX_RES_PHY_CNT 8
1378 #define IWLAGN_RX_RES_AGC_IDX 1
1379 #define IWLAGN_RX_RES_RSSI_AB_IDX 2
1380 #define IWLAGN_RX_RES_RSSI_C_IDX 3
1381 #define IWLAGN_OFDM_AGC_MSK 0xfe00
1382 #define IWLAGN_OFDM_AGC_BIT_POS 9
1383 #define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff
1384 #define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00
1385 #define IWLAGN_OFDM_RSSI_A_BIT_POS 0
1386 #define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000
1387 #define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000
1388 #define IWLAGN_OFDM_RSSI_B_BIT_POS 16
1389 #define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff
1390 #define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00
1391 #define IWLAGN_OFDM_RSSI_C_BIT_POS 0
1393 struct iwlagn_non_cfg_phy {
1394 __le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT]; /* up to 8 phy entries */
1399 * REPLY_RX = 0xc3 (response only, not a command)
1400 * Used only for legacy (non 11n) frames.
1402 struct iwl_rx_phy_res {
1403 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
1404 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
1405 u8 stat_id; /* configurable DSP phy data set ID */
1407 __le64 timestamp; /* TSF at on air rise */
1408 __le32 beacon_time_stamp; /* beacon at on-air rise */
1409 __le16 phy_flags; /* general phy flags: band, modulation, ... */
1410 __le16 channel; /* channel number */
1411 u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
1412 __le32 rate_n_flags; /* RATE_MCS_* */
1413 __le16 byte_count; /* frame's byte-count */
1414 __le16 frame_time; /* frame's time on the air */
1417 struct iwl_rx_mpdu_res_start {
1423 /******************************************************************************
1425 * Tx Commands & Responses:
1427 * Driver must place each REPLY_TX command into one of the prioritized Tx
1428 * queues in host DRAM, shared between driver and device (see comments for
1429 * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
1430 * are preparing to transmit, the device pulls the Tx command over the PCI
1431 * bus via one of the device's Tx DMA channels, to fill an internal FIFO
1432 * from which data will be transmitted.
1434 * uCode handles all timing and protocol related to control frames
1435 * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
1436 * handle reception of block-acks; uCode updates the host driver via
1437 * REPLY_COMPRESSED_BA.
1439 * uCode handles retrying Tx when an ACK is expected but not received.
1440 * This includes trying lower data rates than the one requested in the Tx
1441 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
1442 * REPLY_TX_LINK_QUALITY_CMD (agn).
1444 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
1445 * This command must be executed after every RXON command, before Tx can occur.
1446 *****************************************************************************/
1448 /* REPLY_TX Tx flags field */
1451 * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
1452 * before this frame. if CTS-to-self required check
1453 * RXON_FLG_SELF_CTS_EN status.
1454 * unused in 3945/4965, used in 5000 series and after
1456 #define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0)
1459 * 1: Use Request-To-Send protocol before this frame.
1460 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
1461 * used in 3945/4965, unused in 5000 series and after
1463 #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
1466 * 1: Transmit Clear-To-Send to self before this frame.
1467 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
1468 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
1469 * used in 3945/4965, unused in 5000 series and after
1471 #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
1473 /* 1: Expect ACK from receiving station
1474 * 0: Don't expect ACK (MAC header's duration field s/b 0)
1475 * Set this for unicast frames, but not broadcast/multicast. */
1476 #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
1479 * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
1480 * Tx command's initial_rate_index indicates first rate to try;
1481 * uCode walks through table for additional Tx attempts.
1482 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1483 * This rate will be used for all Tx attempts; it will not be scaled. */
1484 #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
1486 /* 1: Expect immediate block-ack.
1487 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
1488 #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
1491 * 1: Frame requires full Tx-Op protection.
1492 * Set this if either RTS or CTS Tx Flag gets set.
1493 * used in 3945/4965, unused in 5000 series and after
1495 #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
1497 /* Tx antenna selection field; used only for 3945, reserved (0) for agn devices.
1498 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
1499 #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
1500 #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
1501 #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
1503 /* 1: Ignore Bluetooth priority for this frame.
1504 * 0: Delay Tx until Bluetooth device is done (normal usage). */
1505 #define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12)
1507 /* 1: uCode overrides sequence control field in MAC header.
1508 * 0: Driver provides sequence control field in MAC header.
1509 * Set this for management frames, non-QOS data frames, non-unicast frames,
1510 * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
1511 #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
1513 /* 1: This frame is non-last MPDU; more fragments are coming.
1514 * 0: Last fragment, or not using fragmentation. */
1515 #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
1517 /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1518 * 0: No TSF required in outgoing frame.
1519 * Set this for transmitting beacons and probe responses. */
1520 #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
1522 /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
1523 * alignment of frame's payload data field.
1525 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
1526 * field (but not both). Driver must align frame data (i.e. data following
1527 * MAC header) to DWORD boundary. */
1528 #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
1530 /* accelerate aggregation support
1531 * 0 - no CCMP encryption; 1 - CCMP encryption */
1532 #define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
1534 /* HCCA-AP - disable duration overwriting. */
1535 #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
1539 * TX command security control
1541 #define TX_CMD_SEC_WEP 0x01
1542 #define TX_CMD_SEC_CCM 0x02
1543 #define TX_CMD_SEC_TKIP 0x03
1544 #define TX_CMD_SEC_MSK 0x03
1545 #define TX_CMD_SEC_SHIFT 6
1546 #define TX_CMD_SEC_KEY128 0x08
1549 * security overhead sizes
1551 #define WEP_IV_LEN 4
1552 #define WEP_ICV_LEN 4
1553 #define CCMP_MIC_LEN 8
1554 #define TKIP_ICV_LEN 4
1557 * REPLY_TX = 0x1c (command)
1560 struct iwl3945_tx_cmd {
1563 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1564 * + 8 byte IV for CCM or TKIP (not used for WEP)
1566 * + 8-byte MIC (not used for CCM/WEP)
1567 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1568 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1569 * Range: 14-2342 bytes.
1574 * MPDU or MSDU byte count for next frame.
1575 * Used for fragmentation and bursting, but not 11n aggregation.
1576 * Same as "len", but for next frame. Set to 0 if not applicable.
1578 __le16 next_frame_len;
1580 __le32 tx_flags; /* TX_CMD_FLG_* */
1584 /* Index of recipient station in uCode's station table */
1594 __le32 next_frame_info;
1600 u8 rts_retry_limit; /*byte 50 */
1601 u8 data_retry_limit; /*byte 51 */
1603 __le16 pm_frame_timeout;
1604 __le16 attempt_duration;
1608 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1609 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1614 * MAC header goes here, followed by 2 bytes padding if MAC header
1615 * length is 26 or 30 bytes, followed by payload data
1618 struct ieee80211_hdr hdr[0];
1622 * REPLY_TX = 0x1c (response)
1624 struct iwl3945_tx_resp {
1629 __le32 wireless_media_time;
1630 __le32 status; /* TX status */
1635 * 4965 uCode updates these Tx attempt count values in host DRAM.
1636 * Used for managing Tx retries when expecting block-acks.
1637 * Driver should set these fields to 0.
1639 struct iwl_dram_scratch {
1640 u8 try_cnt; /* Tx attempts */
1641 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
1648 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1649 * + 8 byte IV for CCM or TKIP (not used for WEP)
1651 * + 8-byte MIC (not used for CCM/WEP)
1652 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1653 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1654 * Range: 14-2342 bytes.
1659 * MPDU or MSDU byte count for next frame.
1660 * Used for fragmentation and bursting, but not 11n aggregation.
1661 * Same as "len", but for next frame. Set to 0 if not applicable.
1663 __le16 next_frame_len;
1665 __le32 tx_flags; /* TX_CMD_FLG_* */
1667 /* uCode may modify this field of the Tx command (in host DRAM!).
1668 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
1669 struct iwl_dram_scratch scratch;
1671 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1672 __le32 rate_n_flags; /* RATE_MCS_* */
1674 /* Index of destination station in uCode's station table */
1677 /* Type of security encryption: CCM or TKIP */
1678 u8 sec_ctl; /* TX_CMD_SEC_* */
1681 * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial
1682 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
1683 * data frames, this field may be used to selectively reduce initial
1684 * rate (via non-0 value) for special frames (e.g. management), while
1685 * still supporting rate scaling for all frames.
1687 u8 initial_rate_index;
1690 __le16 next_frame_flags;
1697 /* Host DRAM physical address pointer to "scratch" in this command.
1698 * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
1699 __le32 dram_lsb_ptr;
1702 u8 rts_retry_limit; /*byte 50 */
1703 u8 data_retry_limit; /*byte 51 */
1706 __le16 pm_frame_timeout;
1707 __le16 attempt_duration;
1711 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1712 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1717 * MAC header goes here, followed by 2 bytes padding if MAC header
1718 * length is 26 or 30 bytes, followed by payload data
1721 struct ieee80211_hdr hdr[0];
1724 /* TX command response is sent after *3945* transmission attempts.
1728 * TX_STATUS_FAIL_NEXT_FRAG
1730 * If the fragment flag in the MAC header for the frame being transmitted
1731 * is set and there is insufficient time to transmit the next frame, the
1732 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
1734 * TX_STATUS_FIFO_UNDERRUN
1736 * Indicates the host did not provide bytes to the FIFO fast enough while
1737 * a TX was in progress.
1739 * TX_STATUS_FAIL_MGMNT_ABORT
1741 * This status is only possible if the ABORT ON MGMT RX parameter was
1742 * set to true with the TX command.
1744 * If the MSB of the status parameter is set then an abort sequence is
1745 * required. This sequence consists of the host activating the TX Abort
1746 * control line, and then waiting for the TX Abort command response. This
1747 * indicates that a the device is no longer in a transmit state, and that the
1748 * command FIFO has been cleared. The host must then deactivate the TX Abort
1749 * control line. Receiving is still allowed in this case.
1752 TX_3945_STATUS_SUCCESS = 0x01,
1753 TX_3945_STATUS_DIRECT_DONE = 0x02,
1754 TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
1755 TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
1756 TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1757 TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
1758 TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
1759 TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1760 TX_3945_STATUS_FAIL_DEST_PS = 0x88,
1761 TX_3945_STATUS_FAIL_ABORTED = 0x89,
1762 TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
1763 TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
1764 TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1765 TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
1766 TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
1767 TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1768 TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
1769 TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
1773 * TX command response is sent after *agn* transmission attempts.
1775 * both postpone and abort status are expected behavior from uCode. there is
1776 * no special operation required from driver; except for RFKILL_FLUSH,
1777 * which required tx flush host command to flush all the tx frames in queues
1780 TX_STATUS_SUCCESS = 0x01,
1781 TX_STATUS_DIRECT_DONE = 0x02,
1783 TX_STATUS_POSTPONE_DELAY = 0x40,
1784 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
1785 TX_STATUS_POSTPONE_BT_PRIO = 0x42,
1786 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
1787 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
1789 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
1790 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
1791 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
1792 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1793 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
1794 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
1795 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1796 TX_STATUS_FAIL_DEST_PS = 0x88,
1797 TX_STATUS_FAIL_HOST_ABORTED = 0x89,
1798 TX_STATUS_FAIL_BT_RETRY = 0x8a,
1799 TX_STATUS_FAIL_STA_INVALID = 0x8b,
1800 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1801 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
1802 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
1803 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1804 /* uCode drop due to FW drop request */
1805 TX_STATUS_FAIL_FW_DROP = 0x90,
1807 * uCode drop due to station color mismatch
1808 * between tx command and station table
1810 TX_STATUS_FAIL_STA_COLOR_MISMATCH_DROP = 0x91,
1813 #define TX_PACKET_MODE_REGULAR 0x0000
1814 #define TX_PACKET_MODE_BURST_SEQ 0x0100
1815 #define TX_PACKET_MODE_BURST_FIRST 0x0200
1818 TX_POWER_PA_NOT_ACTIVE = 0x0,
1822 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
1823 TX_STATUS_DELAY_MSK = 0x00000040,
1824 TX_STATUS_ABORT_MSK = 0x00000080,
1825 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
1826 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
1827 TX_RESERVED = 0x00780000, /* bits 19:22 */
1828 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
1829 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
1832 /* *******************************
1833 * TX aggregation status
1834 ******************************* */
1837 AGG_TX_STATE_TRANSMITTED = 0x00,
1838 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
1839 AGG_TX_STATE_BT_PRIO_MSK = 0x02,
1840 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
1841 AGG_TX_STATE_ABORT_MSK = 0x08,
1842 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
1843 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
1844 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
1845 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
1846 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
1847 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
1848 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
1849 AGG_TX_STATE_DELAY_TX_MSK = 0x400
1852 #define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
1853 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
1854 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
1856 /* # tx attempts for first frame in aggregation */
1857 #define AGG_TX_STATE_TRY_CNT_POS 12
1858 #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1860 /* Command ID and sequence number of Tx command for this frame */
1861 #define AGG_TX_STATE_SEQ_NUM_POS 16
1862 #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1865 * REPLY_TX = 0x1c (response)
1867 * This response may be in one of two slightly different formats, indicated
1868 * by the frame_count field:
1870 * 1) No aggregation (frame_count == 1). This reports Tx results for
1871 * a single frame. Multiple attempts, at various bit rates, may have
1872 * been made for this frame.
1874 * 2) Aggregation (frame_count > 1). This reports Tx results for
1875 * 2 or more frames that used block-acknowledge. All frames were
1876 * transmitted at same rate. Rate scaling may have been used if first
1877 * frame in this new agg block failed in previous agg block(s).
1879 * Note that, for aggregation, ACK (block-ack) status is not delivered here;
1880 * block-ack has not been received by the time the agn device records
1882 * This status relates to reasons the tx might have been blocked or aborted
1883 * within the sending station (this agn device), rather than whether it was
1884 * received successfully by the destination station.
1886 struct agg_tx_status {
1891 struct iwl4965_tx_resp {
1892 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1893 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1894 u8 failure_rts; /* # failures due to unsuccessful RTS */
1895 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1897 /* For non-agg: Rate at which frame was successful.
1898 * For agg: Rate at which all frames were transmitted. */
1899 __le32 rate_n_flags; /* RATE_MCS_* */
1901 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1902 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1903 __le16 wireless_media_time; /* uSecs */
1906 __le32 pa_power1; /* RF power amplifier measurement (not used) */
1910 * For non-agg: frame status TX_STATUS_*
1911 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1912 * fields follow this one, up to frame_count.
1914 * 11- 0: AGG_TX_STATE_* status code
1915 * 15-12: Retry count for 1st frame in aggregation (retries
1916 * occur if tx failed for this frame when it was a
1917 * member of a previous aggregation block). If rate
1918 * scaling is used, retry count indicates the rate
1919 * table entry used for all frames in the new agg.
1920 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1924 struct agg_tx_status agg_status[0]; /* for each agg frame */
1929 * definitions for initial rate index field
1930 * bits [3:0] initial rate index
1931 * bits [6:4] rate table color, used for the initial rate
1932 * bit-7 invalid rate indication
1933 * i.e. rate was not chosen from rate table
1934 * or rate table color was changed during frame retries
1935 * refer tlc rate info
1938 #define IWL50_TX_RES_INIT_RATE_INDEX_POS 0
1939 #define IWL50_TX_RES_INIT_RATE_INDEX_MSK 0x0f
1940 #define IWL50_TX_RES_RATE_TABLE_COLOR_POS 4
1941 #define IWL50_TX_RES_RATE_TABLE_COLOR_MSK 0x70
1942 #define IWL50_TX_RES_INV_RATE_INDEX_MSK 0x80
1944 /* refer to ra_tid */
1945 #define IWL50_TX_RES_TID_POS 0
1946 #define IWL50_TX_RES_TID_MSK 0x0f
1947 #define IWL50_TX_RES_RA_POS 4
1948 #define IWL50_TX_RES_RA_MSK 0xf0
1950 struct iwl5000_tx_resp {
1951 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1952 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1953 u8 failure_rts; /* # failures due to unsuccessful RTS */
1954 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1956 /* For non-agg: Rate at which frame was successful.
1957 * For agg: Rate at which all frames were transmitted. */
1958 __le32 rate_n_flags; /* RATE_MCS_* */
1960 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1961 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1962 __le16 wireless_media_time; /* uSecs */
1964 u8 pa_status; /* RF power amplifier measurement (not used) */
1965 u8 pa_integ_res_a[3];
1966 u8 pa_integ_res_b[3];
1967 u8 pa_integ_res_C[3];
1973 u8 ra_tid; /* tid (0:3), sta_id (4:7) */
1976 * For non-agg: frame status TX_STATUS_*
1977 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1978 * fields follow this one, up to frame_count.
1980 * 11- 0: AGG_TX_STATE_* status code
1981 * 15-12: Retry count for 1st frame in aggregation (retries
1982 * occur if tx failed for this frame when it was a
1983 * member of a previous aggregation block). If rate
1984 * scaling is used, retry count indicates the rate
1985 * table entry used for all frames in the new agg.
1986 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1988 struct agg_tx_status status; /* TX status (in aggregation -
1989 * status of 1st frame) */
1992 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
1994 * Reports Block-Acknowledge from recipient station
1996 struct iwl_compressed_ba_resp {
1997 __le32 sta_addr_lo32;
1998 __le16 sta_addr_hi16;
2001 /* Index of recipient (BA-sending) station in uCode's station table */
2011 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
2013 * See details under "TXPOWER" in iwl-4965-hw.h.
2016 struct iwl3945_txpowertable_cmd {
2017 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
2020 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
2023 struct iwl4965_txpowertable_cmd {
2024 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
2027 struct iwl4965_tx_power_db tx_power;
2032 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
2034 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
2036 * NOTE: The table of rates passed to the uCode via the
2037 * RATE_SCALE command sets up the corresponding order of
2038 * rates used for all related commands, including rate
2041 * For example, if you set 9MB (PLCP 0x0f) as the first
2042 * rate in the rate table, the bit mask for that rate
2043 * when passed through ofdm_basic_rates on the REPLY_RXON
2044 * command would be bit 0 (1 << 0)
2046 struct iwl3945_rate_scaling_info {
2047 __le16 rate_n_flags;
2052 struct iwl3945_rate_scaling_cmd {
2055 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
2059 /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
2060 #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
2062 /* # of EDCA prioritized tx fifos */
2063 #define LINK_QUAL_AC_NUM AC_NUM
2065 /* # entries in rate scale table to support Tx retries */
2066 #define LINK_QUAL_MAX_RETRY_NUM 16
2068 /* Tx antenna selection values */
2069 #define LINK_QUAL_ANT_A_MSK (1 << 0)
2070 #define LINK_QUAL_ANT_B_MSK (1 << 1)
2071 #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
2075 * struct iwl_link_qual_general_params
2077 * Used in REPLY_TX_LINK_QUALITY_CMD
2079 struct iwl_link_qual_general_params {
2082 /* No entries at or above this (driver chosen) index contain MIMO */
2085 /* Best single antenna to use for single stream (legacy, SISO). */
2086 u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */
2088 /* Best antennas to use for MIMO (unused for 4965, assumes both). */
2089 u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */
2092 * If driver needs to use different initial rates for different
2093 * EDCA QOS access categories (as implemented by tx fifos 0-3),
2094 * this table will set that up, by indicating the indexes in the
2095 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
2096 * Otherwise, driver should set all entries to 0.
2099 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
2100 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
2102 u8 start_rate_index[LINK_QUAL_AC_NUM];
2105 #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
2106 #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
2107 #define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
2109 #define LINK_QUAL_AGG_DISABLE_START_DEF (3)
2110 #define LINK_QUAL_AGG_DISABLE_START_MAX (255)
2111 #define LINK_QUAL_AGG_DISABLE_START_MIN (0)
2113 #define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
2114 #define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
2115 #define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
2118 * struct iwl_link_qual_agg_params
2120 * Used in REPLY_TX_LINK_QUALITY_CMD
2122 struct iwl_link_qual_agg_params {
2125 *Maximum number of uSec in aggregation.
2126 * default set to 4000 (4 milliseconds) if not configured in .cfg
2128 __le16 agg_time_limit;
2131 * Number of Tx retries allowed for a frame, before that frame will
2132 * no longer be considered for the start of an aggregation sequence
2133 * (scheduler will then try to tx it as single frame).
2134 * Driver should set this to 3.
2136 u8 agg_dis_start_th;
2139 * Maximum number of frames in aggregation.
2140 * 0 = no limit (default). 1 = no aggregation.
2141 * Other values = max # frames in aggregation.
2143 u8 agg_frame_cnt_limit;
2149 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
2151 * For agn devices only; 3945 uses REPLY_RATE_SCALE.
2153 * Each station in the agn device's internal station table has its own table
2155 * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
2156 * an ACK is not received. This command replaces the entire table for
2159 * NOTE: Station must already be in agn device's station table.
2160 * Use REPLY_ADD_STA.
2162 * The rate scaling procedures described below work well. Of course, other
2163 * procedures are possible, and may work better for particular environments.
2166 * FILLING THE RATE TABLE
2168 * Given a particular initial rate and mode, as determined by the rate
2169 * scaling algorithm described below, the Linux driver uses the following
2170 * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
2171 * Link Quality command:
2174 * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
2175 * a) Use this same initial rate for first 3 entries.
2176 * b) Find next lower available rate using same mode (SISO or MIMO),
2177 * use for next 3 entries. If no lower rate available, switch to
2178 * legacy mode (no HT40 channel, no MIMO, no short guard interval).
2179 * c) If using MIMO, set command's mimo_delimiter to number of entries
2180 * using MIMO (3 or 6).
2181 * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
2182 * no MIMO, no short guard interval), at the next lower bit rate
2183 * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
2184 * legacy procedure for remaining table entries.
2186 * 2) If using legacy initial rate:
2187 * a) Use the initial rate for only one entry.
2188 * b) For each following entry, reduce the rate to next lower available
2189 * rate, until reaching the lowest available rate.
2190 * c) When reducing rate, also switch antenna selection.
2191 * d) Once lowest available rate is reached, repeat this rate until
2192 * rate table is filled (16 entries), switching antenna each entry.
2195 * ACCUMULATING HISTORY
2197 * The rate scaling algorithm for agn devices, as implemented in Linux driver,
2198 * uses two sets of frame Tx success history: One for the current/active
2199 * modulation mode, and one for a speculative/search mode that is being
2200 * attempted. If the speculative mode turns out to be more effective (i.e.
2201 * actual transfer rate is better), then the driver continues to use the
2202 * speculative mode as the new current active mode.
2204 * Each history set contains, separately for each possible rate, data for a
2205 * sliding window of the 62 most recent tx attempts at that rate. The data
2206 * includes a shifting bitmap of success(1)/failure(0), and sums of successful
2207 * and attempted frames, from which the driver can additionally calculate a
2208 * success ratio (success / attempted) and number of failures
2209 * (attempted - success), and control the size of the window (attempted).
2210 * The driver uses the bit map to remove successes from the success sum, as
2211 * the oldest tx attempts fall out of the window.
2213 * When the agn device makes multiple tx attempts for a given frame, each
2214 * attempt might be at a different rate, and have different modulation
2215 * characteristics (e.g. antenna, fat channel, short guard interval), as set
2216 * up in the rate scaling table in the Link Quality command. The driver must
2217 * determine which rate table entry was used for each tx attempt, to determine
2218 * which rate-specific history to update, and record only those attempts that
2219 * match the modulation characteristics of the history set.
2221 * When using block-ack (aggregation), all frames are transmitted at the same
2222 * rate, since there is no per-attempt acknowledgment from the destination
2223 * station. The Tx response struct iwl_tx_resp indicates the Tx rate in
2224 * rate_n_flags field. After receiving a block-ack, the driver can update
2225 * history for the entire block all at once.
2228 * FINDING BEST STARTING RATE:
2230 * When working with a selected initial modulation mode (see below), the
2231 * driver attempts to find a best initial rate. The initial rate is the
2232 * first entry in the Link Quality command's rate table.
2234 * 1) Calculate actual throughput (success ratio * expected throughput, see
2235 * table below) for current initial rate. Do this only if enough frames
2236 * have been attempted to make the value meaningful: at least 6 failed
2237 * tx attempts, or at least 8 successes. If not enough, don't try rate
2240 * 2) Find available rates adjacent to current initial rate. Available means:
2241 * a) supported by hardware &&
2242 * b) supported by association &&
2243 * c) within any constraints selected by user
2245 * 3) Gather measured throughputs for adjacent rates. These might not have
2246 * enough history to calculate a throughput. That's okay, we might try
2247 * using one of them anyway!
2249 * 4) Try decreasing rate if, for current rate:
2250 * a) success ratio is < 15% ||
2251 * b) lower adjacent rate has better measured throughput ||
2252 * c) higher adjacent rate has worse throughput, and lower is unmeasured
2254 * As a sanity check, if decrease was determined above, leave rate
2256 * a) lower rate unavailable
2257 * b) success ratio at current rate > 85% (very good)
2258 * c) current measured throughput is better than expected throughput
2259 * of lower rate (under perfect 100% tx conditions, see table below)
2261 * 5) Try increasing rate if, for current rate:
2262 * a) success ratio is < 15% ||
2263 * b) both adjacent rates' throughputs are unmeasured (try it!) ||
2264 * b) higher adjacent rate has better measured throughput ||
2265 * c) lower adjacent rate has worse throughput, and higher is unmeasured
2267 * As a sanity check, if increase was determined above, leave rate
2269 * a) success ratio at current rate < 70%. This is not particularly
2270 * good performance; higher rate is sure to have poorer success.
2272 * 6) Re-evaluate the rate after each tx frame. If working with block-
2273 * acknowledge, history and statistics may be calculated for the entire
2274 * block (including prior history that fits within the history windows),
2275 * before re-evaluation.
2277 * FINDING BEST STARTING MODULATION MODE:
2279 * After working with a modulation mode for a "while" (and doing rate scaling),
2280 * the driver searches for a new initial mode in an attempt to improve
2281 * throughput. The "while" is measured by numbers of attempted frames:
2283 * For legacy mode, search for new mode after:
2284 * 480 successful frames, or 160 failed frames
2285 * For high-throughput modes (SISO or MIMO), search for new mode after:
2286 * 4500 successful frames, or 400 failed frames
2288 * Mode switch possibilities are (3 for each mode):
2291 * Change antenna, try SISO (if HT association), try MIMO (if HT association)
2293 * Change antenna, try MIMO, try shortened guard interval (SGI)
2295 * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
2297 * When trying a new mode, use the same bit rate as the old/current mode when
2298 * trying antenna switches and shortened guard interval. When switching to
2299 * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
2300 * for which the expected throughput (under perfect conditions) is about the
2301 * same or slightly better than the actual measured throughput delivered by
2302 * the old/current mode.
2304 * Actual throughput can be estimated by multiplying the expected throughput
2305 * by the success ratio (successful / attempted tx frames). Frame size is
2306 * not considered in this calculation; it assumes that frame size will average
2307 * out to be fairly consistent over several samples. The following are
2308 * metric values for expected throughput assuming 100% success ratio.
2309 * Only G band has support for CCK rates:
2311 * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
2313 * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
2314 * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
2315 * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
2316 * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
2317 * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
2318 * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
2319 * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
2320 * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
2321 * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
2322 * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
2324 * After the new mode has been tried for a short while (minimum of 6 failed
2325 * frames or 8 successful frames), compare success ratio and actual throughput
2326 * estimate of the new mode with the old. If either is better with the new
2327 * mode, continue to use the new mode.
2329 * Continue comparing modes until all 3 possibilities have been tried.
2330 * If moving from legacy to HT, try all 3 possibilities from the new HT
2331 * mode. After trying all 3, a best mode is found. Continue to use this mode
2332 * for the longer "while" described above (e.g. 480 successful frames for
2333 * legacy), and then repeat the search process.
2336 struct iwl_link_quality_cmd {
2338 /* Index of destination/recipient station in uCode's station table */
2341 __le16 control; /* not used */
2342 struct iwl_link_qual_general_params general_params;
2343 struct iwl_link_qual_agg_params agg_params;
2346 * Rate info; when using rate-scaling, Tx command's initial_rate_index
2347 * specifies 1st Tx rate attempted, via index into this table.
2348 * agn devices works its way through table when retrying Tx.
2351 __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */
2352 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
2357 * BT configuration enable flags:
2358 * bit 0 - 1: BT channel announcement enabled
2360 * bit 1 - 1: priority of BT device enabled
2362 * bit 2 - 1: BT 2 wire support enabled
2365 #define BT_COEX_DISABLE (0x0)
2366 #define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
2367 #define BT_ENABLE_PRIORITY BIT(1)
2368 #define BT_ENABLE_2_WIRE BIT(2)
2370 #define BT_COEX_DISABLE (0x0)
2371 #define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
2373 #define BT_LEAD_TIME_MIN (0x0)
2374 #define BT_LEAD_TIME_DEF (0x1E)
2375 #define BT_LEAD_TIME_MAX (0xFF)
2377 #define BT_MAX_KILL_MIN (0x1)
2378 #define BT_MAX_KILL_DEF (0x5)
2379 #define BT_MAX_KILL_MAX (0xFF)
2382 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
2384 * 3945 and agn devices support hardware handshake with Bluetooth device on
2385 * same platform. Bluetooth device alerts wireless device when it will Tx;
2386 * wireless device can delay or kill its own Tx to accommodate.
2393 __le32 kill_ack_mask;
2394 __le32 kill_cts_mask;
2397 /******************************************************************************
2399 * Spectrum Management (802.11h) Commands, Responses, Notifications:
2401 *****************************************************************************/
2404 * Spectrum Management
2406 #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
2407 RXON_FILTER_CTL2HOST_MSK | \
2408 RXON_FILTER_ACCEPT_GRP_MSK | \
2409 RXON_FILTER_DIS_DECRYPT_MSK | \
2410 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
2411 RXON_FILTER_ASSOC_MSK | \
2412 RXON_FILTER_BCON_AWARE_MSK)
2414 struct iwl_measure_channel {
2415 __le32 duration; /* measurement duration in extended beacon
2417 u8 channel; /* channel to measure */
2418 u8 type; /* see enum iwl_measure_type */
2423 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
2425 struct iwl_spectrum_cmd {
2426 __le16 len; /* number of bytes starting from token */
2427 u8 token; /* token id */
2428 u8 id; /* measurement id -- 0 or 1 */
2429 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
2430 u8 periodic; /* 1 = periodic */
2431 __le16 path_loss_timeout;
2432 __le32 start_time; /* start time in extended beacon format */
2434 __le32 flags; /* rxon flags */
2435 __le32 filter_flags; /* rxon filter flags */
2436 __le16 channel_count; /* minimum 1, maximum 10 */
2438 struct iwl_measure_channel channels[10];
2442 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
2444 struct iwl_spectrum_resp {
2446 u8 id; /* id of the prior command replaced, or 0xff */
2447 __le16 status; /* 0 - command will be handled
2448 * 1 - cannot handle (conflicts with another
2452 enum iwl_measurement_state {
2453 IWL_MEASUREMENT_START = 0,
2454 IWL_MEASUREMENT_STOP = 1,
2457 enum iwl_measurement_status {
2458 IWL_MEASUREMENT_OK = 0,
2459 IWL_MEASUREMENT_CONCURRENT = 1,
2460 IWL_MEASUREMENT_CSA_CONFLICT = 2,
2461 IWL_MEASUREMENT_TGH_CONFLICT = 3,
2463 IWL_MEASUREMENT_STOPPED = 6,
2464 IWL_MEASUREMENT_TIMEOUT = 7,
2465 IWL_MEASUREMENT_PERIODIC_FAILED = 8,
2468 #define NUM_ELEMENTS_IN_HISTOGRAM 8
2470 struct iwl_measurement_histogram {
2471 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
2472 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
2475 /* clear channel availability counters */
2476 struct iwl_measurement_cca_counters {
2481 enum iwl_measure_type {
2482 IWL_MEASURE_BASIC = (1 << 0),
2483 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
2484 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
2485 IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
2486 IWL_MEASURE_FRAME = (1 << 4),
2487 /* bits 5:6 are reserved */
2488 IWL_MEASURE_IDLE = (1 << 7),
2492 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
2494 struct iwl_spectrum_notification {
2495 u8 id; /* measurement id -- 0 or 1 */
2497 u8 channel_index; /* index in measurement channel list */
2498 u8 state; /* 0 - start, 1 - stop */
2499 __le32 start_time; /* lower 32-bits of TSF */
2500 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
2502 u8 type; /* see enum iwl_measurement_type */
2504 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
2505 * valid if applicable for measurement type requested. */
2506 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
2507 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
2508 __le32 cca_time; /* channel load time in usecs */
2509 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
2512 struct iwl_measurement_histogram histogram;
2513 __le32 stop_time; /* lower 32-bits of TSF */
2514 __le32 status; /* see iwl_measurement_status */
2517 /******************************************************************************
2519 * Power Management Commands, Responses, Notifications:
2521 *****************************************************************************/
2524 * struct iwl_powertable_cmd - Power Table Command
2525 * @flags: See below:
2527 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
2530 * bit 0 - '0' Driver not allow power management
2531 * '1' Driver allow PM (use rest of parameters)
2533 * uCode send sleep notifications:
2534 * bit 1 - '0' Don't send sleep notification
2535 * '1' send sleep notification (SEND_PM_NOTIFICATION)
2538 * bit 2 - '0' PM have to walk up every DTIM
2539 * '1' PM could sleep over DTIM till listen Interval.
2542 * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
2543 * '1' !(PCI_CFG_LINK_CTRL & 0x1)
2546 * bit 4 - '1' Put radio to sleep when receiving frame for others
2549 * bit 31/30- '00' use both mac/xtal sleeps
2550 * '01' force Mac sleep
2551 * '10' force xtal sleep
2554 * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
2555 * ucode assume sleep over DTIM is allowed and we don't need to wake up
2558 #define IWL_POWER_VEC_SIZE 5
2560 #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
2561 #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2))
2562 #define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
2563 #define IWL_POWER_FAST_PD cpu_to_le16(BIT(4))
2565 struct iwl3945_powertable_cmd {
2568 __le32 rx_data_timeout;
2569 __le32 tx_data_timeout;
2570 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
2573 struct iwl_powertable_cmd {
2575 u8 keep_alive_seconds; /* 3945 reserved */
2576 u8 debug_flags; /* 3945 reserved */
2577 __le32 rx_data_timeout;
2578 __le32 tx_data_timeout;
2579 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
2580 __le32 keep_alive_beacons;
2584 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
2585 * all devices identical.
2587 struct iwl_sleep_notification {
2596 /* Sleep states. all devices identical. */
2598 IWL_PM_NO_SLEEP = 0,
2600 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
2601 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
2603 IWL_PM_SLP_REPENT = 5,
2604 IWL_PM_WAKEUP_BY_TIMER = 6,
2605 IWL_PM_WAKEUP_BY_DRIVER = 7,
2606 IWL_PM_WAKEUP_BY_RFKILL = 8,
2608 IWL_PM_NUM_OF_MODES = 12,
2612 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
2614 #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
2615 #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
2616 #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
2617 struct iwl_card_state_cmd {
2618 __le32 status; /* CARD_STATE_CMD_* request new power state */
2622 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
2624 struct iwl_card_state_notif {
2628 #define HW_CARD_DISABLED 0x01
2629 #define SW_CARD_DISABLED 0x02
2630 #define CT_CARD_DISABLED 0x04
2631 #define RXON_CARD_DISABLED 0x10
2633 struct iwl_ct_kill_config {
2635 __le32 critical_temperature_M;
2636 __le32 critical_temperature_R;
2639 /* 1000, and 6x00 */
2640 struct iwl_ct_kill_throttling_config {
2641 __le32 critical_temperature_exit;
2643 __le32 critical_temperature_enter;
2646 /******************************************************************************
2648 * Scan Commands, Responses, Notifications:
2650 *****************************************************************************/
2652 #define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
2653 #define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
2656 * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
2658 * One for each channel in the scan list.
2659 * Each channel can independently select:
2660 * 1) SSID for directed active scans
2661 * 2) Txpower setting (for rate specified within Tx command)
2662 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
2663 * quiet_plcp_th, good_CRC_th)
2665 * To avoid uCode errors, make sure the following are true (see comments
2666 * under struct iwl_scan_cmd about max_out_time and quiet_time):
2667 * 1) If using passive_dwell (i.e. passive_dwell != 0):
2668 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
2669 * 2) quiet_time <= active_dwell
2670 * 3) If restricting off-channel time (i.e. max_out_time !=0):
2671 * passive_dwell < max_out_time
2672 * active_dwell < max_out_time
2675 /* FIXME: rename to AP1, remove tpc */
2676 struct iwl3945_scan_channel {
2678 * type is defined as:
2679 * 0:0 1 = active, 0 = passive
2680 * 1:4 SSID direct bit map; if a bit is set, then corresponding
2681 * SSID IE is transmitted in probe request.
2685 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
2686 struct iwl3945_tx_power tpc;
2687 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2688 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2691 /* set number of direct probes u8 type */
2692 #define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
2694 struct iwl_scan_channel {
2696 * type is defined as:
2697 * 0:0 1 = active, 0 = passive
2698 * 1:20 SSID direct bit map; if a bit is set, then corresponding
2699 * SSID IE is transmitted in probe request.
2703 __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */
2704 u8 tx_gain; /* gain for analog radio */
2705 u8 dsp_atten; /* gain for DSP */
2706 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2707 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2710 /* set number of direct probes __le32 type */
2711 #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
2714 * struct iwl_ssid_ie - directed scan network information element
2716 * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in
2717 * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel;
2718 * each channel may select different ssids from among the 20 (4) entries.
2719 * SSID IEs get transmitted in reverse order of entry.
2721 struct iwl_ssid_ie {
2727 #define PROBE_OPTION_MAX_3945 4
2728 #define PROBE_OPTION_MAX 20
2729 #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
2730 #define IWL_GOOD_CRC_TH_DISABLED 0
2731 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2732 #define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2733 #define IWL_MAX_SCAN_SIZE 1024
2734 #define IWL_MAX_CMD_SIZE 4096
2737 * REPLY_SCAN_CMD = 0x80 (command)
2739 * The hardware scan command is very powerful; the driver can set it up to
2740 * maintain (relatively) normal network traffic while doing a scan in the
2741 * background. The max_out_time and suspend_time control the ratio of how
2742 * long the device stays on an associated network channel ("service channel")
2743 * vs. how long it's away from the service channel, i.e. tuned to other channels
2746 * max_out_time is the max time off-channel (in usec), and suspend_time
2747 * is how long (in "extended beacon" format) that the scan is "suspended"
2748 * after returning to the service channel. That is, suspend_time is the
2749 * time that we stay on the service channel, doing normal work, between
2750 * scan segments. The driver may set these parameters differently to support
2751 * scanning when associated vs. not associated, and light vs. heavy traffic
2752 * loads when associated.
2754 * After receiving this command, the device's scan engine does the following;
2756 * 1) Sends SCAN_START notification to driver
2757 * 2) Checks to see if it has time to do scan for one channel
2758 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
2759 * to tell AP that we're going off-channel
2760 * 4) Tunes to first channel in scan list, does active or passive scan
2761 * 5) Sends SCAN_RESULT notification to driver
2762 * 6) Checks to see if it has time to do scan on *next* channel in list
2763 * 7) Repeats 4-6 until it no longer has time to scan the next channel
2764 * before max_out_time expires
2765 * 8) Returns to service channel
2766 * 9) Sends NULL packet with PS=0 to tell AP that we're back
2767 * 10) Stays on service channel until suspend_time expires
2768 * 11) Repeats entire process 2-10 until list is complete
2769 * 12) Sends SCAN_COMPLETE notification
2771 * For fast, efficient scans, the scan command also has support for staying on
2772 * a channel for just a short time, if doing active scanning and getting no
2773 * responses to the transmitted probe request. This time is controlled by
2774 * quiet_time, and the number of received packets below which a channel is
2775 * considered "quiet" is controlled by quiet_plcp_threshold.
2777 * For active scanning on channels that have regulatory restrictions against
2778 * blindly transmitting, the scan can listen before transmitting, to make sure
2779 * that there is already legitimate activity on the channel. If enough
2780 * packets are cleanly received on the channel (controlled by good_CRC_th,
2781 * typical value 1), the scan engine starts transmitting probe requests.
2783 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
2785 * To avoid uCode errors, see timing restrictions described under
2786 * struct iwl_scan_channel.
2789 struct iwl3945_scan_cmd {
2792 u8 channel_count; /* # channels in channel list */
2793 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2794 * (only for active scan) */
2795 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2796 __le16 good_CRC_th; /* passive -> active promotion threshold */
2798 __le32 max_out_time; /* max usec to be away from associated (service)
2800 __le32 suspend_time; /* pause scan this long (in "extended beacon
2801 * format") when returning to service channel:
2802 * 3945; 31:24 # beacons, 19:0 additional usec,
2803 * 4965; 31:22 # beacons, 21:0 additional usec.
2805 __le32 flags; /* RXON_FLG_* */
2806 __le32 filter_flags; /* RXON_FILTER_* */
2808 /* For active scans (set to all-0s for passive scans).
2809 * Does not include payload. Must specify Tx rate; no rate scaling. */
2810 struct iwl3945_tx_cmd tx_cmd;
2812 /* For directed active scans (set to all-0s otherwise) */
2813 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
2816 * Probe request frame, followed by channel list.
2818 * Size of probe request frame is specified by byte count in tx_cmd.
2819 * Channel list follows immediately after probe request frame.
2820 * Number of channels in list is specified by channel_count.
2821 * Each channel in list is of type:
2823 * struct iwl3945_scan_channel channels[0];
2825 * NOTE: Only one band of channels can be scanned per pass. You
2826 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2827 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2828 * before requesting another scan.
2833 struct iwl_scan_cmd {
2836 u8 channel_count; /* # channels in channel list */
2837 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2838 * (only for active scan) */
2839 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2840 __le16 good_CRC_th; /* passive -> active promotion threshold */
2841 __le16 rx_chain; /* RXON_RX_CHAIN_* */
2842 __le32 max_out_time; /* max usec to be away from associated (service)
2844 __le32 suspend_time; /* pause scan this long (in "extended beacon
2845 * format") when returning to service chnl:
2846 * 3945; 31:24 # beacons, 19:0 additional usec,
2847 * 4965; 31:22 # beacons, 21:0 additional usec.
2849 __le32 flags; /* RXON_FLG_* */
2850 __le32 filter_flags; /* RXON_FILTER_* */
2852 /* For active scans (set to all-0s for passive scans).
2853 * Does not include payload. Must specify Tx rate; no rate scaling. */
2854 struct iwl_tx_cmd tx_cmd;
2856 /* For directed active scans (set to all-0s otherwise) */
2857 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
2860 * Probe request frame, followed by channel list.
2862 * Size of probe request frame is specified by byte count in tx_cmd.
2863 * Channel list follows immediately after probe request frame.
2864 * Number of channels in list is specified by channel_count.
2865 * Each channel in list is of type:
2867 * struct iwl_scan_channel channels[0];
2869 * NOTE: Only one band of channels can be scanned per pass. You
2870 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2871 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2872 * before requesting another scan.
2877 /* Can abort will notify by complete notification with abort status. */
2878 #define CAN_ABORT_STATUS cpu_to_le32(0x1)
2879 /* complete notification statuses */
2880 #define ABORT_STATUS 0x2
2883 * REPLY_SCAN_CMD = 0x80 (response)
2885 struct iwl_scanreq_notification {
2886 __le32 status; /* 1: okay, 2: cannot fulfill request */
2890 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
2892 struct iwl_scanstart_notification {
2895 __le32 beacon_timer;
2902 #define SCAN_OWNER_STATUS 0x1;
2903 #define MEASURE_OWNER_STATUS 0x2;
2905 #define IWL_PROBE_STATUS_OK 0
2906 #define IWL_PROBE_STATUS_TX_FAILED BIT(0)
2907 /* error statuses combined with TX_FAILED */
2908 #define IWL_PROBE_STATUS_FAIL_TTL BIT(1)
2909 #define IWL_PROBE_STATUS_FAIL_BT BIT(2)
2911 #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
2913 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
2915 struct iwl_scanresults_notification {
2919 u8 num_probe_not_sent; /* not enough time to send */
2922 __le32 statistics[NUMBER_OF_STATISTICS];
2926 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
2928 struct iwl_scancomplete_notification {
2929 u8 scanned_channels;
2938 /******************************************************************************
2940 * IBSS/AP Commands and Notifications:
2942 *****************************************************************************/
2944 enum iwl_ibss_manager {
2945 IWL_NOT_IBSS_MANAGER = 0,
2946 IWL_IBSS_MANAGER = 1,
2950 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
2953 struct iwl3945_beacon_notif {
2954 struct iwl3945_tx_resp beacon_notify_hdr;
2957 __le32 ibss_mgr_status;
2960 struct iwl4965_beacon_notif {
2961 struct iwl4965_tx_resp beacon_notify_hdr;
2964 __le32 ibss_mgr_status;
2968 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
2971 struct iwl3945_tx_beacon_cmd {
2972 struct iwl3945_tx_cmd tx;
2976 struct ieee80211_hdr frame[0]; /* beacon frame */
2979 struct iwl_tx_beacon_cmd {
2980 struct iwl_tx_cmd tx;
2984 struct ieee80211_hdr frame[0]; /* beacon frame */
2987 /******************************************************************************
2989 * Statistics Commands and Notifications:
2991 *****************************************************************************/
2993 #define IWL_TEMP_CONVERT 260
2995 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
2996 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
2997 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
2999 /* Used for passing to driver number of successes and failures per rate */
3000 struct rate_histogram {
3002 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
3003 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
3004 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
3007 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
3008 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
3009 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
3013 /* statistics command response */
3015 struct iwl39_statistics_rx_phy {
3021 __le32 early_overrun_err;
3023 __le32 false_alarm_cnt;
3024 __le32 fina_sync_err_cnt;
3026 __le32 fina_timeout;
3027 __le32 unresponded_rts;
3028 __le32 rxe_frame_limit_overrun;
3029 __le32 sent_ack_cnt;
3030 __le32 sent_cts_cnt;
3033 struct iwl39_statistics_rx_non_phy {
3034 __le32 bogus_cts; /* CTS received when not expecting CTS */
3035 __le32 bogus_ack; /* ACK received when not expecting ACK */
3036 __le32 non_bssid_frames; /* number of frames with BSSID that
3037 * doesn't belong to the STA BSSID */
3038 __le32 filtered_frames; /* count frames that were dumped in the
3039 * filtering process */
3040 __le32 non_channel_beacons; /* beacons with our bss id but not on
3041 * our serving channel */
3044 struct iwl39_statistics_rx {
3045 struct iwl39_statistics_rx_phy ofdm;
3046 struct iwl39_statistics_rx_phy cck;
3047 struct iwl39_statistics_rx_non_phy general;
3050 struct iwl39_statistics_tx {
3051 __le32 preamble_cnt;
3052 __le32 rx_detected_cnt;
3053 __le32 bt_prio_defer_cnt;
3054 __le32 bt_prio_kill_cnt;
3055 __le32 few_bytes_cnt;
3058 __le32 expected_ack_cnt;
3059 __le32 actual_ack_cnt;
3062 struct statistics_dbg {
3065 __le32 wait_for_silence_timeout_cnt;
3069 struct iwl39_statistics_div {
3076 struct iwl39_statistics_general {
3078 struct statistics_dbg dbg;
3082 __le32 ttl_timestamp;
3083 struct iwl39_statistics_div div;
3086 struct statistics_rx_phy {
3092 __le32 early_overrun_err;
3094 __le32 false_alarm_cnt;
3095 __le32 fina_sync_err_cnt;
3097 __le32 fina_timeout;
3098 __le32 unresponded_rts;
3099 __le32 rxe_frame_limit_overrun;
3100 __le32 sent_ack_cnt;
3101 __le32 sent_cts_cnt;
3102 __le32 sent_ba_rsp_cnt;
3103 __le32 dsp_self_kill;
3104 __le32 mh_format_err;
3105 __le32 re_acq_main_rssi_sum;
3109 struct statistics_rx_ht_phy {
3112 __le32 early_overrun_err;
3115 __le32 mh_format_err;
3116 __le32 agg_crc32_good;
3117 __le32 agg_mpdu_cnt;
3119 __le32 unsupport_mcs;
3122 #define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
3124 struct statistics_rx_non_phy {
3125 __le32 bogus_cts; /* CTS received when not expecting CTS */
3126 __le32 bogus_ack; /* ACK received when not expecting ACK */
3127 __le32 non_bssid_frames; /* number of frames with BSSID that
3128 * doesn't belong to the STA BSSID */
3129 __le32 filtered_frames; /* count frames that were dumped in the
3130 * filtering process */
3131 __le32 non_channel_beacons; /* beacons with our bss id but not on
3132 * our serving channel */
3133 __le32 channel_beacons; /* beacons with our bss id and in our
3134 * serving channel */
3135 __le32 num_missed_bcon; /* number of missed beacons */
3136 __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
3137 * ADC was in saturation */
3138 __le32 ina_detection_search_time;/* total time (in 0.8us) searched
3140 __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
3141 __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
3142 __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
3143 __le32 interference_data_flag; /* flag for interference data
3144 * availability. 1 when data is
3146 __le32 channel_load; /* counts RX Enable time in uSec */
3147 __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
3148 * and CCK) counter */
3149 __le32 beacon_rssi_a;
3150 __le32 beacon_rssi_b;
3151 __le32 beacon_rssi_c;
3152 __le32 beacon_energy_a;
3153 __le32 beacon_energy_b;
3154 __le32 beacon_energy_c;
3157 struct statistics_rx_non_phy_bt {
3158 struct statistics_rx_non_phy common;
3159 /* additional stats for bt */
3160 __le32 num_bt_kills;
3164 struct statistics_rx {
3165 struct statistics_rx_phy ofdm;
3166 struct statistics_rx_phy cck;
3167 struct statistics_rx_non_phy general;
3168 struct statistics_rx_ht_phy ofdm_ht;
3171 struct statistics_rx_bt {
3172 struct statistics_rx_phy ofdm;
3173 struct statistics_rx_phy cck;
3174 struct statistics_rx_non_phy_bt general;
3175 struct statistics_rx_ht_phy ofdm_ht;
3179 * struct statistics_tx_power - current tx power
3181 * @ant_a: current tx power on chain a in 1/2 dB step
3182 * @ant_b: current tx power on chain b in 1/2 dB step
3183 * @ant_c: current tx power on chain c in 1/2 dB step
3185 struct statistics_tx_power {
3192 struct statistics_tx_non_phy_agg {
3194 __le32 ba_reschedule_frames;
3195 __le32 scd_query_agg_frame_cnt;
3196 __le32 scd_query_no_agg;
3197 __le32 scd_query_agg;
3198 __le32 scd_query_mismatch;
3199 __le32 frame_not_ready;
3201 __le32 bt_prio_kill;
3202 __le32 rx_ba_rsp_cnt;
3205 struct statistics_tx {
3206 __le32 preamble_cnt;
3207 __le32 rx_detected_cnt;
3208 __le32 bt_prio_defer_cnt;
3209 __le32 bt_prio_kill_cnt;
3210 __le32 few_bytes_cnt;
3213 __le32 expected_ack_cnt;
3214 __le32 actual_ack_cnt;
3215 __le32 dump_msdu_cnt;
3216 __le32 burst_abort_next_frame_mismatch_cnt;
3217 __le32 burst_abort_missing_next_frame_cnt;
3218 __le32 cts_timeout_collision;
3219 __le32 ack_or_ba_timeout_collision;
3220 struct statistics_tx_non_phy_agg agg;
3222 * "tx_power" are optional parameters provided by uCode,
3223 * 6000 series is the only device provide the information,
3224 * Those are reserved fields for all the other devices
3226 struct statistics_tx_power tx_power;
3231 struct statistics_div {
3240 struct statistics_general_common {
3241 __le32 temperature; /* radio temperature */
3242 __le32 temperature_m; /* for 5000 and up, this is radio voltage */
3243 struct statistics_dbg dbg;
3247 __le32 ttl_timestamp;
3248 struct statistics_div div;
3249 __le32 rx_enable_counter;
3251 * num_of_sos_states:
3252 * count the number of times we have to re-tune
3253 * in order to get out of bad PHY status
3255 __le32 num_of_sos_states;
3258 struct statistics_bt_activity {
3260 __le32 hi_priority_tx_req_cnt;
3261 __le32 hi_priority_tx_denied_cnt;
3262 __le32 lo_priority_tx_req_cnt;
3263 __le32 lo_priority_tx_denied_cnt;
3265 __le32 hi_priority_rx_req_cnt;
3266 __le32 hi_priority_rx_denied_cnt;
3267 __le32 lo_priority_rx_req_cnt;
3268 __le32 lo_priority_rx_denied_cnt;
3271 struct statistics_general {
3272 struct statistics_general_common common;
3277 struct statistics_general_bt {
3278 struct statistics_general_common common;
3279 struct statistics_bt_activity activity;
3284 #define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0)
3285 #define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1)
3286 #define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2)
3289 * REPLY_STATISTICS_CMD = 0x9c,
3290 * all devices identical.
3292 * This command triggers an immediate response containing uCode statistics.
3293 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
3295 * If the CLEAR_STATS configuration flag is set, uCode will clear its
3296 * internal copy of the statistics (counters) after issuing the response.
3297 * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
3299 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
3300 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
3301 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
3303 #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
3304 #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
3305 struct iwl_statistics_cmd {
3306 __le32 configuration_flags; /* IWL_STATS_CONF_* */
3310 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
3312 * By default, uCode issues this notification after receiving a beacon
3313 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
3314 * REPLY_STATISTICS_CMD 0x9c, above.
3316 * Statistics counters continue to increment beacon after beacon, but are
3317 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
3318 * 0x9c with CLEAR_STATS bit set (see above).
3320 * uCode also issues this notification during scans. uCode clears statistics
3321 * appropriately so that each notification contains statistics for only the
3322 * one channel that has just been scanned.
3324 #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
3325 #define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
3327 struct iwl3945_notif_statistics {
3329 struct iwl39_statistics_rx rx;
3330 struct iwl39_statistics_tx tx;
3331 struct iwl39_statistics_general general;
3334 struct iwl_notif_statistics {
3336 struct statistics_rx rx;
3337 struct statistics_tx tx;
3338 struct statistics_general general;
3341 struct iwl_bt_notif_statistics {
3343 struct statistics_rx_bt rx;
3344 struct statistics_tx tx;
3345 struct statistics_general_bt general;
3349 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
3351 * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed
3352 * in regardless of how many missed beacons, which mean when driver receive the
3353 * notification, inside the command, it can find all the beacons information
3354 * which include number of total missed beacons, number of consecutive missed
3355 * beacons, number of beacons received and number of beacons expected to
3358 * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3359 * in order to bring the radio/PHY back to working state; which has no relation
3360 * to when driver will perform sensitivity calibration.
3362 * Driver should set it own missed_beacon_threshold to decide when to perform
3363 * sensitivity calibration based on number of consecutive missed beacons in
3364 * order to improve overall performance, especially in noisy environment.
3368 #define IWL_MISSED_BEACON_THRESHOLD_MIN (1)
3369 #define IWL_MISSED_BEACON_THRESHOLD_DEF (5)
3370 #define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF
3372 struct iwl_missed_beacon_notif {
3373 __le32 consecutive_missed_beacons;
3374 __le32 total_missed_becons;
3375 __le32 num_expected_beacons;
3376 __le32 num_recvd_beacons;
3380 /******************************************************************************
3382 * Rx Calibration Commands:
3384 * With the uCode used for open source drivers, most Tx calibration (except
3385 * for Tx Power) and most Rx calibration is done by uCode during the
3386 * "initialize" phase of uCode boot. Driver must calibrate only:
3388 * 1) Tx power (depends on temperature), described elsewhere
3389 * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
3390 * 3) Receiver sensitivity (to optimize signal detection)
3392 *****************************************************************************/
3395 * SENSITIVITY_CMD = 0xa8 (command, has simple generic response)
3397 * This command sets up the Rx signal detector for a sensitivity level that
3398 * is high enough to lock onto all signals within the associated network,
3399 * but low enough to ignore signals that are below a certain threshold, so as
3400 * not to have too many "false alarms". False alarms are signals that the
3401 * Rx DSP tries to lock onto, but then discards after determining that they
3404 * The optimum number of false alarms is between 5 and 50 per 200 TUs
3405 * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
3406 * time listening, not transmitting). Driver must adjust sensitivity so that
3407 * the ratio of actual false alarms to actual Rx time falls within this range.
3409 * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each
3410 * received beacon. These provide information to the driver to analyze the
3411 * sensitivity. Don't analyze statistics that come in from scanning, or any
3412 * other non-associated-network source. Pertinent statistics include:
3414 * From "general" statistics (struct statistics_rx_non_phy):
3416 * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
3417 * Measure of energy of desired signal. Used for establishing a level
3418 * below which the device does not detect signals.
3420 * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
3421 * Measure of background noise in silent period after beacon.
3424 * uSecs of actual Rx time during beacon period (varies according to
3425 * how much time was spent transmitting).
3427 * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately:
3430 * Signal locks abandoned early (before phy-level header).
3433 * Signal locks abandoned late (during phy-level header).
3435 * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
3436 * beacon to beacon, i.e. each value is an accumulation of all errors
3437 * before and including the latest beacon. Values will wrap around to 0
3438 * after counting up to 2^32 - 1. Driver must differentiate vs.
3439 * previous beacon's values to determine # false alarms in the current
3442 * Total number of false alarms = false_alarms + plcp_errs
3444 * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd
3445 * (notice that the start points for OFDM are at or close to settings for
3446 * maximum sensitivity):
3449 * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120
3450 * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210
3451 * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140
3452 * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270
3454 * If actual rate of OFDM false alarms (+ plcp_errors) is too high
3455 * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
3456 * by *adding* 1 to all 4 of the table entries above, up to the max for
3457 * each entry. Conversely, if false alarm rate is too low (less than 5
3458 * for each 204.8 msecs listening), *subtract* 1 from each entry to
3459 * increase sensitivity.
3461 * For CCK sensitivity, keep track of the following:
3463 * 1). 20-beacon history of maximum background noise, indicated by
3464 * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
3465 * 3 receivers. For any given beacon, the "silence reference" is
3466 * the maximum of last 60 samples (20 beacons * 3 receivers).
3468 * 2). 10-beacon history of strongest signal level, as indicated
3469 * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
3470 * i.e. the strength of the signal through the best receiver at the
3471 * moment. These measurements are "upside down", with lower values
3472 * for stronger signals, so max energy will be *minimum* value.
3474 * Then for any given beacon, the driver must determine the *weakest*
3475 * of the strongest signals; this is the minimum level that needs to be
3476 * successfully detected, when using the best receiver at the moment.
3477 * "Max cck energy" is the maximum (higher value means lower energy!)
3478 * of the last 10 minima. Once this is determined, driver must add
3479 * a little margin by adding "6" to it.
3481 * 3). Number of consecutive beacon periods with too few false alarms.
3482 * Reset this to 0 at the first beacon period that falls within the
3483 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3485 * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd
3486 * (notice that the start points for CCK are at maximum sensitivity):
3489 * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200
3490 * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400
3491 * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100
3493 * If actual rate of CCK false alarms (+ plcp_errors) is too high
3494 * (greater than 50 for each 204.8 msecs listening), method for reducing
3497 * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3500 * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160,
3501 * sensitivity has been reduced a significant amount; bring it up to
3502 * a moderate 161. Otherwise, *add* 3, up to max 200.
3504 * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160,
3505 * sensitivity has been reduced only a moderate or small amount;
3506 * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX,
3507 * down to min 0. Otherwise (if gain has been significantly reduced),
3508 * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value.
3510 * b) Save a snapshot of the "silence reference".
3512 * If actual rate of CCK false alarms (+ plcp_errors) is too low
3513 * (less than 5 for each 204.8 msecs listening), method for increasing
3514 * sensitivity is used only if:
3516 * 1a) Previous beacon did not have too many false alarms
3517 * 1b) AND difference between previous "silence reference" and current
3518 * "silence reference" (prev - current) is 2 or more,
3519 * OR 2) 100 or more consecutive beacon periods have had rate of
3520 * less than 5 false alarms per 204.8 milliseconds rx time.
3522 * Method for increasing sensitivity:
3524 * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX,
3527 * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3530 * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100.
3532 * If actual rate of CCK false alarms (+ plcp_errors) is within good range
3533 * (between 5 and 50 for each 204.8 msecs listening):
3535 * 1) Save a snapshot of the silence reference.
3537 * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
3538 * give some extra margin to energy threshold by *subtracting* 8
3539 * from value in HD_MIN_ENERGY_CCK_DET_INDEX.
3541 * For all cases (too few, too many, good range), make sure that the CCK
3542 * detection threshold (energy) is below the energy level for robust
3543 * detection over the past 10 beacon periods, the "Max cck energy".
3544 * Lower values mean higher energy; this means making sure that the value
3545 * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
3550 * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd)
3552 #define HD_TABLE_SIZE (11) /* number of entries */
3553 #define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */
3554 #define HD_MIN_ENERGY_OFDM_DET_INDEX (1)
3555 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2)
3556 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3)
3557 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4)
3558 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5)
3559 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6)
3560 #define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7)
3561 #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8)
3562 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)
3563 #define HD_OFDM_ENERGY_TH_IN_INDEX (10)
3566 * Additional table entries in enhance SENSITIVITY_CMD
3568 #define HD_INA_NON_SQUARE_DET_OFDM_INDEX (11)
3569 #define HD_INA_NON_SQUARE_DET_CCK_INDEX (12)
3570 #define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX (13)
3571 #define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX (14)
3572 #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (15)
3573 #define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX (16)
3574 #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX (17)
3575 #define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX (18)
3576 #define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (19)
3577 #define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX (20)
3578 #define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX (21)
3579 #define HD_RESERVED (22)
3581 /* number of entries for enhanced tbl */
3582 #define ENHANCE_HD_TABLE_SIZE (23)
3584 /* number of additional entries for enhanced tbl */
3585 #define ENHANCE_HD_TABLE_ENTRIES (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE)
3587 #define HD_INA_NON_SQUARE_DET_OFDM_DATA cpu_to_le16(0)
3588 #define HD_INA_NON_SQUARE_DET_CCK_DATA cpu_to_le16(0)
3589 #define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA cpu_to_le16(0)
3590 #define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA cpu_to_le16(668)
3591 #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA cpu_to_le16(4)
3592 #define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA cpu_to_le16(486)
3593 #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA cpu_to_le16(37)
3594 #define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA cpu_to_le16(853)
3595 #define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA cpu_to_le16(4)
3596 #define HD_CCK_NON_SQUARE_DET_SLOPE_DATA cpu_to_le16(476)
3597 #define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA cpu_to_le16(99)
3600 /* Control field in struct iwl_sensitivity_cmd */
3601 #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0)
3602 #define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1)
3605 * struct iwl_sensitivity_cmd
3606 * @control: (1) updates working table, (0) updates default table
3607 * @table: energy threshold values, use HD_* as index into table
3609 * Always use "1" in "control" to update uCode's working table and DSP.
3611 struct iwl_sensitivity_cmd {
3612 __le16 control; /* always use "1" */
3613 __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */
3619 struct iwl_enhance_sensitivity_cmd {
3620 __le16 control; /* always use "1" */
3621 __le16 enhance_table[ENHANCE_HD_TABLE_SIZE]; /* use HD_* as index */
3626 * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response)
3628 * This command sets the relative gains of agn device's 3 radio receiver chains.
3630 * After the first association, driver should accumulate signal and noise
3631 * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20
3632 * beacons from the associated network (don't collect statistics that come
3633 * in from scanning, or any other non-network source).
3635 * DISCONNECTED ANTENNA:
3637 * Driver should determine which antennas are actually connected, by comparing
3638 * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
3639 * following values over 20 beacons, one accumulator for each of the chains
3640 * a/b/c, from struct statistics_rx_non_phy:
3642 * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
3644 * Find the strongest signal from among a/b/c. Compare the other two to the
3645 * strongest. If any signal is more than 15 dB (times 20, unless you
3646 * divide the accumulated values by 20) below the strongest, the driver
3647 * considers that antenna to be disconnected, and should not try to use that
3648 * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
3649 * driver should declare the stronger one as connected, and attempt to use it
3650 * (A and B are the only 2 Tx chains!).
3655 * Driver should balance the 3 receivers (but just the ones that are connected
3656 * to antennas, see above) for gain, by comparing the average signal levels
3657 * detected during the silence after each beacon (background noise).
3658 * Accumulate (add) the following values over 20 beacons, one accumulator for
3659 * each of the chains a/b/c, from struct statistics_rx_non_phy:
3661 * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
3663 * Find the weakest background noise level from among a/b/c. This Rx chain
3664 * will be the reference, with 0 gain adjustment. Attenuate other channels by
3665 * finding noise difference:
3667 * (accum_noise[i] - accum_noise[reference]) / 30
3669 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
3670 * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the
3671 * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3672 * and set bit 2 to indicate "reduce gain". The value for the reference
3673 * (weakest) chain should be "0".
3675 * diff_gain_[abc] bit fields:
3676 * 2: (1) reduce gain, (0) increase gain
3677 * 1-0: amount of gain, units of 1.5 dB
3680 /* Phy calibration command for series */
3683 IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
3684 IWL_PHY_CALIBRATE_DC_CMD = 8,
3685 IWL_PHY_CALIBRATE_LO_CMD = 9,
3686 IWL_PHY_CALIBRATE_TX_IQ_CMD = 11,
3687 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15,
3688 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16,
3689 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
3690 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 18,
3693 #define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
3695 #define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff)
3697 struct iwl_calib_cfg_elmnt_s {
3705 struct iwl_calib_cfg_status_s {
3706 struct iwl_calib_cfg_elmnt_s once;
3707 struct iwl_calib_cfg_elmnt_s perd;
3711 struct iwl_calib_cfg_cmd {
3712 struct iwl_calib_cfg_status_s ucd_calib_cfg;
3713 struct iwl_calib_cfg_status_s drv_calib_cfg;
3717 struct iwl_calib_hdr {
3724 struct iwl_calib_cmd {
3725 struct iwl_calib_hdr hdr;
3729 /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
3730 struct iwl_calib_diff_gain_cmd {
3731 struct iwl_calib_hdr hdr;
3732 s8 diff_gain_a; /* see above */
3738 struct iwl_calib_xtal_freq_cmd {
3739 struct iwl_calib_hdr hdr;
3745 /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
3746 struct iwl_calib_chain_noise_reset_cmd {
3747 struct iwl_calib_hdr hdr;
3751 /* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */
3752 struct iwl_calib_chain_noise_gain_cmd {
3753 struct iwl_calib_hdr hdr;
3759 /******************************************************************************
3761 * Miscellaneous Commands:
3763 *****************************************************************************/
3766 * LEDs Command & Response
3767 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
3769 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3770 * this command turns it on or off, or sets up a periodic blinking cycle.
3772 struct iwl_led_cmd {
3773 __le32 interval; /* "interval" in uSec */
3774 u8 id; /* 1: Activity, 2: Link, 3: Tech */
3775 u8 off; /* # intervals off while blinking;
3776 * "0", with >0 "on" value, turns LED on */
3777 u8 on; /* # intervals on while blinking;
3778 * "0", regardless of "off", turns LED off */
3783 * station priority table entries
3784 * also used as potential "events" value for both
3785 * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD
3789 * COEX events entry flag masks
3790 * RP - Requested Priority
3791 * WP - Win Medium Priority: priority assigned when the contention has been won
3793 #define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG (0x1)
3794 #define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG (0x2)
3795 #define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG (0x4)
3797 #define COEX_CU_UNASSOC_IDLE_RP 4
3798 #define COEX_CU_UNASSOC_MANUAL_SCAN_RP 4
3799 #define COEX_CU_UNASSOC_AUTO_SCAN_RP 4
3800 #define COEX_CU_CALIBRATION_RP 4
3801 #define COEX_CU_PERIODIC_CALIBRATION_RP 4
3802 #define COEX_CU_CONNECTION_ESTAB_RP 4
3803 #define COEX_CU_ASSOCIATED_IDLE_RP 4
3804 #define COEX_CU_ASSOC_MANUAL_SCAN_RP 4
3805 #define COEX_CU_ASSOC_AUTO_SCAN_RP 4
3806 #define COEX_CU_ASSOC_ACTIVE_LEVEL_RP 4
3807 #define COEX_CU_RF_ON_RP 6
3808 #define COEX_CU_RF_OFF_RP 4
3809 #define COEX_CU_STAND_ALONE_DEBUG_RP 6
3810 #define COEX_CU_IPAN_ASSOC_LEVEL_RP 4
3811 #define COEX_CU_RSRVD1_RP 4
3812 #define COEX_CU_RSRVD2_RP 4
3814 #define COEX_CU_UNASSOC_IDLE_WP 3
3815 #define COEX_CU_UNASSOC_MANUAL_SCAN_WP 3
3816 #define COEX_CU_UNASSOC_AUTO_SCAN_WP 3
3817 #define COEX_CU_CALIBRATION_WP 3
3818 #define COEX_CU_PERIODIC_CALIBRATION_WP 3
3819 #define COEX_CU_CONNECTION_ESTAB_WP 3
3820 #define COEX_CU_ASSOCIATED_IDLE_WP 3
3821 #define COEX_CU_ASSOC_MANUAL_SCAN_WP 3
3822 #define COEX_CU_ASSOC_AUTO_SCAN_WP 3
3823 #define COEX_CU_ASSOC_ACTIVE_LEVEL_WP 3
3824 #define COEX_CU_RF_ON_WP 3
3825 #define COEX_CU_RF_OFF_WP 3
3826 #define COEX_CU_STAND_ALONE_DEBUG_WP 6
3827 #define COEX_CU_IPAN_ASSOC_LEVEL_WP 3
3828 #define COEX_CU_RSRVD1_WP 3
3829 #define COEX_CU_RSRVD2_WP 3
3831 #define COEX_UNASSOC_IDLE_FLAGS 0
3832 #define COEX_UNASSOC_MANUAL_SCAN_FLAGS \
3833 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3834 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3835 #define COEX_UNASSOC_AUTO_SCAN_FLAGS \
3836 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3837 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3838 #define COEX_CALIBRATION_FLAGS \
3839 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3840 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3841 #define COEX_PERIODIC_CALIBRATION_FLAGS 0
3843 * COEX_CONNECTION_ESTAB:
3844 * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
3846 #define COEX_CONNECTION_ESTAB_FLAGS \
3847 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3848 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \
3849 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
3850 #define COEX_ASSOCIATED_IDLE_FLAGS 0
3851 #define COEX_ASSOC_MANUAL_SCAN_FLAGS \
3852 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3853 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3854 #define COEX_ASSOC_AUTO_SCAN_FLAGS \
3855 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3856 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3857 #define COEX_ASSOC_ACTIVE_LEVEL_FLAGS 0
3858 #define COEX_RF_ON_FLAGS 0
3859 #define COEX_RF_OFF_FLAGS 0
3860 #define COEX_STAND_ALONE_DEBUG_FLAGS \
3861 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3862 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3863 #define COEX_IPAN_ASSOC_LEVEL_FLAGS \
3864 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3865 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \
3866 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
3867 #define COEX_RSRVD1_FLAGS 0
3868 #define COEX_RSRVD2_FLAGS 0
3870 * COEX_CU_RF_ON is the event wrapping all radio ownership.
3871 * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
3873 #define COEX_CU_RF_ON_FLAGS \
3874 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3875 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \
3876 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
3880 /* un-association part */
3881 COEX_UNASSOC_IDLE = 0,
3882 COEX_UNASSOC_MANUAL_SCAN = 1,
3883 COEX_UNASSOC_AUTO_SCAN = 2,
3885 COEX_CALIBRATION = 3,
3886 COEX_PERIODIC_CALIBRATION = 4,
3888 COEX_CONNECTION_ESTAB = 5,
3889 /* association part */
3890 COEX_ASSOCIATED_IDLE = 6,
3891 COEX_ASSOC_MANUAL_SCAN = 7,
3892 COEX_ASSOC_AUTO_SCAN = 8,
3893 COEX_ASSOC_ACTIVE_LEVEL = 9,
3897 COEX_STAND_ALONE_DEBUG = 12,
3899 COEX_IPAN_ASSOC_LEVEL = 13,
3903 COEX_NUM_OF_EVENTS = 16
3907 * Coexistence WIFI/WIMAX Command
3908 * COEX_PRIORITY_TABLE_CMD = 0x5a
3911 struct iwl_wimax_coex_event_entry {
3918 /* COEX flag masks */
3920 /* Station table is valid */
3921 #define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1)
3922 /* UnMask wake up src at unassociated sleep */
3923 #define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4)
3924 /* UnMask wake up src at associated sleep */
3925 #define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8)
3926 /* Enable CoEx feature. */
3927 #define COEX_FLAGS_COEX_ENABLE_MSK (0x80)
3929 struct iwl_wimax_coex_cmd {
3932 struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
3936 * Coexistence MEDIUM NOTIFICATION
3937 * COEX_MEDIUM_NOTIFICATION = 0x5b
3939 * notification from uCode to host to indicate medium changes
3944 * bit 0 - 2: medium status
3945 * bit 3: medium change indication
3946 * bit 4 - 31: reserved
3948 /* status option values, (0 - 2 bits) */
3949 #define COEX_MEDIUM_BUSY (0x0) /* radio belongs to WiMAX */
3950 #define COEX_MEDIUM_ACTIVE (0x1) /* radio belongs to WiFi */
3951 #define COEX_MEDIUM_PRE_RELEASE (0x2) /* received radio release */
3952 #define COEX_MEDIUM_MSK (0x7)
3954 /* send notification status (1 bit) */
3955 #define COEX_MEDIUM_CHANGED (0x8)
3956 #define COEX_MEDIUM_CHANGED_MSK (0x8)
3957 #define COEX_MEDIUM_SHIFT (3)
3959 struct iwl_coex_medium_notification {
3965 * Coexistence EVENT Command
3966 * COEX_EVENT_CMD = 0x5c
3968 * send from host to uCode for coex event request.
3971 #define COEX_EVENT_REQUEST_MSK (0x1)
3973 struct iwl_coex_event_cmd {
3979 struct iwl_coex_event_resp {
3984 /******************************************************************************
3985 * Bluetooth Coexistence commands
3987 *****************************************************************************/
3990 * BT Status notification
3991 * REPLY_BT_COEX_PROFILE_NOTIF = 0xcb
3993 enum iwl_bt_coex_profile_traffic_load {
3994 IWL_BT_COEX_TRAFFIC_LOAD_NONE = 0,
3995 IWL_BT_COEX_TRAFFIC_LOAD_LOW = 1,
3996 IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 2,
3997 IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS = 3,
3999 * There are no more even though below is a u8, the
4000 * indication from the BT device only has two bits.
4004 struct iwl_bt_coex_profile_notif {
4006 u8 bt_status; /* 0 - off, 1 - on */
4007 u8 bt_traffic_load; /* 0 .. 3? */
4008 u8 bt_ci_compliance; /* 0 - not complied, 1 - complied */
4010 } __attribute__((packed));
4012 #define IWL_BT_COEX_PRIO_SHARED_ANTENNA 0x1
4013 #define IWL_BT_COEX_PRIO_PRIO_MASK 0xe
4014 #define IWL_BT_COEX_PRIO_PRIO_SHIFT 1
4017 * BT Coexistence Priority table
4018 * REPLY_BT_COEX_PRIO_TABLE = 0xcc
4020 struct iwl_bt_coex_prio_table_cmd {
4021 u8 init_calib_protection_cfg1,
4022 init_calib_protection_cfg2,
4023 init_calib_protection_lowprio_cfg1,
4024 init_calib_protection_lowprio_cfg2,
4025 init_calib_protection_highprio_cfg1,
4026 init_calib_protection_highprio_cfg2,
4027 dtim_protection_prio_cfg,
4028 scan_52_protection_cfg,
4029 scan_24_protection_cfg,
4030 bc_mc_protection_cfg;
4032 } __attribute__((packed));
4035 * BT Protection Envelope
4036 * REPLY_BT_COEX_PROT_ENV = 0xcd
4038 struct iwl_bt_coex_prot_env_cmd {
4039 u8 open; /* 0 = closed, 1 = open */
4040 u8 type; /* 0 .. 15 */
4042 } __attribute__((packed));
4044 /******************************************************************************
4046 * Union of all expected notifications/responses:
4048 *****************************************************************************/
4050 struct iwl_rx_packet {
4052 * The first 4 bytes of the RX frame header contain both the RX frame
4053 * size and some flags.
4055 * 31: flag flush RB request
4056 * 30: flag ignore TC (terminal counter) request
4057 * 29: flag fast IRQ request
4059 * 13-00: RX frame size
4062 struct iwl_cmd_header hdr;
4064 struct iwl3945_rx_frame rx_frame;
4065 struct iwl3945_tx_resp tx_resp;
4066 struct iwl3945_beacon_notif beacon_status;
4068 struct iwl_alive_resp alive_frame;
4069 struct iwl_spectrum_notification spectrum_notif;
4070 struct iwl_csa_notification csa_notif;
4071 struct iwl_error_resp err_resp;
4072 struct iwl_card_state_notif card_state_notif;
4073 struct iwl_add_sta_resp add_sta;
4074 struct iwl_rem_sta_resp rem_sta;
4075 struct iwl_sleep_notification sleep_notif;
4076 struct iwl_spectrum_resp spectrum;
4077 struct iwl_notif_statistics stats;
4078 struct iwl_bt_notif_statistics stats_bt;
4079 struct iwl_compressed_ba_resp compressed_ba;
4080 struct iwl_missed_beacon_notif missed_beacon;
4081 struct iwl_coex_medium_notification coex_medium_notif;
4082 struct iwl_coex_event_resp coex_event;
4083 struct iwl_bt_coex_profile_notif bt_coex_profile_notif;
4089 int iwl_agn_check_rxon_cmd(struct iwl_priv *priv);
4091 #endif /* __iwl_commands_h__ */