1 /* $OpenBSD: if_wivar.h,v 1.24 2004/03/18 16:16:10 millert Exp $ */ 2 3 /* 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 * From: if_wireg.h,v 1.8.2.2 2001/08/25 00:48:25 nsayer Exp $ 35 */ 36 37 #include <dev/ic/if_wi_hostap.h> 38 39 struct wi_softc { 40 #ifndef __FreeBSD__ 41 struct device sc_dev; 42 #endif /* !__FreeBSD__ */ 43 struct arpcom sc_arpcom; 44 struct ifmedia sc_media; 45 bus_space_handle_t wi_bhandle; 46 bus_space_tag_t wi_btag; 47 bus_space_handle_t wi_lhandle; 48 bus_space_tag_t wi_ltag; 49 bus_size_t wi_cor_offset; 50 int wi_tx_data_id; 51 int wi_tx_mgmt_id; 52 int wi_flags; 53 int wi_if_flags; 54 int wi_cmd_count; 55 u_int16_t wi_procframe; 56 u_int16_t wi_ptype; 57 u_int16_t wi_portnum; 58 u_int16_t wi_max_data_len; 59 u_int16_t wi_rts_thresh; 60 u_int16_t wi_ap_density; 61 u_int16_t wi_tx_rate; 62 u_int16_t wi_create_ibss; 63 u_int16_t wi_channel; 64 u_int16_t wi_pm_enabled; 65 u_int16_t wi_mor_enabled; 66 u_int16_t wi_max_sleep; 67 u_int16_t wi_authtype; 68 u_int16_t wi_roaming; 69 u_int16_t wi_supprates; 70 u_int16_t wi_diversity; 71 72 u_int8_t wi_txbuf[1596]; 73 u_int8_t wi_scanbuf[1596]; 74 75 u_int8_t wi_scanbuf_len; 76 77 struct ieee80211_nwid wi_node_name; 78 struct ieee80211_nwid wi_net_name; 79 struct ieee80211_nwid wi_ibss_name; 80 81 int wi_use_wep; 82 int wi_enh_security; 83 int wi_crypto_algorithm; 84 int wi_tx_key; 85 struct wi_ltv_keys wi_keys; 86 struct wi_counters wi_stats; 87 void *sc_ih; 88 struct timeout sc_timo; 89 int sc_firmware_type; 90 int sc_sta_firmware_ver; 91 int sc_pci; 92 struct wihap_info wi_hostap_info; 93 u_int32_t wi_icv; 94 int wi_icv_flag; 95 int wi_ibss_port; 96 97 struct { 98 u_int16_t wi_sleep; 99 u_int16_t wi_delaysupp; 100 u_int16_t wi_txsupp; 101 u_int16_t wi_monitor; 102 u_int16_t wi_ledtest; 103 u_int16_t wi_ledtest_param0; 104 u_int16_t wi_ledtest_param1; 105 u_int16_t wi_conttx; 106 u_int16_t wi_conttx_param0; 107 u_int16_t wi_contrx; 108 u_int16_t wi_sigstate; 109 u_int16_t wi_sigstate_param0; 110 u_int16_t wi_confbits; 111 u_int16_t wi_confbits_param0; 112 } wi_debug; 113 void *sc_sdhook; 114 struct wi_usb_softc *wi_usb_cdata; 115 116 struct wi_funcs *sc_funcs; 117 }; 118 #define wi_cmd sc->sc_funcs->f_cmd 119 #define wi_read_record sc->sc_funcs->f_read_record 120 #define wi_write_record sc->sc_funcs->f_write_record 121 #define wi_alloc_nicmem sc->sc_funcs->f_alloc_nicmem 122 #define wi_read_data sc->sc_funcs->f_read_data 123 #define wi_write_data sc->sc_funcs->f_write_data 124 #define wi_get_fid sc->sc_funcs->f_get_fid 125 #define wi_init sc->sc_funcs->f_init 126 127 /* Values for wi_flags. */ 128 #define WI_FLAGS_ATTACHED 0x0001 129 #define WI_FLAGS_INITIALIZED 0x0002 130 #define WI_FLAGS_HAS_WEP 0x0004 131 #define WI_FLAGS_HAS_IBSS 0x0008 132 #define WI_FLAGS_HAS_CREATE_IBSS 0x0010 133 #define WI_FLAGS_HAS_MOR 0x0020 134 #define WI_FLAGS_HAS_ROAMING 0x0040 135 #define WI_FLAGS_HAS_DIVERSITY 0x0080 136 #define WI_FLAGS_HAS_HOSTAP 0x0100 137 #define WI_FLAGS_BUS_PCMCIA 0x0200 138 #define WI_FLAGS_BUS_USB 0x0400 139 #define WI_FLAGS_HAS_ENH_SECURITY 0x0800 140 141 #define WI_PRT_FMT "%s" 142 #define WI_PRT_ARG(sc) (sc)->sc_dev.dv_xname 143 144 struct wi_funcs { 145 int (*f_cmd)(struct wi_softc *sc, int cmd, int val0, int val1, 146 int val2); 147 int (*f_read_record)(struct wi_softc *sc, struct wi_ltv_gen *ltv); 148 int (*f_write_record)(struct wi_softc *sc, 149 struct wi_ltv_gen *ltv); 150 int (*f_alloc_nicmem)(struct wi_softc *sc, int len, int *id); 151 int (*f_read_data)(struct wi_softc *sc, int id, int off, 152 caddr_t buf, int len); 153 int (*f_write_data)(struct wi_softc *sc, int id, int off, 154 caddr_t buf, int len); 155 int (*f_get_fid)(struct wi_softc *sc, int fid); 156 void (*f_init)(struct wi_softc *sc); 157 158 void (*f_start)(struct ifnet *ifp); 159 int (*f_ioctl)(struct ifnet *, u_long, caddr_t); 160 void (*f_watchdog)(struct ifnet *ifp); 161 void (*f_inquire)(void *xsc); 162 }; 163 164 extern struct wi_funcs wi_func_io; 165 166 int wi_attach(struct wi_softc *, struct wi_funcs *); 167 void wi_detach(struct wi_softc *); 168 int wi_intr(void *); 169 void wi_stop(struct wi_softc *); 170 void wi_cor_reset(struct wi_softc *); 171 int wi_mgmt_xmit(struct wi_softc *, caddr_t, int); 172 173 void wi_update_stats(struct wi_softc *sc); 174 void wi_rxeof(struct wi_softc *sc); 175 void wi_txeof(struct wi_softc *sc, int status); 176