iwlagn: generic bt coex functions
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-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 *
1f447808 8 * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
b481de9c
ZY
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:
759ef89f 28 * Intel Linux Wireless <ilw@linux.intel.com>
b481de9c
ZY
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
1f447808 33 * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
b481de9c
ZY
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 *****************************************************************************/
fcd427bb 63/*
5a36ba0e 64 * Please use this file (iwl-commands.h) only for uCode API definitions.
767d055d 65 * Please use iwl-xxxx-hw.h for hardware-related definitions.
3e0d4cb1 66 * Please use iwl-dev.h for driver implementation definitions.
fcd427bb 67 */
b481de9c 68
6a63578d
EG
69#ifndef __iwl_commands_h__
70#define __iwl_commands_h__
b481de9c 71
a3139c59
SO
72struct iwl_priv;
73
c02b3acd
CR
74/* uCode version contains 4 values: Major/Minor/API/Serial */
75#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
76#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
77#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
78#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
79
4c897253
TW
80
81/* Tx rates */
82#define IWL_CCK_RATES 4
83#define IWL_OFDM_RATES 8
84#define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES)
85
b481de9c
ZY
86enum {
87 REPLY_ALIVE = 0x1,
88 REPLY_ERROR = 0x2,
89
90 /* RXON and QOS commands */
91 REPLY_RXON = 0x10,
92 REPLY_RXON_ASSOC = 0x11,
93 REPLY_QOS_PARAM = 0x13,
94 REPLY_RXON_TIMING = 0x14,
95
96 /* Multi-Station support */
97 REPLY_ADD_STA = 0x18,
fc66be2a 98 REPLY_REMOVE_STA = 0x19,
b481de9c 99 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
947279ee 100 REPLY_TXFIFO_FLUSH = 0x1e,
b481de9c 101
0a0bed1d
EG
102 /* Security */
103 REPLY_WEPKEY = 0x20,
104
b481de9c 105 /* RX, TX, LEDs */
2aa6ab86 106 REPLY_3945_RX = 0x1b, /* 3945 only */
b481de9c
ZY
107 REPLY_TX = 0x1c,
108 REPLY_RATE_SCALE = 0x47, /* 3945 only */
109 REPLY_LEDS_CMD = 0x48,
4c8d1913 110 REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */
b481de9c 111
9636e583 112 /* WiMAX coexistence */
d23000cd 113 COEX_PRIORITY_TABLE_CMD = 0x5a, /* for 5000 series and up */
9636e583
RR
114 COEX_MEDIUM_NOTIFICATION = 0x5b,
115 COEX_EVENT_CMD = 0x5c,
116
be5d56ed 117 /* Calibration */
1a5c3d61 118 TEMPERATURE_NOTIFICATION = 0x62,
be5d56ed
TW
119 CALIBRATION_CFG_CMD = 0x65,
120 CALIBRATION_RES_NOTIFICATION = 0x66,
121 CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
122
b481de9c 123 /* 802.11h related */
b481de9c
ZY
124 REPLY_QUIET_CMD = 0x71, /* not used */
125 REPLY_CHANNEL_SWITCH = 0x72,
126 CHANNEL_SWITCH_NOTIFICATION = 0x73,
127 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
128 SPECTRUM_MEASURE_NOTIFICATION = 0x75,
129
130 /* Power Management */
131 POWER_TABLE_CMD = 0x77,
132 PM_SLEEP_NOTIFICATION = 0x7A,
133 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
134
135 /* Scan commands and notifications */
136 REPLY_SCAN_CMD = 0x80,
137 REPLY_SCAN_ABORT_CMD = 0x81,
138 SCAN_START_NOTIFICATION = 0x82,
139 SCAN_RESULTS_NOTIFICATION = 0x83,
140 SCAN_COMPLETE_NOTIFICATION = 0x84,
141
142 /* IBSS/AP commands */
143 BEACON_NOTIFICATION = 0x90,
144 REPLY_TX_BEACON = 0x91,
145 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
146
147 /* Miscellaneous commands */
76a2407a 148 REPLY_TX_POWER_DBM_CMD = 0x95,
b481de9c
ZY
149 QUIET_NOTIFICATION = 0x96, /* not used */
150 REPLY_TX_PWR_TABLE_CMD = 0x97,
76a2407a 151 REPLY_TX_POWER_DBM_CMD_V1 = 0x98, /* old version of API */
2f748dec 152 TX_ANT_CONFIGURATION_CMD = 0x98,
b481de9c
ZY
153 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
154
a96a27f9 155 /* Bluetooth device coexistence config command */
b481de9c
ZY
156 REPLY_BT_CONFIG = 0x9b,
157
80cc0c38 158 /* Statistics */
b481de9c
ZY
159 REPLY_STATISTICS_CMD = 0x9c,
160 STATISTICS_NOTIFICATION = 0x9d,
161
162 /* RF-KILL commands and notifications */
163 REPLY_CARD_STATE_CMD = 0xa0,
164 CARD_STATE_NOTIFICATION = 0xa1,
165
166 /* Missed beacons notification */
167 MISSED_BEACONS_NOTIFICATION = 0xa2,
168
b481de9c
ZY
169 REPLY_CT_KILL_CONFIG_CMD = 0xa4,
170 SENSITIVITY_CMD = 0xa8,
171 REPLY_PHY_CALIBRATION_CMD = 0xb0,
172 REPLY_RX_PHY_CMD = 0xc0,
173 REPLY_RX_MPDU_CMD = 0xc1,
857485c0 174 REPLY_RX = 0xc3,
b481de9c 175 REPLY_COMPRESSED_BA = 0xc5,
0288d237
JB
176
177 /* BT Coex */
178 REPLY_BT_COEX_PRIO_TABLE = 0xcc,
179 REPLY_BT_COEX_PROT_ENV = 0xcd,
180 REPLY_BT_COEX_PROFILE_NOTIF = 0xce,
9e4afc21 181 REPLY_BT_COEX_SCO = 0xcf,
0288d237 182
b481de9c
ZY
183 REPLY_MAX = 0xff
184};
185
186/******************************************************************************
187 * (0)
abceddb4 188 * Commonly used structures and definitions:
80cc0c38 189 * Command header, rate_n_flags, txpower
b481de9c
ZY
190 *
191 *****************************************************************************/
192
857485c0 193/* iwl_cmd_header flags value */
b481de9c
ZY
194#define IWL_CMD_FAILED_MSK 0x40
195
9734cb23
TW
196#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
197#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
198#define SEQ_TO_INDEX(s) ((s) & 0xff)
199#define INDEX_TO_SEQ(i) ((i) & 0xff)
51e9bf5d
HH
200#define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
201#define SEQ_RX_FRAME cpu_to_le16(0x8000)
9734cb23 202
075416cd 203/**
857485c0 204 * struct iwl_cmd_header
075416cd
BC
205 *
206 * This header format appears in the beginning of each command sent from the
207 * driver, and each response/notification received from uCode.
208 */
857485c0 209struct iwl_cmd_header {
075416cd 210 u8 cmd; /* Command ID: REPLY_RXON, etc. */
9734cb23 211 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
075416cd 212 /*
a96a27f9 213 * The driver sets up the sequence number to values of its choosing.
075416cd
BC
214 * uCode does not use this value, but passes it back to the driver
215 * when sending the response to each driver-originated command, so
216 * the driver can match the response to the command. Since the values
217 * don't get used by uCode, the driver may set up an arbitrary format.
b481de9c 218 *
075416cd
BC
219 * There is one exception: uCode sets bit 15 when it originates
220 * the response/notification, i.e. when the response/notification
221 * is not a direct response to a command sent by the driver. For
222 * example, uCode issues REPLY_3945_RX when it sends a received frame
223 * to the driver; it is not a direct response to any driver command.
b481de9c 224 *
075416cd
BC
225 * The Linux driver uses the following format:
226 *
9734cb23
TW
227 * 0:7 tfd index - position within TX queue
228 * 8:12 TX queue id
229 * 13 reserved
230 * 14 huge - driver sets this to indicate command is in the
231 * 'huge' storage at the end of the command buffers
232 * 15 unsolicited RX or uCode-originated notification
b481de9c
ZY
233 */
234 __le16 sequence;
235
075416cd 236 /* command or response/notification data follows immediately */
b481de9c 237 u8 data[0];
ba2d3587 238} __packed;
b481de9c 239
3d24a9f7
TW
240
241/**
242 * struct iwl3945_tx_power
243 *
244 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
245 *
246 * Each entry contains two values:
247 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
248 * linear value that multiplies the output of the digital signal processor,
249 * before being sent to the analog radio.
250 * 2) Radio gain. This sets the analog gain of the radio Tx path.
251 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
252 *
253 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
254 */
255struct iwl3945_tx_power {
256 u8 tx_gain; /* gain for analog radio */
257 u8 dsp_atten; /* gain for DSP */
ba2d3587 258} __packed;
3d24a9f7
TW
259
260/**
261 * struct iwl3945_power_per_rate
262 *
263 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
264 */
265struct iwl3945_power_per_rate {
266 u8 rate; /* plcp */
267 struct iwl3945_tx_power tpc;
268 u8 reserved;
ba2d3587 269} __packed;
3d24a9f7 270
abceddb4 271/**
5c5aa3f1 272 * iwlagn rate_n_flags bit fields
abceddb4 273 *
5c5aa3f1 274 * rate_n_flags format is used in following iwlagn commands:
857485c0 275 * REPLY_RX (response only)
5c5aa3f1 276 * REPLY_RX_MPDU (response only)
abceddb4
BC
277 * REPLY_TX (both command and response)
278 * REPLY_TX_LINK_QUALITY_CMD
279 *
280 * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
281 * 2-0: 0) 6 Mbps
282 * 1) 12 Mbps
283 * 2) 18 Mbps
284 * 3) 24 Mbps
285 * 4) 36 Mbps
286 * 5) 48 Mbps
287 * 6) 54 Mbps
288 * 7) 60 Mbps
289 *
5c5aa3f1 290 * 4-3: 0) Single stream (SISO)
abceddb4 291 * 1) Dual stream (MIMO)
5c5aa3f1 292 * 2) Triple stream (MIMO)
abceddb4 293 *
7aafef1c 294 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
abceddb4
BC
295 *
296 * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
297 * 3-0: 0xD) 6 Mbps
298 * 0xF) 9 Mbps
299 * 0x5) 12 Mbps
300 * 0x7) 18 Mbps
301 * 0x9) 24 Mbps
302 * 0xB) 36 Mbps
303 * 0x1) 48 Mbps
304 * 0x3) 54 Mbps
305 *
306 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
10617879 307 * 6-0: 10) 1 Mbps
abceddb4
BC
308 * 20) 2 Mbps
309 * 55) 5.5 Mbps
310 * 110) 11 Mbps
311 */
312#define RATE_MCS_CODE_MSK 0x7
5c5aa3f1
HD
313#define RATE_MCS_SPATIAL_POS 3
314#define RATE_MCS_SPATIAL_MSK 0x18
abceddb4
BC
315#define RATE_MCS_HT_DUP_POS 5
316#define RATE_MCS_HT_DUP_MSK 0x20
317
075416cd 318/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
abceddb4
BC
319#define RATE_MCS_FLAGS_POS 8
320#define RATE_MCS_HT_POS 8
321#define RATE_MCS_HT_MSK 0x100
322
075416cd 323/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
abceddb4
BC
324#define RATE_MCS_CCK_POS 9
325#define RATE_MCS_CCK_MSK 0x200
326
075416cd 327/* Bit 10: (1) Use Green Field preamble */
abceddb4
BC
328#define RATE_MCS_GF_POS 10
329#define RATE_MCS_GF_MSK 0x400
330
7aafef1c
WYG
331/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
332#define RATE_MCS_HT40_POS 11
333#define RATE_MCS_HT40_MSK 0x800
abceddb4 334
7aafef1c 335/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
abceddb4
BC
336#define RATE_MCS_DUP_POS 12
337#define RATE_MCS_DUP_MSK 0x1000
338
075416cd 339/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
abceddb4
BC
340#define RATE_MCS_SGI_POS 13
341#define RATE_MCS_SGI_MSK 0x2000
342
343/**
76eff18b
TW
344 * rate_n_flags Tx antenna masks
345 * 4965 has 2 transmitters
346 * 5100 has 1 transmitter B
347 * 5150 has 1 transmitter A
348 * 5300 has 3 transmitters
349 * 5350 has 3 transmitters
350 * bit14:16
abceddb4 351 */
600c0e11
TW
352#define RATE_MCS_ANT_POS 14
353#define RATE_MCS_ANT_A_MSK 0x04000
354#define RATE_MCS_ANT_B_MSK 0x08000
355#define RATE_MCS_ANT_C_MSK 0x10000
356#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
357#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
76eff18b 358#define RATE_ANT_NUM 3
80cc0c38
BC
359
360#define POWER_TABLE_NUM_ENTRIES 33
361#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
362#define POWER_TABLE_CCK_ENTRY 32
363
e57f1489
WYG
364#define IWL_PWR_NUM_HT_OFDM_ENTRIES 24
365#define IWL_PWR_CCK_ENTRIES 2
366
80cc0c38
BC
367/**
368 * union iwl4965_tx_power_dual_stream
369 *
370 * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
371 * Use __le32 version (struct tx_power_dual_stream) when building command.
372 *
373 * Driver provides radio gain and DSP attenuation settings to device in pairs,
374 * one value for each transmitter chain. The first value is for transmitter A,
375 * second for transmitter B.
376 *
377 * For SISO bit rates, both values in a pair should be identical.
378 * For MIMO rates, one value may be different from the other,
379 * in order to balance the Tx output between the two transmitters.
380 *
381 * See more details in doc for TXPOWER in iwl-4965-hw.h.
382 */
383union iwl4965_tx_power_dual_stream {
384 struct {
385 u8 radio_tx_gain[2];
386 u8 dsp_predis_atten[2];
387 } s;
388 u32 dw;
389};
390
391/**
392 * struct tx_power_dual_stream
393 *
394 * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
395 *
396 * Same format as iwl_tx_power_dual_stream, but __le32
397 */
398struct tx_power_dual_stream {
399 __le32 dw;
ba2d3587 400} __packed;
80cc0c38
BC
401
402/**
403 * struct iwl4965_tx_power_db
404 *
405 * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
406 */
407struct iwl4965_tx_power_db {
408 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
ba2d3587 409} __packed;
80cc0c38 410
630fe9b6 411/**
a96a27f9 412 * Command REPLY_TX_POWER_DBM_CMD = 0x98
630fe9b6
TW
413 * struct iwl5000_tx_power_dbm_cmd
414 */
415#define IWL50_TX_POWER_AUTO 0x7f
853554ac
GG
416#define IWL50_TX_POWER_NO_CLOSED (0x1 << 6)
417
630fe9b6
TW
418struct iwl5000_tx_power_dbm_cmd {
419 s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
420 u8 flags;
421 s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
422 u8 reserved;
ba2d3587 423} __packed;
80cc0c38 424
2f748dec
WYG
425/**
426 * Command TX_ANT_CONFIGURATION_CMD = 0x98
427 * This command is used to configure valid Tx antenna.
428 * By default uCode concludes the valid antenna according to the radio flavor.
429 * This command enables the driver to override/modify this conclusion.
430 */
431struct iwl_tx_ant_config_cmd {
432 __le32 valid;
ba2d3587 433} __packed;
2f748dec 434
b481de9c
ZY
435/******************************************************************************
436 * (0a)
437 * Alive and Error Commands & Responses:
438 *
439 *****************************************************************************/
440
51e9bf5d 441#define UCODE_VALID_OK cpu_to_le32(0x1)
b481de9c
ZY
442#define INITIALIZE_SUBTYPE (9)
443
444/*
075416cd
BC
445 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
446 *
447 * uCode issues this "initialize alive" notification once the initialization
448 * uCode image has completed its work, and is ready to load the runtime image.
449 * This is the *first* "alive" notification that the driver will receive after
450 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
451 *
452 * See comments documenting "BSM" (bootstrap state machine).
453 *
454 * For 4965, this notification contains important calibration data for
455 * calculating txpower settings:
456 *
457 * 1) Power supply voltage indication. The voltage sensor outputs higher
a96a27f9 458 * values for lower voltage, and vice verse.
075416cd
BC
459 *
460 * 2) Temperature measurement parameters, for each of two channel widths
461 * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
462 * is done via one of the receiver chains, and channel width influences
463 * the results.
464 *
465 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
466 * for each of 5 frequency ranges.
b481de9c 467 */
885ba202 468struct iwl_init_alive_resp {
b481de9c
ZY
469 u8 ucode_minor;
470 u8 ucode_major;
471 __le16 reserved1;
472 u8 sw_rev[8];
473 u8 ver_type;
075416cd 474 u8 ver_subtype; /* "9" for initialize alive */
b481de9c
ZY
475 __le16 reserved2;
476 __le32 log_event_table_ptr;
477 __le32 error_event_table_ptr;
478 __le32 timestamp;
479 __le32 is_valid;
075416cd
BC
480
481 /* calibration values from "initialize" uCode */
482 __le32 voltage; /* signed, higher value is lower voltage */
7aafef1c 483 __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */
075416cd
BC
484 __le32 therm_r2[2]; /* signed */
485 __le32 therm_r3[2]; /* signed */
486 __le32 therm_r4[2]; /* signed */
487 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
488 * 2 Tx chains */
ba2d3587 489} __packed;
b481de9c 490
075416cd
BC
491
492/**
493 * REPLY_ALIVE = 0x1 (response only, not a command)
494 *
495 * uCode issues this "alive" notification once the runtime image is ready
496 * to receive commands from the driver. This is the *second* "alive"
497 * notification that the driver will receive after rebooting uCode;
498 * this "alive" is indicated by subtype field != 9.
499 *
500 * See comments documenting "BSM" (bootstrap state machine).
501 *
502 * This response includes two pointers to structures within the device's
503 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
504 *
505 * 1) log_event_table_ptr indicates base of the event log. This traces
506 * a 256-entry history of uCode execution within a circular buffer.
507 * Its header format is:
508 *
509 * __le32 log_size; log capacity (in number of entries)
510 * __le32 type; (1) timestamp with each entry, (0) no timestamp
511 * __le32 wraps; # times uCode has wrapped to top of circular buffer
512 * __le32 write_index; next circular buffer entry that uCode would fill
513 *
514 * The header is followed by the circular buffer of log entries. Entries
515 * with timestamps have the following format:
516 *
517 * __le32 event_id; range 0 - 1500
518 * __le32 timestamp; low 32 bits of TSF (of network, if associated)
519 * __le32 data; event_id-specific data value
520 *
521 * Entries without timestamps contain only event_id and data.
522 *
461ef382 523 *
075416cd 524 * 2) error_event_table_ptr indicates base of the error log. This contains
461ef382 525 * information about any uCode error that occurs. For agn, the format
075416cd
BC
526 * of the error log is:
527 *
528 * __le32 valid; (nonzero) valid, (0) log is empty
529 * __le32 error_id; type of error
530 * __le32 pc; program counter
531 * __le32 blink1; branch link
532 * __le32 blink2; branch link
533 * __le32 ilink1; interrupt link
534 * __le32 ilink2; interrupt link
535 * __le32 data1; error-specific data
536 * __le32 data2; error-specific data
537 * __le32 line; source code line of error
538 * __le32 bcon_time; beacon timer
539 * __le32 tsf_low; network timestamp function timer
540 * __le32 tsf_hi; network timestamp function timer
461ef382
WYG
541 * __le32 gp1; GP1 timer register
542 * __le32 gp2; GP2 timer register
543 * __le32 gp3; GP3 timer register
544 * __le32 ucode_ver; uCode version
545 * __le32 hw_ver; HW Silicon version
546 * __le32 brd_ver; HW board version
547 * __le32 log_pc; log program counter
548 * __le32 frame_ptr; frame pointer
549 * __le32 stack_ptr; stack pointer
550 * __le32 hcmd; last host command
551 * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
552 * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
553 * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
554 * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
555 * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
556 * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
557 * __le32 wait_event; wait event() caller address
558 * __le32 l2p_control; L2pControlField
559 * __le32 l2p_duration; L2pDurationField
560 * __le32 l2p_mhvalid; L2pMhValidBits
561 * __le32 l2p_addr_match; L2pAddrMatchStat
562 * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
563 * __le32 u_timestamp; indicate when the date and time of the compilation
564 * __le32 reserved;
075416cd
BC
565 *
566 * The Linux driver can print both logs to the system log when a uCode error
567 * occurs.
568 */
885ba202 569struct iwl_alive_resp {
b481de9c
ZY
570 u8 ucode_minor;
571 u8 ucode_major;
572 __le16 reserved1;
573 u8 sw_rev[8];
574 u8 ver_type;
075416cd 575 u8 ver_subtype; /* not "9" for runtime alive */
b481de9c 576 __le16 reserved2;
075416cd
BC
577 __le32 log_event_table_ptr; /* SRAM address for event log */
578 __le32 error_event_table_ptr; /* SRAM address for error log */
b481de9c
ZY
579 __le32 timestamp;
580 __le32 is_valid;
ba2d3587 581} __packed;
b481de9c 582
b481de9c
ZY
583/*
584 * REPLY_ERROR = 0x2 (response only, not a command)
585 */
885ba202 586struct iwl_error_resp {
b481de9c
ZY
587 __le32 error_type;
588 u8 cmd_id;
589 u8 reserved1;
590 __le16 bad_cmd_seq_num;
b481de9c 591 __le32 error_info;
3195c1f3 592 __le64 timestamp;
ba2d3587 593} __packed;
b481de9c
ZY
594
595/******************************************************************************
596 * (1)
597 * RXON Commands & Responses:
598 *
599 *****************************************************************************/
600
601/*
602 * Rx config defines & structure
603 */
604/* rx_config device types */
605enum {
606 RXON_DEV_TYPE_AP = 1,
607 RXON_DEV_TYPE_ESS = 3,
608 RXON_DEV_TYPE_IBSS = 4,
609 RXON_DEV_TYPE_SNIFFER = 6,
610};
611
14519a0b 612
51e9bf5d 613#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
7b841727 614#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
51e9bf5d 615#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
14519a0b 616#define RXON_RX_CHAIN_VALID_POS (1)
51e9bf5d 617#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
14519a0b 618#define RXON_RX_CHAIN_FORCE_SEL_POS (4)
51e9bf5d 619#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
14519a0b 620#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
51e9bf5d 621#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
14519a0b 622#define RXON_RX_CHAIN_CNT_POS (10)
51e9bf5d 623#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
14519a0b 624#define RXON_RX_CHAIN_MIMO_CNT_POS (12)
51e9bf5d 625#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
14519a0b
BC
626#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
627
b481de9c
ZY
628/* rx_config flags */
629/* band & modulation selection */
51e9bf5d
HH
630#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
631#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
b481de9c 632/* auto detection enable */
51e9bf5d 633#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
b481de9c 634/* TGg protection when tx */
51e9bf5d 635#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
b481de9c 636/* cck short slot & preamble */
51e9bf5d
HH
637#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
638#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
b481de9c 639/* antenna selection */
51e9bf5d
HH
640#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
641#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
642#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
643#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
b481de9c 644/* radar detection enable */
51e9bf5d
HH
645#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
646#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
b481de9c
ZY
647/* rx response to host with 8-byte TSF
648* (according to ON_AIR deassertion) */
51e9bf5d 649#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
b481de9c 650
14519a0b
BC
651
652/* HT flags */
653#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
51e9bf5d 654#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
14519a0b
BC
655
656#define RXON_FLG_HT_OPERATING_MODE_POS (23)
657
51e9bf5d 658#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
7aafef1c 659#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
14519a0b
BC
660
661#define RXON_FLG_CHANNEL_MODE_POS (25)
51e9bf5d 662#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
a2b0f02e
WYG
663
664/* channel mode */
665enum {
666 CHANNEL_MODE_LEGACY = 0,
667 CHANNEL_MODE_PURE_40 = 1,
668 CHANNEL_MODE_MIXED = 2,
669 CHANNEL_MODE_RESERVED = 3,
670};
671#define RXON_FLG_CHANNEL_MODE_LEGACY cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
672#define RXON_FLG_CHANNEL_MODE_PURE_40 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
673#define RXON_FLG_CHANNEL_MODE_MIXED cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
674
a326a5d0 675/* CTS to self (if spec allows) flag */
51e9bf5d 676#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
14519a0b 677
b481de9c
ZY
678/* rx_config filter flags */
679/* accept all data frames */
51e9bf5d 680#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
b481de9c 681/* pass control & management to host */
51e9bf5d 682#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
b481de9c 683/* accept multi-cast */
51e9bf5d 684#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
b481de9c 685/* don't decrypt uni-cast frames */
51e9bf5d 686#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
b481de9c 687/* don't decrypt multi-cast frames */
51e9bf5d 688#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
b481de9c 689/* STA is associated */
51e9bf5d 690#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
b481de9c 691/* transfer to host non bssid beacons in associated state */
51e9bf5d 692#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
b481de9c 693
80cc0c38 694/**
b481de9c 695 * REPLY_RXON = 0x10 (command, has simple generic response)
80cc0c38
BC
696 *
697 * RXON tunes the radio tuner to a service channel, and sets up a number
698 * of parameters that are used primarily for Rx, but also for Tx operations.
699 *
700 * NOTE: When tuning to a new channel, driver must set the
701 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
702 * info within the device, including the station tables, tx retry
703 * rate tables, and txpower tables. Driver must build a new station
704 * table and txpower table before transmitting anything on the RXON
705 * channel.
706 *
707 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
708 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
709 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
b481de9c 710 */
3d24a9f7
TW
711
712struct iwl3945_rxon_cmd {
713 u8 node_addr[6];
714 __le16 reserved1;
715 u8 bssid_addr[6];
716 __le16 reserved2;
717 u8 wlap_bssid_addr[6];
718 __le16 reserved3;
719 u8 dev_type;
720 u8 air_propagation;
721 __le16 reserved4;
722 u8 ofdm_basic_rates;
723 u8 cck_basic_rates;
724 __le16 assoc_id;
725 __le32 flags;
726 __le32 filter_flags;
727 __le16 channel;
728 __le16 reserved5;
ba2d3587 729} __packed;
3d24a9f7 730
bb8c093b 731struct iwl4965_rxon_cmd {
b481de9c
ZY
732 u8 node_addr[6];
733 __le16 reserved1;
734 u8 bssid_addr[6];
735 __le16 reserved2;
736 u8 wlap_bssid_addr[6];
737 __le16 reserved3;
738 u8 dev_type;
739 u8 air_propagation;
b481de9c 740 __le16 rx_chain;
b481de9c
ZY
741 u8 ofdm_basic_rates;
742 u8 cck_basic_rates;
743 __le16 assoc_id;
744 __le32 flags;
745 __le32 filter_flags;
746 __le16 channel;
b481de9c
ZY
747 u8 ofdm_ht_single_stream_basic_rates;
748 u8 ofdm_ht_dual_stream_basic_rates;
ba2d3587 749} __packed;
b481de9c 750
a96a27f9 751/* 5000 HW just extend this command */
c1adf9fb
GG
752struct iwl_rxon_cmd {
753 u8 node_addr[6];
754 __le16 reserved1;
755 u8 bssid_addr[6];
756 __le16 reserved2;
757 u8 wlap_bssid_addr[6];
758 __le16 reserved3;
759 u8 dev_type;
760 u8 air_propagation;
761 __le16 rx_chain;
762 u8 ofdm_basic_rates;
763 u8 cck_basic_rates;
764 __le16 assoc_id;
765 __le32 flags;
766 __le32 filter_flags;
767 __le16 channel;
768 u8 ofdm_ht_single_stream_basic_rates;
769 u8 ofdm_ht_dual_stream_basic_rates;
770 u8 ofdm_ht_triple_stream_basic_rates;
771 u8 reserved5;
772 __le16 acquisition_data;
773 __le16 reserved6;
ba2d3587 774} __packed;
c1adf9fb 775
3d24a9f7
TW
776/*
777 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
778 */
779struct iwl3945_rxon_assoc_cmd {
780 __le32 flags;
781 __le32 filter_flags;
782 u8 ofdm_basic_rates;
783 u8 cck_basic_rates;
784 __le16 reserved;
ba2d3587 785} __packed;
3d24a9f7
TW
786
787struct iwl4965_rxon_assoc_cmd {
fe7a90c2
RR
788 __le32 flags;
789 __le32 filter_flags;
790 u8 ofdm_basic_rates;
791 u8 cck_basic_rates;
fe7a90c2
RR
792 u8 ofdm_ht_single_stream_basic_rates;
793 u8 ofdm_ht_dual_stream_basic_rates;
fe7a90c2 794 __le16 rx_chain_select_flags;
3d24a9f7 795 __le16 reserved;
ba2d3587 796} __packed;
c1adf9fb 797
3d24a9f7 798struct iwl5000_rxon_assoc_cmd {
b481de9c
ZY
799 __le32 flags;
800 __le32 filter_flags;
801 u8 ofdm_basic_rates;
802 u8 cck_basic_rates;
3d24a9f7 803 __le16 reserved1;
b481de9c
ZY
804 u8 ofdm_ht_single_stream_basic_rates;
805 u8 ofdm_ht_dual_stream_basic_rates;
3d24a9f7
TW
806 u8 ofdm_ht_triple_stream_basic_rates;
807 u8 reserved2;
b481de9c 808 __le16 rx_chain_select_flags;
3d24a9f7
TW
809 __le16 acquisition_data;
810 __le32 reserved3;
ba2d3587 811} __packed;
b481de9c 812
b5d7be5e 813#define IWL_CONN_MAX_LISTEN_INTERVAL 10
2c2f3b33
TW
814#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
815#define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
fe7a90c2 816
b481de9c
ZY
817/*
818 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
819 */
3195c1f3
TW
820struct iwl_rxon_time_cmd {
821 __le64 timestamp;
b481de9c
ZY
822 __le16 beacon_interval;
823 __le16 atim_window;
824 __le32 beacon_init_val;
825 __le16 listen_interval;
826 __le16 reserved;
ba2d3587 827} __packed;
b481de9c 828
b481de9c
ZY
829/*
830 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
831 */
3d24a9f7
TW
832struct iwl3945_channel_switch_cmd {
833 u8 band;
834 u8 expect_beacon;
835 __le16 channel;
836 __le32 rxon_flags;
837 __le32 rxon_filter_flags;
838 __le32 switch_time;
839 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
ba2d3587 840} __packed;
3d24a9f7 841
e57f1489 842struct iwl4965_channel_switch_cmd {
b481de9c
ZY
843 u8 band;
844 u8 expect_beacon;
845 __le16 channel;
846 __le32 rxon_flags;
847 __le32 rxon_filter_flags;
848 __le32 switch_time;
bb8c093b 849 struct iwl4965_tx_power_db tx_power;
ba2d3587 850} __packed;
b481de9c 851
e57f1489
WYG
852/**
853 * struct iwl5000_channel_switch_cmd
854 * @band: 0- 5.2GHz, 1- 2.4GHz
855 * @expect_beacon: 0- resume transmits after channel switch
856 * 1- wait for beacon to resume transmits
857 * @channel: new channel number
858 * @rxon_flags: Rx on flags
859 * @rxon_filter_flags: filtering parameters
860 * @switch_time: switch time in extended beacon format
861 * @reserved: reserved bytes
862 */
863struct iwl5000_channel_switch_cmd {
864 u8 band;
865 u8 expect_beacon;
866 __le16 channel;
867 __le32 rxon_flags;
868 __le32 rxon_filter_flags;
869 __le32 switch_time;
870 __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
ba2d3587 871} __packed;
e57f1489
WYG
872
873/**
874 * struct iwl6000_channel_switch_cmd
875 * @band: 0- 5.2GHz, 1- 2.4GHz
876 * @expect_beacon: 0- resume transmits after channel switch
877 * 1- wait for beacon to resume transmits
878 * @channel: new channel number
879 * @rxon_flags: Rx on flags
880 * @rxon_filter_flags: filtering parameters
881 * @switch_time: switch time in extended beacon format
882 * @reserved: reserved bytes
883 */
884struct iwl6000_channel_switch_cmd {
885 u8 band;
886 u8 expect_beacon;
887 __le16 channel;
888 __le32 rxon_flags;
889 __le32 rxon_filter_flags;
890 __le32 switch_time;
891 __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
ba2d3587 892} __packed;
e57f1489 893
b481de9c
ZY
894/*
895 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
896 */
2aa6ab86 897struct iwl_csa_notification {
b481de9c
ZY
898 __le16 band;
899 __le16 channel;
900 __le32 status; /* 0 - OK, 1 - fail */
ba2d3587 901} __packed;
b481de9c
ZY
902
903/******************************************************************************
904 * (2)
905 * Quality-of-Service (QOS) Commands & Responses:
906 *
907 *****************************************************************************/
2054a00b
BC
908
909/**
910 * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
911 * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
912 *
913 * @cw_min: Contention window, start value in numbers of slots.
914 * Should be a power-of-2, minus 1. Device's default is 0x0f.
915 * @cw_max: Contention window, max value in numbers of slots.
916 * Should be a power-of-2, minus 1. Device's default is 0x3f.
917 * @aifsn: Number of slots in Arbitration Interframe Space (before
918 * performing random backoff timing prior to Tx). Device default 1.
919 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
920 *
921 * Device will automatically increase contention window by (2*CW) + 1 for each
922 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
923 * value, to cap the CW value.
924 */
1ff50bda 925struct iwl_ac_qos {
b481de9c
ZY
926 __le16 cw_min;
927 __le16 cw_max;
928 u8 aifsn;
929 u8 reserved1;
930 __le16 edca_txop;
ba2d3587 931} __packed;
b481de9c
ZY
932
933/* QoS flags defines */
51e9bf5d
HH
934#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
935#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
936#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
b481de9c 937
2054a00b 938/* Number of Access Categories (AC) (EDCA), queues 0..3 */
b481de9c
ZY
939#define AC_NUM 4
940
941/*
942 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
2054a00b
BC
943 *
944 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
945 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
b481de9c 946 */
1ff50bda 947struct iwl_qosparam_cmd {
b481de9c 948 __le32 qos_flags;
1ff50bda 949 struct iwl_ac_qos ac[AC_NUM];
ba2d3587 950} __packed;
b481de9c
ZY
951
952/******************************************************************************
953 * (3)
954 * Add/Modify Stations Commands & Responses:
955 *
956 *****************************************************************************/
957/*
958 * Multi station support
959 */
2054a00b
BC
960
961/* Special, dedicated locations within device's station table */
b481de9c 962#define IWL_AP_ID 0
b481de9c 963#define IWL_STA_ID 2
4c897253
TW
964#define IWL3945_BROADCAST_ID 24
965#define IWL3945_STATION_COUNT 25
b481de9c
ZY
966#define IWL4965_BROADCAST_ID 31
967#define IWL4965_STATION_COUNT 32
bf3c7fdd
WYG
968#define IWLAGN_BROADCAST_ID 15
969#define IWLAGN_STATION_COUNT 16
b481de9c
ZY
970
971#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
972#define IWL_INVALID_STATION 255
973
1bd14eaf
JB
974#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
975#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
51e9bf5d
HH
976#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
977#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
74093ddf 978#define STA_FLG_MAX_AGG_SIZE_POS (19)
51e9bf5d 979#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
7aafef1c 980#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
51e9bf5d 981#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
74093ddf 982#define STA_FLG_AGG_MPDU_DENSITY_POS (23)
51e9bf5d 983#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
b481de9c 984
2054a00b 985/* Use in mode field. 1: modify existing entry, 0: add new station entry */
b481de9c
ZY
986#define STA_CONTROL_MODIFY_MSK 0x01
987
988/* key flags __le16*/
51e9bf5d
HH
989#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
990#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
991#define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
992#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
993#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
b481de9c
ZY
994
995#define STA_KEY_FLG_KEYID_POS 8
51e9bf5d 996#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
eaaf7894 997/* wep key is either from global key (0) or from station info array (1) */
51e9bf5d 998#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
eaaf7894
EG
999
1000/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
51e9bf5d
HH
1001#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
1002#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
deb09c43 1003#define STA_KEY_MAX_NUM 8
b481de9c 1004
2054a00b 1005/* Flags indicate whether to modify vs. don't change various station params */
b481de9c
ZY
1006#define STA_MODIFY_KEY_MASK 0x01
1007#define STA_MODIFY_TID_DISABLE_TX 0x02
1008#define STA_MODIFY_TX_RATE_MSK 0x04
1009#define STA_MODIFY_ADDBA_TID_MSK 0x08
1010#define STA_MODIFY_DELBA_TID_MSK 0x10
6ab10ff8 1011#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
2054a00b
BC
1012
1013/* Receiver address (actually, Rx station's index into station table),
1014 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
b481de9c
ZY
1015#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
1016
bb8c093b 1017struct iwl4965_keyinfo {
b481de9c
ZY
1018 __le16 key_flags;
1019 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
1020 u8 reserved1;
1021 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
eaaf7894
EG
1022 u8 key_offset;
1023 u8 reserved2;
b481de9c 1024 u8 key[16]; /* 16-byte unicast decryption key */
ba2d3587 1025} __packed;
b481de9c 1026
133636de
TW
1027/* 5000 */
1028struct iwl_keyinfo {
1029 __le16 key_flags;
1030 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
1031 u8 reserved1;
1032 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
1033 u8 key_offset;
1034 u8 reserved2;
1035 u8 key[16]; /* 16-byte unicast decryption key */
1036 __le64 tx_secur_seq_cnt;
1037 __le64 hw_tkip_mic_rx_key;
1038 __le64 hw_tkip_mic_tx_key;
ba2d3587 1039} __packed;
133636de 1040
2054a00b
BC
1041/**
1042 * struct sta_id_modify
1043 * @addr[ETH_ALEN]: station's MAC address
1044 * @sta_id: index of station in uCode's station table
1045 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
1046 *
1047 * Driver selects unused table index when adding new station,
1048 * or the index to a pre-existing station entry when modifying that station.
1049 * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
1050 *
1051 * modify_mask flags select which parameters to modify vs. leave alone.
1052 */
b481de9c
ZY
1053struct sta_id_modify {
1054 u8 addr[ETH_ALEN];
1055 __le16 reserved1;
1056 u8 sta_id;
1057 u8 modify_mask;
1058 __le16 reserved2;
ba2d3587 1059} __packed;
b481de9c
ZY
1060
1061/*
1062 * REPLY_ADD_STA = 0x18 (command)
2054a00b
BC
1063 *
1064 * The device contains an internal table of per-station information,
1065 * with info on security keys, aggregation parameters, and Tx rates for
767d055d
WYG
1066 * initial Tx attempt and any retries (agn devices uses
1067 * REPLY_TX_LINK_QUALITY_CMD,
2054a00b
BC
1068 * 3945 uses REPLY_RATE_SCALE to set up rate tables).
1069 *
1070 * REPLY_ADD_STA sets up the table entry for one station, either creating
1071 * a new entry, or modifying a pre-existing one.
1072 *
1073 * NOTE: RXON command (without "associated" bit set) wipes the station table
1074 * clean. Moving into RF_KILL state does this also. Driver must set up
1075 * new station table before transmitting anything on the RXON channel
1076 * (except active scans or active measurements; those commands carry
1077 * their own txpower/rate setup data).
1078 *
1079 * When getting started on a new channel, driver must set up the
1080 * IWL_BROADCAST_ID entry (last entry in the table). For a client
1081 * station in a BSS, once an AP is selected, driver sets up the AP STA
1082 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
1083 * are all that are needed for a BSS client station. If the device is
1084 * used as AP, or in an IBSS network, driver must set up station table
1085 * entries for all STAs in network, starting with index IWL_STA_ID.
b481de9c 1086 */
3d24a9f7
TW
1087
1088struct iwl3945_addsta_cmd {
1089 u8 mode; /* 1: modify existing, 0: add new station */
1090 u8 reserved[3];
1091 struct sta_id_modify sta;
1092 struct iwl4965_keyinfo key;
1093 __le32 station_flags; /* STA_FLG_* */
1094 __le32 station_flags_msk; /* STA_FLG_* */
1095
1096 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1097 * corresponding to bit (e.g. bit 5 controls TID 5).
1098 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1099 __le16 tid_disable_tx;
1100
1101 __le16 rate_n_flags;
1102
1103 /* TID for which to add block-ack support.
1104 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1105 u8 add_immediate_ba_tid;
1106
1107 /* TID for which to remove block-ack support.
1108 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1109 u8 remove_immediate_ba_tid;
1110
1111 /* Starting Sequence Number for added block-ack support.
1112 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1113 __le16 add_immediate_ba_ssn;
ba2d3587 1114} __packed;
3d24a9f7 1115
bb8c093b 1116struct iwl4965_addsta_cmd {
2054a00b 1117 u8 mode; /* 1: modify existing, 0: add new station */
b481de9c
ZY
1118 u8 reserved[3];
1119 struct sta_id_modify sta;
bb8c093b 1120 struct iwl4965_keyinfo key;
2054a00b
BC
1121 __le32 station_flags; /* STA_FLG_* */
1122 __le32 station_flags_msk; /* STA_FLG_* */
1123
1124 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1125 * corresponding to bit (e.g. bit 5 controls TID 5).
1126 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
b481de9c 1127 __le16 tid_disable_tx;
2054a00b 1128
b481de9c 1129 __le16 reserved1;
2054a00b
BC
1130
1131 /* TID for which to add block-ack support.
1132 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
b481de9c 1133 u8 add_immediate_ba_tid;
2054a00b
BC
1134
1135 /* TID for which to remove block-ack support.
1136 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
b481de9c 1137 u8 remove_immediate_ba_tid;
2054a00b
BC
1138
1139 /* Starting Sequence Number for added block-ack support.
1140 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
b481de9c 1141 __le16 add_immediate_ba_ssn;
2054a00b 1142
9bb487b4
JB
1143 /*
1144 * Number of packets OK to transmit to station even though
1145 * it is asleep -- used to synchronise PS-poll and u-APSD
1146 * responses while ucode keeps track of STA sleep state.
1147 */
1148 __le16 sleep_tx_count;
1149
1150 __le16 reserved2;
ba2d3587 1151} __packed;
b481de9c 1152
133636de
TW
1153/* 5000 */
1154struct iwl_addsta_cmd {
1155 u8 mode; /* 1: modify existing, 0: add new station */
1156 u8 reserved[3];
1157 struct sta_id_modify sta;
1158 struct iwl_keyinfo key;
1159 __le32 station_flags; /* STA_FLG_* */
1160 __le32 station_flags_msk; /* STA_FLG_* */
1161
1162 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1163 * corresponding to bit (e.g. bit 5 controls TID 5).
1164 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1165 __le16 tid_disable_tx;
1166
c587de0b 1167 __le16 rate_n_flags; /* 3945 only */
133636de
TW
1168
1169 /* TID for which to add block-ack support.
1170 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1171 u8 add_immediate_ba_tid;
1172
1173 /* TID for which to remove block-ack support.
1174 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1175 u8 remove_immediate_ba_tid;
1176
1177 /* Starting Sequence Number for added block-ack support.
1178 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1179 __le16 add_immediate_ba_ssn;
1180
9bb487b4
JB
1181 /*
1182 * Number of packets OK to transmit to station even though
1183 * it is asleep -- used to synchronise PS-poll and u-APSD
1184 * responses while ucode keeps track of STA sleep state.
1185 */
1186 __le16 sleep_tx_count;
1187
1188 __le16 reserved2;
ba2d3587 1189} __packed;
133636de
TW
1190
1191
2054a00b
BC
1192#define ADD_STA_SUCCESS_MSK 0x1
1193#define ADD_STA_NO_ROOM_IN_TABLE 0x2
1194#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
1195#define ADD_STA_MODIFY_NON_EXIST_STA 0x8
b481de9c
ZY
1196/*
1197 * REPLY_ADD_STA = 0x18 (response)
1198 */
7a999bf0 1199struct iwl_add_sta_resp {
2054a00b 1200 u8 status; /* ADD_STA_* */
ba2d3587 1201} __packed;
b481de9c 1202
7a999bf0
TW
1203#define REM_STA_SUCCESS_MSK 0x1
1204/*
1205 * REPLY_REM_STA = 0x19 (response)
1206 */
1207struct iwl_rem_sta_resp {
1208 u8 status;
ba2d3587 1209} __packed;
7a999bf0
TW
1210
1211/*
1212 * REPLY_REM_STA = 0x19 (command)
1213 */
1214struct iwl_rem_sta_cmd {
1215 u8 num_sta; /* number of removed stations */
1216 u8 reserved[3];
1217 u8 addr[ETH_ALEN]; /* MAC addr of the first station */
1218 u8 reserved2[2];
ba2d3587 1219} __packed;
7a999bf0 1220
947279ee
WYG
1221#define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
1222#define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
1223#define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
1224#define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
1225#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
1226
716c74b0
WYG
1227#define IWL_DROP_SINGLE 0
1228#define IWL_DROP_SELECTED 1
1229#define IWL_DROP_ALL 2
1230
947279ee
WYG
1231/*
1232 * REPLY_TXFIFO_FLUSH = 0x1e(command and response)
1233 *
1234 * When using full FIFO flush this command checks the scheduler HW block WR/RD
1235 * pointers to check if all the frames were transferred by DMA into the
1236 * relevant TX FIFO queue. Only when the DMA is finished and the queue is
1237 * empty the command can finish.
1238 * This command is used to flush the TXFIFO from transmit commands, it may
1239 * operate on single or multiple queues, the command queue can't be flushed by
1240 * this command. The command response is returned when all the queue flush
1241 * operations are done. Each TX command flushed return response with the FLUSH
1242 * status set in the TX response status. When FIFO flush operation is used,
1243 * the flush operation ends when both the scheduler DMA done and TXFIFO empty
1244 * are set.
1245 *
1246 * @fifo_control: bit mask for which queues to flush
1247 * @flush_control: flush controls
1248 * 0: Dump single MSDU
1249 * 1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable.
1250 * 2: Dump all FIFO
1251 */
1252struct iwl_txfifo_flush_cmd {
1253 __le32 fifo_control;
1254 __le16 flush_control;
1255 __le16 reserved;
0e954099 1256} __packed;
947279ee 1257
0a0bed1d
EG
1258/*
1259 * REPLY_WEP_KEY = 0x20
1260 */
1261struct iwl_wep_key {
1262 u8 key_index;
1263 u8 key_offset;
1264 u8 reserved1[2];
1265 u8 key_size;
1266 u8 reserved2[3];
1267 u8 key[16];
ba2d3587 1268} __packed;
0a0bed1d
EG
1269
1270struct iwl_wep_cmd {
1271 u8 num_keys;
1272 u8 global_key_type;
1273 u8 flags;
1274 u8 reserved;
1275 struct iwl_wep_key key[0];
ba2d3587 1276} __packed;
0a0bed1d
EG
1277
1278#define WEP_KEY_WEP_TYPE 1
1279#define WEP_KEYS_MAX 4
1280#define WEP_INVALID_OFFSET 0xff
4564ce8b 1281#define WEP_KEY_LEN_64 5
0a0bed1d 1282#define WEP_KEY_LEN_128 13
b481de9c
ZY
1283
1284/******************************************************************************
1285 * (4)
1286 * Rx Responses:
1287 *
1288 *****************************************************************************/
1289
51e9bf5d
HH
1290#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
1291#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
8211ef78 1292
51e9bf5d
HH
1293#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
1294#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
1295#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
1296#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
9024adf5 1297#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
9f30e04e 1298#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
8211ef78
TW
1299
1300#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
1301#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
1302#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
1303#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
1304#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
17e476b8
EG
1305#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
1306
1307#define RX_RES_STATUS_STATION_FOUND (1<<6)
1308#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
8211ef78
TW
1309
1310#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
1311#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
1312#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
1313#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
1314#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
b481de9c 1315
17e476b8
EG
1316#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
1317#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
1318#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
1319#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1320
3d24a9f7
TW
1321
1322struct iwl3945_rx_frame_stats {
1323 u8 phy_count;
1324 u8 id;
1325 u8 rssi;
1326 u8 agc;
1327 __le16 sig_avg;
1328 __le16 noise_diff;
1329 u8 payload[0];
ba2d3587 1330} __packed;
3d24a9f7
TW
1331
1332struct iwl3945_rx_frame_hdr {
1333 __le16 channel;
1334 __le16 phy_flags;
1335 u8 reserved1;
1336 u8 rate;
1337 __le16 len;
1338 u8 payload[0];
ba2d3587 1339} __packed;
3d24a9f7
TW
1340
1341struct iwl3945_rx_frame_end {
1342 __le32 status;
1343 __le64 timestamp;
1344 __le32 beacon_timestamp;
ba2d3587 1345} __packed;
3d24a9f7
TW
1346
1347/*
1348 * REPLY_3945_RX = 0x1b (response only, not a command)
1349 *
1350 * NOTE: DO NOT dereference from casts to this structure
1351 * It is provided only for calculating minimum data set size.
1352 * The actual offsets of the hdr and end are dynamic based on
1353 * stats.phy_count
1354 */
1355struct iwl3945_rx_frame {
1356 struct iwl3945_rx_frame_stats stats;
1357 struct iwl3945_rx_frame_hdr hdr;
1358 struct iwl3945_rx_frame_end end;
ba2d3587 1359} __packed;
3d24a9f7
TW
1360
1361#define IWL39_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1362
b481de9c 1363/* Fixed (non-configurable) rx data from phy */
caab8f1a
TW
1364
1365#define IWL49_RX_RES_PHY_CNT 14
1366#define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
1367#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
1368#define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
1369#define IWL49_AGC_DB_POS (7)
b481de9c
ZY
1370struct iwl4965_rx_non_cfg_phy {
1371 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
1372 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
1373 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
1374 u8 pad[0];
ba2d3587 1375} __packed;
b481de9c 1376
caab8f1a 1377
7ccc896f
WYG
1378#define IWLAGN_RX_RES_PHY_CNT 8
1379#define IWLAGN_RX_RES_AGC_IDX 1
1380#define IWLAGN_RX_RES_RSSI_AB_IDX 2
1381#define IWLAGN_RX_RES_RSSI_C_IDX 3
1382#define IWLAGN_OFDM_AGC_MSK 0xfe00
1383#define IWLAGN_OFDM_AGC_BIT_POS 9
1384#define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff
1385#define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00
1386#define IWLAGN_OFDM_RSSI_A_BIT_POS 0
1387#define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000
1388#define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000
1389#define IWLAGN_OFDM_RSSI_B_BIT_POS 16
1390#define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff
1391#define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00
1392#define IWLAGN_OFDM_RSSI_C_BIT_POS 0
1393
1394struct iwlagn_non_cfg_phy {
1395 __le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT]; /* up to 8 phy entries */
ba2d3587 1396} __packed;
caab8f1a
TW
1397
1398
b481de9c 1399/*
857485c0 1400 * REPLY_RX = 0xc3 (response only, not a command)
b481de9c
ZY
1401 * Used only for legacy (non 11n) frames.
1402 */
caab8f1a 1403struct iwl_rx_phy_res {
b481de9c
ZY
1404 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
1405 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
1406 u8 stat_id; /* configurable DSP phy data set ID */
1407 u8 reserved1;
1408 __le64 timestamp; /* TSF at on air rise */
1409 __le32 beacon_time_stamp; /* beacon at on-air rise */
1410 __le16 phy_flags; /* general phy flags: band, modulation, ... */
1411 __le16 channel; /* channel number */
caab8f1a 1412 u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
52969981
BC
1413 __le32 rate_n_flags; /* RATE_MCS_* */
1414 __le16 byte_count; /* frame's byte-count */
30c1b0f7 1415 __le16 frame_time; /* frame's time on the air */
ba2d3587 1416} __packed;
b481de9c 1417
2fb291ee 1418struct iwl_rx_mpdu_res_start {
b481de9c
ZY
1419 __le16 byte_count;
1420 __le16 reserved;
ba2d3587 1421} __packed;
b481de9c
ZY
1422
1423
1424/******************************************************************************
1425 * (5)
1426 * Tx Commands & Responses:
1427 *
52969981
BC
1428 * Driver must place each REPLY_TX command into one of the prioritized Tx
1429 * queues in host DRAM, shared between driver and device (see comments for
1430 * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
1431 * are preparing to transmit, the device pulls the Tx command over the PCI
1432 * bus via one of the device's Tx DMA channels, to fill an internal FIFO
1433 * from which data will be transmitted.
1434 *
1435 * uCode handles all timing and protocol related to control frames
1436 * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
1437 * handle reception of block-acks; uCode updates the host driver via
767d055d 1438 * REPLY_COMPRESSED_BA.
52969981
BC
1439 *
1440 * uCode handles retrying Tx when an ACK is expected but not received.
1441 * This includes trying lower data rates than the one requested in the Tx
1442 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
767d055d 1443 * REPLY_TX_LINK_QUALITY_CMD (agn).
52969981
BC
1444 *
1445 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
1446 * This command must be executed after every RXON command, before Tx can occur.
b481de9c
ZY
1447 *****************************************************************************/
1448
52969981
BC
1449/* REPLY_TX Tx flags field */
1450
4e3243f5
WYG
1451/*
1452 * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
a326a5d0 1453 * before this frame. if CTS-to-self required check
4e3243f5
WYG
1454 * RXON_FLG_SELF_CTS_EN status.
1455 * unused in 3945/4965, used in 5000 series and after
1456 */
1457#define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0)
a326a5d0 1458
4e3243f5
WYG
1459/*
1460 * 1: Use Request-To-Send protocol before this frame.
1461 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
1462 * used in 3945/4965, unused in 5000 series and after
1463 */
51e9bf5d 1464#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
52969981 1465
4e3243f5
WYG
1466/*
1467 * 1: Transmit Clear-To-Send to self before this frame.
52969981 1468 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
4e3243f5
WYG
1469 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
1470 * used in 3945/4965, unused in 5000 series and after
1471 */
51e9bf5d 1472#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
52969981
BC
1473
1474/* 1: Expect ACK from receiving station
1475 * 0: Don't expect ACK (MAC header's duration field s/b 0)
1476 * Set this for unicast frames, but not broadcast/multicast. */
51e9bf5d 1477#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
52969981 1478
767d055d 1479/* For agn devices:
52969981
BC
1480 * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
1481 * Tx command's initial_rate_index indicates first rate to try;
1482 * uCode walks through table for additional Tx attempts.
1483 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1484 * This rate will be used for all Tx attempts; it will not be scaled. */
51e9bf5d 1485#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
52969981
BC
1486
1487/* 1: Expect immediate block-ack.
1488 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
51e9bf5d 1489#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
52969981 1490
4e3243f5
WYG
1491/*
1492 * 1: Frame requires full Tx-Op protection.
1493 * Set this if either RTS or CTS Tx Flag gets set.
1494 * used in 3945/4965, unused in 5000 series and after
1495 */
51e9bf5d 1496#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
52969981 1497
767d055d 1498/* Tx antenna selection field; used only for 3945, reserved (0) for agn devices.
52969981 1499 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
51e9bf5d
HH
1500#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
1501#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
1502#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
b481de9c 1503
52969981
BC
1504/* 1: Ignore Bluetooth priority for this frame.
1505 * 0: Delay Tx until Bluetooth device is done (normal usage). */
b2e8690d 1506#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12)
b481de9c 1507
52969981
BC
1508/* 1: uCode overrides sequence control field in MAC header.
1509 * 0: Driver provides sequence control field in MAC header.
1510 * Set this for management frames, non-QOS data frames, non-unicast frames,
1511 * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
51e9bf5d 1512#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
b481de9c 1513
52969981
BC
1514/* 1: This frame is non-last MPDU; more fragments are coming.
1515 * 0: Last fragment, or not using fragmentation. */
51e9bf5d 1516#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
b481de9c 1517
52969981
BC
1518/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1519 * 0: No TSF required in outgoing frame.
1520 * Set this for transmitting beacons and probe responses. */
51e9bf5d 1521#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
b481de9c 1522
52969981
BC
1523/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
1524 * alignment of frame's payload data field.
1525 * 0: No pad
1526 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
1527 * field (but not both). Driver must align frame data (i.e. data following
1528 * MAC header) to DWORD boundary. */
51e9bf5d 1529#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
b481de9c 1530
8236e183
MS
1531/* accelerate aggregation support
1532 * 0 - no CCMP encryption; 1 - CCMP encryption */
51e9bf5d 1533#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
8236e183 1534
b481de9c 1535/* HCCA-AP - disable duration overwriting. */
51e9bf5d 1536#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
b481de9c 1537
52969981 1538
b481de9c
ZY
1539/*
1540 * TX command security control
1541 */
1542#define TX_CMD_SEC_WEP 0x01
1543#define TX_CMD_SEC_CCM 0x02
1544#define TX_CMD_SEC_TKIP 0x03
1545#define TX_CMD_SEC_MSK 0x03
1546#define TX_CMD_SEC_SHIFT 6
1547#define TX_CMD_SEC_KEY128 0x08
1548
3195cdb7
TW
1549/*
1550 * security overhead sizes
1551 */
1552#define WEP_IV_LEN 4
1553#define WEP_ICV_LEN 4
1554#define CCMP_MIC_LEN 8
1555#define TKIP_ICV_LEN 4
1556
3d24a9f7
TW
1557/*
1558 * REPLY_TX = 0x1c (command)
1559 */
1560
1561struct iwl3945_tx_cmd {
1562 /*
1563 * MPDU byte count:
1564 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1565 * + 8 byte IV for CCM or TKIP (not used for WEP)
1566 * + Data payload
1567 * + 8-byte MIC (not used for CCM/WEP)
1568 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1569 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1570 * Range: 14-2342 bytes.
1571 */
1572 __le16 len;
1573
1574 /*
1575 * MPDU or MSDU byte count for next frame.
1576 * Used for fragmentation and bursting, but not 11n aggregation.
1577 * Same as "len", but for next frame. Set to 0 if not applicable.
1578 */
1579 __le16 next_frame_len;
1580
1581 __le32 tx_flags; /* TX_CMD_FLG_* */
1582
1583 u8 rate;
1584
1585 /* Index of recipient station in uCode's station table */
1586 u8 sta_id;
1587 u8 tid_tspec;
1588 u8 sec_ctl;
1589 u8 key[16];
1590 union {
1591 u8 byte[8];
1592 __le16 word[4];
1593 __le32 dw[2];
1594 } tkip_mic;
1595 __le32 next_frame_info;
1596 union {
1597 __le32 life_time;
1598 __le32 attempt;
1599 } stop_time;
1600 u8 supp_rates[2];
1601 u8 rts_retry_limit; /*byte 50 */
1602 u8 data_retry_limit; /*byte 51 */
1603 union {
1604 __le16 pm_frame_timeout;
1605 __le16 attempt_duration;
1606 } timeout;
1607
1608 /*
1609 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1610 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1611 */
1612 __le16 driver_txop;
1613
1614 /*
1615 * MAC header goes here, followed by 2 bytes padding if MAC header
1616 * length is 26 or 30 bytes, followed by payload data
1617 */
1618 u8 payload[0];
1619 struct ieee80211_hdr hdr[0];
ba2d3587 1620} __packed;
3d24a9f7
TW
1621
1622/*
1623 * REPLY_TX = 0x1c (response)
1624 */
1625struct iwl3945_tx_resp {
1626 u8 failure_rts;
1627 u8 failure_frame;
1628 u8 bt_kill_count;
1629 u8 rate;
1630 __le32 wireless_media_time;
1631 __le32 status; /* TX status */
ba2d3587 1632} __packed;
3d24a9f7
TW
1633
1634
b481de9c 1635/*
52969981
BC
1636 * 4965 uCode updates these Tx attempt count values in host DRAM.
1637 * Used for managing Tx retries when expecting block-acks.
1638 * Driver should set these fields to 0.
b481de9c 1639 */
2aa6ab86 1640struct iwl_dram_scratch {
52969981
BC
1641 u8 try_cnt; /* Tx attempts */
1642 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
b481de9c 1643 __le16 reserved;
ba2d3587 1644} __packed;
b481de9c 1645
83d527d9 1646struct iwl_tx_cmd {
52969981
BC
1647 /*
1648 * MPDU byte count:
1649 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1650 * + 8 byte IV for CCM or TKIP (not used for WEP)
1651 * + Data payload
1652 * + 8-byte MIC (not used for CCM/WEP)
1653 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1654 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1655 * Range: 14-2342 bytes.
1656 */
b481de9c 1657 __le16 len;
52969981
BC
1658
1659 /*
1660 * MPDU or MSDU byte count for next frame.
1661 * Used for fragmentation and bursting, but not 11n aggregation.
1662 * Same as "len", but for next frame. Set to 0 if not applicable.
1663 */
b481de9c 1664 __le16 next_frame_len;
52969981
BC
1665
1666 __le32 tx_flags; /* TX_CMD_FLG_* */
1667
2aa6ab86 1668 /* uCode may modify this field of the Tx command (in host DRAM!).
52969981 1669 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
2aa6ab86 1670 struct iwl_dram_scratch scratch;
52969981
BC
1671
1672 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1673 __le32 rate_n_flags; /* RATE_MCS_* */
1674
1675 /* Index of destination station in uCode's station table */
b481de9c 1676 u8 sta_id;
52969981
BC
1677
1678 /* Type of security encryption: CCM or TKIP */
1679 u8 sec_ctl; /* TX_CMD_SEC_* */
1680
1681 /*
1682 * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial
1683 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
1684 * data frames, this field may be used to selectively reduce initial
1685 * rate (via non-0 value) for special frames (e.g. management), while
1686 * still supporting rate scaling for all frames.
1687 */
b481de9c
ZY
1688 u8 initial_rate_index;
1689 u8 reserved;
b481de9c 1690 u8 key[16];
b481de9c
ZY
1691 __le16 next_frame_flags;
1692 __le16 reserved2;
b481de9c
ZY
1693 union {
1694 __le32 life_time;
1695 __le32 attempt;
1696 } stop_time;
52969981
BC
1697
1698 /* Host DRAM physical address pointer to "scratch" in this command.
1699 * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
b481de9c
ZY
1700 __le32 dram_lsb_ptr;
1701 u8 dram_msb_ptr;
52969981 1702
b481de9c
ZY
1703 u8 rts_retry_limit; /*byte 50 */
1704 u8 data_retry_limit; /*byte 51 */
b481de9c 1705 u8 tid_tspec;
b481de9c
ZY
1706 union {
1707 __le16 pm_frame_timeout;
1708 __le16 attempt_duration;
1709 } timeout;
52969981
BC
1710
1711 /*
1712 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1713 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1714 */
b481de9c 1715 __le16 driver_txop;
52969981
BC
1716
1717 /*
1718 * MAC header goes here, followed by 2 bytes padding if MAC header
1719 * length is 26 or 30 bytes, followed by payload data
1720 */
b481de9c
ZY
1721 u8 payload[0];
1722 struct ieee80211_hdr hdr[0];
ba2d3587 1723} __packed;
b481de9c 1724
04569cbe 1725/* TX command response is sent after *3945* transmission attempts.
b481de9c
ZY
1726 *
1727 * NOTES:
1728 *
1729 * TX_STATUS_FAIL_NEXT_FRAG
1730 *
1731 * If the fragment flag in the MAC header for the frame being transmitted
1732 * is set and there is insufficient time to transmit the next frame, the
1733 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
1734 *
1735 * TX_STATUS_FIFO_UNDERRUN
1736 *
1737 * Indicates the host did not provide bytes to the FIFO fast enough while
1738 * a TX was in progress.
1739 *
1740 * TX_STATUS_FAIL_MGMNT_ABORT
1741 *
1742 * This status is only possible if the ABORT ON MGMT RX parameter was
1743 * set to true with the TX command.
1744 *
1745 * If the MSB of the status parameter is set then an abort sequence is
1746 * required. This sequence consists of the host activating the TX Abort
1747 * control line, and then waiting for the TX Abort command response. This
1748 * indicates that a the device is no longer in a transmit state, and that the
1749 * command FIFO has been cleared. The host must then deactivate the TX Abort
1750 * control line. Receiving is still allowed in this case.
1751 */
04569cbe
WYG
1752enum {
1753 TX_3945_STATUS_SUCCESS = 0x01,
1754 TX_3945_STATUS_DIRECT_DONE = 0x02,
1755 TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
1756 TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
1757 TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1758 TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
1759 TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
1760 TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1761 TX_3945_STATUS_FAIL_DEST_PS = 0x88,
1762 TX_3945_STATUS_FAIL_ABORTED = 0x89,
1763 TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
1764 TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
1765 TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1766 TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
1767 TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
1768 TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1769 TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
1770 TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
1771};
1772
1773/*
1774 * TX command response is sent after *agn* transmission attempts.
1775 *
1776 * both postpone and abort status are expected behavior from uCode. there is
1777 * no special operation required from driver; except for RFKILL_FLUSH,
1778 * which required tx flush host command to flush all the tx frames in queues
1779 */
b481de9c
ZY
1780enum {
1781 TX_STATUS_SUCCESS = 0x01,
1782 TX_STATUS_DIRECT_DONE = 0x02,
04569cbe
WYG
1783 /* postpone TX */
1784 TX_STATUS_POSTPONE_DELAY = 0x40,
1785 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
1786 TX_STATUS_POSTPONE_BT_PRIO = 0x42,
1787 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
1788 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
1789 /* abort TX */
1790 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
b481de9c
ZY
1791 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
1792 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
1793 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
04569cbe
WYG
1794 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
1795 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
b481de9c
ZY
1796 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1797 TX_STATUS_FAIL_DEST_PS = 0x88,
04569cbe 1798 TX_STATUS_FAIL_HOST_ABORTED = 0x89,
b481de9c
ZY
1799 TX_STATUS_FAIL_BT_RETRY = 0x8a,
1800 TX_STATUS_FAIL_STA_INVALID = 0x8b,
1801 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1802 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
04569cbe 1803 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
b481de9c 1804 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
04569cbe
WYG
1805 /* uCode drop due to FW drop request */
1806 TX_STATUS_FAIL_FW_DROP = 0x90,
1807 /*
1808 * uCode drop due to station color mismatch
1809 * between tx command and station table
1810 */
1811 TX_STATUS_FAIL_STA_COLOR_MISMATCH_DROP = 0x91,
b481de9c
ZY
1812};
1813
1814#define TX_PACKET_MODE_REGULAR 0x0000
1815#define TX_PACKET_MODE_BURST_SEQ 0x0100
1816#define TX_PACKET_MODE_BURST_FIRST 0x0200
1817
1818enum {
1819 TX_POWER_PA_NOT_ACTIVE = 0x0,
1820};
1821
1822enum {
3fd07a1e 1823 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
b481de9c
ZY
1824 TX_STATUS_DELAY_MSK = 0x00000040,
1825 TX_STATUS_ABORT_MSK = 0x00000080,
1826 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
1827 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
3fd07a1e 1828 TX_RESERVED = 0x00780000, /* bits 19:22 */
b481de9c
ZY
1829 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
1830 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
1831};
1832
1833/* *******************************
52969981 1834 * TX aggregation status
b481de9c
ZY
1835 ******************************* */
1836
1837enum {
1838 AGG_TX_STATE_TRANSMITTED = 0x00,
1839 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
1840 AGG_TX_STATE_BT_PRIO_MSK = 0x02,
1841 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
1842 AGG_TX_STATE_ABORT_MSK = 0x08,
1843 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
1844 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
1845 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
1846 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
1847 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
1848 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
1849 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
1850 AGG_TX_STATE_DELAY_TX_MSK = 0x400
1851};
1852
3fd07a1e
TW
1853#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
1854 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
1855 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
b481de9c 1856
52969981 1857/* # tx attempts for first frame in aggregation */
b481de9c
ZY
1858#define AGG_TX_STATE_TRY_CNT_POS 12
1859#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1860
52969981 1861/* Command ID and sequence number of Tx command for this frame */
b481de9c
ZY
1862#define AGG_TX_STATE_SEQ_NUM_POS 16
1863#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1864
1865/*
1866 * REPLY_TX = 0x1c (response)
52969981
BC
1867 *
1868 * This response may be in one of two slightly different formats, indicated
1869 * by the frame_count field:
1870 *
1871 * 1) No aggregation (frame_count == 1). This reports Tx results for
1872 * a single frame. Multiple attempts, at various bit rates, may have
1873 * been made for this frame.
1874 *
1875 * 2) Aggregation (frame_count > 1). This reports Tx results for
1876 * 2 or more frames that used block-acknowledge. All frames were
1877 * transmitted at same rate. Rate scaling may have been used if first
1878 * frame in this new agg block failed in previous agg block(s).
1879 *
1880 * Note that, for aggregation, ACK (block-ack) status is not delivered here;
767d055d
WYG
1881 * block-ack has not been received by the time the agn device records
1882 * this status.
52969981 1883 * This status relates to reasons the tx might have been blocked or aborted
767d055d 1884 * within the sending station (this agn device), rather than whether it was
52969981 1885 * received successfully by the destination station.
b481de9c 1886 */
001caff0
RR
1887struct agg_tx_status {
1888 __le16 status;
1889 __le16 sequence;
ba2d3587 1890} __packed;
001caff0 1891
bb8c093b 1892struct iwl4965_tx_resp {
b481de9c 1893 u8 frame_count; /* 1 no aggregation, >1 aggregation */
52969981
BC
1894 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1895 u8 failure_rts; /* # failures due to unsuccessful RTS */
1896 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1897
1898 /* For non-agg: Rate at which frame was successful.
1899 * For agg: Rate at which all frames were transmitted. */
1900 __le32 rate_n_flags; /* RATE_MCS_* */
1901
1902 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1903 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1904 __le16 wireless_media_time; /* uSecs */
1905
b481de9c 1906 __le16 reserved;
52969981 1907 __le32 pa_power1; /* RF power amplifier measurement (not used) */
b481de9c 1908 __le32 pa_power2;
52969981
BC
1909
1910 /*
1911 * For non-agg: frame status TX_STATUS_*
1912 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1913 * fields follow this one, up to frame_count.
1914 * Bit fields:
1915 * 11- 0: AGG_TX_STATE_* status code
1916 * 15-12: Retry count for 1st frame in aggregation (retries
1917 * occur if tx failed for this frame when it was a
1918 * member of a previous aggregation block). If rate
1919 * scaling is used, retry count indicates the rate
1920 * table entry used for all frames in the new agg.
1921 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1922 */
25a6572c
TW
1923 union {
1924 __le32 status;
1925 struct agg_tx_status agg_status[0]; /* for each agg frame */
1926 } u;
ba2d3587 1927} __packed;
fe01b477 1928
3fd07a1e
TW
1929/*
1930 * definitions for initial rate index field
a96a27f9 1931 * bits [3:0] initial rate index
3fd07a1e
TW
1932 * bits [6:4] rate table color, used for the initial rate
1933 * bit-7 invalid rate indication
1934 * i.e. rate was not chosen from rate table
1935 * or rate table color was changed during frame retries
1936 * refer tlc rate info
1937 */
1938
1939#define IWL50_TX_RES_INIT_RATE_INDEX_POS 0
1940#define IWL50_TX_RES_INIT_RATE_INDEX_MSK 0x0f
1941#define IWL50_TX_RES_RATE_TABLE_COLOR_POS 4
1942#define IWL50_TX_RES_RATE_TABLE_COLOR_MSK 0x70
1943#define IWL50_TX_RES_INV_RATE_INDEX_MSK 0x80
1944
1945/* refer to ra_tid */
1946#define IWL50_TX_RES_TID_POS 0
1947#define IWL50_TX_RES_TID_MSK 0x0f
1948#define IWL50_TX_RES_RA_POS 4
1949#define IWL50_TX_RES_RA_MSK 0xf0
1950
001caff0
RR
1951struct iwl5000_tx_resp {
1952 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1953 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1954 u8 failure_rts; /* # failures due to unsuccessful RTS */
1955 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1956
1957 /* For non-agg: Rate at which frame was successful.
1958 * For agg: Rate at which all frames were transmitted. */
1959 __le32 rate_n_flags; /* RATE_MCS_* */
1960
1961 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1962 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1963 __le16 wireless_media_time; /* uSecs */
1964
3fd07a1e
TW
1965 u8 pa_status; /* RF power amplifier measurement (not used) */
1966 u8 pa_integ_res_a[3];
1967 u8 pa_integ_res_b[3];
1968 u8 pa_integ_res_C[3];
001caff0
RR
1969
1970 __le32 tfd_info;
1971 __le16 seq_ctl;
1972 __le16 byte_cnt;
3fd07a1e
TW
1973 u8 tlc_info;
1974 u8 ra_tid; /* tid (0:3), sta_id (4:7) */
1975 __le16 frame_ctrl;
001caff0
RR
1976 /*
1977 * For non-agg: frame status TX_STATUS_*
1978 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1979 * fields follow this one, up to frame_count.
1980 * Bit fields:
1981 * 11- 0: AGG_TX_STATE_* status code
1982 * 15-12: Retry count for 1st frame in aggregation (retries
1983 * occur if tx failed for this frame when it was a
1984 * member of a previous aggregation block). If rate
1985 * scaling is used, retry count indicates the rate
1986 * table entry used for all frames in the new agg.
1987 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1988 */
1989 struct agg_tx_status status; /* TX status (in aggregation -
1990 * status of 1st frame) */
ba2d3587 1991} __packed;
b481de9c
ZY
1992/*
1993 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
52969981
BC
1994 *
1995 * Reports Block-Acknowledge from recipient station
b481de9c 1996 */
653fa4a0 1997struct iwl_compressed_ba_resp {
b481de9c
ZY
1998 __le32 sta_addr_lo32;
1999 __le16 sta_addr_hi16;
2000 __le16 reserved;
52969981
BC
2001
2002 /* Index of recipient (BA-sending) station in uCode's station table */
b481de9c
ZY
2003 u8 sta_id;
2004 u8 tid;
fe01b477
RR
2005 __le16 seq_ctl;
2006 __le64 bitmap;
b481de9c
ZY
2007 __le16 scd_flow;
2008 __le16 scd_ssn;
ba2d3587 2009} __packed;
b481de9c
ZY
2010
2011/*
2012 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
2bdc7031
BC
2013 *
2014 * See details under "TXPOWER" in iwl-4965-hw.h.
b481de9c 2015 */
3d24a9f7
TW
2016
2017struct iwl3945_txpowertable_cmd {
2018 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
2019 u8 reserved;
2020 __le16 channel;
2021 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
ba2d3587 2022} __packed;
3d24a9f7 2023
bb8c093b 2024struct iwl4965_txpowertable_cmd {
b481de9c
ZY
2025 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
2026 u8 reserved;
2027 __le16 channel;
bb8c093b 2028 struct iwl4965_tx_power_db tx_power;
ba2d3587 2029} __packed;
b481de9c 2030
3d24a9f7
TW
2031
2032/**
2033 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
2034 *
2035 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
2036 *
2037 * NOTE: The table of rates passed to the uCode via the
2038 * RATE_SCALE command sets up the corresponding order of
2039 * rates used for all related commands, including rate
2040 * masks, etc.
2041 *
2042 * For example, if you set 9MB (PLCP 0x0f) as the first
2043 * rate in the rate table, the bit mask for that rate
2044 * when passed through ofdm_basic_rates on the REPLY_RXON
2045 * command would be bit 0 (1 << 0)
2046 */
2047struct iwl3945_rate_scaling_info {
2048 __le16 rate_n_flags;
2049 u8 try_cnt;
2050 u8 next_rate_index;
ba2d3587 2051} __packed;
3d24a9f7
TW
2052
2053struct iwl3945_rate_scaling_cmd {
2054 u8 table_id;
2055 u8 reserved[3];
2056 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
ba2d3587 2057} __packed;
3d24a9f7
TW
2058
2059
b481de9c 2060/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
8a1b0245 2061#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
b481de9c 2062
2bdc7031 2063/* # of EDCA prioritized tx fifos */
b481de9c 2064#define LINK_QUAL_AC_NUM AC_NUM
2bdc7031
BC
2065
2066/* # entries in rate scale table to support Tx retries */
b481de9c
ZY
2067#define LINK_QUAL_MAX_RETRY_NUM 16
2068
2bdc7031 2069/* Tx antenna selection values */
8a1b0245
RC
2070#define LINK_QUAL_ANT_A_MSK (1 << 0)
2071#define LINK_QUAL_ANT_B_MSK (1 << 1)
b481de9c
ZY
2072#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
2073
2bdc7031
BC
2074
2075/**
66c73db7 2076 * struct iwl_link_qual_general_params
2bdc7031
BC
2077 *
2078 * Used in REPLY_TX_LINK_QUALITY_CMD
2079 */
66c73db7 2080struct iwl_link_qual_general_params {
b481de9c 2081 u8 flags;
2bdc7031
BC
2082
2083 /* No entries at or above this (driver chosen) index contain MIMO */
b481de9c 2084 u8 mimo_delimiter;
2bdc7031
BC
2085
2086 /* Best single antenna to use for single stream (legacy, SISO). */
2087 u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */
2088
2089 /* Best antennas to use for MIMO (unused for 4965, assumes both). */
2090 u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */
2091
2092 /*
2093 * If driver needs to use different initial rates for different
2094 * EDCA QOS access categories (as implemented by tx fifos 0-3),
2095 * this table will set that up, by indicating the indexes in the
2096 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
2097 * Otherwise, driver should set all entries to 0.
2098 *
2099 * Entry usage:
2100 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
2101 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
2102 */
b481de9c 2103 u8 start_rate_index[LINK_QUAL_AC_NUM];
ba2d3587 2104} __packed;
b481de9c 2105
13c33a09 2106#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
b15826a7
WYG
2107#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
2108#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
13c33a09
WYG
2109
2110#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
2111#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
2112#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
2113
2114#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
b623a9f7 2115#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
13c33a09
WYG
2116#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
2117
2bdc7031 2118/**
66c73db7 2119 * struct iwl_link_qual_agg_params
2bdc7031
BC
2120 *
2121 * Used in REPLY_TX_LINK_QUALITY_CMD
2122 */
66c73db7 2123struct iwl_link_qual_agg_params {
2bdc7031 2124
7469701e
WYG
2125 /*
2126 *Maximum number of uSec in aggregation.
2127 * default set to 4000 (4 milliseconds) if not configured in .cfg
2128 */
b481de9c 2129 __le16 agg_time_limit;
2bdc7031
BC
2130
2131 /*
2132 * Number of Tx retries allowed for a frame, before that frame will
2133 * no longer be considered for the start of an aggregation sequence
2134 * (scheduler will then try to tx it as single frame).
2135 * Driver should set this to 3.
2136 */
b481de9c 2137 u8 agg_dis_start_th;
2bdc7031
BC
2138
2139 /*
2140 * Maximum number of frames in aggregation.
2141 * 0 = no limit (default). 1 = no aggregation.
2142 * Other values = max # frames in aggregation.
2143 */
b481de9c 2144 u8 agg_frame_cnt_limit;
2bdc7031 2145
b481de9c 2146 __le32 reserved;
ba2d3587 2147} __packed;
b481de9c
ZY
2148
2149/*
2150 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
2bdc7031 2151 *
767d055d 2152 * For agn devices only; 3945 uses REPLY_RATE_SCALE.
2bdc7031 2153 *
767d055d
WYG
2154 * Each station in the agn device's internal station table has its own table
2155 * of 16
2bdc7031
BC
2156 * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
2157 * an ACK is not received. This command replaces the entire table for
2158 * one station.
2159 *
767d055d
WYG
2160 * NOTE: Station must already be in agn device's station table.
2161 * Use REPLY_ADD_STA.
2bdc7031
BC
2162 *
2163 * The rate scaling procedures described below work well. Of course, other
2164 * procedures are possible, and may work better for particular environments.
2165 *
2166 *
2167 * FILLING THE RATE TABLE
2168 *
2169 * Given a particular initial rate and mode, as determined by the rate
2170 * scaling algorithm described below, the Linux driver uses the following
2171 * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
2172 * Link Quality command:
2173 *
2174 *
2175 * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
2176 * a) Use this same initial rate for first 3 entries.
2177 * b) Find next lower available rate using same mode (SISO or MIMO),
2178 * use for next 3 entries. If no lower rate available, switch to
7aafef1c 2179 * legacy mode (no HT40 channel, no MIMO, no short guard interval).
2bdc7031
BC
2180 * c) If using MIMO, set command's mimo_delimiter to number of entries
2181 * using MIMO (3 or 6).
7aafef1c 2182 * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
2bdc7031
BC
2183 * no MIMO, no short guard interval), at the next lower bit rate
2184 * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
2185 * legacy procedure for remaining table entries.
2186 *
2187 * 2) If using legacy initial rate:
2188 * a) Use the initial rate for only one entry.
2189 * b) For each following entry, reduce the rate to next lower available
2190 * rate, until reaching the lowest available rate.
2191 * c) When reducing rate, also switch antenna selection.
2192 * d) Once lowest available rate is reached, repeat this rate until
2193 * rate table is filled (16 entries), switching antenna each entry.
2194 *
2195 *
2196 * ACCUMULATING HISTORY
2197 *
767d055d
WYG
2198 * The rate scaling algorithm for agn devices, as implemented in Linux driver,
2199 * uses two sets of frame Tx success history: One for the current/active
2200 * modulation mode, and one for a speculative/search mode that is being
2201 * attempted. If the speculative mode turns out to be more effective (i.e.
2202 * actual transfer rate is better), then the driver continues to use the
2203 * speculative mode as the new current active mode.
2bdc7031
BC
2204 *
2205 * Each history set contains, separately for each possible rate, data for a
2206 * sliding window of the 62 most recent tx attempts at that rate. The data
2207 * includes a shifting bitmap of success(1)/failure(0), and sums of successful
2208 * and attempted frames, from which the driver can additionally calculate a
2209 * success ratio (success / attempted) and number of failures
2210 * (attempted - success), and control the size of the window (attempted).
2211 * The driver uses the bit map to remove successes from the success sum, as
2212 * the oldest tx attempts fall out of the window.
2213 *
767d055d
WYG
2214 * When the agn device makes multiple tx attempts for a given frame, each
2215 * attempt might be at a different rate, and have different modulation
2216 * characteristics (e.g. antenna, fat channel, short guard interval), as set
2217 * up in the rate scaling table in the Link Quality command. The driver must
2218 * determine which rate table entry was used for each tx attempt, to determine
2219 * which rate-specific history to update, and record only those attempts that
2bdc7031
BC
2220 * match the modulation characteristics of the history set.
2221 *
2222 * When using block-ack (aggregation), all frames are transmitted at the same
a96a27f9 2223 * rate, since there is no per-attempt acknowledgment from the destination
2bdc7031
BC
2224 * station. The Tx response struct iwl_tx_resp indicates the Tx rate in
2225 * rate_n_flags field. After receiving a block-ack, the driver can update
2226 * history for the entire block all at once.
2227 *
2228 *
2229 * FINDING BEST STARTING RATE:
2230 *
2231 * When working with a selected initial modulation mode (see below), the
2232 * driver attempts to find a best initial rate. The initial rate is the
2233 * first entry in the Link Quality command's rate table.
2234 *
2235 * 1) Calculate actual throughput (success ratio * expected throughput, see
2236 * table below) for current initial rate. Do this only if enough frames
2237 * have been attempted to make the value meaningful: at least 6 failed
2238 * tx attempts, or at least 8 successes. If not enough, don't try rate
2239 * scaling yet.
2240 *
2241 * 2) Find available rates adjacent to current initial rate. Available means:
2242 * a) supported by hardware &&
2243 * b) supported by association &&
2244 * c) within any constraints selected by user
2245 *
2246 * 3) Gather measured throughputs for adjacent rates. These might not have
2247 * enough history to calculate a throughput. That's okay, we might try
2248 * using one of them anyway!
2249 *
2250 * 4) Try decreasing rate if, for current rate:
2251 * a) success ratio is < 15% ||
2252 * b) lower adjacent rate has better measured throughput ||
2253 * c) higher adjacent rate has worse throughput, and lower is unmeasured
2254 *
2255 * As a sanity check, if decrease was determined above, leave rate
2256 * unchanged if:
2257 * a) lower rate unavailable
2258 * b) success ratio at current rate > 85% (very good)
2259 * c) current measured throughput is better than expected throughput
2260 * of lower rate (under perfect 100% tx conditions, see table below)
2261 *
2262 * 5) Try increasing rate if, for current rate:
2263 * a) success ratio is < 15% ||
2264 * b) both adjacent rates' throughputs are unmeasured (try it!) ||
2265 * b) higher adjacent rate has better measured throughput ||
2266 * c) lower adjacent rate has worse throughput, and higher is unmeasured
2267 *
2268 * As a sanity check, if increase was determined above, leave rate
2269 * unchanged if:
2270 * a) success ratio at current rate < 70%. This is not particularly
2271 * good performance; higher rate is sure to have poorer success.
2272 *
2273 * 6) Re-evaluate the rate after each tx frame. If working with block-
2274 * acknowledge, history and statistics may be calculated for the entire
2275 * block (including prior history that fits within the history windows),
2276 * before re-evaluation.
2277 *
2278 * FINDING BEST STARTING MODULATION MODE:
2279 *
2280 * After working with a modulation mode for a "while" (and doing rate scaling),
2281 * the driver searches for a new initial mode in an attempt to improve
2282 * throughput. The "while" is measured by numbers of attempted frames:
2283 *
2284 * For legacy mode, search for new mode after:
2285 * 480 successful frames, or 160 failed frames
2286 * For high-throughput modes (SISO or MIMO), search for new mode after:
2287 * 4500 successful frames, or 400 failed frames
2288 *
2289 * Mode switch possibilities are (3 for each mode):
2290 *
2291 * For legacy:
2292 * Change antenna, try SISO (if HT association), try MIMO (if HT association)
2293 * For SISO:
2294 * Change antenna, try MIMO, try shortened guard interval (SGI)
2295 * For MIMO:
2296 * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
2297 *
2298 * When trying a new mode, use the same bit rate as the old/current mode when
2299 * trying antenna switches and shortened guard interval. When switching to
2300 * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
2301 * for which the expected throughput (under perfect conditions) is about the
2302 * same or slightly better than the actual measured throughput delivered by
2303 * the old/current mode.
2304 *
2305 * Actual throughput can be estimated by multiplying the expected throughput
2306 * by the success ratio (successful / attempted tx frames). Frame size is
2307 * not considered in this calculation; it assumes that frame size will average
2308 * out to be fairly consistent over several samples. The following are
2309 * metric values for expected throughput assuming 100% success ratio.
2310 * Only G band has support for CCK rates:
2311 *
2312 * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
2313 *
2314 * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
2315 * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
2316 * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
2317 * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
2318 * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
2319 * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
2320 * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
2321 * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
2322 * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
2323 * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
2324 *
2325 * After the new mode has been tried for a short while (minimum of 6 failed
2326 * frames or 8 successful frames), compare success ratio and actual throughput
2327 * estimate of the new mode with the old. If either is better with the new
2328 * mode, continue to use the new mode.
2329 *
2330 * Continue comparing modes until all 3 possibilities have been tried.
2331 * If moving from legacy to HT, try all 3 possibilities from the new HT
2332 * mode. After trying all 3, a best mode is found. Continue to use this mode
2333 * for the longer "while" described above (e.g. 480 successful frames for
2334 * legacy), and then repeat the search process.
2335 *
b481de9c 2336 */
66c73db7 2337struct iwl_link_quality_cmd {
2bdc7031
BC
2338
2339 /* Index of destination/recipient station in uCode's station table */
b481de9c
ZY
2340 u8 sta_id;
2341 u8 reserved1;
2bdc7031 2342 __le16 control; /* not used */
66c73db7
TW
2343 struct iwl_link_qual_general_params general_params;
2344 struct iwl_link_qual_agg_params agg_params;
2bdc7031
BC
2345
2346 /*
2347 * Rate info; when using rate-scaling, Tx command's initial_rate_index
2348 * specifies 1st Tx rate attempted, via index into this table.
767d055d 2349 * agn devices works its way through table when retrying Tx.
2bdc7031 2350 */
b481de9c 2351 struct {
2bdc7031 2352 __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */
b481de9c
ZY
2353 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
2354 __le32 reserved2;
ba2d3587 2355} __packed;
b481de9c 2356
dab1c161
WYG
2357/*
2358 * BT configuration enable flags:
2359 * bit 0 - 1: BT channel announcement enabled
2360 * 0: disable
2361 * bit 1 - 1: priority of BT device enabled
2362 * 0: disable
2363 * bit 2 - 1: BT 2 wire support enabled
2364 * 0: disable
2365 */
456d0f76 2366#define BT_COEX_DISABLE (0x0)
dab1c161
WYG
2367#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
2368#define BT_ENABLE_PRIORITY BIT(1)
2369#define BT_ENABLE_2_WIRE BIT(2)
456d0f76 2370
06702a73
WYG
2371#define BT_COEX_DISABLE (0x0)
2372#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
2373
456d0f76
WYG
2374#define BT_LEAD_TIME_MIN (0x0)
2375#define BT_LEAD_TIME_DEF (0x1E)
2376#define BT_LEAD_TIME_MAX (0xFF)
2377
2378#define BT_MAX_KILL_MIN (0x1)
2379#define BT_MAX_KILL_DEF (0x5)
2380#define BT_MAX_KILL_MAX (0xFF)
2381
22bf59a0
WYG
2382#define BT_DURATION_LIMIT_DEF 625
2383#define BT_DURATION_LIMIT_MAX 1250
2384#define BT_DURATION_LIMIT_MIN 625
2385
2386#define BT_ON_THRESHOLD_DEF 4
2387#define BT_ON_THRESHOLD_MAX 1000
2388#define BT_ON_THRESHOLD_MIN 1
2389
2390#define BT_FRAG_THRESHOLD_DEF 0
2391#define BT_FRAG_THRESHOLD_MAX 0
2392#define BT_FRAG_THRESHOLD_MIN 0
2393
2394#define BT_AGG_THRESHOLD_DEF 0
2395#define BT_AGG_THRESHOLD_MAX 0
2396#define BT_AGG_THRESHOLD_MIN 0
2397
b481de9c
ZY
2398/*
2399 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
3058f021 2400 *
767d055d 2401 * 3945 and agn devices support hardware handshake with Bluetooth device on
3058f021 2402 * same platform. Bluetooth device alerts wireless device when it will Tx;
a96a27f9 2403 * wireless device can delay or kill its own Tx to accommodate.
b481de9c 2404 */
2aa6ab86 2405struct iwl_bt_cmd {
b481de9c
ZY
2406 u8 flags;
2407 u8 lead_time;
2408 u8 max_kill;
2409 u8 reserved;
2410 __le32 kill_ack_mask;
2411 __le32 kill_cts_mask;
ba2d3587 2412} __packed;
b481de9c 2413
b6e116e8 2414#define IWLAGN_BT_FLAG_CHANNEL_INHIBITION BIT(0)
670245ed 2415
b6e116e8
WYG
2416#define IWLAGN_BT_FLAG_COEX_MODE_MASK (BIT(3)|BIT(4)|BIT(5))
2417#define IWLAGN_BT_FLAG_COEX_MODE_SHIFT 3
2418#define IWLAGN_BT_FLAG_COEX_MODE_DISABLED 0
2419#define IWLAGN_BT_FLAG_COEX_MODE_LEGACY_2W 1
2420#define IWLAGN_BT_FLAG_COEX_MODE_3W 2
2421#define IWLAGN_BT_FLAG_COEX_MODE_4W 3
670245ed 2422
b6e116e8
WYG
2423#define IWLAGN_BT_FLAG_UCODE_DEFAULT BIT(6)
2424#define IWLAGN_BT_FLAG_NOCOEX_NOTIF BIT(7)
670245ed 2425
b6e116e8
WYG
2426#define IWLAGN_BT_PRIO_BOOST_MAX 0xFF
2427#define IWLAGN_BT_PRIO_BOOST_MIN 0x00
2428#define IWLAGN_BT_PRIO_BOOST_DEFAULT 0xF0
670245ed 2429
b6e116e8 2430#define IWLAGN_BT_MAX_KILL_DEFAULT 5
670245ed 2431
b6e116e8 2432#define IWLAGN_BT3_T7_DEFAULT 1
670245ed 2433
b6e116e8
WYG
2434#define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffffffff)
2435#define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffffffff)
670245ed 2436
b6e116e8 2437#define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2
670245ed 2438
b6e116e8 2439#define IWLAGN_BT3_T2_DEFAULT 0xc
670245ed 2440
b6e116e8
WYG
2441#define IWLAGN_BT_VALID_ENABLE_FLAGS cpu_to_le16(BIT(0))
2442#define IWLAGN_BT_VALID_BOOST cpu_to_le16(BIT(1))
2443#define IWLAGN_BT_VALID_MAX_KILL cpu_to_le16(BIT(2))
2444#define IWLAGN_BT_VALID_3W_TIMERS cpu_to_le16(BIT(3))
2445#define IWLAGN_BT_VALID_KILL_ACK_MASK cpu_to_le16(BIT(4))
2446#define IWLAGN_BT_VALID_KILL_CTS_MASK cpu_to_le16(BIT(5))
2447#define IWLAGN_BT_VALID_BT4_TIMES cpu_to_le16(BIT(6))
2448#define IWLAGN_BT_VALID_3W_LUT cpu_to_le16(BIT(7))
670245ed 2449
b6e116e8
WYG
2450#define IWLAGN_BT_ALL_VALID_MSK (IWLAGN_BT_VALID_ENABLE_FLAGS | \
2451 IWLAGN_BT_VALID_BOOST | \
2452 IWLAGN_BT_VALID_MAX_KILL | \
2453 IWLAGN_BT_VALID_3W_TIMERS | \
2454 IWLAGN_BT_VALID_KILL_ACK_MASK | \
2455 IWLAGN_BT_VALID_KILL_CTS_MASK | \
2456 IWLAGN_BT_VALID_BT4_TIMES | \
2457 IWLAGN_BT_VALID_3W_LUT)
670245ed 2458
b6e116e8 2459struct iwlagn_bt_cmd {
670245ed
JB
2460 u8 flags;
2461 u8 ledtime; /* unused */
2462 u8 max_kill;
2463 u8 bt3_timer_t7_value;
2464 __le32 kill_ack_mask;
2465 __le32 kill_cts_mask;
2466 u8 bt3_prio_sample_time;
2467 u8 bt3_timer_t2_value;
2468 __le16 bt4_reaction_time; /* unused */
2469 __le32 bt3_lookup_table[12];
2470 __le16 bt4_decision_time; /* unused */
2471 __le16 valid;
2472 u8 prio_boost;
2473 u8 reserved[3];
2474};
2475
b6e116e8 2476#define IWLAGN_BT_SCO_ACTIVE cpu_to_le32(BIT(0))
9e4afc21 2477
b6e116e8 2478struct iwlagn_bt_sco_cmd {
9e4afc21
JB
2479 __le32 flags;
2480};
2481
b481de9c
ZY
2482/******************************************************************************
2483 * (6)
2484 * Spectrum Management (802.11h) Commands, Responses, Notifications:
2485 *
2486 *****************************************************************************/
2487
2488/*
2489 * Spectrum Management
2490 */
2491#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
2492 RXON_FILTER_CTL2HOST_MSK | \
2493 RXON_FILTER_ACCEPT_GRP_MSK | \
2494 RXON_FILTER_DIS_DECRYPT_MSK | \
2495 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
2496 RXON_FILTER_ASSOC_MSK | \
2497 RXON_FILTER_BCON_AWARE_MSK)
2498
2aa6ab86 2499struct iwl_measure_channel {
b481de9c
ZY
2500 __le32 duration; /* measurement duration in extended beacon
2501 * format */
2502 u8 channel; /* channel to measure */
2aa6ab86 2503 u8 type; /* see enum iwl_measure_type */
b481de9c 2504 __le16 reserved;
ba2d3587 2505} __packed;
b481de9c
ZY
2506
2507/*
2508 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
2509 */
2aa6ab86 2510struct iwl_spectrum_cmd {
b481de9c
ZY
2511 __le16 len; /* number of bytes starting from token */
2512 u8 token; /* token id */
2513 u8 id; /* measurement id -- 0 or 1 */
2514 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
2515 u8 periodic; /* 1 = periodic */
2516 __le16 path_loss_timeout;
2517 __le32 start_time; /* start time in extended beacon format */
2518 __le32 reserved2;
2519 __le32 flags; /* rxon flags */
2520 __le32 filter_flags; /* rxon filter flags */
2521 __le16 channel_count; /* minimum 1, maximum 10 */
2522 __le16 reserved3;
2aa6ab86 2523 struct iwl_measure_channel channels[10];
ba2d3587 2524} __packed;
b481de9c
ZY
2525
2526/*
2527 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
2528 */
2aa6ab86 2529struct iwl_spectrum_resp {
b481de9c
ZY
2530 u8 token;
2531 u8 id; /* id of the prior command replaced, or 0xff */
2532 __le16 status; /* 0 - command will be handled
2533 * 1 - cannot handle (conflicts with another
2534 * measurement) */
ba2d3587 2535} __packed;
b481de9c 2536
2aa6ab86 2537enum iwl_measurement_state {
b481de9c
ZY
2538 IWL_MEASUREMENT_START = 0,
2539 IWL_MEASUREMENT_STOP = 1,
2540};
2541
2aa6ab86 2542enum iwl_measurement_status {
b481de9c
ZY
2543 IWL_MEASUREMENT_OK = 0,
2544 IWL_MEASUREMENT_CONCURRENT = 1,
2545 IWL_MEASUREMENT_CSA_CONFLICT = 2,
2546 IWL_MEASUREMENT_TGH_CONFLICT = 3,
2547 /* 4-5 reserved */
2548 IWL_MEASUREMENT_STOPPED = 6,
2549 IWL_MEASUREMENT_TIMEOUT = 7,
2550 IWL_MEASUREMENT_PERIODIC_FAILED = 8,
2551};
2552
2553#define NUM_ELEMENTS_IN_HISTOGRAM 8
2554
2aa6ab86 2555struct iwl_measurement_histogram {
b481de9c
ZY
2556 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
2557 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
ba2d3587 2558} __packed;
b481de9c
ZY
2559
2560/* clear channel availability counters */
2aa6ab86 2561struct iwl_measurement_cca_counters {
b481de9c
ZY
2562 __le32 ofdm;
2563 __le32 cck;
ba2d3587 2564} __packed;
b481de9c 2565
2aa6ab86 2566enum iwl_measure_type {
b481de9c
ZY
2567 IWL_MEASURE_BASIC = (1 << 0),
2568 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
2569 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
2570 IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
2571 IWL_MEASURE_FRAME = (1 << 4),
2572 /* bits 5:6 are reserved */
2573 IWL_MEASURE_IDLE = (1 << 7),
2574};
2575
2576/*
2577 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
2578 */
2aa6ab86 2579struct iwl_spectrum_notification {
b481de9c
ZY
2580 u8 id; /* measurement id -- 0 or 1 */
2581 u8 token;
2582 u8 channel_index; /* index in measurement channel list */
2583 u8 state; /* 0 - start, 1 - stop */
2584 __le32 start_time; /* lower 32-bits of TSF */
2585 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
2586 u8 channel;
2aa6ab86 2587 u8 type; /* see enum iwl_measurement_type */
b481de9c
ZY
2588 u8 reserved1;
2589 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
2590 * valid if applicable for measurement type requested. */
2591 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
2592 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
2593 __le32 cca_time; /* channel load time in usecs */
2594 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
2595 * unidentified */
2596 u8 reserved2[3];
2aa6ab86 2597 struct iwl_measurement_histogram histogram;
b481de9c 2598 __le32 stop_time; /* lower 32-bits of TSF */
2aa6ab86 2599 __le32 status; /* see iwl_measurement_status */
ba2d3587 2600} __packed;
b481de9c
ZY
2601
2602/******************************************************************************
2603 * (7)
2604 * Power Management Commands, Responses, Notifications:
2605 *
2606 *****************************************************************************/
2607
2608/**
ca579617 2609 * struct iwl_powertable_cmd - Power Table Command
b481de9c
ZY
2610 * @flags: See below:
2611 *
2612 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
2613 *
2614 * PM allow:
2615 * bit 0 - '0' Driver not allow power management
2616 * '1' Driver allow PM (use rest of parameters)
e312c24c 2617 *
b481de9c
ZY
2618 * uCode send sleep notifications:
2619 * bit 1 - '0' Don't send sleep notification
2620 * '1' send sleep notification (SEND_PM_NOTIFICATION)
e312c24c 2621 *
b481de9c
ZY
2622 * Sleep over DTIM
2623 * bit 2 - '0' PM have to walk up every DTIM
2624 * '1' PM could sleep over DTIM till listen Interval.
e312c24c 2625 *
b481de9c 2626 * PCI power managed
e7b63581
TW
2627 * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
2628 * '1' !(PCI_CFG_LINK_CTRL & 0x1)
e312c24c
JB
2629 *
2630 * Fast PD
2631 * bit 4 - '1' Put radio to sleep when receiving frame for others
2632 *
b481de9c
ZY
2633 * Force sleep Modes
2634 * bit 31/30- '00' use both mac/xtal sleeps
2635 * '01' force Mac sleep
2636 * '10' force xtal sleep
2637 * '11' Illegal set
2638 *
2639 * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
a96a27f9 2640 * ucode assume sleep over DTIM is allowed and we don't need to wake up
b481de9c
ZY
2641 * for every DTIM.
2642 */
2643#define IWL_POWER_VEC_SIZE 5
2644
600c0e11
TW
2645#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
2646#define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2))
2647#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
2648#define IWL_POWER_FAST_PD cpu_to_le16(BIT(4))
2649
2650struct iwl3945_powertable_cmd {
2651 __le16 flags;
2652 u8 reserved[2];
2653 __le32 rx_data_timeout;
2654 __le32 tx_data_timeout;
2655 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
ba2d3587 2656} __packed;
b481de9c 2657
ca579617 2658struct iwl_powertable_cmd {
b481de9c 2659 __le16 flags;
600c0e11
TW
2660 u8 keep_alive_seconds; /* 3945 reserved */
2661 u8 debug_flags; /* 3945 reserved */
b481de9c
ZY
2662 __le32 rx_data_timeout;
2663 __le32 tx_data_timeout;
2664 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
2665 __le32 keep_alive_beacons;
ba2d3587 2666} __packed;
b481de9c
ZY
2667
2668/*
2669 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
767d055d 2670 * all devices identical.
b481de9c 2671 */
2aa6ab86 2672struct iwl_sleep_notification {
b481de9c
ZY
2673 u8 pm_sleep_mode;
2674 u8 pm_wakeup_src;
2675 __le16 reserved;
2676 __le32 sleep_time;
2677 __le32 tsf_low;
2678 __le32 bcon_timer;
ba2d3587 2679} __packed;
b481de9c 2680
767d055d 2681/* Sleep states. all devices identical. */
b481de9c
ZY
2682enum {
2683 IWL_PM_NO_SLEEP = 0,
2684 IWL_PM_SLP_MAC = 1,
2685 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
2686 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
2687 IWL_PM_SLP_PHY = 4,
2688 IWL_PM_SLP_REPENT = 5,
2689 IWL_PM_WAKEUP_BY_TIMER = 6,
2690 IWL_PM_WAKEUP_BY_DRIVER = 7,
2691 IWL_PM_WAKEUP_BY_RFKILL = 8,
2692 /* 3 reserved */
2693 IWL_PM_NUM_OF_MODES = 12,
2694};
2695
2696/*
2697 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
2698 */
2699#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
2700#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
2701#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
2aa6ab86 2702struct iwl_card_state_cmd {
b481de9c 2703 __le32 status; /* CARD_STATE_CMD_* request new power state */
ba2d3587 2704} __packed;
b481de9c
ZY
2705
2706/*
2707 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
2708 */
2aa6ab86 2709struct iwl_card_state_notif {
b481de9c 2710 __le32 flags;
ba2d3587 2711} __packed;
b481de9c
ZY
2712
2713#define HW_CARD_DISABLED 0x01
2714#define SW_CARD_DISABLED 0x02
3a41bbd5 2715#define CT_CARD_DISABLED 0x04
b481de9c
ZY
2716#define RXON_CARD_DISABLED 0x10
2717
47f4a587 2718struct iwl_ct_kill_config {
b481de9c
ZY
2719 __le32 reserved;
2720 __le32 critical_temperature_M;
2721 __le32 critical_temperature_R;
ba2d3587 2722} __packed;
b481de9c 2723
672639de
WYG
2724/* 1000, and 6x00 */
2725struct iwl_ct_kill_throttling_config {
2726 __le32 critical_temperature_exit;
2727 __le32 reserved;
2728 __le32 critical_temperature_enter;
ba2d3587 2729} __packed;
672639de 2730
b481de9c
ZY
2731/******************************************************************************
2732 * (8)
2733 * Scan Commands, Responses, Notifications:
2734 *
2735 *****************************************************************************/
2736
51e9bf5d
HH
2737#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
2738#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
d16dc48a 2739
3058f021 2740/**
2a421b91 2741 * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
3058f021
BC
2742 *
2743 * One for each channel in the scan list.
2744 * Each channel can independently select:
2745 * 1) SSID for directed active scans
2746 * 2) Txpower setting (for rate specified within Tx command)
2747 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
2748 * quiet_plcp_th, good_CRC_th)
2749 *
2750 * To avoid uCode errors, make sure the following are true (see comments
2a421b91 2751 * under struct iwl_scan_cmd about max_out_time and quiet_time):
3058f021
BC
2752 * 1) If using passive_dwell (i.e. passive_dwell != 0):
2753 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
2754 * 2) quiet_time <= active_dwell
2755 * 3) If restricting off-channel time (i.e. max_out_time !=0):
2756 * passive_dwell < max_out_time
2757 * active_dwell < max_out_time
2758 */
3d24a9f7
TW
2759
2760/* FIXME: rename to AP1, remove tpc */
2761struct iwl3945_scan_channel {
2762 /*
2763 * type is defined as:
2764 * 0:0 1 = active, 0 = passive
2765 * 1:4 SSID direct bit map; if a bit is set, then corresponding
2766 * SSID IE is transmitted in probe request.
2767 * 5:7 reserved
2768 */
2769 u8 type;
2770 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
2771 struct iwl3945_tx_power tpc;
2772 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2773 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
ba2d3587 2774} __packed;
3d24a9f7 2775
0d21044e
WT
2776/* set number of direct probes u8 type */
2777#define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
2778
2a421b91 2779struct iwl_scan_channel {
3058f021
BC
2780 /*
2781 * type is defined as:
2782 * 0:0 1 = active, 0 = passive
d16dc48a 2783 * 1:20 SSID direct bit map; if a bit is set, then corresponding
3058f021 2784 * SSID IE is transmitted in probe request.
d16dc48a 2785 * 21:31 reserved
b481de9c 2786 */
d16dc48a
TW
2787 __le32 type;
2788 __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */
f53696de
TW
2789 u8 tx_gain; /* gain for analog radio */
2790 u8 dsp_atten; /* gain for DSP */
3058f021
BC
2791 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2792 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
ba2d3587 2793} __packed;
b481de9c 2794
0d21044e
WT
2795/* set number of direct probes __le32 type */
2796#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
2797
3058f021 2798/**
2a421b91 2799 * struct iwl_ssid_ie - directed scan network information element
3058f021 2800 *
2a3b793d
BC
2801 * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in
2802 * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel;
2803 * each channel may select different ssids from among the 20 (4) entries.
2804 * SSID IEs get transmitted in reverse order of entry.
3058f021 2805 */
2a421b91 2806struct iwl_ssid_ie {
b481de9c
ZY
2807 u8 id;
2808 u8 len;
2809 u8 ssid[32];
ba2d3587 2810} __packed;
b481de9c 2811
9b3bf06a
JB
2812#define PROBE_OPTION_MAX_3945 4
2813#define PROBE_OPTION_MAX 20
51e9bf5d 2814#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
96ff5641
JB
2815#define IWL_GOOD_CRC_TH_DISABLED 0
2816#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2817#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
b481de9c 2818#define IWL_MAX_SCAN_SIZE 1024
89612124 2819#define IWL_MAX_CMD_SIZE 4096
b481de9c
ZY
2820
2821/*
2822 * REPLY_SCAN_CMD = 0x80 (command)
3058f021
BC
2823 *
2824 * The hardware scan command is very powerful; the driver can set it up to
2825 * maintain (relatively) normal network traffic while doing a scan in the
2826 * background. The max_out_time and suspend_time control the ratio of how
2827 * long the device stays on an associated network channel ("service channel")
2828 * vs. how long it's away from the service channel, i.e. tuned to other channels
2829 * for scanning.
2830 *
2831 * max_out_time is the max time off-channel (in usec), and suspend_time
2832 * is how long (in "extended beacon" format) that the scan is "suspended"
2833 * after returning to the service channel. That is, suspend_time is the
2834 * time that we stay on the service channel, doing normal work, between
2835 * scan segments. The driver may set these parameters differently to support
2836 * scanning when associated vs. not associated, and light vs. heavy traffic
2837 * loads when associated.
2838 *
2839 * After receiving this command, the device's scan engine does the following;
2840 *
2841 * 1) Sends SCAN_START notification to driver
2842 * 2) Checks to see if it has time to do scan for one channel
2843 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
2844 * to tell AP that we're going off-channel
2845 * 4) Tunes to first channel in scan list, does active or passive scan
2846 * 5) Sends SCAN_RESULT notification to driver
2847 * 6) Checks to see if it has time to do scan on *next* channel in list
2848 * 7) Repeats 4-6 until it no longer has time to scan the next channel
2849 * before max_out_time expires
2850 * 8) Returns to service channel
2851 * 9) Sends NULL packet with PS=0 to tell AP that we're back
2852 * 10) Stays on service channel until suspend_time expires
2853 * 11) Repeats entire process 2-10 until list is complete
2854 * 12) Sends SCAN_COMPLETE notification
2855 *
2856 * For fast, efficient scans, the scan command also has support for staying on
2857 * a channel for just a short time, if doing active scanning and getting no
2858 * responses to the transmitted probe request. This time is controlled by
2859 * quiet_time, and the number of received packets below which a channel is
2860 * considered "quiet" is controlled by quiet_plcp_threshold.
2861 *
2862 * For active scanning on channels that have regulatory restrictions against
2863 * blindly transmitting, the scan can listen before transmitting, to make sure
2864 * that there is already legitimate activity on the channel. If enough
2865 * packets are cleanly received on the channel (controlled by good_CRC_th,
2866 * typical value 1), the scan engine starts transmitting probe requests.
2867 *
2868 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
2869 *
2870 * To avoid uCode errors, see timing restrictions described under
2a421b91 2871 * struct iwl_scan_channel.
b481de9c 2872 */
3d24a9f7
TW
2873
2874struct iwl3945_scan_cmd {
2875 __le16 len;
2876 u8 reserved0;
2877 u8 channel_count; /* # channels in channel list */
2878 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2879 * (only for active scan) */
2880 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2881 __le16 good_CRC_th; /* passive -> active promotion threshold */
2882 __le16 reserved1;
2883 __le32 max_out_time; /* max usec to be away from associated (service)
2884 * channel */
2885 __le32 suspend_time; /* pause scan this long (in "extended beacon
2886 * format") when returning to service channel:
2887 * 3945; 31:24 # beacons, 19:0 additional usec,
2888 * 4965; 31:22 # beacons, 21:0 additional usec.
2889 */
2890 __le32 flags; /* RXON_FLG_* */
2891 __le32 filter_flags; /* RXON_FILTER_* */
2892
2893 /* For active scans (set to all-0s for passive scans).
2894 * Does not include payload. Must specify Tx rate; no rate scaling. */
2895 struct iwl3945_tx_cmd tx_cmd;
2896
2897 /* For directed active scans (set to all-0s otherwise) */
9b3bf06a 2898 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
3d24a9f7
TW
2899
2900 /*
2901 * Probe request frame, followed by channel list.
2902 *
2903 * Size of probe request frame is specified by byte count in tx_cmd.
2904 * Channel list follows immediately after probe request frame.
2905 * Number of channels in list is specified by channel_count.
2906 * Each channel in list is of type:
2907 *
2908 * struct iwl3945_scan_channel channels[0];
2909 *
2910 * NOTE: Only one band of channels can be scanned per pass. You
2911 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2912 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2913 * before requesting another scan.
2914 */
2915 u8 data[0];
ba2d3587 2916} __packed;
3d24a9f7 2917
2a421b91 2918struct iwl_scan_cmd {
b481de9c
ZY
2919 __le16 len;
2920 u8 reserved0;
3058f021
BC
2921 u8 channel_count; /* # channels in channel list */
2922 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2923 * (only for active scan) */
2924 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2925 __le16 good_CRC_th; /* passive -> active promotion threshold */
2926 __le16 rx_chain; /* RXON_RX_CHAIN_* */
2927 __le32 max_out_time; /* max usec to be away from associated (service)
2928 * channel */
2929 __le32 suspend_time; /* pause scan this long (in "extended beacon
2930 * format") when returning to service chnl:
2931 * 3945; 31:24 # beacons, 19:0 additional usec,
2932 * 4965; 31:22 # beacons, 21:0 additional usec.
2933 */
2934 __le32 flags; /* RXON_FLG_* */
2935 __le32 filter_flags; /* RXON_FILTER_* */
2936
2937 /* For active scans (set to all-0s for passive scans).
2938 * Does not include payload. Must specify Tx rate; no rate scaling. */
83d527d9 2939 struct iwl_tx_cmd tx_cmd;
3058f021
BC
2940
2941 /* For directed active scans (set to all-0s otherwise) */
2a421b91 2942 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
b481de9c 2943
b481de9c 2944 /*
3058f021
BC
2945 * Probe request frame, followed by channel list.
2946 *
2947 * Size of probe request frame is specified by byte count in tx_cmd.
2948 * Channel list follows immediately after probe request frame.
2949 * Number of channels in list is specified by channel_count.
2950 * Each channel in list is of type:
b481de9c 2951 *
2aa6ab86 2952 * struct iwl_scan_channel channels[0];
b481de9c
ZY
2953 *
2954 * NOTE: Only one band of channels can be scanned per pass. You
3058f021
BC
2955 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2956 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2957 * before requesting another scan.
b481de9c 2958 */
3058f021 2959 u8 data[0];
ba2d3587 2960} __packed;
b481de9c
ZY
2961
2962/* Can abort will notify by complete notification with abort status. */
51e9bf5d 2963#define CAN_ABORT_STATUS cpu_to_le32(0x1)
b481de9c
ZY
2964/* complete notification statuses */
2965#define ABORT_STATUS 0x2
2966
2967/*
2968 * REPLY_SCAN_CMD = 0x80 (response)
2969 */
2a421b91 2970struct iwl_scanreq_notification {
b481de9c 2971 __le32 status; /* 1: okay, 2: cannot fulfill request */
ba2d3587 2972} __packed;
b481de9c
ZY
2973
2974/*
2975 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
2976 */
2a421b91 2977struct iwl_scanstart_notification {
b481de9c
ZY
2978 __le32 tsf_low;
2979 __le32 tsf_high;
2980 __le32 beacon_timer;
2981 u8 channel;
2982 u8 band;
2983 u8 reserved[2];
2984 __le32 status;
ba2d3587 2985} __packed;
b481de9c
ZY
2986
2987#define SCAN_OWNER_STATUS 0x1;
2988#define MEASURE_OWNER_STATUS 0x2;
2989
0288d237
JB
2990#define IWL_PROBE_STATUS_OK 0
2991#define IWL_PROBE_STATUS_TX_FAILED BIT(0)
2992/* error statuses combined with TX_FAILED */
2993#define IWL_PROBE_STATUS_FAIL_TTL BIT(1)
2994#define IWL_PROBE_STATUS_FAIL_BT BIT(2)
2995
b481de9c
ZY
2996#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
2997/*
2998 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
2999 */
2a421b91 3000struct iwl_scanresults_notification {
b481de9c
ZY
3001 u8 channel;
3002 u8 band;
0288d237
JB
3003 u8 probe_status;
3004 u8 num_probe_not_sent; /* not enough time to send */
b481de9c
ZY
3005 __le32 tsf_low;
3006 __le32 tsf_high;
3007 __le32 statistics[NUMBER_OF_STATISTICS];
ba2d3587 3008} __packed;
b481de9c
ZY
3009
3010/*
3011 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
3012 */
2a421b91 3013struct iwl_scancomplete_notification {
b481de9c
ZY
3014 u8 scanned_channels;
3015 u8 status;
3016 u8 reserved;
3017 u8 last_channel;
3018 __le32 tsf_low;
3019 __le32 tsf_high;
ba2d3587 3020} __packed;
b481de9c
ZY
3021
3022
3023/******************************************************************************
3024 * (9)
3025 * IBSS/AP Commands and Notifications:
3026 *
3027 *****************************************************************************/
3028
a85d7cca
JB
3029enum iwl_ibss_manager {
3030 IWL_NOT_IBSS_MANAGER = 0,
3031 IWL_IBSS_MANAGER = 1,
3032};
3033
b481de9c
ZY
3034/*
3035 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
3036 */
3d24a9f7
TW
3037
3038struct iwl3945_beacon_notif {
3039 struct iwl3945_tx_resp beacon_notify_hdr;
3040 __le32 low_tsf;
3041 __le32 high_tsf;
3042 __le32 ibss_mgr_status;
ba2d3587 3043} __packed;
3d24a9f7 3044
bb8c093b
CH
3045struct iwl4965_beacon_notif {
3046 struct iwl4965_tx_resp beacon_notify_hdr;
b481de9c
ZY
3047 __le32 low_tsf;
3048 __le32 high_tsf;
3049 __le32 ibss_mgr_status;
ba2d3587 3050} __packed;
b481de9c
ZY
3051
3052/*
3053 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
3054 */
3d24a9f7
TW
3055
3056struct iwl3945_tx_beacon_cmd {
3057 struct iwl3945_tx_cmd tx;
3058 __le16 tim_idx;
3059 u8 tim_size;
3060 u8 reserved1;
3061 struct ieee80211_hdr frame[0]; /* beacon frame */
ba2d3587 3062} __packed;
3d24a9f7 3063
4bf64efd 3064struct iwl_tx_beacon_cmd {
83d527d9 3065 struct iwl_tx_cmd tx;
b481de9c
ZY
3066 __le16 tim_idx;
3067 u8 tim_size;
3068 u8 reserved1;
3069 struct ieee80211_hdr frame[0]; /* beacon frame */
ba2d3587 3070} __packed;
b481de9c
ZY
3071
3072/******************************************************************************
3073 * (10)
3074 * Statistics Commands and Notifications:
3075 *
3076 *****************************************************************************/
3077
3078#define IWL_TEMP_CONVERT 260
3079
3080#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
3081#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
3082#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
3083
3084/* Used for passing to driver number of successes and failures per rate */
3085struct rate_histogram {
3086 union {
3087 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
3088 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
3089 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
3090 } success;
3091 union {
3092 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
3093 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
3094 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
3095 } failed;
ba2d3587 3096} __packed;
b481de9c
ZY
3097
3098/* statistics command response */
3099
3d24a9f7
TW
3100struct iwl39_statistics_rx_phy {
3101 __le32 ina_cnt;
3102 __le32 fina_cnt;
3103 __le32 plcp_err;
3104 __le32 crc32_err;
3105 __le32 overrun_err;
3106 __le32 early_overrun_err;
3107 __le32 crc32_good;
3108 __le32 false_alarm_cnt;
3109 __le32 fina_sync_err_cnt;
3110 __le32 sfd_timeout;
3111 __le32 fina_timeout;
3112 __le32 unresponded_rts;
3113 __le32 rxe_frame_limit_overrun;
3114 __le32 sent_ack_cnt;
3115 __le32 sent_cts_cnt;
ba2d3587 3116} __packed;
3d24a9f7
TW
3117
3118struct iwl39_statistics_rx_non_phy {
3119 __le32 bogus_cts; /* CTS received when not expecting CTS */
3120 __le32 bogus_ack; /* ACK received when not expecting ACK */
3121 __le32 non_bssid_frames; /* number of frames with BSSID that
3122 * doesn't belong to the STA BSSID */
3123 __le32 filtered_frames; /* count frames that were dumped in the
3124 * filtering process */
3125 __le32 non_channel_beacons; /* beacons with our bss id but not on
3126 * our serving channel */
ba2d3587 3127} __packed;
3d24a9f7
TW
3128
3129struct iwl39_statistics_rx {
3130 struct iwl39_statistics_rx_phy ofdm;
3131 struct iwl39_statistics_rx_phy cck;
3132 struct iwl39_statistics_rx_non_phy general;
ba2d3587 3133} __packed;
3d24a9f7
TW
3134
3135struct iwl39_statistics_tx {
3136 __le32 preamble_cnt;
3137 __le32 rx_detected_cnt;
3138 __le32 bt_prio_defer_cnt;
3139 __le32 bt_prio_kill_cnt;
3140 __le32 few_bytes_cnt;
3141 __le32 cts_timeout;
3142 __le32 ack_timeout;
3143 __le32 expected_ack_cnt;
3144 __le32 actual_ack_cnt;
ba2d3587 3145} __packed;
3d24a9f7
TW
3146
3147struct statistics_dbg {
3148 __le32 burst_check;
3149 __le32 burst_count;
7c094c5c
WYG
3150 __le32 wait_for_silence_timeout_cnt;
3151 __le32 reserved[3];
ba2d3587 3152} __packed;
3d24a9f7
TW
3153
3154struct iwl39_statistics_div {
3155 __le32 tx_on_a;
3156 __le32 tx_on_b;
3157 __le32 exec_time;
3158 __le32 probe_time;
ba2d3587 3159} __packed;
3d24a9f7
TW
3160
3161struct iwl39_statistics_general {
3162 __le32 temperature;
3163 struct statistics_dbg dbg;
3164 __le32 sleep_time;
3165 __le32 slots_out;
3166 __le32 slots_idle;
3167 __le32 ttl_timestamp;
3168 struct iwl39_statistics_div div;
ba2d3587 3169} __packed;
3d24a9f7 3170
b481de9c
ZY
3171struct statistics_rx_phy {
3172 __le32 ina_cnt;
3173 __le32 fina_cnt;
3174 __le32 plcp_err;
3175 __le32 crc32_err;
3176 __le32 overrun_err;
3177 __le32 early_overrun_err;
3178 __le32 crc32_good;
3179 __le32 false_alarm_cnt;
3180 __le32 fina_sync_err_cnt;
3181 __le32 sfd_timeout;
3182 __le32 fina_timeout;
3183 __le32 unresponded_rts;
3184 __le32 rxe_frame_limit_overrun;
3185 __le32 sent_ack_cnt;
3186 __le32 sent_cts_cnt;
b481de9c
ZY
3187 __le32 sent_ba_rsp_cnt;
3188 __le32 dsp_self_kill;
3189 __le32 mh_format_err;
3190 __le32 re_acq_main_rssi_sum;
3191 __le32 reserved3;
ba2d3587 3192} __packed;
b481de9c 3193
b481de9c
ZY
3194struct statistics_rx_ht_phy {
3195 __le32 plcp_err;
3196 __le32 overrun_err;
3197 __le32 early_overrun_err;
3198 __le32 crc32_good;
3199 __le32 crc32_err;
3200 __le32 mh_format_err;
3201 __le32 agg_crc32_good;
3202 __le32 agg_mpdu_cnt;
3203 __le32 agg_cnt;
f0118a45 3204 __le32 unsupport_mcs;
ba2d3587 3205} __packed;
b481de9c 3206
c1b4aa3f 3207#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
34c22cf9 3208
b481de9c
ZY
3209struct statistics_rx_non_phy {
3210 __le32 bogus_cts; /* CTS received when not expecting CTS */
3211 __le32 bogus_ack; /* ACK received when not expecting ACK */
3212 __le32 non_bssid_frames; /* number of frames with BSSID that
3213 * doesn't belong to the STA BSSID */
3214 __le32 filtered_frames; /* count frames that were dumped in the
3215 * filtering process */
3216 __le32 non_channel_beacons; /* beacons with our bss id but not on
3217 * our serving channel */
b481de9c
ZY
3218 __le32 channel_beacons; /* beacons with our bss id and in our
3219 * serving channel */
3220 __le32 num_missed_bcon; /* number of missed beacons */
3221 __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
3222 * ADC was in saturation */
3223 __le32 ina_detection_search_time;/* total time (in 0.8us) searched
3224 * for INA */
3225 __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
3226 __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
3227 __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
3228 __le32 interference_data_flag; /* flag for interference data
3229 * availability. 1 when data is
3230 * available. */
3058f021 3231 __le32 channel_load; /* counts RX Enable time in uSec */
b481de9c
ZY
3232 __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
3233 * and CCK) counter */
3234 __le32 beacon_rssi_a;
3235 __le32 beacon_rssi_b;
3236 __le32 beacon_rssi_c;
3237 __le32 beacon_energy_a;
3238 __le32 beacon_energy_b;
3239 __le32 beacon_energy_c;
ba2d3587 3240} __packed;
b481de9c 3241
325322ee
WYG
3242struct statistics_rx_non_phy_bt {
3243 struct statistics_rx_non_phy common;
3244 /* additional stats for bt */
3245 __le32 num_bt_kills;
3246 __le32 reserved[2];
da22f795 3247} __packed;
325322ee 3248
b481de9c
ZY
3249struct statistics_rx {
3250 struct statistics_rx_phy ofdm;
3251 struct statistics_rx_phy cck;
3252 struct statistics_rx_non_phy general;
b481de9c 3253 struct statistics_rx_ht_phy ofdm_ht;
ba2d3587 3254} __packed;
b481de9c 3255
325322ee
WYG
3256struct statistics_rx_bt {
3257 struct statistics_rx_phy ofdm;
3258 struct statistics_rx_phy cck;
3259 struct statistics_rx_non_phy_bt general;
3260 struct statistics_rx_ht_phy ofdm_ht;
da22f795 3261} __packed;
325322ee 3262
fcbaf8b0
WYG
3263/**
3264 * struct statistics_tx_power - current tx power
3265 *
3266 * @ant_a: current tx power on chain a in 1/2 dB step
3267 * @ant_b: current tx power on chain b in 1/2 dB step
3268 * @ant_c: current tx power on chain c in 1/2 dB step
3269 */
3270struct statistics_tx_power {
3271 u8 ant_a;
3272 u8 ant_b;
3273 u8 ant_c;
3274 u8 reserved;
ba2d3587 3275} __packed;
fcbaf8b0 3276
b481de9c
ZY
3277struct statistics_tx_non_phy_agg {
3278 __le32 ba_timeout;
3279 __le32 ba_reschedule_frames;
3280 __le32 scd_query_agg_frame_cnt;
3281 __le32 scd_query_no_agg;
3282 __le32 scd_query_agg;
3283 __le32 scd_query_mismatch;
3284 __le32 frame_not_ready;
3285 __le32 underrun;
3286 __le32 bt_prio_kill;
3287 __le32 rx_ba_rsp_cnt;
ba2d3587 3288} __packed;
b481de9c
ZY
3289
3290struct statistics_tx {
3291 __le32 preamble_cnt;
3292 __le32 rx_detected_cnt;
3293 __le32 bt_prio_defer_cnt;
3294 __le32 bt_prio_kill_cnt;
3295 __le32 few_bytes_cnt;
3296 __le32 cts_timeout;
3297 __le32 ack_timeout;
3298 __le32 expected_ack_cnt;
3299 __le32 actual_ack_cnt;
b481de9c
ZY
3300 __le32 dump_msdu_cnt;
3301 __le32 burst_abort_next_frame_mismatch_cnt;
3302 __le32 burst_abort_missing_next_frame_cnt;
3303 __le32 cts_timeout_collision;
3304 __le32 ack_or_ba_timeout_collision;
3305 struct statistics_tx_non_phy_agg agg;
470356b8
WYG
3306 /*
3307 * "tx_power" are optional parameters provided by uCode,
3308 * 6000 series is the only device provide the information,
3309 * Those are reserved fields for all the other devices
3310 */
fcbaf8b0
WYG
3311 struct statistics_tx_power tx_power;
3312 __le32 reserved1;
ba2d3587 3313} __packed;
b481de9c 3314
b481de9c
ZY
3315
3316struct statistics_div {
3317 __le32 tx_on_a;
3318 __le32 tx_on_b;
3319 __le32 exec_time;
3320 __le32 probe_time;
b481de9c
ZY
3321 __le32 reserved1;
3322 __le32 reserved2;
ba2d3587 3323} __packed;
b481de9c 3324
325322ee 3325struct statistics_general_common {
f0118a45
WYG
3326 __le32 temperature; /* radio temperature */
3327 __le32 temperature_m; /* for 5000 and up, this is radio voltage */
b481de9c
ZY
3328 struct statistics_dbg dbg;
3329 __le32 sleep_time;
3330 __le32 slots_out;
3331 __le32 slots_idle;
3332 __le32 ttl_timestamp;
3333 struct statistics_div div;
b481de9c 3334 __le32 rx_enable_counter;
11fc5249
WYG
3335 /*
3336 * num_of_sos_states:
3337 * count the number of times we have to re-tune
3338 * in order to get out of bad PHY status
3339 */
3340 __le32 num_of_sos_states;
da22f795 3341} __packed;
325322ee
WYG
3342
3343struct statistics_bt_activity {
3344 /* Tx statistics */
3345 __le32 hi_priority_tx_req_cnt;
3346 __le32 hi_priority_tx_denied_cnt;
3347 __le32 lo_priority_tx_req_cnt;
3348 __le32 lo_priority_tx_denied_cnt;
3349 /* Rx statistics */
3350 __le32 hi_priority_rx_req_cnt;
3351 __le32 hi_priority_rx_denied_cnt;
3352 __le32 lo_priority_rx_req_cnt;
3353 __le32 lo_priority_rx_denied_cnt;
da22f795 3354} __packed;
325322ee
WYG
3355
3356struct statistics_general {
3357 struct statistics_general_common common;
3358 __le32 reserved2;
3359 __le32 reserved3;
da22f795 3360} __packed;
325322ee
WYG
3361
3362struct statistics_general_bt {
3363 struct statistics_general_common common;
3364 struct statistics_bt_activity activity;
b481de9c
ZY
3365 __le32 reserved2;
3366 __le32 reserved3;
ba2d3587 3367} __packed;
b481de9c 3368
ef8d5529
WYG
3369#define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0)
3370#define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1)
3371#define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2)
3372
b481de9c
ZY
3373/*
3374 * REPLY_STATISTICS_CMD = 0x9c,
767d055d 3375 * all devices identical.
b481de9c
ZY
3376 *
3377 * This command triggers an immediate response containing uCode statistics.
3378 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
3379 *
3380 * If the CLEAR_STATS configuration flag is set, uCode will clear its
3381 * internal copy of the statistics (counters) after issuing the response.
3382 * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
3383 *
3384 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
3385 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
3386 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
3387 */
51e9bf5d
HH
3388#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
3389#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
8f91aecb 3390struct iwl_statistics_cmd {
b481de9c 3391 __le32 configuration_flags; /* IWL_STATS_CONF_* */
ba2d3587 3392} __packed;
b481de9c
ZY
3393
3394/*
3395 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
3396 *
3397 * By default, uCode issues this notification after receiving a beacon
3398 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
3399 * REPLY_STATISTICS_CMD 0x9c, above.
3400 *
3401 * Statistics counters continue to increment beacon after beacon, but are
3402 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
3403 * 0x9c with CLEAR_STATS bit set (see above).
3404 *
3405 * uCode also issues this notification during scans. uCode clears statistics
3406 * appropriately so that each notification contains statistics for only the
3407 * one channel that has just been scanned.
3408 */
51e9bf5d 3409#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
7aafef1c 3410#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
3d24a9f7
TW
3411
3412struct iwl3945_notif_statistics {
3413 __le32 flag;
3414 struct iwl39_statistics_rx rx;
3415 struct iwl39_statistics_tx tx;
3416 struct iwl39_statistics_general general;
ba2d3587 3417} __packed;
3d24a9f7 3418
8f91aecb 3419struct iwl_notif_statistics {
b481de9c
ZY
3420 __le32 flag;
3421 struct statistics_rx rx;
3422 struct statistics_tx tx;
3423 struct statistics_general general;
ba2d3587 3424} __packed;
b481de9c 3425
325322ee
WYG
3426struct iwl_bt_notif_statistics {
3427 __le32 flag;
3428 struct statistics_rx_bt rx;
3429 struct statistics_tx tx;
3430 struct statistics_general_bt general;
da22f795 3431} __packed;
b481de9c
ZY
3432
3433/*
3434 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
a13d276f
WYG
3435 *
3436 * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed
3437 * in regardless of how many missed beacons, which mean when driver receive the
3438 * notification, inside the command, it can find all the beacons information
3439 * which include number of total missed beacons, number of consecutive missed
3440 * beacons, number of beacons received and number of beacons expected to
3441 * receive.
3442 *
3443 * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3444 * in order to bring the radio/PHY back to working state; which has no relation
3445 * to when driver will perform sensitivity calibration.
3446 *
3447 * Driver should set it own missed_beacon_threshold to decide when to perform
3448 * sensitivity calibration based on number of consecutive missed beacons in
3449 * order to improve overall performance, especially in noisy environment.
3450 *
b481de9c 3451 */
a13d276f
WYG
3452
3453#define IWL_MISSED_BEACON_THRESHOLD_MIN (1)
3454#define IWL_MISSED_BEACON_THRESHOLD_DEF (5)
3455#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF
b481de9c 3456
2aa6ab86 3457struct iwl_missed_beacon_notif {
a13d276f 3458 __le32 consecutive_missed_beacons;
b481de9c
ZY
3459 __le32 total_missed_becons;
3460 __le32 num_expected_beacons;
3461 __le32 num_recvd_beacons;
ba2d3587 3462} __packed;
b481de9c 3463
f7d09d7c 3464
b481de9c
ZY
3465/******************************************************************************
3466 * (11)
3467 * Rx Calibration Commands:
3468 *
f7d09d7c
BC
3469 * With the uCode used for open source drivers, most Tx calibration (except
3470 * for Tx Power) and most Rx calibration is done by uCode during the
3471 * "initialize" phase of uCode boot. Driver must calibrate only:
3472 *
3473 * 1) Tx power (depends on temperature), described elsewhere
3474 * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
3475 * 3) Receiver sensitivity (to optimize signal detection)
3476 *
b481de9c
ZY
3477 *****************************************************************************/
3478
f7d09d7c
BC
3479/**
3480 * SENSITIVITY_CMD = 0xa8 (command, has simple generic response)
3481 *
3482 * This command sets up the Rx signal detector for a sensitivity level that
3483 * is high enough to lock onto all signals within the associated network,
3484 * but low enough to ignore signals that are below a certain threshold, so as
3485 * not to have too many "false alarms". False alarms are signals that the
3486 * Rx DSP tries to lock onto, but then discards after determining that they
3487 * are noise.
3488 *
3489 * The optimum number of false alarms is between 5 and 50 per 200 TUs
3490 * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
3491 * time listening, not transmitting). Driver must adjust sensitivity so that
3492 * the ratio of actual false alarms to actual Rx time falls within this range.
3493 *
3494 * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each
3495 * received beacon. These provide information to the driver to analyze the
3496 * sensitivity. Don't analyze statistics that come in from scanning, or any
3497 * other non-associated-network source. Pertinent statistics include:
3498 *
3499 * From "general" statistics (struct statistics_rx_non_phy):
3500 *
3501 * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
3502 * Measure of energy of desired signal. Used for establishing a level
3503 * below which the device does not detect signals.
3504 *
3505 * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
3506 * Measure of background noise in silent period after beacon.
3507 *
3508 * channel_load
3509 * uSecs of actual Rx time during beacon period (varies according to
3510 * how much time was spent transmitting).
3511 *
3512 * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately:
3513 *
3514 * false_alarm_cnt
3515 * Signal locks abandoned early (before phy-level header).
3516 *
3517 * plcp_err
3518 * Signal locks abandoned late (during phy-level header).
3519 *
3520 * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
3521 * beacon to beacon, i.e. each value is an accumulation of all errors
3522 * before and including the latest beacon. Values will wrap around to 0
3523 * after counting up to 2^32 - 1. Driver must differentiate vs.
3524 * previous beacon's values to determine # false alarms in the current
3525 * beacon period.
3526 *
3527 * Total number of false alarms = false_alarms + plcp_errs
3528 *
3529 * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd
3530 * (notice that the start points for OFDM are at or close to settings for
3531 * maximum sensitivity):
3532 *
3533 * START / MIN / MAX
3534 * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120
3535 * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210
3536 * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140
3537 * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270
3538 *
3539 * If actual rate of OFDM false alarms (+ plcp_errors) is too high
3540 * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
3541 * by *adding* 1 to all 4 of the table entries above, up to the max for
3542 * each entry. Conversely, if false alarm rate is too low (less than 5
3543 * for each 204.8 msecs listening), *subtract* 1 from each entry to
3544 * increase sensitivity.
3545 *
3546 * For CCK sensitivity, keep track of the following:
3547 *
3548 * 1). 20-beacon history of maximum background noise, indicated by
3549 * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
3550 * 3 receivers. For any given beacon, the "silence reference" is
3551 * the maximum of last 60 samples (20 beacons * 3 receivers).
3552 *
3553 * 2). 10-beacon history of strongest signal level, as indicated
3554 * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
3555 * i.e. the strength of the signal through the best receiver at the
3556 * moment. These measurements are "upside down", with lower values
3557 * for stronger signals, so max energy will be *minimum* value.
3558 *
3559 * Then for any given beacon, the driver must determine the *weakest*
3560 * of the strongest signals; this is the minimum level that needs to be
3561 * successfully detected, when using the best receiver at the moment.
3562 * "Max cck energy" is the maximum (higher value means lower energy!)
3563 * of the last 10 minima. Once this is determined, driver must add
3564 * a little margin by adding "6" to it.
3565 *
3566 * 3). Number of consecutive beacon periods with too few false alarms.
3567 * Reset this to 0 at the first beacon period that falls within the
3568 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3569 *
3570 * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd
3571 * (notice that the start points for CCK are at maximum sensitivity):
3572 *
3573 * START / MIN / MAX
3574 * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200
3575 * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400
3576 * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100
3577 *
3578 * If actual rate of CCK false alarms (+ plcp_errors) is too high
3579 * (greater than 50 for each 204.8 msecs listening), method for reducing
3580 * sensitivity is:
3581 *
3582 * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3583 * up to max 400.
3584 *
3585 * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160,
3586 * sensitivity has been reduced a significant amount; bring it up to
3587 * a moderate 161. Otherwise, *add* 3, up to max 200.
3588 *
3589 * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160,
3590 * sensitivity has been reduced only a moderate or small amount;
3591 * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX,
3592 * down to min 0. Otherwise (if gain has been significantly reduced),
3593 * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value.
3594 *
3595 * b) Save a snapshot of the "silence reference".
3596 *
3597 * If actual rate of CCK false alarms (+ plcp_errors) is too low
3598 * (less than 5 for each 204.8 msecs listening), method for increasing
3599 * sensitivity is used only if:
3600 *
3601 * 1a) Previous beacon did not have too many false alarms
3602 * 1b) AND difference between previous "silence reference" and current
3603 * "silence reference" (prev - current) is 2 or more,
3604 * OR 2) 100 or more consecutive beacon periods have had rate of
3605 * less than 5 false alarms per 204.8 milliseconds rx time.
3606 *
3607 * Method for increasing sensitivity:
3608 *
3609 * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX,
3610 * down to min 125.
3611 *
3612 * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3613 * down to min 200.
3614 *
3615 * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100.
3616 *
3617 * If actual rate of CCK false alarms (+ plcp_errors) is within good range
3618 * (between 5 and 50 for each 204.8 msecs listening):
3619 *
3620 * 1) Save a snapshot of the silence reference.
3621 *
3622 * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
3623 * give some extra margin to energy threshold by *subtracting* 8
3624 * from value in HD_MIN_ENERGY_CCK_DET_INDEX.
3625 *
3626 * For all cases (too few, too many, good range), make sure that the CCK
3627 * detection threshold (energy) is below the energy level for robust
3628 * detection over the past 10 beacon periods, the "Max cck energy".
3629 * Lower values mean higher energy; this means making sure that the value
3630 * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
3631 *
f7d09d7c
BC
3632 */
3633
3634/*
f0832f13 3635 * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd)
f7d09d7c
BC
3636 */
3637#define HD_TABLE_SIZE (11) /* number of entries */
3638#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */
3639#define HD_MIN_ENERGY_OFDM_DET_INDEX (1)
3640#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2)
3641#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3)
3642#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4)
3643#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5)
3644#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6)
3645#define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7)
3646#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8)
3647#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)
3648#define HD_OFDM_ENERGY_TH_IN_INDEX (10)
3649
c8312fac
WYG
3650/*
3651 * Additional table entries in enhance SENSITIVITY_CMD
3652 */
3653#define HD_INA_NON_SQUARE_DET_OFDM_INDEX (11)
3654#define HD_INA_NON_SQUARE_DET_CCK_INDEX (12)
3655#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX (13)
3656#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX (14)
3657#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (15)
3658#define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX (16)
3659#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX (17)
3660#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX (18)
3661#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (19)
3662#define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX (20)
3663#define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX (21)
3664#define HD_RESERVED (22)
3665
3666/* number of entries for enhanced tbl */
3667#define ENHANCE_HD_TABLE_SIZE (23)
3668
3669/* number of additional entries for enhanced tbl */
3670#define ENHANCE_HD_TABLE_ENTRIES (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE)
3671
3672#define HD_INA_NON_SQUARE_DET_OFDM_DATA cpu_to_le16(0)
3673#define HD_INA_NON_SQUARE_DET_CCK_DATA cpu_to_le16(0)
3674#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA cpu_to_le16(0)
3675#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA cpu_to_le16(668)
3676#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA cpu_to_le16(4)
3677#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA cpu_to_le16(486)
3678#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA cpu_to_le16(37)
3679#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA cpu_to_le16(853)
3680#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA cpu_to_le16(4)
3681#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA cpu_to_le16(476)
3682#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA cpu_to_le16(99)
3683
3684
f0832f13 3685/* Control field in struct iwl_sensitivity_cmd */
51e9bf5d
HH
3686#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0)
3687#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1)
b481de9c 3688
f7d09d7c 3689/**
f0832f13 3690 * struct iwl_sensitivity_cmd
f7d09d7c
BC
3691 * @control: (1) updates working table, (0) updates default table
3692 * @table: energy threshold values, use HD_* as index into table
3693 *
3694 * Always use "1" in "control" to update uCode's working table and DSP.
3695 */
f0832f13 3696struct iwl_sensitivity_cmd {
f7d09d7c
BC
3697 __le16 control; /* always use "1" */
3698 __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */
ba2d3587 3699} __packed;
b481de9c 3700
c8312fac
WYG
3701/*
3702 *
3703 */
3704struct iwl_enhance_sensitivity_cmd {
3705 __le16 control; /* always use "1" */
3706 __le16 enhance_table[ENHANCE_HD_TABLE_SIZE]; /* use HD_* as index */
0e954099 3707} __packed;
c8312fac 3708
f7d09d7c
BC
3709
3710/**
3711 * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response)
3712 *
767d055d 3713 * This command sets the relative gains of agn device's 3 radio receiver chains.
f7d09d7c
BC
3714 *
3715 * After the first association, driver should accumulate signal and noise
3716 * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20
3717 * beacons from the associated network (don't collect statistics that come
3718 * in from scanning, or any other non-network source).
3719 *
3720 * DISCONNECTED ANTENNA:
3721 *
3722 * Driver should determine which antennas are actually connected, by comparing
3723 * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
3724 * following values over 20 beacons, one accumulator for each of the chains
3725 * a/b/c, from struct statistics_rx_non_phy:
3726 *
3727 * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
3728 *
3729 * Find the strongest signal from among a/b/c. Compare the other two to the
3730 * strongest. If any signal is more than 15 dB (times 20, unless you
3731 * divide the accumulated values by 20) below the strongest, the driver
3732 * considers that antenna to be disconnected, and should not try to use that
3733 * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
3734 * driver should declare the stronger one as connected, and attempt to use it
3735 * (A and B are the only 2 Tx chains!).
3736 *
3737 *
3738 * RX BALANCE:
3739 *
3740 * Driver should balance the 3 receivers (but just the ones that are connected
3741 * to antennas, see above) for gain, by comparing the average signal levels
3742 * detected during the silence after each beacon (background noise).
3743 * Accumulate (add) the following values over 20 beacons, one accumulator for
3744 * each of the chains a/b/c, from struct statistics_rx_non_phy:
3745 *
3746 * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
3747 *
3748 * Find the weakest background noise level from among a/b/c. This Rx chain
3749 * will be the reference, with 0 gain adjustment. Attenuate other channels by
3750 * finding noise difference:
3751 *
3752 * (accum_noise[i] - accum_noise[reference]) / 30
3753 *
3754 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
3755 * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the
3756 * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3757 * and set bit 2 to indicate "reduce gain". The value for the reference
3758 * (weakest) chain should be "0".
3759 *
3760 * diff_gain_[abc] bit fields:
3761 * 2: (1) reduce gain, (0) increase gain
3762 * 1-0: amount of gain, units of 1.5 dB
3763 */
3764
f69f42a6 3765/* Phy calibration command for series */
33fd5033
EG
3766
3767enum {
f69f42a6
TW
3768 IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
3769 IWL_PHY_CALIBRATE_DC_CMD = 8,
3770 IWL_PHY_CALIBRATE_LO_CMD = 9,
f69f42a6 3771 IWL_PHY_CALIBRATE_TX_IQ_CMD = 11,
f69f42a6
TW
3772 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15,
3773 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16,
3774 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
6a822d06 3775 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 18,
33fd5033
EG
3776};
3777
6a822d06 3778#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
f69f42a6 3779
51e9bf5d 3780#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff)
7c616cba
TW
3781
3782struct iwl_calib_cfg_elmnt_s {
3783 __le32 is_enable;
3784 __le32 start;
3785 __le32 send_res;
3786 __le32 apply_res;
3787 __le32 reserved;
ba2d3587 3788} __packed;
7c616cba
TW
3789
3790struct iwl_calib_cfg_status_s {
3791 struct iwl_calib_cfg_elmnt_s once;
3792 struct iwl_calib_cfg_elmnt_s perd;
3793 __le32 flags;
ba2d3587 3794} __packed;
7c616cba 3795
f69f42a6 3796struct iwl_calib_cfg_cmd {
7c616cba
TW
3797 struct iwl_calib_cfg_status_s ucd_calib_cfg;
3798 struct iwl_calib_cfg_status_s drv_calib_cfg;
3799 __le32 reserved1;
ba2d3587 3800} __packed;
7c616cba 3801
f69f42a6 3802struct iwl_calib_hdr {
7c616cba
TW
3803 u8 op_code;
3804 u8 first_group;
3805 u8 groups_num;
3806 u8 data_valid;
ba2d3587 3807} __packed;
7c616cba 3808
f69f42a6
TW
3809struct iwl_calib_cmd {
3810 struct iwl_calib_hdr hdr;
be5d56ed 3811 u8 data[0];
ba2d3587 3812} __packed;
be5d56ed 3813
0d950d84 3814/* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
f69f42a6 3815struct iwl_calib_diff_gain_cmd {
0d950d84 3816 struct iwl_calib_hdr hdr;
f69f42a6
TW
3817 s8 diff_gain_a; /* see above */
3818 s8 diff_gain_b;
3819 s8 diff_gain_c;
3820 u8 reserved1;
ba2d3587 3821} __packed;
f69f42a6 3822
0d950d84
TW
3823struct iwl_calib_xtal_freq_cmd {
3824 struct iwl_calib_hdr hdr;
3825 u8 cap_pin1;
3826 u8 cap_pin2;
3827 u8 pad[2];
ba2d3587 3828} __packed;
33fd5033 3829
0d950d84
TW
3830/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
3831struct iwl_calib_chain_noise_reset_cmd {
3832 struct iwl_calib_hdr hdr;
3833 u8 data[0];
3834};
3835
3836/* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */
f69f42a6 3837struct iwl_calib_chain_noise_gain_cmd {
0d950d84 3838 struct iwl_calib_hdr hdr;
33fd5033
EG
3839 u8 delta_gain_1;
3840 u8 delta_gain_2;
0d950d84 3841 u8 pad[2];
ba2d3587 3842} __packed;
33fd5033 3843
b481de9c
ZY
3844/******************************************************************************
3845 * (12)
3846 * Miscellaneous Commands:
3847 *
3848 *****************************************************************************/
3849
3850/*
3851 * LEDs Command & Response
3852 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
3853 *
3854 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3855 * this command turns it on or off, or sets up a periodic blinking cycle.
3856 */
ec1a7460 3857struct iwl_led_cmd {
b481de9c
ZY
3858 __le32 interval; /* "interval" in uSec */
3859 u8 id; /* 1: Activity, 2: Link, 3: Tech */
3860 u8 off; /* # intervals off while blinking;
3861 * "0", with >0 "on" value, turns LED on */
3862 u8 on; /* # intervals on while blinking;
3863 * "0", regardless of "off", turns LED off */
3864 u8 reserved;
ba2d3587 3865} __packed;
b481de9c 3866
9636e583 3867/*
fe1bcbfd
WYG
3868 * station priority table entries
3869 * also used as potential "events" value for both
3870 * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD
9636e583 3871 */
1933ac4d
WYG
3872
3873/*
3874 * COEX events entry flag masks
3875 * RP - Requested Priority
3876 * WP - Win Medium Priority: priority assigned when the contention has been won
3877 */
3878#define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG (0x1)
3879#define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG (0x2)
3880#define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG (0x4)
3881
3882#define COEX_CU_UNASSOC_IDLE_RP 4
3883#define COEX_CU_UNASSOC_MANUAL_SCAN_RP 4
3884#define COEX_CU_UNASSOC_AUTO_SCAN_RP 4
3885#define COEX_CU_CALIBRATION_RP 4
3886#define COEX_CU_PERIODIC_CALIBRATION_RP 4
3887#define COEX_CU_CONNECTION_ESTAB_RP 4
3888#define COEX_CU_ASSOCIATED_IDLE_RP 4
3889#define COEX_CU_ASSOC_MANUAL_SCAN_RP 4
3890#define COEX_CU_ASSOC_AUTO_SCAN_RP 4
3891#define COEX_CU_ASSOC_ACTIVE_LEVEL_RP 4
3892#define COEX_CU_RF_ON_RP 6
3893#define COEX_CU_RF_OFF_RP 4
3894#define COEX_CU_STAND_ALONE_DEBUG_RP 6
3895#define COEX_CU_IPAN_ASSOC_LEVEL_RP 4
3896#define COEX_CU_RSRVD1_RP 4
3897#define COEX_CU_RSRVD2_RP 4
3898
3899#define COEX_CU_UNASSOC_IDLE_WP 3
3900#define COEX_CU_UNASSOC_MANUAL_SCAN_WP 3
3901#define COEX_CU_UNASSOC_AUTO_SCAN_WP 3
3902#define COEX_CU_CALIBRATION_WP 3
3903#define COEX_CU_PERIODIC_CALIBRATION_WP 3
3904#define COEX_CU_CONNECTION_ESTAB_WP 3
3905#define COEX_CU_ASSOCIATED_IDLE_WP 3
3906#define COEX_CU_ASSOC_MANUAL_SCAN_WP 3
3907#define COEX_CU_ASSOC_AUTO_SCAN_WP 3
3908#define COEX_CU_ASSOC_ACTIVE_LEVEL_WP 3
3909#define COEX_CU_RF_ON_WP 3
3910#define COEX_CU_RF_OFF_WP 3
3911#define COEX_CU_STAND_ALONE_DEBUG_WP 6
3912#define COEX_CU_IPAN_ASSOC_LEVEL_WP 3
3913#define COEX_CU_RSRVD1_WP 3
3914#define COEX_CU_RSRVD2_WP 3
3915
3916#define COEX_UNASSOC_IDLE_FLAGS 0
3917#define COEX_UNASSOC_MANUAL_SCAN_FLAGS \
3918 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3919 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3920#define COEX_UNASSOC_AUTO_SCAN_FLAGS \
3921 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3922 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3923#define COEX_CALIBRATION_FLAGS \
3924 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3925 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3926#define COEX_PERIODIC_CALIBRATION_FLAGS 0
3927/*
3928 * COEX_CONNECTION_ESTAB:
3929 * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
3930 */
3931#define COEX_CONNECTION_ESTAB_FLAGS \
3932 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3933 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \
3934 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
3935#define COEX_ASSOCIATED_IDLE_FLAGS 0
3936#define COEX_ASSOC_MANUAL_SCAN_FLAGS \
3937 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3938 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3939#define COEX_ASSOC_AUTO_SCAN_FLAGS \
3940 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3941 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3942#define COEX_ASSOC_ACTIVE_LEVEL_FLAGS 0
3943#define COEX_RF_ON_FLAGS 0
3944#define COEX_RF_OFF_FLAGS 0
3945#define COEX_STAND_ALONE_DEBUG_FLAGS \
3946 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3947 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
3948#define COEX_IPAN_ASSOC_LEVEL_FLAGS \
3949 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3950 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \
3951 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
3952#define COEX_RSRVD1_FLAGS 0
3953#define COEX_RSRVD2_FLAGS 0
3954/*
3955 * COEX_CU_RF_ON is the event wrapping all radio ownership.
3956 * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
3957 */
3958#define COEX_CU_RF_ON_FLAGS \
3959 (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \
3960 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \
3961 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
3962
3963
9636e583 3964enum {
fe1bcbfd 3965 /* un-association part */
9636e583
RR
3966 COEX_UNASSOC_IDLE = 0,
3967 COEX_UNASSOC_MANUAL_SCAN = 1,
3968 COEX_UNASSOC_AUTO_SCAN = 2,
fe1bcbfd 3969 /* calibration */
9636e583
RR
3970 COEX_CALIBRATION = 3,
3971 COEX_PERIODIC_CALIBRATION = 4,
fe1bcbfd 3972 /* connection */
9636e583 3973 COEX_CONNECTION_ESTAB = 5,
fe1bcbfd 3974 /* association part */
9636e583
RR
3975 COEX_ASSOCIATED_IDLE = 6,
3976 COEX_ASSOC_MANUAL_SCAN = 7,
3977 COEX_ASSOC_AUTO_SCAN = 8,
3978 COEX_ASSOC_ACTIVE_LEVEL = 9,
fe1bcbfd 3979 /* RF ON/OFF */
9636e583
RR
3980 COEX_RF_ON = 10,
3981 COEX_RF_OFF = 11,
3982 COEX_STAND_ALONE_DEBUG = 12,
fe1bcbfd 3983 /* IPAN */
9636e583 3984 COEX_IPAN_ASSOC_LEVEL = 13,
fe1bcbfd 3985 /* reserved */
9636e583
RR
3986 COEX_RSRVD1 = 14,
3987 COEX_RSRVD2 = 15,
3988 COEX_NUM_OF_EVENTS = 16
3989};
3990
fe1bcbfd
WYG
3991/*
3992 * Coexistence WIFI/WIMAX Command
3993 * COEX_PRIORITY_TABLE_CMD = 0x5a
3994 *
3995 */
9636e583
RR
3996struct iwl_wimax_coex_event_entry {
3997 u8 request_prio;
3998 u8 win_medium_prio;
3999 u8 reserved;
4000 u8 flags;
ba2d3587 4001} __packed;
9636e583
RR
4002
4003/* COEX flag masks */
4004
a96a27f9 4005/* Station table is valid */
9636e583 4006#define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1)
a96a27f9 4007/* UnMask wake up src at unassociated sleep */
9636e583 4008#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4)
a96a27f9 4009/* UnMask wake up src at associated sleep */
9636e583
RR
4010#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8)
4011/* Enable CoEx feature. */
4012#define COEX_FLAGS_COEX_ENABLE_MSK (0x80)
4013
4014struct iwl_wimax_coex_cmd {
4015 u8 flags;
4016 u8 reserved[3];
4017 struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
ba2d3587 4018} __packed;
9636e583 4019
fe1bcbfd
WYG
4020/*
4021 * Coexistence MEDIUM NOTIFICATION
4022 * COEX_MEDIUM_NOTIFICATION = 0x5b
4023 *
4024 * notification from uCode to host to indicate medium changes
4025 *
4026 */
4027/*
4028 * status field
4029 * bit 0 - 2: medium status
4030 * bit 3: medium change indication
4031 * bit 4 - 31: reserved
4032 */
4033/* status option values, (0 - 2 bits) */
4034#define COEX_MEDIUM_BUSY (0x0) /* radio belongs to WiMAX */
4035#define COEX_MEDIUM_ACTIVE (0x1) /* radio belongs to WiFi */
4036#define COEX_MEDIUM_PRE_RELEASE (0x2) /* received radio release */
4037#define COEX_MEDIUM_MSK (0x7)
4038
4039/* send notification status (1 bit) */
4040#define COEX_MEDIUM_CHANGED (0x8)
4041#define COEX_MEDIUM_CHANGED_MSK (0x8)
4042#define COEX_MEDIUM_SHIFT (3)
4043
4044struct iwl_coex_medium_notification {
4045 __le32 status;
4046 __le32 events;
ba2d3587 4047} __packed;
fe1bcbfd
WYG
4048
4049/*
4050 * Coexistence EVENT Command
4051 * COEX_EVENT_CMD = 0x5c
4052 *
4053 * send from host to uCode for coex event request.
4054 */
4055/* flags options */
4056#define COEX_EVENT_REQUEST_MSK (0x1)
4057
4058struct iwl_coex_event_cmd {
4059 u8 flags;
4060 u8 event;
4061 __le16 reserved;
ba2d3587 4062} __packed;
fe1bcbfd
WYG
4063
4064struct iwl_coex_event_resp {
4065 __le32 status;
ba2d3587 4066} __packed;
fe1bcbfd
WYG
4067
4068
0288d237
JB
4069/******************************************************************************
4070 * Bluetooth Coexistence commands
4071 *
4072 *****************************************************************************/
4073
4074/*
4075 * BT Status notification
fbba9410 4076 * REPLY_BT_COEX_PROFILE_NOTIF = 0xce
0288d237
JB
4077 */
4078enum iwl_bt_coex_profile_traffic_load {
4079 IWL_BT_COEX_TRAFFIC_LOAD_NONE = 0,
4080 IWL_BT_COEX_TRAFFIC_LOAD_LOW = 1,
4081 IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 2,
4082 IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS = 3,
4083/*
4084 * There are no more even though below is a u8, the
4085 * indication from the BT device only has two bits.
4086 */
4087};
4088
fbba9410
WYG
4089#define BT_UART_MSG_FRAME1MSGTYPE_POS (0)
4090#define BT_UART_MSG_FRAME1MSGTYPE_MSK \
4091 (0x7 << BT_UART_MSG_FRAME1MSGTYPE_POS)
4092#define BT_UART_MSG_FRAME1SSN_POS (3)
4093#define BT_UART_MSG_FRAME1SSN_MSK \
4094 (0x3 << BT_UART_MSG_FRAME1SSN_POS)
4095#define BT_UART_MSG_FRAME1UPDATEREQ_POS (5)
4096#define BT_UART_MSG_FRAME1UPDATEREQ_MSK \
4097 (0x1 << BT_UART_MSG_FRAME1UPDATEREQ_POS)
4098#define BT_UART_MSG_FRAME1RESERVED_POS (6)
4099#define BT_UART_MSG_FRAME1RESERVED_MSK \
4100 (0x3 << BT_UART_MSG_FRAME1RESERVED_POS)
4101
4102#define BT_UART_MSG_FRAME2OPENCONNECTIONS_POS (0)
4103#define BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK \
4104 (0x3 << BT_UART_MSG_FRAME2OPENCONNECTIONS_POS)
4105#define BT_UART_MSG_FRAME2TRAFFICLOAD_POS (2)
4106#define BT_UART_MSG_FRAME2TRAFFICLOAD_MSK \
4107 (0x3 << BT_UART_MSG_FRAME2TRAFFICLOAD_POS)
4108#define BT_UART_MSG_FRAME2CHLSEQN_POS (4)
4109#define BT_UART_MSG_FRAME2CHLSEQN_MSK \
4110 (0x1 << BT_UART_MSG_FRAME2CHLSEQN_POS)
4111#define BT_UART_MSG_FRAME2INBAND_POS (5)
4112#define BT_UART_MSG_FRAME2INBAND_MSK \
4113 (0x1 << BT_UART_MSG_FRAME2INBAND_POS)
4114#define BT_UART_MSG_FRAME2RESERVED_POS (6)
4115#define BT_UART_MSG_FRAME2RESERVED_MSK \
4116 (0x3 << BT_UART_MSG_FRAME2RESERVED_POS)
4117
4118#define BT_UART_MSG_FRAME3SCOESCO_POS (0)
4119#define BT_UART_MSG_FRAME3SCOESCO_MSK \
4120 (0x1 << BT_UART_MSG_FRAME3SCOESCO_POS)
4121#define BT_UART_MSG_FRAME3SNIFF_POS (1)
4122#define BT_UART_MSG_FRAME3SNIFF_MSK \
4123 (0x1 << BT_UART_MSG_FRAME3SNIFF_POS)
4124#define BT_UART_MSG_FRAME3A2DP_POS (2)
4125#define BT_UART_MSG_FRAME3A2DP_MSK \
4126 (0x1 << BT_UART_MSG_FRAME3A2DP_POS)
4127#define BT_UART_MSG_FRAME3ACL_POS (3)
4128#define BT_UART_MSG_FRAME3ACL_MSK \
4129 (0x1 << BT_UART_MSG_FRAME3ACL_POS)
4130#define BT_UART_MSG_FRAME3MASTER_POS (4)
4131#define BT_UART_MSG_FRAME3MASTER_MSK \
4132 (0x1 << BT_UART_MSG_FRAME3MASTER_POS)
4133#define BT_UART_MSG_FRAME3OBEX_POS (5)
4134#define BT_UART_MSG_FRAME3OBEX_MSK \
4135 (0x1 << BT_UART_MSG_FRAME3OBEX_POS)
4136#define BT_UART_MSG_FRAME3RESERVED_POS (6)
4137#define BT_UART_MSG_FRAME3RESERVED_MSK \
4138 (0x3 << BT_UART_MSG_FRAME3RESERVED_POS)
4139
4140#define BT_UART_MSG_FRAME4IDLEDURATION_POS (0)
4141#define BT_UART_MSG_FRAME4IDLEDURATION_MSK \
4142 (0x3F << BT_UART_MSG_FRAME4IDLEDURATION_POS)
4143#define BT_UART_MSG_FRAME4RESERVED_POS (6)
4144#define BT_UART_MSG_FRAME4RESERVED_MSK \
4145 (0x3 << BT_UART_MSG_FRAME4RESERVED_POS)
4146
4147#define BT_UART_MSG_FRAME5TXACTIVITY_POS (0)
4148#define BT_UART_MSG_FRAME5TXACTIVITY_MSK \
4149 (0x3 << BT_UART_MSG_FRAME5TXACTIVITY_POS)
4150#define BT_UART_MSG_FRAME5RXACTIVITY_POS (2)
4151#define BT_UART_MSG_FRAME5RXACTIVITY_MSK \
4152 (0x3 << BT_UART_MSG_FRAME5RXACTIVITY_POS)
4153#define BT_UART_MSG_FRAME5ESCORETRANSMIT_POS (4)
4154#define BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK \
4155 (0x3 << BT_UART_MSG_FRAME5ESCORETRANSMIT_POS)
4156#define BT_UART_MSG_FRAME5RESERVED_POS (6)
4157#define BT_UART_MSG_FRAME5RESERVED_MSK \
4158 (0x3 << BT_UART_MSG_FRAME5RESERVED_POS)
4159
4160#define BT_UART_MSG_FRAME6SNIFFINTERVAL_POS (0)
4161#define BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK \
4162 (0x1F << BT_UART_MSG_FRAME6SNIFFINTERVAL_POS)
4163#define BT_UART_MSG_FRAME6DISCOVERABLE_POS (5)
4164#define BT_UART_MSG_FRAME6DISCOVERABLE_MSK \
4165 (0x1 << BT_UART_MSG_FRAME6DISCOVERABLE_POS)
4166#define BT_UART_MSG_FRAME6RESERVED_POS (6)
4167#define BT_UART_MSG_FRAME6RESERVED_MSK \
4168 (0x3 << BT_UART_MSG_FRAME6RESERVED_POS)
4169
4170#define BT_UART_MSG_FRAME7SNIFFACTIVITY_POS (0)
4171#define BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK \
4172 (0x7 << BT_UART_MSG_FRAME7SNIFFACTIVITY_POS)
4173#define BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_POS (3)
4174#define BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_MSK \
4175 (0x3 << BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_POS)
4176#define BT_UART_MSG_FRAME7CONNECTABLE_POS (5)
4177#define BT_UART_MSG_FRAME7CONNECTABLE_MSK \
4178 (0x1 << BT_UART_MSG_FRAME7CONNECTABLE_POS)
4179#define BT_UART_MSG_FRAME7RESERVED_POS (6)
4180#define BT_UART_MSG_FRAME7RESERVED_MSK \
4181 (0x3 << BT_UART_MSG_FRAME7RESERVED_POS)
4182
4183
4184struct iwl_bt_uart_msg {
4185 u8 header;
4186 u8 frame1;
4187 u8 frame2;
4188 u8 frame3;
4189 u8 frame4;
4190 u8 frame5;
4191 u8 frame6;
4192 u8 frame7;
4193} __attribute__((packed));
4194
0288d237 4195struct iwl_bt_coex_profile_notif {
fbba9410 4196 struct iwl_bt_uart_msg last_bt_uart_msg;
0288d237
JB
4197 u8 bt_status; /* 0 - off, 1 - on */
4198 u8 bt_traffic_load; /* 0 .. 3? */
4199 u8 bt_ci_compliance; /* 0 - not complied, 1 - complied */
4200 u8 reserved;
4201} __attribute__((packed));
4202
aeb4a2ee
WYG
4203#define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS 0
4204#define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_MSK 0x1
4205#define IWL_BT_COEX_PRIO_TBL_PRIO_POS 1
4206#define IWL_BT_COEX_PRIO_TBL_PRIO_MASK 0x0e
4207#define IWL_BT_COEX_PRIO_TBL_RESERVED_POS 4
4208#define IWL_BT_COEX_PRIO_TBL_RESERVED_MASK 0xf0
4209#define IWL_BT_COEX_PRIO_TBL_PRIO_SHIFT 1
0288d237
JB
4210
4211/*
4212 * BT Coexistence Priority table
4213 * REPLY_BT_COEX_PRIO_TABLE = 0xcc
4214 */
aeb4a2ee
WYG
4215enum bt_coex_prio_table_events {
4216 BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0,
4217 BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1,
4218 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2,
4219 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, /* DC calib */
4220 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4,
4221 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5,
4222 BT_COEX_PRIO_TBL_EVT_DTIM = 6,
4223 BT_COEX_PRIO_TBL_EVT_SCAN52 = 7,
4224 BT_COEX_PRIO_TBL_EVT_SCAN24 = 8,
4225 BT_COEX_PRIO_TBL_EVT_RESERVED0 = 9,
4226 BT_COEX_PRIO_TBL_EVT_RESERVED1 = 10,
4227 BT_COEX_PRIO_TBL_EVT_RESERVED2 = 11,
4228 BT_COEX_PRIO_TBL_EVT_RESERVED3 = 12,
4229 BT_COEX_PRIO_TBL_EVT_RESERVED4 = 13,
4230 BT_COEX_PRIO_TBL_EVT_RESERVED5 = 14,
4231 BT_COEX_PRIO_TBL_EVT_RESERVED6 = 15,
4232 /* BT_COEX_PRIO_TBL_EVT_MAX should always be last */
4233 BT_COEX_PRIO_TBL_EVT_MAX,
4234};
4235
4236enum bt_coex_prio_table_priorities {
4237 BT_COEX_PRIO_TBL_DISABLED = 0,
4238 BT_COEX_PRIO_TBL_PRIO_LOW = 1,
4239 BT_COEX_PRIO_TBL_PRIO_HIGH = 2,
4240 BT_COEX_PRIO_TBL_PRIO_BYPASS = 3,
4241 BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4,
4242 BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5,
4243 BT_COEX_PRIO_TBL_PRIO_RSRVD1 = 6,
4244 BT_COEX_PRIO_TBL_PRIO_RSRVD2 = 7,
4245 BT_COEX_PRIO_TBL_MAX,
4246};
4247
0288d237 4248struct iwl_bt_coex_prio_table_cmd {
aeb4a2ee 4249 u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX];
0288d237
JB
4250} __attribute__((packed));
4251
aeb4a2ee
WYG
4252#define IWL_BT_COEX_ENV_CLOSE 0
4253#define IWL_BT_COEX_ENV_OPEN 1
0288d237
JB
4254/*
4255 * BT Protection Envelope
4256 * REPLY_BT_COEX_PROT_ENV = 0xcd
4257 */
4258struct iwl_bt_coex_prot_env_cmd {
aeb4a2ee 4259 u8 action; /* 0 = closed, 1 = open */
0288d237
JB
4260 u8 type; /* 0 .. 15 */
4261 u8 reserved[2];
4262} __attribute__((packed));
4263
b481de9c
ZY
4264/******************************************************************************
4265 * (13)
4266 * Union of all expected notifications/responses:
4267 *
4268 *****************************************************************************/
4269
db11d634 4270struct iwl_rx_packet {
2f301227
ZY
4271 /*
4272 * The first 4 bytes of the RX frame header contain both the RX frame
4273 * size and some flags.
4274 * Bit fields:
4275 * 31: flag flush RB request
4276 * 30: flag ignore TC (terminal counter) request
4277 * 29: flag fast IRQ request
4278 * 28-14: Reserved
4279 * 13-00: RX frame size
4280 */
396887a2 4281 __le32 len_n_flags;
857485c0 4282 struct iwl_cmd_header hdr;
b481de9c 4283 union {
3d24a9f7
TW
4284 struct iwl3945_rx_frame rx_frame;
4285 struct iwl3945_tx_resp tx_resp;
4286 struct iwl3945_beacon_notif beacon_status;
4287
885ba202 4288 struct iwl_alive_resp alive_frame;
2aa6ab86
TW
4289 struct iwl_spectrum_notification spectrum_notif;
4290 struct iwl_csa_notification csa_notif;
885ba202 4291 struct iwl_error_resp err_resp;
2aa6ab86 4292 struct iwl_card_state_notif card_state_notif;
7a999bf0
TW
4293 struct iwl_add_sta_resp add_sta;
4294 struct iwl_rem_sta_resp rem_sta;
2aa6ab86
TW
4295 struct iwl_sleep_notification sleep_notif;
4296 struct iwl_spectrum_resp spectrum;
8f91aecb 4297 struct iwl_notif_statistics stats;
7980fba5 4298 struct iwl_bt_notif_statistics stats_bt;
653fa4a0 4299 struct iwl_compressed_ba_resp compressed_ba;
2aa6ab86 4300 struct iwl_missed_beacon_notif missed_beacon;
fe1bcbfd
WYG
4301 struct iwl_coex_medium_notification coex_medium_notif;
4302 struct iwl_coex_event_resp coex_event;
0288d237 4303 struct iwl_bt_coex_profile_notif bt_coex_profile_notif;
b481de9c
ZY
4304 __le32 status;
4305 u8 raw[0];
4306 } u;
ba2d3587 4307} __packed;
b481de9c 4308
a3139c59 4309int iwl_agn_check_rxon_cmd(struct iwl_priv *priv);
8f5c87dc 4310
6a63578d 4311#endif /* __iwl_commands_h__ */
This page took 1.175499 seconds and 5 git commands to generate.