if_iwivar.h revision 1.7 1 1.7 skrll /* $NetBSD: if_iwivar.h,v 1.7 2005/09/17 12:40:28 skrll 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.5 skrll struct iwi_tx_desc *desc;
87 1.5 skrll struct iwi_tx_data *data;
88 1.5 skrll int count;
89 1.5 skrll int queued;
90 1.5 skrll int cur;
91 1.5 skrll int next;
92 1.5 skrll };
93 1.5 skrll
94 1.5 skrll struct iwi_rx_data {
95 1.5 skrll bus_dmamap_t map;
96 1.5 skrll struct mbuf *m;
97 1.5 skrll };
98 1.5 skrll
99 1.5 skrll struct iwi_rx_ring {
100 1.5 skrll struct iwi_rx_data *data;
101 1.5 skrll int count;
102 1.5 skrll int cur;
103 1.5 skrll };
104 1.5 skrll
105 1.1 skrll struct iwi_softc {
106 1.1 skrll struct device sc_dev;
107 1.3 dyoung struct ethercom sc_ec;
108 1.1 skrll struct ieee80211com sc_ic;
109 1.1 skrll int (*sc_newstate)(struct ieee80211com *,
110 1.1 skrll enum ieee80211_state, int);
111 1.1 skrll
112 1.1 skrll struct iwi_firmware fw;
113 1.7 skrll uint32_t flags;
114 1.1 skrll #define IWI_FLAG_FW_CACHED (1 << 0)
115 1.1 skrll #define IWI_FLAG_FW_INITED (1 << 1)
116 1.4 christos #define IWI_FLAG_FW_WARNED (1 << 2)
117 1.4 christos #define IWI_FLAG_SCANNING (1 << 3)
118 1.1 skrll
119 1.1 skrll bus_dma_tag_t sc_dmat;
120 1.1 skrll
121 1.5 skrll struct iwi_cmd_ring cmdq;
122 1.5 skrll struct iwi_tx_ring txq;
123 1.5 skrll struct iwi_rx_ring rxq;
124 1.1 skrll
125 1.1 skrll struct resource *irq;
126 1.1 skrll struct resource *mem;
127 1.1 skrll bus_space_tag_t sc_st;
128 1.1 skrll bus_space_handle_t sc_sh;
129 1.1 skrll void *sc_ih;
130 1.1 skrll pci_chipset_tag_t sc_pct;
131 1.1 skrll pcitag_t sc_pcitag;
132 1.1 skrll bus_size_t sc_sz;
133 1.1 skrll
134 1.6 skrll void *sc_sdhook; /* shutdown hook */
135 1.6 skrll void *sc_powerhook; /* power management hook */
136 1.6 skrll
137 1.5 skrll int antenna;
138 1.5 skrll int dwelltime;
139 1.5 skrll int bluetooth;
140 1.1 skrll
141 1.1 skrll int sc_tx_timer;
142 1.1 skrll
143 1.1 skrll #if NBPFILTER > 0
144 1.1 skrll struct bpf_if *sc_drvbpf;
145 1.1 skrll
146 1.1 skrll union {
147 1.1 skrll struct iwi_rx_radiotap_header th;
148 1.7 skrll uint8_t pad[64];
149 1.1 skrll } sc_rxtapu;
150 1.1 skrll #define sc_rxtap sc_rxtapu.th
151 1.1 skrll int sc_rxtap_len;
152 1.1 skrll
153 1.1 skrll union {
154 1.1 skrll struct iwi_tx_radiotap_header th;
155 1.7 skrll uint8_t pad[64];
156 1.1 skrll } sc_txtapu;
157 1.1 skrll #define sc_txtap sc_txtapu.th
158 1.1 skrll int sc_txtap_len;
159 1.1 skrll #endif
160 1.1 skrll };
161 1.1 skrll
162 1.3 dyoung #define sc_if sc_ec.ec_if
163 1.3 dyoung
164 1.1 skrll #define SIOCSLOADFW _IOW('i', 137, struct ifreq)
165 1.1 skrll #define SIOCSKILLFW _IOW('i', 138, struct ifreq)
166 1.1 skrll #define SIOCGRADIO _IOWR('i', 139, struct ifreq)
167 1.1 skrll #define SIOCGTABLE0 _IOWR('i', 140, struct ifreq)
168