4 /**** (legal) claimer in README
5 ** Copyright (C) 2003 ACX100 Open Source Project
7 #include <linux/version.h>
8 #include "acx_firmware.h"
9 #include "acx_commands.h"
11 /***********************************************************************
12 ** Forward declarations of types
14 typedef struct tx tx_t
;
15 typedef struct acx_device acx_device_t
;
16 typedef struct client client_t
;
17 typedef struct rxdesc rxdesc_t
;
18 typedef struct txdesc txdesc_t
;
19 typedef struct rxhostdesc rxhostdesc_t
;
20 typedef struct txhostdesc txhostdesc_t
;
23 /***********************************************************************
24 ** Debug / log functionality
27 L_LOCK
= (ACX_DEBUG
>1)*0x0001, /* locking debug log */
28 L_INIT
= (ACX_DEBUG
>0)*0x0002, /* special card initialization logging */
29 L_IRQ
= (ACX_DEBUG
>0)*0x0004, /* interrupt stuff */
30 L_ASSOC
= (ACX_DEBUG
>0)*0x0008, /* assocation (network join) and station log */
31 L_FUNC
= (ACX_DEBUG
>1)*0x0020, /* logging of function enter / leave */
32 L_XFER
= (ACX_DEBUG
>1)*0x0080, /* logging of transfers and mgmt */
33 L_DATA
= (ACX_DEBUG
>1)*0x0100, /* logging of transfer data */
34 L_DEBUG
= (ACX_DEBUG
>1)*0x0200, /* log of debug info */
35 L_IOCTL
= (ACX_DEBUG
>0)*0x0400, /* log ioctl calls */
36 L_CTL
= (ACX_DEBUG
>1)*0x0800, /* log of low-level ctl commands */
37 L_BUFR
= (ACX_DEBUG
>1)*0x1000, /* debug rx buffer mgmt (ring buffer etc.) */
38 L_XFER_BEACON
= (ACX_DEBUG
>1)*0x2000, /* also log beacon packets */
39 L_BUFT
= (ACX_DEBUG
>1)*0x4000, /* debug tx buffer mgmt (ring buffer etc.) */
40 L_USBRXTX
= (ACX_DEBUG
>0)*0x8000, /* debug USB rx/tx operations */
41 L_BUF
= L_BUFR
+ L_BUFT
,
46 extern unsigned int acx_debug
;
48 enum { acx_debug
= 0 };
52 /***********************************************************************
55 #define ACX_PACKED __attribute__ ((packed))
57 /***********************************************************************
63 /* The supported chip models */
64 #define CHIPTYPE_ACX100 1
65 #define CHIPTYPE_ACX111 2
67 #define IS_ACX100(adev) ((adev)->chip_type == CHIPTYPE_ACX100)
68 #define IS_ACX111(adev) ((adev)->chip_type == CHIPTYPE_ACX111)
70 /* Supported interfaces */
74 #if !(defined(CONFIG_ACX_MAC80211_PCI) || defined(CONFIG_ACX_MAC80211_USB))
75 #error Driver must include PCI and/or USB support. You selected neither.
78 #if defined(CONFIG_ACX_MAC80211_PCI)
79 #if !defined(CONFIG_ACX_MAC80211_USB)
80 #define IS_PCI(adev) 1
82 #define IS_PCI(adev) ((adev)->dev_type == DEVTYPE_PCI)
85 #define IS_PCI(adev) 0
88 #if defined(CONFIG_ACX_MAC80211_USB)
89 #if !defined(CONFIG_ACX_MAC80211_PCI)
90 #define IS_USB(adev) 1
92 #define IS_USB(adev) ((adev)->dev_type == DEVTYPE_USB)
95 #define IS_USB(adev) 0
99 #define DEFAULT_DTIM_INTERVAL 10
100 /* used to be 2048, but FreeBSD driver changed it to 4096 to work properly
102 #define DEFAULT_MSDU_LIFETIME 4096
103 #define DEFAULT_RTS_THRESHOLD 2312 /* max. size: disable RTS mechanism */
104 #define DEFAULT_BEACON_INTERVAL 100
106 #define ACX100_BAP_DATALEN_MAX 4096
107 #define ACX100_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
108 #define ACX100_RIDDATA_MAXLEN ACX100_RID_GUESSING_MAXLEN
110 /* Support Constants */
111 /* Radio type names, found in Win98 driver's TIACXLN.INF */
112 #define RADIO_MAXIM_0D 0x0d
113 #define RADIO_RFMD_11 0x11
114 #define RADIO_RALINK_15 0x15
115 /* used in ACX111 cards (WG311v2, WL-121, ...): */
116 #define RADIO_RADIA_16 0x16
117 /* most likely *sometimes* used in ACX111 cards: */
118 #define RADIO_UNKNOWN_17 0x17
119 /* FwRad19.bin was found in a Safecom driver; must be an ACX111 radio: */
120 #define RADIO_UNKNOWN_19 0x19
121 #define RADIO_UNKNOWN_1B 0x1b /* radio in SafeCom SWLUT-54125 USB adapter; entirely unknown!! */
124 /* 'After Interrupt' Commands */
125 #define ACX_AFTER_IRQ_CMD_STOP_SCAN 0x01
126 #define ACX_AFTER_IRQ_CMD_ASSOCIATE 0x02
127 #define ACX_AFTER_IRQ_CMD_RADIO_RECALIB 0x04
128 #define ACX_AFTER_IRQ_UPDATE_CARD_CFG 0x08
129 #define ACX_AFTER_IRQ_TX_CLEANUP 0x10
130 #define ACX_AFTER_IRQ_COMPLETE_SCAN 0x20
131 #define ACX_AFTER_IRQ_RESTART_SCAN 0x40
133 /***********************************************************************
134 ** Tx/Rx buffer sizes and watermarks
136 ** This will alloc and use DMAable buffers of
137 ** WLAN_A4FR_MAXLEN_WEP_FCS * (RX_CNT + TX_CNT) bytes
138 ** RX/TX_CNT=32 -> ~150k DMA buffers
139 ** RX/TX_CNT=16 -> ~75k DMA buffers
141 ** 2005-10-10: reduced memory usage by lowering both to 16
146 /* we clean up txdescs when we have N free txdesc: */
147 #define TX_CLEAN_BACKLOG (TX_CNT/4)
148 #define TX_START_CLEAN (TX_CNT - TX_CLEAN_BACKLOG)
149 #define TX_EMERG_CLEAN 2
150 /* we stop queue if we have < N free txbufs: */
151 #define TX_STOP_QUEUE 3
152 /* we start queue if we have >= N free txbufs: */
153 #define TX_START_QUEUE 5
156 /***********************************************************************
157 **Information Frames Structures
160 /* Used in beacon frames and the like */
161 #define DOT11RATEBYTE_1 (1*2)
162 #define DOT11RATEBYTE_2 (2*2)
163 #define DOT11RATEBYTE_5_5 (5*2+1)
164 #define DOT11RATEBYTE_11 (11*2)
165 #define DOT11RATEBYTE_22 (22*2)
166 #define DOT11RATEBYTE_6_G (6*2)
167 #define DOT11RATEBYTE_9_G (9*2)
168 #define DOT11RATEBYTE_12_G (12*2)
169 #define DOT11RATEBYTE_18_G (18*2)
170 #define DOT11RATEBYTE_24_G (24*2)
171 #define DOT11RATEBYTE_36_G (36*2)
172 #define DOT11RATEBYTE_48_G (48*2)
173 #define DOT11RATEBYTE_54_G (54*2)
174 #define DOT11RATEBYTE_BASIC 0x80 /* flags rates included in basic rate set */
178 /***********************************************************************
179 ** Hardware structures
182 /* An opaque typesafe helper type
184 * Some hardware fields are actually pointers,
185 * but they have to remain u32, since using ptr instead
186 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
187 * format the acx firmware expects in the non-user area.
188 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
189 * enforce that pointed to data remains in low memory
190 * (address value needs to fit in 4 bytes) on 64bit systems.
192 * This is easy to get wrong, thus we are using a small struct
193 * and special macros to access it. Macros will check for
194 * attempts to overflow an acx_ptr with value > 0xffffffff.
196 * Attempts to use acx_ptr without macros result in compile-time errors */
200 } __attribute__ ((packed
)) acx_ptr
;
203 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
205 #define CHECK32(n) ((void)0)
208 /* acx_ptr <-> integer conversion */
209 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
210 #define acx2cpu(a) (le32_to_cpu(a.v))
212 /* acx_ptr <-> pointer conversion */
213 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
214 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
216 /* Values for rate field (acx100 only) */
220 #define RATE100_11 110
221 #define RATE100_22 220
222 /* This bit denotes use of PBCC:
223 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
224 #define RATE100_PBCC511 0x80
226 /* Bit values for rate111 field */
227 #define RATE111_1 0x0001 /* DBPSK */
228 #define RATE111_2 0x0002 /* DQPSK */
229 #define RATE111_5 0x0004 /* CCK or PBCC */
230 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
231 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
232 #define RATE111_11 0x0020 /* CCK or PBCC */
233 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
234 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
235 #define RATE111_22 0x0100 /* PBCC */
236 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
237 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
238 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
239 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
240 #define RATE111_RESERVED 0x2000
241 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
242 #define RATE111_SHORTPRE 0x8000 /* short preamble */
243 /* Special 'try everything' value */
244 #define RATE111_ALL 0x1fff
245 /* These bits denote acx100 compatible settings */
246 #define RATE111_ACX100_COMPAT 0x0127
247 /* These bits denote 802.11b compatible settings */
248 #define RATE111_80211B_COMPAT 0x0027
250 /* Descriptor Ctl field bits
251 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
253 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
254 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
255 #define DESC_CTL_AUTODMA 0x04
256 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
257 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
258 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
259 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
260 #define DESC_CTL_HOSTOWN 0x80
261 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
263 /* Descriptor Status field
265 #define DESC_STATUS_FULL (1 << 31)
267 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
268 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
269 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
270 #define DESC_CTL2_MORE_FRAG 0x04
271 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
272 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
273 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
274 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
275 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
277 /***********************************************************************
281 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
282 ** of txdesc and rxdesc: */
284 acx_ptr pNextDesc
; /* pointer to next txdesc */
285 acx_ptr HostMemPtr
; /* 0x04 */
286 acx_ptr AcxMemPtr
; /* 0x08 */
287 u32 tx_time
; /* 0x0c */
288 u16 total_length
; /* 0x10 */
289 u16 Reserved
; /* 0x12 */
291 /* The following 16 bytes do not change when acx100 owns the descriptor */
292 /* BUG: fw clears last byte of this area which is supposedly reserved
293 ** for driver use. amd64 blew up. We dare not use it now */
296 u8 Ctl_8
; /* 0x24, 8bit value */
297 u8 Ctl2_8
; /* 0x25, 8bit value */
299 u8 ack_failures
; /* 0x27 */
300 u8 rts_failures
; /* 0x28 */
301 u8 rts_ok
; /* 0x29 */
305 u8 queue_ctrl
; /* 0x2b */
306 } __attribute__ ((packed
)) r1
;
308 u16 rate111
; /* 0x2a */
309 } __attribute__ ((packed
)) r2
;
310 } __attribute__ ((packed
)) u
;
311 u32 queue_info
; /* 0x2c (acx100, reserved on acx111) */
312 } __attribute__ ((packed
)); /* size : 48 = 0x30 */
313 /* NB: acx111 txdesc structure is 4 byte larger */
314 /* All these 4 extra bytes are reserved. tx alloc code takes them into account */
317 acx_ptr pNextDesc
; /* 0x00 */
318 acx_ptr HostMemPtr
; /* 0x04 */
319 acx_ptr ACXMemPtr
; /* 0x08 */
320 u32 rx_time
; /* 0x0c */
321 u16 total_length
; /* 0x10 */
322 u16 WEP_length
; /* 0x12 */
323 u32 WEP_ofs
; /* 0x14 */
325 /* the following 16 bytes do not change when acx100 owns the descriptor */
326 u8 driverWorkspace
[16]; /* 0x18 */
331 u8 SNR
; /* Signal-to-Noise Ratio */
336 } __attribute__ ((packed
)); /* size 52 = 0x34 */
338 /***********************************************************************
341 ** This is the format of rx data returned by acx
344 /* I've hoped it's a 802.11 PHY header, but no...
345 * so far, I've seen on acx111:
346 * 0000 3a00 0000 0000 IBSS Beacons
347 * 0000 3c00 0000 0000 ESS Beacons
348 * 0000 2700 0000 0000 Probe requests
351 typedef struct phy_hdr
{
353 u8 acx111_unknown
[4];
354 } ACX_PACKED phy_hdr_t
;
356 /* seems to be a bit similar to hfa384x_rx_frame.
357 * These fields are still not quite obvious, though.
358 * Some seem to have different meanings... */
360 #define RXBUF_HDRSIZE 12
361 #define RXBUF_BYTES_RCVD(adev, rxbuf) \
362 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) - (adev)->phy_header_len)
363 #define RXBUF_BYTES_USED(rxbuf) \
364 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) + RXBUF_HDRSIZE)
366 #define RXBUF_IS_TXSTAT(rxbuf) (le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0x8000)
369 12 bits: length of frame from control field to first byte of FCS
371 1 bit: 1 = it's a tx status info, not a rx packet (USB only)
374 6 bits: number of memory block used to store frame in adapter memory
375 1 bit: Traffic Indicator bit in TIM of received Beacon was set
377 mac_status: 1 byte (bitmap):
380 5 BDCST Address 1 field is a broadcast
381 4 VBM received beacon frame has more than one set bit (?!)
382 3 TIM Set bit representing this station is set in TIM of received beacon
383 2 GROUP Address 1 is a multicast
384 1 ADDR1 Address 1 matches our MAC
387 phy_stat_baseband: 1 byte (bitmap):
388 7 Preamble frame had a long preamble
389 6 PLCP Error CRC16 error in PLCP header
390 5 Unsup_Mod unsupported modulation
391 4 Selected Antenna antenna 1 was used to receive this frame
392 3 PBCC/CCK frame used: 1=PBCC, 0=CCK modulation
393 2 OFDM frame used OFDM modulation
394 1 TI Protection protection frame was detected
397 phy_plcp_signal: 1 byte:
398 Receive PLCP Signal field from the Baseband Processor
401 receive AGC gain level (can be used to measure receive signal strength)
404 estimated noise power of equalized receive signal
405 at input of FEC decoder (can be used to measure receive signal quality)
408 timestamp sampled from either the Access Manager TSF counter
409 or free-running microsecond counter when the MAC receives
410 first byte of PLCP header.
413 typedef struct rxbuffer
{
414 u16 mac_cnt_rcvd
; /* only 12 bits are len! (0xfff) */
417 u8 phy_stat_baseband
; /* bit 0x80: used LNA (Low-Noise Amplifier) */
419 u8 phy_level
; /* PHY stat */
420 u8 phy_snr
; /* PHY stat */
421 u32 time
; /* timestamp upon MAC rcv first byte */
422 /* 4-byte (acx100) or 8-byte (acx111) phy header will be here
423 ** if RX_CFG1_INCLUDE_PHY_HDR is in effect:
425 struct ieee80211_hdr hdr_a3
;
426 /* maximally sized data part of wlan packet */
427 u8 data_a3
[30 + 2312 + 4 - 24]; /*WLAN_A4FR_MAXLEN_WEP_FCS - WLAN_HDR_A3_LEN]*/
428 /* can add hdr/data_a4 if needed */
429 } ACX_PACKED rxbuffer_t
;
432 /*--- Firmware statistics ----------------------------------------------------*/
434 /* define a random 100 bytes more to catch firmware versions which
435 * provide a bigger struct */
436 #define FW_STATS_FUTURE_EXTENSION 100
437 #define FW_ID_SIZE 20
440 /*--- WEP stuff --------------------------------------------------------------*/
441 #define DOT11_MAX_DEFAULT_WEP_KEYS 4
443 /* non-firmware struct, no packing necessary */
444 typedef struct wep_key
{
445 size_t size
; /* most often used member first */
449 } wep_key_t
; /* size = 264 bytes (33*8) */
450 /* FIXME: We don't have size 264! Or is there 2 bytes beyond the key
451 * (strange_filler)? */
453 /* non-firmware struct, no packing necessary */
454 typedef struct key_struct
{
455 u8 addr
[ETH_ALEN
]; /* 0x00 */
456 u16 filler1
; /* 0x06 */
457 u32 filler2
; /* 0x08 */
458 u32 index
; /* 0x0c */
460 u8 key
[29]; /* 0x12; is this long enough??? */
461 } key_struct_t
; /* size = 276. FIXME: where is the remaining space?? */
464 /*--- Client (peer) info -----------------------------------------------------*/
465 /* adev->sta_list[] is used for:
466 ** accumulating and processing of scan results
467 ** keeping client info in AP mode
468 ** keeping AP info in STA mode (AP is the only one 'client')
469 ** keeping peer info in ad-hoc mode
470 ** non-firmware struct --> no packing necessary */
472 CLIENT_EMPTY_SLOT_0
= 0,
474 CLIENT_AUTHENTICATED_2
= 2,
475 CLIENT_ASSOCIATED_3
= 3,
476 CLIENT_JOIN_CANDIDATE
= 4
479 /* most frequent access first */
480 u8 used
; /* misnamed, more like 'status' */
482 unsigned long mtime
; /* last time we heard it, in jiffies */
483 size_t essid_len
; /* length of ESSID (without '\0') */
484 u32 sir
; /* Standard IR */
485 u32 snr
; /* Signal to Noise Ratio */
486 u16 aid
; /* association ID */
487 u16 seq
; /* from client's auth req */
488 u16 auth_alg
; /* from client's auth req */
489 u16 cap_info
; /* from client's assoc req */
490 u16 rate_cap
; /* what client supports (all rates) */
491 u16 rate_bas
; /* what client supports (basic rates) */
492 u16 rate_cfg
; /* what is allowed (by iwconfig etc) */
493 u16 rate_cur
; /* currently used rate mask */
494 u8 rate_100
; /* currently used rate byte (acx100 only) */
495 u8 address
[ETH_ALEN
];
496 u8 bssid
[ETH_ALEN
]; /* ad-hoc hosts can have bssid != mac */
502 char essid
[IW_ESSID_MAX_SIZE
+ 1]; /* ESSID and trailing '\0' */
503 /* FIXME: this one is too damn big */
504 char challenge_text
[128]; /*WLAN_CHALLENGE_LEN*/
509 /* Config Option structs */
511 typedef struct co_antennas
{
515 } __attribute__ ((packed
)) co_antennas_t
;
517 typedef struct co_powerlevels
{
521 } __attribute__ ((packed
)) co_powerlevels_t
;
523 typedef struct co_datarates
{
527 } __attribute__ ((packed
)) co_datarates_t
;
529 typedef struct co_domains
{
533 } __attribute__ ((packed
)) co_domains_t
;
535 typedef struct co_product_id
{
539 } __attribute__ ((packed
)) co_product_id_t
;
541 typedef struct co_manuf_id
{
545 } __attribute__ ((packed
)) co_manuf_t
;
547 typedef struct co_fixed
{
549 /* u16 NVS_vendor_offs; ACX111-only */
550 /* u16 unknown; ACX111-only */
551 u8 MAC
[6]; /* ACX100-only */
552 u16 probe_delay
; /* ACX100-only */
556 u8 dot11ShortPreambleOption
;
558 u8 dot11ChannelAgility
;
559 u8 dot11PhyType
; /* FIXME: does 802.11 call it "dot11PHYType"? */
562 } __attribute__ ((packed
)) co_fixed_t
;
564 typedef struct acx111_ie_configoption
{
567 /* Do not access below members directly, they are in fact variable length */
569 co_antennas_t antennas
;
570 co_powerlevels_t power_levels
;
571 co_datarates_t data_rates
;
572 co_domains_t domains
;
573 co_product_id_t product_id
;
574 co_manuf_t manufacturer
;
576 } __attribute__ ((packed
)) acx111_ie_configoption_t
;
578 /***********************************************************************
579 ** Hardware structures
582 /* An opaque typesafe helper type
584 * Some hardware fields are actually pointers,
585 * but they have to remain u32, since using ptr instead
586 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
587 * format the acx firmware expects in the non-user area.
588 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
589 * enforce that pointed to data remains in low memory
590 * (address value needs to fit in 4 bytes) on 64bit systems.
592 * This is easy to get wrong, thus we are using a small struct
593 * and special macros to access it. Macros will check for
594 * attempts to overflow an acx_ptr with value > 0xffffffff.
596 * Attempts to use acx_ptr without macros result in compile-time errors */
599 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
601 #define CHECK32(n) ((void)0)
604 /* acx_ptr <-> integer conversion */
605 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
606 #define acx2cpu(a) (le32_to_cpu(a.v))
608 /* acx_ptr <-> pointer conversion */
609 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
610 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
612 /* Values for rate field (acx100 only) */
616 #define RATE100_11 110
617 #define RATE100_22 220
618 /* This bit denotes use of PBCC:
619 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
620 #define RATE100_PBCC511 0x80
622 /* Bit values for rate111 field */
623 #define RATE111_1 0x0001 /* DBPSK */
624 #define RATE111_2 0x0002 /* DQPSK */
625 #define RATE111_5 0x0004 /* CCK or PBCC */
626 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
627 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
628 #define RATE111_11 0x0020 /* CCK or PBCC */
629 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
630 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
631 #define RATE111_22 0x0100 /* PBCC */
632 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
633 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
634 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
635 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
636 #define RATE111_RESERVED 0x2000
637 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
638 #define RATE111_SHORTPRE 0x8000 /* short preamble */
639 /* Special 'try everything' value */
640 #define RATE111_ALL 0x1fff
641 /* These bits denote acx100 compatible settings */
642 #define RATE111_ACX100_COMPAT 0x0127
643 /* These bits denote 802.11b compatible settings */
644 #define RATE111_80211B_COMPAT 0x0027
646 /* Descriptor Ctl field bits
647 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
649 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
650 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
651 #define DESC_CTL_AUTODMA 0x04
652 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
653 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
654 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
655 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
656 #define DESC_CTL_HOSTOWN 0x80
657 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
659 /* Descriptor Status field
661 #define DESC_STATUS_FULL (1 << 31)
663 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
664 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
665 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
666 #define DESC_CTL2_MORE_FRAG 0x04
667 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
668 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
669 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
670 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
671 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
673 /***********************************************************************
677 ** (outside of "#ifdef PCI" because USB (mis)uses HOST_INT_SCAN_COMPLETE) */
678 #define HOST_INT_RX_DATA 0x0001
679 #define HOST_INT_TX_COMPLETE 0x0002
680 #define HOST_INT_TX_XFER 0x0004
681 #define HOST_INT_RX_COMPLETE 0x0008
682 #define HOST_INT_DTIM 0x0010
683 #define HOST_INT_BEACON 0x0020
684 #define HOST_INT_TIMER 0x0040
685 #define HOST_INT_KEY_NOT_FOUND 0x0080
686 #define HOST_INT_IV_ICV_FAILURE 0x0100
687 #define HOST_INT_CMD_COMPLETE 0x0200
688 #define HOST_INT_INFO 0x0400
689 #define HOST_INT_OVERFLOW 0x0800
690 #define HOST_INT_PROCESS_ERROR 0x1000
691 #define HOST_INT_SCAN_COMPLETE 0x2000
692 #define HOST_INT_FCS_THRESHOLD 0x4000
693 #define HOST_INT_UNKNOWN 0x8000
695 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
696 ** of txdesc and rxdesc: */
697 #ifdef ACX_MAC80211_PCI
699 /* Register I/O offsets */
700 #define ACX100_EEPROM_ID_OFFSET 0x380
702 /* please add further ACX hardware register definitions only when
703 it turns out you need them in the driver, and please try to use
704 firmware functionality instead, since using direct I/O access instead
705 of letting the firmware do it might confuse the firmware's state
708 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
709 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
712 * NOTE about IO_ACX_IRQ_REASON: this register is CLEARED ON READ.
715 IO_ACX_SOFT_RESET
= 0,
722 IO_ACX_FEMR
, /* Function Event Mask */
726 IO_ACX_IRQ_STATUS_NON_DES
,
746 IO_ACX_CMD_MAILBOX_OFFS
,
747 IO_ACX_INFO_MAILBOX_OFFS
,
748 IO_ACX_EEPROM_INFORMATION
,
754 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
755 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
757 /* Values for IO_ACX_INT_TRIG register: */
758 /* inform hw that rxdesc in queue needs processing */
759 #define INT_TRIG_RXPRC 0x08
760 /* inform hw that txdesc in queue needs processing */
761 #define INT_TRIG_TXPRC 0x04
762 /* ack that we received info from info mailbox */
763 #define INT_TRIG_INFOACK 0x02
764 /* inform hw that we have filled command mailbox */
765 #define INT_TRIG_CMD 0x01
768 acx_ptr data_phy
; /* 0x00 [u8 *] */
769 u16 data_offset
; /* 0x04 */
770 u16 reserved
; /* 0x06 */
771 u16 Ctl_16
; /* 16bit value, endianness!! */
772 u16 length
; /* 0x0a */
773 acx_ptr desc_phy_next
; /* 0x0c [txhostdesc *] */
774 acx_ptr pNext
; /* 0x10 [txhostdesc *] */
775 u32 Status
; /* 0x14, unused on Tx */
776 /* From here on you can use this area as you want (variable length, too!) */
778 struct ieee80211_tx_status txstatus
;
784 acx_ptr data_phy
; /* 0x00 [rxbuffer_t *] */
785 u16 data_offset
; /* 0x04 */
786 u16 reserved
; /* 0x06 */
787 u16 Ctl_16
; /* 0x08; 16bit value, endianness!! */
788 u16 length
; /* 0x0a */
789 acx_ptr desc_phy_next
; /* 0x0c [rxhostdesc_t *] */
790 acx_ptr pNext
; /* 0x10 [rxhostdesc_t *] */
791 u32 Status
; /* 0x14 */
792 /* From here on you can use this area as you want (variable length, too!) */
799 /***********************************************************************
800 ** USB structures and constants
802 #ifdef ACX_MAC80211_USB
804 /* Used for usb_txbuffer.desc field */
805 #define USB_TXBUF_TXDESC 0xA
806 /* Size of header (everything up to data[]) */
807 #define USB_TXBUF_HDRSIZE 14
808 typedef struct usb_txbuffer
{
817 /* wlan packet content is placed here: */
818 u8 data
[30 + 2312 + 4]; /*WLAN_A4FR_MAXLEN_WEP_FCS]*/
819 } ACX_PACKED usb_txbuffer_t
;
821 /* USB returns either rx packets (see rxbuffer) or
822 ** these "tx status" structs: */
823 typedef struct usb_txstatus
{
824 u16 mac_cnt_rcvd
; /* only 12 bits are len! (0xfff) */
826 u8 mac_status
; /* seen 0x20 on tx failure */
832 // struct ieee80211_tx_status txstatus;
833 // struct sk_buff *skb;
834 } ACX_PACKED usb_txstatus_t
;
836 typedef struct usb_tx
{
840 /* actual USB bulk output data block is here: */
841 usb_txbuffer_t bulkout
;
844 struct usb_rx_plain
{
851 typedef struct usb_rx
{
856 /* Make entire structure 4k */
857 u8 padding
[4*1024 - sizeof(struct usb_rx_plain
)];
861 /***********************************************************************
862 ** Main acx per-device data structure
864 #define ACX_STATE_FW_LOADED 0x01
865 #define ACX_STATE_IFACE_UP 0x02
867 /* MAC mode (BSS type) defines
868 * Note that they shouldn't be redefined, since they are also used
869 * during communication with firmware */
870 #define ACX_MODE_0_ADHOC 0
871 #define ACX_MODE_1_UNUSED 1
872 #define ACX_MODE_2_STA 2
873 #define ACX_MODE_3_AP 3
874 /* These are our own inventions. Sending these to firmware
875 ** makes it stop emitting beacons, which is exactly what we want
876 ** for these modes */
877 #define ACX_MODE_MONITOR 0xfe
878 #define ACX_MODE_OFF 0xff
879 /* 'Submode': identifies exact status of ADHOC/STA host */
880 #define ACX_STATUS_0_STOPPED 0
881 #define ACX_STATUS_1_SCANNING 1
882 #define ACX_STATUS_2_WAIT_AUTH 2
883 #define ACX_STATUS_3_AUTHENTICATED 3
884 #define ACX_STATUS_4_ASSOCIATED 4
886 /* FIXME: this should be named something like struct acx_priv (typedef'd to
889 /* non-firmware struct, no packing necessary */
891 /* most frequent accesses first (dereferencing and cache line!) */
896 #if defined(PARANOID_LOCKING) /* Lock debugging */
897 const char *last_sem
;
898 const char *last_lock
;
899 unsigned long sem_time
;
900 unsigned long lock_time
;
903 /*** Linux network device ***/
904 //struct device *dev; /* pointer to linux netdevice */
906 /*** Device statistics ***/
907 struct ieee80211_low_level_stats ieee_stats
; /* wireless device statistics */
909 /*** Device statistics ***/
910 struct net_device_stats stats
; /* net device statistics */
913 // struct iw_statistics wstats; /* wireless statistics */
915 struct ieee80211_hw
*ieee
;
916 struct ieee80211_hw_mode modes
[2];
917 struct ieee80211_rx_status rx_status
;
919 struct ieee80211_vif
*vif
;
921 /*** Power managment ***/
922 struct pm_dev
*pm
; /* PM crap */
924 /*** Management timer ***/
925 struct timer_list mgmt_timer
;
927 /*** Hardware identification ***/
928 const char *chip_name
;
935 /*** Config retrieved from EEPROM ***/
937 u16 cfgopt_NVS_vendor_offs
;
939 u16 cfgopt_probe_delay
;
940 u32 cfgopt_eof_memory
;
941 u8 cfgopt_dot11CCAModes
;
942 u8 cfgopt_dot11Diversity
;
943 u8 cfgopt_dot11ShortPreambleOption
;
944 u8 cfgopt_dot11PBCCOption
;
945 u8 cfgopt_dot11ChannelAgility
;
946 u8 cfgopt_dot11PhyType
;
947 u8 cfgopt_dot11TempType
;
948 co_antennas_t cfgopt_antennas
;
949 co_powerlevels_t cfgopt_power_levels
;
950 co_datarates_t cfgopt_data_rates
;
951 co_domains_t cfgopt_domains
;
952 co_product_id_t cfgopt_product_id
;
953 co_manuf_t cfgopt_manufacturer
;
955 /*** Firmware identification ***/
956 char firmware_version
[FW_ID_SIZE
+1];
960 const u16
*ie_len_dot11
;
962 /*** Device state ***/
964 u8 led_power
; /* power LED status */
965 u32 get_mask
; /* mask of settings to fetch from the card */
966 u32 set_mask
; /* mask of settings to write to the card */
968 /* Barely used in USB case */
972 u8 after_interrupt_jobs
; /* mini job list for doing actions after an interrupt occurred */
973 struct work_struct after_interrupt_task
; /* our task for after interrupt actions */
978 u16 scan_count
; /* number of times to do channel scan */
979 u8 scan_mode
; /* 0 == active, 1 == passive, 2 == background */
982 u16 scan_probe_delay
;
983 #if WIRELESS_EXT > 15
984 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
987 /*** Virtual interface struct ***/
988 struct acx_interface interface
;
990 /*** Wireless network settings ***/
991 /* copy of the device address (ifconfig hw ether) that we actually use
992 ** for 802.11; copied over from the network device's MAC address
993 ** (ifconfig) when it makes sense only */
994 u8 dev_addr
[MAX_ADDR_LEN
];
995 u8 bssid
[ETH_ALEN
]; /* the BSSID after having joined */
996 u8 ap
[ETH_ALEN
]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
997 u16 aid
; /* The Association ID sent from the AP / last used AID if we're an AP */
998 u16 mode
; /* mode from iwconfig */
999 int monitor_type
; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
1000 u16 status
; /* 802.11 association status */
1001 u8 essid_active
; /* specific ESSID active, or select any? */
1002 u8 essid_len
; /* to avoid dozens of strlen() */
1003 /* INCLUDES \0 termination for easy printf - but many places
1004 ** simply want the string data memcpy'd plus a length indicator!
1005 ** Keep that in mind... */
1006 char essid
[IW_ESSID_MAX_SIZE
+1];
1007 /* essid we are going to use for association, in case of "essid 'any'"
1008 ** and in case of hidden ESSID (use configured ESSID then) */
1009 char essid_for_assoc
[IW_ESSID_MAX_SIZE
+1];
1010 char nick
[IW_ESSID_MAX_SIZE
+1]; /* see essid! */
1012 u8 reg_dom_id
; /* reg domain setting */
1013 u16 reg_dom_chanmask
;
1014 u16 auth_or_assoc_retries
;
1016 unsigned long scan_start
; /* YES, jiffies is defined as "unsigned long" */
1019 /* MAC80211 Template Reference */
1020 struct sk_buff
*beacon_cache
;
1021 /* stations known to us (if we're an ap) */
1022 // client_t sta_list[32]; /* tab is larger than list, so that */
1023 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
1024 // client_t *ap_client; /* this one is our AP (STA mode only) */
1028 unsigned long dup_msg_expiry
;
1029 u16 last_seq_ctrl
; /* duplicate packet detection */
1031 /* 802.11 power save mode */
1033 u8 ps_listen_interval
;
1035 u8 ps_hangover_period
;
1036 u32 ps_enhanced_transition_time
;
1037 u32 ps_beacon_rx_time
;
1039 /*** PHY settings ***/
1040 u8 fallback_threshold
;
1041 u8 stepup_threshold
;
1046 u8 rate_auto
; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
1047 u8 preamble_mode
; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
1052 /* u8 tx_level_val; */
1053 /* u8 tx_level_auto; whether to do automatic power adjustment */
1055 unsigned long recalib_time_last_success
;
1056 unsigned long recalib_time_last_attempt
;
1057 int recalib_failure_count
;
1058 int recalib_msg_ratelimit
;
1059 int retry_errors_msg_ratelimit
;
1061 unsigned long brange_time_last_state_change
; /* time the power LED was last changed */
1062 u8 brange_last_state
; /* last state of the LED */
1063 u8 brange_max_quality
; /* maximum quality that equates to full speed */
1066 u8 antenna
; /* antenna settings */
1067 u8 ed_threshold
; /* energy detect threshold */
1068 u8 cca
; /* clear channel assessment */
1075 u16 listen_interval
; /* given in units of beacon interval */
1076 u32 beacon_interval
;
1079 u8 rate_supported_len
;
1080 u8 rate_supported
[13];
1082 /*** Encryption settings (WEP) ***/
1083 u32 auth_alg
; /* used in transmit_authen1 */
1086 u8 wep_current_index
;
1087 wep_key_t wep_keys
[DOT11_MAX_DEFAULT_WEP_KEYS
]; /* the default WEP keys */
1089 key_struct_t wep_key_struct
[10];
1091 /*** Encryption Replacement for mac80211 ***/
1092 struct acx_key key
[54];
1093 u16 security_offset
;
1100 /*** Card Rx/Tx management ***/
1104 unsigned int tx_free
;
1105 unsigned int tx_head
; /* keep as close as possible to Tx stuff below (cache line) */
1108 /*************************************************************************
1109 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
1110 *************************************************************************/
1112 /* hack to let common code compile. FIXME */
1113 dma_addr_t rxhostdesc_startphy
;
1116 #ifdef ACX_MAC80211_PCI
1117 /* pointers to tx buffers, tx host descriptors (in host memory)
1118 ** and tx descs in device memory */
1119 unsigned int tx_tail
;
1121 txhostdesc_t
*txhostdesc_start
;
1122 txdesc_t
*txdesc_start
; /* points to PCI-mapped memory */
1123 dma_addr_t txbuf_startphy
;
1124 dma_addr_t txhostdesc_startphy
;
1125 /* sizes of above host memory areas */
1126 unsigned int txbuf_area_size
;
1127 unsigned int txhostdesc_area_size
;
1129 unsigned int txdesc_size
; /* size of txdesc; ACX111 = ACX100 + 4 */
1130 client_t
*txc
[TX_CNT
];
1134 unsigned int rx_tail
;
1135 rxbuffer_t
*rxbuf_start
;
1136 rxhostdesc_t
*rxhostdesc_start
;
1137 rxdesc_t
*rxdesc_start
;
1138 /* physical addresses of above host memory areas */
1139 dma_addr_t rxbuf_startphy
;
1140 /* dma_addr_t rxhostdesc_startphy; */
1141 unsigned int rxbuf_area_size
;
1142 unsigned int rxhostdesc_area_size
;
1145 u8 irqs_active
; /* whether irq sending is activated */
1147 const u16
*io
; /* points to ACX100 or ACX111 PCI I/O register address set */
1150 struct pci_dev
*pdev
;
1153 struct vlynq_device
*vdev
;
1155 struct device
*bus_dev
;
1156 unsigned long membase
;
1157 unsigned long membase2
;
1158 void __iomem
*iobase
;
1159 void __iomem
*iobase2
;
1160 /* command interface */
1161 u8 __iomem
*cmd_area
;
1162 u8 __iomem
*info_area
;
1164 u16 irq_mask
; /* interrupt types to mask out (not wanted) with many IRQs activated */
1165 u16 irq_mask_off
; /* interrupt types to mask out (not wanted) with IRQs off */
1166 unsigned int irq_loops_this_jiffy
;
1167 unsigned long irq_last_jiffies
;
1171 #ifdef ACX_MAC80211_USB
1172 struct usb_device
*usbdev
;
1174 rxbuffer_t rxtruncbuf
;
1179 int bulkinep
; /* bulk-in endpoint */
1180 int bulkoutep
; /* bulk-out endpoint */
1189 acx_device_t
* ieee2adev(struct ieee80211_hw
*hw
)
1195 /* For use with ACX1xx_REG_RXCONFIG */
1197 * 13 include additional header (length etc.) *required*
1198 * struct is defined in 'struct rxbuffer'
1199 * is this bit acx100 only? does acx111 always put the header,
1200 * and bit setting is irrelevant? --vda
1201 * 10 receive frames only with SSID used in last join cmd
1202 * 9 discard broadcast
1203 * 8 receive packets for multicast address 1
1204 * 7 receive packets for multicast address 0
1205 * 6 discard all multicast packets
1206 * 5 discard frames from foreign BSSID
1207 * 4 discard frames with foreign destination MAC address
1208 * 3 promiscuous mode (receive ALL frames, disable filter)
1210 * 1 include phy header
1213 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1214 #define RX_CFG1_FILTER_SSID 0x0400
1215 #define RX_CFG1_FILTER_BCAST 0x0200
1216 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1217 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1218 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1219 #define RX_CFG1_FILTER_BSSID 0x0020
1220 #define RX_CFG1_FILTER_MAC 0x0010
1221 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1222 #define RX_CFG1_INCLUDE_FCS 0x0004
1223 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1225 * 11 receive association requests etc.
1226 * 10 receive authentication frames
1227 * 9 receive beacon frames
1228 * 8 receive contention free packets
1229 * 7 receive control frames
1230 * 6 receive data frames
1231 * 5 receive broken frames
1232 * 4 receive management frames
1233 * 3 receive probe requests
1234 * 2 receive probe responses
1235 * 1 receive RTS/CTS/ACK frames
1238 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1239 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1240 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1241 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1242 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1243 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1244 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1245 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1246 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1247 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1248 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1249 #define RX_CFG2_RCV_OTHER 0x0001
1251 /* For use with ACX1xx_REG_FEATURE_CONFIG */
1252 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1253 #define FEATURE1_4X 0x00000020L
1254 #define FEATURE1_LOW_RX 0x00000008L
1255 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1257 #define FEATURE2_SNIFFER 0x00000080L
1258 #define FEATURE2_NO_TXCRYPT 0x00000001L
1260 /*-- get and set mask values --*/
1261 #define GETSET_LED_POWER 0x00000001L
1262 #define GETSET_STATION_ID 0x00000002L
1263 #define SET_TEMPLATES 0x00000004L
1264 #define SET_STA_LIST 0x00000008L
1265 #define GETSET_TX 0x00000010L
1266 #define GETSET_RX 0x00000020L
1267 #define SET_RXCONFIG 0x00000040L
1268 #define GETSET_ANTENNA 0x00000080L
1269 #define GETSET_SENSITIVITY 0x00000100L
1270 #define GETSET_TXPOWER 0x00000200L
1271 #define GETSET_ED_THRESH 0x00000400L
1272 #define GETSET_CCA 0x00000800L
1273 #define GETSET_POWER_80211 0x00001000L
1274 #define GETSET_RETRY 0x00002000L
1275 #define GETSET_REG_DOMAIN 0x00004000L
1276 #define GETSET_CHANNEL 0x00008000L
1277 /* Used when ESSID changes etc and we need to scan for AP anew */
1278 #define GETSET_RESCAN 0x00010000L
1279 #define GETSET_MODE 0x00020000L
1280 #define GETSET_WEP 0x00040000L
1281 #define SET_WEP_OPTIONS 0x00080000L
1282 #define SET_MSDU_LIFETIME 0x00100000L
1283 #define SET_RATE_FALLBACK 0x00200000L
1285 /* keep in sync with the above */
1286 #define GETSET_ALL (0 \
1287 /* GETSET_LED_POWER */ | 0x00000001L \
1288 /* GETSET_STATION_ID */ | 0x00000002L \
1289 /* SET_TEMPLATES */ | 0x00000004L \
1290 /* SET_STA_LIST */ | 0x00000008L \
1291 /* GETSET_TX */ | 0x00000010L \
1292 /* GETSET_RX */ | 0x00000020L \
1293 /* SET_RXCONFIG */ | 0x00000040L \
1294 /* GETSET_ANTENNA */ | 0x00000080L \
1295 /* GETSET_SENSITIVITY */| 0x00000100L \
1296 /* GETSET_TXPOWER */ | 0x00000200L \
1297 /* GETSET_ED_THRESH */ | 0x00000400L \
1298 /* GETSET_CCA */ | 0x00000800L \
1299 /* GETSET_POWER_80211 */| 0x00001000L \
1300 /* GETSET_RETRY */ | 0x00002000L \
1301 /* GETSET_REG_DOMAIN */ | 0x00004000L \
1302 /* GETSET_CHANNEL */ | 0x00008000L \
1303 /* GETSET_RESCAN */ | 0x00010000L \
1304 /* GETSET_MODE */ | 0x00020000L \
1305 /* GETSET_WEP */ | 0x00040000L \
1306 /* SET_WEP_OPTIONS */ | 0x00080000L \
1307 /* SET_MSDU_LIFETIME */ | 0x00100000L \
1308 /* SET_RATE_FALLBACK */ | 0x00200000L \
1311 /***********************************************************************
1313 typedef struct acx100_ie_memblocksize
{
1317 } ACX_PACKED acx100_ie_memblocksize_t
;
1319 typedef struct acx100_ie_queueconfig
{
1326 u8 NumRxDesc
; /* for USB only */
1329 u32 HostQueueEnd
; /* QueueEnd2 */
1334 } ACX_PACKED acx100_ie_queueconfig_t
;
1336 typedef struct acx111_ie_queueconfig
{
1339 u32 tx_memory_block_address
;
1340 u32 rx_memory_block_address
;
1341 u32 rx1_queue_address
;
1343 u32 tx1_queue_address
;
1347 } ACX_PACKED acx111_ie_queueconfig_t
;
1349 typedef struct acx100_ie_memconfigoption
{
1353 acx_ptr pRxHostDesc
;
1358 } ACX_PACKED acx100_ie_memconfigoption_t
;
1360 typedef struct acx111_ie_memoryconfig
{
1364 u16 memory_block_size
;
1365 u8 tx_rx_memory_block_allocation
;
1373 /* start of rx1 block */
1374 u8 rx_queue1_count_descs
;
1375 u8 rx_queue1_reserved1
;
1376 u8 rx_queue1_type
; /* must be set to 7 */
1377 u8 rx_queue1_prio
; /* must be set to 0 */
1378 acx_ptr rx_queue1_host_rx_start
;
1379 /* end of rx1 block */
1381 /* start of tx1 block */
1382 u8 tx_queue1_count_descs
;
1383 u8 tx_queue1_reserved1
;
1384 u8 tx_queue1_reserved2
;
1385 u8 tx_queue1_attributes
;
1386 /* end of tx1 block */
1387 } ACX_PACKED acx111_ie_memoryconfig_t
;
1389 typedef struct acx_ie_memmap
{
1396 u32 PacketTemplateStart
;
1397 u32 PacketTemplateEnd
;
1402 } ACX_PACKED acx_ie_memmap_t
;
1404 typedef struct acx111_ie_feature_config
{
1407 u32 feature_options
;
1408 u32 data_flow_options
;
1409 } ACX_PACKED acx111_ie_feature_config_t
;
1411 typedef struct acx111_ie_tx_level
{
1415 } ACX_PACKED acx111_ie_tx_level_t
;
1417 #define PS_CFG_ENABLE 0x80
1418 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1419 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1420 #define PS_CFG_WAKEUP_BY_HOST 0x03
1421 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1422 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1423 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1425 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1426 ** in the TIM; newer firmwares only(?) */
1427 #define PS_OPT_ENA_ENHANCED_PS 0x04
1428 #define PS_OPT_TX_PSPOLL 0x02 /* send PSPoll frame to fetch waiting frames from AP (on frame with matching AID) */
1429 #define PS_OPT_STILL_RCV_BCASTS 0x01
1431 typedef struct acx100_ie_powersave
{
1435 u8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
1437 u8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1438 u16 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
1439 } ACX_PACKED acx100_ie_powersave_t
;
1441 typedef struct acx111_ie_powersave
{
1445 u8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
1447 u8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1449 u32 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
1450 } ACX_PACKED acx111_ie_powersave_t
;
1453 /***********************************************************************
1454 ** Commands and template structures
1458 ** SCAN command structure
1460 ** even though acx100 scan rates match RATE100 constants,
1461 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1462 #define ACX_SCAN_RATE_1 10
1463 #define ACX_SCAN_RATE_2 20
1464 #define ACX_SCAN_RATE_5 55
1465 #define ACX_SCAN_RATE_11 110
1466 #define ACX_SCAN_RATE_22 220
1467 #define ACX_SCAN_RATE_PBCC 0x80 /* OR with this if needed */
1468 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1469 #define ACX_SCAN_OPT_PASSIVE 0x01
1470 /* Background scan: we go into Power Save mode (by transmitting
1471 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1472 ** and then exit Power Save mode. A plus is that AP buffers frames
1473 ** for us while we do background scan. Thus we avoid frame losses.
1474 ** Background scan can be active or passive, just like normal one */
1475 #define ACX_SCAN_OPT_BACKGROUND 0x02
1476 typedef struct acx100_scan
{
1477 u16 count
; /* number of scans to do, 0xffff == continuous */
1479 u16 flags
; /* channel list mask; 0x8000 == all channels? */
1480 u8 max_rate
; /* max. probe rate */
1481 u8 options
; /* bit mask, see defines above */
1483 u16 max_probe_delay
;
1484 } ACX_PACKED acx100_scan_t
; /* length 0xc */
1486 #define ACX111_SCAN_RATE_6 0x0B
1487 #define ACX111_SCAN_RATE_9 0x0F
1488 #define ACX111_SCAN_RATE_12 0x0A
1489 #define ACX111_SCAN_RATE_18 0x0E
1490 #define ACX111_SCAN_RATE_24 0x09
1491 #define ACX111_SCAN_RATE_36 0x0D
1492 #define ACX111_SCAN_RATE_48 0x08
1493 #define ACX111_SCAN_RATE_54 0x0C
1494 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1495 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1496 #define ACX111_SCAN_MOD_PBCC 0x80
1497 #define ACX111_SCAN_MOD_OFDM 0x40
1498 typedef struct acx111_scan
{
1499 u16 count
; /* number of scans to do */
1500 u8 channel_list_select
; /* 0: scan all channels, 1: from chan_list only */
1503 u8 rate
; /* rate for probe requests (if active scan) */
1504 u8 options
; /* bit mask, see defines above */
1505 u16 chan_duration
; /* min time to wait for reply on one channel (in TU) */
1506 /* (active scan only) (802.11 section 11.1.3.2.2) */
1507 u16 max_probe_delay
; /* max time to wait for reply on one channel (active scan) */
1508 /* time to listen on a channel (passive scan) */
1510 u8 channel_list
[26]; /* bits 7:0 first byte: channels 8:1 */
1511 /* bits 7:0 second byte: channels 16:9 */
1512 /* 26 bytes is enough to cover 802.11a */
1513 } ACX_PACKED acx111_scan_t
;
1516 ** Radio calibration command structure
1518 typedef struct acx111_cmd_radiocalib
{
1519 /* 0x80000000 == automatic calibration by firmware, according to interval;
1520 * bits 0..3: select calibration methods to go through:
1521 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1524 } ACX_PACKED acx111_cmd_radiocalib_t
;
1527 ** Packet template structures
1529 ** Packet templates store contents of Beacon, Probe response, Probe request,
1530 ** Null data frame, and TIM data frame. Firmware automatically transmits
1531 ** contents of template at appropriate time:
1532 ** - Beacon: when configured as AP or Ad-hoc
1533 ** - Probe response: when configured as AP or Ad-hoc, whenever
1534 ** a Probe request frame is received
1535 ** - Probe request: when host issues SCAN command (active)
1536 ** - Null data frame: when entering 802.11 power save mode
1537 ** - TIM data: at the end of Beacon frames (if no TIM template
1538 ** is configured, then transmits default TIM)
1540 ** - size field must be set to size of actual template
1541 ** (NOT sizeof(struct) - templates are variable in length),
1542 ** size field is not itself counted.
1543 ** - members flagged with an asterisk must be initialized with host,
1544 ** rest must be zero filled.
1545 ** - variable length fields shown only in comments */
1546 typedef struct acx_template_tim
{
1548 u8 tim_eid
; /* 00 1 TIM IE ID * */
1549 u8 len
; /* 01 1 Length * */
1550 u8 dtim_cnt
; /* 02 1 DTIM Count */
1551 u8 dtim_period
; /* 03 1 DTIM Period */
1552 u8 bitmap_ctrl
; /* 04 1 Bitmap Control * (except bit0) */
1553 /* 05 n Partial Virtual Bitmap * */
1554 u8 variable
[0x100 - 1-1-1-1-1];
1555 } ACX_PACKED acx_template_tim_t
;
1557 typedef struct acx_template_probereq
{
1559 u16 fc
; /* 00 2 fc * */
1560 u16 dur
; /* 02 2 Duration */
1561 u8 da
[6]; /* 04 6 Destination Address * */
1562 u8 sa
[6]; /* 0A 6 Source Address * */
1563 u8 bssid
[6]; /* 10 6 BSSID * */
1564 u16 seq
; /* 16 2 Sequence Control */
1566 /* nn n Supported Rates * */
1567 u8 variable
[0x44 - 2-2-6-6-6-2];
1568 } ACX_PACKED acx_template_probereq_t
;
1570 typedef struct acx_template_proberesp
{
1572 u16 fc
; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1573 u16 dur
; /* 02 2 Duration */
1574 u8 da
[6]; /* 04 6 Destination Address */
1575 u8 sa
[6]; /* 0A 6 Source Address */
1576 u8 bssid
[6]; /* 10 6 BSSID */
1577 u16 seq
; /* 16 2 Sequence Control */
1578 u8 timestamp
[8];/* 18 8 Timestamp */
1579 u16 beacon_interval
; /* 20 2 Beacon Interval * */
1580 u16 cap
; /* 22 2 Capability Information * */
1582 /* nn n Supported Rates * */
1583 /* nn 1 DS Parameter Set * */
1584 u8 variable
[0x54 - 2-2-6-6-6-2-8-2-2];
1585 } ACX_PACKED acx_template_proberesp_t
;
1586 #define acx_template_beacon_t acx_template_proberesp_t
1587 #define acx_template_beacon acx_template_proberesp
1589 typedef struct acx_template_nullframe
{
1591 struct ieee80211_hdr hdr
;
1592 } ACX_PACKED acx_template_nullframe_t
;
1596 ** JOIN command structure
1598 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1599 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1600 typedef struct acx_joinbss
{
1602 u16 beacon_interval
;
1608 } ACX_PACKED acx100
;
1612 } ACX_PACKED acx111
;
1614 u8 genfrm_txrate
; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1615 u8 genfrm_mod_pre
; /* generated frame modulation/preamble:
1616 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1617 ** bit5: short pre */
1618 u8 macmode
; /* BSS Type, must be one of ACX_MODE_xxx */
1621 char essid
[IW_ESSID_MAX_SIZE
];
1622 } ACX_PACKED acx_joinbss_t
;
1624 #define JOINBSS_RATES_1 0x01
1625 #define JOINBSS_RATES_2 0x02
1626 #define JOINBSS_RATES_5 0x04
1627 #define JOINBSS_RATES_11 0x08
1628 #define JOINBSS_RATES_22 0x10
1630 /* Looks like missing bits are used to indicate 11g rates!
1631 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1632 ** This was actually seen! Look at that Assoc Request sent by acx111,
1633 ** it _does_ contain 11g rates in basic set:
1634 01:30:20.070772 Beacon (xxx) [1.0* 2.0* 5.5* 11.0* 6.0* 9.0* 12.0* 18.0* 24.0* 36.0* 48.0* 54.0* Mbit] ESS CH: 1
1635 01:30:20.074425 Authentication (Open System)-1: Succesful
1636 01:30:20.076539 Authentication (Open System)-2:
1637 01:30:20.076620 Acknowledgment
1638 01:30:20.088546 Assoc Request (xxx) [1.0* 2.0* 5.5* 6.0* 9.0* 11.0* 12.0* 18.0* 24.0* 36.0* 48.0* 54.0* Mbit]
1639 01:30:20.122413 Assoc Response AID(1) :: Succesful
1640 01:30:20.122679 Acknowledgment
1641 01:30:20.173204 Beacon (xxx) [1.0* 2.0* 5.5* 11.0* 6.0* 9.0* 12.0* 18.0* 24.0* 36.0* 48.0* 54.0* Mbit] ESS CH: 1
1643 #define JOINBSS_RATES_BASIC111_1 0x0001
1644 #define JOINBSS_RATES_BASIC111_2 0x0002
1645 #define JOINBSS_RATES_BASIC111_5 0x0004
1646 #define JOINBSS_RATES_BASIC111_11 0x0020
1647 #define JOINBSS_RATES_BASIC111_22 0x0100
1650 /***********************************************************************
1652 typedef struct mem_read_write
{
1654 u16 type
; /* 0x0 int. RAM / 0xffff MAC reg. / 0x81 PHY RAM / 0x82 PHY reg.; or maybe it's actually 0x30 for MAC? Better verify it by writing and reading back and checking whether the value holds! */
1657 } ACX_PACKED mem_read_write_t
;
1660 typedef struct acx_cmd_radioinit
{
1663 } ACX_PACKED acx_cmd_radioinit_t
;
1665 typedef struct acx100_ie_wep_options
{
1668 u16 NumKeys
; /* max # of keys */
1669 u8 WEPOption
; /* 0 == decrypt default key only, 1 == override decrypt */
1670 u8 Pad
; /* used only for acx111 */
1671 } ACX_PACKED acx100_ie_wep_options_t
;
1673 typedef struct ie_dot11WEPDefaultKey
{
1679 u8 key
[29]; /* check this! was Key[19] */
1680 } ACX_PACKED ie_dot11WEPDefaultKey_t
;
1682 typedef struct acx111WEPDefaultKey
{
1683 u8 MacAddr
[ETH_ALEN
];
1684 u16 action
; /* NOTE: this is a u16, NOT a u8!! */
1691 u8 key
[32]; /* up to 32 bytes (for TKIP!) */
1692 } ACX_PACKED acx111WEPDefaultKey_t
;
1694 typedef struct ie_dot11WEPDefaultKeyID
{
1698 } ACX_PACKED ie_dot11WEPDefaultKeyID_t
;
1700 typedef struct acx100_cmd_wep_mgmt
{
1701 u8 MacAddr
[ETH_ALEN
];
1704 u8 Key
[29]; /* 29*8 == 232bits == WEP256 */
1705 } ACX_PACKED acx100_cmd_wep_mgmt_t
;
1707 typedef struct acx_ie_generic
{
1711 /* Association ID IE: just a 16bit value: */
1713 /* generic member for quick implementation of commands */
1716 } ACX_PACKED acx_ie_generic_t
;
1718 #define ACX_SEC_KEYSIZE 16
1719 /* Security algorithms. */
1722 ACX_SEC_ALGO_NONE
= 0, /* unencrypted, as of TX header. */
1724 ACX_SEC_ALGO_UNKNOWN
,
1726 ACX_SEC_ALGO_WEP104
,
1729 /***********************************************************************
1731 #define CHECK_SIZEOF(type,size) { \
1732 extern void BUG_bad_size_for_##type(void); \
1733 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
1737 acx_struct_size_check(void)
1739 CHECK_SIZEOF(txdesc_t
, 0x30);
1740 CHECK_SIZEOF(acx100_ie_memconfigoption_t
, 24);
1741 CHECK_SIZEOF(acx100_ie_queueconfig_t
, 0x20);
1742 CHECK_SIZEOF(acx_joinbss_t
, 0x30);
1743 /* IEs need 4 bytes for (type,len) tuple */
1744 CHECK_SIZEOF(acx111_ie_configoption_t
, ACX111_REG_CONFIG_OPTIONS_LEN
+ 4);
1748 /***********************************************************************
1751 extern const u8 acx_bitpos2ratebyte
[];
1752 extern const u8 acx_bitpos2rate100
[];
1754 extern const u8 acx_reg_domain_ids
[];
1755 extern const char * const acx_reg_domain_strings
[];
1757 acx_reg_domain_ids_len
= 8
1760 //extern const struct iw_handler_def acx_ioctl_handler_def;
1762 #endif /* _ACX_STRUCT_H_ */