if_iwivar.h revision 1.9 1 1.9 rpaulo /* $NetBSD: if_iwivar.h,v 1.9 2005/11/29 13:57:00 rpaulo Exp $ */
2 1.1 skrll
3 1.1 skrll /*-
4 1.1 skrll * Copyright (c) 2004, 2005
5 1.1 skrll * Damien Bergamini <damien.bergamini (at) free.fr>. All rights reserved.
6 1.1 skrll *
7 1.1 skrll * Redistribution and use in source and binary forms, with or without
8 1.1 skrll * modification, are permitted provided that the following conditions
9 1.1 skrll * are met:
10 1.1 skrll * 1. Redistributions of source code must retain the above copyright
11 1.1 skrll * notice unmodified, this list of conditions, and the following
12 1.1 skrll * disclaimer.
13 1.1 skrll * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 skrll * notice, this list of conditions and the following disclaimer in the
15 1.1 skrll * documentation and/or other materials provided with the distribution.
16 1.1 skrll *
17 1.1 skrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 1.1 skrll * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 1.1 skrll * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 1.1 skrll * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 1.1 skrll * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.1 skrll * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 1.1 skrll * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1 skrll * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 1.1 skrll * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 1.1 skrll * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 1.1 skrll * SUCH DAMAGE.
28 1.1 skrll */
29 1.1 skrll
30 1.1 skrll struct iwi_firmware {
31 1.1 skrll void *boot;
32 1.1 skrll int boot_size;
33 1.1 skrll void *ucode;
34 1.1 skrll int ucode_size;
35 1.1 skrll void *main;
36 1.1 skrll int main_size;
37 1.1 skrll };
38 1.1 skrll
39 1.1 skrll struct iwi_rx_radiotap_header {
40 1.1 skrll struct ieee80211_radiotap_header wr_ihdr;
41 1.7 skrll uint8_t wr_flags;
42 1.7 skrll uint8_t wr_rate;
43 1.7 skrll uint16_t wr_chan_freq;
44 1.7 skrll uint16_t wr_chan_flags;
45 1.7 skrll uint8_t wr_antsignal;
46 1.7 skrll uint8_t wr_antenna;
47 1.1 skrll };
48 1.1 skrll
49 1.1 skrll #define IWI_RX_RADIOTAP_PRESENT \
50 1.1 skrll ((1 << IEEE80211_RADIOTAP_FLAGS) | \
51 1.1 skrll (1 << IEEE80211_RADIOTAP_RATE) | \
52 1.1 skrll (1 << IEEE80211_RADIOTAP_CHANNEL) | \
53 1.1 skrll (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
54 1.1 skrll (1 << IEEE80211_RADIOTAP_ANTENNA))
55 1.1 skrll
56 1.1 skrll struct iwi_tx_radiotap_header {
57 1.1 skrll struct ieee80211_radiotap_header wt_ihdr;
58 1.7 skrll uint8_t wt_flags;
59 1.7 skrll uint16_t wt_chan_freq;
60 1.7 skrll uint16_t wt_chan_flags;
61 1.1 skrll };
62 1.1 skrll
63 1.1 skrll #define IWI_TX_RADIOTAP_PRESENT \
64 1.1 skrll ((1 << IEEE80211_RADIOTAP_FLAGS) | \
65 1.1 skrll (1 << IEEE80211_RADIOTAP_CHANNEL))
66 1.1 skrll
67 1.5 skrll struct iwi_cmd_ring {
68 1.5 skrll bus_dmamap_t desc_map;
69 1.5 skrll bus_dma_segment_t desc_seg;
70 1.5 skrll struct iwi_cmd_desc *desc;
71 1.5 skrll int count;
72 1.5 skrll int queued;
73 1.5 skrll int cur;
74 1.5 skrll int next;
75 1.5 skrll };
76 1.5 skrll
77 1.5 skrll struct iwi_tx_data {
78 1.5 skrll bus_dmamap_t map;
79 1.5 skrll struct mbuf *m;
80 1.5 skrll struct ieee80211_node *ni;
81 1.5 skrll };
82 1.5 skrll
83 1.5 skrll struct iwi_tx_ring {
84 1.5 skrll bus_dmamap_t desc_map;
85 1.5 skrll bus_dma_segment_t desc_seg;
86 1.8 skrll bus_addr_t csr_ridx;
87 1.8 skrll bus_addr_t csr_widx;
88 1.5 skrll struct iwi_tx_desc *desc;
89 1.5 skrll struct iwi_tx_data *data;
90 1.5 skrll int count;
91 1.5 skrll int queued;
92 1.5 skrll int cur;
93 1.5 skrll int next;
94 1.5 skrll };
95 1.5 skrll
96 1.5 skrll struct iwi_rx_data {
97 1.5 skrll bus_dmamap_t map;
98 1.5 skrll struct mbuf *m;
99 1.5 skrll };
100 1.5 skrll
101 1.5 skrll struct iwi_rx_ring {
102 1.5 skrll struct iwi_rx_data *data;
103 1.5 skrll int count;
104 1.5 skrll int cur;
105 1.5 skrll };
106 1.5 skrll
107 1.8 skrll struct iwi_node {
108 1.8 skrll struct ieee80211_node in_node;
109 1.8 skrll int in_station;
110 1.8 skrll #define IWI_MAX_IBSSNODE 32
111 1.8 skrll };
112 1.8 skrll
113 1.1 skrll struct iwi_softc {
114 1.1 skrll struct device sc_dev;
115 1.3 dyoung struct ethercom sc_ec;
116 1.1 skrll struct ieee80211com sc_ic;
117 1.1 skrll int (*sc_newstate)(struct ieee80211com *,
118 1.1 skrll enum ieee80211_state, int);
119 1.8 skrll void (*sc_node_free)(struct ieee80211_node *);
120 1.8 skrll
121 1.8 skrll uint32_t sc_unr;
122 1.1 skrll
123 1.1 skrll struct iwi_firmware fw;
124 1.7 skrll uint32_t flags;
125 1.1 skrll #define IWI_FLAG_FW_CACHED (1 << 0)
126 1.1 skrll #define IWI_FLAG_FW_INITED (1 << 1)
127 1.4 christos #define IWI_FLAG_FW_WARNED (1 << 2)
128 1.4 christos #define IWI_FLAG_SCANNING (1 << 3)
129 1.1 skrll
130 1.1 skrll bus_dma_tag_t sc_dmat;
131 1.1 skrll
132 1.5 skrll struct iwi_cmd_ring cmdq;
133 1.8 skrll struct iwi_tx_ring txq[WME_NUM_AC];
134 1.5 skrll struct iwi_rx_ring rxq;
135 1.1 skrll
136 1.1 skrll struct resource *irq;
137 1.1 skrll struct resource *mem;
138 1.1 skrll bus_space_tag_t sc_st;
139 1.1 skrll bus_space_handle_t sc_sh;
140 1.1 skrll void *sc_ih;
141 1.1 skrll pci_chipset_tag_t sc_pct;
142 1.1 skrll pcitag_t sc_pcitag;
143 1.1 skrll bus_size_t sc_sz;
144 1.1 skrll
145 1.6 skrll void *sc_sdhook; /* shutdown hook */
146 1.6 skrll void *sc_powerhook; /* power management hook */
147 1.6 skrll
148 1.5 skrll int antenna;
149 1.5 skrll int dwelltime;
150 1.5 skrll int bluetooth;
151 1.9 rpaulo int nictype;
152 1.1 skrll
153 1.1 skrll int sc_tx_timer;
154 1.1 skrll
155 1.1 skrll #if NBPFILTER > 0
156 1.1 skrll struct bpf_if *sc_drvbpf;
157 1.1 skrll
158 1.1 skrll union {
159 1.1 skrll struct iwi_rx_radiotap_header th;
160 1.7 skrll uint8_t pad[64];
161 1.1 skrll } sc_rxtapu;
162 1.1 skrll #define sc_rxtap sc_rxtapu.th
163 1.1 skrll int sc_rxtap_len;
164 1.1 skrll
165 1.1 skrll union {
166 1.1 skrll struct iwi_tx_radiotap_header th;
167 1.7 skrll uint8_t pad[64];
168 1.1 skrll } sc_txtapu;
169 1.1 skrll #define sc_txtap sc_txtapu.th
170 1.1 skrll int sc_txtap_len;
171 1.1 skrll #endif
172 1.1 skrll };
173 1.1 skrll
174 1.3 dyoung #define sc_if sc_ec.ec_if
175 1.3 dyoung
176 1.1 skrll #define SIOCSLOADFW _IOW('i', 137, struct ifreq)
177 1.1 skrll #define SIOCSKILLFW _IOW('i', 138, struct ifreq)
178 1.1 skrll #define SIOCGRADIO _IOWR('i', 139, struct ifreq)
179 1.1 skrll #define SIOCGTABLE0 _IOWR('i', 140, struct ifreq)
180