iwl-commands.h 144 KB
Newer Older
1
2
3
4
5
6
7
/******************************************************************************
 *
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
 *
 * GPL LICENSE SUMMARY
 *
8
 * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
9
10
 *
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of version 2 of the GNU General Public License as
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
 * USA
 *
 * The full GNU General Public License is included in this distribution
 * in the file called LICENSE.GPL.
 *
 * Contact Information:
28
 *  Intel Linux Wireless <ilw@linux.intel.com>
29
30
31
32
 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 *
 * BSD LICENSE
 *
33
 * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name Intel Corporation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/
63
/*
64
 * Please use this file (iwl-commands.h) only for uCode API definitions.
Wey-Yi Guy's avatar
Wey-Yi Guy committed
65
 * Please use iwl-xxxx-hw.h for hardware-related definitions.
66
 * Please use iwl-dev.h for driver implementation definitions.
67
 */
68

69
70
#ifndef __iwl_commands_h__
#define __iwl_commands_h__
71

72
73
struct iwl_priv;

74
75
76
77
78
79
/* uCode version contains 4 values: Major/Minor/API/Serial */
#define IWL_UCODE_MAJOR(ver)	(((ver) & 0xFF000000) >> 24)
#define IWL_UCODE_MINOR(ver)	(((ver) & 0x00FF0000) >> 16)
#define IWL_UCODE_API(ver)	(((ver) & 0x0000FF00) >> 8)
#define IWL_UCODE_SERIAL(ver)	((ver) & 0x000000FF)

80
81
82
83
84
85

/* Tx rates */
#define IWL_CCK_RATES	4
#define IWL_OFDM_RATES	8
#define IWL_MAX_RATES	(IWL_CCK_RATES + IWL_OFDM_RATES)

86
87
88
89
90
91
92
93
94
95
96
97
enum {
	REPLY_ALIVE = 0x1,
	REPLY_ERROR = 0x2,

	/* RXON and QOS commands */
	REPLY_RXON = 0x10,
	REPLY_RXON_ASSOC = 0x11,
	REPLY_QOS_PARAM = 0x13,
	REPLY_RXON_TIMING = 0x14,

	/* Multi-Station support */
	REPLY_ADD_STA = 0x18,
98
	REPLY_REMOVE_STA = 0x19,
99
	REPLY_REMOVE_ALL_STA = 0x1a,	/* not used */
100
	REPLY_TXFIFO_FLUSH = 0x1e,
101

102
103
104
	/* Security */
	REPLY_WEPKEY = 0x20,

105
	/* RX, TX, LEDs */
106
	REPLY_3945_RX = 0x1b,           /* 3945 only */
107
108
109
	REPLY_TX = 0x1c,
	REPLY_RATE_SCALE = 0x47,	/* 3945 only */
	REPLY_LEDS_CMD = 0x48,
110
	REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */
111

112
	/* WiMAX coexistence */
113
	COEX_PRIORITY_TABLE_CMD = 0x5a,	/* for 5000 series and up */
114
115
116
	COEX_MEDIUM_NOTIFICATION = 0x5b,
	COEX_EVENT_CMD = 0x5c,

117
	/* Calibration */
118
	TEMPERATURE_NOTIFICATION = 0x62,
119
120
121
122
	CALIBRATION_CFG_CMD = 0x65,
	CALIBRATION_RES_NOTIFICATION = 0x66,
	CALIBRATION_COMPLETE_NOTIFICATION = 0x67,

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
	/* 802.11h related */
	REPLY_QUIET_CMD = 0x71,		/* not used */
	REPLY_CHANNEL_SWITCH = 0x72,
	CHANNEL_SWITCH_NOTIFICATION = 0x73,
	REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
	SPECTRUM_MEASURE_NOTIFICATION = 0x75,

	/* Power Management */
	POWER_TABLE_CMD = 0x77,
	PM_SLEEP_NOTIFICATION = 0x7A,
	PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,

	/* Scan commands and notifications */
	REPLY_SCAN_CMD = 0x80,
	REPLY_SCAN_ABORT_CMD = 0x81,
	SCAN_START_NOTIFICATION = 0x82,
	SCAN_RESULTS_NOTIFICATION = 0x83,
	SCAN_COMPLETE_NOTIFICATION = 0x84,

	/* IBSS/AP commands */
	BEACON_NOTIFICATION = 0x90,
	REPLY_TX_BEACON = 0x91,
	WHO_IS_AWAKE_NOTIFICATION = 0x94,	/* not used */

	/* Miscellaneous commands */
148
	REPLY_TX_POWER_DBM_CMD = 0x95,
149
150
	QUIET_NOTIFICATION = 0x96,		/* not used */
	REPLY_TX_PWR_TABLE_CMD = 0x97,
151
	REPLY_TX_POWER_DBM_CMD_V1 = 0x98,	/* old version of API */
152
	TX_ANT_CONFIGURATION_CMD = 0x98,
153
154
	MEASURE_ABORT_NOTIFICATION = 0x99,	/* not used */

155
	/* Bluetooth device coexistence config command */
156
157
	REPLY_BT_CONFIG = 0x9b,

158
	/* Statistics */
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
	REPLY_STATISTICS_CMD = 0x9c,
	STATISTICS_NOTIFICATION = 0x9d,

