Use netproto/802_11 includes instead of net/if_ieee80211.h.
[dragonfly.git] / sys / dev / netif / wi / if_wivar.h
CommitLineData
984263bc
MD
1/*
2 * Copyright (c) 2002
3 * M Warner Losh <imp@freebsd.org>. All rights reserved.
4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Bill Paul.
18 * 4. Neither the name of the author nor the names of any co-contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * $FreeBSD: src/sys/dev/wi/if_wivar.h,v 1.8.2.3 2002/08/02 07:11:34 imp Exp $
3ee50d77 35 * $DragonFly: src/sys/dev/netif/wi/if_wivar.h,v 1.4 2004/07/27 14:30:10 joerg Exp $
984263bc
MD
36 */
37
38#define WICACHE /* turn on signal strength cache code */
39#define MAXWICACHE 10
40
984263bc
MD
41/*
42 * Encryption controls. We can enable or disable encryption as
43 * well as specify up to 4 encryption keys. We can also specify
44 * which of the four keys will be used for transmit encryption.
45 */
46#define WI_RID_ENCRYPTION 0xFC20
47#define WI_RID_AUTHTYPE 0xFC21
48#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0
49#define WI_RID_TX_CRYPT_KEY 0xFCB1
50#define WI_RID_WEP_AVAIL 0xFD4F
51#define WI_RID_P2_TX_CRYPT_KEY 0xFC23
52#define WI_RID_P2_CRYPT_KEY0 0xFC24
53#define WI_RID_P2_CRYPT_KEY1 0xFC25
54#define WI_RID_MICROWAVE_OVEN 0xFC25
55#define WI_RID_P2_CRYPT_KEY2 0xFC26
56#define WI_RID_P2_CRYPT_KEY3 0xFC27
57#define WI_RID_P2_ENCRYPTION 0xFC28
58#define WI_RID_ROAMING_MODE 0xFC2D
59#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
984263bc
MD
60
61struct wi_softc {
62 struct arpcom arpcom;
63 struct ifmedia ifmedia;
64 device_t dev;
65 int wi_unit;
66 struct resource * local;
67 int local_rid;
68 struct resource * iobase;
69 int iobase_rid;
70 struct resource * irq;
71 int irq_rid;
72 struct resource * mem;
73 int mem_rid;
74 bus_space_handle_t wi_localhandle;
75 bus_space_tag_t wi_localtag;
76 bus_space_handle_t wi_bhandle;
77 bus_space_tag_t wi_btag;
78 bus_space_handle_t wi_bmemhandle;
79 bus_space_tag_t wi_bmemtag;
80 void * wi_intrhand;
81 int sc_firmware_type;
82#define WI_NOTYPE 0
83#define WI_LUCENT 1
84#define WI_INTERSIL 2
85#define WI_SYMBOL 3
86 int sc_pri_firmware_ver; /* Primary firmware */
87 int sc_sta_firmware_ver; /* Station firmware */
88 int sc_enabled;
89 int wi_io_addr;
90 int wi_tx_data_id;
91 int wi_tx_mgmt_id;
92 int wi_gone;
93 int wi_flags;
94#define WI_FLAGS_ATTACHED 0x01
95#define WI_FLAGS_INITIALIZED 0x02
96#define WI_FLAGS_HAS_WEP 0x04
97#define WI_FLAGS_HAS_IBSS 0x08
98#define WI_FLAGS_HAS_CREATE_IBSS 0x10
99#define WI_FLAGS_HAS_MOR 0x20
100#define WI_FLAGS_HAS_ROAMING 0x30
101#define WI_FLAGS_HAS_DIVERSITY 0x40
102#define WI_FLAGS_HAS_HOSTAP 0x80
103 int wi_if_flags;
104 u_int16_t wi_procframe;
105 u_int16_t wi_ptype;
106 u_int16_t wi_portnum;
107 u_int16_t wi_max_data_len;
108 u_int16_t wi_rts_thresh;
109 u_int16_t wi_ap_density;
110 u_int16_t wi_tx_rate;
111 u_int16_t wi_create_ibss;
112 u_int16_t wi_channel;
113 u_int16_t wi_pm_enabled;
114 u_int16_t wi_mor_enabled;
115 u_int16_t wi_max_sleep;
116 u_int16_t wi_supprates;
117 u_int16_t wi_authtype;
118 u_int16_t wi_roaming;
119 char wi_node_name[32];
120 char wi_net_name[32];
121 char wi_ibss_name[32];
122 u_int8_t wi_txbuf[1596];
123 u_int8_t wi_scanbuf[1596];
124 int wi_scanbuf_len;
125 struct wi_counters wi_stats;
126 int wi_has_wep;
127 int wi_use_wep;
128 int wi_authmode;
129 int wi_tx_key;
130 struct wi_ltv_keys wi_keys;
131#ifdef WICACHE
132 int wi_sigitems;
133 struct wi_sigcache wi_sigcache[MAXWICACHE];
134 int wi_nextitem;
135#endif
136 struct wihap_info wi_hostap_info;
137 u_int32_t wi_icv;
138 int wi_icv_flag;
139 int wi_ibss_port;
140 struct callout_handle wi_stat_ch;
929783d0 141#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
984263bc
MD
142 struct mtx wi_mtx;
143#endif
144 int wi_nic_type;
145 int wi_bus_type; /* Bus attachment type */
146 struct {
147 u_int16_t wi_sleep;
148 u_int16_t wi_delaysupp;
149 u_int16_t wi_txsupp;
150 u_int16_t wi_monitor;
151 u_int16_t wi_ledtest;
152 u_int16_t wi_ledtest_param0;
153 u_int16_t wi_ledtest_param1;
154 u_int16_t wi_conttx;
155 u_int16_t wi_conttx_param0;
156 u_int16_t wi_contrx;
157 u_int16_t wi_sigstate;
158 u_int16_t wi_sigstate_param0;
159 u_int16_t wi_confbits;
160 u_int16_t wi_confbits_param0;
161 } wi_debug;
162
163};
164
165struct wi_card_ident {
166 u_int16_t card_id;
167 char *card_name;
168 u_int8_t firm_type;
169};
170
929783d0 171#if defined(__DragonFly__) || __FreeBSD_version < 500000
984263bc
MD
172/*
173 * Various compat hacks/kludges
174 */
175#define le16toh(x) (x)
176#define htole16(x) (x)
177#define ifaddr_byindex(idx) ifnet_addrs[(idx) - 1];
178#define WI_LOCK(_sc, _s) s = splimp()
179#define WI_UNLOCK(_sc, _s) splx(s)
180#else
181#define WI_LOCK(_sc, _s) _s = 1
182#define WI_UNLOCK(_sc, _s)
183#endif
184
185int wi_generic_attach(device_t);
186int wi_generic_detach(device_t);
187void wi_shutdown(device_t);
188int wi_alloc(device_t, int);
189void wi_free(device_t);
190extern devclass_t wi_devclass;
191int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);