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