if_ndisvar.h revision 151207
1/*- 2 * Copyright (c) 2003 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by Bill Paul. 16 * 4. Neither the name of the author nor the names of any co-contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 * $FreeBSD: head/sys/dev/if_ndis/if_ndisvar.h 151207 2005-10-10 16:46:39Z wpaul $ 33 */ 34 35#define NDIS_DEFAULT_NODENAME "FreeBSD NDIS node" 36#define NDIS_NODENAME_LEN 32 37 38/* For setting/getting OIDs from userspace. */ 39 40struct ndis_oid_data { 41 uint32_t oid; 42 uint32_t len; 43#ifdef notdef 44 uint8_t data[1]; 45#endif 46}; 47 48struct ndis_pci_type { 49 uint16_t ndis_vid; 50 uint16_t ndis_did; 51 uint32_t ndis_subsys; 52 char *ndis_name; 53}; 54 55struct ndis_pccard_type { 56 const char *ndis_vid; 57 const char *ndis_did; 58 char *ndis_name; 59}; 60 61struct ndis_shmem { 62 list_entry ndis_list; 63 bus_dma_tag_t ndis_stag; 64 bus_dmamap_t ndis_smap; 65 void *ndis_saddr; 66 ndis_physaddr ndis_paddr; 67}; 68 69struct ndis_cfglist { 70 ndis_cfg ndis_cfg; 71 struct sysctl_oid *ndis_oid; 72 TAILQ_ENTRY(ndis_cfglist) link; 73}; 74 75/* 76 * Helper struct to make parsing information 77 * elements easier. 78 */ 79struct ndis_ie { 80 uint8_t ni_oui[3]; 81 uint8_t ni_val; 82}; 83 84TAILQ_HEAD(nch, ndis_cfglist); 85 86#define NDIS_INITIALIZED(sc) (sc->ndis_block->nmb_devicectx != NULL) 87 88#define NDIS_INC(x) \ 89 (x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts 90 91#if __FreeBSD_version < 600000 92#define arpcom ic.ic_ac 93#endif 94 95#define NDIS_EVENTS 4 96#define NDIS_EVTINC(x) (x) = ((x) + 1) % NDIS_EVENTS 97 98struct ndis_evt { 99 uint32_t ne_sts; 100 uint32_t ne_len; 101 char *ne_buf; 102}; 103 104struct ndis_softc { 105 struct ieee80211com ic; /* interface info */ 106 struct ifnet *ifp; 107 struct ifmedia ifmedia; /* media info */ 108 u_long ndis_hwassist; 109 uint32_t ndis_v4tx; 110 uint32_t ndis_v4rx; 111 bus_space_handle_t ndis_bhandle; 112 bus_space_tag_t ndis_btag; 113 void *ndis_intrhand; 114 struct resource *ndis_irq; 115 struct resource *ndis_res; 116 struct resource *ndis_res_io; 117 int ndis_io_rid; 118 struct resource *ndis_res_mem; 119 int ndis_mem_rid; 120 struct resource *ndis_res_altmem; 121 int ndis_altmem_rid; 122 struct resource *ndis_res_am; /* attribute mem (pccard) */ 123 int ndis_am_rid; 124 struct resource *ndis_res_cm; /* common mem (pccard) */ 125 struct resource_list ndis_rl; 126 int ndis_rescnt; 127 kspin_lock ndis_spinlock; 128 uint8_t ndis_irql; 129 device_t ndis_dev; 130 int ndis_unit; 131 ndis_miniport_block *ndis_block; 132 ndis_miniport_characteristics *ndis_chars; 133 interface_type ndis_type; 134 struct callout_handle ndis_stat_ch; 135 int ndis_maxpkts; 136 ndis_oid *ndis_oids; 137 int ndis_oidcnt; 138 int ndis_txidx; 139 int ndis_txpending; 140 ndis_packet **ndis_txarray; 141 ndis_handle ndis_txpool; 142 int ndis_sc; 143 ndis_cfg *ndis_regvals; 144 struct nch ndis_cfglist_head; 145 int ndis_80211; 146 int ndis_link; 147 uint32_t ndis_sts; 148 uint32_t ndis_filter; 149 int ndis_if_flags; 150 int ndis_skip; 151 152#if __FreeBSD_version < 502113 153 struct sysctl_ctx_list ndis_ctx; 154 struct sysctl_oid *ndis_tree; 155#endif 156 int ndis_devidx; 157 interface_type ndis_iftype; 158 driver_object *ndis_dobj; 159 io_workitem *ndis_tickitem; 160 io_workitem *ndis_startitem; 161 io_workitem *ndis_resetitem; 162 kdpc ndis_rxdpc; 163 bus_dma_tag_t ndis_parent_tag; 164/* 165 struct ndis_shmem *ndis_shlist; 166*/ 167 list_entry ndis_shlist; 168 bus_dma_tag_t ndis_mtag; 169 bus_dma_tag_t ndis_ttag; 170 bus_dmamap_t *ndis_mmaps; 171 bus_dmamap_t *ndis_tmaps; 172 int ndis_mmapcnt; 173 struct ndis_evt ndis_evt[NDIS_EVENTS]; 174 int ndis_evtpidx; 175 int ndis_evtcidx; 176}; 177 178#define NDIS_LOCK(_sc) KeAcquireSpinLock(&(_sc)->ndis_spinlock, \ 179 &(_sc)->ndis_irql); 180#define NDIS_UNLOCK(_sc) KeReleaseSpinLock(&(_sc)->ndis_spinlock, \ 181 (_sc)->ndis_irql); 182 183/* 184 * Backwards compatibility defines. 185 */ 186 187#ifndef IF_ADDR_LOCK 188#define IF_ADDR_LOCK(x) 189#define IF_ADDR_UNLOCK(x) 190#endif 191 192#ifndef IFF_DRV_OACTIVE 193#define IFF_DRV_OACTIVE IFF_OACTIVE 194#define IFF_DRV_RUNNING IFF_RUNNING 195#define if_drv_flags if_flags 196#endif 197 198#ifndef ic_def_txkey 199#define ic_def_txkey ic_wep_txkey 200#define wk_keylen wk_len 201#endif 202 203#ifndef SIOCGDRVSPEC 204#define SIOCSDRVSPEC _IOW('i', 123, struct ifreq) /* set driver-specific 205 parameters */ 206#define SIOCGDRVSPEC _IOWR('i', 123, struct ifreq) /* get driver-specific 207 parameters */ 208#endif 209