if_wivar.h revision 94486
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 94486 2002-04-12 06:01:28Z imp $ 35 */ 36 37#define WICACHE /* turn on signal strength cache code */ 38#define MAXWICACHE 10 39 40struct wi_counters { 41 u_int32_t wi_tx_unicast_frames; 42 u_int32_t wi_tx_multicast_frames; 43 u_int32_t wi_tx_fragments; 44 u_int32_t wi_tx_unicast_octets; 45 u_int32_t wi_tx_multicast_octets; 46 u_int32_t wi_tx_deferred_xmits; 47 u_int32_t wi_tx_single_retries; 48 u_int32_t wi_tx_multi_retries; 49 u_int32_t wi_tx_retry_limit; 50 u_int32_t wi_tx_discards; 51 u_int32_t wi_rx_unicast_frames; 52 u_int32_t wi_rx_multicast_frames; 53 u_int32_t wi_rx_fragments; 54 u_int32_t wi_rx_unicast_octets; 55 u_int32_t wi_rx_multicast_octets; 56 u_int32_t wi_rx_fcs_errors; 57 u_int32_t wi_rx_discards_nobuf; 58 u_int32_t wi_tx_discards_wrong_sa; 59 u_int32_t wi_rx_WEP_cant_decrypt; 60 u_int32_t wi_rx_msg_in_msg_frags; 61 u_int32_t wi_rx_msg_in_bad_msg_frags; 62}; 63 64/* 65 * Encryption controls. We can enable or disable encryption as 66 * well as specify up to 4 encryption keys. We can also specify 67 * which of the four keys will be used for transmit encryption. 68 */ 69#define WI_RID_ENCRYPTION 0xFC20 70#define WI_RID_AUTHTYPE 0xFC21 71#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0 72#define WI_RID_TX_CRYPT_KEY 0xFCB1 73#define WI_RID_WEP_AVAIL 0xFD4F 74#define WI_RID_P2_TX_CRYPT_KEY 0xFC23 75#define WI_RID_P2_CRYPT_KEY0 0xFC24 76#define WI_RID_P2_CRYPT_KEY1 0xFC25 77#define WI_RID_MICROWAVE_OVEN 0xFC25 78#define WI_RID_P2_CRYPT_KEY2 0xFC26 79#define WI_RID_P2_CRYPT_KEY3 0xFC27 80#define WI_RID_P2_ENCRYPTION 0xFC28 81#define WI_RID_ROAMING_MODE 0xFC2D 82#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */ 83struct wi_key { 84 u_int16_t wi_keylen; 85 u_int8_t wi_keydat[14]; 86}; 87 88struct wi_ltv_keys { 89 u_int16_t wi_len; 90 u_int16_t wi_type; 91 struct wi_key wi_keys[4]; 92}; 93 94struct wi_softc { 95 struct arpcom arpcom; 96 struct ifmedia ifmedia; 97 device_t dev; 98 int wi_unit; 99 struct resource * local; 100 int local_rid; 101 struct resource * iobase; 102 int iobase_rid; 103 struct resource * irq; 104 int irq_rid; 105 struct resource * mem; 106 int mem_rid; 107 bus_space_handle_t wi_localhandle; 108 bus_space_tag_t wi_localtag; 109 bus_space_handle_t wi_bhandle; 110 bus_space_tag_t wi_btag; 111 bus_space_handle_t wi_bmemhandle; 112 bus_space_tag_t wi_bmemtag; 113 void * wi_intrhand; 114 int sc_firmware_type; 115#define WI_NOTYPE 0 116#define WI_LUCENT 1 117#define WI_INTERSIL 2 118#define WI_SYMBOL 3 119 int sc_pri_firmware_ver; /* Primary firmware */ 120 int sc_sta_firmware_ver; /* Station firmware */ 121 int sc_enabled; 122 int wi_io_addr; 123 int wi_tx_data_id; 124 int wi_tx_mgmt_id; 125 int wi_gone; 126 int wi_if_flags; 127 u_int16_t wi_procframe; 128 u_int16_t wi_ptype; 129 u_int16_t wi_portnum; 130 u_int16_t wi_max_data_len; 131 u_int16_t wi_rts_thresh; 132 u_int16_t wi_ap_density; 133 u_int16_t wi_tx_rate; 134 u_int16_t wi_create_ibss; 135 u_int16_t wi_channel; 136 u_int16_t wi_pm_enabled; 137 u_int16_t wi_mor_enabled; 138 u_int16_t wi_max_sleep; 139 u_int16_t wi_supprates; 140 u_int16_t wi_authtype; 141 u_int16_t wi_roaming; 142 143 char wi_node_name[32]; 144 char wi_net_name[32]; 145 char wi_ibss_name[32]; 146 u_int8_t wi_txbuf[1596]; 147 u_int8_t wi_scanbuf[1596]; 148 int wi_scanbuf_len; 149 struct wi_counters wi_stats; 150 int wi_has_wep; 151 int wi_use_wep; 152 int wi_authmode; 153 int wi_tx_key; 154 struct wi_ltv_keys wi_keys; 155#ifdef WICACHE 156 int wi_sigitems; 157 struct wi_sigcache wi_sigcache[MAXWICACHE]; 158 int wi_nextitem; 159#endif 160 struct wihap_info wi_hostap_info; 161 u_int32_t wi_icv; 162 int wi_icv_flag; 163 struct callout_handle wi_stat_ch; 164 struct mtx wi_mtx; 165 int wi_nic_type; 166 int wi_bus_type; /* Bus attachment type */ 167 struct { 168 u_int16_t wi_sleep; 169 u_int16_t wi_delaysupp; 170 u_int16_t wi_txsupp; 171 u_int16_t wi_monitor; 172 u_int16_t wi_ledtest; 173 u_int16_t wi_ledtest_param0; 174 u_int16_t wi_ledtest_param1; 175 u_int16_t wi_conttx; 176 u_int16_t wi_conttx_param0; 177 u_int16_t wi_contrx; 178 u_int16_t wi_sigstate; 179 u_int16_t wi_sigstate_param0; 180 u_int16_t wi_confbits; 181 u_int16_t wi_confbits_param0; 182 } wi_debug; 183 184}; 185 186struct wi_card_ident { 187 u_int16_t card_id; 188 char *card_name; 189 u_int8_t firm_type; 190}; 191 192#define WI_LOCK(_sc) 193#define WI_UNLOCK(_sc) 194 195int wi_generic_attach(device_t); 196int wi_generic_detach(device_t); 197void wi_shutdown(device_t); 198int wi_alloc(device_t, int); 199void wi_free(device_t); 200extern devclass_t wi_devclass; 201int wi_mgmt_xmit(struct wi_softc *, caddr_t, int); 202