	/* RF-KILL commands and notifications */
	REPLY_CARD_STATE_CMD = 0xa0,
	CARD_STATE_NOTIFICATION = 0xa1,

	/* Missed beacons notification */
	MISSED_BEACONS_NOTIFICATION = 0xa2,

	REPLY_CT_KILL_CONFIG_CMD = 0xa4,
	SENSITIVITY_CMD = 0xa8,
	REPLY_PHY_CALIBRATION_CMD = 0xb0,
	REPLY_RX_PHY_CMD = 0xc0,
	REPLY_RX_MPDU_CMD = 0xc1,
174
	REPLY_RX = 0xc3,
175
	REPLY_COMPRESSED_BA = 0xc5,
176
177
178
179
180
181

	/* BT Coex */
	REPLY_BT_COEX_PRIO_TABLE = 0xcc,
	REPLY_BT_COEX_PROT_ENV = 0xcd,
	REPLY_BT_COEX_PROFILE_NOTIF = 0xce,

Johannes Berg's avatar
Johannes Berg committed
182
183
184
185
186
187
188
189
190
	/* PAN commands */
	REPLY_WIPAN_PARAMS = 0xb2,
	REPLY_WIPAN_RXON = 0xb3,	/* use REPLY_RXON structure */
	REPLY_WIPAN_RXON_TIMING = 0xb4,	/* use REPLY_RXON_TIMING structure */
	REPLY_WIPAN_RXON_ASSOC = 0xb6,	/* use REPLY_RXON_ASSOC structure */
	REPLY_WIPAN_QOS_PARAM = 0xb7,	/* use REPLY_QOS_PARAM structure */
	REPLY_WIPAN_WEPKEY = 0xb8,	/* use REPLY_WEPKEY structure */
	REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9,
	REPLY_WIPAN_NOA_NOTIFICATION = 0xbc,
191
	REPLY_WIPAN_DEACTIVATION_COMPLETE = 0xbd,
Johannes Berg's avatar
Johannes Berg committed
192

193
194
195
196
197
	REPLY_MAX = 0xff
};

/******************************************************************************
 * (0)
198
 * Commonly used structures and definitions:
199
 * Command header, rate_n_flags, txpower
200
201
202
 *
 *****************************************************************************/

203
/* iwl_cmd_header flags value */
204
205
#define IWL_CMD_FAILED_MSK 0x40

206
207
208
209
#define SEQ_TO_QUEUE(s)	(((s) >> 8) & 0x1f)
#define QUEUE_TO_SEQ(q)	(((q) & 0x1f) << 8)
#define SEQ_TO_INDEX(s)	((s) & 0xff)
#define INDEX_TO_SEQ(i)	((i) & 0xff)
210
211
#define SEQ_HUGE_FRAME	cpu_to_le16(0x4000)
#define SEQ_RX_FRAME	cpu_to_le16(0x8000)
212

213
/**
214
 * struct iwl_cmd_header
215
216
217
218
 *
 * This header format appears in the beginning of each command sent from the
 * driver, and each response/notification received from uCode.
 */
219
struct iwl_cmd_header {
220
	u8 cmd;		/* Command ID:  REPLY_RXON, etc. */
221
	u8 flags;	/* 0:5 reserved, 6 abort, 7 internal */
222
	/*
223
	 * The driver sets up the sequence number to values of its choosing.
224
225
226
227
	 * uCode does not use this value, but passes it back to the driver
	 * when sending the response to each driver-originated command, so
	 * the driver can match the response to the command.  Since the values
	 * don't get used by uCode, the driver may set up an arbitrary format.
228
	 *
229
230
231
232
233
	 * There is one exception:  uCode sets bit 15 when it originates
	 * the response/notification, i.e. when the response/notification
	 * is not a direct response to a command sent by the driver.  For
	 * example, uCode issues REPLY_3945_RX when it sends a received frame
	 * to the driver; it is not a direct response to any driver command.
234
	 *
235
236
	 * The Linux driver uses the following format:
	 *
237
238
239
240
241
242
	 *  0:7		tfd index - position within TX queue
	 *  8:12	TX queue id
	 *  13		reserved
	 *  14		huge - driver sets this to indicate command is in the
	 *  		'huge' storage at the end of the command buffers
	 *  15		unsolicited RX or uCode-originated notification
243
244
245
	 */
	__le16 sequence;

246
	/* command or response/notification data follows immediately */
247
	u8 data[0];
248
} __packed;
249

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267

/**
 * struct iwl3945_tx_power
 *
 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
 *
 * Each entry contains two values:
 * 1)  DSP gain (or sometimes called DSP attenuation).  This is a fine-grained
 *     linear value that multiplies the output of the digital signal processor,
 *     before being sent to the analog radio.
 * 2)  Radio gain.  This sets the analog gain of the radio Tx path.
 *     It is a coarser setting, and behaves in a logarithmic (dB) fashion.
 *
 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
 */
