if_ndisvar.h revision 151207
1139749Simp/*- 2123474Swpaul * Copyright (c) 2003 3123474Swpaul * Bill Paul <wpaul@windriver.com>. All rights reserved. 4123474Swpaul * 5123474Swpaul * Redistribution and use in source and binary forms, with or without 6123474Swpaul * modification, are permitted provided that the following conditions 7123474Swpaul * are met: 8123474Swpaul * 1. Redistributions of source code must retain the above copyright 9123474Swpaul * notice, this list of conditions and the following disclaimer. 10123474Swpaul * 2. Redistributions in binary form must reproduce the above copyright 11123474Swpaul * notice, this list of conditions and the following disclaimer in the 12123474Swpaul * documentation and/or other materials provided with the distribution. 13123474Swpaul * 3. All advertising materials mentioning features or use of this software 14123474Swpaul * must display the following acknowledgement: 15123474Swpaul * This product includes software developed by Bill Paul. 16123474Swpaul * 4. Neither the name of the author nor the names of any co-contributors 17123474Swpaul * may be used to endorse or promote products derived from this software 18123474Swpaul * without specific prior written permission. 19123474Swpaul * 20123474Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21123474Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22123474Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23123474Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 24123474Swpaul * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25123474Swpaul * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26123474Swpaul * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27123474Swpaul * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28123474Swpaul * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29123474Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30123474Swpaul * THE POSSIBILITY OF SUCH DAMAGE. 31123474Swpaul * 32123474Swpaul * $FreeBSD: head/sys/dev/if_ndis/if_ndisvar.h 151207 2005-10-10 16:46:39Z wpaul $ 33123474Swpaul */ 34123474Swpaul 35128229Swpaul#define NDIS_DEFAULT_NODENAME "FreeBSD NDIS node" 36128229Swpaul#define NDIS_NODENAME_LEN 32 37128229Swpaul 38151207Swpaul/* For setting/getting OIDs from userspace. */ 39151207Swpaul 40151207Swpaulstruct ndis_oid_data { 41151207Swpaul uint32_t oid; 42151207Swpaul uint32_t len; 43151207Swpaul#ifdef notdef 44151207Swpaul uint8_t data[1]; 45151207Swpaul#endif 46151207Swpaul}; 47151207Swpaul 48126706Swpaulstruct ndis_pci_type { 49123474Swpaul uint16_t ndis_vid; 50123474Swpaul uint16_t ndis_did; 51123620Swpaul uint32_t ndis_subsys; 52123474Swpaul char *ndis_name; 53123474Swpaul}; 54123474Swpaul 55126706Swpaulstruct ndis_pccard_type { 56126706Swpaul const char *ndis_vid; 57126706Swpaul const char *ndis_did; 58126706Swpaul char *ndis_name; 59126706Swpaul}; 60126706Swpaul 61123474Swpaulstruct ndis_shmem { 62151207Swpaul list_entry ndis_list; 63123474Swpaul bus_dma_tag_t ndis_stag; 64123474Swpaul bus_dmamap_t ndis_smap; 65123474Swpaul void *ndis_saddr; 66145895Swpaul ndis_physaddr ndis_paddr; 67123474Swpaul}; 68123474Swpaul 69123474Swpaulstruct ndis_cfglist { 70123474Swpaul ndis_cfg ndis_cfg; 71151207Swpaul struct sysctl_oid *ndis_oid; 72123474Swpaul TAILQ_ENTRY(ndis_cfglist) link; 73123474Swpaul}; 74123474Swpaul 75151207Swpaul/* 76151207Swpaul * Helper struct to make parsing information 77151207Swpaul * elements easier. 78151207Swpaul */ 79151207Swpaulstruct ndis_ie { 80151207Swpaul uint8_t ni_oui[3]; 81151207Swpaul uint8_t ni_val; 82151207Swpaul}; 83151207Swpaul 84123474SwpaulTAILQ_HEAD(nch, ndis_cfglist); 85123474Swpaul 86151207Swpaul#define NDIS_INITIALIZED(sc) (sc->ndis_block->nmb_devicectx != NULL) 87131750Swpaul 88123474Swpaul#define NDIS_INC(x) \ 89123474Swpaul (x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts 90123474Swpaul 91151207Swpaul#if __FreeBSD_version < 600000 92151207Swpaul#define arpcom ic.ic_ac 93151207Swpaul#endif 94151207Swpaul 95151207Swpaul#define NDIS_EVENTS 4 96151207Swpaul#define NDIS_EVTINC(x) (x) = ((x) + 1) % NDIS_EVENTS 97151207Swpaul 98151207Swpaulstruct ndis_evt { 99151207Swpaul uint32_t ne_sts; 100151207Swpaul uint32_t ne_len; 101151207Swpaul char *ne_buf; 102151207Swpaul}; 103151207Swpaul 104123474Swpaulstruct ndis_softc { 105151207Swpaul struct ieee80211com ic; /* interface info */ 106147256Sbrooks struct ifnet *ifp; 107123474Swpaul struct ifmedia ifmedia; /* media info */ 108124821Swpaul u_long ndis_hwassist; 109124821Swpaul uint32_t ndis_v4tx; 110124821Swpaul uint32_t ndis_v4rx; 111123474Swpaul bus_space_handle_t ndis_bhandle; 112123474Swpaul bus_space_tag_t ndis_btag; 113123474Swpaul void *ndis_intrhand; 114123474Swpaul struct resource *ndis_irq; 115123474Swpaul struct resource *ndis_res; 116123474Swpaul struct resource *ndis_res_io; 117123474Swpaul int ndis_io_rid; 118123474Swpaul struct resource *ndis_res_mem; 119123474Swpaul int ndis_mem_rid; 120123474Swpaul struct resource *ndis_res_altmem; 121123474Swpaul int ndis_altmem_rid; 122123474Swpaul struct resource *ndis_res_am; /* attribute mem (pccard) */ 123131953Swpaul int ndis_am_rid; 124123474Swpaul struct resource *ndis_res_cm; /* common mem (pccard) */ 125131953Swpaul struct resource_list ndis_rl; 126123474Swpaul int ndis_rescnt; 127151207Swpaul kspin_lock ndis_spinlock; 128151207Swpaul uint8_t ndis_irql; 129123474Swpaul device_t ndis_dev; 130123474Swpaul int ndis_unit; 131141524Swpaul ndis_miniport_block *ndis_block; 132141524Swpaul ndis_miniport_characteristics *ndis_chars; 133123474Swpaul interface_type ndis_type; 134123474Swpaul struct callout_handle ndis_stat_ch; 135123474Swpaul int ndis_maxpkts; 136123474Swpaul ndis_oid *ndis_oids; 137123474Swpaul int ndis_oidcnt; 138123474Swpaul int ndis_txidx; 139123474Swpaul int ndis_txpending; 140123474Swpaul ndis_packet **ndis_txarray; 141141963Swpaul ndis_handle ndis_txpool; 142123474Swpaul int ndis_sc; 143123474Swpaul ndis_cfg *ndis_regvals; 144123474Swpaul struct nch ndis_cfglist_head; 145123695Swpaul int ndis_80211; 146123695Swpaul int ndis_link; 147151207Swpaul uint32_t ndis_sts; 148123695Swpaul uint32_t ndis_filter; 149123695Swpaul int ndis_if_flags; 150125076Swpaul int ndis_skip; 151123474Swpaul 152130097Sdes#if __FreeBSD_version < 502113 153123474Swpaul struct sysctl_ctx_list ndis_ctx; 154123474Swpaul struct sysctl_oid *ndis_tree; 155130097Sdes#endif 156123620Swpaul int ndis_devidx; 157123474Swpaul interface_type ndis_iftype; 158145485Swpaul driver_object *ndis_dobj; 159151207Swpaul io_workitem *ndis_tickitem; 160151207Swpaul io_workitem *ndis_startitem; 161151207Swpaul io_workitem *ndis_resetitem; 162146230Swpaul kdpc ndis_rxdpc; 163123474Swpaul bus_dma_tag_t ndis_parent_tag; 164151207Swpaul/* 165123474Swpaul struct ndis_shmem *ndis_shlist; 166151207Swpaul*/ 167151207Swpaul list_entry ndis_shlist; 168123474Swpaul bus_dma_tag_t ndis_mtag; 169123474Swpaul bus_dma_tag_t ndis_ttag; 170123474Swpaul bus_dmamap_t *ndis_mmaps; 171123474Swpaul bus_dmamap_t *ndis_tmaps; 172123474Swpaul int ndis_mmapcnt; 173151207Swpaul struct ndis_evt ndis_evt[NDIS_EVENTS]; 174151207Swpaul int ndis_evtpidx; 175151207Swpaul int ndis_evtcidx; 176123474Swpaul}; 177123474Swpaul 178151207Swpaul#define NDIS_LOCK(_sc) KeAcquireSpinLock(&(_sc)->ndis_spinlock, \ 179151207Swpaul &(_sc)->ndis_irql); 180151207Swpaul#define NDIS_UNLOCK(_sc) KeReleaseSpinLock(&(_sc)->ndis_spinlock, \ 181151207Swpaul (_sc)->ndis_irql); 182151207Swpaul 183151207Swpaul/* 184151207Swpaul * Backwards compatibility defines. 185151207Swpaul */ 186151207Swpaul 187151207Swpaul#ifndef IF_ADDR_LOCK 188151207Swpaul#define IF_ADDR_LOCK(x) 189151207Swpaul#define IF_ADDR_UNLOCK(x) 190151207Swpaul#endif 191151207Swpaul 192151207Swpaul#ifndef IFF_DRV_OACTIVE 193151207Swpaul#define IFF_DRV_OACTIVE IFF_OACTIVE 194151207Swpaul#define IFF_DRV_RUNNING IFF_RUNNING 195151207Swpaul#define if_drv_flags if_flags 196151207Swpaul#endif 197151207Swpaul 198151207Swpaul#ifndef ic_def_txkey 199151207Swpaul#define ic_def_txkey ic_wep_txkey 200151207Swpaul#define wk_keylen wk_len 201151207Swpaul#endif 202151207Swpaul 203151207Swpaul#ifndef SIOCGDRVSPEC 204151207Swpaul#define SIOCSDRVSPEC _IOW('i', 123, struct ifreq) /* set driver-specific 205151207Swpaul parameters */ 206151207Swpaul#define SIOCGDRVSPEC _IOWR('i', 123, struct ifreq) /* get driver-specific 207151207Swpaul parameters */ 208151207Swpaul#endif 209