iwlwifi: add comments to RXON command and txpower formats
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-3945-commands.h
1 /******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63 /*
64 * Please use this file (iwl-3945-commands.h) only for uCode API definitions.
65 * Please use iwl-3945-hw.h for hardware-related definitions.
66 * Please use iwl-3945.h for driver implementation definitions.
67 */
68
69 #ifndef __iwl_3945_commands_h__
70 #define __iwl_3945_commands_h__
71
72 enum {
73 REPLY_ALIVE = 0x1,
74 REPLY_ERROR = 0x2,
75
76 /* RXON and QOS commands */
77 REPLY_RXON = 0x10,
78 REPLY_RXON_ASSOC = 0x11,
79 REPLY_QOS_PARAM = 0x13,
80 REPLY_RXON_TIMING = 0x14,
81
82 /* Multi-Station support */
83 REPLY_ADD_STA = 0x18,
84 REPLY_REMOVE_STA = 0x19, /* not used */
85 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
86
87 /* RX, TX, LEDs */
88 REPLY_3945_RX = 0x1b, /* 3945 only */
89 REPLY_TX = 0x1c,
90 REPLY_RATE_SCALE = 0x47, /* 3945 only */
91 REPLY_LEDS_CMD = 0x48,
92 REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
93
94 /* 802.11h related */
95 RADAR_NOTIFICATION = 0x70, /* not used */
96 REPLY_QUIET_CMD = 0x71, /* not used */
97 REPLY_CHANNEL_SWITCH = 0x72,
98 CHANNEL_SWITCH_NOTIFICATION = 0x73,
99 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
100 SPECTRUM_MEASURE_NOTIFICATION = 0x75,
101
102 /* Power Management */
103 POWER_TABLE_CMD = 0x77,
104 PM_SLEEP_NOTIFICATION = 0x7A,
105 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
106
107 /* Scan commands and notifications */
108 REPLY_SCAN_CMD = 0x80,
109 REPLY_SCAN_ABORT_CMD = 0x81,
110 SCAN_START_NOTIFICATION = 0x82,
111 SCAN_RESULTS_NOTIFICATION = 0x83,
112 SCAN_COMPLETE_NOTIFICATION = 0x84,
113
114 /* IBSS/AP commands */
115 BEACON_NOTIFICATION = 0x90,
116 REPLY_TX_BEACON = 0x91,
117 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
118
119 /* Miscellaneous commands */
120 QUIET_NOTIFICATION = 0x96, /* not used */
121 REPLY_TX_PWR_TABLE_CMD = 0x97,
122 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
123
124 /* Bluetooth device coexistance config command */
125 REPLY_BT_CONFIG = 0x9b,
126
127 /* Statistics */
128 REPLY_STATISTICS_CMD = 0x9c,
129 STATISTICS_NOTIFICATION = 0x9d,
130
131 /* RF-KILL commands and notifications */
132 REPLY_CARD_STATE_CMD = 0xa0,
133 CARD_STATE_NOTIFICATION = 0xa1,
134
135 /* Missed beacons notification */
136 MISSED_BEACONS_NOTIFICATION = 0xa2,
137
138 REPLY_MAX = 0xff
139 };
140
141 /******************************************************************************
142 * (0)
143 * Commonly used structures and definitions:
144 * Command header, txpower
145 *
146 *****************************************************************************/
147
148 /* iwl3945_cmd_header flags value */
149 #define IWL_CMD_FAILED_MSK 0x40
150
151 /**
152 * struct iwl3945_cmd_header
153 *
154 * This header format appears in the beginning of each command sent from the
155 * driver, and each response/notification received from uCode.
156 */
157 struct iwl3945_cmd_header {
158 u8 cmd; /* Command ID: REPLY_RXON, etc. */
159 u8 flags; /* IWL_CMD_* */
160 /*
161 * The driver sets up the sequence number to values of its chosing.
162 * uCode does not use this value, but passes it back to the driver
163 * when sending the response to each driver-originated command, so
164 * the driver can match the response to the command. Since the values
165 * don't get used by uCode, the driver may set up an arbitrary format.
166 *
167 * There is one exception: uCode sets bit 15 when it originates
168 * the response/notification, i.e. when the response/notification
169 * is not a direct response to a command sent by the driver. For
170 * example, uCode issues REPLY_3945_RX when it sends a received frame
171 * to the driver; it is not a direct response to any driver command.
172 *
173 * The Linux driver uses the following format:
174 *
175 * 0:7 index/position within Tx queue
176 * 8:13 Tx queue selection
177 * 14:14 driver sets this to indicate command is in the 'huge'
178 * storage at the end of the command buffers, i.e. scan cmd
179 * 15:15 uCode sets this in uCode-originated response/notification
180 */
181 __le16 sequence;
182
183 /* command or response/notification data follows immediately */
184 u8 data[0];
185 } __attribute__ ((packed));
186
187 /**
188 * struct iwl3945_tx_power
189 *
190 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
191 *
192 * Each entry contains two values:
193 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
194 * linear value that multiplies the output of the digital signal processor,
195 * before being sent to the analog radio.
196 * 2) Radio gain. This sets the analog gain of the radio Tx path.
197 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
198 *
199 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
200 */
201 struct iwl3945_tx_power {
202 u8 tx_gain; /* gain for analog radio */
203 u8 dsp_atten; /* gain for DSP */
204 } __attribute__ ((packed));
205
206 /**
207 * struct iwl3945_power_per_rate
208 *
209 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
210 */
211 struct iwl3945_power_per_rate {
212 u8 rate; /* plcp */
213 struct iwl3945_tx_power tpc;
214 u8 reserved;
215 } __attribute__ ((packed));
216
217 /******************************************************************************
218 * (0a)
219 * Alive and Error Commands & Responses:
220 *
221 *****************************************************************************/
222
223 #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
224 #define INITIALIZE_SUBTYPE (9)
225
226 /*
227 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
228 *
229 * uCode issues this "initialize alive" notification once the initialization
230 * uCode image has completed its work, and is ready to load the runtime image.
231 * This is the *first* "alive" notification that the driver will receive after
232 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
233 *
234 * See comments documenting "BSM" (bootstrap state machine).
235 */
236 struct iwl3945_init_alive_resp {
237 u8 ucode_minor;
238 u8 ucode_major;
239 __le16 reserved1;
240 u8 sw_rev[8];
241 u8 ver_type;
242 u8 ver_subtype; /* "9" for initialize alive */
243 __le16 reserved2;
244 __le32 log_event_table_ptr;
245 __le32 error_event_table_ptr;
246 __le32 timestamp;
247 __le32 is_valid;
248 } __attribute__ ((packed));
249
250
251 /**
252 * REPLY_ALIVE = 0x1 (response only, not a command)
253 *
254 * uCode issues this "alive" notification once the runtime image is ready
255 * to receive commands from the driver. This is the *second* "alive"
256 * notification that the driver will receive after rebooting uCode;
257 * this "alive" is indicated by subtype field != 9.
258 *
259 * See comments documenting "BSM" (bootstrap state machine).
260 *
261 * This response includes two pointers to structures within the device's
262 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
263 *
264 * 1) log_event_table_ptr indicates base of the event log. This traces
265 * a 256-entry history of uCode execution within a circular buffer.
266 *
267 * 2) error_event_table_ptr indicates base of the error log. This contains
268 * information about any uCode error that occurs.
269 *
270 * The Linux driver can print both logs to the system log when a uCode error
271 * occurs.
272 */
273 struct iwl3945_alive_resp {
274 u8 ucode_minor;
275 u8 ucode_major;
276 __le16 reserved1;
277 u8 sw_rev[8];
278 u8 ver_type;
279 u8 ver_subtype; /* not "9" for runtime alive */
280 __le16 reserved2;
281 __le32 log_event_table_ptr; /* SRAM address for event log */
282 __le32 error_event_table_ptr; /* SRAM address for error log */
283 __le32 timestamp;
284 __le32 is_valid;
285 } __attribute__ ((packed));
286
287 union tsf {
288 u8 byte[8];
289 __le16 word[4];
290 __le32 dw[2];
291 };
292
293 /*
294 * REPLY_ERROR = 0x2 (response only, not a command)
295 */
296 struct iwl3945_error_resp {
297 __le32 error_type;
298 u8 cmd_id;
299 u8 reserved1;
300 __le16 bad_cmd_seq_num;
301 __le16 reserved2;
302 __le32 error_info;
303 union tsf timestamp;
304 } __attribute__ ((packed));
305
306 /******************************************************************************
307 * (1)
308 * RXON Commands & Responses:
309 *
310 *****************************************************************************/
311
312 /*
313 * Rx config defines & structure
314 */
315 /* rx_config device types */
316 enum {
317 RXON_DEV_TYPE_AP = 1,
318 RXON_DEV_TYPE_ESS = 3,
319 RXON_DEV_TYPE_IBSS = 4,
320 RXON_DEV_TYPE_SNIFFER = 6,
321 };
322
323 /* rx_config flags */
324 /* band & modulation selection */
325 #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
326 #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
327 /* auto detection enable */
328 #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
329 /* TGg protection when tx */
330 #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
331 /* cck short slot & preamble */
332 #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
333 #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
334 /* antenna selection */
335 #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
336 #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
337 #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
338 #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
339 /* radar detection enable */
340 #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
341 #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
342 /* rx response to host with 8-byte TSF
343 * (according to ON_AIR deassertion) */
344 #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
345
346 /* rx_config filter flags */
347 /* accept all data frames */
348 #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
349 /* pass control & management to host */
350 #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
351 /* accept multi-cast */
352 #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
353 /* don't decrypt uni-cast frames */
354 #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
355 /* don't decrypt multi-cast frames */
356 #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
357 /* STA is associated */
358 #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
359 /* transfer to host non bssid beacons in associated state */
360 #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
361
362 /**
363 * REPLY_RXON = 0x10 (command, has simple generic response)
364 *
365 * RXON tunes the radio tuner to a service channel, and sets up a number
366 * of parameters that are used primarily for Rx, but also for Tx operations.
367 *
368 * NOTE: When tuning to a new channel, driver must set the
369 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
370 * info within the device, including the station tables, tx retry
371 * rate tables, and txpower tables. Driver must build a new station
372 * table and txpower table before transmitting anything on the RXON
373 * channel.
374 *
375 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
376 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
377 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
378 */
379 struct iwl3945_rxon_cmd {
380 u8 node_addr[6];
381 __le16 reserved1;
382 u8 bssid_addr[6];
383 __le16 reserved2;
384 u8 wlap_bssid_addr[6];
385 __le16 reserved3;
386 u8 dev_type;
387 u8 air_propagation;
388 __le16 reserved4;
389 u8 ofdm_basic_rates;
390 u8 cck_basic_rates;
391 __le16 assoc_id;
392 __le32 flags;
393 __le32 filter_flags;
394 __le16 channel;
395 __le16 reserved5;
396 } __attribute__ ((packed));
397
398 /*
399 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
400 */
401 struct iwl3945_rxon_assoc_cmd {
402 __le32 flags;
403 __le32 filter_flags;
404 u8 ofdm_basic_rates;
405 u8 cck_basic_rates;
406 __le16 reserved;
407 } __attribute__ ((packed));
408
409 /*
410 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
411 */
412 struct iwl3945_rxon_time_cmd {
413 union tsf timestamp;
414 __le16 beacon_interval;
415 __le16 atim_window;
416 __le32 beacon_init_val;
417 __le16 listen_interval;
418 __le16 reserved;
419 } __attribute__ ((packed));
420
421 /*
422 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
423 */
424 struct iwl3945_channel_switch_cmd {
425 u8 band;
426 u8 expect_beacon;
427 __le16 channel;
428 __le32 rxon_flags;
429 __le32 rxon_filter_flags;
430 __le32 switch_time;
431 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
432 } __attribute__ ((packed));
433
434 /*
435 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
436 */
437 struct iwl3945_csa_notification {
438 __le16 band;
439 __le16 channel;
440 __le32 status; /* 0 - OK, 1 - fail */
441 } __attribute__ ((packed));
442
443 /******************************************************************************
444 * (2)
445 * Quality-of-Service (QOS) Commands & Responses:
446 *
447 *****************************************************************************/
448 struct iwl3945_ac_qos {
449 __le16 cw_min;
450 __le16 cw_max;
451 u8 aifsn;
452 u8 reserved1;
453 __le16 edca_txop;
454 } __attribute__ ((packed));
455
456 /* QoS flags defines */
457 #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
458 #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
459 #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
460
461 /*
462 * TXFIFO Queue number defines
463 */
464 /* number of Access categories (AC) (EDCA), queues 0..3 */
465 #define AC_NUM 4
466
467 /*
468 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
469 */
470 struct iwl3945_qosparam_cmd {
471 __le32 qos_flags;
472 struct iwl3945_ac_qos ac[AC_NUM];
473 } __attribute__ ((packed));
474
475 /******************************************************************************
476 * (3)
477 * Add/Modify Stations Commands & Responses:
478 *
479 *****************************************************************************/
480 /*
481 * Multi station support
482 */
483 #define IWL_AP_ID 0
484 #define IWL_MULTICAST_ID 1
485 #define IWL_STA_ID 2
486
487 #define IWL3945_BROADCAST_ID 24
488 #define IWL3945_STATION_COUNT 25
489
490 #define IWL4965_BROADCAST_ID 31
491 #define IWL4965_STATION_COUNT 32
492
493 #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
494 #define IWL_INVALID_STATION 255
495
496 #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);
497 #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
498
499 #define STA_CONTROL_MODIFY_MSK 0x01
500
501 /* key flags __le16*/
502 #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
503 #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
504 #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
505 #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
506 #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
507
508 #define STA_KEY_FLG_KEYID_POS 8
509 #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
510
511 /* modify flags */
512 #define STA_MODIFY_KEY_MASK 0x01
513 #define STA_MODIFY_TID_DISABLE_TX 0x02
514 #define STA_MODIFY_TX_RATE_MSK 0x04
515 #define STA_MODIFY_ADDBA_TID_MSK 0x08
516 #define STA_MODIFY_DELBA_TID_MSK 0x10
517 #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
518
519 /*
520 * Antenna masks:
521 * bit14:15 01 B inactive, A active
522 * 10 B active, A inactive
523 * 11 Both active
524 */
525 #define RATE_MCS_ANT_A_POS 14
526 #define RATE_MCS_ANT_B_POS 15
527 #define RATE_MCS_ANT_A_MSK 0x4000
528 #define RATE_MCS_ANT_B_MSK 0x8000
529 #define RATE_MCS_ANT_AB_MSK 0xc000
530
531 struct iwl3945_keyinfo {
532 __le16 key_flags;
533 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
534 u8 reserved1;
535 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
536 __le16 reserved2;
537 u8 key[16]; /* 16-byte unicast decryption key */
538 } __attribute__ ((packed));
539
540 struct sta_id_modify {
541 u8 addr[ETH_ALEN];
542 __le16 reserved1;
543 u8 sta_id;
544 u8 modify_mask;
545 __le16 reserved2;
546 } __attribute__ ((packed));
547
548 /*
549 * REPLY_ADD_STA = 0x18 (command)
550 */
551 struct iwl3945_addsta_cmd {
552 u8 mode;
553 u8 reserved[3];
554 struct sta_id_modify sta;
555 struct iwl3945_keyinfo key;
556 __le32 station_flags;
557 __le32 station_flags_msk;
558 __le16 tid_disable_tx;
559 __le16 rate_n_flags;
560 u8 add_immediate_ba_tid;
561 u8 remove_immediate_ba_tid;
562 __le16 add_immediate_ba_ssn;
563 } __attribute__ ((packed));
564
565 /*
566 * REPLY_ADD_STA = 0x18 (response)
567 */
568 struct iwl3945_add_sta_resp {
569 u8 status;
570 } __attribute__ ((packed));
571
572 #define ADD_STA_SUCCESS_MSK 0x1
573
574 /******************************************************************************
575 * (4)
576 * Rx Responses:
577 *
578 *****************************************************************************/
579
580 struct iwl3945_rx_frame_stats {
581 u8 phy_count;
582 u8 id;
583 u8 rssi;
584 u8 agc;
585 __le16 sig_avg;
586 __le16 noise_diff;
587 u8 payload[0];
588 } __attribute__ ((packed));
589
590 struct iwl3945_rx_frame_hdr {
591 __le16 channel;
592 __le16 phy_flags;
593 u8 reserved1;
594 u8 rate;
595 __le16 len;
596 u8 payload[0];
597 } __attribute__ ((packed));
598
599 #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
600 #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
601
602 #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
603 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
604 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
605 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
606 #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
607
608 #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
609 #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
610 #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
611 #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
612 #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
613
614 #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
615 #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
616 #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
617 #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
618 #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
619
620 struct iwl3945_rx_frame_end {
621 __le32 status;
622 __le64 timestamp;
623 __le32 beacon_timestamp;
624 } __attribute__ ((packed));
625
626 /*
627 * REPLY_3945_RX = 0x1b (response only, not a command)
628 *
629 * NOTE: DO NOT dereference from casts to this structure
630 * It is provided only for calculating minimum data set size.
631 * The actual offsets of the hdr and end are dynamic based on
632 * stats.phy_count
633 */
634 struct iwl3945_rx_frame {
635 struct iwl3945_rx_frame_stats stats;
636 struct iwl3945_rx_frame_hdr hdr;
637 struct iwl3945_rx_frame_end end;
638 } __attribute__ ((packed));
639
640 /* Fixed (non-configurable) rx data from phy */
641 #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
642 #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
643 #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
644 #define IWL_AGC_DB_POS (7)
645 struct iwl4965_rx_non_cfg_phy {
646 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
647 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
648 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
649 u8 pad[0];
650 } __attribute__ ((packed));
651
652 /*
653 * REPLY_4965_RX = 0xc3 (response only, not a command)
654 * Used only for legacy (non 11n) frames.
655 */
656 #define RX_RES_PHY_CNT 14
657 struct iwl4965_rx_phy_res {
658 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
659 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
660 u8 stat_id; /* configurable DSP phy data set ID */
661 u8 reserved1;
662 __le64 timestamp; /* TSF at on air rise */
663 __le32 beacon_time_stamp; /* beacon at on-air rise */
664 __le16 phy_flags; /* general phy flags: band, modulation, ... */
665 __le16 channel; /* channel number */
666 __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
667 __le32 reserved2;
668 __le32 rate_n_flags;
669 __le16 byte_count; /* frame's byte-count */
670 __le16 reserved3;
671 } __attribute__ ((packed));
672
673 struct iwl4965_rx_mpdu_res_start {
674 __le16 byte_count;
675 __le16 reserved;
676 } __attribute__ ((packed));
677
678
679 /******************************************************************************
680 * (5)
681 * Tx Commands & Responses:
682 *
683 *****************************************************************************/
684
685 /* Tx flags */
686 #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
687 #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
688 #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
689 #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
690 #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
691 #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
692 #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
693 #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
694 #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
695
696 /* ucode ignores BT priority for this frame */
697 #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
698
699 /* ucode overrides sequence control */
700 #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
701
702 /* signal that this frame is non-last MPDU */
703 #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
704
705 /* calculate TSF in outgoing frame */
706 #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
707
708 /* activate TX calibration. */
709 #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
710
711 /* signals that 2 bytes pad was inserted
712 after the MAC header */
713 #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
714
715 /* HCCA-AP - disable duration overwriting. */
716 #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
717
718 /*
719 * TX command security control
720 */
721 #define TX_CMD_SEC_WEP 0x01
722 #define TX_CMD_SEC_CCM 0x02
723 #define TX_CMD_SEC_TKIP 0x03
724 #define TX_CMD_SEC_MSK 0x03
725 #define TX_CMD_SEC_SHIFT 6
726 #define TX_CMD_SEC_KEY128 0x08
727
728 /*
729 * TX command Frame life time
730 */
731
732 struct iwl3945_dram_scratch {
733 u8 try_cnt;
734 u8 bt_kill_cnt;
735 __le16 reserved;
736 } __attribute__ ((packed));
737
738 /*
739 * REPLY_TX = 0x1c (command)
740 */
741 struct iwl3945_tx_cmd {
742 __le16 len;
743 __le16 next_frame_len;
744 __le32 tx_flags;
745 u8 rate;
746 u8 sta_id;
747 u8 tid_tspec;
748 u8 sec_ctl;
749 u8 key[16];
750 union {
751 u8 byte[8];
752 __le16 word[4];
753 __le32 dw[2];
754 } tkip_mic;
755 __le32 next_frame_info;
756 union {
757 __le32 life_time;
758 __le32 attempt;
759 } stop_time;
760 u8 supp_rates[2];
761 u8 rts_retry_limit; /*byte 50 */
762 u8 data_retry_limit; /*byte 51 */
763 union {
764 __le16 pm_frame_timeout;
765 __le16 attempt_duration;
766 } timeout;
767 __le16 driver_txop;
768 u8 payload[0];
769 struct ieee80211_hdr hdr[0];
770 } __attribute__ ((packed));
771
772 /* TX command response is sent after *all* transmission attempts.
773 *
774 * NOTES:
775 *
776 * TX_STATUS_FAIL_NEXT_FRAG
777 *
778 * If the fragment flag in the MAC header for the frame being transmitted
779 * is set and there is insufficient time to transmit the next frame, the
780 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
781 *
782 * TX_STATUS_FIFO_UNDERRUN
783 *
784 * Indicates the host did not provide bytes to the FIFO fast enough while
785 * a TX was in progress.
786 *
787 * TX_STATUS_FAIL_MGMNT_ABORT
788 *
789 * This status is only possible if the ABORT ON MGMT RX parameter was
790 * set to true with the TX command.
791 *
792 * If the MSB of the status parameter is set then an abort sequence is
793 * required. This sequence consists of the host activating the TX Abort
794 * control line, and then waiting for the TX Abort command response. This
795 * indicates that a the device is no longer in a transmit state, and that the
796 * command FIFO has been cleared. The host must then deactivate the TX Abort
797 * control line. Receiving is still allowed in this case.
798 */
799 enum {
800 TX_STATUS_SUCCESS = 0x01,
801 TX_STATUS_DIRECT_DONE = 0x02,
802 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
803 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
804 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
805 TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
806 TX_STATUS_FAIL_NEXT_FRAG = 0x86,
807 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
808 TX_STATUS_FAIL_DEST_PS = 0x88,
809 TX_STATUS_FAIL_ABORTED = 0x89,
810 TX_STATUS_FAIL_BT_RETRY = 0x8a,
811 TX_STATUS_FAIL_STA_INVALID = 0x8b,
812 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
813 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
814 TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
815 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
816 TX_STATUS_FAIL_TX_LOCKED = 0x90,
817 TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
818 };
819
820 #define TX_PACKET_MODE_REGULAR 0x0000
821 #define TX_PACKET_MODE_BURST_SEQ 0x0100
822 #define TX_PACKET_MODE_BURST_FIRST 0x0200
823
824 enum {
825 TX_POWER_PA_NOT_ACTIVE = 0x0,
826 };
827
828 enum {
829 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
830 TX_STATUS_DELAY_MSK = 0x00000040,
831 TX_STATUS_ABORT_MSK = 0x00000080,
832 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
833 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
834 TX_RESERVED = 0x00780000, /* bits 19:22 */
835 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
836 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
837 };
838
839 /* *******************************
840 * TX aggregation state
841 ******************************* */
842
843 enum {
844 AGG_TX_STATE_TRANSMITTED = 0x00,
845 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
846 AGG_TX_STATE_BT_PRIO_MSK = 0x02,
847 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
848 AGG_TX_STATE_ABORT_MSK = 0x08,
849 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
850 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
851 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
852 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
853 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
854 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
855 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
856 AGG_TX_STATE_DELAY_TX_MSK = 0x400
857 };
858
859 #define AGG_TX_STATE_LAST_SENT_MSK \
860 (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
861 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
862 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
863
864 #define AGG_TX_STATE_TRY_CNT_POS 12
865 #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
866
867 #define AGG_TX_STATE_SEQ_NUM_POS 16
868 #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
869
870 /*
871 * REPLY_TX = 0x1c (response)
872 */
873 struct iwl3945_tx_resp {
874 u8 failure_rts;
875 u8 failure_frame;
876 u8 bt_kill_count;
877 u8 rate;
878 __le32 wireless_media_time;
879 __le32 status; /* TX status (for aggregation status of 1st frame) */
880 } __attribute__ ((packed));
881
882 /*
883 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
884 */
885 struct iwl3945_compressed_ba_resp {
886 __le32 sta_addr_lo32;
887 __le16 sta_addr_hi16;
888 __le16 reserved;
889 u8 sta_id;
890 u8 tid;
891 __le16 ba_seq_ctl;
892 __le32 ba_bitmap0;
893 __le32 ba_bitmap1;
894 __le16 scd_flow;
895 __le16 scd_ssn;
896 } __attribute__ ((packed));
897
898 /*
899 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
900 */
901 struct iwl3945_txpowertable_cmd {
902 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
903 u8 reserved;
904 __le16 channel;
905 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
906 } __attribute__ ((packed));
907
908 struct iwl3945_rate_scaling_info {
909 __le16 rate_n_flags;
910 u8 try_cnt;
911 u8 next_rate_index;
912 } __attribute__ ((packed));
913
914 /**
915 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
916 *
917 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
918 *
919 * NOTE: The table of rates passed to the uCode via the
920 * RATE_SCALE command sets up the corresponding order of
921 * rates used for all related commands, including rate
922 * masks, etc.
923 *
924 * For example, if you set 9MB (PLCP 0x0f) as the first
925 * rate in the rate table, the bit mask for that rate
926 * when passed through ofdm_basic_rates on the REPLY_RXON
927 * command would be bit 0 (1<<0)
928 */
929 struct iwl3945_rate_scaling_cmd {
930 u8 table_id;
931 u8 reserved[3];
932 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
933 } __attribute__ ((packed));
934
935 /*
936 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
937 */
938 struct iwl3945_bt_cmd {
939 u8 flags;
940 u8 lead_time;
941 u8 max_kill;
942 u8 reserved;
943 __le32 kill_ack_mask;
944 __le32 kill_cts_mask;
945 } __attribute__ ((packed));
946
947 /******************************************************************************
948 * (6)
949 * Spectrum Management (802.11h) Commands, Responses, Notifications:
950 *
951 *****************************************************************************/
952
953 /*
954 * Spectrum Management
955 */
956 #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
957 RXON_FILTER_CTL2HOST_MSK | \
958 RXON_FILTER_ACCEPT_GRP_MSK | \
959 RXON_FILTER_DIS_DECRYPT_MSK | \
960 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
961 RXON_FILTER_ASSOC_MSK | \
962 RXON_FILTER_BCON_AWARE_MSK)
963
964 struct iwl3945_measure_channel {
965 __le32 duration; /* measurement duration in extended beacon
966 * format */
967 u8 channel; /* channel to measure */
968 u8 type; /* see enum iwl3945_measure_type */
969 __le16 reserved;
970 } __attribute__ ((packed));
971
972 /*
973 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
974 */
975 struct iwl3945_spectrum_cmd {
976 __le16 len; /* number of bytes starting from token */
977 u8 token; /* token id */
978 u8 id; /* measurement id -- 0 or 1 */
979 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
980 u8 periodic; /* 1 = periodic */
981 __le16 path_loss_timeout;
982 __le32 start_time; /* start time in extended beacon format */
983 __le32 reserved2;
984 __le32 flags; /* rxon flags */
985 __le32 filter_flags; /* rxon filter flags */
986 __le16 channel_count; /* minimum 1, maximum 10 */
987 __le16 reserved3;
988 struct iwl3945_measure_channel channels[10];
989 } __attribute__ ((packed));
990
991 /*
992 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
993 */
994 struct iwl3945_spectrum_resp {
995 u8 token;
996 u8 id; /* id of the prior command replaced, or 0xff */
997 __le16 status; /* 0 - command will be handled
998 * 1 - cannot handle (conflicts with another
999 * measurement) */
1000 } __attribute__ ((packed));
1001
1002 enum iwl3945_measurement_state {
1003 IWL_MEASUREMENT_START = 0,
1004 IWL_MEASUREMENT_STOP = 1,
1005 };
1006
1007 enum iwl3945_measurement_status {
1008 IWL_MEASUREMENT_OK = 0,
1009 IWL_MEASUREMENT_CONCURRENT = 1,
1010 IWL_MEASUREMENT_CSA_CONFLICT = 2,
1011 IWL_MEASUREMENT_TGH_CONFLICT = 3,
1012 /* 4-5 reserved */
1013 IWL_MEASUREMENT_STOPPED = 6,
1014 IWL_MEASUREMENT_TIMEOUT = 7,
1015 IWL_MEASUREMENT_PERIODIC_FAILED = 8,
1016 };
1017
1018 #define NUM_ELEMENTS_IN_HISTOGRAM 8
1019
1020 struct iwl3945_measurement_histogram {
1021 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
1022 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
1023 } __attribute__ ((packed));
1024
1025 /* clear channel availability counters */
1026 struct iwl3945_measurement_cca_counters {
1027 __le32 ofdm;
1028 __le32 cck;
1029 } __attribute__ ((packed));
1030
1031 enum iwl3945_measure_type {
1032 IWL_MEASURE_BASIC = (1 << 0),
1033 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
1034 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
1035 IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
1036 IWL_MEASURE_FRAME = (1 << 4),
1037 /* bits 5:6 are reserved */
1038 IWL_MEASURE_IDLE = (1 << 7),
1039 };
1040
1041 /*
1042 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
1043 */
1044 struct iwl3945_spectrum_notification {
1045 u8 id; /* measurement id -- 0 or 1 */
1046 u8 token;
1047 u8 channel_index; /* index in measurement channel list */
1048 u8 state; /* 0 - start, 1 - stop */
1049 __le32 start_time; /* lower 32-bits of TSF */
1050 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
1051 u8 channel;
1052 u8 type; /* see enum iwl3945_measurement_type */
1053 u8 reserved1;
1054 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
1055 * valid if applicable for measurement type requested. */
1056 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
1057 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
1058 __le32 cca_time; /* channel load time in usecs */
1059 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
1060 * unidentified */
1061 u8 reserved2[3];
1062 struct iwl3945_measurement_histogram histogram;
1063 __le32 stop_time; /* lower 32-bits of TSF */
1064 __le32 status; /* see iwl3945_measurement_status */
1065 } __attribute__ ((packed));
1066
1067 /******************************************************************************
1068 * (7)
1069 * Power Management Commands, Responses, Notifications:
1070 *
1071 *****************************************************************************/
1072
1073 /**
1074 * struct iwl3945_powertable_cmd - Power Table Command
1075 * @flags: See below:
1076 *
1077 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
1078 *
1079 * PM allow:
1080 * bit 0 - '0' Driver not allow power management
1081 * '1' Driver allow PM (use rest of parameters)
1082 * uCode send sleep notifications:
1083 * bit 1 - '0' Don't send sleep notification
1084 * '1' send sleep notification (SEND_PM_NOTIFICATION)
1085 * Sleep over DTIM
1086 * bit 2 - '0' PM have to walk up every DTIM
1087 * '1' PM could sleep over DTIM till listen Interval.
1088 * PCI power managed
1089 * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
1090 * '1' !(PCI_LINK_CTRL & 0x1)
1091 * Force sleep Modes
1092 * bit 31/30- '00' use both mac/xtal sleeps
1093 * '01' force Mac sleep
1094 * '10' force xtal sleep
1095 * '11' Illegal set
1096 *
1097 * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
1098 * ucode assume sleep over DTIM is allowed and we don't need to wakeup
1099 * for every DTIM.
1100 */
1101 #define IWL_POWER_VEC_SIZE 5
1102
1103 #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
1104 #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
1105 #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
1106 struct iwl3945_powertable_cmd {
1107 __le32 flags;
1108 __le32 rx_data_timeout;
1109 __le32 tx_data_timeout;
1110 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
1111 } __attribute__((packed));
1112
1113 /*
1114 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1115 * 3945 and 4965 identical.
1116 */
1117 struct iwl3945_sleep_notification {
1118 u8 pm_sleep_mode;
1119 u8 pm_wakeup_src;
1120 __le16 reserved;
1121 __le32 sleep_time;
1122 __le32 tsf_low;
1123 __le32 bcon_timer;
1124 } __attribute__ ((packed));
1125
1126 /* Sleep states. 3945 and 4965 identical. */
1127 enum {
1128 IWL_PM_NO_SLEEP = 0,
1129 IWL_PM_SLP_MAC = 1,
1130 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
1131 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
1132 IWL_PM_SLP_PHY = 4,
1133 IWL_PM_SLP_REPENT = 5,
1134 IWL_PM_WAKEUP_BY_TIMER = 6,
1135 IWL_PM_WAKEUP_BY_DRIVER = 7,
1136 IWL_PM_WAKEUP_BY_RFKILL = 8,
1137 /* 3 reserved */
1138 IWL_PM_NUM_OF_MODES = 12,
1139 };
1140
1141 /*
1142 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
1143 */
1144 #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
1145 #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
1146 #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
1147 struct iwl3945_card_state_cmd {
1148 __le32 status; /* CARD_STATE_CMD_* request new power state */
1149 } __attribute__ ((packed));
1150
1151 /*
1152 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1153 */
1154 struct iwl3945_card_state_notif {
1155 __le32 flags;
1156 } __attribute__ ((packed));
1157
1158 #define HW_CARD_DISABLED 0x01
1159 #define SW_CARD_DISABLED 0x02
1160 #define RF_CARD_DISABLED 0x04
1161 #define RXON_CARD_DISABLED 0x10
1162
1163 struct iwl3945_ct_kill_config {
1164 __le32 reserved;
1165 __le32 critical_temperature_M;
1166 __le32 critical_temperature_R;
1167 } __attribute__ ((packed));
1168
1169 /******************************************************************************
1170 * (8)
1171 * Scan Commands, Responses, Notifications:
1172 *
1173 *****************************************************************************/
1174
1175 struct iwl3945_scan_channel {
1176 /* type is defined as:
1177 * 0:0 active (0 - passive)
1178 * 1:4 SSID direct
1179 * If 1 is set then corresponding SSID IE is transmitted in probe
1180 * 5:7 reserved
1181 */
1182 u8 type;
1183 u8 channel;
1184 struct iwl3945_tx_power tpc;
1185 __le16 active_dwell;
1186 __le16 passive_dwell;
1187 } __attribute__ ((packed));
1188
1189 struct iwl3945_ssid_ie {
1190 u8 id;
1191 u8 len;
1192 u8 ssid[32];
1193 } __attribute__ ((packed));
1194
1195 #define PROBE_OPTION_MAX 0x4
1196 #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
1197 #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
1198 #define IWL_MAX_SCAN_SIZE 1024
1199
1200 /*
1201 * REPLY_SCAN_CMD = 0x80 (command)
1202 */
1203 struct iwl3945_scan_cmd {
1204 __le16 len;
1205 u8 reserved0;
1206 u8 channel_count;
1207 __le16 quiet_time; /* dwell only this long on quiet chnl
1208 * (active scan) */
1209 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
1210 __le16 good_CRC_th; /* passive -> active promotion threshold */
1211 __le16 reserved1;
1212 __le32 max_out_time; /* max usec to be out of associated (service)
1213 * chnl */
1214 __le32 suspend_time; /* pause scan this long when returning to svc
1215 * chnl.
1216 * 3945 -- 31:24 # beacons, 19:0 additional usec,
1217 * 4965 -- 31:22 # beacons, 21:0 additional usec.
1218 */
1219 __le32 flags;
1220 __le32 filter_flags;
1221
1222 struct iwl3945_tx_cmd tx_cmd;
1223 struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
1224
1225 u8 data[0];
1226 /*
1227 * The channels start after the probe request payload and are of type:
1228 *
1229 * struct iwl3945_scan_channel channels[0];
1230 *
1231 * NOTE: Only one band of channels can be scanned per pass. You
1232 * can not mix 2.4GHz channels and 5.2GHz channels and must
1233 * request a scan multiple times (not concurrently)
1234 *
1235 */
1236 } __attribute__ ((packed));
1237
1238 /* Can abort will notify by complete notification with abort status. */
1239 #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
1240 /* complete notification statuses */
1241 #define ABORT_STATUS 0x2
1242
1243 /*
1244 * REPLY_SCAN_CMD = 0x80 (response)
1245 */
1246 struct iwl3945_scanreq_notification {
1247 __le32 status; /* 1: okay, 2: cannot fulfill request */
1248 } __attribute__ ((packed));
1249
1250 /*
1251 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1252 */
1253 struct iwl3945_scanstart_notification {
1254 __le32 tsf_low;
1255 __le32 tsf_high;
1256 __le32 beacon_timer;
1257 u8 channel;
1258 u8 band;
1259 u8 reserved[2];
1260 __le32 status;
1261 } __attribute__ ((packed));
1262
1263 #define SCAN_OWNER_STATUS 0x1;
1264 #define MEASURE_OWNER_STATUS 0x2;
1265
1266 #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
1267 /*
1268 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1269 */
1270 struct iwl3945_scanresults_notification {
1271 u8 channel;
1272 u8 band;
1273 u8 reserved[2];
1274 __le32 tsf_low;
1275 __le32 tsf_high;
1276 __le32 statistics[NUMBER_OF_STATISTICS];
1277 } __attribute__ ((packed));
1278
1279 /*
1280 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1281 */
1282 struct iwl3945_scancomplete_notification {
1283 u8 scanned_channels;
1284 u8 status;
1285 u8 reserved;
1286 u8 last_channel;
1287 __le32 tsf_low;
1288 __le32 tsf_high;
1289 } __attribute__ ((packed));
1290
1291
1292 /******************************************************************************
1293 * (9)
1294 * IBSS/AP Commands and Notifications:
1295 *
1296 *****************************************************************************/
1297
1298 /*
1299 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1300 */
1301 struct iwl3945_beacon_notif {
1302 struct iwl3945_tx_resp beacon_notify_hdr;
1303 __le32 low_tsf;
1304 __le32 high_tsf;
1305 __le32 ibss_mgr_status;
1306 } __attribute__ ((packed));
1307
1308 /*
1309 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1310 */
1311 struct iwl3945_tx_beacon_cmd {
1312 struct iwl3945_tx_cmd tx;
1313 __le16 tim_idx;
1314 u8 tim_size;
1315 u8 reserved1;
1316 struct ieee80211_hdr frame[0]; /* beacon frame */
1317 } __attribute__ ((packed));
1318
1319 /******************************************************************************
1320 * (10)
1321 * Statistics Commands and Notifications:
1322 *
1323 *****************************************************************************/
1324
1325 #define IWL_TEMP_CONVERT 260
1326
1327 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
1328 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
1329 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
1330
1331 /* Used for passing to driver number of successes and failures per rate */
1332 struct rate_histogram {
1333 union {
1334 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
1335 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
1336 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
1337 } success;
1338 union {
1339 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
1340 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
1341 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
1342 } failed;
1343 } __attribute__ ((packed));
1344
1345 /* statistics command response */
1346
1347 struct statistics_rx_phy {
1348 __le32 ina_cnt;
1349 __le32 fina_cnt;
1350 __le32 plcp_err;
1351 __le32 crc32_err;
1352 __le32 overrun_err;
1353 __le32 early_overrun_err;
1354 __le32 crc32_good;
1355 __le32 false_alarm_cnt;
1356 __le32 fina_sync_err_cnt;
1357 __le32 sfd_timeout;
1358 __le32 fina_timeout;
1359 __le32 unresponded_rts;
1360 __le32 rxe_frame_limit_overrun;
1361 __le32 sent_ack_cnt;
1362 __le32 sent_cts_cnt;
1363 } __attribute__ ((packed));
1364
1365 struct statistics_rx_non_phy {
1366 __le32 bogus_cts; /* CTS received when not expecting CTS */
1367 __le32 bogus_ack; /* ACK received when not expecting ACK */
1368 __le32 non_bssid_frames; /* number of frames with BSSID that
1369 * doesn't belong to the STA BSSID */
1370 __le32 filtered_frames; /* count frames that were dumped in the
1371 * filtering process */
1372 __le32 non_channel_beacons; /* beacons with our bss id but not on
1373 * our serving channel */
1374 } __attribute__ ((packed));
1375
1376 struct statistics_rx {
1377 struct statistics_rx_phy ofdm;
1378 struct statistics_rx_phy cck;
1379 struct statistics_rx_non_phy general;
1380 } __attribute__ ((packed));
1381
1382 struct statistics_tx {
1383 __le32 preamble_cnt;
1384 __le32 rx_detected_cnt;
1385 __le32 bt_prio_defer_cnt;
1386 __le32 bt_prio_kill_cnt;
1387 __le32 few_bytes_cnt;
1388 __le32 cts_timeout;
1389 __le32 ack_timeout;
1390 __le32 expected_ack_cnt;
1391 __le32 actual_ack_cnt;
1392 } __attribute__ ((packed));
1393
1394 struct statistics_dbg {
1395 __le32 burst_check;
1396 __le32 burst_count;
1397 __le32 reserved[4];
1398 } __attribute__ ((packed));
1399
1400 struct statistics_div {
1401 __le32 tx_on_a;
1402 __le32 tx_on_b;
1403 __le32 exec_time;
1404 __le32 probe_time;
1405 } __attribute__ ((packed));
1406
1407 struct statistics_general {
1408 __le32 temperature;
1409 struct statistics_dbg dbg;
1410 __le32 sleep_time;
1411 __le32 slots_out;
1412 __le32 slots_idle;
1413 __le32 ttl_timestamp;
1414 struct statistics_div div;
1415 } __attribute__ ((packed));
1416
1417 /*
1418 * REPLY_STATISTICS_CMD = 0x9c,
1419 * 3945 and 4965 identical.
1420 *
1421 * This command triggers an immediate response containing uCode statistics.
1422 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
1423 *
1424 * If the CLEAR_STATS configuration flag is set, uCode will clear its
1425 * internal copy of the statistics (counters) after issuing the response.
1426 * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
1427 *
1428 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
1429 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
1430 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
1431 */
1432 #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
1433 #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
1434 struct iwl3945_statistics_cmd {
1435 __le32 configuration_flags; /* IWL_STATS_CONF_* */
1436 } __attribute__ ((packed));
1437
1438 /*
1439 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
1440 *
1441 * By default, uCode issues this notification after receiving a beacon
1442 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
1443 * REPLY_STATISTICS_CMD 0x9c, above.
1444 *
1445 * Statistics counters continue to increment beacon after beacon, but are
1446 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
1447 * 0x9c with CLEAR_STATS bit set (see above).
1448 *
1449 * uCode also issues this notification during scans. uCode clears statistics
1450 * appropriately so that each notification contains statistics for only the
1451 * one channel that has just been scanned.
1452 */
1453 #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
1454 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
1455 struct iwl3945_notif_statistics {
1456 __le32 flag;
1457 struct statistics_rx rx;
1458 struct statistics_tx tx;
1459 struct statistics_general general;
1460 } __attribute__ ((packed));
1461
1462
1463 /*
1464 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
1465 */
1466 /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
1467 * then this notification will be sent. */
1468 #define CONSECUTIVE_MISSED_BCONS_TH 20
1469
1470 struct iwl3945_missed_beacon_notif {
1471 __le32 consequtive_missed_beacons;
1472 __le32 total_missed_becons;
1473 __le32 num_expected_beacons;
1474 __le32 num_recvd_beacons;
1475 } __attribute__ ((packed));
1476
1477 /******************************************************************************
1478 * (11)
1479 * Rx Calibration Commands:
1480 *
1481 *****************************************************************************/
1482
1483 #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1484 #define HD_TABLE_SIZE (11)
1485
1486 struct iwl3945_sensitivity_cmd {
1487 __le16 control;
1488 __le16 table[HD_TABLE_SIZE];
1489 } __attribute__ ((packed));
1490
1491 struct iwl3945_calibration_cmd {
1492 u8 opCode;
1493 u8 flags;
1494 __le16 reserved;
1495 s8 diff_gain_a;
1496 s8 diff_gain_b;
1497 s8 diff_gain_c;
1498 u8 reserved1;
1499 } __attribute__ ((packed));
1500
1501 /******************************************************************************
1502 * (12)
1503 * Miscellaneous Commands:
1504 *
1505 *****************************************************************************/
1506
1507 /*
1508 * LEDs Command & Response
1509 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
1510 *
1511 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
1512 * this command turns it on or off, or sets up a periodic blinking cycle.
1513 */
1514 struct iwl3945_led_cmd {
1515 __le32 interval; /* "interval" in uSec */
1516 u8 id; /* 1: Activity, 2: Link, 3: Tech */
1517 u8 off; /* # intervals off while blinking;
1518 * "0", with >0 "on" value, turns LED on */
1519 u8 on; /* # intervals on while blinking;
1520 * "0", regardless of "off", turns LED off */
1521 u8 reserved;
1522 } __attribute__ ((packed));
1523
1524 /******************************************************************************
1525 * (13)
1526 * Union of all expected notifications/responses:
1527 *
1528 *****************************************************************************/
1529
1530 struct iwl3945_rx_packet {
1531 __le32 len;
1532 struct iwl3945_cmd_header hdr;
1533 union {
1534 struct iwl3945_alive_resp alive_frame;
1535 struct iwl3945_rx_frame rx_frame;
1536 struct iwl3945_tx_resp tx_resp;
1537 struct iwl3945_spectrum_notification spectrum_notif;
1538 struct iwl3945_csa_notification csa_notif;
1539 struct iwl3945_error_resp err_resp;
1540 struct iwl3945_card_state_notif card_state_notif;
1541 struct iwl3945_beacon_notif beacon_status;
1542 struct iwl3945_add_sta_resp add_sta;
1543 struct iwl3945_sleep_notification sleep_notif;
1544 struct iwl3945_spectrum_resp spectrum;
1545 struct iwl3945_notif_statistics stats;
1546 __le32 status;
1547 u8 raw[0];
1548 } u;
1549 } __attribute__ ((packed));
1550
1551 #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1552
1553 #endif /* __iwl3945_3945_commands_h__ */
This page took 0.066979 seconds and 6 git commands to generate.