struct iwl3945_tx_power {
	u8 tx_gain;		/* gain for analog radio */
	u8 dsp_atten;		/* gain for DSP */
268
} __packed;
269
270
271
272
273
274
275
276
277
278

/**
 * struct iwl3945_power_per_rate
 *
 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
 */
struct iwl3945_power_per_rate {
	u8 rate;		/* plcp */
	struct iwl3945_tx_power tpc;
	u8 reserved;
279
} __packed;
280

281
/**
282
 * iwlagn rate_n_flags bit fields
283
 *
284
 * rate_n_flags format is used in following iwlagn commands:
285
 *  REPLY_RX (response only)
286
 *  REPLY_RX_MPDU (response only)
287
288
289
290
291
292
293
294
295
296
297
298
299
 *  REPLY_TX (both command and response)
 *  REPLY_TX_LINK_QUALITY_CMD
 *
 * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
 *  2-0:  0)   6 Mbps
 *        1)  12 Mbps
 *        2)  18 Mbps
 *        3)  24 Mbps
 *        4)  36 Mbps
 *        5)  48 Mbps
 *        6)  54 Mbps
 *        7)  60 Mbps
 *
300
 *  4-3:  0)  Single stream (SISO)
301
 *        1)  Dual stream (MIMO)
302
 *        2)  Triple stream (MIMO)
303
 *
304
 *    5:  Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
305
306
307
308
309
310
311
312
313
314
315
316
 *
 * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
 *  3-0:  0xD)   6 Mbps
 *        0xF)   9 Mbps
 *        0x5)  12 Mbps
 *        0x7)  18 Mbps
 *        0x9)  24 Mbps
 *        0xB)  36 Mbps
 *        0x1)  48 Mbps
 *        0x3)  54 Mbps
 *
 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
317
 *  6-0:   10)  1 Mbps
318
319
320
321
322
 *         20)  2 Mbps
 *         55)  5.5 Mbps
 *        110)  11 Mbps
 */
#define RATE_MCS_CODE_MSK 0x7
323
324
#define RATE_MCS_SPATIAL_POS 3
#define RATE_MCS_SPATIAL_MSK 0x18
325
326
327
#define RATE_MCS_HT_DUP_POS 5
#define RATE_MCS_HT_DUP_MSK 0x20

328
/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
329
330
331
332
#define RATE_MCS_FLAGS_POS 8
#define RATE_MCS_HT_POS 8
#define RATE_MCS_HT_MSK 0x100

333
/* Bit 9: (1) CCK, (0) OFDM.  HT (bit 8) must be "0" for this bit to be valid */
334
335
336
#define RATE_MCS_CCK_POS 9
#define RATE_MCS_CCK_MSK 0x200

337
/* Bit 10: (1) Use Green Field preamble */
338
339
340
#define RATE_MCS_GF_POS 10
#define RATE_MCS_GF_MSK 0x400

341
342
343
/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
#define RATE_MCS_HT40_POS 11
#define RATE_MCS_HT40_MSK 0x800
344

345
/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
346
347
348
#define RATE_MCS_DUP_POS 12
#define RATE_MCS_DUP_MSK 0x1000

349
/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
350
351
352
353
#define RATE_MCS_SGI_POS 13
#define RATE_MCS_SGI_MSK 0x2000

/**
354
355
356
357
358
359
360
 * rate_n_flags Tx antenna masks
 * 4965 has 2 transmitters
 * 5100 has 1 transmitter B
 * 5150 has 1 transmitter A
 * 5300 has 3 transmitters
 * 5350 has 3 transmitters
 * bit14:16
361
 */
362
363
364
365
366
367
#define RATE_MCS_ANT_POS	14
#define RATE_MCS_ANT_A_MSK	0x04000
#define RATE_MCS_ANT_B_MSK	0x08000
#define RATE_MCS_ANT_C_MSK	0x10000
#define RATE_MCS_ANT_AB_MSK	(RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
#define RATE_MCS_ANT_ABC_MSK	(RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
368
#define RATE_ANT_NUM 3
369
370
371
372
373

#define POWER_TABLE_NUM_ENTRIES			33
#define POWER_TABLE_NUM_HT_OFDM_ENTRIES		32
#define POWER_TABLE_CCK_ENTRY			32

374
375
376
#define IWL_PWR_NUM_HT_OFDM_ENTRIES		24
#define IWL_PWR_CCK_ENTRIES			2

377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
/**
 * union iwl4965_tx_power_dual_stream
 *
 * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
 * Use __le32 version (struct tx_power_dual_stream) when building command.
 *
 * Driver provides radio gain and DSP attenuation settings to device in pairs,
 * one value for each transmitter chain.  The first value is for transmitter A,
 * second for transmitter B.
 *
 * For SISO bit rates, both values in a pair should be identical.
 * For MIMO rates, one value may be different from the other,
 * in order to balance the Tx output between the two transmitters.
 *
 * See more details in doc for TXPOWER in iwl-4965-hw.h.
 */
union iwl4965_tx_power_dual_stream {
	struct {
		u8 radio_tx_gain[2];
		u8 dsp_predis_atten[2];
	} s;
	u32 dw;
};

