if_wivar.h revision 112363
193611Simp/* 293611Simp * Copyright (c) 2002 393611Simp * M Warner Losh <imp@freebsd.org>. All rights reserved. 493611Simp * Copyright (c) 1997, 1998, 1999 593611Simp * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 693611Simp * 793611Simp * Redistribution and use in source and binary forms, with or without 893611Simp * modification, are permitted provided that the following conditions 993611Simp * are met: 1093611Simp * 1. Redistributions of source code must retain the above copyright 1193611Simp * notice, this list of conditions and the following disclaimer. 1293611Simp * 2. Redistributions in binary form must reproduce the above copyright 1393611Simp * notice, this list of conditions and the following disclaimer in the 1493611Simp * documentation and/or other materials provided with the distribution. 1593611Simp * 3. All advertising materials mentioning features or use of this software 1693611Simp * must display the following acknowledgement: 1793611Simp * This product includes software developed by Bill Paul. 1893611Simp * 4. Neither the name of the author nor the names of any co-contributors 1993611Simp * may be used to endorse or promote products derived from this software 2093611Simp * without specific prior written permission. 2193611Simp * 2293611Simp * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 2393611Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2493611Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2593611Simp * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 2693611Simp * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2793611Simp * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2893611Simp * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2993611Simp * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3093611Simp * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3193611Simp * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 3293611Simp * THE POSSIBILITY OF SUCH DAMAGE. 3393611Simp * 3493611Simp * $FreeBSD: head/sys/dev/wi/if_wivar.h 112363 2003-03-18 04:22:42Z imp $ 3593611Simp */ 3693611Simp 37109323Ssam#if 0 3893611Simp#define WICACHE /* turn on signal strength cache code */ 3993611Simp#define MAXWICACHE 10 40109323Ssam#endif 4193611Simp 4293611Simp/* 4393611Simp * Encryption controls. We can enable or disable encryption as 4493611Simp * well as specify up to 4 encryption keys. We can also specify 4593611Simp * which of the four keys will be used for transmit encryption. 4693611Simp */ 4793611Simp#define WI_RID_ENCRYPTION 0xFC20 4893611Simp#define WI_RID_AUTHTYPE 0xFC21 4993611Simp#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0 5093611Simp#define WI_RID_TX_CRYPT_KEY 0xFCB1 5193611Simp#define WI_RID_WEP_AVAIL 0xFD4F 5293611Simp#define WI_RID_P2_TX_CRYPT_KEY 0xFC23 5393611Simp#define WI_RID_P2_CRYPT_KEY0 0xFC24 5493611Simp#define WI_RID_P2_CRYPT_KEY1 0xFC25 5593611Simp#define WI_RID_MICROWAVE_OVEN 0xFC25 5693611Simp#define WI_RID_P2_CRYPT_KEY2 0xFC26 5793611Simp#define WI_RID_P2_CRYPT_KEY3 0xFC27 5893611Simp#define WI_RID_P2_ENCRYPTION 0xFC28 5993611Simp#define WI_RID_ROAMING_MODE 0xFC2D 6093611Simp#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */ 6193611Simp 62109323Ssamstruct wi_softc { 63109323Ssam struct ieee80211com sc_ic; 64109323Ssam device_t sc_dev; 65109323Ssam#if __FreeBSD_version >= 500000 66109323Ssam struct mtx sc_mtx; 67109323Ssam#endif 68109323Ssam int sc_unit; 69109323Ssam int wi_gone; 70109323Ssam int sc_enabled; 71112362Simp int sc_reset; 72109323Ssam int sc_firmware_type; 73109323Ssam#define WI_NOTYPE 0 74109323Ssam#define WI_LUCENT 1 75109323Ssam#define WI_INTERSIL 2 76109323Ssam#define WI_SYMBOL 3 77109323Ssam int sc_pri_firmware_ver; /* Primary firmware */ 78109323Ssam int sc_sta_firmware_ver; /* Station firmware */ 7993611Simp 80109323Ssam int wi_bus_type; /* Bus attachment type */ 8193611Simp struct resource * local; 82109323Ssam int local_rid; 8393611Simp struct resource * iobase; 84109323Ssam int iobase_rid; 8593611Simp struct resource * irq; 86109323Ssam int irq_rid; 8793611Simp struct resource * mem; 88109323Ssam int mem_rid; 8993611Simp bus_space_handle_t wi_localhandle; 9093611Simp bus_space_tag_t wi_localtag; 9193611Simp bus_space_handle_t wi_bhandle; 9293611Simp bus_space_tag_t wi_btag; 9393611Simp bus_space_handle_t wi_bmemhandle; 9493611Simp bus_space_tag_t wi_bmemtag; 9593611Simp void * wi_intrhand; 9693733Simp int wi_io_addr; 97109323Ssam 98109323Ssam struct ifmedia sc_media; 99109323Ssam struct bpf_if *sc_drvbpf; 100109323Ssam int sc_flags; 101109323Ssam int sc_if_flags; 102109323Ssam int sc_bap_id; 103109323Ssam int sc_bap_off; 104109323Ssam 105109323Ssam u_int16_t sc_procframe; 106109323Ssam u_int16_t sc_portnum; 107109323Ssam 108109323Ssam u_int16_t sc_dbm_adjust; 109109323Ssam u_int16_t sc_max_datalen; 110109323Ssam u_int16_t sc_frag_thresh; 111109323Ssam u_int16_t sc_rts_thresh; 112109323Ssam u_int16_t sc_system_scale; 113109323Ssam u_int16_t sc_cnfauthmode; 114109323Ssam u_int16_t sc_roaming_mode; 115109323Ssam u_int16_t sc_microwave_oven; 116109323Ssam u_int16_t sc_authtype; 117109323Ssam 118109323Ssam int sc_nodelen; 119109323Ssam char sc_nodename[IEEE80211_NWID_LEN]; 120109323Ssam char sc_net_name[IEEE80211_NWID_LEN]; 121109323Ssam 122109323Ssam int sc_buflen; /* TX buffer size */ 123112363Simp int sc_ntxbuf; 124109323Ssam#define WI_NTXBUF 3 12593611Simp struct { 126109323Ssam int d_fid; 127109323Ssam int d_len; 128109323Ssam } sc_txd[WI_NTXBUF]; /* TX buffers */ 129109323Ssam int sc_txnext; /* index of next TX */ 130109323Ssam int sc_txcur; /* index of current TX*/ 131109323Ssam int sc_tx_timer; 132109323Ssam int sc_scan_timer; 133109323Ssam int sc_syn_timer; 134109323Ssam 135109323Ssam struct wi_counters sc_stats; 136109323Ssam u_int16_t sc_ibss_port; 137109323Ssam 138109323Ssam#define WI_MAXAPINFO 30 139109323Ssam struct wi_apinfo sc_aps[WI_MAXAPINFO]; 140109323Ssam int sc_naps; 141109323Ssam 142109323Ssam struct { 14393611Simp u_int16_t wi_sleep; 14493611Simp u_int16_t wi_delaysupp; 14593611Simp u_int16_t wi_txsupp; 14693611Simp u_int16_t wi_monitor; 14793611Simp u_int16_t wi_ledtest; 14893611Simp u_int16_t wi_ledtest_param0; 14993611Simp u_int16_t wi_ledtest_param1; 15093611Simp u_int16_t wi_conttx; 15193611Simp u_int16_t wi_conttx_param0; 15293611Simp u_int16_t wi_contrx; 15393611Simp u_int16_t wi_sigstate; 15493611Simp u_int16_t wi_sigstate_param0; 15593611Simp u_int16_t wi_confbits; 15693611Simp u_int16_t wi_confbits_param0; 15793611Simp } wi_debug; 15893611Simp 159109323Ssam int sc_false_syns; 160109323Ssam 161109323Ssam u_int16_t sc_txbuf[IEEE80211_MAX_LEN/2]; 16293611Simp}; 163109323Ssam#define sc_if sc_ic.ic_if 16493611Simp 165109323Ssam/* maximum consecutive false change-of-BSSID indications */ 166109323Ssam#define WI_MAX_FALSE_SYNS 10 167109323Ssam 168109323Ssam#define WI_SCAN_INQWAIT 3 /* wait sec before inquire */ 169109323Ssam#define WI_SCAN_WAIT 5 /* maximum scan wait */ 170109323Ssam 171109323Ssam#define WI_FLAGS_ATTACHED 0x0001 172109323Ssam#define WI_FLAGS_INITIALIZED 0x0002 173109323Ssam#define WI_FLAGS_OUTRANGE 0x0004 174109323Ssam#define WI_FLAGS_HAS_MOR 0x0010 175109323Ssam#define WI_FLAGS_HAS_ROAMING 0x0020 176109323Ssam#define WI_FLAGS_HAS_DIVERSITY 0x0040 177109323Ssam#define WI_FLAGS_HAS_SYSSCALE 0x0080 178109323Ssam#define WI_FLAGS_BUG_AUTOINC 0x0100 179109323Ssam#define WI_FLAGS_HAS_FRAGTHR 0x0200 180109323Ssam#define WI_FLAGS_HAS_DBMADJUST 0x0400 181109323Ssam 18293825Simpstruct wi_card_ident { 18393825Simp u_int16_t card_id; 18493825Simp char *card_name; 18593825Simp u_int8_t firm_type; 18693825Simp}; 18793825Simp 18895534Simp#if __FreeBSD_version < 500000 18995534Simp/* 19095534Simp * Various compat hacks/kludges 19195534Simp */ 19295534Simp#define le16toh(x) (x) 19395534Simp#define htole16(x) (x) 19495534Simp#define ifaddr_byindex(idx) ifnet_addrs[(idx) - 1]; 195109323Ssam#define WI_LOCK_DECL() int s 196109323Ssam#define WI_LOCK(_sc) s = splimp() 197109323Ssam#define WI_UNLOCK(_sc) splx(s) 19895534Simp#else 199109323Ssam#define WI_LOCK_DECL() 200109323Ssam#define WI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 201109323Ssam#define WI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 20295534Simp#endif 20393611Simp 204109323Ssamint wi_attach(device_t); 205109323Ssamint wi_detach(device_t); 206109323Ssamvoid wi_shutdown(device_t); 207109323Ssamint wi_alloc(device_t, int); 208109323Ssamvoid wi_free(device_t); 20993611Simpextern devclass_t wi_devclass; 210109323Ssamvoid wi_init(void *); 211109323Ssamvoid wi_intr(void *); 212109323Ssamint wi_mgmt_xmit(struct wi_softc *, caddr_t, int); 213109323Ssamvoid wi_stop(struct ifnet *, int); 214109323Ssamint wi_symbol_load_firm(struct wi_softc *, const void *, int, const void *, int); 215