1 /* $OpenBSD: if_ipwvar.h,v 1.14 2006/08/19 12:03:05 damien Exp $ */
2
3 /*-
4 * Copyright (c) 2004-2006
5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice unmodified, this list of conditions, and the following
12 * disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30 struct ipw_firmware {
31 u_char *data;
32 u_char *main;
33 size_t main_size;
34 u_char *ucode;
35 size_t ucode_size;
36 };
37
38 struct ipw_soft_bd {
39 struct ipw_bd *bd;
40 int type;
41 #define IPW_SBD_TYPE_NOASSOC 0
42 #define IPW_SBD_TYPE_COMMAND 1
43 #define IPW_SBD_TYPE_HEADER 2
44 #define IPW_SBD_TYPE_DATA 3
45 void *priv;
46 };
47
48 struct ipw_soft_hdr {
49 struct ipw_hdr hdr;
50 bus_dmamap_t map;
51 SLIST_ENTRY(ipw_soft_hdr) next;
52 };
53
54 struct ipw_soft_buf {
55 struct mbuf *m;
56 struct ieee80211_node *ni;
57 bus_dmamap_t map;
58 SLIST_ENTRY(ipw_soft_buf) next;
59 };
60
61 struct ipw_rx_radiotap_header {
62 struct ieee80211_radiotap_header wr_ihdr;
63 uint8_t wr_flags;
64 uint16_t wr_chan_freq;
65 uint16_t wr_chan_flags;
66 uint8_t wr_antsignal;
67 } __packed;
68
69 #define IPW_RX_RADIOTAP_PRESENT \
70 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
71 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
72 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
73
74 struct ipw_tx_radiotap_header {
75 struct ieee80211_radiotap_header wt_ihdr;
76 uint8_t wt_flags;
77 uint16_t wt_chan_freq;
78 uint16_t wt_chan_flags;
79 } __packed;
80
81 #define IPW_TX_RADIOTAP_PRESENT \
82 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
83 (1 << IEEE80211_RADIOTAP_CHANNEL))
84
85 #define IPW_MAX_NSEG 1
86
87 struct ipw_softc {
88 struct device sc_dev;
89
90 struct ieee80211com sc_ic;
91 int (*sc_newstate)(struct ieee80211com *,
92 enum ieee80211_state, int);
93
94 uint32_t flags;
95 #define IPW_FLAG_FW_INITED (1 << 0)
96
97 struct resource *irq;
98 struct resource *mem;
99 bus_space_tag_t sc_st;
100 bus_space_handle_t sc_sh;
101 void *sc_ih;
102 pci_chipset_tag_t sc_pct;
103 pcitag_t sc_pcitag;
104 bus_size_t sc_sz;
105
106 int sc_tx_timer;
107
108 bus_dma_tag_t sc_dmat;
109
110 bus_dmamap_t tbd_map;
111 bus_dmamap_t rbd_map;
112 bus_dmamap_t status_map;
113 bus_dmamap_t cmd_map;
114
115 bus_dma_segment_t tbd_seg;
116 bus_dma_segment_t rbd_seg;
117 bus_dma_segment_t status_seg;
118 bus_dma_segment_t cmd_seg;
119
120 struct ipw_bd *tbd_list;
121 struct ipw_bd *rbd_list;
122 struct ipw_status *status_list;
123
124 struct ipw_cmd cmd;
125 struct ipw_soft_bd stbd_list[IPW_NTBD];
126 struct ipw_soft_buf tx_sbuf_list[IPW_NDATA];
127 struct ipw_soft_hdr shdr_list[IPW_NDATA];
128 struct ipw_soft_bd srbd_list[IPW_NRBD];
129 struct ipw_soft_buf rx_sbuf_list[IPW_NRBD];
130
131 SLIST_HEAD(, ipw_soft_hdr) free_shdr;
132 SLIST_HEAD(, ipw_soft_buf) free_sbuf;
133
134 uint32_t table1_base;
135 uint32_t table2_base;
136
137 uint32_t txcur;
138 uint32_t txold;
139 uint32_t rxcur;
140 int txfree;
141
142 void *powerhook;
143
144 #if NBPFILTER > 0
145 caddr_t sc_drvbpf;
146
147 union {
148 struct ipw_rx_radiotap_header th;
149 uint8_t pad[64];
150 } sc_rxtapu;
151 #define sc_rxtap sc_rxtapu.th
152 int sc_rxtap_len;
153
154 union {
155 struct ipw_tx_radiotap_header th;
156 uint8_t pad[64];
157 } sc_txtapu;
158 #define sc_txtap sc_txtapu.th
159 int sc_txtap_len;
160 #endif
161 };