/**
 * struct tx_power_dual_stream
 *
 * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
 *
 * Same format as iwl_tx_power_dual_stream, but __le32
 */
struct tx_power_dual_stream {
	__le32 dw;
410
} __packed;
411
412
413
414
415
416
417
418

/**
 * struct iwl4965_tx_power_db
 *
 * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
 */
struct iwl4965_tx_power_db {
	struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
419
} __packed;
420

421
/**
422
 * Command REPLY_TX_POWER_DBM_CMD = 0x98
423
 * struct iwlagn_tx_power_dbm_cmd
424
 */
425
426
#define IWLAGN_TX_POWER_AUTO 0x7f
#define IWLAGN_TX_POWER_NO_CLOSED (0x1 << 6)
427

428
struct iwlagn_tx_power_dbm_cmd {
429
430
431
432
	s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
	u8 flags;
	s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
	u8 reserved;
433
} __packed;
434

435
436
437
438
439
440
441
442
/**
 * Command TX_ANT_CONFIGURATION_CMD = 0x98
 * This command is used to configure valid Tx antenna.
 * By default uCode concludes the valid antenna according to the radio flavor.
 * This command enables the driver to override/modify this conclusion.
 */
struct iwl_tx_ant_config_cmd {
	__le32 valid;
443
} __packed;
444

445
446
447
448
449
450
/******************************************************************************
 * (0a)
 * Alive and Error Commands & Responses:
 *
 *****************************************************************************/

451
#define UCODE_VALID_OK	cpu_to_le32(0x1)
452
453
454
#define INITIALIZE_SUBTYPE    (9)

/*
455
456
457
458
459
460
461
462
463
464
465
466
467
 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
 *
 * uCode issues this "initialize alive" notification once the initialization
 * uCode image has completed its work, and is ready to load the runtime image.
 * This is the *first* "alive" notification that the driver will receive after
 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
 *
 * See comments documenting "BSM" (bootstrap state machine).
 *
 * For 4965, this notification contains important calibration data for
 * calculating txpower settings:
 *
 * 1)  Power supply voltage indication.  The voltage sensor outputs higher
468
 *     values for lower voltage, and vice verse.
469
470
471
472
473
474
475
476
 *
 * 2)  Temperature measurement parameters, for each of two channel widths
 *     (20 MHz and 40 MHz) supported by the radios.  Temperature sensing
 *     is done via one of the receiver chains, and channel width influences
 *     the results.
 *
 * 3)  Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
 *     for each of 5 frequency ranges.
477
 */
478
struct iwl_init_alive_resp {
479
480
481
482
483
	u8 ucode_minor;
	u8 ucode_major;
	__le16 reserved1;
	u8 sw_rev[8];
	u8 ver_type;
484
	u8 ver_subtype;		/* "9" for initialize alive */
485
486
487
488
489
	__le16 reserved2;
	__le32 log_event_table_ptr;
	__le32 error_event_table_ptr;
	__le32 timestamp;
	__le32 is_valid;
490
491
492

	/* calibration values from "initialize" uCode */
	__le32 voltage;		/* signed, higher value is lower voltage */
493
	__le32 therm_r1[2];	/* signed, 1st for normal, 2nd for HT40 */
494
495
496
497
498
	__le32 therm_r2[2];	/* signed */
	__le32 therm_r3[2];	/* signed */
	__le32 therm_r4[2];	/* signed */
	__le32 tx_atten[5][2];	/* signed MIMO gain comp, 5 freq groups,
				 * 2 Tx chains */
499
} __packed;
500

501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532

