if_ndisvar.h revision 123474
1123474Swpaul/*
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 123474 2003-12-11 22:34:37Z wpaul $
33123474Swpaul */
34123474Swpaul
35123474Swpaul#define NDIS_PCI_LOIO		0x10
36123474Swpaul#define NDIS_PCI_LOMEM		0x14
37123474Swpaul
38123474Swpaul
39123474Swpaulstruct ndis_chain_onefrag {
40123474Swpaul	void			*dummy;
41123474Swpaul};
42123474Swpaul
43123474Swpaulstruct ndis_chain {
44123474Swpaul	void			*dummy;
45123474Swpaul};
46123474Swpaul
47123474Swpaulstruct ndis_type {
48123474Swpaul	uint16_t		ndis_vid;
49123474Swpaul	uint16_t		ndis_did;
50123474Swpaul	char			*ndis_name;
51123474Swpaul};
52123474Swpaul
53123474Swpaulstruct ndis_shmem {
54123474Swpaul	bus_dma_tag_t		ndis_stag;
55123474Swpaul	bus_dmamap_t		ndis_smap;
56123474Swpaul	void			*ndis_saddr;
57123474Swpaul	struct ndis_shmem	*ndis_next;
58123474Swpaul};
59123474Swpaul
60123474Swpaulstruct ndis_cfglist {
61123474Swpaul	ndis_cfg		ndis_cfg;
62123474Swpaul        TAILQ_ENTRY(ndis_cfglist)	link;
63123474Swpaul};
64123474Swpaul
65123474SwpaulTAILQ_HEAD(nch, ndis_cfglist);
66123474Swpaul
67123474Swpaul#define NDIS_INC(x)		\
68123474Swpaul	(x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts
69123474Swpaul
70123474Swpaulstruct ndis_softc {
71123474Swpaul	struct arpcom		arpcom;		/* interface info */
72123474Swpaul	struct ifmedia		ifmedia;	/* media info */
73123474Swpaul	bus_space_handle_t	ndis_bhandle;
74123474Swpaul	bus_space_tag_t		ndis_btag;
75123474Swpaul	void			*ndis_intrhand;
76123474Swpaul	struct resource		*ndis_irq;
77123474Swpaul	struct resource		*ndis_res;
78123474Swpaul	struct resource		*ndis_res_io;
79123474Swpaul	int			ndis_io_rid;
80123474Swpaul	struct resource		*ndis_res_mem;
81123474Swpaul	int			ndis_mem_rid;
82123474Swpaul	struct resource		*ndis_res_altmem;
83123474Swpaul	int			ndis_altmem_rid;
84123474Swpaul	struct resource		*ndis_res_am;	/* attribute mem (pccard) */
85123474Swpaul	struct resource		*ndis_res_cm;	/* common mem (pccard) */
86123474Swpaul	int			ndis_rescnt;
87123474Swpaul	struct mtx		ndis_mtx;
88123474Swpaul	device_t		ndis_dev;
89123474Swpaul	int			ndis_unit;
90123474Swpaul	ndis_miniport_block	ndis_block;
91123474Swpaul	ndis_miniport_characteristics	ndis_chars;
92123474Swpaul	interface_type		ndis_type;
93123474Swpaul	struct callout_handle	ndis_stat_ch;
94123474Swpaul	int			ndis_maxpkts;
95123474Swpaul	ndis_oid		*ndis_oids;
96123474Swpaul	int			ndis_oidcnt;
97123474Swpaul	int			ndis_txidx;
98123474Swpaul	int			ndis_txpending;
99123474Swpaul	ndis_packet		**ndis_txarray;
100123474Swpaul	int			ndis_sc;
101123474Swpaul	ndis_cfg		*ndis_regvals;
102123474Swpaul	struct nch		ndis_cfglist_head;
103123474Swpaul
104123474Swpaul	struct sysctl_ctx_list	ndis_ctx;
105123474Swpaul	struct sysctl_oid	*ndis_tree;
106123474Swpaul	interface_type		ndis_iftype;
107123474Swpaul
108123474Swpaul	bus_dma_tag_t		ndis_parent_tag;
109123474Swpaul	struct ndis_shmem	*ndis_shlist;
110123474Swpaul	bus_dma_tag_t		ndis_mtag;
111123474Swpaul	bus_dma_tag_t		ndis_ttag;
112123474Swpaul	bus_dmamap_t		*ndis_mmaps;
113123474Swpaul	bus_dmamap_t		*ndis_tmaps;
114123474Swpaul	struct mbuf		**ndis_mbufs;
115123474Swpaul	int			ndis_mmapcnt;
116123474Swpaul
117123474Swpaul};
118123474Swpaul
119123474Swpaul#define NDIS_LOCK(_sc)		mtx_lock(&(_sc)->ndis_mtx)
120123474Swpaul#define NDIS_UNLOCK(_sc)	mtx_unlock(&(_sc)->ndis_mtx)
121123474Swpaul
122