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.
32 * $FreeBSD: src/sys/dev/if_ndis/if_ndisvar.h,v 1.15.2.2 2005/02/18 16:30:10 wpaul Exp $
35 #define NDIS_DEFAULT_NODENAME "FreeBSD NDIS node"
36 #define NDIS_NODENAME_LEN 32
39 #include <dev/pci/pcivar.h>
40 #include <dev/pci/pcireg.h>
41 #include <dev/pci/pcidevs.h>
43 #include <dev/pcmcia/pcmciareg.h>
44 #include <dev/pcmcia/pcmciavar.h>
45 #include <dev/pcmcia/pcmciadevs.h>
47 #include <dev/cardbus/cardbusvar.h>
48 #include <dev/cardbus/cardbusreg.h>
51 struct ndis_pci_type
{
52 const uint16_t ndis_vid
;
53 const uint16_t ndis_did
;
54 const uint32_t ndis_subsys
;
55 const char *ndis_name
;
58 struct ndis_pccard_type
{
65 bus_dma_tag_t ndis_stag
;
66 bus_dmamap_t ndis_smap
;
68 struct ndis_shmem
*ndis_next
;
73 TAILQ_ENTRY(ndis_cfglist
) link
;
76 TAILQ_HEAD(nch
, ndis_cfglist
);
78 #define NDIS_INITIALIZED(sc) (sc->ndis_block->nmb_miniportadapterctx != NULL)
81 (x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts
85 * A linked list of resources
88 SLIST_ENTRY(resource
) link
;
89 cm_partial_resource_desc win_res
;
91 SLIST_HEAD(resource_list
, resource
);
92 #endif /* __NetBSD__ */
95 #define arpcom ic.ic_ac
99 struct ndis_resource
{
100 bus_space_handle_t res_handle
;
101 bus_space_tag_t res_tag
;
114 * TODO: It seems like in the attach function the ndis "struct device" object
115 * and the softc are the same thing, so I added a "struct device" to the
116 * front of the softc, to make sure the arpcom field wasn't getting
117 * messed up. However, I'm not sure if the arpcom field is supposed
118 * to be first for some other reason.
121 struct ethercom arpcom
;
123 struct ieee80211com ic
; /* interface info */
125 struct ieee80211com arpcom
; /* interface info */
127 struct ifmedia ifmedia
; /* media info */
128 u_long ndis_hwassist
;
131 bus_space_handle_t ndis_bhandle
;
132 bus_space_tag_t ndis_btag
;
135 struct resource
*ndis_irq
;
136 struct resource
*ndis_res
;
137 struct resource
*ndis_res_io
;
139 struct resource
*ndis_res_mem
;
141 struct resource
*ndis_res_altmem
;
143 struct resource
*ndis_res_am
; /* attribute mem (pccard) */
145 struct resource
*ndis_res_cm
; /* common mem (pccard) */
146 struct resource_list ndis_rl
;
147 #else /* __NetBSD__ */
148 uint8_t ndis_mac
[ETHER_ADDR_LEN
];
150 struct sysctllog
*sysctllog
;
152 //ndis_resource_list ndis_rl;
153 ndis_resource_list
*ndis_rl
;
155 /* TODO: Is the ndis_irq set up right? */
158 /* for both pci and cardbus ? */
159 struct ndis_resource
*ndis_res_io
;
160 int ndis_io_rid
; /* not actuially used, just for bus_release_resource() */
161 struct ndis_resource
*ndis_res_mem
;
162 struct ndis_resource
*ndis_res_altmem
;
163 int ndis_mem_rid
; /* not actuially used, just for bus_release_resource() */
166 pci_chipset_tag_t ndis_res_pc
; /* pci chipset */
167 pcitag_t ndis_res_pctag
; /* pci tag */
168 pci_intr_handle_t pci_ih
; /* interrupt handle */
170 /* pcmcia specific */
171 struct pcmcia_io_handle ndis_res_pcioh
; /* specific i/o for pcmcia */
172 struct pcmcia_mem_handle ndis_res_pcmem
; /* specific mem for pcmcia */
173 int sc_io_windows
; /* i/o window */
174 struct pcmcia_function
* ndis_res_pcfunc
; /* pcmcia function */
176 /* cardbus specific */
177 cardbus_devfunc_t ndis_res_ct
; /* cardbus devfuncs */
178 cardbustag_t ndis_res_ctag
; /* carbus tag */
179 bus_size_t ndis_res_mapsize
; /* size of mapped bus space region */
180 #endif /* end __NetBSD__ section */
184 #else /* __NetBSD__ */
185 struct simplelock ndis_mtx
;
189 ndis_miniport_block
*ndis_block
;
190 ndis_miniport_characteristics
*ndis_chars
;
191 interface_type ndis_type
;
193 struct callout_handle ndis_stat_ch
;
195 struct callout ndis_stat_ch
;
202 ndis_packet
**ndis_txarray
;
203 ndis_handle ndis_txpool
;
205 ndis_cfg
*ndis_regvals
;
206 struct nch ndis_cfglist_head
;
209 uint32_t ndis_filter
;
214 struct sysctl_ctx_list ndis_ctx
;
216 #if __FreeBSD__ && __FreeBSD_version < 502113
217 struct sysctl_oid
*ndis_tree
;
220 interface_type ndis_iftype
;
222 bus_dma_tag_t ndis_parent_tag
;
223 struct ndis_shmem
*ndis_shlist
;
224 bus_dma_tag_t ndis_mtag
;
225 bus_dma_tag_t ndis_ttag
;
226 bus_dmamap_t
*ndis_mmaps
;
227 bus_dmamap_t
*ndis_tmaps
;
233 #define NDIS_LOCK(_sc) mtx_lock(&(_sc)->ndis_mtx)
234 #define NDIS_UNLOCK(_sc) mtx_unlock(&(_sc)->ndis_mtx)
236 #else /* __NetBSD__ */
238 #define NDIS_LOCK(_sc) do {s = spl_sc(); simple_lock(&(_sc)->ndis_mtx);} while(0)
239 #define NDIS_UNLOCK(_sc) do {simple_unlock(&(_sc)->ndis_mtx); splx(s);} while(0)
240 #define spl_sc() splnet()
244 /*static*/ __stdcall
void ndis_txeof (ndis_handle
, ndis_packet
*, ndis_status
);
245 /*static*/ __stdcall
void ndis_rxeof (ndis_handle
, ndis_packet
**, uint32_t);
246 /*static*/ __stdcall
void ndis_linksts (ndis_handle
, ndis_status
, void *, uint32_t);
247 /*static*/ __stdcall
void ndis_linksts_done (ndis_handle
);