awireg.h revision 1.2.2.2 1 /* $NetBSD: awireg.h,v 1.2.2.2 1999/11/05 05:13:37 sommerfeld Exp $ */
2
3 /*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Bill Sommerfeld
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * The firmware typically loaded onto Am79C930-based 802.11 interfaces
41 * uses a 32k or larger shared memory buffer to communicate with the
42 * host.
43 *
44 * Depending on the exact configuration of the device, this buffer may
45 * either be mapped into PCMCIA memory space, or accessible a byte at
46 * a type through PCMCIA I/O space.
47 *
48 * This header defines offsets into this shared memory.
49 */
50
51
52 /*
53 * LAST_TXD block. 5 32-bit words.
54 *
55 * There are five different output queues; this defines pointers to
56 * the last completed descriptor for each one.
57 */
58 #define AWI_LAST_TXD 0x3ec /* last completed Tx Descr */
59
60 #define AWI_LAST_BCAST_TXD AWI_LAST_TXD+0
61 #define AWI_LAST_MGT_TXD AWI_LAST_TXD+4
62 #define AWI_LAST_DATA_TXD AWI_LAST_TXD+8
63 #define AWI_LAST_PS_POLL_TXD AWI_LAST_TXD+12
64 #define AWI_LAST_CF_POLL_TXD AWI_LAST_TXD+16
65
66 /*
67 * Banner block; null-terminated string.
68 *
69 * The doc says it contains
70 * "PCnetMobile:v2.00 mmddyy APIx.x\0"
71 */
72
73 #define AWI_BANNER 0x480 /* Version string */
74 #define AWI_BANNER_LEN 0x20
75
76 /*
77 * Command block protocol:
78 * write command byte to a zero value.
79 * write command status to a zero value.
80 * write arguments to AWI_COMMAND_PARAMS
81 * write command byte to a non-zero value.
82 * wait for command status to be non-zero.
83 * write command byte to a zero value.
84 * write command status to a zero value.
85 */
86
87 #define AWI_CMD 0x4a0 /* Command opcode byte */
88
89 #define AWI_CMD_IDLE 0x0
90 #define AWI_CMD_NOP 0x1
91
92 #define AWI_CMD_SET_MIB 0x2
93 #define AWI_CMD_GET_MIB 0x9
94
95 #define AWI_CA_MIB_TYPE 0x0
96 #define AWI_CA_MIB_SIZE 0x1
97 #define AWI_CA_MIB_INDEX 0x2
98 #define AWI_CA_MIB_DATA 0x4
99
100 #define AWI_MIB_LOCAL 0x0
101 #define AWI_MIB_MAC_ADDR 0x2
102 #define AWI_MIB_MAC 0x3
103 #define AWI_MIB_MAC_STAT 0x4
104 #define AWI_MIB_MAC_MGT 0x5
105 #define AWI_MIB_DRVR_MAC 0x6
106 #define AWI_MIB_PHY 0x7
107
108 #define AWI_MIB_LAST AWI_MIB_PHY
109
110
111 #define AWI_CMD_INIT_TX 0x3
112
113 #define AWI_CA_TX_LEN 0x14
114 #define AWI_CA_TX_DATA 0x0
115 #define AWI_CA_TX_MGT 0x4
116 #define AWI_CA_TX_BCAST 0x8
117 #define AWI_CA_TX_PS 0xc
118 #define AWI_CA_TX_CF 0x10
119
120 #define AWI_CMD_FLUSH_TX 0x4
121
122 #define AWI_CA_FTX_LEN 0x5
123 #define AWI_CA_FTX_DATA 0x0
124 #define AWI_CA_FTX_MGT 0x1
125 #define AWI_CA_FTX_BCAST 0x2
126 #define AWI_CA_FTX_PS 0x3
127 #define AWI_CA_FTX_CF 0x4
128
129 #define AWI_CMD_INIT_RX 0x5
130 #define AWI_CA_IRX_LEN 0x8
131 #define AWI_CA_IRX_DATA_DESC 0x0 /* return */
132 #define AWI_CA_IRX_PS_DESC 0x4 /* return */
133
134 #define AWI_CMD_KILL_RX 0x6
135
136 #define AWI_CMD_SLEEP 0x7
137 #define AWI_CA_SLEEP_LEN 0x8
138 #define AWI_CA_WAKEUP 0x0 /* uint64 */
139
140 #define AWI_CMD_WAKE 0x8
141
142 #define AWI_CMD_SCAN 0xa
143 #define AWI_CA_SCAN_LEN 0x6
144 #define AWI_CA_SCAN_DURATION 0x0
145 #define AWI_CA_SCAN_SET 0x2
146 #define AWI_CA_SCAN_PATTERN 0x3
147 #define AWI_CA_SCAN_IDX 0x4
148 #define AWI_CA_SCAN_SUSP 0x5
149
150 #define AWI_CMD_SYNC 0xb
151 #define AWI_CA_SYNC_LEN 0x14
152 #define AWI_CA_SYNC_SET 0x0
153 #define AWI_CA_SYNC_PATTERN 0x1
154 #define AWI_CA_SYNC_IDX 0x2
155 #define AWI_CA_SYNC_STARTBSS 0x3
156 #define AWI_CA_SYNC_DWELL 0x4
157 #define AWI_CA_SYNC_MBZ 0x6
158 #define AWI_CA_SYNC_TIMESTAMP 0x8
159 #define AWI_CA_SYNC_REFTIME 0x10
160
161 #define AWI_CMD_RESUME 0xc
162
163 #define AWI_CMD_STATUS 0x4a1 /* Command status */
164
165 #define AWI_STAT_IDLE 0x0
166 #define AWI_STAT_OK 0x1
167 #define AWI_STAT_BADCMD 0x2
168 #define AWI_STAT_BADPARM 0x3
169 #define AWI_STAT_NOTIMP 0x4
170 #define AWI_STAT_BADRES 0x5
171 #define AWI_STAT_BADMODE 0x6
172
173 #define AWI_ERROR_OFFSET 0x4a2 /* Offset to erroneous parameter */
174 #define AWI_CMD_PARAMS 0x4a4 /* Command parameters */
175
176 #define AWI_CSB 0x4f0 /* Control/Status block */
177
178 #define AWI_SELFTEST 0x4f0
179
180 #define AWI_SELFTEST_INIT 0x00 /* initial */
181 #define AWI_SELFTEST_FIRMCKSUM 0x01 /* firmware cksum running */
182 #define AWI_SELFTEST_HARDWARE 0x02 /* hardware tests running */
183 #define AWI_SELFTEST_MIB 0x03 /* mib initializing */
184
185 #define AWI_SELFTEST_MIB_FAIL 0xfa
186 #define AWI_SELFTEST_RADIO_FAIL 0xfb
187 #define AWI_SELFTEST_MAC_FAIL 0xfc
188 #define AWI_SELFTEST_FLASH_FAIL 0xfd
189 #define AWI_SELFTEST_RAM_FAIL 0xfe
190 #define AWI_SELFTEST_PASSED 0xff
191
192 #define AWI_STA_STATE 0x4f1
193
194 #define AWI_STA_AP 0x20 /* acting as AP */
195 #define AWI_STA_NOPSP 0x10 /* Power Saving disabled */
196 #define AWI_STA_DOZE 0x08 /* about to go to sleep */
197 #define AWI_STA_PSP 0x04 /* enable PSP */
198 #define AWI_STA_RXEN 0x02 /* enable RX */
199 #define AWI_STA_TXEN 0x01 /* enable TX */
200
201 #define AWI_INTSTAT 0x4f3
202 #define AWI_INTMASK 0x4f4
203
204 /* Bits in AWI_INTSTAT/AWI_INTMASK */
205
206 #define AWI_INT_GROGGY 0x80 /* about to wake up */
207 #define AWI_INT_CFP_ENDING 0x40 /* cont. free period ending */
208 #define AWI_INT_DTIM 0x20 /* beacon outgoing */
209 #define AWI_INT_CFP_START 0x10 /* cont. free period starting */
210 #define AWI_INT_SCAN_CMPLT 0x08 /* scan complete */
211 #define AWI_INT_TX 0x04 /* tx done */
212 #define AWI_INT_RX 0x02 /* rx done */
213 #define AWI_INT_CMD 0x01 /* cmd done */
214
215 #define AWI_INT_BITS "\20\1CMD\2RX\3TX\4SCAN\5CFPST\6DTIM\7CFPE\10GROGGY"
216
217 /*
218 * The following are used to implement a locking protocol between host
219 * and MAC to protect the interrupt status and mask fields.
220 *
221 * driver: read lockout_host byte; if zero, set lockout_mac to non-zero,
222 * then reread lockout_host byte; if still zero, host has lock.
223 * if non-zero, clear lockout_mac, loop.
224 */
225
226 #define AWI_LOCKOUT_MAC 0x4f5
227 #define AWI_LOCKOUT_HOST 0x4f6
228
229
230 #define AWI_INTSTAT2 0x4f7
231 #define AWI_INTMASK2 0x4fd
232
233 /* Bits in AWI_INTSTAT2/INTMASK2 */
234 #define AWI_INT2_RXMGT 0x80 /* mgt/ps recieved */
235 #define AWI_INT2_RXDATA 0x40 /* data received */
236 #define AWI_INT2_TXMGT 0x10 /* mgt tx done */
237 #define AWI_INT2_TXCF 0x08f /* CF tx done */
238 #define AWI_INT2_TXPS 0x04 /* PS tx done */
239 #define AWI_INT2_TXBCAST 0x02 /* Broadcast tx done */
240 #define AWI_INT2_TXDATA 0x01 /* data tx done */
241
242 #define AWI_DIS_PWRDN 0x4fc /* disable powerdown if set */
243
244 #define AWI_DRIVERSTATE 0x4fe /* driver state */
245
246 #define AWI_DRV_STATEMASK 0x0f
247
248 #define AWI_DRV_RESET 0x0
249 #define AWI_DRV_INFSY 0x1 /* inf synced */
250 #define AWI_DRV_ADHSC 0x2 /* adhoc scan */
251 #define AWI_DRV_ADHSY 0x3 /* adhoc synced */
252 #define AWI_DRV_INFSC 0x4 /* inf scanning */
253 #define AWI_DRV_INFAUTH 0x5 /* inf authed */
254 #define AWI_DRV_INFASSOC 0x6 /* inf associated */
255 #define AWI_DRV_INFTOSS 0x7 /* inf handoff */
256 #define AWI_DRV_APNONE 0x8 /* AP activity: no assoc */
257 #define AWI_DRV_APQUIET 0xc /* AP: >=one assoc, no traffic */
258 #define AWI_DRV_APLO 0xd /* AP: >=one assoc, light tfc */
259 #define AWI_DRV_APMED 0xe /* AP: >=one assoc, mod tfc */
260 #define AWI_DRV_APHIGH 0xf /* AP: >=one assoc, heavy tfc */
261
262 #define AWI_DRV_AUTORXLED 0x10
263 #define AWI_DRV_AUTOTXLED 0x20
264 #define AWI_DRV_RXLED 0x40
265 #define AWI_DRV_TXLED 0x80
266
267 #define AWI_VBM 0x500 /* Virtual Bit Map */
268
269 #define AWI_BUFFERS 0x600 /* Buffers */
270
271 /*
272 * Receive descriptors; there are a linked list of these chained
273 * through the "NEXT" fields, starting from XXX
274 */
275
276 #define AWI_RXD_SIZE 0x18
277
278 #define AWI_RXD_NEXT 0x4
279 #define AWI_RXD_NEXT_LAST 0x80000000
280
281
282 #define AWI_RXD_HOST_DESC_STATE 0x9
283
284 #define AWI_RXD_ST_OWN 0x80 /* host owns this */
285 #define AWI_RXD_ST_CONSUMED 0x40 /* host is done */
286 #define AWI_RXD_ST_LF 0x20 /* last frag */
287 #define AWI_RXD_ST_CRC 0x08 /* CRC error */
288 #define AWI_RXD_ST_OFLO 0x02 /* possible buffer overrun */
289 #define AWI_RXD_ST_RXERROR 0x01 /* this frame is borked; discard me */
290
291 #define AWI_RXD_ST_BITS "\20\1ERROR\2OVERRUN\4CRC\6LF\7CONSUMED\10OWN"
292
293 #define AWI_RXD_RSSI 0xa /* 1 byte: radio strength indicator */
294 #define AWI_RXD_INDEX 0xb /* 1 byte: FH hop index or DS channel */
295 #define AWI_RXD_LOCALTIME 0xc /* 4 bytes: local time of RX */
296 #define AWI_RXD_START_FRAME 0x10 /* 4 bytes: ptr to first received byte */
297 #define AWI_RXD_LEN 0x14 /* 2 bytes: rx len in bytes */
298 #define AWI_RXD_RATE 0x16 /* 1 byte: rx rate in 1e5 bps */
299
300 /*
301 * Transmit descriptors.
302 */
303
304 #define AWI_TXD_SIZE 0x18
305
306 #define AWI_TXD_START 0x00 /* pointer to start of frame */
307 #define AWI_TXD_NEXT 0x04 /* pointer to next TXD */
308 #define AWI_TXD_LENGTH 0x08 /* length of frame */
309 #define AWI_TXD_STATE 0x0a /* state */
310
311 #define AWI_TXD_ST_OWN 0x80 /* MAC owns this */
312 #define AWI_TXD_ST_DONE 0x40 /* MAC is done */
313 #define AWI_TXD_ST_REJ 0x20 /* MAC doesn't like */
314 #define AWI_TXD_ST_MSDU 0x10 /* MSDU timeout */
315 #define AWI_TXD_ST_ABRT 0x08 /* TX aborted */
316 #define AWI_TXD_ST_RETURNED 0x04 /* TX returned */
317 #define AWI_TXD_ST_RETRY 0x02 /* TX retries exceeded */
318 #define AWI_TXD_ST_ERROR 0x01 /* TX error */
319
320 #define AWI_TXD_RATE 0x0b /* rate */
321
322 #define AWI_RATE_1MBIT 10
323 #define AWI_RATE_2MBIT 20
324
325 #define AWI_TXD_NDA 0x0c /* num DIFS attempts */
326 #define AWI_TXD_NDF 0x0d /* num DIFS failures */
327 #define AWI_TXD_NSA 0x0e /* num SIFS attempts */
328 #define AWI_TXD_NSF 0x0f /* num SIFS failures */
329
330 #define AWI_TXD_NRA 0x14 /* num RTS attempts */
331 #define AWI_TXD_NDTA 0x15 /* num data attempts */
332 #define AWI_TXD_CTL 0x16 /* control */
333
334 #define AWI_TXD_CTL_PSN 0x80 /* preserve sequence in MAC frame */
335 #define AWI_TXD_CTL_BURST 0x02 /* host is doing 802.11 fragmt. */
336 #define AWI_TXD_CTL_FRAGS 0x01 /* override normal fragmentation */
337
338 /*
339 * MIB structures.
340 */
341
342 /*
343 * MIB 0: Local MIB
344 */
345
346 #define AWI_MIB_LOCAL_NOFRAG 0
347 #define AWI_MIB_LOCAL_NOPLCP 1
348 #define AWI_MIB_LOCAL_MACPRES 2
349 #define AWI_MIB_LOCAL_RXMGTQ 3
350 #define AWI_MIB_LOCAL_NOREASM 4
351 #define AWI_MIB_LOCAL_NOSTRIPPLCP 5
352 #define AWI_MIB_LOCAL_NORXERROR 6
353 #define AWI_MIB_LOCAL_NOPWRSAVE 7
354
355 #define AWI_MIB_LOCAL_FILTMULTI 8
356 #define AWI_MIB_LOCAL_NOSEQCHECK 9
357 #define AWI_MIB_LOCAL_CFPENDFLUSHCFPQ 10
358 #define AWI_MIB_LOCAL_INFRA_MODE 11
359 #define AWI_MIB_LOCAL_PWD_LEVEL 12
360 #define AWI_MIB_LOCAL_CFPMODE 13
361
362 #define AWI_MIB_LOCAL_TXB_OFFSET 14
363 #define AWI_MIB_LOCAL_TXB_SIZE 18
364 #define AWI_MIB_LOCAL_RXB_OFFSET 22
365 #define AWI_MIB_LOCAL_RXB_SIZE 26
366
367 #define AWI_MIB_LOCAL_ACTING_AS_AP 30
368 #define AWI_MIB_LOCAL_FILL_CFP 31
369 #define AWI_MIB_LOCAL_SIZE 32
370
371 /*
372 * MAC mib
373 */
374
375 #define AWI_MIB_MAC_RTS_THRESH 4 /* 2 bytes */
376 #define AWI_MIB_MAC_CW_MAX 6
377 #define AWI_MIB_MAC_CW_MIN 8
378 #define AWI_MIB_MAC_PROMISC 10
379 #define AWI_MIB_MAC_SHORT_RETRY 16
380 #define AWI_MIB_MAC_LONG_RETRY 17
381 #define AWI_MIB_MAC_MAX_FRAME 18
382 #define AWI_MIB_MAC_MAX_FRAG 20
383 #define AWI_MIB_MAC_PROBE_DELAY 22
384 #define AWI_MIB_MAC_PROBE_RESP_MIN 24
385 #define AWI_MIB_MAC_PROBE_RESP_MAX 26
386 #define AWI_MIB_MAC_MAX_TX_MSDU_LIFE 28
387 #define AWI_MIB_MAC_MAX_RX_MSDU_LIFE 32
388 #define AWI_MIB_MAC_STATION_BASE_RATE 36
389 #define AWI_MIB_MAC_DES_ESSID 38 /* 34 bytes */
390
391 /*
392 * MGT mib.
393 */
394
395 #define AWI_MIB_MGT_POWER_MODE 0
396 #define AWI_MIB_MGT_SCAN_MODE 1
397 #define AWI_MIB_MGT_SCAN_STATE 2
398 #define AWI_MIB_MGT_DTIM_PERIOD 3
399 #define AWI_MIB_MGT_ATIM_WINDOW 4
400 #define AWI_MIB_MGT_WEPREQ 6
401 #define AWI_MIB_MGT_BEACON_PD 8
402 #define AWI_MIB_MGT_PASSIVE_SCAN 10
403 #define AWI_MIB_MGT_LISTEN_INT 12
404 #define AWI_MIB_MGT_MEDIUP_OCC 14
405 #define AWI_MIB_MGT_MAX_MPDU_TIME 16
406 #define AWI_MIB_MGT_CFP_MAX_DUR 18
407 #define AWI_MIB_MGT_CFP_RATE 20
408 #define AWI_MIB_MGT_NO_DTMS 21
409 #define AWI_MIB_MGT_STATION_ID 22
410 #define AWI_MIB_MGT_BSS_ID 24
411 #define AWI_MIB_MGT_ESS_ID 30 /* 34 bytes */
412 #define AWI_MIB_MGT_ESS_SIZE 34
413
414
415 /*
416 * MAC address group.
417 */
418
419 #define AWI_MIB_MAC_ADDR_MINE 0
420 #define AWI_MIB_MAC_ADDR_MULTI0 6
421 #define AWI_MIB_MAC_ADDR_MULTI1 12
422 #define AWI_MIB_MAC_ADDR_MULTI2 18
423 #define AWI_MIB_MAC_ADDR_MULTI3 24
424
425 #define AWI_MIB_MAC_ADDR_TXEN 30
426
427 /*
428 * 802.11 media layer goo.
429 * Should be split out into separate module independant of this driver.
430 */
431
432 #define IEEEWL_FC 0 /* frame control */
433
434 #define IEEEWL_FC_VERS 0
435 #define IEEEWL_FC_VERS_MASK 0x03
436
437 #define IEEEWL_FC_TYPE_MGT 0
438 #define IEEEWL_FC_TYPE_CTL 1
439 #define IEEEWL_FC_TYPE_DATA 2
440
441 #define IEEEWL_FC_TYPE_MASK 0x0c
442 #define IEEEWL_FC_TYPE_SHIFT 2
443
444 #define IEEEWL_FC_SUBTYPE_MASK 0xf0
445 #define IEEEWL_FC_SUBTYPE_SHIFT 4
446
447 #define IEEEWL_SUBTYPE_ASSOCREQ 0x00
448 #define IEEEWL_SUBTYPE_ASSOCRESP 0x01
449 #define IEEEWL_SUBTYPE_REASSOCREQ 0x02
450 #define IEEEWL_SUBTYPE_REASSOCRESP 0x03
451 #define IEEEWL_SUBTYPE_PROBEREQ 0x04
452 #define IEEEWL_SUBTYPE_PROBERESP 0x05
453
454 #define IEEEWL_SUBTYPE_BEACON 0x08
455 #define IEEEWL_SUBTYPE_DISSOC 0x0a
456 #define IEEEWL_SUBTYPE_AUTH 0x0b
457 #define IEEEWL_SUBTYPE_DEAUTH 0x0c
458
459 #define IEEEWL_FC2 1 /* second byte of fc */
460
461 /*
462 * TLV tags for things we care about..
463 */
464 #define IEEEWL_MGT_TLV_SSID 0
465 #define IEEEWL_MGT_TLV_FHPARMS 2
466
467 /*
468 * misc frame control bits in second byte of frame control word.
469 * there are others, but we don't ever want to set them..
470 */
471
472 #define IEEEWL_FC2_DSMASK 0x03
473
474 #define IEEEWL_FC2_TODS 0x01
475 #define IEEEWL_FC2_FROMDS 0x02
476
477 #define IEEEWL_FH_CHANSET_MIN 1
478 #define IEEEWL_FH_CHANSET_MAX 3
479 #define IEEEWL_FH_PATTERN_MIN 0
480 #define IEEEWL_FH_PATTERN_MAX 77
481
482 struct awi_mac_header
483 {
484 u_int8_t awi_fc;
485 u_int8_t awi_f2;
486 u_int16_t awi_duration;
487 u_int8_t awi_addr1[6];
488 u_int8_t awi_addr2[6];
489 u_int8_t awi_addr3[6];
490 u_int16_t awi_seqctl;
491 };
492
493 struct awi_llc_header
494 {
495 u_int8_t awi_llc_goo[8];
496 };
497
498 struct awi_assoc_hdr
499 {
500 u_int8_t awi_cap_info[2];
501 u_int8_t awi_li[2];
502 };
503
504 struct awi_auth_hdr
505 {
506 u_int8_t awi_algno[2];
507 u_int8_t awi_seqno[2];
508 u_int8_t awi_status[2];
509 };
510