/**
 * REPLY_ALIVE = 0x1 (response only, not a command)
 *
 * uCode issues this "alive" notification once the runtime image is ready
 * to receive commands from the driver.  This is the *second* "alive"
 * notification that the driver will receive after rebooting uCode;
 * this "alive" is indicated by subtype field != 9.
 *
 * See comments documenting "BSM" (bootstrap state machine).
 *
 * This response includes two pointers to structures within the device's
 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
 *
 * 1)  log_event_table_ptr indicates base of the event log.  This traces
 *     a 256-entry history of uCode execution within a circular buffer.
 *     Its header format is:
 *
 *	__le32 log_size;     log capacity (in number of entries)
 *	__le32 type;         (1) timestamp with each entry, (0) no timestamp
 *	__le32 wraps;        # times uCode has wrapped to top of circular buffer
 *      __le32 write_index;  next circular buffer entry that uCode would fill
 *
 *     The header is followed by the circular buffer of log entries.  Entries
 *     with timestamps have the following format:
 *
 *	__le32 event_id;     range 0 - 1500
 *	__le32 timestamp;    low 32 bits of TSF (of network, if associated)
 *	__le32 data;         event_id-specific data value
 *
 *     Entries without timestamps contain only event_id and data.
 *
533
 *
534
 * 2)  error_event_table_ptr indicates base of the error log.  This contains
535
 *     information about any uCode error that occurs.  For agn, the format
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
 *     of the error log is:
 *
 *	__le32 valid;        (nonzero) valid, (0) log is empty
 *	__le32 error_id;     type of error
 *	__le32 pc;           program counter
 *	__le32 blink1;       branch link
 *	__le32 blink2;       branch link
 *	__le32 ilink1;       interrupt link
 *	__le32 ilink2;       interrupt link
 *	__le32 data1;        error-specific data
 *	__le32 data2;        error-specific data
 *	__le32 line;         source code line of error
 *	__le32 bcon_time;    beacon timer
 *	__le32 tsf_low;      network timestamp function timer
 *	__le32 tsf_hi;       network timestamp function timer
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
 *	__le32 gp1;          GP1 timer register
 *	__le32 gp2;          GP2 timer register
 *	__le32 gp3;          GP3 timer register
 *	__le32 ucode_ver;    uCode version
 *	__le32 hw_ver;       HW Silicon version
 *	__le32 brd_ver;      HW board version
 *	__le32 log_pc;       log program counter
 *	__le32 frame_ptr;    frame pointer
 *	__le32 stack_ptr;    stack pointer
 *	__le32 hcmd;         last host command
 *	__le32 isr0;         isr status register LMPM_NIC_ISR0: rxtx_flag
 *	__le32 isr1;         isr status register LMPM_NIC_ISR1: host_flag
 *	__le32 isr2;         isr status register LMPM_NIC_ISR2: enc_flag
 *	__le32 isr3;         isr status register LMPM_NIC_ISR3: time_flag
 *	__le32 isr4;         isr status register LMPM_NIC_ISR4: wico interrupt
 *	__le32 isr_pref;     isr status register LMPM_NIC_PREF_STAT
 *	__le32 wait_event;   wait event() caller address
 *	__le32 l2p_control;  L2pControlField
 *	__le32 l2p_duration; L2pDurationField
 *	__le32 l2p_mhvalid;  L2pMhValidBits
 *	__le32 l2p_addr_match; L2pAddrMatchStat
 *	__le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
 *	__le32 u_timestamp;  indicate when the date and time of the compilation
 *	__le32 reserved;
575
576
577
578
 *
 * The Linux driver can print both logs to the system log when a uCode error
 * occurs.
 */
579
struct iwl_alive_resp {
580
581
582
583
584
	u8 ucode_minor;
	u8 ucode_major;
	__le16 reserved1;
	u8 sw_rev[8];
	u8 ver_type;
585
	u8 ver_subtype;			/* not "9" for runtime alive */
586
	__le16 reserved2;
587
588
	__le32 log_event_table_ptr;	/* SRAM address for event log */
	__le32 error_event_table_ptr;	/* SRAM address for error log */
589
590
	__le32 timestamp;
	__le32 is_valid;
591
} __packed;
592
593
594
595

/*
 * REPLY_ERROR = 0x2 (response only, not a command)
 */
596
struct iwl_error_resp {
597
598
599
600
601
	__le32 error_type;
	u8 cmd_id;
	u8 reserved1;
	__le16 bad_cmd_seq_num;
	__le32 error_info;
602
	__le64 timestamp;
603
} __packed;
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619

/******************************************************************************
 * (1)
 * RXON Commands & Responses:
 *
 *****************************************************************************/

/*
 * Rx config defines & structure
 */
/* rx_config device types  */
enum {
	RXON_DEV_TYPE_AP = 1,
	RXON_DEV_TYPE_ESS = 3,
	RXON_DEV_TYPE_IBSS = 4,
	RXON_DEV_TYPE_SNIFFER = 6,
Johannes Berg's avatar
Johannes Berg committed
620
621
622
	RXON_DEV_TYPE_CP = 7,
	RXON_DEV_TYPE_2STA = 8,
	RXON_DEV_TYPE_P2P = 9,
623
624
};

625

626
#define RXON_RX_CHAIN_DRIVER_FORCE_MSK		cpu_to_le16(0x1 << 0)
627
#define RXON_RX_CHAIN_DRIVER_FORCE_POS		(0)
628
#define RXON_RX_CHAIN_VALID_MSK			cpu_to_le16(0x7 << 1)
629
#define RXON_RX_CHAIN_VALID_POS			(1)
630
#define RXON_RX_CHAIN_FORCE_SEL_MSK		cpu_to_le16(0x7 << 4)
631
#define RXON_RX_CHAIN_FORCE_SEL_POS		(4)
632
#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK	cpu_to_le16(0x7 << 7)
633
#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS	(7)
634
#define RXON_RX_CHAIN_CNT_MSK			cpu_to_le16(0x3 << 10)
635
#define RXON_RX_CHAIN_CNT_POS			(10)
636
#define RXON_RX_CHAIN_MIMO_CNT_MSK		cpu_to_le16(0x3 << 12)
637
#define RXON_RX_CHAIN_MIMO_CNT_POS		(12)
638
#define RXON_RX_CHAIN_MIMO_FORCE_MSK		cpu_to_le16(0x1 << 14)
639
640
#define RXON_RX_CHAIN_MIMO_FORCE_POS		(14)

