1*49e2ec9eSderaadt /* $OpenBSD: if_wivar.h,v 1.30 2010/08/30 20:42:27 deraadt Exp $ */ 22cf71003Smillert 32cf71003Smillert /* 42cf71003Smillert * Copyright (c) 1997, 1998, 1999 52cf71003Smillert * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 62cf71003Smillert * 72cf71003Smillert * Redistribution and use in source and binary forms, with or without 82cf71003Smillert * modification, are permitted provided that the following conditions 92cf71003Smillert * are met: 102cf71003Smillert * 1. Redistributions of source code must retain the above copyright 112cf71003Smillert * notice, this list of conditions and the following disclaimer. 122cf71003Smillert * 2. Redistributions in binary form must reproduce the above copyright 132cf71003Smillert * notice, this list of conditions and the following disclaimer in the 142cf71003Smillert * documentation and/or other materials provided with the distribution. 152cf71003Smillert * 3. All advertising materials mentioning features or use of this software 162cf71003Smillert * must display the following acknowledgement: 172cf71003Smillert * This product includes software developed by Bill Paul. 182cf71003Smillert * 4. Neither the name of the author nor the names of any co-contributors 192cf71003Smillert * may be used to endorse or promote products derived from this software 202cf71003Smillert * without specific prior written permission. 212cf71003Smillert * 222cf71003Smillert * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 232cf71003Smillert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 242cf71003Smillert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 252cf71003Smillert * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 262cf71003Smillert * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 272cf71003Smillert * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 282cf71003Smillert * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 292cf71003Smillert * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 302cf71003Smillert * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 312cf71003Smillert * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 322cf71003Smillert * THE POSSIBILITY OF SUCH DAMAGE. 332cf71003Smillert * 341de77e4fSmickey * From: if_wireg.h,v 1.8.2.2 2001/08/25 00:48:25 nsayer Exp $ 352cf71003Smillert */ 362cf71003Smillert 371de77e4fSmickey #include <dev/ic/if_wi_hostap.h> 381de77e4fSmickey 392cf71003Smillert struct wi_softc { 402cf71003Smillert struct device sc_dev; 4155f29f42Sjsg struct ieee80211com sc_ic; 423f497931Smickey struct ifmedia sc_media; 432cf71003Smillert bus_space_handle_t wi_bhandle; 442cf71003Smillert bus_space_tag_t wi_btag; 457c600ae8Smillert bus_space_handle_t wi_lhandle; 467c600ae8Smillert bus_space_tag_t wi_ltag; 477c600ae8Smillert bus_size_t wi_cor_offset; 482cf71003Smillert int wi_tx_data_id; 492cf71003Smillert int wi_tx_mgmt_id; 50f9242e52Smillert int wi_flags; 512cf71003Smillert int wi_if_flags; 52375f9aaeSmillert int wi_cmd_count; 5325f6eb65Smillert u_int16_t wi_procframe; 542cf71003Smillert u_int16_t wi_ptype; 552cf71003Smillert u_int16_t wi_portnum; 562cf71003Smillert u_int16_t wi_max_data_len; 572cf71003Smillert u_int16_t wi_rts_thresh; 582cf71003Smillert u_int16_t wi_ap_density; 592cf71003Smillert u_int16_t wi_tx_rate; 602cf71003Smillert u_int16_t wi_create_ibss; 612cf71003Smillert u_int16_t wi_channel; 622cf71003Smillert u_int16_t wi_pm_enabled; 6338f7d3e7Smillert u_int16_t wi_mor_enabled; 642cf71003Smillert u_int16_t wi_max_sleep; 655123e574Smickey u_int16_t wi_authtype; 665123e574Smickey u_int16_t wi_roaming; 671de77e4fSmickey u_int16_t wi_supprates; 68a458d0e6Smillert u_int16_t wi_diversity; 695123e574Smickey 700595c65bSpascoe u_int8_t wi_rxbuf[1596]; 71dc5956cdSderaadt u_int8_t wi_txbuf[1596]; 72dc5956cdSderaadt u_int8_t wi_scanbuf[1596]; 730f5259a2Sreyk int wi_scan_lock; 740f5259a2Sreyk struct timeout wi_scan_timeout; 75dc5956cdSderaadt 76dc5956cdSderaadt u_int8_t wi_scanbuf_len; 77dc5956cdSderaadt 783f497931Smickey struct ieee80211_nwid wi_node_name; 793f497931Smickey struct ieee80211_nwid wi_net_name; 803f497931Smickey struct ieee80211_nwid wi_ibss_name; 815123e574Smickey 822cf71003Smillert int wi_use_wep; 8395ec1fb9Smillert int wi_enh_security; 84822260fcSmillert int wi_crypto_algorithm; 852cf71003Smillert int wi_tx_key; 862cf71003Smillert struct wi_ltv_keys wi_keys; 872cf71003Smillert struct wi_counters wi_stats; 882cf71003Smillert void *sc_ih; 892cf71003Smillert struct timeout sc_timo; 907c600ae8Smillert int sc_firmware_type; 917c600ae8Smillert int sc_sta_firmware_ver; 92ad850669Smickey int sc_pci; 931de77e4fSmickey struct wihap_info wi_hostap_info; 941de77e4fSmickey u_int32_t wi_icv; 951de77e4fSmickey int wi_icv_flag; 964580a9d3Smillert int wi_ibss_port; 97eb215967Sreyk int16_t wi_txpower; 9825f6eb65Smillert 9925f6eb65Smillert struct { 10025f6eb65Smillert u_int16_t wi_sleep; 10125f6eb65Smillert u_int16_t wi_delaysupp; 10225f6eb65Smillert u_int16_t wi_txsupp; 10325f6eb65Smillert u_int16_t wi_monitor; 10425f6eb65Smillert u_int16_t wi_ledtest; 10525f6eb65Smillert u_int16_t wi_ledtest_param0; 10625f6eb65Smillert u_int16_t wi_ledtest_param1; 10725f6eb65Smillert u_int16_t wi_conttx; 10825f6eb65Smillert u_int16_t wi_conttx_param0; 10925f6eb65Smillert u_int16_t wi_contrx; 11025f6eb65Smillert u_int16_t wi_sigstate; 11125f6eb65Smillert u_int16_t wi_sigstate_param0; 11225f6eb65Smillert u_int16_t wi_confbits; 11325f6eb65Smillert u_int16_t wi_confbits_param0; 11425f6eb65Smillert } wi_debug; 11537837c73Sdrahn struct wi_usb_softc *wi_usb_cdata; 11637837c73Sdrahn 11737837c73Sdrahn struct wi_funcs *sc_funcs; 1182cf71003Smillert }; 11937837c73Sdrahn #define wi_cmd sc->sc_funcs->f_cmd 12037837c73Sdrahn #define wi_read_record sc->sc_funcs->f_read_record 12137837c73Sdrahn #define wi_write_record sc->sc_funcs->f_write_record 12237837c73Sdrahn #define wi_alloc_nicmem sc->sc_funcs->f_alloc_nicmem 12337837c73Sdrahn #define wi_read_data sc->sc_funcs->f_read_data 12437837c73Sdrahn #define wi_write_data sc->sc_funcs->f_write_data 12537837c73Sdrahn #define wi_get_fid sc->sc_funcs->f_get_fid 12637837c73Sdrahn #define wi_init sc->sc_funcs->f_init 1272cf71003Smillert 128f9242e52Smillert /* Values for wi_flags. */ 129f8b244a8Smillert #define WI_FLAGS_ATTACHED 0x0001 130f8b244a8Smillert #define WI_FLAGS_INITIALIZED 0x0002 131f8b244a8Smillert #define WI_FLAGS_HAS_WEP 0x0004 132f8b244a8Smillert #define WI_FLAGS_HAS_IBSS 0x0008 133f8b244a8Smillert #define WI_FLAGS_HAS_CREATE_IBSS 0x0010 134f8b244a8Smillert #define WI_FLAGS_HAS_MOR 0x0020 135f8b244a8Smillert #define WI_FLAGS_HAS_ROAMING 0x0040 136f8b244a8Smillert #define WI_FLAGS_HAS_DIVERSITY 0x0080 137f8b244a8Smillert #define WI_FLAGS_HAS_HOSTAP 0x0100 138c3c4c461Sfgsch #define WI_FLAGS_BUS_PCMCIA 0x0200 13937837c73Sdrahn #define WI_FLAGS_BUS_USB 0x0400 14095ec1fb9Smillert #define WI_FLAGS_HAS_ENH_SECURITY 0x0800 141eb215967Sreyk #define WI_FLAGS_TXPOWER 0x1000 142*49e2ec9eSderaadt #define WI_FLAGS_BUSY 0x2000 143f9242e52Smillert 1442cf71003Smillert #define WI_PRT_FMT "%s" 1452cf71003Smillert #define WI_PRT_ARG(sc) (sc)->sc_dev.dv_xname 1461de77e4fSmickey 14737837c73Sdrahn struct wi_funcs { 14837837c73Sdrahn int (*f_cmd)(struct wi_softc *sc, int cmd, int val0, int val1, 14937837c73Sdrahn int val2); 15037837c73Sdrahn int (*f_read_record)(struct wi_softc *sc, struct wi_ltv_gen *ltv); 15137837c73Sdrahn int (*f_write_record)(struct wi_softc *sc, 15237837c73Sdrahn struct wi_ltv_gen *ltv); 15337837c73Sdrahn int (*f_alloc_nicmem)(struct wi_softc *sc, int len, int *id); 15437837c73Sdrahn int (*f_read_data)(struct wi_softc *sc, int id, int off, 15537837c73Sdrahn caddr_t buf, int len); 15637837c73Sdrahn int (*f_write_data)(struct wi_softc *sc, int id, int off, 15737837c73Sdrahn caddr_t buf, int len); 15837837c73Sdrahn int (*f_get_fid)(struct wi_softc *sc, int fid); 15937837c73Sdrahn void (*f_init)(struct wi_softc *sc); 16037837c73Sdrahn 16137837c73Sdrahn void (*f_start)(struct ifnet *ifp); 16237837c73Sdrahn int (*f_ioctl)(struct ifnet *, u_long, caddr_t); 16337837c73Sdrahn void (*f_watchdog)(struct ifnet *ifp); 16437837c73Sdrahn void (*f_inquire)(void *xsc); 16537837c73Sdrahn }; 16637837c73Sdrahn 16737837c73Sdrahn extern struct wi_funcs wi_func_io; 16837837c73Sdrahn 16937837c73Sdrahn int wi_attach(struct wi_softc *, struct wi_funcs *); 17012366eb7Sdrahn void wi_detach(struct wi_softc *); 1718e9befddSfgsch int wi_intr(void *); 1728e9befddSfgsch void wi_stop(struct wi_softc *); 1738e9befddSfgsch void wi_cor_reset(struct wi_softc *); 1741de77e4fSmickey int wi_mgmt_xmit(struct wi_softc *, caddr_t, int); 17537837c73Sdrahn 17637837c73Sdrahn void wi_update_stats(struct wi_softc *sc); 17737837c73Sdrahn void wi_rxeof(struct wi_softc *sc); 17837837c73Sdrahn void wi_txeof(struct wi_softc *sc, int status); 179