if_wivar.h revision 109323
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: head/sys/dev/wi/if_wivar.h 109323 2003-01-15 20:11:31Z sam $ 35 */ 36 37#if 0 38#define WICACHE /* turn on signal strength cache code */ 39#define MAXWICACHE 10 40#endif 41 42/* 43 * Encryption controls. We can enable or disable encryption as 44 * well as specify up to 4 encryption keys. We can also specify 45 * which of the four keys will be used for transmit encryption. 46 */ 47#define WI_RID_ENCRYPTION 0xFC20 48#define WI_RID_AUTHTYPE 0xFC21 49#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0 50#define WI_RID_TX_CRYPT_KEY 0xFCB1 51#define WI_RID_WEP_AVAIL 0xFD4F 52#define WI_RID_P2_TX_CRYPT_KEY 0xFC23 53#define WI_RID_P2_CRYPT_KEY0 0xFC24 54#define WI_RID_P2_CRYPT_KEY1 0xFC25 55#define WI_RID_MICROWAVE_OVEN 0xFC25 56#define WI_RID_P2_CRYPT_KEY2 0xFC26 57#define WI_RID_P2_CRYPT_KEY3 0xFC27 58#define WI_RID_P2_ENCRYPTION 0xFC28 59#define WI_RID_ROAMING_MODE 0xFC2D 60#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */ 61 62struct wi_softc { 63 struct ieee80211com sc_ic; 64 device_t sc_dev; 65#if __FreeBSD_version >= 500000 66 struct mtx sc_mtx; 67#endif 68 int sc_unit; 69 int wi_gone; 70 int sc_enabled; 71 int sc_firmware_type; 72#define WI_NOTYPE 0 73#define WI_LUCENT 1 74#define WI_INTERSIL 2 75#define WI_SYMBOL 3 76 int sc_pri_firmware_ver; /* Primary firmware */ 77 int sc_sta_firmware_ver; /* Station firmware */ 78 79 int wi_bus_type; /* Bus attachment type */ 80 struct resource * local; 81 int local_rid; 82 struct resource * iobase; 83 int iobase_rid; 84 struct resource * irq; 85 int irq_rid; 86 struct resource * mem; 87 int mem_rid; 88 bus_space_handle_t wi_localhandle; 89 bus_space_tag_t wi_localtag; 90 bus_space_handle_t wi_bhandle; 91 bus_space_tag_t wi_btag; 92 bus_space_handle_t wi_bmemhandle; 93 bus_space_tag_t wi_bmemtag; 94 void * wi_intrhand; 95 int wi_io_addr; 96 97 struct ifmedia sc_media; 98 struct bpf_if *sc_drvbpf; 99 int sc_flags; 100 int sc_if_flags; 101 int sc_bap_id; 102 int sc_bap_off; 103 104 u_int16_t sc_procframe; 105 u_int16_t sc_portnum; 106 107 u_int16_t sc_dbm_adjust; 108 u_int16_t sc_max_datalen; 109 u_int16_t sc_frag_thresh; 110 u_int16_t sc_rts_thresh; 111 u_int16_t sc_system_scale; 112 u_int16_t sc_cnfauthmode; 113 u_int16_t sc_roaming_mode; 114 u_int16_t sc_microwave_oven; 115 u_int16_t sc_authtype; 116 117 int sc_nodelen; 118 char sc_nodename[IEEE80211_NWID_LEN]; 119 char sc_net_name[IEEE80211_NWID_LEN]; 120 121 int sc_buflen; /* TX buffer size */ 122#define WI_NTXBUF 3 123 struct { 124 int d_fid; 125 int d_len; 126 } sc_txd[WI_NTXBUF]; /* TX buffers */ 127 int sc_txnext; /* index of next TX */ 128 int sc_txcur; /* index of current TX*/ 129 int sc_tx_timer; 130 int sc_scan_timer; 131 int sc_syn_timer; 132 133 struct wi_counters sc_stats; 134 u_int16_t sc_ibss_port; 135 136#define WI_MAXAPINFO 30 137 struct wi_apinfo sc_aps[WI_MAXAPINFO]; 138 int sc_naps; 139 140 struct { 141 u_int16_t wi_sleep; 142 u_int16_t wi_delaysupp; 143 u_int16_t wi_txsupp; 144 u_int16_t wi_monitor; 145 u_int16_t wi_ledtest; 146 u_int16_t wi_ledtest_param0; 147 u_int16_t wi_ledtest_param1; 148 u_int16_t wi_conttx; 149 u_int16_t wi_conttx_param0; 150 u_int16_t wi_contrx; 151 u_int16_t wi_sigstate; 152 u_int16_t wi_sigstate_param0; 153 u_int16_t wi_confbits; 154 u_int16_t wi_confbits_param0; 155 } wi_debug; 156 157 int sc_false_syns; 158 159 u_int16_t sc_txbuf[IEEE80211_MAX_LEN/2]; 160}; 161#define sc_if sc_ic.ic_if 162 163/* maximum consecutive false change-of-BSSID indications */ 164#define WI_MAX_FALSE_SYNS 10 165 166#define WI_SCAN_INQWAIT 3 /* wait sec before inquire */ 167#define WI_SCAN_WAIT 5 /* maximum scan wait */ 168 169#define WI_FLAGS_ATTACHED 0x0001 170#define WI_FLAGS_INITIALIZED 0x0002 171#define WI_FLAGS_OUTRANGE 0x0004 172#define WI_FLAGS_HAS_MOR 0x0010 173#define WI_FLAGS_HAS_ROAMING 0x0020 174#define WI_FLAGS_HAS_DIVERSITY 0x0040 175#define WI_FLAGS_HAS_SYSSCALE 0x0080 176#define WI_FLAGS_BUG_AUTOINC 0x0100 177#define WI_FLAGS_HAS_FRAGTHR 0x0200 178#define WI_FLAGS_HAS_DBMADJUST 0x0400 179 180struct wi_card_ident { 181 u_int16_t card_id; 182 char *card_name; 183 u_int8_t firm_type; 184}; 185 186#if __FreeBSD_version < 500000 187/* 188 * Various compat hacks/kludges 189 */ 190#define le16toh(x) (x) 191#define htole16(x) (x) 192#define ifaddr_byindex(idx) ifnet_addrs[(idx) - 1]; 193#define WI_LOCK_DECL() int s 194#define WI_LOCK(_sc) s = splimp() 195#define WI_UNLOCK(_sc) splx(s) 196#else 197#define WI_LOCK_DECL() 198#define WI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 199#define WI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 200#endif 201 202int wi_attach(device_t); 203int wi_detach(device_t); 204void wi_shutdown(device_t); 205int wi_alloc(device_t, int); 206void wi_free(device_t); 207extern devclass_t wi_devclass; 208void wi_init(void *); 209void wi_intr(void *); 210int wi_mgmt_xmit(struct wi_softc *, caddr_t, int); 211void wi_stop(struct ifnet *, int); 212int wi_symbol_load_firm(struct wi_softc *, const void *, int, const void *, int); 213