641
642
/* rx_config flags */
/* band & modulation selection */
643
644
#define RXON_FLG_BAND_24G_MSK           cpu_to_le32(1 << 0)
#define RXON_FLG_CCK_MSK                cpu_to_le32(1 << 1)
645
/* auto detection enable */
646
#define RXON_FLG_AUTO_DETECT_MSK        cpu_to_le32(1 << 2)
647
/* TGg protection when tx */
648
#define RXON_FLG_TGG_PROTECT_MSK        cpu_to_le32(1 << 3)
649
/* cck short slot & preamble */
650
651
#define RXON_FLG_SHORT_SLOT_MSK          cpu_to_le32(1 << 4)
#define RXON_FLG_SHORT_PREAMBLE_MSK     cpu_to_le32(1 << 5)
652
/* antenna selection */
653
654
655
656
#define RXON_FLG_DIS_DIV_MSK            cpu_to_le32(1 << 7)
#define RXON_FLG_ANT_SEL_MSK            cpu_to_le32(0x0f00)
#define RXON_FLG_ANT_A_MSK              cpu_to_le32(1 << 8)
#define RXON_FLG_ANT_B_MSK              cpu_to_le32(1 << 9)
657
/* radar detection enable */
658
659
#define RXON_FLG_RADAR_DETECT_MSK       cpu_to_le32(1 << 12)
#define RXON_FLG_TGJ_NARROW_BAND_MSK    cpu_to_le32(1 << 13)
660
661
/* rx response to host with 8-byte TSF
* (according to ON_AIR deassertion) */
662
#define RXON_FLG_TSF2HOST_MSK           cpu_to_le32(1 << 15)
663

664
665
666

/* HT flags */
#define RXON_FLG_CTRL_CHANNEL_LOC_POS		(22)
667
#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK	cpu_to_le32(0x1 << 22)
668
669
670

#define RXON_FLG_HT_OPERATING_MODE_POS		(23)

671
#define RXON_FLG_HT_PROT_MSK			cpu_to_le32(0x1 << 23)
672
#define RXON_FLG_HT40_PROT_MSK			cpu_to_le32(0x2 << 23)
673
674

#define RXON_FLG_CHANNEL_MODE_POS		(25)
675
#define RXON_FLG_CHANNEL_MODE_MSK		cpu_to_le32(0x3 << 25)
676
677
678
679
680
681
682
683
684
685
686
687

/* channel mode */
enum {
	CHANNEL_MODE_LEGACY = 0,
	CHANNEL_MODE_PURE_40 = 1,
	CHANNEL_MODE_MIXED = 2,
	CHANNEL_MODE_RESERVED = 3,
};
#define RXON_FLG_CHANNEL_MODE_LEGACY	cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
#define RXON_FLG_CHANNEL_MODE_PURE_40	cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
#define RXON_FLG_CHANNEL_MODE_MIXED	cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)

688
/* CTS to self (if spec allows) flag */
689
#define RXON_FLG_SELF_CTS_EN			cpu_to_le32(0x1<<30)
690

691
692
/* rx_config filter flags */
/* accept all data frames */
693
#define RXON_FILTER_PROMISC_MSK         cpu_to_le32(1 << 0)
694
/* pass control & management to host */
695
#define RXON_FILTER_CTL2HOST_MSK        cpu_to_le32(1 << 1)
696
/* accept multi-cast */
697
#define RXON_FILTER_ACCEPT_GRP_MSK      cpu_to_le32(1 << 2)
698
/* don't decrypt uni-cast frames */
699
#define RXON_FILTER_DIS_DECRYPT_MSK     cpu_to_le32(1 << 3)
700
/* don't decrypt multi-cast frames */
701
#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
702
/* STA is associated */
703
#define RXON_FILTER_ASSOC_MSK           cpu_to_le32(1 << 5)
704
/* transfer to host non bssid beacons in associated state */
705
#define RXON_FILTER_BCON_AWARE_MSK      cpu_to_le32(1 << 6)
706

707
/**
708
 * REPLY_RXON = 0x10 (command, has simple generic response)
709
710
711
712
713
714
715
716
717
718
719
720
721
722
 *
 * RXON tunes the radio tuner to a service channel, and sets up a number
 * of parameters that are used primarily for Rx, but also for Tx operations.
 *
 * NOTE:  When tuning to a new channel, driver must set the
 *        RXON_FILTER_ASSOC_MSK to 0.  This will clear station-dependent
 *        info within the device, including the station tables, tx retry
 *        rate tables, and txpower tables.  Driver must build a new station
 *        table and txpower table before transmitting anything on the RXON
 *        channel.
 *
 * NOTE:  All RXONs wipe clean the internal txpower table.  Driver must
 *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
 *        regardless of whether RXON_FILTER_ASSOC_MSK is set.
723
 */
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741

struct iwl3945_rxon_cmd {
	u8 node_addr[6];
	__le16 reserved1;
	u8 bssid_addr[6];
	__le16 reserved2;
	u8 wlap_bssid_addr[6];
	__le16 reserved3;
	u8 dev_type;
	u8 air_propagation;
	__le16 reserved4;
	u8 ofdm_basic_rates;
	u8 cck_basic_rates;
	__le16 assoc_id;
	__le32 flags;
	__le32 filter_flags;
	__le16 channel;
	__le16 reserved5;
742
} __packed;
743

