1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 #define WI_DELAY 5
38 #define WI_TIMEOUT (500000/WI_DELAY)
39
40 #define WI_PORT0 0
41 #define WI_PORT1 1
42 #define WI_PORT2 2
43 #define WI_PORT3 3
44 #define WI_PORT4 4
45 #define WI_PORT5 5
46
47
48 #define WI_DEFAULT_PORT (WI_PORT0 << 8)
49
50
51 #define WI_DEFAULT_TX_RATE 3
52
53
54 #define WI_DEFAULT_NETNAME ""
55
56 #define WI_DEFAULT_AP_DENSITY 1
57
58 #define WI_DEFAULT_RTS_THRESH 2347
59
60 #define WI_DEFAULT_DATALEN 2304
61
62 #define WI_DEFAULT_CREATE_IBSS 0
63
64 #define WI_DEFAULT_PM_ENABLED 0
65
66 #define WI_DEFAULT_MAX_SLEEP 100
67
68 #define WI_DEFAULT_NODENAME "WaveLAN/IEEE node"
69
70 #define WI_DEFAULT_IBSS "IBSS"
71
72 #define WI_DEFAULT_CHAN 3
73
74 #define WI_DEFAULT_ROAMING 1
75
76 #define WI_DEFAULT_AUTHTYPE 1
77
78 #define WI_DEFAULT_DIVERSITY 0
79
80
81
82
83
84 #if defined(__sparc64__)
85 #define WI_BIG_ENDIAN_POSSIBLE (sc->wi_flags & WI_FLAGS_BUS_PCMCIA)
86 #else
87 #define WI_BIG_ENDIAN_POSSIBLE 0
88 #endif
89
90 #define CSR_WRITE_4(sc, reg, val) \
91 bus_space_write_4(sc->wi_btag, sc->wi_bhandle, \
92 (sc->sc_pci ? reg * 2: reg), \
93 WI_BIG_ENDIAN_POSSIBLE ? htole32(val) : (val))
94 #define CSR_WRITE_2(sc, reg, val) \
95 bus_space_write_2(sc->wi_btag, sc->wi_bhandle, \
96 (sc->sc_pci ? reg * 2: reg), \
97 WI_BIG_ENDIAN_POSSIBLE ? htole16(val) : (val))
98 #define CSR_WRITE_1(sc, reg, val) \
99 bus_space_write_1(sc->wi_btag, sc->wi_bhandle, \
100 (sc->sc_pci ? reg * 2: reg), val)
101
102 #define CSR_READ_4(sc, reg) \
103 (WI_BIG_ENDIAN_POSSIBLE ? \
104 letoh32(bus_space_read_4(sc->wi_btag, sc->wi_bhandle, \
105 (sc->sc_pci ? reg * 2: reg))) : \
106 bus_space_read_4(sc->wi_btag, sc->wi_bhandle, \
107 (sc->sc_pci ? reg * 2: reg)))
108 #define CSR_READ_2(sc, reg) \
109 (WI_BIG_ENDIAN_POSSIBLE ? \
110 letoh16(bus_space_read_2(sc->wi_btag, sc->wi_bhandle, \
111 (sc->sc_pci ? reg * 2: reg))) : \
112 bus_space_read_2(sc->wi_btag, sc->wi_bhandle, \
113 (sc->sc_pci ? reg * 2: reg)))
114 #define CSR_READ_1(sc, reg) \
115 bus_space_read_1(sc->wi_btag, sc->wi_bhandle, \
116 (sc->sc_pci ? reg * 2: reg))
117
118 #define CSR_READ_RAW_2(sc, ba, dst, sz) \
119 bus_space_read_raw_multi_2((sc)->wi_btag, \
120 (sc)->wi_bhandle, \
121 (sc->sc_pci? ba * 2: ba), (dst), (sz))
122 #define CSR_WRITE_RAW_2(sc, ba, dst, sz) \
123 bus_space_write_raw_multi_2((sc)->wi_btag, \
124 (sc)->wi_bhandle, \
125 (sc->sc_pci? ba * 2: ba), (dst), (sz))
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169 #define WI_IOSIZ 0x40
170
171
172
173
174
175
176 #define WI_COMMAND 0x00
177 #define WI_PARAM0 0x02
178 #define WI_PARAM1 0x04
179 #define WI_PARAM2 0x06
180 #define WI_STATUS 0x08
181 #define WI_RESP0 0x0A
182 #define WI_RESP1 0x0C
183 #define WI_RESP2 0x0E
184
185
186 #define WI_CMD_BUSY 0x8000
187 #define WI_CMD_INI 0x0000
188 #define WI_CMD_ENABLE 0x0001
189 #define WI_CMD_DISABLE 0x0002
190 #define WI_CMD_DIAG 0x0003
191 #define WI_CMD_ALLOC_MEM 0x000A
192 #define WI_CMD_TX 0x000B
193 #define WI_CMD_NOTIFY 0x0010
194 #define WI_CMD_INQUIRE 0x0011
195 #define WI_CMD_ACCESS 0x0021
196 #define WI_CMD_PROGRAM 0x0022
197 #define WI_CMD_READ_MIF 0x0030
198 #define WI_CMD_WRITE_MIF 0x0031
199
200 #define WI_CMD_CODE_MASK 0x003F
201
202
203
204
205
206 #define WI_RECLAIM 0x0100
207
208
209
210
211 #define WI_ACCESS_READ 0x0000
212 #define WI_ACCESS_WRITE 0x0100
213
214
215
216
217 #define WI_PROGRAM_DISABLE 0x0000
218 #define WI_PROGRAM_ENABLE_RAM 0x0100
219 #define WI_PROGRAM_ENABLE_NVRAM 0x0200
220 #define WI_PROGRAM_NVRAM 0x0300
221
222
223 #define WI_STAT_CMD_CODE 0x003F
224 #define WI_STAT_DIAG_ERR 0x0100
225 #define WI_STAT_INQ_ERR 0x0500
226 #define WI_STAT_CMD_RESULT 0x7F00
227
228
229 #define WI_INFO_FID 0x10
230 #define WI_RX_FID 0x20
231 #define WI_ALLOC_FID 0x22
232 #define WI_TX_CMP_FID 0x24
233
234
235
236
237
238
239
240
241
242 #define WI_SEL0 0x18
243 #define WI_SEL1 0x1A
244 #define WI_OFF0 0x1C
245 #define WI_OFF1 0x1E
246 #define WI_DATA0 0x36
247 #define WI_DATA1 0x38
248 #define WI_BAP0 WI_DATA0
249 #define WI_BAP1 WI_DATA1
250
251 #define WI_OFF_BUSY 0x8000
252 #define WI_OFF_ERR 0x4000
253 #define WI_OFF_DATAOFF 0x0FFF
254
255
256 #define WI_EVENT_STAT 0x30
257 #define WI_INT_EN 0x32
258 #define WI_EVENT_ACK 0x34
259
260
261 #define WI_EV_TICK 0x8000
262 #define WI_EV_RES 0x4000
263 #define WI_EV_INFO_DROP 0x2000
264 #define WI_EV_NO_CARD 0x0800
265 #define WI_EV_DUIF_RX 0x0400
266 #define WI_EV_INFO 0x0080
267 #define WI_EV_CMD 0x0010
268 #define WI_EV_ALLOC 0x0008
269 #define WI_EV_TX_EXC 0x0004
270 #define WI_EV_TX 0x0002
271 #define WI_EV_RX 0x0001
272
273 #define WI_INTRS \
274 (WI_EV_RX|WI_EV_TX|WI_EV_TX_EXC|WI_EV_ALLOC|WI_EV_INFO|WI_EV_INFO_DROP)
275
276
277 #define WI_SW0 0x28
278 #define WI_SW1 0x2A
279 #define WI_SW2 0x2C
280 #define WI_SW3 0x2E
281
282 #define WI_CNTL 0x14
283
284 #define WI_CNTL_AUX_ENA 0xC000
285 #define WI_CNTL_AUX_ENA_STAT 0xC000
286 #define WI_CNTL_AUX_DIS_STAT 0x0000
287 #define WI_CNTL_AUX_ENA_CNTL 0x8000
288 #define WI_CNTL_AUX_DIS_CNTL 0x4000
289
290 #define WI_AUX_PAGE 0x3A
291 #define WI_AUX_OFFSET 0x3C
292 #define WI_AUX_DATA 0x3E
293
294 #define WI_COR_OFFSET 0x40
295 #define WI_COR_IOMODE 0x41
296
297 #define WI_PLX_LOCALRES 0x14
298 #define WI_PLX_MEMRES 0x18
299 #define WI_PLX_IORES 0x1C
300 #define WI_PLX_INTCSR 0x4C
301 #define WI_PLX_INTEN 0x40
302 #define WI_PLX_LINT1STAT 0x04
303 #define WI_PLX_COR_OFFSET 0x3E0
304
305 #define WI_ACEX_CMDRES 0x10
306 #define WI_ACEX_LOCALRES 0x14
307 #define WI_ACEX_IORES 0x18
308 #define WI_ACEX_COR_OFFSET 0xe0
309
310 #define WI_TMD_LOCALRES 0x14
311 #define WI_TMD_IORES 0x18
312
313 #define WI_DRVR_MAGIC 0x4A2D
314
315
316
317
318
319
320
321 #define WI_PCI_CBMA 0x10
322 #define WI_PCI_COR_OFFSET 0x4C
323 #define WI_PCI_HCR 0x5C
324 #define WI_PCI_MASTER0_ADDRH 0x80
325 #define WI_PCI_MASTER0_ADDRL 0x84
326 #define WI_PCI_MASTER0_LEN 0x88
327 #define WI_PCI_MASTER0_CON 0x8C
328
329 #define WI_PCI_STATUS 0x98
330
331 #define WI_PCI_MASTER1_ADDRH 0xA0
332 #define WI_PCI_MASTER1_ADDRL 0xA4
333 #define WI_PCI_MASTER1_LEN 0xA8
334 #define WI_PCI_MASTER1_CON 0xAC
335
336 #define WI_COR_SOFT_RESET (1 << 7)
337 #define WI_COR_CLEAR 0x00
338
339
340
341
342
343
344
345 struct wi_ltv_gen {
346 u_int16_t wi_len;
347 u_int16_t wi_type;
348 u_int16_t wi_val;
349 };
350
351 struct wi_ltv_str {
352 u_int16_t wi_len;
353 u_int16_t wi_type;
354 u_int16_t wi_str[17];
355 };
356
357 #define WI_SETVAL(recno, val) \
358 do { \
359 struct wi_ltv_gen g; \
360 \
361 g.wi_len = 2; \
362 g.wi_type = recno; \
363 g.wi_val = htole16(val); \
364 wi_write_record(sc, &g); \
365 } while (0)
366
367 #define WI_SETSTR(recno, str) \
368 do { \
369 struct wi_ltv_str s; \
370 int l; \
371 \
372 l = (str.i_len + 1) & ~0x1; \
373 bzero((char *)&s, sizeof(s)); \
374 s.wi_len = (l / 2) + 2; \
375 s.wi_type = recno; \
376 s.wi_str[0] = htole16(str.i_len); \
377 bcopy(str.i_nwid, &s.wi_str[1], str.i_len); \
378 wi_write_record(sc, (struct wi_ltv_gen *)&s); \
379 } while (0)
380
381
382
383
384 #define WI_RID_DNLD_BUF 0xFD01
385 struct wi_ltv_dnld_buf {
386 u_int16_t wi_len;
387 u_int16_t wi_type;
388 u_int16_t wi_buf_pg;
389 u_int16_t wi_buf_off;
390 u_int16_t wi_buf_len;
391 };
392
393
394
395
396 #define WI_RID_MEMSZ 0xFD02
397 struct wi_ltv_memsz {
398 u_int16_t wi_len;
399 u_int16_t wi_type;
400 u_int16_t wi_mem_ram;
401 u_int16_t wi_mem_nvram;
402 };
403
404
405
406
407 struct wi_ltv_ver {
408 u_int16_t wi_len;
409 u_int16_t wi_type;
410 u_int16_t wi_ver[4];
411 };
412
413
414
415
416 struct wi_ltv_domains {
417 u_int16_t wi_len;
418 u_int16_t wi_type;
419 u_int16_t wi_domains[6];
420 };
421
422
423
424
425 struct wi_ltv_cis {
426 u_int16_t wi_len;
427 u_int16_t wi_type;
428 u_int16_t wi_cis[240];
429 };
430
431
432
433
434 struct wi_ltv_commqual {
435 u_int16_t wi_len;
436 u_int16_t wi_type;
437 u_int16_t wi_coms_qual;
438 u_int16_t wi_sig_lvl;
439 u_int16_t wi_noise_lvl;
440 };
441
442
443
444
445 struct wi_ltv_scalethresh {
446 u_int16_t wi_len;
447 u_int16_t wi_type;
448 u_int16_t wi_energy_detect;
449 u_int16_t wi_carrier_detect;
450 u_int16_t wi_defer;
451 u_int16_t wi_cell_search;
452 u_int16_t wi_out_of_range;
453 u_int16_t wi_delta_snr;
454 };
455
456
457
458
459 struct wi_ltv_pcf {
460 u_int16_t wi_len;
461 u_int16_t wi_type;
462 u_int16_t wi_energy_detect;
463 u_int16_t wi_carrier_detect;
464 u_int16_t wi_defer;
465 u_int16_t wi_cell_search;
466 u_int16_t wi_range;
467 };
468
469
470
471
472
473
474
475
476 #define WI_PORTTYPE_BSS 0x1
477 #define WI_PORTTYPE_WDS 0x2
478 #define WI_PORTTYPE_ADHOC 0x3
479 #define WI_PORTTYPE_IBSS 0x4
480 #define WI_PORTTYPE_HOSTAP 0x6
481
482
483
484
485 struct wi_ltv_macaddr {
486 u_int16_t wi_len;
487 u_int16_t wi_type;
488 u_int16_t wi_mac_addr[3];
489 };
490
491
492
493
494 struct wi_ltv_ssid {
495 u_int16_t wi_len;
496 u_int16_t wi_type;
497 u_int16_t wi_id[17];
498 };
499
500
501
502
503 struct wi_ltv_nodename {
504 u_int16_t wi_len;
505 u_int16_t wi_type;
506 u_int16_t wi_nodename[17];
507 };
508
509
510
511
512
513 struct wi_ltv_mcast {
514 u_int16_t wi_len;
515 u_int16_t wi_type;
516 struct ether_addr wi_mcast[16];
517 };
518
519
520
521
522
523 struct wi_ltv_rates {
524 u_int16_t wi_len;
525 u_int16_t wi_type;
526 u_int8_t wi_rates[10];
527 };
528
529
530
531
532 #define WI_SUPPRATES_1M 0x0001
533 #define WI_SUPPRATES_2M 0x0002
534 #define WI_SUPPRATES_5M 0x0004
535 #define WI_SUPPRATES_11M 0x0008
536 #define WI_RATES_BITS "\20\0011M\0022M\0035.5M\00411M"
537
538
539
540
541 #define WI_INFO_NOTIFY 0xF000
542 #define WI_INFO_COUNTERS 0xF100
543 #define WI_INFO_SCAN_RESULTS 0xF101
544 #define WI_INFO_LINK_STAT 0xF200
545 #define WI_INFO_ASSOC_STAT 0xF201
546
547
548
549
550 struct wi_frame {
551 u_int16_t wi_status;
552 u_int16_t wi_rsvd0;
553 u_int16_t wi_rsvd1;
554 u_int16_t wi_q_info;
555 u_int16_t wi_rsvd2;
556 u_int8_t wi_tx_rtry;
557 u_int8_t wi_tx_rate;
558 u_int16_t wi_tx_ctl;
559 u_int16_t wi_frame_ctl;
560 u_int16_t wi_id;
561 u_int8_t wi_addr1[6];
562 u_int8_t wi_addr2[6];
563 u_int8_t wi_addr3[6];
564 u_int16_t wi_seq_ctl;
565 u_int8_t wi_addr4[6];
566 u_int16_t wi_dat_len;
567 u_int8_t wi_dst_addr[6];
568 u_int8_t wi_src_addr[6];
569 u_int16_t wi_len;
570 u_int16_t wi_dat[3];
571 u_int16_t wi_type;
572 };
573
574 #define WI_802_3_OFFSET 0x2E
575 #define WI_802_11_OFFSET 0x44
576 #define WI_802_11_OFFSET_RAW 0x3C
577 #define WI_802_11_OFFSET_HDR 0x0E
578
579 #define WI_STAT_BADCRC 0x0001
580 #define WI_STAT_UNDECRYPTABLE 0x0002
581 #define WI_STAT_ERRSTAT 0x0003
582 #define WI_STAT_MAC_PORT 0x0700
583 #define WI_STAT_1042 0x2000
584 #define WI_STAT_TUNNEL 0x4000
585 #define WI_STAT_WMP_MSG 0x6000
586 #define WI_STAT_MGMT 0x8000
587 #define WI_RXSTAT_MSG_TYPE 0xE000
588
589 #define WI_ENC_TX_802_3 0x00
590 #define WI_ENC_TX_802_11 0x11
591 #define WI_ENC_TX_MGMT 0x08
592 #define WI_ENC_TX_E_II 0x0E
593
594 #define WI_ENC_TX_1042 0x00
595 #define WI_ENC_TX_TUNNEL 0xF8
596
597 #define WI_TXCNTL_MACPORT 0x00FF
598 #define WI_TXCNTL_STRUCTTYPE 0xFF00
599 #define WI_TXCNTL_TX_EX 0x0004
600 #define WI_TXCNTL_TX_OK 0x0002
601 #define WI_TXCNTL_NOCRYPT 0x0080
602
603
604
605
606
607
608
609
610 #define WI_SNAP_K1 0xaa
611 #define WI_SNAP_K2 0x00
612 #define WI_SNAP_CONTROL 0x03
613 #define WI_SNAP_WORD0 (WI_SNAP_K1 | (WI_SNAP_K1 << 8))
614 #define WI_SNAP_WORD1 (WI_SNAP_K2 | (WI_SNAP_CONTROL << 8))
615 #define WI_SNAPHDR_LEN 0x6
616 #define WI_FCS_LEN 0x4
617
618 #define WI_ETHERTYPE_LEN 0x2
619
620
621
622
623 #define WI_HFA384X_CR_A_D_TEST_MODES2 0x1a
624 #define WI_HFA384X_CR_MANUAL_TX_POWER 0x3e