xref: /netbsd-src/sys/dev/pci/if_ipwvar.h (revision de1dfb1250df962f1ff3a011772cf58e605aed11)
1 /*	$NetBSD: if_ipwvar.h,v 1.2 2004/08/23 11:57:35 lukem Exp $	*/
2 /*      Id: if_ipwvar.h,v 1.1.2.2 2004/08/19 16:28:26 damien Exp  */
3 
4 /*-
5  * Copyright (c) 2004
6  *      Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice unmodified, this list of conditions, and the following
13  *    disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 struct ipw_soft_bd {
32 	struct ipw_bd	*bd;
33 	int		type;
34 #define IPW_SBD_TYPE_NOASSOC	0
35 #define IPW_SBD_TYPE_COMMAND	1
36 #define IPW_SBD_TYPE_HEADER	2
37 #define IPW_SBD_TYPE_DATA	3
38 	void		*priv;
39 };
40 
41 struct ipw_soft_hdr {
42 	struct ipw_hdr			hdr;
43 	bus_dmamap_t			map;
44 	TAILQ_ENTRY(ipw_soft_hdr)	next;
45 };
46 
47 struct ipw_soft_buf {
48 	struct mbuf			*m;
49 	struct ieee80211_node		*ni;
50 	bus_dmamap_t			map;
51 	TAILQ_ENTRY(ipw_soft_buf)	next;
52 };
53 
54 struct ipw_softc {
55 	struct device			sc_dev;
56 
57         struct ieee80211com		sc_ic;
58 	int				(*sc_newstate)(struct ieee80211com *,
59 					    enum ieee80211_state, int);
60 
61 	u_int32_t			flags;
62 #define IPW_FLAG_FW_INITED	(1 << 0)
63 
64 	struct resource			*irq;
65 	struct resource			*mem;
66 	bus_space_tag_t			sc_st;
67 	bus_space_handle_t		sc_sh;
68 	void 				*sc_ih;
69 	pci_chipset_tag_t		sc_pct;
70 	bus_size_t			sc_sz;
71 
72 	int				sc_tx_timer;
73 
74 	bus_dma_tag_t			sc_dmat;
75 
76 	bus_dmamap_t			tbd_map;
77 	bus_dmamap_t			rbd_map;
78 	bus_dmamap_t			status_map;
79 	bus_dmamap_t			cmd_map;
80 
81 	bus_dma_segment_t		tbd_seg;
82 	bus_dma_segment_t		rbd_seg;
83 	bus_dma_segment_t		status_seg;
84 	bus_dma_segment_t		cmd_seg;
85 
86 	struct ipw_bd			*tbd_list;
87 	struct ipw_bd			*rbd_list;
88 	struct ipw_status		*status_list;
89 
90 	struct ipw_cmd			*cmd;
91 	struct ipw_soft_bd		*stbd_list;
92 	struct ipw_soft_bd		*srbd_list;
93 	struct ipw_soft_hdr		*shdr_list;
94 	struct ipw_soft_buf		*tx_sbuf_list;
95 	struct ipw_soft_buf		*rx_sbuf_list;
96 
97 	TAILQ_HEAD(, ipw_soft_hdr)	sc_free_shdr;
98 	TAILQ_HEAD(, ipw_soft_buf)	sc_free_sbuf;
99 
100 	u_int32_t			table1_base;
101 	u_int32_t			table2_base;
102 
103 	u_int32_t			txcur;
104 	u_int32_t			txold;
105 	u_int32_t			rxcur;
106 };
107 
108 #define SIOCSLOADFW	 _IOW('i', 137, struct ifreq)
109 #define SIOCSKILLFW	 _IOW('i', 138, struct ifreq)
110 #define SIOCGRADIO	_IOWR('i', 139, struct ifreq)
111 #define SIOCGTABLE1	_IOWR('i', 140, struct ifreq)
112