iwlwifi: keep 3945 and 4965 headers separate
[linux-2.6/linux-2.6-openrd.git] / drivers / net / wireless / iwlwifi / iwl-4965-commands.h
blob5524bf77e882a9fc5fc1ffc841106807e72cde30
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.
6 * GPL LICENSE SUMMARY
8 * Copyright(c) 2005 - 2007 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,
22 * USA
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
27 * Contact Information:
28 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31 * BSD LICENSE
33 * Copyright(c) 2005 - 2007 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
38 * are met:
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
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 #ifndef __iwl_commands_h__
65 #define __iwl_commands_h__
67 enum {
68 REPLY_ALIVE = 0x1,
69 REPLY_ERROR = 0x2,
71 /* RXON and QOS commands */
72 REPLY_RXON = 0x10,
73 REPLY_RXON_ASSOC = 0x11,
74 REPLY_QOS_PARAM = 0x13,
75 REPLY_RXON_TIMING = 0x14,
77 /* Multi-Station support */
78 REPLY_ADD_STA = 0x18,
79 REPLY_REMOVE_STA = 0x19, /* not used */
80 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
82 /* RX, TX, LEDs */
83 REPLY_TX = 0x1c,
84 REPLY_RATE_SCALE = 0x47, /* 3945 only */
85 REPLY_LEDS_CMD = 0x48,
86 REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
88 /* 802.11h related */
89 RADAR_NOTIFICATION = 0x70, /* not used */
90 REPLY_QUIET_CMD = 0x71, /* not used */
91 REPLY_CHANNEL_SWITCH = 0x72,
92 CHANNEL_SWITCH_NOTIFICATION = 0x73,
93 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
94 SPECTRUM_MEASURE_NOTIFICATION = 0x75,
96 /* Power Management */
97 POWER_TABLE_CMD = 0x77,
98 PM_SLEEP_NOTIFICATION = 0x7A,
99 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
101 /* Scan commands and notifications */
102 REPLY_SCAN_CMD = 0x80,
103 REPLY_SCAN_ABORT_CMD = 0x81,
104 SCAN_START_NOTIFICATION = 0x82,
105 SCAN_RESULTS_NOTIFICATION = 0x83,
106 SCAN_COMPLETE_NOTIFICATION = 0x84,
108 /* IBSS/AP commands */
109 BEACON_NOTIFICATION = 0x90,
110 REPLY_TX_BEACON = 0x91,
111 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
113 /* Miscellaneous commands */
114 QUIET_NOTIFICATION = 0x96, /* not used */
115 REPLY_TX_PWR_TABLE_CMD = 0x97,
116 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
118 /* BT config command */
119 REPLY_BT_CONFIG = 0x9b,
121 /* 4965 Statistics */
122 REPLY_STATISTICS_CMD = 0x9c,
123 STATISTICS_NOTIFICATION = 0x9d,
125 /* RF-KILL commands and notifications */
126 REPLY_CARD_STATE_CMD = 0xa0,
127 CARD_STATE_NOTIFICATION = 0xa1,
129 /* Missed beacons notification */
130 MISSED_BEACONS_NOTIFICATION = 0xa2,
132 REPLY_CT_KILL_CONFIG_CMD = 0xa4,
133 SENSITIVITY_CMD = 0xa8,
134 REPLY_PHY_CALIBRATION_CMD = 0xb0,
135 REPLY_RX_PHY_CMD = 0xc0,
136 REPLY_RX_MPDU_CMD = 0xc1,
137 REPLY_4965_RX = 0xc3,
138 REPLY_COMPRESSED_BA = 0xc5,
139 REPLY_MAX = 0xff
142 /******************************************************************************
143 * (0)
144 * Header
146 *****************************************************************************/
148 #define IWL_CMD_FAILED_MSK 0x40
150 struct iwl_cmd_header {
151 u8 cmd;
152 u8 flags;
153 /* We have 15 LSB to use as we please (MSB indicates
154 * a frame Rx'd from the HW). We encode the following
155 * information into the sequence field:
157 * 0:7 index in fifo
158 * 8:13 fifo selection
159 * 14:14 bit indicating if this packet references the 'extra'
160 * storage at the end of the memory queue
161 * 15:15 (Rx indication)
164 __le16 sequence;
166 /* command data follows immediately */
167 u8 data[0];
168 } __attribute__ ((packed));
170 /******************************************************************************
171 * (0a)
172 * Alive and Error Commands & Responses:
174 *****************************************************************************/
176 #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
177 #define INITIALIZE_SUBTYPE (9)
180 * REPLY_ALIVE = 0x1 (response only, not a command)
182 struct iwl_alive_resp {
183 u8 ucode_minor;
184 u8 ucode_major;
185 __le16 reserved1;
186 u8 sw_rev[8];
187 u8 ver_type;
188 u8 ver_subtype;
189 __le16 reserved2;
190 __le32 log_event_table_ptr;
191 __le32 error_event_table_ptr;
192 __le32 timestamp;
193 __le32 is_valid;
194 } __attribute__ ((packed));
196 struct iwl_init_alive_resp {
197 u8 ucode_minor;
198 u8 ucode_major;
199 __le16 reserved1;
200 u8 sw_rev[8];
201 u8 ver_type;
202 u8 ver_subtype;
203 __le16 reserved2;
204 __le32 log_event_table_ptr;
205 __le32 error_event_table_ptr;
206 __le32 timestamp;
207 __le32 is_valid;
209 /* calibration values from "initialize" uCode */
210 __le32 voltage; /* signed */
211 __le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */
212 __le32 therm_r2[2]; /* signed */
213 __le32 therm_r3[2]; /* signed */
214 __le32 therm_r4[2]; /* signed */
215 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
216 * 2 Tx chains */
217 } __attribute__ ((packed));
219 union tsf {
220 u8 byte[8];
221 __le16 word[4];
222 __le32 dw[2];
226 * REPLY_ERROR = 0x2 (response only, not a command)
228 struct iwl_error_resp {
229 __le32 error_type;
230 u8 cmd_id;
231 u8 reserved1;
232 __le16 bad_cmd_seq_num;
233 __le32 error_info;
234 union tsf timestamp;
235 } __attribute__ ((packed));
237 /******************************************************************************
238 * (1)
239 * RXON Commands & Responses:
241 *****************************************************************************/
244 * Rx config defines & structure
246 /* rx_config device types */
247 enum {
248 RXON_DEV_TYPE_AP = 1,
249 RXON_DEV_TYPE_ESS = 3,
250 RXON_DEV_TYPE_IBSS = 4,
251 RXON_DEV_TYPE_SNIFFER = 6,
254 /* rx_config flags */
255 /* band & modulation selection */
256 #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
257 #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
258 /* auto detection enable */
259 #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
260 /* TGg protection when tx */
261 #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
262 /* cck short slot & preamble */
263 #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
264 #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
265 /* antenna selection */
266 #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
267 #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
268 #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
269 #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
270 /* radar detection enable */
271 #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
272 #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
273 /* rx response to host with 8-byte TSF
274 * (according to ON_AIR deassertion) */
275 #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
277 /* rx_config filter flags */
278 /* accept all data frames */
279 #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
280 /* pass control & management to host */
281 #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
282 /* accept multi-cast */
283 #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
284 /* don't decrypt uni-cast frames */
285 #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
286 /* don't decrypt multi-cast frames */
287 #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
288 /* STA is associated */
289 #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
290 /* transfer to host non bssid beacons in associated state */
291 #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
294 * REPLY_RXON = 0x10 (command, has simple generic response)
296 struct iwl_rxon_cmd {
297 u8 node_addr[6];
298 __le16 reserved1;
299 u8 bssid_addr[6];
300 __le16 reserved2;
301 u8 wlap_bssid_addr[6];
302 __le16 reserved3;
303 u8 dev_type;
304 u8 air_propagation;
305 __le16 rx_chain;
306 u8 ofdm_basic_rates;
307 u8 cck_basic_rates;
308 __le16 assoc_id;
309 __le32 flags;
310 __le32 filter_flags;
311 __le16 channel;
312 u8 ofdm_ht_single_stream_basic_rates;
313 u8 ofdm_ht_dual_stream_basic_rates;
314 } __attribute__ ((packed));
317 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
319 struct iwl_rxon_assoc_cmd {
320 __le32 flags;
321 __le32 filter_flags;
322 u8 ofdm_basic_rates;
323 u8 cck_basic_rates;
324 u8 ofdm_ht_single_stream_basic_rates;
325 u8 ofdm_ht_dual_stream_basic_rates;
326 __le16 rx_chain_select_flags;
327 __le16 reserved;
328 } __attribute__ ((packed));
331 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
333 struct iwl_rxon_time_cmd {
334 union tsf timestamp;
335 __le16 beacon_interval;
336 __le16 atim_window;
337 __le32 beacon_init_val;
338 __le16 listen_interval;
339 __le16 reserved;
340 } __attribute__ ((packed));
342 struct iwl_tx_power {
343 u8 tx_gain; /* gain for analog radio */
344 u8 dsp_atten; /* gain for DSP */
345 } __attribute__ ((packed));
347 #define POWER_TABLE_NUM_ENTRIES 33
348 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
349 #define POWER_TABLE_CCK_ENTRY 32
350 struct tx_power_dual_stream {
351 __le32 dw;
352 } __attribute__ ((packed));
354 struct iwl_tx_power_db {
355 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
356 } __attribute__ ((packed));
359 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
361 struct iwl_channel_switch_cmd {
362 u8 band;
363 u8 expect_beacon;
364 __le16 channel;
365 __le32 rxon_flags;
366 __le32 rxon_filter_flags;
367 __le32 switch_time;
368 struct iwl_tx_power_db tx_power;
369 } __attribute__ ((packed));
372 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
374 struct iwl_csa_notification {
375 __le16 band;
376 __le16 channel;
377 __le32 status; /* 0 - OK, 1 - fail */
378 } __attribute__ ((packed));
380 /******************************************************************************
381 * (2)
382 * Quality-of-Service (QOS) Commands & Responses:
384 *****************************************************************************/
385 struct iwl_ac_qos {
386 __le16 cw_min;
387 __le16 cw_max;
388 u8 aifsn;
389 u8 reserved1;
390 __le16 edca_txop;
391 } __attribute__ ((packed));
393 /* QoS flags defines */
394 #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
395 #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
396 #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
399 * TXFIFO Queue number defines
401 /* number of Access categories (AC) (EDCA), queues 0..3 */
402 #define AC_NUM 4
405 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
407 struct iwl_qosparam_cmd {
408 __le32 qos_flags;
409 struct iwl_ac_qos ac[AC_NUM];
410 } __attribute__ ((packed));
412 /******************************************************************************
413 * (3)
414 * Add/Modify Stations Commands & Responses:
416 *****************************************************************************/
418 * Multi station support
420 #define IWL_AP_ID 0
421 #define IWL_MULTICAST_ID 1
422 #define IWL_STA_ID 2
424 #define IWL3945_BROADCAST_ID 24
425 #define IWL3945_STATION_COUNT 25
427 #define IWL4965_BROADCAST_ID 31
428 #define IWL4965_STATION_COUNT 32
430 #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
431 #define IWL_INVALID_STATION 255
433 #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
435 #define STA_CONTROL_MODIFY_MSK 0x01
437 /* key flags __le16*/
438 #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
439 #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
440 #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
441 #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
442 #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
444 #define STA_KEY_FLG_KEYID_POS 8
445 #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
447 /* modify flags */
448 #define STA_MODIFY_KEY_MASK 0x01
449 #define STA_MODIFY_TID_DISABLE_TX 0x02
450 #define STA_MODIFY_TX_RATE_MSK 0x04
451 #define STA_MODIFY_ADDBA_TID_MSK 0x08
452 #define STA_MODIFY_DELBA_TID_MSK 0x10
453 #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
456 * Antenna masks:
457 * bit14:15 01 B inactive, A active
458 * 10 B active, A inactive
459 * 11 Both active
461 #define RATE_MCS_ANT_A_POS 14
462 #define RATE_MCS_ANT_B_POS 15
463 #define RATE_MCS_ANT_A_MSK 0x4000
464 #define RATE_MCS_ANT_B_MSK 0x8000
465 #define RATE_MCS_ANT_AB_MSK 0xc000
467 struct iwl_keyinfo {
468 __le16 key_flags;
469 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
470 u8 reserved1;
471 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
472 __le16 reserved2;
473 u8 key[16]; /* 16-byte unicast decryption key */
474 } __attribute__ ((packed));
476 struct sta_id_modify {
477 u8 addr[ETH_ALEN];
478 __le16 reserved1;
479 u8 sta_id;
480 u8 modify_mask;
481 __le16 reserved2;
482 } __attribute__ ((packed));
485 * REPLY_ADD_STA = 0x18 (command)
487 struct iwl_addsta_cmd {
488 u8 mode;
489 u8 reserved[3];
490 struct sta_id_modify sta;
491 struct iwl_keyinfo key;
492 __le32 station_flags;
493 __le32 station_flags_msk;
494 __le16 tid_disable_tx;
495 __le16 reserved1;
496 u8 add_immediate_ba_tid;
497 u8 remove_immediate_ba_tid;
498 __le16 add_immediate_ba_ssn;
499 __le32 reserved2;
500 } __attribute__ ((packed));
503 * REPLY_ADD_STA = 0x18 (response)
505 struct iwl_add_sta_resp {
506 u8 status;
507 } __attribute__ ((packed));
509 #define ADD_STA_SUCCESS_MSK 0x1
511 /******************************************************************************
512 * (4)
513 * Rx Responses:
515 *****************************************************************************/
517 struct iwl_rx_frame_stats {
518 u8 phy_count;
519 u8 id;
520 u8 rssi;
521 u8 agc;
522 __le16 sig_avg;
523 __le16 noise_diff;
524 u8 payload[0];
525 } __attribute__ ((packed));
527 struct iwl_rx_frame_hdr {
528 __le16 channel;
529 __le16 phy_flags;
530 u8 reserved1;
531 u8 rate;
532 __le16 len;
533 u8 payload[0];
534 } __attribute__ ((packed));
536 #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
537 #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
539 #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
540 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
541 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
542 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
543 #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
545 #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
546 #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
547 #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
548 #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
549 #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
551 #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
552 #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
553 #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
554 #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
555 #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
557 struct iwl_rx_frame_end {
558 __le32 status;
559 __le64 timestamp;
560 __le32 beacon_timestamp;
561 } __attribute__ ((packed));
564 * REPLY_3945_RX = 0x1b (response only, not a command)
566 * NOTE: DO NOT dereference from casts to this structure
567 * It is provided only for calculating minimum data set size.
568 * The actual offsets of the hdr and end are dynamic based on
569 * stats.phy_count
571 struct iwl_rx_frame {
572 struct iwl_rx_frame_stats stats;
573 struct iwl_rx_frame_hdr hdr;
574 struct iwl_rx_frame_end end;
575 } __attribute__ ((packed));
577 /* Fixed (non-configurable) rx data from phy */
578 #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
579 #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
580 #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
581 #define IWL_AGC_DB_POS (7)
582 struct iwl4965_rx_non_cfg_phy {
583 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
584 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
585 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
586 u8 pad[0];
587 } __attribute__ ((packed));
590 * REPLY_4965_RX = 0xc3 (response only, not a command)
591 * Used only for legacy (non 11n) frames.
593 #define RX_RES_PHY_CNT 14
594 struct iwl4965_rx_phy_res {
595 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
596 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
597 u8 stat_id; /* configurable DSP phy data set ID */
598 u8 reserved1;
599 __le64 timestamp; /* TSF at on air rise */
600 __le32 beacon_time_stamp; /* beacon at on-air rise */
601 __le16 phy_flags; /* general phy flags: band, modulation, ... */
602 __le16 channel; /* channel number */
603 __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
604 __le32 reserved2;
605 __le32 rate_n_flags;
606 __le16 byte_count; /* frame's byte-count */
607 __le16 reserved3;
608 } __attribute__ ((packed));
610 struct iwl4965_rx_mpdu_res_start {
611 __le16 byte_count;
612 __le16 reserved;
613 } __attribute__ ((packed));
616 /******************************************************************************
617 * (5)
618 * Tx Commands & Responses:
620 *****************************************************************************/
622 /* Tx flags */
623 #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
624 #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
625 #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
626 #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
627 #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
628 #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
629 #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
630 #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
631 #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
633 /* ucode ignores BT priority for this frame */
634 #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
636 /* ucode overrides sequence control */
637 #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
639 /* signal that this frame is non-last MPDU */
640 #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
642 /* calculate TSF in outgoing frame */
643 #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
645 /* activate TX calibration. */
646 #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
648 /* signals that 2 bytes pad was inserted
649 after the MAC header */
650 #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
652 /* HCCA-AP - disable duration overwriting. */
653 #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
656 * TX command security control
658 #define TX_CMD_SEC_WEP 0x01
659 #define TX_CMD_SEC_CCM 0x02
660 #define TX_CMD_SEC_TKIP 0x03
661 #define TX_CMD_SEC_MSK 0x03
662 #define TX_CMD_SEC_SHIFT 6
663 #define TX_CMD_SEC_KEY128 0x08
666 * TX command Frame life time
669 struct iwl_dram_scratch {
670 u8 try_cnt;
671 u8 bt_kill_cnt;
672 __le16 reserved;
673 } __attribute__ ((packed));
676 * REPLY_TX = 0x1c (command)
678 struct iwl_tx_cmd {
679 __le16 len;
680 __le16 next_frame_len;
681 __le32 tx_flags;
682 struct iwl_dram_scratch scratch;
683 __le32 rate_n_flags;
684 u8 sta_id;
685 u8 sec_ctl;
686 u8 initial_rate_index;
687 u8 reserved;
688 u8 key[16];
689 __le16 next_frame_flags;
690 __le16 reserved2;
691 union {
692 __le32 life_time;
693 __le32 attempt;
694 } stop_time;
695 __le32 dram_lsb_ptr;
696 u8 dram_msb_ptr;
697 u8 rts_retry_limit; /*byte 50 */
698 u8 data_retry_limit; /*byte 51 */
699 u8 tid_tspec;
700 union {
701 __le16 pm_frame_timeout;
702 __le16 attempt_duration;
703 } timeout;
704 __le16 driver_txop;
705 u8 payload[0];
706 struct ieee80211_hdr hdr[0];
707 } __attribute__ ((packed));
709 /* TX command response is sent after *all* transmission attempts.
711 * NOTES:
713 * TX_STATUS_FAIL_NEXT_FRAG
715 * If the fragment flag in the MAC header for the frame being transmitted
716 * is set and there is insufficient time to transmit the next frame, the
717 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
719 * TX_STATUS_FIFO_UNDERRUN
721 * Indicates the host did not provide bytes to the FIFO fast enough while
722 * a TX was in progress.
724 * TX_STATUS_FAIL_MGMNT_ABORT
726 * This status is only possible if the ABORT ON MGMT RX parameter was
727 * set to true with the TX command.
729 * If the MSB of the status parameter is set then an abort sequence is
730 * required. This sequence consists of the host activating the TX Abort
731 * control line, and then waiting for the TX Abort command response. This
732 * indicates that a the device is no longer in a transmit state, and that the
733 * command FIFO has been cleared. The host must then deactivate the TX Abort
734 * control line. Receiving is still allowed in this case.
736 enum {
737 TX_STATUS_SUCCESS = 0x01,
738 TX_STATUS_DIRECT_DONE = 0x02,
739 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
740 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
741 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
742 TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
743 TX_STATUS_FAIL_NEXT_FRAG = 0x86,
744 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
745 TX_STATUS_FAIL_DEST_PS = 0x88,
746 TX_STATUS_FAIL_ABORTED = 0x89,
747 TX_STATUS_FAIL_BT_RETRY = 0x8a,
748 TX_STATUS_FAIL_STA_INVALID = 0x8b,
749 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
750 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
751 TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
752 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
753 TX_STATUS_FAIL_TX_LOCKED = 0x90,
754 TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
757 #define TX_PACKET_MODE_REGULAR 0x0000
758 #define TX_PACKET_MODE_BURST_SEQ 0x0100
759 #define TX_PACKET_MODE_BURST_FIRST 0x0200
761 enum {
762 TX_POWER_PA_NOT_ACTIVE = 0x0,
765 enum {
766 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
767 TX_STATUS_DELAY_MSK = 0x00000040,
768 TX_STATUS_ABORT_MSK = 0x00000080,
769 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
770 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
771 TX_RESERVED = 0x00780000, /* bits 19:22 */
772 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
773 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
776 /* *******************************
777 * TX aggregation state
778 ******************************* */
780 enum {
781 AGG_TX_STATE_TRANSMITTED = 0x00,
782 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
783 AGG_TX_STATE_BT_PRIO_MSK = 0x02,
784 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
785 AGG_TX_STATE_ABORT_MSK = 0x08,
786 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
787 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
788 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
789 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
790 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
791 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
792 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
793 AGG_TX_STATE_DELAY_TX_MSK = 0x400
796 #define AGG_TX_STATE_LAST_SENT_MSK \
797 (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
798 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
799 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
801 #define AGG_TX_STATE_TRY_CNT_POS 12
802 #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
804 #define AGG_TX_STATE_SEQ_NUM_POS 16
805 #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
808 * REPLY_TX = 0x1c (response)
810 struct iwl_tx_resp {
811 u8 frame_count; /* 1 no aggregation, >1 aggregation */
812 u8 bt_kill_count;
813 u8 failure_rts;
814 u8 failure_frame;
815 __le32 rate_n_flags;
816 __le16 wireless_media_time;
817 __le16 reserved;
818 __le32 pa_power1;
819 __le32 pa_power2;
820 __le32 status; /* TX status (for aggregation status of 1st frame) */
821 } __attribute__ ((packed));
824 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
826 struct iwl_compressed_ba_resp {
827 __le32 sta_addr_lo32;
828 __le16 sta_addr_hi16;
829 __le16 reserved;
830 u8 sta_id;
831 u8 tid;
832 __le16 ba_seq_ctl;
833 __le32 ba_bitmap0;
834 __le32 ba_bitmap1;
835 __le16 scd_flow;
836 __le16 scd_ssn;
837 } __attribute__ ((packed));
840 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
842 struct iwl_txpowertable_cmd {
843 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
844 u8 reserved;
845 __le16 channel;
846 struct iwl_tx_power_db tx_power;
847 } __attribute__ ((packed));
849 /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
850 #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0)
852 #define LINK_QUAL_AC_NUM AC_NUM
853 #define LINK_QUAL_MAX_RETRY_NUM 16
855 #define LINK_QUAL_ANT_A_MSK (1<<0)
856 #define LINK_QUAL_ANT_B_MSK (1<<1)
857 #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
859 struct iwl_link_qual_general_params {
860 u8 flags;
861 u8 mimo_delimiter;
862 u8 single_stream_ant_msk;
863 u8 dual_stream_ant_msk;
864 u8 start_rate_index[LINK_QUAL_AC_NUM];
865 } __attribute__ ((packed));
867 struct iwl_link_qual_agg_params {
868 __le16 agg_time_limit;
869 u8 agg_dis_start_th;
870 u8 agg_frame_cnt_limit;
871 __le32 reserved;
872 } __attribute__ ((packed));
875 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
877 struct iwl_link_quality_cmd {
878 u8 sta_id;
879 u8 reserved1;
880 __le16 control;
881 struct iwl_link_qual_general_params general_params;
882 struct iwl_link_qual_agg_params agg_params;
883 struct {
884 __le32 rate_n_flags;
885 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
886 __le32 reserved2;
887 } __attribute__ ((packed));
890 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
892 struct iwl_bt_cmd {
893 u8 flags;
894 u8 lead_time;
895 u8 max_kill;
896 u8 reserved;
897 __le32 kill_ack_mask;
898 __le32 kill_cts_mask;
899 } __attribute__ ((packed));
901 /******************************************************************************
902 * (6)
903 * Spectrum Management (802.11h) Commands, Responses, Notifications:
905 *****************************************************************************/
908 * Spectrum Management
910 #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
911 RXON_FILTER_CTL2HOST_MSK | \
912 RXON_FILTER_ACCEPT_GRP_MSK | \
913 RXON_FILTER_DIS_DECRYPT_MSK | \
914 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
915 RXON_FILTER_ASSOC_MSK | \
916 RXON_FILTER_BCON_AWARE_MSK)
918 struct iwl_measure_channel {
919 __le32 duration; /* measurement duration in extended beacon
920 * format */
921 u8 channel; /* channel to measure */
922 u8 type; /* see enum iwl_measure_type */
923 __le16 reserved;
924 } __attribute__ ((packed));
927 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
929 struct iwl_spectrum_cmd {
930 __le16 len; /* number of bytes starting from token */
931 u8 token; /* token id */
932 u8 id; /* measurement id -- 0 or 1 */
933 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
934 u8 periodic; /* 1 = periodic */
935 __le16 path_loss_timeout;
936 __le32 start_time; /* start time in extended beacon format */
937 __le32 reserved2;
938 __le32 flags; /* rxon flags */
939 __le32 filter_flags; /* rxon filter flags */
940 __le16 channel_count; /* minimum 1, maximum 10 */
941 __le16 reserved3;
942 struct iwl_measure_channel channels[10];
943 } __attribute__ ((packed));
946 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
948 struct iwl_spectrum_resp {
949 u8 token;
950 u8 id; /* id of the prior command replaced, or 0xff */
951 __le16 status; /* 0 - command will be handled
952 * 1 - cannot handle (conflicts with another
953 * measurement) */
954 } __attribute__ ((packed));
956 enum iwl_measurement_state {
957 IWL_MEASUREMENT_START = 0,
958 IWL_MEASUREMENT_STOP = 1,
961 enum iwl_measurement_status {
962 IWL_MEASUREMENT_OK = 0,
963 IWL_MEASUREMENT_CONCURRENT = 1,
964 IWL_MEASUREMENT_CSA_CONFLICT = 2,
965 IWL_MEASUREMENT_TGH_CONFLICT = 3,
966 /* 4-5 reserved */
967 IWL_MEASUREMENT_STOPPED = 6,
968 IWL_MEASUREMENT_TIMEOUT = 7,
969 IWL_MEASUREMENT_PERIODIC_FAILED = 8,
972 #define NUM_ELEMENTS_IN_HISTOGRAM 8
974 struct iwl_measurement_histogram {
975 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
976 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
977 } __attribute__ ((packed));
979 /* clear channel availability counters */
980 struct iwl_measurement_cca_counters {
981 __le32 ofdm;
982 __le32 cck;
983 } __attribute__ ((packed));
985 enum iwl_measure_type {
986 IWL_MEASURE_BASIC = (1 << 0),
987 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
988 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
989 IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
990 IWL_MEASURE_FRAME = (1 << 4),
991 /* bits 5:6 are reserved */
992 IWL_MEASURE_IDLE = (1 << 7),
996 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
998 struct iwl_spectrum_notification {
999 u8 id; /* measurement id -- 0 or 1 */
1000 u8 token;
1001 u8 channel_index; /* index in measurement channel list */
1002 u8 state; /* 0 - start, 1 - stop */
1003 __le32 start_time; /* lower 32-bits of TSF */
1004 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
1005 u8 channel;
1006 u8 type; /* see enum iwl_measurement_type */
1007 u8 reserved1;
1008 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
1009 * valid if applicable for measurement type requested. */
1010 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
1011 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
1012 __le32 cca_time; /* channel load time in usecs */
1013 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
1014 * unidentified */
1015 u8 reserved2[3];
1016 struct iwl_measurement_histogram histogram;
1017 __le32 stop_time; /* lower 32-bits of TSF */
1018 __le32 status; /* see iwl_measurement_status */
1019 } __attribute__ ((packed));
1021 /******************************************************************************
1022 * (7)
1023 * Power Management Commands, Responses, Notifications:
1025 *****************************************************************************/
1028 * struct iwl_powertable_cmd - Power Table Command
1029 * @flags: See below:
1031 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
1033 * PM allow:
1034 * bit 0 - '0' Driver not allow power management
1035 * '1' Driver allow PM (use rest of parameters)
1036 * uCode send sleep notifications:
1037 * bit 1 - '0' Don't send sleep notification
1038 * '1' send sleep notification (SEND_PM_NOTIFICATION)
1039 * Sleep over DTIM
1040 * bit 2 - '0' PM have to walk up every DTIM
1041 * '1' PM could sleep over DTIM till listen Interval.
1042 * PCI power managed
1043 * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
1044 * '1' !(PCI_LINK_CTRL & 0x1)
1045 * Force sleep Modes
1046 * bit 31/30- '00' use both mac/xtal sleeps
1047 * '01' force Mac sleep
1048 * '10' force xtal sleep
1049 * '11' Illegal set
1051 * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
1052 * ucode assume sleep over DTIM is allowed and we don't need to wakeup
1053 * for every DTIM.
1055 #define IWL_POWER_VEC_SIZE 5
1057 #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0)
1058 #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
1059 #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
1061 struct iwl_powertable_cmd {
1062 __le16 flags;
1063 u8 keep_alive_seconds;
1064 u8 debug_flags;
1065 __le32 rx_data_timeout;
1066 __le32 tx_data_timeout;
1067 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
1068 __le32 keep_alive_beacons;
1069 } __attribute__ ((packed));
1072 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1073 * 3945 and 4965 identical.
1075 struct iwl_sleep_notification {
1076 u8 pm_sleep_mode;
1077 u8 pm_wakeup_src;
1078 __le16 reserved;
1079 __le32 sleep_time;
1080 __le32 tsf_low;
1081 __le32 bcon_timer;
1082 } __attribute__ ((packed));
1084 /* Sleep states. 3945 and 4965 identical. */
1085 enum {
1086 IWL_PM_NO_SLEEP = 0,
1087 IWL_PM_SLP_MAC = 1,
1088 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
1089 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
1090 IWL_PM_SLP_PHY = 4,
1091 IWL_PM_SLP_REPENT = 5,
1092 IWL_PM_WAKEUP_BY_TIMER = 6,
1093 IWL_PM_WAKEUP_BY_DRIVER = 7,
1094 IWL_PM_WAKEUP_BY_RFKILL = 8,
1095 /* 3 reserved */
1096 IWL_PM_NUM_OF_MODES = 12,
1100 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
1102 #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
1103 #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
1104 #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
1105 struct iwl_card_state_cmd {
1106 __le32 status; /* CARD_STATE_CMD_* request new power state */
1107 } __attribute__ ((packed));
1110 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1112 struct iwl_card_state_notif {
1113 __le32 flags;
1114 } __attribute__ ((packed));
1116 #define HW_CARD_DISABLED 0x01
1117 #define SW_CARD_DISABLED 0x02
1118 #define RF_CARD_DISABLED 0x04
1119 #define RXON_CARD_DISABLED 0x10
1121 struct iwl_ct_kill_config {
1122 __le32 reserved;
1123 __le32 critical_temperature_M;
1124 __le32 critical_temperature_R;
1125 } __attribute__ ((packed));
1127 /******************************************************************************
1128 * (8)
1129 * Scan Commands, Responses, Notifications:
1131 *****************************************************************************/
1133 struct iwl_scan_channel {
1134 /* type is defined as:
1135 * 0:0 active (0 - passive)
1136 * 1:4 SSID direct
1137 * If 1 is set then corresponding SSID IE is transmitted in probe
1138 * 5:7 reserved
1140 u8 type;
1141 u8 channel;
1142 struct iwl_tx_power tpc;
1143 __le16 active_dwell;
1144 __le16 passive_dwell;
1145 } __attribute__ ((packed));
1147 struct iwl_ssid_ie {
1148 u8 id;
1149 u8 len;
1150 u8 ssid[32];
1151 } __attribute__ ((packed));
1153 #define PROBE_OPTION_MAX 0x4
1154 #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
1155 #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
1156 #define IWL_MAX_SCAN_SIZE 1024
1159 * REPLY_SCAN_CMD = 0x80 (command)
1161 struct iwl_scan_cmd {
1162 __le16 len;
1163 u8 reserved0;
1164 u8 channel_count;
1165 __le16 quiet_time; /* dwell only this long on quiet chnl
1166 * (active scan) */
1167 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
1168 __le16 good_CRC_th; /* passive -> active promotion threshold */
1169 __le16 rx_chain;
1170 __le32 max_out_time; /* max usec to be out of associated (service)
1171 * chnl */
1172 __le32 suspend_time; /* pause scan this long when returning to svc
1173 * chnl.
1174 * 3945 -- 31:24 # beacons, 19:0 additional usec,
1175 * 4965 -- 31:22 # beacons, 21:0 additional usec.
1177 __le32 flags;
1178 __le32 filter_flags;
1180 struct iwl_tx_cmd tx_cmd;
1181 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
1183 u8 data[0];
1185 * The channels start after the probe request payload and are of type:
1187 * struct iwl_scan_channel channels[0];
1189 * NOTE: Only one band of channels can be scanned per pass. You
1190 * can not mix 2.4GHz channels and 5.2GHz channels and must
1191 * request a scan multiple times (not concurrently)
1194 } __attribute__ ((packed));
1196 /* Can abort will notify by complete notification with abort status. */
1197 #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
1198 /* complete notification statuses */
1199 #define ABORT_STATUS 0x2
1202 * REPLY_SCAN_CMD = 0x80 (response)
1204 struct iwl_scanreq_notification {
1205 __le32 status; /* 1: okay, 2: cannot fulfill request */
1206 } __attribute__ ((packed));
1209 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1211 struct iwl_scanstart_notification {
1212 __le32 tsf_low;
1213 __le32 tsf_high;
1214 __le32 beacon_timer;
1215 u8 channel;
1216 u8 band;
1217 u8 reserved[2];
1218 __le32 status;
1219 } __attribute__ ((packed));
1221 #define SCAN_OWNER_STATUS 0x1;
1222 #define MEASURE_OWNER_STATUS 0x2;
1224 #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
1226 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1228 struct iwl_scanresults_notification {
1229 u8 channel;
1230 u8 band;
1231 u8 reserved[2];
1232 __le32 tsf_low;
1233 __le32 tsf_high;
1234 __le32 statistics[NUMBER_OF_STATISTICS];
1235 } __attribute__ ((packed));
1238 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1240 struct iwl_scancomplete_notification {
1241 u8 scanned_channels;
1242 u8 status;
1243 u8 reserved;
1244 u8 last_channel;
1245 __le32 tsf_low;
1246 __le32 tsf_high;
1247 } __attribute__ ((packed));
1250 /******************************************************************************
1251 * (9)
1252 * IBSS/AP Commands and Notifications:
1254 *****************************************************************************/
1257 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1259 struct iwl_beacon_notif {
1260 struct iwl_tx_resp beacon_notify_hdr;
1261 __le32 low_tsf;
1262 __le32 high_tsf;
1263 __le32 ibss_mgr_status;
1264 } __attribute__ ((packed));
1267 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1269 struct iwl_tx_beacon_cmd {
1270 struct iwl_tx_cmd tx;
1271 __le16 tim_idx;
1272 u8 tim_size;
1273 u8 reserved1;
1274 struct ieee80211_hdr frame[0]; /* beacon frame */
1275 } __attribute__ ((packed));
1277 /******************************************************************************
1278 * (10)
1279 * Statistics Commands and Notifications:
1281 *****************************************************************************/
1283 #define IWL_TEMP_CONVERT 260
1285 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
1286 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
1287 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
1289 /* Used for passing to driver number of successes and failures per rate */
1290 struct rate_histogram {
1291 union {
1292 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
1293 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
1294 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
1295 } success;
1296 union {
1297 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
1298 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
1299 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
1300 } failed;
1301 } __attribute__ ((packed));
1303 /* statistics command response */
1305 struct statistics_rx_phy {
1306 __le32 ina_cnt;
1307 __le32 fina_cnt;
1308 __le32 plcp_err;
1309 __le32 crc32_err;
1310 __le32 overrun_err;
1311 __le32 early_overrun_err;
1312 __le32 crc32_good;
1313 __le32 false_alarm_cnt;
1314 __le32 fina_sync_err_cnt;
1315 __le32 sfd_timeout;
1316 __le32 fina_timeout;
1317 __le32 unresponded_rts;
1318 __le32 rxe_frame_limit_overrun;
1319 __le32 sent_ack_cnt;
1320 __le32 sent_cts_cnt;
1321 __le32 sent_ba_rsp_cnt;
1322 __le32 dsp_self_kill;
1323 __le32 mh_format_err;
1324 __le32 re_acq_main_rssi_sum;
1325 __le32 reserved3;
1326 } __attribute__ ((packed));
1328 struct statistics_rx_ht_phy {
1329 __le32 plcp_err;
1330 __le32 overrun_err;
1331 __le32 early_overrun_err;
1332 __le32 crc32_good;
1333 __le32 crc32_err;
1334 __le32 mh_format_err;
1335 __le32 agg_crc32_good;
1336 __le32 agg_mpdu_cnt;
1337 __le32 agg_cnt;
1338 __le32 reserved2;
1339 } __attribute__ ((packed));
1341 struct statistics_rx_non_phy {
1342 __le32 bogus_cts; /* CTS received when not expecting CTS */
1343 __le32 bogus_ack; /* ACK received when not expecting ACK */
1344 __le32 non_bssid_frames; /* number of frames with BSSID that
1345 * doesn't belong to the STA BSSID */
1346 __le32 filtered_frames; /* count frames that were dumped in the
1347 * filtering process */
1348 __le32 non_channel_beacons; /* beacons with our bss id but not on
1349 * our serving channel */
1350 __le32 channel_beacons; /* beacons with our bss id and in our
1351 * serving channel */
1352 __le32 num_missed_bcon; /* number of missed beacons */
1353 __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
1354 * ADC was in saturation */
1355 __le32 ina_detection_search_time;/* total time (in 0.8us) searched
1356 * for INA */
1357 __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
1358 __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
1359 __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
1360 __le32 interference_data_flag; /* flag for interference data
1361 * availability. 1 when data is
1362 * available. */
1363 __le32 channel_load; /* counts RX Enable time */
1364 __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
1365 * and CCK) counter */
1366 __le32 beacon_rssi_a;
1367 __le32 beacon_rssi_b;
1368 __le32 beacon_rssi_c;
1369 __le32 beacon_energy_a;
1370 __le32 beacon_energy_b;
1371 __le32 beacon_energy_c;
1372 } __attribute__ ((packed));
1374 struct statistics_rx {
1375 struct statistics_rx_phy ofdm;
1376 struct statistics_rx_phy cck;
1377 struct statistics_rx_non_phy general;
1378 struct statistics_rx_ht_phy ofdm_ht;
1379 } __attribute__ ((packed));
1381 struct statistics_tx_non_phy_agg {
1382 __le32 ba_timeout;
1383 __le32 ba_reschedule_frames;
1384 __le32 scd_query_agg_frame_cnt;
1385 __le32 scd_query_no_agg;
1386 __le32 scd_query_agg;
1387 __le32 scd_query_mismatch;
1388 __le32 frame_not_ready;
1389 __le32 underrun;
1390 __le32 bt_prio_kill;
1391 __le32 rx_ba_rsp_cnt;
1392 __le32 reserved2;
1393 __le32 reserved3;
1394 } __attribute__ ((packed));
1396 struct statistics_tx {
1397 __le32 preamble_cnt;
1398 __le32 rx_detected_cnt;
1399 __le32 bt_prio_defer_cnt;
1400 __le32 bt_prio_kill_cnt;
1401 __le32 few_bytes_cnt;
1402 __le32 cts_timeout;
1403 __le32 ack_timeout;
1404 __le32 expected_ack_cnt;
1405 __le32 actual_ack_cnt;
1406 __le32 dump_msdu_cnt;
1407 __le32 burst_abort_next_frame_mismatch_cnt;
1408 __le32 burst_abort_missing_next_frame_cnt;
1409 __le32 cts_timeout_collision;
1410 __le32 ack_or_ba_timeout_collision;
1411 struct statistics_tx_non_phy_agg agg;
1412 } __attribute__ ((packed));
1414 struct statistics_dbg {
1415 __le32 burst_check;
1416 __le32 burst_count;
1417 __le32 reserved[4];
1418 } __attribute__ ((packed));
1420 struct statistics_div {
1421 __le32 tx_on_a;
1422 __le32 tx_on_b;
1423 __le32 exec_time;
1424 __le32 probe_time;
1425 __le32 reserved1;
1426 __le32 reserved2;
1427 } __attribute__ ((packed));
1429 struct statistics_general {
1430 __le32 temperature;
1431 __le32 temperature_m;
1432 struct statistics_dbg dbg;
1433 __le32 sleep_time;
1434 __le32 slots_out;
1435 __le32 slots_idle;
1436 __le32 ttl_timestamp;
1437 struct statistics_div div;
1438 __le32 rx_enable_counter;
1439 __le32 reserved1;
1440 __le32 reserved2;
1441 __le32 reserved3;
1442 } __attribute__ ((packed));
1445 * REPLY_STATISTICS_CMD = 0x9c,
1446 * 3945 and 4965 identical.
1448 * This command triggers an immediate response containing uCode statistics.
1449 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
1451 * If the CLEAR_STATS configuration flag is set, uCode will clear its
1452 * internal copy of the statistics (counters) after issuing the response.
1453 * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
1455 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
1456 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
1457 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
1459 #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
1460 #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
1461 struct iwl_statistics_cmd {
1462 __le32 configuration_flags; /* IWL_STATS_CONF_* */
1463 } __attribute__ ((packed));
1466 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
1468 * By default, uCode issues this notification after receiving a beacon
1469 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
1470 * REPLY_STATISTICS_CMD 0x9c, above.
1472 * Statistics counters continue to increment beacon after beacon, but are
1473 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
1474 * 0x9c with CLEAR_STATS bit set (see above).
1476 * uCode also issues this notification during scans. uCode clears statistics
1477 * appropriately so that each notification contains statistics for only the
1478 * one channel that has just been scanned.
1480 #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
1481 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
1482 struct iwl_notif_statistics {
1483 __le32 flag;
1484 struct statistics_rx rx;
1485 struct statistics_tx tx;
1486 struct statistics_general general;
1487 } __attribute__ ((packed));
1491 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
1493 /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
1494 * then this notification will be sent. */
1495 #define CONSECUTIVE_MISSED_BCONS_TH 20
1497 struct iwl_missed_beacon_notif {
1498 __le32 consequtive_missed_beacons;
1499 __le32 total_missed_becons;
1500 __le32 num_expected_beacons;
1501 __le32 num_recvd_beacons;
1502 } __attribute__ ((packed));
1504 /******************************************************************************
1505 * (11)
1506 * Rx Calibration Commands:
1508 *****************************************************************************/
1510 #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1511 #define HD_TABLE_SIZE (11)
1513 struct iwl_sensitivity_cmd {
1514 __le16 control;
1515 __le16 table[HD_TABLE_SIZE];
1516 } __attribute__ ((packed));
1518 struct iwl_calibration_cmd {
1519 u8 opCode;
1520 u8 flags;
1521 __le16 reserved;
1522 s8 diff_gain_a;
1523 s8 diff_gain_b;
1524 s8 diff_gain_c;
1525 u8 reserved1;
1526 } __attribute__ ((packed));
1528 /******************************************************************************
1529 * (12)
1530 * Miscellaneous Commands:
1532 *****************************************************************************/
1535 * LEDs Command & Response
1536 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
1538 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
1539 * this command turns it on or off, or sets up a periodic blinking cycle.
1541 struct iwl_led_cmd {
1542 __le32 interval; /* "interval" in uSec */
1543 u8 id; /* 1: Activity, 2: Link, 3: Tech */
1544 u8 off; /* # intervals off while blinking;
1545 * "0", with >0 "on" value, turns LED on */
1546 u8 on; /* # intervals on while blinking;
1547 * "0", regardless of "off", turns LED off */
1548 u8 reserved;
1549 } __attribute__ ((packed));
1551 /******************************************************************************
1552 * (13)
1553 * Union of all expected notifications/responses:
1555 *****************************************************************************/
1557 struct iwl_rx_packet {
1558 __le32 len;
1559 struct iwl_cmd_header hdr;
1560 union {
1561 struct iwl_alive_resp alive_frame;
1562 struct iwl_rx_frame rx_frame;
1563 struct iwl_tx_resp tx_resp;
1564 struct iwl_spectrum_notification spectrum_notif;
1565 struct iwl_csa_notification csa_notif;
1566 struct iwl_error_resp err_resp;
1567 struct iwl_card_state_notif card_state_notif;
1568 struct iwl_beacon_notif beacon_status;
1569 struct iwl_add_sta_resp add_sta;
1570 struct iwl_sleep_notification sleep_notif;
1571 struct iwl_spectrum_resp spectrum;
1572 struct iwl_notif_statistics stats;
1573 struct iwl_compressed_ba_resp compressed_ba;
1574 struct iwl_missed_beacon_notif missed_beacon;
1575 __le32 status;
1576 u8 raw[0];
1577 } u;
1578 } __attribute__ ((packed));
1580 #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame))
1582 #endif /* __iwl_commands_h__ */