if_iwnvar.h revision 1.3.12.2 1 1.3.12.2 matt /* $NetBSD: if_iwnvar.h,v 1.3.12.2 2008/03/23 02:04:47 matt Exp $ */
2 1.3.12.2 matt /* OpenBSD: if_iwnvar.h,v 1.2 2007/11/19 19:34:25 damien Exp */
3 1.3.12.2 matt
4 1.3.12.2 matt /*-
5 1.3.12.2 matt * Copyright (c) 2007
6 1.3.12.2 matt * Damien Bergamini <damien.bergamini (at) free.fr>
7 1.3.12.2 matt *
8 1.3.12.2 matt * Permission to use, copy, modify, and distribute this software for any
9 1.3.12.2 matt * purpose with or without fee is hereby granted, provided that the above
10 1.3.12.2 matt * copyright notice and this permission notice appear in all copies.
11 1.3.12.2 matt *
12 1.3.12.2 matt * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 1.3.12.2 matt * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 1.3.12.2 matt * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 1.3.12.2 matt * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 1.3.12.2 matt * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 1.3.12.2 matt * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 1.3.12.2 matt * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 1.3.12.2 matt */
20 1.3.12.2 matt
21 1.3.12.2 matt struct iwn_rx_radiotap_header {
22 1.3.12.2 matt struct ieee80211_radiotap_header wr_ihdr;
23 1.3.12.2 matt uint64_t wr_tsft;
24 1.3.12.2 matt uint8_t wr_flags;
25 1.3.12.2 matt uint8_t wr_rate;
26 1.3.12.2 matt uint16_t wr_chan_freq;
27 1.3.12.2 matt uint16_t wr_chan_flags;
28 1.3.12.2 matt int8_t wr_dbm_antsignal;
29 1.3.12.2 matt int8_t wr_dbm_antnoise;
30 1.3.12.2 matt } __packed;
31 1.3.12.2 matt
32 1.3.12.2 matt #define IWN_RX_RADIOTAP_PRESENT \
33 1.3.12.2 matt ((1 << IEEE80211_RADIOTAP_TSFT) | \
34 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_FLAGS) | \
35 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_RATE) | \
36 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_CHANNEL) | \
37 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
38 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
39 1.3.12.2 matt
40 1.3.12.2 matt struct iwn_tx_radiotap_header {
41 1.3.12.2 matt struct ieee80211_radiotap_header wt_ihdr;
42 1.3.12.2 matt uint8_t wt_flags;
43 1.3.12.2 matt uint8_t wt_rate;
44 1.3.12.2 matt uint16_t wt_chan_freq;
45 1.3.12.2 matt uint16_t wt_chan_flags;
46 1.3.12.2 matt uint8_t wt_hwqueue;
47 1.3.12.2 matt } __packed;
48 1.3.12.2 matt
49 1.3.12.2 matt #define IWN_TX_RADIOTAP_PRESENT \
50 1.3.12.2 matt ((1 << IEEE80211_RADIOTAP_FLAGS) | \
51 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_RATE) | \
52 1.3.12.2 matt (1 << IEEE80211_RADIOTAP_CHANNEL))
53 1.3.12.2 matt
54 1.3.12.2 matt struct iwn_dma_info {
55 1.3.12.2 matt bus_dma_tag_t tag;
56 1.3.12.2 matt bus_dmamap_t map;
57 1.3.12.2 matt bus_dma_segment_t seg;
58 1.3.12.2 matt bus_addr_t paddr;
59 1.3.12.2 matt void * vaddr;
60 1.3.12.2 matt bus_size_t size;
61 1.3.12.2 matt };
62 1.3.12.2 matt
63 1.3.12.2 matt struct iwn_tx_data {
64 1.3.12.2 matt bus_dmamap_t map;
65 1.3.12.2 matt struct mbuf *m;
66 1.3.12.2 matt struct ieee80211_node *ni;
67 1.3.12.2 matt };
68 1.3.12.2 matt
69 1.3.12.2 matt struct iwn_tx_ring {
70 1.3.12.2 matt struct iwn_dma_info desc_dma;
71 1.3.12.2 matt struct iwn_dma_info cmd_dma;
72 1.3.12.2 matt struct iwn_tx_desc *desc;
73 1.3.12.2 matt struct iwn_tx_cmd *cmd;
74 1.3.12.2 matt struct iwn_tx_data *data;
75 1.3.12.2 matt int qid;
76 1.3.12.2 matt int queued;
77 1.3.12.2 matt int count;
78 1.3.12.2 matt int cur;
79 1.3.12.2 matt };
80 1.3.12.2 matt
81 1.3.12.2 matt #define IWN_RBUF_COUNT (IWN_RX_RING_COUNT + 32)
82 1.3.12.2 matt
83 1.3.12.2 matt struct iwn_softc;
84 1.3.12.2 matt
85 1.3.12.2 matt struct iwn_rbuf {
86 1.3.12.2 matt struct iwn_softc *sc;
87 1.3.12.2 matt void * vaddr;
88 1.3.12.2 matt bus_addr_t paddr;
89 1.3.12.2 matt SLIST_ENTRY(iwn_rbuf) next;
90 1.3.12.2 matt };
91 1.3.12.2 matt
92 1.3.12.2 matt struct iwn_rx_data {
93 1.3.12.2 matt struct mbuf *m;
94 1.3.12.2 matt };
95 1.3.12.2 matt
96 1.3.12.2 matt struct iwn_rx_ring {
97 1.3.12.2 matt struct iwn_dma_info desc_dma;
98 1.3.12.2 matt struct iwn_dma_info buf_dma;
99 1.3.12.2 matt uint32_t *desc;
100 1.3.12.2 matt struct iwn_rx_data data[IWN_RX_RING_COUNT];
101 1.3.12.2 matt struct iwn_rbuf rbuf[IWN_RBUF_COUNT];
102 1.3.12.2 matt SLIST_HEAD(, iwn_rbuf) freelist;
103 1.3.12.2 matt int nb_free_entries;
104 1.3.12.2 matt int cur;
105 1.3.12.2 matt };
106 1.3.12.2 matt
107 1.3.12.2 matt struct iwn_node {
108 1.3.12.2 matt struct ieee80211_node ni; /* must be the first */
109 1.3.12.2 matt struct ieee80211_amrr_node amn;
110 1.3.12.2 matt };
111 1.3.12.2 matt
112 1.3.12.2 matt struct iwn_calib_state {
113 1.3.12.2 matt uint8_t state;
114 1.3.12.2 matt #define IWN_CALIB_STATE_INIT 0
115 1.3.12.2 matt #define IWN_CALIB_STATE_ASSOC 1
116 1.3.12.2 matt #define IWN_CALIB_STATE_RUN 2
117 1.3.12.2 matt
118 1.3.12.2 matt u_int nbeacons;
119 1.3.12.2 matt uint32_t noise[3];
120 1.3.12.2 matt uint32_t rssi[3];
121 1.3.12.2 matt uint32_t corr_ofdm_x1;
122 1.3.12.2 matt uint32_t corr_ofdm_mrc_x1;
123 1.3.12.2 matt uint32_t corr_ofdm_x4;
124 1.3.12.2 matt uint32_t corr_ofdm_mrc_x4;
125 1.3.12.2 matt uint32_t corr_cck_x4;
126 1.3.12.2 matt uint32_t corr_cck_mrc_x4;
127 1.3.12.2 matt uint32_t bad_plcp_ofdm;
128 1.3.12.2 matt uint32_t fa_ofdm;
129 1.3.12.2 matt uint32_t bad_plcp_cck;
130 1.3.12.2 matt uint32_t fa_cck;
131 1.3.12.2 matt uint32_t low_fa;
132 1.3.12.2 matt uint8_t cck_state;
133 1.3.12.2 matt #define IWN_CCK_STATE_INIT 0
134 1.3.12.2 matt #define IWN_CCK_STATE_LOFA 1
135 1.3.12.2 matt #define IWN_CCK_STATE_HIFA 2
136 1.3.12.2 matt
137 1.3.12.2 matt uint8_t noise_samples[20];
138 1.3.12.2 matt u_int cur_noise_sample;
139 1.3.12.2 matt uint8_t noise_ref;
140 1.3.12.2 matt uint32_t energy_samples[10];
141 1.3.12.2 matt u_int cur_energy_sample;
142 1.3.12.2 matt uint32_t energy_cck;
143 1.3.12.2 matt };
144 1.3.12.2 matt
145 1.3.12.2 matt struct iwn_softc {
146 1.3.12.2 matt device_t sc_dev;
147 1.3.12.2 matt struct ethercom sc_ec;
148 1.3.12.2 matt struct ieee80211com sc_ic;
149 1.3.12.2 matt int (*sc_newstate)(struct ieee80211com *,
150 1.3.12.2 matt enum ieee80211_state, int);
151 1.3.12.2 matt
152 1.3.12.2 matt struct ieee80211_amrr amrr;
153 1.3.12.2 matt
154 1.3.12.2 matt bus_dma_tag_t sc_dmat;
155 1.3.12.2 matt
156 1.3.12.2 matt /* shared area */
157 1.3.12.2 matt struct iwn_dma_info shared_dma;
158 1.3.12.2 matt struct iwn_shared *shared;
159 1.3.12.2 matt
160 1.3.12.2 matt /* "keep warm" page */
161 1.3.12.2 matt struct iwn_dma_info kw_dma;
162 1.3.12.2 matt
163 1.3.12.2 matt /* firmware DMA transfer */
164 1.3.12.2 matt struct iwn_dma_info fw_dma;
165 1.3.12.2 matt
166 1.3.12.2 matt /* rings */
167 1.3.12.2 matt struct iwn_tx_ring txq[IWN_NTXQUEUES];
168 1.3.12.2 matt struct iwn_rx_ring rxq;
169 1.3.12.2 matt
170 1.3.12.2 matt bus_space_tag_t sc_st;
171 1.3.12.2 matt bus_space_handle_t sc_sh;
172 1.3.12.2 matt void *sc_ih;
173 1.3.12.2 matt pci_chipset_tag_t sc_pct;
174 1.3.12.2 matt pcitag_t sc_pcitag;
175 1.3.12.2 matt bus_size_t sc_sz;
176 1.3.12.2 matt
177 1.3.12.2 matt struct callout calib_to;
178 1.3.12.2 matt int calib_cnt;
179 1.3.12.2 matt struct iwn_calib_state calib;
180 1.3.12.2 matt
181 1.3.12.2 matt struct iwn_rx_stat last_rx_stat;
182 1.3.12.2 matt int last_rx_valid;
183 1.3.12.2 matt struct iwn_ucode_info ucode_info;
184 1.3.12.2 matt struct iwn_config config;
185 1.3.12.2 matt uint32_t rawtemp;
186 1.3.12.2 matt int temp;
187 1.3.12.2 matt int noise;
188 1.3.12.2 matt uint8_t antmsk;
189 1.3.12.2 matt
190 1.3.12.2 matt struct iwn_eeprom_band bands[IWN_NBANDS];
191 1.3.12.2 matt int16_t eeprom_voltage;
192 1.3.12.2 matt int8_t maxpwr2GHz;
193 1.3.12.2 matt int8_t maxpwr5GHz;
194 1.3.12.2 matt int8_t maxpwr[IEEE80211_CHAN_MAX];
195 1.3.12.2 matt
196 1.3.12.2 matt int sc_tx_timer;
197 1.3.12.2 matt
198 1.3.12.2 matt #if NBPFILTER > 0
199 1.3.12.2 matt void * sc_drvbpf;
200 1.3.12.2 matt
201 1.3.12.2 matt union {
202 1.3.12.2 matt struct iwn_rx_radiotap_header th;
203 1.3.12.2 matt uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
204 1.3.12.2 matt } sc_rxtapu;
205 1.3.12.2 matt #define sc_rxtap sc_rxtapu.th
206 1.3.12.2 matt int sc_rxtap_len;
207 1.3.12.2 matt
208 1.3.12.2 matt union {
209 1.3.12.2 matt struct iwn_tx_radiotap_header th;
210 1.3.12.2 matt uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
211 1.3.12.2 matt } sc_txtapu;
212 1.3.12.2 matt #define sc_txtap sc_txtapu.th
213 1.3.12.2 matt int sc_txtap_len;
214 1.3.12.2 matt #endif
215 1.3.12.2 matt
216 1.3.12.2 matt bool is_scanning;
217 1.3.12.2 matt };
218