iwlwifi: Add comments to some driver data structures
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-4965-commands.h
CommitLineData
b481de9c
ZY
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
01ebd063 11 * it under the terms of version 2 of the GNU General Public License as
b481de9c
ZY
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63
bb8c093b
CH
64#ifndef __iwl4965_commands_h__
65#define __iwl4965_commands_h__
b481de9c
ZY
66
67enum {
68 REPLY_ALIVE = 0x1,
69 REPLY_ERROR = 0x2,
70
71 /* RXON and QOS commands */
72 REPLY_RXON = 0x10,
73 REPLY_RXON_ASSOC = 0x11,
74 REPLY_QOS_PARAM = 0x13,
75 REPLY_RXON_TIMING = 0x14,
76
77 /* Multi-Station support */
78 REPLY_ADD_STA = 0x18,
79 REPLY_REMOVE_STA = 0x19, /* not used */
80 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
81
82 /* RX, TX, LEDs */
b481de9c
ZY
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 */
87
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,
95
96 /* Power Management */
97 POWER_TABLE_CMD = 0x77,
98 PM_SLEEP_NOTIFICATION = 0x7A,
99 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
100
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,
107
108 /* IBSS/AP commands */
109 BEACON_NOTIFICATION = 0x90,
110 REPLY_TX_BEACON = 0x91,
111 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
112
113 /* Miscellaneous commands */
114 QUIET_NOTIFICATION = 0x96, /* not used */
115 REPLY_TX_PWR_TABLE_CMD = 0x97,
116 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
117
118 /* BT config command */
119 REPLY_BT_CONFIG = 0x9b,
120
121 /* 4965 Statistics */
122 REPLY_STATISTICS_CMD = 0x9c,
123 STATISTICS_NOTIFICATION = 0x9d,
124
125 /* RF-KILL commands and notifications */
126 REPLY_CARD_STATE_CMD = 0xa0,
127 CARD_STATE_NOTIFICATION = 0xa1,
128
129 /* Missed beacons notification */
130 MISSED_BEACONS_NOTIFICATION = 0xa2,
131
b481de9c
ZY
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,
b481de9c
ZY
139 REPLY_MAX = 0xff
140};
141
142/******************************************************************************
143 * (0)
144 * Header
145 *
146 *****************************************************************************/
147
148#define IWL_CMD_FAILED_MSK 0x40
149
bb8c093b 150struct iwl4965_cmd_header {
b481de9c
ZY
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:
156 *
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)
162 *
163 */
164 __le16 sequence;
165
166 /* command data follows immediately */
167 u8 data[0];
168} __attribute__ ((packed));
169
170/******************************************************************************
171 * (0a)
172 * Alive and Error Commands & Responses:
173 *
174 *****************************************************************************/
175
176#define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
177#define INITIALIZE_SUBTYPE (9)
178
179/*
180 * REPLY_ALIVE = 0x1 (response only, not a command)
181 */
bb8c093b 182struct iwl4965_alive_resp {
b481de9c
ZY
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));
195
bb8c093b 196struct iwl4965_init_alive_resp {
b481de9c
ZY
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;
208
b481de9c
ZY
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 */
b481de9c
ZY
217} __attribute__ ((packed));
218
219union tsf {
220 u8 byte[8];
221 __le16 word[4];
222 __le32 dw[2];
223};
224
225/*
226 * REPLY_ERROR = 0x2 (response only, not a command)
227 */
bb8c093b 228struct iwl4965_error_resp {
b481de9c
ZY
229 __le32 error_type;
230 u8 cmd_id;
231 u8 reserved1;
232 __le16 bad_cmd_seq_num;
b481de9c
ZY
233 __le32 error_info;
234 union tsf timestamp;
235} __attribute__ ((packed));
236
237/******************************************************************************
238 * (1)
239 * RXON Commands & Responses:
240 *
241 *****************************************************************************/
242
243/*
244 * Rx config defines & structure
245 */
246/* rx_config device types */
247enum {
248 RXON_DEV_TYPE_AP = 1,
249 RXON_DEV_TYPE_ESS = 3,
250 RXON_DEV_TYPE_IBSS = 4,
251 RXON_DEV_TYPE_SNIFFER = 6,
252};
253
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)
276
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)
292
293/*
294 * REPLY_RXON = 0x10 (command, has simple generic response)
295 */
bb8c093b 296struct iwl4965_rxon_cmd {
b481de9c
ZY
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;
b481de9c 305 __le16 rx_chain;
b481de9c
ZY
306 u8 ofdm_basic_rates;
307 u8 cck_basic_rates;
308 __le16 assoc_id;
309 __le32 flags;
310 __le32 filter_flags;
311 __le16 channel;
b481de9c
ZY
312 u8 ofdm_ht_single_stream_basic_rates;
313 u8 ofdm_ht_dual_stream_basic_rates;
b481de9c
ZY
314} __attribute__ ((packed));
315
316/*
317 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
318 */
bb8c093b 319struct iwl4965_rxon_assoc_cmd {
b481de9c
ZY
320 __le32 flags;
321 __le32 filter_flags;
322 u8 ofdm_basic_rates;
323 u8 cck_basic_rates;
b481de9c
ZY
324 u8 ofdm_ht_single_stream_basic_rates;
325 u8 ofdm_ht_dual_stream_basic_rates;
326 __le16 rx_chain_select_flags;
b481de9c
ZY
327 __le16 reserved;
328} __attribute__ ((packed));
329
330/*
331 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
332 */
bb8c093b 333struct iwl4965_rxon_time_cmd {
b481de9c
ZY
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));
341
bb8c093b 342struct iwl4965_tx_power {
b481de9c
ZY
343 u8 tx_gain; /* gain for analog radio */
344 u8 dsp_atten; /* gain for DSP */
345} __attribute__ ((packed));
346
b481de9c
ZY
347#define POWER_TABLE_NUM_ENTRIES 33
348#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
349#define POWER_TABLE_CCK_ENTRY 32
350struct tx_power_dual_stream {
351 __le32 dw;
352} __attribute__ ((packed));
353
bb8c093b 354struct iwl4965_tx_power_db {
b481de9c
ZY
355 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
356} __attribute__ ((packed));
b481de9c
ZY
357
358/*
359 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
360 */
bb8c093b 361struct iwl4965_channel_switch_cmd {
b481de9c
ZY
362 u8 band;
363 u8 expect_beacon;
364 __le16 channel;
365 __le32 rxon_flags;
366 __le32 rxon_filter_flags;
367 __le32 switch_time;
bb8c093b 368 struct iwl4965_tx_power_db tx_power;
b481de9c
ZY
369} __attribute__ ((packed));
370
371/*
372 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
373 */
bb8c093b 374struct iwl4965_csa_notification {
b481de9c
ZY
375 __le16 band;
376 __le16 channel;
377 __le32 status; /* 0 - OK, 1 - fail */
378} __attribute__ ((packed));
379
380/******************************************************************************
381 * (2)
382 * Quality-of-Service (QOS) Commands & Responses:
383 *
384 *****************************************************************************/
bb8c093b 385struct iwl4965_ac_qos {
b481de9c
ZY
386 __le16 cw_min;
387 __le16 cw_max;
388 u8 aifsn;
389 u8 reserved1;
390 __le16 edca_txop;
391} __attribute__ ((packed));
392
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)
397
398/*
399 * TXFIFO Queue number defines
400 */
401/* number of Access categories (AC) (EDCA), queues 0..3 */
402#define AC_NUM 4
403
404/*
405 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
406 */
bb8c093b 407struct iwl4965_qosparam_cmd {
b481de9c 408 __le32 qos_flags;
bb8c093b 409 struct iwl4965_ac_qos ac[AC_NUM];
b481de9c
ZY
410} __attribute__ ((packed));
411
412/******************************************************************************
413 * (3)
414 * Add/Modify Stations Commands & Responses:
415 *
416 *****************************************************************************/
417/*
418 * Multi station support
419 */
420#define IWL_AP_ID 0
421#define IWL_MULTICAST_ID 1
422#define IWL_STA_ID 2
423
424#define IWL3945_BROADCAST_ID 24
425#define IWL3945_STATION_COUNT 25
426
427#define IWL4965_BROADCAST_ID 31
428#define IWL4965_STATION_COUNT 32
429
430#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
431#define IWL_INVALID_STATION 255
432
b481de9c
ZY
433#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
434
435#define STA_CONTROL_MODIFY_MSK 0x01
436
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)
443
444#define STA_KEY_FLG_KEYID_POS 8
445#define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
446
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))
454
455/*
456 * Antenna masks:
457 * bit14:15 01 B inactive, A active
458 * 10 B active, A inactive
459 * 11 Both active
460 */
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
466
bb8c093b 467struct iwl4965_keyinfo {
b481de9c
ZY
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));
475
476struct 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));
483
484/*
485 * REPLY_ADD_STA = 0x18 (command)
486 */
bb8c093b 487struct iwl4965_addsta_cmd {
b481de9c
ZY
488 u8 mode;
489 u8 reserved[3];
490 struct sta_id_modify sta;
bb8c093b 491 struct iwl4965_keyinfo key;
b481de9c
ZY
492 __le32 station_flags;
493 __le32 station_flags_msk;
494 __le16 tid_disable_tx;
b481de9c 495 __le16 reserved1;
b481de9c
ZY
496 u8 add_immediate_ba_tid;
497 u8 remove_immediate_ba_tid;
498 __le16 add_immediate_ba_ssn;
b481de9c 499 __le32 reserved2;
b481de9c
ZY
500} __attribute__ ((packed));
501
502/*
503 * REPLY_ADD_STA = 0x18 (response)
504 */
bb8c093b 505struct iwl4965_add_sta_resp {
b481de9c
ZY
506 u8 status;
507} __attribute__ ((packed));
508
509#define ADD_STA_SUCCESS_MSK 0x1
510
511/******************************************************************************
512 * (4)
513 * Rx Responses:
514 *
515 *****************************************************************************/
516
bb8c093b 517struct iwl4965_rx_frame_stats {
b481de9c
ZY
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));
526
bb8c093b 527struct iwl4965_rx_frame_hdr {
b481de9c
ZY
528 __le16 channel;
529 __le16 phy_flags;
530 u8 reserved1;
531 u8 rate;
532 __le16 len;
533 u8 payload[0];
534} __attribute__ ((packed));
535
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)
538
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)
544
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)
550
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)
556
bb8c093b 557struct iwl4965_rx_frame_end {
b481de9c
ZY
558 __le32 status;
559 __le64 timestamp;
560 __le32 beacon_timestamp;
561} __attribute__ ((packed));
562
563/*
564 * REPLY_3945_RX = 0x1b (response only, not a command)
565 *
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
570 */
bb8c093b
CH
571struct iwl4965_rx_frame {
572 struct iwl4965_rx_frame_stats stats;
573 struct iwl4965_rx_frame_hdr hdr;
574 struct iwl4965_rx_frame_end end;
b481de9c
ZY
575} __attribute__ ((packed));
576
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)
582struct 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));
588
589/*
590 * REPLY_4965_RX = 0xc3 (response only, not a command)
591 * Used only for legacy (non 11n) frames.
592 */
593#define RX_RES_PHY_CNT 14
594struct 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));
609
610struct iwl4965_rx_mpdu_res_start {
611 __le16 byte_count;
612 __le16 reserved;
613} __attribute__ ((packed));
614
615
616/******************************************************************************
617 * (5)
618 * Tx Commands & Responses:
619 *
620 *****************************************************************************/
621
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)
632
633/* ucode ignores BT priority for this frame */
634#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
635
636/* ucode overrides sequence control */
637#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
638
639/* signal that this frame is non-last MPDU */
640#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
641
642/* calculate TSF in outgoing frame */
643#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
644
645/* activate TX calibration. */
646#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
647
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)
651
652/* HCCA-AP - disable duration overwriting. */
653#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
654
655/*
656 * TX command security control
657 */
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
664
665/*
666 * TX command Frame life time
667 */
668
bb8c093b 669struct iwl4965_dram_scratch {
b481de9c
ZY
670 u8 try_cnt;
671 u8 bt_kill_cnt;
672 __le16 reserved;
673} __attribute__ ((packed));
674
675/*
676 * REPLY_TX = 0x1c (command)
677 */
bb8c093b 678struct iwl4965_tx_cmd {
b481de9c
ZY
679 __le16 len;
680 __le16 next_frame_len;
681 __le32 tx_flags;
bb8c093b 682 struct iwl4965_dram_scratch scratch;
b481de9c
ZY
683 __le32 rate_n_flags;
684 u8 sta_id;
b481de9c 685 u8 sec_ctl;
b481de9c
ZY
686 u8 initial_rate_index;
687 u8 reserved;
b481de9c 688 u8 key[16];
b481de9c
ZY
689 __le16 next_frame_flags;
690 __le16 reserved2;
b481de9c
ZY
691 union {
692 __le32 life_time;
693 __le32 attempt;
694 } stop_time;
b481de9c
ZY
695 __le32 dram_lsb_ptr;
696 u8 dram_msb_ptr;
b481de9c
ZY
697 u8 rts_retry_limit; /*byte 50 */
698 u8 data_retry_limit; /*byte 51 */
b481de9c 699 u8 tid_tspec;
b481de9c
ZY
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));
708
709/* TX command response is sent after *all* transmission attempts.
710 *
711 * NOTES:
712 *
713 * TX_STATUS_FAIL_NEXT_FRAG
714 *
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'.
718 *
719 * TX_STATUS_FIFO_UNDERRUN
720 *
721 * Indicates the host did not provide bytes to the FIFO fast enough while
722 * a TX was in progress.
723 *
724 * TX_STATUS_FAIL_MGMNT_ABORT
725 *
726 * This status is only possible if the ABORT ON MGMT RX parameter was
727 * set to true with the TX command.
728 *
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.
735 */
736enum {
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,
755};
756
757#define TX_PACKET_MODE_REGULAR 0x0000
758#define TX_PACKET_MODE_BURST_SEQ 0x0100
759#define TX_PACKET_MODE_BURST_FIRST 0x0200
760
761enum {
762 TX_POWER_PA_NOT_ACTIVE = 0x0,
763};
764
765enum {
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 */
774};
775
776/* *******************************
777 * TX aggregation state
778 ******************************* */
779
780enum {
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
794};
795
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)
800
801#define AGG_TX_STATE_TRY_CNT_POS 12
802#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
803
804#define AGG_TX_STATE_SEQ_NUM_POS 16
805#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
806
807/*
808 * REPLY_TX = 0x1c (response)
809 */
bb8c093b 810struct iwl4965_tx_resp {
b481de9c
ZY
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));
822
b481de9c
ZY
823/*
824 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
825 */
bb8c093b 826struct iwl4965_compressed_ba_resp {
b481de9c
ZY
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));
838
839/*
840 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
841 */
bb8c093b 842struct iwl4965_txpowertable_cmd {
b481de9c
ZY
843 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
844 u8 reserved;
845 __le16 channel;
bb8c093b 846 struct iwl4965_tx_power_db tx_power;
b481de9c
ZY
847} __attribute__ ((packed));
848
b481de9c
ZY
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)
851
852#define LINK_QUAL_AC_NUM AC_NUM
853#define LINK_QUAL_MAX_RETRY_NUM 16
854
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)
858
bb8c093b 859struct iwl4965_link_qual_general_params {
b481de9c
ZY
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));
866
bb8c093b 867struct iwl4965_link_qual_agg_params {
b481de9c
ZY
868 __le16 agg_time_limit;
869 u8 agg_dis_start_th;
870 u8 agg_frame_cnt_limit;
871 __le32 reserved;
872} __attribute__ ((packed));
873
874/*
875 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
876 */
bb8c093b 877struct iwl4965_link_quality_cmd {
b481de9c
ZY
878 u8 sta_id;
879 u8 reserved1;
880 __le16 control;
bb8c093b
CH
881 struct iwl4965_link_qual_general_params general_params;
882 struct iwl4965_link_qual_agg_params agg_params;
b481de9c
ZY
883 struct {
884 __le32 rate_n_flags;
885 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
886 __le32 reserved2;
887} __attribute__ ((packed));
b481de9c
ZY
888
889/*
890 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
891 */
bb8c093b 892struct iwl4965_bt_cmd {
b481de9c
ZY
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));
900
901/******************************************************************************
902 * (6)
903 * Spectrum Management (802.11h) Commands, Responses, Notifications:
904 *
905 *****************************************************************************/
906
907/*
908 * Spectrum Management
909 */
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)
917
bb8c093b 918struct iwl4965_measure_channel {
b481de9c
ZY
919 __le32 duration; /* measurement duration in extended beacon
920 * format */
921 u8 channel; /* channel to measure */
bb8c093b 922 u8 type; /* see enum iwl4965_measure_type */
b481de9c
ZY
923 __le16 reserved;
924} __attribute__ ((packed));
925
926/*
927 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
928 */
bb8c093b 929struct iwl4965_spectrum_cmd {
b481de9c
ZY
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;
bb8c093b 942 struct iwl4965_measure_channel channels[10];
b481de9c
ZY
943} __attribute__ ((packed));
944
945/*
946 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
947 */
bb8c093b 948struct iwl4965_spectrum_resp {
b481de9c
ZY
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));
955
bb8c093b 956enum iwl4965_measurement_state {
b481de9c
ZY
957 IWL_MEASUREMENT_START = 0,
958 IWL_MEASUREMENT_STOP = 1,
959};
960
bb8c093b 961enum iwl4965_measurement_status {
b481de9c
ZY
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,
970};
971
972#define NUM_ELEMENTS_IN_HISTOGRAM 8
973
bb8c093b 974struct iwl4965_measurement_histogram {
b481de9c
ZY
975 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
976 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
977} __attribute__ ((packed));
978
979/* clear channel availability counters */
bb8c093b 980struct iwl4965_measurement_cca_counters {
b481de9c
ZY
981 __le32 ofdm;
982 __le32 cck;
983} __attribute__ ((packed));
984
bb8c093b 985enum iwl4965_measure_type {
b481de9c
ZY
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),
993};
994
995/*
996 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
997 */
bb8c093b 998struct iwl4965_spectrum_notification {
b481de9c
ZY
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;
bb8c093b 1006 u8 type; /* see enum iwl4965_measurement_type */
b481de9c
ZY
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];
bb8c093b 1016 struct iwl4965_measurement_histogram histogram;
b481de9c 1017 __le32 stop_time; /* lower 32-bits of TSF */
bb8c093b 1018 __le32 status; /* see iwl4965_measurement_status */
b481de9c
ZY
1019} __attribute__ ((packed));
1020
1021/******************************************************************************
1022 * (7)
1023 * Power Management Commands, Responses, Notifications:
1024 *
1025 *****************************************************************************/
1026
1027/**
bb8c093b 1028 * struct iwl4965_powertable_cmd - Power Table Command
b481de9c
ZY
1029 * @flags: See below:
1030 *
1031 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
1032 *
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
1050 *
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.
1054 */
1055#define IWL_POWER_VEC_SIZE 5
1056
b481de9c
ZY
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)
1060
bb8c093b 1061struct iwl4965_powertable_cmd {
b481de9c
ZY
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));
b481de9c
ZY
1070
1071/*
1072 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1073 * 3945 and 4965 identical.
1074 */
bb8c093b 1075struct iwl4965_sleep_notification {
b481de9c
ZY
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));
1083
1084/* Sleep states. 3945 and 4965 identical. */
1085enum {
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,
1097};
1098
1099/*
1100 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
1101 */
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 */
bb8c093b 1105struct iwl4965_card_state_cmd {
b481de9c
ZY
1106 __le32 status; /* CARD_STATE_CMD_* request new power state */
1107} __attribute__ ((packed));
1108
1109/*
1110 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1111 */
bb8c093b 1112struct iwl4965_card_state_notif {
b481de9c
ZY
1113 __le32 flags;
1114} __attribute__ ((packed));
1115
1116#define HW_CARD_DISABLED 0x01
1117#define SW_CARD_DISABLED 0x02
1118#define RF_CARD_DISABLED 0x04
1119#define RXON_CARD_DISABLED 0x10
1120
bb8c093b 1121struct iwl4965_ct_kill_config {
b481de9c
ZY
1122 __le32 reserved;
1123 __le32 critical_temperature_M;
1124 __le32 critical_temperature_R;
1125} __attribute__ ((packed));
1126
1127/******************************************************************************
1128 * (8)
1129 * Scan Commands, Responses, Notifications:
1130 *
1131 *****************************************************************************/
1132
bb8c093b 1133struct iwl4965_scan_channel {
b481de9c
ZY
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
1139 */
1140 u8 type;
1141 u8 channel;
bb8c093b 1142 struct iwl4965_tx_power tpc;
b481de9c
ZY
1143 __le16 active_dwell;
1144 __le16 passive_dwell;
1145} __attribute__ ((packed));
1146
bb8c093b 1147struct iwl4965_ssid_ie {
b481de9c
ZY
1148 u8 id;
1149 u8 len;
1150 u8 ssid[32];
1151} __attribute__ ((packed));
1152
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
1157
1158/*
1159 * REPLY_SCAN_CMD = 0x80 (command)
1160 */
bb8c093b 1161struct iwl4965_scan_cmd {
b481de9c
ZY
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 */
b481de9c 1169 __le16 rx_chain;
b481de9c
ZY
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.
1176 */
1177 __le32 flags;
1178 __le32 filter_flags;
1179
bb8c093b
CH
1180 struct iwl4965_tx_cmd tx_cmd;
1181 struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
b481de9c
ZY
1182
1183 u8 data[0];
1184 /*
1185 * The channels start after the probe request payload and are of type:
1186 *
bb8c093b 1187 * struct iwl4965_scan_channel channels[0];
b481de9c
ZY
1188 *
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)
1192 *
1193 */
1194} __attribute__ ((packed));
1195
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
1200
1201/*
1202 * REPLY_SCAN_CMD = 0x80 (response)
1203 */
bb8c093b 1204struct iwl4965_scanreq_notification {
b481de9c
ZY
1205 __le32 status; /* 1: okay, 2: cannot fulfill request */
1206} __attribute__ ((packed));
1207
1208/*
1209 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1210 */
bb8c093b 1211struct iwl4965_scanstart_notification {
b481de9c
ZY
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));
1220
1221#define SCAN_OWNER_STATUS 0x1;
1222#define MEASURE_OWNER_STATUS 0x2;
1223
1224#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
1225/*
1226 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1227 */
bb8c093b 1228struct iwl4965_scanresults_notification {
b481de9c
ZY
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));
1236
1237/*
1238 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1239 */
bb8c093b 1240struct iwl4965_scancomplete_notification {
b481de9c
ZY
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));
1248
1249
1250/******************************************************************************
1251 * (9)
1252 * IBSS/AP Commands and Notifications:
1253 *
1254 *****************************************************************************/
1255
1256/*
1257 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1258 */
bb8c093b
CH
1259struct iwl4965_beacon_notif {
1260 struct iwl4965_tx_resp beacon_notify_hdr;
b481de9c
ZY
1261 __le32 low_tsf;
1262 __le32 high_tsf;
1263 __le32 ibss_mgr_status;
1264} __attribute__ ((packed));
1265
1266/*
1267 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1268 */
bb8c093b
CH
1269struct iwl4965_tx_beacon_cmd {
1270 struct iwl4965_tx_cmd tx;
b481de9c
ZY
1271 __le16 tim_idx;
1272 u8 tim_size;
1273 u8 reserved1;
1274 struct ieee80211_hdr frame[0]; /* beacon frame */
1275} __attribute__ ((packed));
1276
1277/******************************************************************************
1278 * (10)
1279 * Statistics Commands and Notifications:
1280 *
1281 *****************************************************************************/
1282
1283#define IWL_TEMP_CONVERT 260
1284
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
1288
1289/* Used for passing to driver number of successes and failures per rate */
1290struct 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));
1302
1303/* statistics command response */
1304
1305struct 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;
b481de9c
ZY
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;
b481de9c
ZY
1326} __attribute__ ((packed));
1327
b481de9c
ZY
1328struct 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));
b481de9c
ZY
1340
1341struct 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 */
b481de9c
ZY
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;
b481de9c
ZY
1372} __attribute__ ((packed));
1373
1374struct statistics_rx {
1375 struct statistics_rx_phy ofdm;
1376 struct statistics_rx_phy cck;
1377 struct statistics_rx_non_phy general;
b481de9c 1378 struct statistics_rx_ht_phy ofdm_ht;
b481de9c
ZY
1379} __attribute__ ((packed));
1380
b481de9c
ZY
1381struct 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));
b481de9c
ZY
1395
1396struct 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;
b481de9c
ZY
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;
b481de9c
ZY
1412} __attribute__ ((packed));
1413
1414struct statistics_dbg {
1415 __le32 burst_check;
1416 __le32 burst_count;
1417 __le32 reserved[4];
1418} __attribute__ ((packed));
1419
1420struct statistics_div {
1421 __le32 tx_on_a;
1422 __le32 tx_on_b;
1423 __le32 exec_time;
1424 __le32 probe_time;
b481de9c
ZY
1425 __le32 reserved1;
1426 __le32 reserved2;
b481de9c
ZY
1427} __attribute__ ((packed));
1428
1429struct statistics_general {
1430 __le32 temperature;
b481de9c 1431 __le32 temperature_m;
b481de9c
ZY
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;
b481de9c
ZY
1438 __le32 rx_enable_counter;
1439 __le32 reserved1;
1440 __le32 reserved2;
1441 __le32 reserved3;
b481de9c
ZY
1442} __attribute__ ((packed));
1443
1444/*
1445 * REPLY_STATISTICS_CMD = 0x9c,
1446 * 3945 and 4965 identical.
1447 *
1448 * This command triggers an immediate response containing uCode statistics.
1449 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
1450 *
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).
1454 *
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.
1458 */
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 */
bb8c093b 1461struct iwl4965_statistics_cmd {
b481de9c
ZY
1462 __le32 configuration_flags; /* IWL_STATS_CONF_* */
1463} __attribute__ ((packed));
1464
1465/*
1466 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
1467 *
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.
1471 *
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).
1475 *
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.
1479 */
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)
bb8c093b 1482struct iwl4965_notif_statistics {
b481de9c
ZY
1483 __le32 flag;
1484 struct statistics_rx rx;
1485 struct statistics_tx tx;
1486 struct statistics_general general;
1487} __attribute__ ((packed));
1488
1489
1490/*
1491 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
1492 */
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
1496
bb8c093b 1497struct iwl4965_missed_beacon_notif {
b481de9c
ZY
1498 __le32 consequtive_missed_beacons;
1499 __le32 total_missed_becons;
1500 __le32 num_expected_beacons;
1501 __le32 num_recvd_beacons;
1502} __attribute__ ((packed));
1503
1504/******************************************************************************
1505 * (11)
1506 * Rx Calibration Commands:
1507 *
1508 *****************************************************************************/
1509
1510#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1511#define HD_TABLE_SIZE (11)
1512
bb8c093b 1513struct iwl4965_sensitivity_cmd {
b481de9c
ZY
1514 __le16 control;
1515 __le16 table[HD_TABLE_SIZE];
1516} __attribute__ ((packed));
1517
bb8c093b 1518struct iwl4965_calibration_cmd {
b481de9c
ZY
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));
1527
1528/******************************************************************************
1529 * (12)
1530 * Miscellaneous Commands:
1531 *
1532 *****************************************************************************/
1533
1534/*
1535 * LEDs Command & Response
1536 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
1537 *
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.
1540 */
bb8c093b 1541struct iwl4965_led_cmd {
b481de9c
ZY
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));
1550
1551/******************************************************************************
1552 * (13)
1553 * Union of all expected notifications/responses:
1554 *
1555 *****************************************************************************/
1556
bb8c093b 1557struct iwl4965_rx_packet {
b481de9c 1558 __le32 len;
bb8c093b 1559 struct iwl4965_cmd_header hdr;
b481de9c 1560 union {
bb8c093b
CH
1561 struct iwl4965_alive_resp alive_frame;
1562 struct iwl4965_rx_frame rx_frame;
1563 struct iwl4965_tx_resp tx_resp;
1564 struct iwl4965_spectrum_notification spectrum_notif;
1565 struct iwl4965_csa_notification csa_notif;
1566 struct iwl4965_error_resp err_resp;
1567 struct iwl4965_card_state_notif card_state_notif;
1568 struct iwl4965_beacon_notif beacon_status;
1569 struct iwl4965_add_sta_resp add_sta;
1570 struct iwl4965_sleep_notification sleep_notif;
1571 struct iwl4965_spectrum_resp spectrum;
1572 struct iwl4965_notif_statistics stats;
1573 struct iwl4965_compressed_ba_resp compressed_ba;
1574 struct iwl4965_missed_beacon_notif missed_beacon;
b481de9c
ZY
1575 __le32 status;
1576 u8 raw[0];
1577 } u;
1578} __attribute__ ((packed));
1579
bb8c093b 1580#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame))
b481de9c 1581
bb8c093b 1582#endif /* __iwl4965_commands_h__ */
This page took 0.155489 seconds and 5 git commands to generate.