Christoph Hellwig's avatar
Christoph Hellwig committed
744
struct iwl4965_rxon_cmd {
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
	u8 node_addr[6];
	__le16 reserved1;
	u8 bssid_addr[6];
	__le16 reserved2;
	u8 wlap_bssid_addr[6];
	__le16 reserved3;
	u8 dev_type;
	u8 air_propagation;
	__le16 rx_chain;
	u8 ofdm_basic_rates;
	u8 cck_basic_rates;
	__le16 assoc_id;
	__le32 flags;
	__le32 filter_flags;
	__le16 channel;
	u8 ofdm_ht_single_stream_basic_rates;
	u8 ofdm_ht_dual_stream_basic_rates;
762
} __packed;
763

764
/* 5000 HW just extend this command */
Gregory Greenman's avatar
Gregory Greenman committed
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
struct iwl_rxon_cmd {
	u8 node_addr[6];
	__le16 reserved1;
	u8 bssid_addr[6];
	__le16 reserved2;
	u8 wlap_bssid_addr[6];
	__le16 reserved3;
	u8 dev_type;
	u8 air_propagation;
	__le16 rx_chain;
	u8 ofdm_basic_rates;
	u8 cck_basic_rates;
	__le16 assoc_id;
	__le32 flags;
	__le32 filter_flags;
	__le16 channel;
	u8 ofdm_ht_single_stream_basic_rates;
	u8 ofdm_ht_dual_stream_basic_rates;
	u8 ofdm_ht_triple_stream_basic_rates;
	u8 reserved5;
	__le16 acquisition_data;
	__le16 reserved6;
787
} __packed;
Gregory Greenman's avatar
Gregory Greenman committed
788

789
790
791
792
793
794
795
796
797
/*
 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
 */
struct iwl3945_rxon_assoc_cmd {
	__le32 flags;
	__le32 filter_flags;
	u8 ofdm_basic_rates;
	u8 cck_basic_rates;
	__le16 reserved;
798
} __packed;
799
800

struct iwl4965_rxon_assoc_cmd {
801
802
803
804
805
806
807
	__le32 flags;
	__le32 filter_flags;
	u8 ofdm_basic_rates;
	u8 cck_basic_rates;
	u8 ofdm_ht_single_stream_basic_rates;
	u8 ofdm_ht_dual_stream_basic_rates;
	__le16 rx_chain_select_flags;
808
	__le16 reserved;
809
} __packed;
Gregory Greenman's avatar
Gregory Greenman committed
810

811
struct iwl5000_rxon_assoc_cmd {
812
813
814
815
	__le32 flags;
	__le32 filter_flags;
	u8 ofdm_basic_rates;
	u8 cck_basic_rates;
816
	__le16 reserved1;
817
818
	u8 ofdm_ht_single_stream_basic_rates;
	u8 ofdm_ht_dual_stream_basic_rates;
819
820
	u8 ofdm_ht_triple_stream_basic_rates;
	u8 reserved2;
821
	__le16 rx_chain_select_flags;
822
823
	__le16 acquisition_data;
	__le32 reserved3;
824
} __packed;
825

826
#define IWL_CONN_MAX_LISTEN_INTERVAL	10
827
828
#define IWL_MAX_UCODE_BEACON_INTERVAL	4 /* 4096 */
#define IWL39_MAX_UCODE_BEACON_INTERVAL	1 /* 1024 */
829

830
831
832
/*
 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
 */
833
834
struct iwl_rxon_time_cmd {
	__le64 timestamp;
835
836
837
838
	__le16 beacon_interval;
	__le16 atim_window;
	__le32 beacon_init_val;
	__le16 listen_interval;
Johannes Berg's avatar
Johannes Berg committed
839
840
	u8 dtim_period;
	u8 delta_cp_bss_tbtts;
841
} __packed;
842
843
844
845

/*
 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
 */
846
847
848
849
850
851
852
853
struct iwl3945_channel_switch_cmd {
	u8 band;
	u8 expect_beacon;
	__le16 channel;
	__le32 rxon_flags;
	__le32 rxon_filter_flags;
	__le32 switch_time;
	struct iwl3945_power_per_rate power[IWL_MAX_RATES];
854
} __packed;
855

856
struct iwl4965_channel_switch_cmd {
857
858
859
860
861
862
	u8 band;
	u8 expect_beacon;
	__le16 channel;
	__le32 rxon_flags;
	__le32 rxon_filter_flags;
	__le32 switch_time;
Christoph Hellwig's avatar
Christoph Hellwig committed
863
	struct iwl4965_tx_power_db tx_power;
864
} __packed;
865

866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
/**
 * struct iwl5000_channel_switch_cmd
 * @band: 0- 5.2GHz, 1- 2.4GHz
 * @expect_beacon: 0- resume transmits after channel switch
 *		   1- wait for beacon to resume transmits
 * @channel: new channel number
 * @rxon_flags: Rx on flags
 * @rxon_filter_flags: filtering parameters
 * @switch_time: switch time in extended beacon format
 * @reserved: reserved bytes
 */
