3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
35 #define NDIS_DEFAULT_NODENAME "FreeBSD NDIS node"
36 #define NDIS_NODENAME_LEN 32
38 /* For setting/getting OIDs from userspace. */
40 struct ndis_oid_data {
48 struct ndis_pci_type {
55 struct ndis_pccard_type {
63 bus_dma_tag_t ndis_stag;
64 bus_dmamap_t ndis_smap;
66 ndis_physaddr ndis_paddr;
71 struct sysctl_oid *ndis_oid;
72 TAILQ_ENTRY(ndis_cfglist) link;
76 * Helper struct to make parsing information
84 TAILQ_HEAD(nch, ndis_cfglist);
86 #define NDIS_INITIALIZED(sc) (sc->ndis_block->nmb_devicectx != NULL)
88 #define NDIS_TXPKTS 64
90 (x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts
92 #if __FreeBSD_version < 600007
93 #define arpcom ic.ic_ac
97 #define NDIS_EVTINC(x) (x) = ((x) + 1) % NDIS_EVENTS
106 struct ieee80211com ic; /* interface info */
108 struct ifmedia ifmedia; /* media info */
109 u_long ndis_hwassist;
112 bus_space_handle_t ndis_bhandle;
113 bus_space_tag_t ndis_btag;
115 struct resource *ndis_irq;
116 struct resource *ndis_res;
117 struct resource *ndis_res_io;
119 struct resource *ndis_res_mem;
121 struct resource *ndis_res_altmem;
123 struct resource *ndis_res_am; /* attribute mem (pccard) */
125 struct resource *ndis_res_cm; /* common mem (pccard) */
126 struct resource_list ndis_rl;
128 kspin_lock ndis_spinlock;
132 ndis_miniport_block *ndis_block;
133 ndis_miniport_characteristics *ndis_chars;
134 interface_type ndis_type;
135 struct callout_handle ndis_stat_ch;
141 ndis_packet **ndis_txarray;
142 ndis_handle ndis_txpool;
144 ndis_cfg *ndis_regvals;
145 struct nch ndis_cfglist_head;
149 uint32_t ndis_filter;
153 #if __FreeBSD_version < 502113
154 struct sysctl_ctx_list ndis_ctx;
155 struct sysctl_oid *ndis_tree;
158 interface_type ndis_iftype;
159 driver_object *ndis_dobj;
160 io_workitem *ndis_tickitem;
161 io_workitem *ndis_startitem;
162 io_workitem *ndis_resetitem;
163 io_workitem *ndis_inputitem;
165 bus_dma_tag_t ndis_parent_tag;
166 list_entry ndis_shlist;
167 bus_dma_tag_t ndis_mtag;
168 bus_dma_tag_t ndis_ttag;
169 bus_dmamap_t *ndis_mmaps;
170 bus_dmamap_t *ndis_tmaps;
172 struct ndis_evt ndis_evt[NDIS_EVENTS];
175 struct ifqueue ndis_rxqueue;
176 kspin_lock ndis_rxlock;
178 struct taskqueue *ndis_tq; /* private task queue */
179 #if __FreeBSD_version < 700000
180 struct proc *ndis_tqproc;
182 struct task ndis_scantask;
183 int (*ndis_newstate)(struct ieee80211com *,
184 enum ieee80211_state, int);
187 #define NDIS_LOCK(_sc) KeAcquireSpinLock(&(_sc)->ndis_spinlock, \
189 #define NDIS_UNLOCK(_sc) KeReleaseSpinLock(&(_sc)->ndis_spinlock, \
193 * Backwards compatibility defines.
197 #define IF_ADDR_LOCK(x)
198 #define IF_ADDR_UNLOCK(x)
201 #ifndef IFF_DRV_OACTIVE
202 #define IFF_DRV_OACTIVE IFF_OACTIVE
203 #define IFF_DRV_RUNNING IFF_RUNNING
204 #define if_drv_flags if_flags
208 #define ic_def_txkey ic_wep_txkey
209 #define wk_keylen wk_len
213 #define SIOCSDRVSPEC _IOW('i', 123, struct ifreq) /* set driver-specific
215 #define SIOCGDRVSPEC _IOWR('i', 123, struct ifreq) /* get driver-specific