Original 20051017 tarball
[acx-mac80211.git] / acx_struct.h
blob6a0db7b9da5ea891e8a24afb607a2833685929f5
1 /***********************************************************************
2 ** Copyright (C) 2003 ACX100 Open Source Project
3 **
4 ** The contents of this file are subject to the Mozilla Public
5 ** License Version 1.1 (the "License"); you may not use this file
6 ** except in compliance with the License. You may obtain a copy of
7 ** the License at http://www.mozilla.org/MPL/
8 **
9 ** Software distributed under the License is distributed on an "AS
10 ** IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11 ** implied. See the License for the specific language governing
12 ** rights and limitations under the License.
14 ** Alternatively, the contents of this file may be used under the
15 ** terms of the GNU Public License version 2 (the "GPL"), in which
16 ** case the provisions of the GPL are applicable instead of the
17 ** above. If you wish to allow the use of your version of this file
18 ** only under the terms of the GPL and not to allow others to use
19 ** your version of this file under the MPL, indicate your decision
20 ** by deleting the provisions above and replace them with the notice
21 ** and other provisions required by the GPL. If you do not delete
22 ** the provisions above, a recipient may use your version of this
23 ** file under either the MPL or the GPL.
24 ** ---------------------------------------------------------------------
25 ** Inquiries regarding the ACX100 Open Source Project can be
26 ** made directly to:
28 ** acx100-users@lists.sf.net
29 ** http://acx100.sf.net
30 ** ---------------------------------------------------------------------
33 /***********************************************************************
34 ** Forward declarations of types
36 typedef struct tx tx_t;
37 typedef struct wlandevice wlandevice_t;
38 typedef struct client client_t;
39 typedef struct rxdesc rxdesc_t;
40 typedef struct txdesc txdesc_t;
41 typedef struct rxhostdesc rxhostdesc_t;
42 typedef struct txhostdesc txhostdesc_t;
45 /***********************************************************************
46 ** Debug / log functionality
48 enum {
49 L_LOCK = (ACX_DEBUG>1)*0x0001, /* locking debug log */
50 L_INIT = (ACX_DEBUG>0)*0x0002, /* special card initialization logging */
51 L_IRQ = (ACX_DEBUG>0)*0x0004, /* interrupt stuff */
52 L_ASSOC = (ACX_DEBUG>0)*0x0008, /* assocation (network join) and station log */
53 L_FUNC = (ACX_DEBUG>1)*0x0020, /* logging of function enter / leave */
54 L_XFER = (ACX_DEBUG>1)*0x0080, /* logging of transfers and mgmt */
55 L_DATA = (ACX_DEBUG>1)*0x0100, /* logging of transfer data */
56 L_DEBUG = (ACX_DEBUG>1)*0x0200, /* log of debug info */
57 L_IOCTL = (ACX_DEBUG>0)*0x0400, /* log ioctl calls */
58 L_CTL = (ACX_DEBUG>1)*0x0800, /* log of low-level ctl commands */
59 L_BUFR = (ACX_DEBUG>1)*0x1000, /* debug rx buffer mgmt (ring buffer etc.) */
60 L_XFER_BEACON = (ACX_DEBUG>1)*0x2000, /* also log beacon packets */
61 L_BUFT = (ACX_DEBUG>1)*0x4000, /* debug tx buffer mgmt (ring buffer etc.) */
62 L_USBRXTX = (ACX_DEBUG>0)*0x8000, /* debug USB rx/tx operations */
63 L_BUF = L_BUFR + L_BUFT,
64 L_ANY = 0xffff
67 #if ACX_DEBUG
68 extern unsigned int acx_debug;
69 #else
70 enum { acx_debug = 0 };
71 #endif
74 /*============================================================================*
75 * Random helpers *
76 *============================================================================*/
77 #define ACX_PACKED __WLAN_ATTRIB_PACK__
79 #define VEC_SIZE(a) (sizeof(a)/sizeof(a[0]))
81 /* Use worker_queues for 2.5/2.6 Kernels and queue tasks for 2.4 Kernels
82 (used for the 'bottom half' of the interrupt routine) */
84 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
85 #include <linux/workqueue.h>
86 /* #define NEWER_KERNELS_ONLY 1 */
87 #define USE_WORKER_TASKS
88 #define WORK_STRUCT struct work_struct
89 #define SCHEDULE_WORK schedule_work
90 #define FLUSH_SCHEDULED_WORK flush_scheduled_work
92 #else
93 #include <linux/tqueue.h>
94 #define USE_QUEUE_TASKS
95 #define WORK_STRUCT struct tq_struct
96 #define SCHEDULE_WORK schedule_task
97 #define INIT_WORK(work, func, ndev) \
98 do { \
99 (work)->routine = (func); \
100 (work)->data = (ndev); \
101 } while (0)
102 #define FLUSH_SCHEDULED_WORK flush_scheduled_tasks
104 #endif
107 /*============================================================================*
108 * Constants *
109 *============================================================================*/
110 #define OK 0
111 #define NOT_OK 1
113 /* The supported chip models */
114 #define CHIPTYPE_ACX100 1
115 #define CHIPTYPE_ACX111 2
117 #define IS_ACX100(priv) ((priv)->chip_type == CHIPTYPE_ACX100)
118 #define IS_ACX111(priv) ((priv)->chip_type == CHIPTYPE_ACX111)
120 /* Supported interfaces */
121 #define DEVTYPE_PCI 0
122 #define DEVTYPE_USB 1
124 #if defined(CONFIG_ACX_PCI)
125 #if !defined(CONFIG_ACX_USB)
126 #define IS_PCI(priv) 1
127 #else
128 #define IS_PCI(priv) ((priv)->dev_type == DEVTYPE_PCI)
129 #endif
130 #else
131 #define IS_PCI(priv) 0
132 #endif
134 #if defined(CONFIG_ACX_USB)
135 #if !defined(CONFIG_ACX_PCI)
136 #define IS_USB(priv) 1
137 #else
138 #define IS_USB(priv) ((priv)->dev_type == DEVTYPE_USB)
139 #endif
140 #else
141 #define IS_USB(priv) 0
142 #endif
144 /* Driver defaults */
145 #define DEFAULT_DTIM_INTERVAL 10
146 /* used to be 2048, but FreeBSD driver changed it to 4096 to work properly
147 ** in noisy wlans */
148 #define DEFAULT_MSDU_LIFETIME 4096
149 #define DEFAULT_RTS_THRESHOLD 2312 /* max. size: disable RTS mechanism */
150 #define DEFAULT_BEACON_INTERVAL 100
152 #define ACX100_BAP_DATALEN_MAX 4096
153 #define ACX100_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
154 #define ACX100_RIDDATA_MAXLEN ACX100_RID_GUESSING_MAXLEN
156 /* Support Constants */
157 /* Radio type names, found in Win98 driver's TIACXLN.INF */
158 #define RADIO_MAXIM_0D 0x0d
159 #define RADIO_RFMD_11 0x11
160 #define RADIO_RALINK_15 0x15
161 /* used in ACX111 cards (WG311v2, WL-121, ...): */
162 #define RADIO_RADIA_16 0x16
163 /* most likely *sometimes* used in ACX111 cards: */
164 #define RADIO_UNKNOWN_17 0x17
165 /* FwRad19.bin was found in a Safecom driver; must be an ACX111 radio: */
166 #define RADIO_UNKNOWN_19 0x19
168 /* Controller Commands */
169 /* can be found in table cmdTable in firmware "Rev. 1.5.0" (FW150) */
170 #define ACX1xx_CMD_RESET 0x00
171 #define ACX1xx_CMD_INTERROGATE 0x01
172 #define ACX1xx_CMD_CONFIGURE 0x02
173 #define ACX1xx_CMD_ENABLE_RX 0x03
174 #define ACX1xx_CMD_ENABLE_TX 0x04
175 #define ACX1xx_CMD_DISABLE_RX 0x05
176 #define ACX1xx_CMD_DISABLE_TX 0x06
177 #define ACX1xx_CMD_FLUSH_QUEUE 0x07
178 #define ACX1xx_CMD_SCAN 0x08
179 #define ACX1xx_CMD_STOP_SCAN 0x09
180 #define ACX1xx_CMD_CONFIG_TIM 0x0a
181 #define ACX1xx_CMD_JOIN 0x0b
182 #define ACX1xx_CMD_WEP_MGMT 0x0c
183 #ifdef OLD_FIRMWARE_VERSIONS
184 #define ACX100_CMD_HALT 0x0e /* mapped to unknownCMD in FW150 */
185 #else
186 #define ACX1xx_CMD_MEM_READ 0x0d
187 #define ACX1xx_CMD_MEM_WRITE 0x0e
188 #endif
189 #define ACX1xx_CMD_SLEEP 0x0f
190 #define ACX1xx_CMD_WAKE 0x10
191 #define ACX1xx_CMD_UNKNOWN_11 0x11 /* mapped to unknownCMD in FW150 */
192 #define ACX100_CMD_INIT_MEMORY 0x12
193 #define ACX1xx_CMD_CONFIG_BEACON 0x13
194 #define ACX1xx_CMD_CONFIG_PROBE_RESPONSE 0x14
195 #define ACX1xx_CMD_CONFIG_NULL_DATA 0x15
196 #define ACX1xx_CMD_CONFIG_PROBE_REQUEST 0x16
197 #define ACX1xx_CMD_TEST 0x17
198 #define ACX1xx_CMD_RADIOINIT 0x18
199 #define ACX111_CMD_RADIOCALIB 0x19
201 /* 'After Interrupt' Commands */
202 #define ACX_AFTER_IRQ_CMD_STOP_SCAN 0x01
203 #define ACX_AFTER_IRQ_CMD_ASSOCIATE 0x02
204 #define ACX_AFTER_IRQ_CMD_RADIO_RECALIB 0x04
205 #define ACX_AFTER_IRQ_UPDATE_CARD_CFG 0x08
206 #define ACX_AFTER_IRQ_TX_CLEANUP 0x10
207 #define ACX_AFTER_IRQ_COMPLETE_SCAN 0x20
208 #define ACX_AFTER_IRQ_RESTART_SCAN 0x40
210 /***********************************************************************
211 ** Tx/Rx buffer sizes and watermarks
213 ** This will alloc and use DMAable buffers of
214 ** WLAN_A4FR_MAXLEN_WEP_FCS * (RX_CNT + TX_CNT) bytes
215 ** RX/TX_CNT=32 -> ~150k DMA buffers
216 ** RX/TX_CNT=16 -> ~75k DMA buffers
218 ** 2005-10-10: reduced memory usage by lowering both to 16
220 #define RX_CNT 16
221 #define TX_CNT 16
223 /* we clean up txdescs when we have N free txdesc: */
224 #define TX_START_CLEAN (TX_CNT - (TX_CNT/4))
225 #define TX_EMERG_CLEAN 2
226 /* we stop queue if we have less than N free txbufs: */
227 #define TX_STOP_QUEUE 3
228 /* we start queue if we have more than N free txbufs: */
229 #define TX_START_QUEUE 6
231 /***********************************************************************
232 ** Interrogate/Configure cmd constants
234 ** NB: length includes JUST the data part of the IE
235 ** (does not include size of the (type,len) pair)
237 ** TODO: seems that acx100, acx100usb, acx111 have some differences,
238 ** fix code with regard to this!
241 #define DEF_IE(name, val, len) enum { ACX##name=val, ACX##name##_LEN=len }
243 /* Information Elements: Network Parameters, Static Configuration Entities */
244 /* these are handled by real_cfgtable in firmware "Rev 1.5.0" (FW150) */
245 DEF_IE(1xx_IE_UNKNOWN_00 ,0x0000, -1); /* mapped to cfgInvalid in FW150 */
246 DEF_IE(100_IE_ACX_TIMER ,0x0001, 0x10);
247 DEF_IE(1xx_IE_POWER_MGMT ,0x0002, 0x06);
248 DEF_IE(1xx_IE_QUEUE_CONFIG ,0x0003, 0x1c);
249 DEF_IE(100_IE_BLOCK_SIZE ,0x0004, 0x02);
250 DEF_IE(1xx_IE_MEMORY_CONFIG_OPTIONS ,0x0005, 0x14);
251 DEF_IE(1xx_IE_RATE_FALLBACK ,0x0006, 0x01);
252 DEF_IE(100_IE_WEP_OPTIONS ,0x0007, 0x03);
253 DEF_IE(111_IE_RADIO_BAND ,0x0007, -1);
254 DEF_IE(1xx_IE_MEMORY_MAP ,0x0008, 0x28); /* huh? */
255 DEF_IE(100_IE_SSID ,0x0008, 0x20); /* huh? */
256 DEF_IE(1xx_IE_SCAN_STATUS ,0x0009, 0x04); /* mapped to cfgInvalid in FW150 */
257 DEF_IE(1xx_IE_ASSOC_ID ,0x000a, 0x02);
258 DEF_IE(1xx_IE_UNKNOWN_0B ,0x000b, -1); /* mapped to cfgInvalid in FW150 */
259 DEF_IE(100_IE_UNKNOWN_0C ,0x000c, -1); /* very small implementation in FW150! */
260 DEF_IE(111_IE_CONFIG_OPTIONS ,0x000c, 0x14c);
261 DEF_IE(1xx_IE_FWREV ,0x000d, 0x18);
262 DEF_IE(1xx_IE_FCS_ERROR_COUNT ,0x000e, 0x04);
263 DEF_IE(1xx_IE_MEDIUM_USAGE ,0x000f, 0x08);
264 DEF_IE(1xx_IE_RXCONFIG ,0x0010, 0x04);
265 DEF_IE(100_IE_UNKNOWN_11 ,0x0011, -1); /* NONBINARY: large implementation in FW150! link quality readings or so? */
266 DEF_IE(111_IE_QUEUE_THRESH ,0x0011, -1);
267 DEF_IE(100_IE_UNKNOWN_12 ,0x0012, -1); /* NONBINARY: VERY large implementation in FW150!! */
268 DEF_IE(111_IE_BSS_POWER_SAVE ,0x0012, -1);
269 DEF_IE(1xx_IE_FIRMWARE_STATISTICS ,0x0013, 0x9c);
270 DEF_IE(1xx_IE_FEATURE_CONFIG ,0x0015, 0x08);
271 DEF_IE(111_IE_KEY_CHOOSE ,0x0016, 0x04); /* for rekeying. really len=4?? */
272 DEF_IE(1xx_IE_DOT11_STATION_ID ,0x1001, 0x06);
273 DEF_IE(100_IE_DOT11_UNKNOWN_1002 ,0x1002, -1); /* mapped to cfgInvalid in FW150 */
274 DEF_IE(111_IE_DOT11_FRAG_THRESH ,0x1002, -1); /* mapped to cfgInvalid in FW150 */
275 DEF_IE(100_IE_DOT11_BEACON_PERIOD ,0x1003, 0x02); /* mapped to cfgInvalid in FW150 */
276 DEF_IE(1xx_IE_DOT11_DTIM_PERIOD ,0x1004, -1); /* mapped to cfgInvalid in FW150 */
277 DEF_IE(1xx_IE_DOT11_SHORT_RETRY_LIMIT ,0x1005, 0x01);
278 DEF_IE(1xx_IE_DOT11_LONG_RETRY_LIMIT ,0x1006, 0x01);
279 DEF_IE(100_IE_DOT11_WEP_DEFAULT_KEY_WRITE ,0x1007, 0x20); /* configure default keys */
280 DEF_IE(1xx_IE_DOT11_MAX_XMIT_MSDU_LIFETIME ,0x1008, 0x04);
281 DEF_IE(1xx_IE_DOT11_GROUP_ADDR ,0x1009, -1);
282 DEF_IE(1xx_IE_DOT11_CURRENT_REG_DOMAIN ,0x100a, 0x02);
283 //It's harmless to have larger struct. Use USB case always.
284 DEF_IE(1xx_IE_DOT11_CURRENT_ANTENNA ,0x100b, 0x02); /* in fact len=1 for PCI */
285 DEF_IE(1xx_IE_DOT11_UNKNOWN_100C ,0x100c, -1); /* mapped to cfgInvalid in FW150 */
286 DEF_IE(1xx_IE_DOT11_TX_POWER_LEVEL ,0x100d, 0x01);
287 DEF_IE(1xx_IE_DOT11_CURRENT_CCA_MODE ,0x100e, 0x02); /* in fact len=1 for PCI */
288 //USB doesn't return anything - len==0?!
289 DEF_IE(100_IE_DOT11_ED_THRESHOLD ,0x100f, 0x04);
290 DEF_IE(1xx_IE_DOT11_WEP_DEFAULT_KEY_SET ,0x1010, 0x01); /* set default key ID */
291 DEF_IE(100_IE_DOT11_UNKNOWN_1011 ,0x1011, -1); /* mapped to cfgInvalid in FW150 */
292 DEF_IE(100_IE_DOT11_UNKNOWN_1012 ,0x1012, -1); /* mapped to cfgInvalid in FW150 */
293 DEF_IE(100_IE_DOT11_UNKNOWN_1013 ,0x1013, -1); /* mapped to cfgInvalid in FW150 */
295 #if 0
296 /* Experimentally obtained on acx100, fw 1.9.8.b
297 ** -1 means that fw returned 'invalid IE'
298 ** 0200 FC00 nnnn... are test read contents: u16 type, u16 len, data
299 ** (AA are poison bytes marking bytes not written by fw)
301 ** Looks like acx100 fw does not update len field (thus len=256-4=FC here)
302 ** A number of IEs seem to trash type,len fields
303 ** IEs marked 'huge' return gobs of data (no poison bytes remain)
305 DEF_IE(100_IE_INVAL_00, 0x0000, -1);
306 DEF_IE(100_IE_INVAL_01, 0x0001, -1); /* IE_ACX_TIMER, len=16 on older fw */
307 DEF_IE(100_IE_POWER_MGMT, 0x0002, 4); /* 0200FC00 00040000 AAAAAAAA */
308 DEF_IE(100_IE_QUEUE_CONFIG, 0x0003, 28); /* 0300FC00 48060000 9CAD0000 0101AAAA DCB00000 E4B00000 9CAA0000 00AAAAAA */
309 DEF_IE(100_IE_BLOCK_SIZE, 0x0004, 2); /* 0400FC00 0001AAAA AAAAAAAA AAAAAAAA */
310 /* write only: */
311 DEF_IE(100_IE_MEMORY_CONFIG_OPTIONS, 0x0005, 20);
312 DEF_IE(100_IE_RATE_FALLBACK, 0x0006, 1); /* 0600FC00 00AAAAAA AAAAAAAA AAAAAAAA */
313 /* write only: */
314 DEF_IE(100_IE_WEP_OPTIONS, 0x0007, 3);
315 DEF_IE(100_IE_MEMORY_MAP, 0x0008, 40); /* huge: 0800FC00 30000000 6CA20000 70A20000... */
316 /* gives INVAL on read: */
317 DEF_IE(100_IE_SCAN_STATUS, 0x0009, -1);
318 DEF_IE(100_IE_ASSOC_ID, 0x000a, 2); /* huge: 0A00FC00 00000000 01040800 00000000... */
319 DEF_IE(100_IE_INVAL_0B, 0x000b, -1);
320 /* 'command rejected': */
321 DEF_IE(100_IE_CONFIG_OPTIONS, 0x000c, -3);
322 DEF_IE(100_IE_FWREV, 0x000d, 24); /* 0D00FC00 52657620 312E392E 382E6200 AAAAAAAA AAAAAAAA 05050201 AAAAAAAA */
323 DEF_IE(100_IE_FCS_ERROR_COUNT, 0x000e, 4);
324 DEF_IE(100_IE_MEDIUM_USAGE, 0x000f, 8); /* E41F0000 2D780300 FCC91300 AAAAAAAA */
325 DEF_IE(100_IE_RXCONFIG, 0x0010, 4); /* 1000FC00 00280000 AAAAAAAA AAAAAAAA */
326 DEF_IE(100_IE_QUEUE_THRESH, 0x0011, 12); /* 1100FC00 AAAAAAAA 00000000 00000000 */
327 DEF_IE(100_IE_BSS_POWER_SAVE, 0x0012, 1); /* 1200FC00 00AAAAAA AAAAAAAA AAAAAAAA */
328 /* read only, variable len */
329 DEF_IE(100_IE_FIRMWARE_STATISTICS, 0x0013, 256); /* 0000AC00 00000000 ... */
330 DEF_IE(100_IE_INT_CONFIG, 0x0014, 20); /* 00000000 00000000 00000000 00000000 5D74D105 00000000 AAAAAAAA AAAAAAAA */
331 DEF_IE(100_IE_FEATURE_CONFIG, 0x0015, 8); /* 1500FC00 16000000 AAAAAAAA AAAAAAAA */
332 /* returns 'invalid MAC': */
333 DEF_IE(100_IE_KEY_CHOOSE, 0x0016, -4);
334 DEF_IE(100_IE_INVAL_17, 0x0017, -1);
335 DEF_IE(100_IE_UNKNOWN_18, 0x0018, 0); /* null len?! 1800FC00 AAAAAAAA AAAAAAAA AAAAAAAA */
336 DEF_IE(100_IE_UNKNOWN_19, 0x0019, 256); /* huge: 1900FC00 9C1F00EA FEFFFFEA FEFFFFEA... */
337 DEF_IE(100_IE_INVAL_1A, 0x001A, -1);
339 DEF_IE(100_IE_DOT11_INVAL_1000, 0x1000, -1);
340 DEF_IE(100_IE_DOT11_STATION_ID, 0x1001, 6); /* huge: 0110FC00 58B10E2F 03000000 00000000... */
341 DEF_IE(100_IE_DOT11_INVAL_1002, 0x1002, -1);
342 DEF_IE(100_IE_DOT11_INVAL_1003, 0x1003, -1);
343 DEF_IE(100_IE_DOT11_INVAL_1004, 0x1004, -1);
344 DEF_IE(100_IE_DOT11_SHORT_RETRY_LIMIT, 0x1005, 1);
345 DEF_IE(100_IE_DOT11_LONG_RETRY_LIMIT, 0x1006, 1);
346 /* write only: */
347 DEF_IE(100_IE_DOT11_WEP_DEFAULT_KEY_WRITE, 0x1007, 32);
348 DEF_IE(100_IE_DOT11_MAX_XMIT_MSDU_LIFETIME, 0x1008, 4); /* huge: 0810FC00 00020000 F4010000 00000000... */
349 /* undoc but returns something */
350 DEF_IE(100_IE_DOT11_GROUP_ADDR, 0x1009, 12); /* huge: 0910FC00 00000000 00000000 00000000... */
351 DEF_IE(100_IE_DOT11_CURRENT_REG_DOMAIN, 0x100a, 1); /* 0A10FC00 30AAAAAA AAAAAAAA AAAAAAAA */
352 DEF_IE(100_IE_DOT11_CURRENT_ANTENNA, 0x100b, 1); /* 0B10FC00 8FAAAAAA AAAAAAAA AAAAAAAA */
353 DEF_IE(100_IE_DOT11_INVAL_100C, 0x100c, -1);
354 DEF_IE(100_IE_DOT11_TX_POWER_LEVEL, 0x100d, 2); /* 00000000 0100AAAA AAAAAAAA AAAAAAAA */
355 DEF_IE(100_IE_DOT11_CURRENT_CCA_MODE, 0x100e, 1); /* 0E10FC00 0DAAAAAA AAAAAAAA AAAAAAAA */
356 DEF_IE(100_IE_DOT11_ED_THRESHOLD, 0x100f, 4); /* 0F10FC00 70000000 AAAAAAAA AAAAAAAA */
357 /* set default key ID */
358 DEF_IE(100_IE_DOT11_WEP_DEFAULT_KEY_SET, 0x1010, 1); /* 1010FC00 00AAAAAA AAAAAAAA AAAAAAAA */
359 DEF_IE(100_IE_DOT11_INVAL_1011, 0x1011, -1);
360 DEF_IE(100_IE_DOT11_INVAL_1012, 0x1012, -1);
361 DEF_IE(100_IE_DOT11_INVAL_1013, 0x1013, -1);
362 DEF_IE(100_IE_DOT11_UNKNOWN_1014, 0x1014, 256); /* huge */
363 DEF_IE(100_IE_DOT11_UNKNOWN_1015, 0x1015, 256); /* huge */
364 DEF_IE(100_IE_DOT11_UNKNOWN_1016, 0x1016, 256); /* huge */
365 DEF_IE(100_IE_DOT11_UNKNOWN_1017, 0x1017, 256); /* huge */
366 DEF_IE(100_IE_DOT11_UNKNOWN_1018, 0x1018, 256); /* huge */
367 DEF_IE(100_IE_DOT11_UNKNOWN_1019, 0x1019, 256); /* huge */
368 #endif
370 #if 0
371 /* Experimentally obtained on PCI acx111 Xterasys XN-2522g, fw 1.2.1.34
372 ** -1 means that fw returned 'invalid IE'
373 ** 0400 0800 nnnn... are test read contents: u16 type, u16 len, data
374 ** (AA are poison bytes marking bytes not written by fw)
376 ** Looks like acx111 fw reports real len!
378 DEF_IE(111_IE_INVAL_00, 0x0000, -1);
379 DEF_IE(111_IE_INVAL_01, 0x0001, -1);
380 DEF_IE(111_IE_POWER_MGMT, 0x0002, 12);
381 /* write only, variable len: 12 + rxqueue_cnt*8 + txqueue_cnt*4: */
382 DEF_IE(111_IE_MEMORY_CONFIG, 0x0003, 24);
383 DEF_IE(111_IE_BLOCK_SIZE, 0x0004, 8); /* 04000800 AA00AAAA AAAAAAAA */
384 /* variable len: 8 + rxqueue_cnt*8 + txqueue_cnt*8: */
385 DEF_IE(111_IE_QUEUE_HEAD, 0x0005, 24);
386 DEF_IE(111_IE_RATE_FALLBACK, 0x0006, 1);
387 /* acx100 name:WEP_OPTIONS */
388 /* said to have len:1 (not true, actually returns 12 bytes): */
389 DEF_IE(111_IE_RADIO_BAND, 0x0007, 12); /* 07000C00 AAAA1F00 FF03AAAA AAAAAAAA */
390 DEF_IE(111_IE_MEMORY_MAP, 0x0008, 48);
391 /* said to have len:4, but gives INVAL on read: */
392 DEF_IE(111_IE_SCAN_STATUS, 0x0009, -1);
393 DEF_IE(111_IE_ASSOC_ID, 0x000a, 2);
394 /* write only, len is not known: */
395 DEF_IE(111_IE_UNKNOWN_0B, 0x000b, 0);
396 /* read only, variable len. I see 67 byte reads: */
397 DEF_IE(111_IE_CONFIG_OPTIONS, 0x000c, 67); /* 0C004300 01160500 ... */
398 DEF_IE(111_IE_FWREV, 0x000d, 24);
399 DEF_IE(111_IE_FCS_ERROR_COUNT, 0x000e, 4);
400 DEF_IE(111_IE_MEDIUM_USAGE, 0x000f, 8);
401 DEF_IE(111_IE_RXCONFIG, 0x0010, 4);
402 DEF_IE(111_IE_QUEUE_THRESH, 0x0011, 12);
403 DEF_IE(111_IE_BSS_POWER_SAVE, 0x0012, 1);
404 /* read only, variable len. I see 240 byte reads: */
405 DEF_IE(111_IE_FIRMWARE_STATISTICS, 0x0013, 240); /* 1300F000 00000000 ... */
406 /* said to have len=17. looks like fw pads it to 20: */
407 DEF_IE(111_IE_INT_CONFIG, 0x0014, 20); /* 14001400 00000000 00000000 00000000 00000000 00000000 */
408 DEF_IE(111_IE_FEATURE_CONFIG, 0x0015, 8);
409 /* said to be name:KEY_INDICATOR, len:4, but gives INVAL on read: */
410 DEF_IE(111_IE_KEY_CHOOSE, 0x0016, -1);
411 /* said to have len:4, but in fact returns 8: */
412 DEF_IE(111_IE_MAX_USB_XFR, 0x0017, 8); /* 17000800 00014000 00000000 */
413 DEF_IE(111_IE_INVAL_18, 0x0018, -1);
414 DEF_IE(111_IE_INVAL_19, 0x0019, -1);
415 /* undoc but returns something: */
416 /* huh, fw indicates len=20 but uses 4 more bytes in buffer??? */
417 DEF_IE(111_IE_UNKNOWN_1A, 0x001A, 20); /* 1A001400 AA00AAAA 0000020F FF030000 00020000 00000007 04000000 */
419 DEF_IE(111_IE_DOT11_INVAL_1000, 0x1000, -1);
420 DEF_IE(111_IE_DOT11_STATION_ID, 0x1001, 6);
421 DEF_IE(111_IE_DOT11_FRAG_THRESH, 0x1002, 2);
422 /* acx100 only? gives INVAL on read: */
423 DEF_IE(111_IE_DOT11_BEACON_PERIOD, 0x1003, -1);
424 /* said to be MAX_RECV_MSDU_LIFETIME: */
425 DEF_IE(111_IE_DOT11_DTIM_PERIOD, 0x1004, 4);
426 DEF_IE(111_IE_DOT11_SHORT_RETRY_LIMIT, 0x1005, 1);
427 DEF_IE(111_IE_DOT11_LONG_RETRY_LIMIT, 0x1006, 1);
428 /* acx100 only? gives INVAL on read: */
429 DEF_IE(111_IE_DOT11_WEP_DEFAULT_KEY_WRITE, 0x1007, -1);
430 DEF_IE(111_IE_DOT11_MAX_XMIT_MSDU_LIFETIME, 0x1008, 4);
431 /* undoc but returns something. maybe it's 2 multicast MACs to listen to? */
432 DEF_IE(111_IE_DOT11_GROUP_ADDR, 0x1009, 12); /* 09100C00 00000000 00000000 00000000 */
433 DEF_IE(111_IE_DOT11_CURRENT_REG_DOMAIN, 0x100a, 1);
434 DEF_IE(111_IE_DOT11_CURRENT_ANTENNA, 0x100b, 2);
435 DEF_IE(111_IE_DOT11_INVAL_100C, 0x100c, -1);
436 DEF_IE(111_IE_DOT11_TX_POWER_LEVEL, 0x100d, 1);
437 /* said to have len=1 but gives INVAL on read: */
438 DEF_IE(111_IE_DOT11_CURRENT_CCA_MODE, 0x100e, -1);
439 /* said to have len=4 but gives INVAL on read: */
440 DEF_IE(111_IE_DOT11_ED_THRESHOLD, 0x100f, -1);
441 /* set default key ID. write only: */
442 DEF_IE(111_IE_DOT11_WEP_DEFAULT_KEY_SET, 0x1010, 1);
443 /* undoc but returns something: */
444 DEF_IE(111_IE_DOT11_UNKNOWN_1011, 0x1011, 1); /* 11100100 20 */
445 DEF_IE(111_IE_DOT11_INVAL_1012, 0x1012, -1);
446 DEF_IE(111_IE_DOT11_INVAL_1013, 0x1013, -1);
447 #endif
450 /*============================================================================*
451 * Information Frames Structures *
452 *============================================================================*/
454 /* Used in beacon frames and the like */
455 #define DOT11RATEBYTE_1 (1*2)
456 #define DOT11RATEBYTE_2 (2*2)
457 #define DOT11RATEBYTE_5_5 (5*2+1)
458 #define DOT11RATEBYTE_11 (11*2)
459 #define DOT11RATEBYTE_22 (22*2)
460 #define DOT11RATEBYTE_6_G (6*2)
461 #define DOT11RATEBYTE_9_G (9*2)
462 #define DOT11RATEBYTE_12_G (12*2)
463 #define DOT11RATEBYTE_18_G (18*2)
464 #define DOT11RATEBYTE_24_G (24*2)
465 #define DOT11RATEBYTE_36_G (36*2)
466 #define DOT11RATEBYTE_48_G (48*2)
467 #define DOT11RATEBYTE_54_G (54*2)
468 #define DOT11RATEBYTE_BASIC 0x80 /* flags rates included in basic rate set */
471 /***********************************************************************
472 ** rxbuffer_t
474 ** This is the format of rx data returned by acx
477 /* I've hoped it's a 802.11 PHY header, but no...
478 * so far, I've seen on acx111:
479 * 0000 3a00 0000 0000 IBBS Beacons
480 * 0000 3c00 0000 0000 ESS Beacons
481 * 0000 2700 0000 0000 Probe requests
482 * --vda
484 typedef struct phy_hdr {
485 u8 unknown[4] ACX_PACKED;
486 u8 acx111_unknown[4] ACX_PACKED;
487 } phy_hdr_t;
489 /* seems to be a bit similar to hfa384x_rx_frame.
490 * These fields are still not quite obvious, though.
491 * Some seem to have different meanings... */
493 #define RXBUF_HDRSIZE 12
494 #define PHY_HDR(rxbuf) ((phy_hdr_t*)&rxbuf->hdr_a3)
495 #define RXBUF_BYTES_RCVD(rxbuf) (le16_to_cpu(rxbuf->mac_cnt_rcvd) & 0xfff)
496 #define RXBUF_BYTES_USED(rxbuf) \
497 ((le16_to_cpu(rxbuf->mac_cnt_rcvd) & 0xfff) + RXBUF_HDRSIZE)
499 mac_cnt_rcvd:
500 12 bits: length of frame from control field to last byte of FCS
501 4 bits: reserved
503 mac_cnt_mblks:
504 6 bits: number of memory block used to store frame in adapter memory
505 1 bit: Traffic Indicator bit in TIM of received Beacon was set
507 mac_status: 1 byte (bitmap):
508 7 Matching BSSID
509 6 Matching SSID
510 5 BDCST Address 1 field is a broadcast
511 4 VBM received beacon frame has more than one set bit (?!)
512 3 TIM Set bit representing this station is set in TIM of received beacon
513 2 GROUP Address 1 is a multicast
514 1 ADDR1 Address 1 matches our MAC
515 0 FCSGD FSC is good
517 phy_stat_baseband: 1 byte (bitmap):
518 7 Preamble frame had a long preamble
519 6 PLCP Error CRC16 error in PLCP header
520 5 Unsup_Mod unsupported modulation
521 4 Selected Antenna antenna 1 was used to receive this frame
522 3 PBCC/CCK frame used: 1=PBCC, 0=CCK modulation
523 2 OFDM frame used OFDM modulation
524 1 TI Protection protection frame was detected
525 0 Reserved
527 phy_plcp_signal: 1 byte:
528 Receive PLCP Signal field from the Baseband Processor
530 phy_level: 1 byte:
531 receive AGC gain level (can be used to measure receive signal strength)
533 phy_snr: 1 byte:
534 estimated noise power of equalized receive signal
535 at input of FEC decoder (can be used to measure receive signal quality)
537 time: 4 bytes:
538 timestamp sampled from either the Access Manager TSF counter
539 or free-running microsecond counter when the MAC receives
540 first byte of PLCP header.
543 typedef struct rxbuffer {
544 u16 mac_cnt_rcvd ACX_PACKED; /* only 12 bits are len! (0xfff) */
545 u8 mac_cnt_mblks ACX_PACKED;
546 u8 mac_status ACX_PACKED;
547 u8 phy_stat_baseband ACX_PACKED; /* bit 0x80: used LNA (Low-Noise Amplifier) */
548 u8 phy_plcp_signal ACX_PACKED;
549 u8 phy_level ACX_PACKED; /* PHY stat */
550 u8 phy_snr ACX_PACKED; /* PHY stat */
551 u32 time ACX_PACKED; /* timestamp upon MAC rcv first byte */
552 /* 4-byte (acx100) or 8-byte (acx111) phy header will be here
553 ** if RX_CFG1_INCLUDE_PHY_HDR is in effect:
554 ** phy_hdr_t phy */
555 wlan_hdr_a3_t hdr_a3 ACX_PACKED;
556 /* maximally sized data part of wlan packet */
557 u8 data_a3[WLAN_A4FR_MAXLEN_WEP_FCS - WLAN_HDR_A3_LEN] ACX_PACKED;
558 /* can add hdr/data_a4 if needed */
559 } rxbuffer_t;
562 /*--- Firmware statistics ----------------------------------------------------*/
563 typedef struct fw_stats {
564 u32 val0x0 ACX_PACKED; /* hdr; */
565 u32 tx_desc_of ACX_PACKED;
566 u32 rx_oom ACX_PACKED;
567 u32 rx_hdr_of ACX_PACKED;
568 u32 rx_hdr_use_next ACX_PACKED;
569 u32 rx_dropped_frame ACX_PACKED;
570 u32 rx_frame_ptr_err ACX_PACKED;
571 u32 rx_xfr_hint_trig ACX_PACKED;
573 u32 rx_dma_req ACX_PACKED;
574 u32 rx_dma_err ACX_PACKED;
575 u32 tx_dma_req ACX_PACKED;
576 u32 tx_dma_err ACX_PACKED;
578 u32 cmd_cplt ACX_PACKED;
579 u32 fiq ACX_PACKED;
580 u32 rx_hdrs ACX_PACKED;
581 u32 rx_cmplt ACX_PACKED;
582 u32 rx_mem_of ACX_PACKED;
583 u32 rx_rdys ACX_PACKED;
584 u32 irqs ACX_PACKED;
585 u32 acx_trans_procs ACX_PACKED;
586 u32 decrypt_done ACX_PACKED;
587 u32 dma_0_done ACX_PACKED;
588 u32 dma_1_done ACX_PACKED;
589 u32 tx_exch_complet ACX_PACKED;
590 u32 commands ACX_PACKED;
591 u32 acx_rx_procs ACX_PACKED;
592 u32 hw_pm_mode_changes ACX_PACKED;
593 u32 host_acks ACX_PACKED;
594 u32 pci_pm ACX_PACKED;
595 u32 acm_wakeups ACX_PACKED;
597 u32 wep_key_count ACX_PACKED;
598 u32 wep_default_key_count ACX_PACKED;
599 u32 dot11_def_key_mib ACX_PACKED;
600 u32 wep_key_not_found ACX_PACKED;
601 u32 wep_decrypt_fail ACX_PACKED;
602 } fw_stats_t;
604 /* Firmware version struct */
606 typedef struct fw_ver {
607 u16 cmd ACX_PACKED;
608 u16 size ACX_PACKED;
609 char fw_id[20] ACX_PACKED;
610 u32 hw_id ACX_PACKED;
611 } fw_ver_t;
613 #define FW_ID_SIZE 20
616 /*--- WEP stuff --------------------------------------------------------------*/
617 #define DOT11_MAX_DEFAULT_WEP_KEYS 4
619 /* non-firmware struct, no packing necessary */
620 typedef struct wep_key {
621 size_t size; /* most often used member first */
622 u8 index;
623 u8 key[29];
624 u16 strange_filler;
625 } wep_key_t; /* size = 264 bytes (33*8) */
626 /* FIXME: We don't have size 264! Or is there 2 bytes beyond the key
627 * (strange_filler)? */
629 /* non-firmware struct, no packing necessary */
630 typedef struct key_struct {
631 u8 addr[ETH_ALEN]; /* 0x00 */
632 u16 filler1; /* 0x06 */
633 u32 filler2; /* 0x08 */
634 u32 index; /* 0x0c */
635 u16 len; /* 0x10 */
636 u8 key[29]; /* 0x12; is this long enough??? */
637 } key_struct_t; /* size = 276. FIXME: where is the remaining space?? */
640 /*--- Client (peer) info -----------------------------------------------------*/
641 /* priv->sta_list[] is used for:
642 ** accumulating and processing of scan results
643 ** keeping client info in AP mode
644 ** keeping AP info in STA mode (AP is the only one 'client')
645 ** keeping peer info in ad-hoc mode
646 ** non-firmware struct --> no packing necessary */
647 enum {
648 CLIENT_EMPTY_SLOT_0 = 0,
649 CLIENT_EXIST_1 = 1,
650 CLIENT_AUTHENTICATED_2 = 2,
651 CLIENT_ASSOCIATED_3 = 3,
652 CLIENT_JOIN_CANDIDATE = 4
654 struct client {
655 struct client* next;
656 unsigned long mtime; /* last time we heard it, in jiffies */
657 size_t essid_len; /* length of ESSID (without '\0') */
658 u32 sir; /* Standard IR */
659 u32 snr; /* Signal to Noise Ratio */
660 u16 aid; /* association ID */
661 u16 seq; /* from client's auth req */
662 u16 auth_alg; /* from client's auth req */
663 u16 cap_info; /* from client's assoc req */
664 u16 rate_cap; /* what client supports (all rates) */
665 u16 rate_bas; /* what client supports (basic rates) */
666 u16 rate_cfg; /* what is allowed (by iwconfig etc) */
667 u16 rate_cur; /* currently used rate mask */
668 u8 rate_100; /* currently used rate byte (acx100 only) */
669 u8 used; /* misnamed, more like 'status' */
670 u8 address[ETH_ALEN];
671 u8 bssid[ETH_ALEN]; /* ad-hoc hosts can have bssid != mac */
672 u8 channel;
673 u8 auth_step;
674 u8 ignore_count;
675 u8 fallback_count;
676 u8 stepup_count;
677 char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID and trailing '\0' */
678 /* FIXME: this one is too damn big */
679 char challenge_text[WLAN_CHALLENGE_LEN];
683 /*============================================================================*
684 * Hardware structures *
685 *============================================================================*/
687 /* An opaque typesafe helper type
689 * Some hardware fields are actually pointers,
690 * but they have to remain u32, since using ptr instead
691 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
692 * format the acx firmware expects in the non-user area.
693 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
694 * enforce that pointed to data remains in low memory
695 * (address value needs to fit in 4 bytes) on 64bit systems.
697 * This is easy to get wrong, thus we are using a small struct
698 * and special macros to access it. Macros will check for
699 * attempts to overflow an acx_ptr with value > 0xffffffff.
701 * Attempts to use acx_ptr without macros result in compile-time errors */
703 typedef struct {
704 u32 v ACX_PACKED;
705 } acx_ptr;
707 #if ACX_DEBUG
708 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
709 #else
710 #define CHECK32(n) ((void)0)
711 #endif
713 /* acx_ptr <-> integer conversion */
714 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
715 #define acx2cpu(a) (le32_to_cpu(a.v))
717 /* acx_ptr <-> pointer conversion */
718 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
719 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
721 /* Values for rate field (acx100 only) */
722 #define RATE100_1 10
723 #define RATE100_2 20
724 #define RATE100_5 55
725 #define RATE100_11 110
726 #define RATE100_22 220
727 /* This bit denotes use of PBCC:
728 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
729 #define RATE100_PBCC511 0x80
731 /* Bit values for rate111 field */
732 #define RATE111_1 0x0001 /* DBPSK */
733 #define RATE111_2 0x0002 /* DQPSK */
734 #define RATE111_5 0x0004 /* CCK or PBCC */
735 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
736 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
737 #define RATE111_11 0x0020 /* CCK or PBCC */
738 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
739 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
740 #define RATE111_22 0x0100 /* PBCC */
741 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
742 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
743 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
744 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
745 #define RATE111_RESERVED 0x2000
746 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
747 #define RATE111_SHORTPRE 0x8000 /* short preamble */
748 /* Special 'try everything' value */
749 #define RATE111_ALL 0x1fff
750 /* These bits denote acx100 compatible settings */
751 #define RATE111_ACX100_COMPAT 0x0127
752 /* These bits denote 802.11b compatible settings */
753 #define RATE111_80211B_COMPAT 0x0027
755 /* Descriptor Ctl field bits
756 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
758 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
759 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
760 #define DESC_CTL_AUTODMA 0x04
761 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
762 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
763 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
764 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
765 #define DESC_CTL_HOSTOWN 0x80
767 #define DESC_CTL_INIT (DESC_CTL_HOSTOWN | DESC_CTL_RECLAIM | \
768 DESC_CTL_AUTODMA | DESC_CTL_FIRSTFRAG)
769 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
771 /* Descriptor Status field
773 #define DESC_STATUS_FULL (1 << 31)
775 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
776 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
777 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
778 #define DESC_CTL2_MORE_FRAG 0x04
779 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
780 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
781 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
782 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
783 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
785 /***************************************************************
786 ** PCI structures
788 /* IRQ Constants
789 ** (outside of "#ifdef PCI" because USB (mis)uses HOST_INT_SCAN_COMPLETE) */
790 #define HOST_INT_RX_DATA 0x0001
791 #define HOST_INT_TX_COMPLETE 0x0002
792 #define HOST_INT_TX_XFER 0x0004
793 #define HOST_INT_RX_COMPLETE 0x0008
794 #define HOST_INT_DTIM 0x0010
795 #define HOST_INT_BEACON 0x0020
796 #define HOST_INT_TIMER 0x0040
797 #define HOST_INT_KEY_NOT_FOUND 0x0080
798 #define HOST_INT_IV_ICV_FAILURE 0x0100
799 #define HOST_INT_CMD_COMPLETE 0x0200
800 #define HOST_INT_INFO 0x0400
801 #define HOST_INT_OVERFLOW 0x0800
802 #define HOST_INT_PROCESS_ERROR 0x1000
803 #define HOST_INT_SCAN_COMPLETE 0x2000
804 #define HOST_INT_FCS_THRESHOLD 0x4000
805 #define HOST_INT_UNKNOWN 0x8000
807 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
808 ** of txdesc and rxdesc: */
809 struct txdesc {
810 acx_ptr pNextDesc ACX_PACKED; /* pointer to next txdesc */
811 acx_ptr HostMemPtr ACX_PACKED; /* 0x04 */
812 acx_ptr AcxMemPtr ACX_PACKED; /* 0x08 */
813 u32 tx_time ACX_PACKED; /* 0x0c */
814 u16 total_length ACX_PACKED; /* 0x10 */
815 u16 Reserved ACX_PACKED; /* 0x12 */
817 /* The following 16 bytes do not change when acx100 owns the descriptor */
818 /* BUG: fw clears last byte of this area which is supposedly reserved
819 ** for driver use. amd64 blew up. We dare not use it now */
820 u32 dummy[4] ACX_PACKED;
822 u8 Ctl_8 ACX_PACKED; /* 0x24, 8bit value */
823 u8 Ctl2_8 ACX_PACKED; /* 0x25, 8bit value */
824 u8 error ACX_PACKED; /* 0x26 */
825 u8 ack_failures ACX_PACKED; /* 0x27 */
826 u8 rts_failures ACX_PACKED; /* 0x28 */
827 u8 rts_ok ACX_PACKED; /* 0x29 */
828 union {
829 struct {
830 u8 rate ACX_PACKED; /* 0x2a */
831 u8 queue_ctrl ACX_PACKED; /* 0x2b */
832 } r1 ACX_PACKED;
833 struct {
834 u16 rate111 ACX_PACKED; /* 0x2a */
835 } r2 ACX_PACKED;
836 } u ACX_PACKED;
837 u32 queue_info ACX_PACKED; /* 0x2c (acx100, reserved on acx111) */
838 }; /* size : 48 = 0x30 */
839 /* NB: acx111 txdesc structure is 4 byte larger */
840 /* All these 4 extra bytes are reserved. tx alloc code takes them into account */
842 struct rxdesc {
843 acx_ptr pNextDesc ACX_PACKED; /* 0x00 */
844 acx_ptr HostMemPtr ACX_PACKED; /* 0x04 */
845 acx_ptr ACXMemPtr ACX_PACKED; /* 0x08 */
846 u32 rx_time ACX_PACKED; /* 0x0c */
847 u16 total_length ACX_PACKED; /* 0x10 */
848 u16 WEP_length ACX_PACKED; /* 0x12 */
849 u32 WEP_ofs ACX_PACKED; /* 0x14 */
851 /* the following 16 bytes do not change when acx100 owns the descriptor */
852 u8 driverWorkspace[16] ACX_PACKED; /* 0x18 */
854 u8 Ctl_8 ACX_PACKED;
855 u8 rate ACX_PACKED;
856 u8 error ACX_PACKED;
857 u8 SNR ACX_PACKED; /* Signal-to-Noise Ratio */
858 u8 RxLevel ACX_PACKED;
859 u8 queue_ctrl ACX_PACKED;
860 u16 unknown ACX_PACKED;
861 u32 unknown2 ACX_PACKED;
862 }; /* size 52 = 0x34 */
864 #ifdef ACX_PCI
866 /* Register I/O offsets */
867 #define ACX100_EEPROM_ID_OFFSET 0x380
869 /* please add further ACX hardware register definitions only when
870 it turns out you need them in the driver, and please try to use
871 firmware functionality instead, since using direct I/O access instead
872 of letting the firmware do it might confuse the firmware's state
873 machine */
875 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
876 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
877 enum {
878 IO_ACX_SOFT_RESET = 0,
880 IO_ACX_SLV_MEM_ADDR,
881 IO_ACX_SLV_MEM_DATA,
882 IO_ACX_SLV_MEM_CTL,
883 IO_ACX_SLV_END_CTL,
885 IO_ACX_FEMR, /* Function Event Mask */
887 IO_ACX_INT_TRIG,
888 IO_ACX_IRQ_MASK,
889 IO_ACX_IRQ_STATUS_NON_DES,
890 IO_ACX_IRQ_STATUS_CLEAR, /* CLEAR = clear on read */
891 IO_ACX_IRQ_ACK,
892 IO_ACX_HINT_TRIG,
894 IO_ACX_ENABLE,
896 IO_ACX_EEPROM_CTL,
897 IO_ACX_EEPROM_ADDR,
898 IO_ACX_EEPROM_DATA,
899 IO_ACX_EEPROM_CFG,
901 IO_ACX_PHY_ADDR,
902 IO_ACX_PHY_DATA,
903 IO_ACX_PHY_CTL,
905 IO_ACX_GPIO_OE,
907 IO_ACX_GPIO_OUT,
909 IO_ACX_CMD_MAILBOX_OFFS,
910 IO_ACX_INFO_MAILBOX_OFFS,
911 IO_ACX_EEPROM_INFORMATION,
913 IO_ACX_EE_START,
914 IO_ACX_SOR_CFG,
915 IO_ACX_ECPU_CTRL
917 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
918 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
920 /* Values for IO_ACX_INT_TRIG register: */
921 /* inform hw that rxdesc in queue needs processing */
922 #define INT_TRIG_RXPRC 0x08
923 /* inform hw that txdesc in queue needs processing */
924 #define INT_TRIG_TXPRC 0x04
925 /* ack that we received info from info mailbox */
926 #define INT_TRIG_INFOACK 0x02
927 /* inform hw that we have filled command mailbox */
928 #define INT_TRIG_CMD 0x01
930 struct txhostdesc {
931 acx_ptr data_phy ACX_PACKED; /* 0x00 [u8 *] */
932 u16 data_offset ACX_PACKED; /* 0x04 */
933 u16 reserved ACX_PACKED; /* 0x06 */
934 u16 Ctl_16 ACX_PACKED; /* 16bit value, endianness!! */
935 u16 length ACX_PACKED; /* 0x0a */
936 acx_ptr desc_phy_next ACX_PACKED; /* 0x0c [txhostdesc *] */
937 acx_ptr pNext ACX_PACKED; /* 0x10 [txhostdesc *] */
938 u32 Status ACX_PACKED; /* 0x14, unused on Tx */
939 /* From here on you can use this area as you want (variable length, too!) */
940 u8 *data ACX_PACKED;
943 struct rxhostdesc {
944 acx_ptr data_phy ACX_PACKED; /* 0x00 [rxbuffer_t *] */
945 u16 data_offset ACX_PACKED; /* 0x04 */
946 u16 reserved ACX_PACKED; /* 0x06 */
947 u16 Ctl_16 ACX_PACKED; /* 0x08; 16bit value, endianness!! */
948 u16 length ACX_PACKED; /* 0x0a */
949 acx_ptr desc_phy_next ACX_PACKED; /* 0x0c [rxhostdesc_t *] */
950 acx_ptr pNext ACX_PACKED; /* 0x10 [rxhostdesc_t *] */
951 u32 Status ACX_PACKED; /* 0x14 */
952 /* From here on you can use this area as you want (variable length, too!) */
953 rxbuffer_t *data ACX_PACKED;
956 #endif /* ACX_PCI */
958 /***************************************************************
959 ** USB structures and constants
961 #ifdef ACX_USB
963 /* Buffer size for fw upload */
964 #define ACX100_USB_RWMEM_MAXLEN 2048
966 /* Should be sent to the ctrlout endpoint */
967 #define ACX100_USB_ENBULKIN 6
969 /* The number of bulk URBs to use */
970 #define ACX100_USB_NUM_BULK_URBS 8
972 /* Should be sent to the bulkout endpoint */
973 #define ACX_USB_REQ_UPLOAD_FW 0x10
974 #define ACX_USB_REQ_ACK_CS 0x11
975 #define ACX_USB_REQ_CMD 0x12
977 /* Used for usb_txbuffer.desc field */
978 #define USB_TXBUF_TXDESC 0xA
979 /* Used for usb_txbuffer.hostData field */
980 #define USB_TXBUF_HD_ISDATA 0x10000
981 #define USB_TXBUF_HD_DIRECTED 0x20000
982 #define USB_TXBUF_HD_BROADCAST 0x40000
983 /* Size of header (everything up to data[]) */
984 #define USB_TXBUF_HDRSIZE 14
985 typedef struct usb_txbuffer {
986 u16 desc ACX_PACKED;
987 u16 MPDUlen ACX_PACKED;
988 u8 index ACX_PACKED;
989 u8 txRate ACX_PACKED;
990 u32 hostData ACX_PACKED;
991 u8 ctrl1 ACX_PACKED;
992 u8 ctrl2 ACX_PACKED;
993 u16 dataLength ACX_PACKED;
994 /* wlan packet content is placed here: */
995 u8 data[WLAN_A4FR_MAXLEN_WEP_FCS] ACX_PACKED;
996 } usb_txbuffer_t;
998 typedef struct usb_tx {
999 unsigned busy:1;
1000 struct urb *urb;
1001 wlandevice_t *priv;
1002 client_t *txc;
1003 /* actual USB bulk output data block is here: */
1004 usb_txbuffer_t bulkout;
1005 } usb_tx_t;
1007 typedef struct usb_rx {
1008 unsigned busy:1;
1009 struct urb *urb;
1010 wlandevice_t *priv;
1011 rxbuffer_t bulkin;
1012 } usb_rx_t;
1013 #endif /* ACX_USB */
1016 /*============================================================================*
1017 * Main acx per-device data structure (netdev_priv(dev)) *
1018 *============================================================================*/
1019 #define ACX_STATE_FW_LOADED 0x01
1020 #define ACX_STATE_IFACE_UP 0x02
1022 /* MAC mode (BSS type) defines
1023 * Note that they shouldn't be redefined, since they are also used
1024 * during communication with firmware */
1025 #define ACX_MODE_0_ADHOC 0
1026 #define ACX_MODE_1_UNUSED 1
1027 #define ACX_MODE_2_STA 2
1028 #define ACX_MODE_3_AP 3
1029 /* These are our own inventions. Sending these to firmware
1030 ** makes it stop emitting beacons, which is exactly what we want
1031 ** for these modes */
1032 #define ACX_MODE_MONITOR 0xfe
1033 #define ACX_MODE_OFF 0xff
1034 /* 'Submode': identifies exact status of ADHOC/STA host */
1035 #define ACX_STATUS_0_STOPPED 0
1036 #define ACX_STATUS_1_SCANNING 1
1037 #define ACX_STATUS_2_WAIT_AUTH 2
1038 #define ACX_STATUS_3_AUTHENTICATED 3
1039 #define ACX_STATUS_4_ASSOCIATED 4
1041 /* FIXME: this should be named something like struct acx_priv (typedef'd to
1042 * acx_priv_t) */
1044 /* non-firmware struct, no packing necessary */
1045 struct wlandevice {
1046 /*** Device chain ***/
1047 struct wlandevice *next; /* link for list of devices */
1049 /*** Linux network device ***/
1050 struct net_device *netdev; /* pointer to linux netdevice */
1051 struct net_device *prev_nd; /* FIXME: We should not chain via our
1052 * private struct wlandevice _and_
1053 * the struct net_device. */
1054 /*** Device statistics ***/
1055 struct net_device_stats stats; /* net device statistics */
1056 #ifdef WIRELESS_EXT
1057 struct iw_statistics wstats; /* wireless statistics */
1058 #endif
1059 /*** Power managment ***/
1060 struct pm_dev *pm; /* PM crap */
1062 /*** Management timer ***/
1063 struct timer_list mgmt_timer;
1065 /*** Locking ***/
1066 struct semaphore sem;
1067 spinlock_t lock;
1068 #if defined(PARANOID_LOCKING) /* Lock debugging */
1069 const char *last_sem;
1070 const char *last_lock;
1071 unsigned long sem_time;
1072 unsigned long lock_time;
1073 #endif
1075 /*** Hardware identification ***/
1076 const char *chip_name;
1077 u8 dev_type;
1078 u8 chip_type;
1079 u8 form_factor;
1080 u8 radio_type;
1081 u8 eeprom_version;
1083 /*** Firmware identification ***/
1084 char firmware_version[FW_ID_SIZE+1];
1085 u32 firmware_numver;
1086 u32 firmware_id;
1088 /*** Device state ***/
1089 u16 dev_state_mask;
1090 u8 led_power; /* power LED status */
1091 u32 get_mask; /* mask of settings to fetch from the card */
1092 u32 set_mask; /* mask of settings to write to the card */
1094 /* Barely used in USB case */
1095 u16 irq_status;
1097 u8 after_interrupt_jobs; /* mini job list for doing actions after an interrupt occurred */
1098 WORK_STRUCT after_interrupt_task; /* our task for after interrupt actions */
1100 /*** scanning ***/
1101 u16 scan_count; /* number of times to do channel scan */
1102 u8 scan_mode; /* 0 == active, 1 == passive, 2 == background */
1103 u8 scan_rate;
1104 u16 scan_duration;
1105 u16 scan_probe_delay;
1106 #if WIRELESS_EXT > 15
1107 struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
1108 #endif
1110 /*** Wireless network settings ***/
1111 /* copy of the device address (ifconfig hw ether) that we actually use
1112 ** for 802.11; copied over from the network device's MAC address
1113 ** (ifconfig) when it makes sense only */
1114 u8 dev_addr[MAX_ADDR_LEN];
1115 u8 bssid[ETH_ALEN]; /* the BSSID after having joined */
1116 u8 ap[ETH_ALEN]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
1117 u16 aid; /* The Association ID sent from the AP / last used AID if we're an AP */
1118 u16 mode; /* mode from iwconfig */
1119 u16 status; /* 802.11 association status */
1120 u8 essid_active; /* specific ESSID active, or select any? */
1121 u8 essid_len; /* to avoid dozens of strlen() */
1122 /* INCLUDES \0 termination for easy printf - but many places
1123 ** simply want the string data memcpy'd plus a length indicator!
1124 ** Keep that in mind... */
1125 char essid[IW_ESSID_MAX_SIZE+1];
1126 /* essid we are going to use for association, in case of "essid 'any'"
1127 ** and in case of hidden ESSID (use configured ESSID then) */
1128 char essid_for_assoc[IW_ESSID_MAX_SIZE+1];
1129 char nick[IW_ESSID_MAX_SIZE+1]; /* see essid! */
1130 u8 channel;
1131 u8 reg_dom_id; /* reg domain setting */
1132 u16 reg_dom_chanmask;
1133 u16 auth_or_assoc_retries;
1134 u16 scan_retries;
1135 unsigned long scan_start; /* YES, jiffies is defined as "unsigned long" */
1137 /* stations known to us (if we're an ap) */
1138 client_t sta_list[32]; /* tab is larger than list, so that */
1139 client_t *sta_hash_tab[64]; /* hash collisions are not likely */
1140 client_t *ap_client; /* this one is our AP (STA mode only) */
1142 unsigned long dup_msg_expiry;
1143 int dup_count;
1144 int nondup_count;
1145 u16 last_seq_ctrl; /* duplicate packet detection */
1147 /* 802.11 power save mode */
1148 u8 ps_wakeup_cfg;
1149 u8 ps_listen_interval;
1150 u8 ps_options;
1151 u8 ps_hangover_period;
1152 u16 ps_enhanced_transition_time;
1154 /*** PHY settings ***/
1155 u8 fallback_threshold;
1156 u8 stepup_threshold;
1157 u16 rate_basic;
1158 u16 rate_oper;
1159 u16 rate_bcast;
1160 u16 rate_bcast100;
1161 u8 rate_auto; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
1162 u8 preamble_mode; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
1163 u8 preamble_cur;
1165 u8 tx_disabled;
1166 u8 tx_level_dbm;
1167 /* u8 tx_level_val; */
1168 /* u8 tx_level_auto; whether to do automatic power adjustment */
1170 unsigned long recalib_time_last_success;
1171 unsigned long recalib_time_last_attempt;
1172 int recalib_failure_count;
1173 int recalib_msg_ratelimit;
1174 int retry_errors_msg_ratelimit;
1176 unsigned long brange_time_last_state_change; /* time the power LED was last changed */
1177 u8 brange_last_state; /* last state of the LED */
1178 u8 brange_max_quality; /* maximum quality that equates to full speed */
1180 u8 sensitivity;
1181 u8 antenna; /* antenna settings */
1182 u8 ed_threshold; /* energy detect threshold */
1183 u8 cca; /* clear channel assessment */
1185 u16 rts_threshold;
1186 u32 short_retry;
1187 u32 long_retry;
1188 u16 msdu_lifetime;
1189 u16 listen_interval; /* given in units of beacon interval */
1190 u32 beacon_interval;
1192 u16 capabilities;
1193 u8 capab_short;
1194 u8 capab_pbcc;
1195 u8 capab_agility;
1196 u8 rate_supported_len;
1197 u8 rate_supported[13];
1199 /*** Encryption settings (WEP) ***/
1200 u32 auth_alg; /* used in transmit_authen1 */
1201 u8 wep_enabled;
1202 u8 wep_restricted;
1203 u8 wep_current_index;
1204 wep_key_t wep_keys[DOT11_MAX_DEFAULT_WEP_KEYS]; /* the default WEP keys */
1205 key_struct_t wep_key_struct[10];
1207 /*** Card Rx/Tx management ***/
1208 u16 rx_config_1;
1209 u16 rx_config_2;
1210 u16 memblocksize;
1211 int tx_free;
1213 /*** Unknown ***/
1214 u8 dtim_interval;
1216 /*** PCI/USB/... must be last or else hw agnostic code breaks horribly ***/
1217 /* hack to let common code compile. FIXME */
1218 dma_addr_t rxhostdesc_startphy;
1220 /*** PCI stuff ***/
1221 #ifdef ACX_PCI
1222 /* pointers to tx buffers, tx host descriptors (in host memory)
1223 ** and tx descs in device memory */
1224 u8 *txbuf_start;
1225 txhostdesc_t *txhostdesc_start;
1226 txdesc_t *txdesc_start; /* points to PCI-mapped memory */
1227 /* same for rx */
1228 rxbuffer_t *rxbuf_start;
1229 rxhostdesc_t *rxhostdesc_start;
1230 rxdesc_t *rxdesc_start;
1231 /* physical addresses of above host memory areas */
1232 dma_addr_t rxbuf_startphy;
1233 /* dma_addr_t rxhostdesc_startphy; */
1234 dma_addr_t txbuf_startphy;
1235 dma_addr_t txhostdesc_startphy;
1236 /* sizes of above host memory areas */
1237 unsigned int txbuf_area_size;
1238 unsigned int txhostdesc_area_size;
1239 unsigned int rxbuf_area_size;
1240 unsigned int rxhostdesc_area_size;
1242 unsigned int txdesc_size; /* size per tx descr; ACX111 = ACX100 + 4 */
1243 unsigned int tx_head; /* current ring buffer pool member index */
1244 unsigned int tx_tail;
1245 unsigned int rx_tail;
1247 client_t *txc[TX_CNT];
1249 u8 need_radio_fw;
1250 u8 irqs_active; /* whether irq sending is activated */
1252 const u16 *io; /* points to ACX100 or ACX111 I/O register address set */
1254 struct pci_dev *pdev;
1256 unsigned long membase;
1257 unsigned long membase2;
1258 void *iobase;
1259 void *iobase2;
1261 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
1262 /* 2.6.9-rc3-mm2 (2.6.9-bk4, too) introduced a shorter API version,
1263 then it made its way into 2.6.10 */
1264 u32 pci_state[16]; /* saved PCI state for suspend/resume */
1265 #endif
1266 u16 irq_mask; /* interrupt types to mask out (not wanted) with many IRQs activated */
1267 u16 irq_mask_off; /* interrupt types to mask out (not wanted) with IRQs off */
1268 unsigned int irq_loops_this_jiffy;
1269 unsigned long irq_last_jiffies;
1271 /* command interface */
1272 void *cmd_area; /* points to PCI mapped memory */
1273 void *info_area; /* points to PCI mapped memory */
1274 u16 cmd_type;
1275 u16 cmd_status;
1276 u16 info_type;
1277 u16 info_status;
1278 #endif
1280 /*** USB stuff ***/
1281 #ifdef ACX_USB
1282 struct usb_device *usbdev;
1284 rxbuffer_t rxtruncbuf;
1286 usb_tx_t *usb_tx;
1287 usb_rx_t *usb_rx;
1289 int bulkinep; /* bulk-in endpoint */
1290 int bulkoutep; /* bulk-out endpoint */
1291 int rxtruncsize;
1292 #endif
1296 /* For use with ACX1xx_IE_RXCONFIG */
1297 /* bit description
1298 * 13 include additional header (length etc.) *required*
1299 * struct is defined in 'struct rxbuffer'
1300 * is this bit acx100 only? does acx111 always put the header,
1301 * and bit setting is irrelevant? --vda
1302 * 10 receive frames only with SSID used in last join cmd
1303 * 9 discard broadcast
1304 * 8 receive packets for multicast address 1
1305 * 7 receive packets for multicast address 0
1306 * 6 discard all multicast packets
1307 * 5 discard frames from foreign BSSID
1308 * 4 discard frames with foreign destination MAC address
1309 * 3 promiscuous mode (receive ALL frames, disable filter)
1310 * 2 include FCS
1311 * 1 include phy header
1312 * 0 ???
1314 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1315 #define RX_CFG1_FILTER_SSID 0x0400
1316 #define RX_CFG1_FILTER_BCAST 0x0200
1317 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1318 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1319 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1320 #define RX_CFG1_FILTER_BSSID 0x0020
1321 #define RX_CFG1_FILTER_MAC 0x0010
1322 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1323 #define RX_CFG1_INCLUDE_FCS 0x0004
1324 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1325 /* bit description
1326 * 11 receive association requests etc.
1327 * 10 receive authentication frames
1328 * 9 receive beacon frames
1329 * 8 receive contention free packets
1330 * 7 receive control frames
1331 * 6 receive data frames
1332 * 5 receive broken frames
1333 * 4 receive management frames
1334 * 3 receive probe requests
1335 * 2 receive probe responses
1336 * 1 receive RTS/CTS/ACK frames
1337 * 0 receive other
1339 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1340 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1341 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1342 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1343 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1344 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1345 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1346 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1347 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1348 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1349 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1350 #define RX_CFG2_RCV_OTHER 0x0001
1352 /* For use with ACX1xx_IE_FEATURE_CONFIG */
1353 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1354 #define FEATURE1_4X 0x00000020L
1355 #define FEATURE1_LOW_RX 0x00000008L
1356 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1358 #define FEATURE2_SNIFFER 0x00000080L
1359 #define FEATURE2_NO_TXCRYPT 0x00000001L
1361 /*-- get and set mask values --*/
1362 #define GETSET_LED_POWER 0x00000001L
1363 #define GETSET_STATION_ID 0x00000002L
1364 #define SET_TEMPLATES 0x00000004L
1365 #define SET_STA_LIST 0x00000008L
1366 #define GETSET_TX 0x00000010L
1367 #define GETSET_RX 0x00000020L
1368 #define SET_RXCONFIG 0x00000040L
1369 #define GETSET_ANTENNA 0x00000080L
1370 #define GETSET_SENSITIVITY 0x00000100L
1371 #define GETSET_TXPOWER 0x00000200L
1372 #define GETSET_ED_THRESH 0x00000400L
1373 #define GETSET_CCA 0x00000800L
1374 #define GETSET_POWER_80211 0x00001000L
1375 #define GETSET_RETRY 0x00002000L
1376 #define GETSET_REG_DOMAIN 0x00004000L
1377 #define GETSET_CHANNEL 0x00008000L
1378 /* Used when ESSID changes etc and we need to scan for AP anew */
1379 #define GETSET_RESCAN 0x00010000L
1380 #define GETSET_MODE 0x00020000L
1381 #define GETSET_WEP 0x00040000L
1382 #define SET_WEP_OPTIONS 0x00080000L
1383 #define SET_MSDU_LIFETIME 0x00100000L
1384 #define SET_RATE_FALLBACK 0x00200000L
1385 #define GETSET_ALL 0x80000000L
1388 /*============================================================================*
1389 * Firmware loading *
1390 *============================================================================*/
1391 /* Doh, 2.4.x also has CONFIG_FW_LOADER_MODULE
1392 * (but doesn't have the new device model yet which we require!)
1393 * FIXME: exact version that introduced new device handling? */
1394 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
1395 #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
1396 #define USE_FW_LOADER_26 1
1397 #define USE_FW_LOADER_LEGACY 0
1398 #else
1399 #define USE_FW_LOADER_26 0
1400 #define USE_FW_LOADER_LEGACY 1
1401 #endif
1402 #endif
1404 #if USE_FW_LOADER_26
1405 #include <linux/firmware.h> /* request_firmware() */
1406 #include <linux/pci.h> /* struct pci_device */
1407 #endif
1410 /***********************************************************************
1412 typedef struct acx100_ie_memblocksize {
1413 u16 type ACX_PACKED;
1414 u16 len ACX_PACKED;
1415 u16 size ACX_PACKED;
1416 } acx100_ie_memblocksize_t;
1418 typedef struct acx100_ie_queueconfig {
1419 u16 type ACX_PACKED;
1420 u16 len ACX_PACKED;
1421 u32 AreaSize ACX_PACKED;
1422 u32 RxQueueStart ACX_PACKED;
1423 u8 QueueOptions ACX_PACKED;
1424 u8 NumTxQueues ACX_PACKED;
1425 u8 NumRxDesc ACX_PACKED; /* for USB only */
1426 u8 pad1 ACX_PACKED;
1427 u32 QueueEnd ACX_PACKED;
1428 u32 HostQueueEnd ACX_PACKED; /* QueueEnd2 */
1429 u32 TxQueueStart ACX_PACKED;
1430 u8 TxQueuePri ACX_PACKED;
1431 u8 NumTxDesc ACX_PACKED;
1432 u16 pad2 ACX_PACKED;
1433 } acx100_ie_queueconfig_t;
1435 typedef struct acx111_ie_queueconfig {
1436 u16 type ACX_PACKED;
1437 u16 len ACX_PACKED;
1438 u32 tx_memory_block_address ACX_PACKED;
1439 u32 rx_memory_block_address ACX_PACKED;
1440 u32 rx1_queue_address ACX_PACKED;
1441 u32 reserved1 ACX_PACKED;
1442 u32 tx1_queue_address ACX_PACKED;
1443 u8 tx1_attributes ACX_PACKED;
1444 u16 reserved2 ACX_PACKED;
1445 u8 reserved3 ACX_PACKED;
1446 } acx111_ie_queueconfig_t;
1448 typedef struct acx100_ie_memconfigoption {
1449 u16 type ACX_PACKED;
1450 u16 len ACX_PACKED;
1451 u32 DMA_config ACX_PACKED;
1452 acx_ptr pRxHostDesc ACX_PACKED;
1453 u32 rx_mem ACX_PACKED;
1454 u32 tx_mem ACX_PACKED;
1455 u16 RxBlockNum ACX_PACKED;
1456 u16 TxBlockNum ACX_PACKED;
1457 } acx100_ie_memconfigoption_t;
1459 typedef struct acx111_ie_memoryconfig {
1460 u16 type ACX_PACKED;
1461 u16 len ACX_PACKED;
1462 u16 no_of_stations ACX_PACKED;
1463 u16 memory_block_size ACX_PACKED;
1464 u8 tx_rx_memory_block_allocation ACX_PACKED;
1465 u8 count_rx_queues ACX_PACKED;
1466 u8 count_tx_queues ACX_PACKED;
1467 u8 options ACX_PACKED;
1468 u8 fragmentation ACX_PACKED;
1469 u16 reserved1 ACX_PACKED;
1470 u8 reserved2 ACX_PACKED;
1472 /* start of rx1 block */
1473 u8 rx_queue1_count_descs ACX_PACKED;
1474 u8 rx_queue1_reserved1 ACX_PACKED;
1475 u8 rx_queue1_type ACX_PACKED; /* must be set to 7 */
1476 u8 rx_queue1_prio ACX_PACKED; /* must be set to 0 */
1477 acx_ptr rx_queue1_host_rx_start ACX_PACKED;
1478 /* end of rx1 block */
1480 /* start of tx1 block */
1481 u8 tx_queue1_count_descs ACX_PACKED;
1482 u8 tx_queue1_reserved1 ACX_PACKED;
1483 u8 tx_queue1_reserved2 ACX_PACKED;
1484 u8 tx_queue1_attributes ACX_PACKED;
1485 /* end of tx1 block */
1486 } acx111_ie_memoryconfig_t;
1488 typedef struct acx_ie_memmap {
1489 u16 type ACX_PACKED;
1490 u16 len ACX_PACKED;
1491 u32 CodeStart ACX_PACKED;
1492 u32 CodeEnd ACX_PACKED;
1493 u32 WEPCacheStart ACX_PACKED;
1494 u32 WEPCacheEnd ACX_PACKED;
1495 u32 PacketTemplateStart ACX_PACKED;
1496 u32 PacketTemplateEnd ACX_PACKED;
1497 u32 QueueStart ACX_PACKED;
1498 u32 QueueEnd ACX_PACKED;
1499 u32 PoolStart ACX_PACKED;
1500 u32 PoolEnd ACX_PACKED;
1501 } acx_ie_memmap_t;
1503 typedef struct acx111_ie_feature_config {
1504 u16 type ACX_PACKED;
1505 u16 len ACX_PACKED;
1506 u32 feature_options ACX_PACKED;
1507 u32 data_flow_options ACX_PACKED;
1508 } acx111_ie_feature_config_t;
1510 typedef struct acx111_ie_tx_level {
1511 u16 type ACX_PACKED;
1512 u16 len ACX_PACKED;
1513 u8 level ACX_PACKED;
1514 } acx111_ie_tx_level_t;
1516 #define PS_CFG_ENABLE 0x80
1517 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1518 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1519 #define PS_CFG_WAKEUP_BY_HOST 0x03
1520 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1521 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1522 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1524 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1525 ** in the TIM; newer firmwares only(?) */
1526 #define PS_OPT_ENA_ENHANCED_PS 0x04
1527 #define PS_OPT_STILL_RCV_BCASTS 0x01
1529 typedef struct acx100_ie_powermgmt {
1530 u32 type ACX_PACKED;
1531 u32 len ACX_PACKED;
1532 u8 wakeup_cfg ACX_PACKED;
1533 u8 listen_interval ACX_PACKED; /* for EACH_ITVL: wake up every "beacon units" interval */
1534 u8 options ACX_PACKED;
1535 u8 hangover_period ACX_PACKED; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1536 u16 enhanced_ps_transition_time ACX_PACKED; /* rem. wake time for Enh. PS */
1537 } acx100_ie_powermgmt_t;
1539 typedef struct acx111_ie_powermgmt {
1540 u32 type ACX_PACKED;
1541 u32 len ACX_PACKED;
1542 u8 wakeup_cfg ACX_PACKED;
1543 u8 listen_interval ACX_PACKED; /* for EACH_ITVL: wake up every "beacon units" interval */
1544 u8 options ACX_PACKED;
1545 u8 hangover_period ACX_PACKED; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1546 u32 beaconRxTime ACX_PACKED;
1547 u32 enhanced_ps_transition_time ACX_PACKED; /* rem. wake time for Enh. PS */
1548 } acx111_ie_powermgmt_t;
1551 /***********************************************************************
1552 ** Commands and template structures
1556 ** SCAN command structure
1558 ** even though acx100 scan rates match RATE100 constants,
1559 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1560 #define ACX_SCAN_RATE_1 10
1561 #define ACX_SCAN_RATE_2 20
1562 #define ACX_SCAN_RATE_5 55
1563 #define ACX_SCAN_RATE_11 110
1564 #define ACX_SCAN_RATE_22 220
1565 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1566 #define ACX_SCAN_OPT_PASSIVE 0x01
1567 /* Background scan: we go into Power Save mode (by transmitting
1568 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1569 ** and then exit Power Save mode. A plus is that AP buffers frames
1570 ** for us while we do background scan. Thus we avoid frame losses.
1571 ** Background scan can be active or passive, just like normal one */
1572 #define ACX_SCAN_OPT_BACKGROUND 0x02
1573 typedef struct acx100_scan {
1574 u16 count ACX_PACKED; /* number of scans to do, 0xffff == continuous */
1575 u16 start_chan ACX_PACKED;
1576 u16 flags ACX_PACKED; /* channel list mask; 0x8000 == all channels? */
1577 u8 max_rate ACX_PACKED; /* max. probe rate */
1578 u8 options ACX_PACKED; /* bit mask, see defines above */
1579 u16 chan_duration ACX_PACKED;
1580 u16 max_probe_delay ACX_PACKED;
1581 } acx100_scan_t; /* length 0xc */
1583 #define ACX111_SCAN_RATE_6 0x0B
1584 #define ACX111_SCAN_RATE_9 0x0F
1585 #define ACX111_SCAN_RATE_12 0x0A
1586 #define ACX111_SCAN_RATE_18 0x0E
1587 #define ACX111_SCAN_RATE_24 0x09
1588 #define ACX111_SCAN_RATE_36 0x0D
1589 #define ACX111_SCAN_RATE_48 0x08
1590 #define ACX111_SCAN_RATE_54 0x0C
1591 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1592 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1593 #define ACX111_SCAN_MOD_PBCC 0x80
1594 #define ACX111_SCAN_MOD_OFDM 0x40
1595 typedef struct acx111_scan {
1596 u16 count ACX_PACKED; /* number of scans to do */
1597 u8 channel_list_select ACX_PACKED; /* 0: scan all channels, 1: from chan_list only */
1598 u16 reserved1 ACX_PACKED;
1599 u8 reserved2 ACX_PACKED;
1600 u8 rate ACX_PACKED; /* rate for probe requests (if active scan) */
1601 u8 options ACX_PACKED; /* bit mask, see defines above */
1602 u16 chan_duration ACX_PACKED; /* min time to wait for reply on one channel (in TU) */
1603 /* (active scan only) (802.11 section 11.1.3.2.2) */
1604 u16 max_probe_delay ACX_PACKED; /* max time to wait for reply on one channel (active scan) */
1605 /* time to listen on a channel (passive scan) */
1606 u8 modulation ACX_PACKED;
1607 u8 channel_list[26] ACX_PACKED; /* bits 7:0 first byte: channels 8:1 */
1608 /* bits 7:0 second byte: channels 16:9 */
1609 /* 26 bytes is enough to cover 802.11a */
1610 } acx111_scan_t;
1614 ** Radio calibration command structure
1616 typedef struct acx111_cmd_radiocalib {
1617 /* 0x80000000 == automatic calibration by firmware, according to interval;
1618 * bits 0..3: select calibration methods to go through:
1619 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1620 u32 methods ACX_PACKED;
1621 u32 interval ACX_PACKED;
1622 } acx111_cmd_radiocalib_t;
1626 ** Packet template structures
1628 ** Packet templates store contents of Beacon, Probe response, Probe request,
1629 ** Null data frame, and TIM data frame. Firmware automatically transmits
1630 ** contents of template at appropriate time:
1631 ** - Beacon: when configured as AP or Ad-hoc
1632 ** - Probe response: when configured as AP or Ad-hoc, whenever
1633 ** a Probe request frame is received
1634 ** - Probe request: when host issues SCAN command (active)
1635 ** - Null data frame: when entering 802.11 power save mode
1636 ** - TIM data: at the end of Beacon frames (if no TIM template
1637 ** is configured, then transmits default TIM)
1638 ** NB:
1639 ** - size field must be set to size of actual template
1640 ** (NOT sizeof(struct) - templates are variable in length),
1641 ** size field is not itself counted.
1642 ** - members flagged with an asterisk must be initialized with host,
1643 ** rest must be zero filled.
1644 ** - variable length fields shown only in comments */
1645 typedef struct acx_template_tim {
1646 u16 size ACX_PACKED;
1647 u8 tim_eid ACX_PACKED; /* 00 1 TIM IE ID * */
1648 u8 len ACX_PACKED; /* 01 1 Length * */
1649 u8 dtim_cnt ACX_PACKED; /* 02 1 DTIM Count */
1650 u8 dtim_period ACX_PACKED; /* 03 1 DTIM Period */
1651 u8 bitmap_ctrl ACX_PACKED; /* 04 1 Bitmap Control * (except bit0) */
1652 /* 05 n Partial Virtual Bitmap * */
1653 u8 variable[0x100 - 1-1-1-1-1] ACX_PACKED;
1654 } acx_template_tim_t;
1656 typedef struct acx100_template_probereq {
1657 u16 size ACX_PACKED;
1658 u16 fc ACX_PACKED; /* 00 2 fc */
1659 u16 dur ACX_PACKED; /* 02 2 Duration */
1660 u8 da[6] ACX_PACKED; /* 04 6 Destination Address * */
1661 u8 sa[6] ACX_PACKED; /* 0A 6 Source Address * */
1662 u8 bssid[6] ACX_PACKED; /* 10 6 BSSID * */
1663 u16 seq ACX_PACKED; /* 16 2 Sequence Control */
1664 u8 timestamp[8] ACX_PACKED;/* 18 8 Timestamp */
1665 u16 beacon_interval ACX_PACKED; /* 20 2 Beacon Interval * */
1666 u16 cap ACX_PACKED; /* 22 2 Capability Information * */
1667 /* 24 n SSID * */
1668 /* nn n Supported Rates * */
1669 u8 variable[0x44 - 2-2-6-6-6-2-8-2-2] ACX_PACKED;
1670 } acx100_template_probereq_t;
1672 typedef struct acx111_template_probereq {
1673 u16 size ACX_PACKED;
1674 u16 fc ACX_PACKED; /* 00 2 fc * */
1675 u16 dur ACX_PACKED; /* 02 2 Duration */
1676 u8 da[6] ACX_PACKED; /* 04 6 Destination Address * */
1677 u8 sa[6] ACX_PACKED; /* 0A 6 Source Address * */
1678 u8 bssid[6] ACX_PACKED; /* 10 6 BSSID * */
1679 u16 seq ACX_PACKED; /* 16 2 Sequence Control */
1680 /* 18 n SSID * */
1681 /* nn n Supported Rates * */
1682 u8 variable[0x44 - 2-2-6-6-6-2] ACX_PACKED;
1683 } acx111_template_probereq_t;
1685 typedef struct acx_template_proberesp {
1686 u16 size ACX_PACKED;
1687 u16 fc ACX_PACKED; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1688 u16 dur ACX_PACKED; /* 02 2 Duration */
1689 u8 da[6] ACX_PACKED; /* 04 6 Destination Address */
1690 u8 sa[6] ACX_PACKED; /* 0A 6 Source Address */
1691 u8 bssid[6] ACX_PACKED; /* 10 6 BSSID */
1692 u16 seq ACX_PACKED; /* 16 2 Sequence Control */
1693 u8 timestamp[8] ACX_PACKED;/* 18 8 Timestamp */
1694 u16 beacon_interval ACX_PACKED; /* 20 2 Beacon Interval * */
1695 u16 cap ACX_PACKED; /* 22 2 Capability Information * */
1696 /* 24 n SSID * */
1697 /* nn n Supported Rates * */
1698 /* nn 1 DS Parameter Set * */
1699 u8 variable[0x54 - 2-2-6-6-6-2-8-2-2] ACX_PACKED;
1700 } acx_template_proberesp_t;
1701 #define acx_template_beacon_t acx_template_proberesp_t
1702 #define acx_template_beacon acx_template_proberesp
1704 typedef struct acx_template_nullframe {
1705 u16 size ACX_PACKED;
1706 struct wlan_hdr_a3 hdr ACX_PACKED;
1707 } acx_template_nullframe_t;
1711 ** JOIN command structure
1713 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1714 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1715 typedef struct acx_joinbss {
1716 u8 bssid[ETH_ALEN] ACX_PACKED;
1717 u16 beacon_interval ACX_PACKED;
1718 union {
1719 struct {
1720 u8 dtim_interval ACX_PACKED;
1721 u8 rates_basic ACX_PACKED;
1722 u8 rates_supported ACX_PACKED;
1723 } acx100 ACX_PACKED;
1724 struct {
1725 u16 rates_basic ACX_PACKED;
1726 u8 dtim_interval ACX_PACKED;
1727 } acx111 ACX_PACKED;
1728 } u ACX_PACKED;
1729 u8 genfrm_txrate ACX_PACKED; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1730 u8 genfrm_mod_pre ACX_PACKED; /* generated frame modulation/preamble:
1731 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1732 ** bit5: short pre */
1733 u8 macmode ACX_PACKED; /* BSS Type, must be one of ACX_MODE_xxx */
1734 u8 channel ACX_PACKED;
1735 u8 essid_len ACX_PACKED;
1736 char essid[IW_ESSID_MAX_SIZE] ACX_PACKED;
1737 } acx_joinbss_t;
1739 #define JOINBSS_RATES_1 0x01
1740 #define JOINBSS_RATES_2 0x02
1741 #define JOINBSS_RATES_5 0x04
1742 #define JOINBSS_RATES_11 0x08
1743 #define JOINBSS_RATES_22 0x10
1745 /* Looks like missing bits are used to indicate 11g rates!
1746 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1747 ** This was actually seen! Look at that Assoc Request sent by acx111,
1748 ** it _does_ contain 11g rates in basic set:
1749 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
1750 01:30:20.074425 Authentication (Open System)-1: Succesful
1751 01:30:20.076539 Authentication (Open System)-2:
1752 01:30:20.076620 Acknowledgment
1753 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]
1754 01:30:20.122413 Assoc Response AID(1) :: Succesful
1755 01:30:20.122679 Acknowledgment
1756 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
1758 #define JOINBSS_RATES_BASIC111_1 0x0001
1759 #define JOINBSS_RATES_BASIC111_2 0x0002
1760 #define JOINBSS_RATES_BASIC111_5 0x0004
1761 #define JOINBSS_RATES_BASIC111_11 0x0020
1762 #define JOINBSS_RATES_BASIC111_22 0x0100
1765 /***********************************************************************
1767 typedef struct mem_read_write {
1768 u16 addr ACX_PACKED;
1769 u16 type ACX_PACKED; /* 0x0 int. RAM / 0xffff MAC reg. / 0x81 PHY RAM / 0x82 PHY reg. */
1770 u32 len ACX_PACKED;
1771 u32 data ACX_PACKED;
1772 } mem_read_write_t;
1774 typedef struct firmware_image {
1775 u32 chksum ACX_PACKED;
1776 u32 size ACX_PACKED;
1777 u8 data[1] ACX_PACKED; /* the byte array of the actual firmware... */
1778 } firmware_image_t;
1780 typedef struct acx_cmd_radioinit {
1781 u32 offset ACX_PACKED;
1782 u32 len ACX_PACKED;
1783 } acx_cmd_radioinit_t;
1785 typedef struct acx100_ie_wep_options {
1786 u16 type ACX_PACKED;
1787 u16 len ACX_PACKED;
1788 u16 NumKeys ACX_PACKED; /* max # of keys */
1789 u8 WEPOption ACX_PACKED; /* 0 == decrypt default key only, 1 == override decrypt */
1790 u8 Pad ACX_PACKED; /* used only for acx111 */
1791 } acx100_ie_wep_options_t;
1793 typedef struct ie_dot11WEPDefaultKey {
1794 u16 type ACX_PACKED;
1795 u16 len ACX_PACKED;
1796 u8 action ACX_PACKED;
1797 u8 keySize ACX_PACKED;
1798 u8 defaultKeyNum ACX_PACKED;
1799 u8 key[29] ACX_PACKED; /* check this! was Key[19]. */
1800 } ie_dot11WEPDefaultKey_t;
1802 typedef struct acx111WEPDefaultKey {
1803 u8 MacAddr[ETH_ALEN] ACX_PACKED;
1804 u16 action ACX_PACKED; /* NOTE: this is a u16, NOT a u8!! */
1805 u16 reserved ACX_PACKED;
1806 u8 keySize ACX_PACKED;
1807 u8 type ACX_PACKED;
1808 u8 index ACX_PACKED;
1809 u8 defaultKeyNum ACX_PACKED;
1810 u8 counter[6] ACX_PACKED;
1811 u8 key[32] ACX_PACKED; /* up to 32 bytes (for TKIP!) */
1812 } acx111WEPDefaultKey_t;
1814 typedef struct ie_dot11WEPDefaultKeyID {
1815 u16 type ACX_PACKED;
1816 u16 len ACX_PACKED;
1817 u8 KeyID ACX_PACKED;
1818 } ie_dot11WEPDefaultKeyID_t;
1820 typedef struct acx100_cmd_wep_mgmt {
1821 u8 MacAddr[ETH_ALEN] ACX_PACKED;
1822 u16 Action ACX_PACKED;
1823 u16 KeySize ACX_PACKED;
1824 u8 Key[29] ACX_PACKED; /* 29*8 == 232bits == WEP256 */
1825 } acx100_cmd_wep_mgmt_t;
1827 typedef struct defaultkey {
1828 u8 num;
1829 } defaultkey_t;
1831 typedef struct acx_ie_generic {
1832 u16 type ACX_PACKED;
1833 u16 len ACX_PACKED;
1834 union {
1835 /* struct wep wp ACX_PACKED; */
1836 /* Association ID IE: just a 16bit value: */
1837 u16 aid;
1838 /* UNUSED? struct defaultkey dkey ACX_PACKED; */
1839 /* generic member for quick implementation of commands */
1840 u8 bytes[32] ACX_PACKED;
1841 } m ACX_PACKED;
1842 } acx_ie_generic_t;
1844 /* Config Option structs */
1846 typedef struct co_antennas {
1847 u8 type ACX_PACKED;
1848 u8 len ACX_PACKED;
1849 u8 list[2] ACX_PACKED;
1850 } co_antennas_t;
1852 typedef struct co_powerlevels {
1853 u8 type ACX_PACKED;
1854 u8 len ACX_PACKED;
1855 u16 list[8] ACX_PACKED;
1856 } co_powerlevels_t;
1858 typedef struct co_datarates {
1859 u8 type ACX_PACKED;
1860 u8 len ACX_PACKED;
1861 u8 list[8] ACX_PACKED;
1862 } co_datarates_t;
1864 typedef struct co_domains {
1865 u8 type ACX_PACKED;
1866 u8 len ACX_PACKED;
1867 u8 list[6] ACX_PACKED;
1868 } co_domains_t;
1870 typedef struct co_product_id {
1871 u8 type ACX_PACKED;
1872 u8 len ACX_PACKED;
1873 u8 list[128] ACX_PACKED;
1874 } co_product_id_t;
1876 typedef struct co_manuf_id {
1877 u8 type ACX_PACKED;
1878 u8 len ACX_PACKED;
1879 u8 list[128] ACX_PACKED;
1880 } co_manuf_t;
1882 typedef struct co_fixed {
1883 u8 type ACX_PACKED;
1884 u8 len ACX_PACKED;
1885 char NVSv[8] ACX_PACKED;
1886 u8 MAC[6] ACX_PACKED;
1887 u16 probe_delay ACX_PACKED;
1888 u32 eof_memory ACX_PACKED;
1889 u8 dot11CCAModes ACX_PACKED;
1890 u8 dot11Diversity ACX_PACKED;
1891 u8 dot11ShortPreambleOption ACX_PACKED;
1892 u8 dot11PBCCOption ACX_PACKED;
1893 u8 dot11ChannelAgility ACX_PACKED;
1894 u8 dot11PhyType ACX_PACKED;
1895 /* u8 dot11TempType ACX_PACKED;
1896 u8 num_var ACX_PACKED; seems to be erased */
1897 } co_fixed_t;
1900 typedef struct acx111_ie_configoption {
1901 co_fixed_t configoption_fixed ACX_PACKED;
1902 co_antennas_t antennas ACX_PACKED;
1903 co_powerlevels_t power_levels ACX_PACKED;
1904 co_datarates_t data_rates ACX_PACKED;
1905 co_domains_t domains ACX_PACKED;
1906 co_product_id_t product_id ACX_PACKED;
1907 co_manuf_t manufacturer ACX_PACKED;
1908 } acx111_ie_configoption_t;
1911 /***********************************************************************
1913 #define CHECK_SIZEOF(type,size) { \
1914 extern void BUG_bad_size_for_##type(void); \
1915 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
1918 static inline void
1919 acx_struct_size_check(void)
1921 CHECK_SIZEOF(txdesc_t, 0x30);
1922 CHECK_SIZEOF(acx100_ie_memconfigoption_t, 24);
1923 CHECK_SIZEOF(acx100_ie_queueconfig_t, 0x20);
1924 CHECK_SIZEOF(acx_joinbss_t, 0x30);
1928 /*============================================================================*
1929 * Global data *
1930 *============================================================================*/
1931 extern const u8 bitpos2ratebyte[];
1932 extern const u8 bitpos2rate100[];
1934 extern const u8 reg_domain_ids[];
1935 extern const u8 reg_domain_ids_len;
1937 extern const struct iw_handler_def acx_ioctl_handler_def;