struct iwl5000_channel_switch_cmd {
	u8 band;
	u8 expect_beacon;
	__le16 channel;
	__le32 rxon_flags;
	__le32 rxon_filter_flags;
	__le32 switch_time;
	__le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
885
} __packed;
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905

/**
 * struct iwl6000_channel_switch_cmd
 * @band: 0- 5.2GHz, 1- 2.4GHz
 * @expect_beacon: 0- resume transmits after channel switch
 *		   1- wait for beacon to resume transmits
 * @channel: new channel number
 * @rxon_flags: Rx on flags
 * @rxon_filter_flags: filtering parameters
 * @switch_time: switch time in extended beacon format
 * @reserved: reserved bytes
 */
struct iwl6000_channel_switch_cmd {
	u8 band;
	u8 expect_beacon;
	__le16 channel;
	__le32 rxon_flags;
	__le32 rxon_filter_flags;
	__le32 switch_time;
	__le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
906
} __packed;
907

908
909
910
/*
 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
 */
911
struct iwl_csa_notification {
912
913
914
	__le16 band;
	__le16 channel;
	__le32 status;		/* 0 - OK, 1 - fail */
915
} __packed;
916
917
918
919
920
921

/******************************************************************************
 * (2)
 * Quality-of-Service (QOS) Commands & Responses:
 *
 *****************************************************************************/
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938

/**
 * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
 * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
 *
 * @cw_min: Contention window, start value in numbers of slots.
 *          Should be a power-of-2, minus 1.  Device's default is 0x0f.
 * @cw_max: Contention window, max value in numbers of slots.
 *          Should be a power-of-2, minus 1.  Device's default is 0x3f.
 * @aifsn:  Number of slots in Arbitration Interframe Space (before
 *          performing random backoff timing prior to Tx).  Device default 1.
 * @edca_txop:  Length of Tx opportunity, in uSecs.  Device default is 0.
 *
 * Device will automatically increase contention window by (2*CW) + 1 for each
 * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW
 * value, to cap the CW value.
 */
939
struct iwl_ac_qos {
940
941
942
943
944
	__le16 cw_min;
	__le16 cw_max;
	u8 aifsn;
	u8 reserved1;
	__le16 edca_txop;
945
} __packed;
946
947

/* QoS flags defines */
948
949
950
#define QOS_PARAM_FLG_UPDATE_EDCA_MSK	cpu_to_le32(0x01)
#define QOS_PARAM_FLG_TGN_MSK		cpu_to_le32(0x02)
#define QOS_PARAM_FLG_TXOP_TYPE_MSK	cpu_to_le32(0x10)
951

952
/* Number of Access Categories (AC) (EDCA), queues 0..3 */
953
954
955
956
#define AC_NUM                4

/*
 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
957
958
959
 *
 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
960
 */
961
struct iwl_qosparam_cmd {
962
	__le32 qos_flags;
963
	struct iwl_ac_qos ac[AC_NUM];
964
} __packed;
965
966
967
968
969
970
971
972
973

/******************************************************************************
 * (3)
 * Add/Modify Stations Commands & Responses:
 *
 *****************************************************************************/
/*
 * Multi station support
 */
974
975

/* Special, dedicated locations within device's station table */
976
#define	IWL_AP_ID		0
Johannes Berg's avatar
Johannes Berg committed
977
#define	IWL_AP_ID_PAN		1
978
#define	IWL_STA_ID		2
979
980
#define	IWL3945_BROADCAST_ID	24
#define IWL3945_STATION_COUNT	25
981
982
#define IWL4965_BROADCAST_ID	31
#define	IWL4965_STATION_COUNT	32
Johannes Berg's avatar
Johannes Berg committed
983
#define IWLAGN_PAN_BCAST_ID	14
984
985
#define IWLAGN_BROADCAST_ID	15
#define	IWLAGN_STATION_COUNT	16
986
987
988
989

#define	IWL_STATION_COUNT	32 	/* MAX(3945,4965)*/
#define	IWL_INVALID_STATION 	255

990
991
#define STA_FLG_TX_RATE_MSK		cpu_to_le32(1 << 2)
#define STA_FLG_PWR_SAVE_MSK		cpu_to_le32(1 << 8)
Johannes Berg's avatar
Johannes Berg committed
992
#define STA_FLG_PAN_STATION		cpu_to_le32(1 << 13)
993
994
#define STA_FLG_RTS_MIMO_PROT_MSK	cpu_to_le32(1 << 17)
#define STA_FLG_AGG_MPDU_8US_MSK	cpu_to_le32(1 << 18)
995
#define STA_FLG_MAX_AGG_SIZE_POS	(19)
996
#define STA_FLG_MAX_AGG_SIZE_MSK	cpu_to_le32(3 << 19)
997
#define STA_FLG_HT40_EN_MSK		cpu_to_le32(1 << 21)
998
#define STA_FLG_MIMO_DIS_MSK		cpu_to_le32(1 << 22)
999
#define STA_FLG_AGG_MPDU_DENSITY_POS	(23)
1000
#define STA_FLG_AGG_MPDU_DENSITY_MSK	cpu_to_le32(7 << 23)
For faster browsing, not all history is shown. View entire blame