Deleted Added
full compact
if_wpivar.h (173362) if_wpivar.h (177043)
1/* $FreeBSD: head/sys/dev/wpi/if_wpivar.h 173362 2007-11-05 11:47:19Z benjsc $ */
1/* $FreeBSD: head/sys/dev/wpi/if_wpivar.h 177043 2008-03-10 23:16:48Z thompsa $ */
2
3/*-
4 * Copyright (c) 2006,2007
5 * Damien Bergamini <damien.bergamini@free.fr>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
2
3/*-
4 * Copyright (c) 2006,2007
5 * Damien Bergamini <damien.bergamini@free.fr>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19#if ( __FreeBSD_version > 700000 )
20#include <net80211/ieee80211_amrr.h>
19#include <net80211/ieee80211_amrr.h>
21#else
22#include <dev/wpi/ieee80211_amrr.h>
23#endif
24
20
25/* DMA mapping */
26struct wpi_mapping {
27 int nsegs;
28 bus_dma_segment_t segs[WPI_MAX_SCATTER];
29};
30
31struct wpi_rx_radiotap_header {
32 struct ieee80211_radiotap_header wr_ihdr;
33 uint64_t wr_tsft;
34 uint8_t wr_flags;
35 uint8_t wr_rate;
36 uint16_t wr_chan_freq;
37 uint16_t wr_chan_flags;
38 int8_t wr_dbm_antsignal;

--- 22 unchanged lines hidden (view full) ---

61#define WPI_TX_RADIOTAP_PRESENT \
62 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
63 (1 << IEEE80211_RADIOTAP_RATE) | \
64 (1 << IEEE80211_RADIOTAP_CHANNEL))
65
66struct wpi_dma_info {
67 bus_dma_tag_t tag;
68 bus_dmamap_t map;
21struct wpi_rx_radiotap_header {
22 struct ieee80211_radiotap_header wr_ihdr;
23 uint64_t wr_tsft;
24 uint8_t wr_flags;
25 uint8_t wr_rate;
26 uint16_t wr_chan_freq;
27 uint16_t wr_chan_flags;
28 int8_t wr_dbm_antsignal;

--- 22 unchanged lines hidden (view full) ---

51#define WPI_TX_RADIOTAP_PRESENT \
52 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
53 (1 << IEEE80211_RADIOTAP_RATE) | \
54 (1 << IEEE80211_RADIOTAP_CHANNEL))
55
56struct wpi_dma_info {
57 bus_dma_tag_t tag;
58 bus_dmamap_t map;
69 bus_addr_t paddr;
70 caddr_t vaddr;
59 bus_addr_t paddr; /* aligned p address */
60 bus_addr_t paddr_start; /* possibly unaligned p start*/
61 caddr_t vaddr; /* aligned v address */
62 caddr_t vaddr_start; /* possibly unaligned v start */
71 bus_size_t size;
72};
73
74struct wpi_tx_data {
75 bus_dmamap_t map;
76 struct mbuf *m;
77 struct ieee80211_node *ni;
78};

--- 8 unchanged lines hidden (view full) ---

87 int qid;
88 int count;
89 int queued;
90 int cur;
91};
92
93#define WPI_RBUF_COUNT ( WPI_RX_RING_COUNT + 16 )
94
63 bus_size_t size;
64};
65
66struct wpi_tx_data {
67 bus_dmamap_t map;
68 struct mbuf *m;
69 struct ieee80211_node *ni;
70};

--- 8 unchanged lines hidden (view full) ---

79 int qid;
80 int count;
81 int queued;
82 int cur;
83};
84
85#define WPI_RBUF_COUNT ( WPI_RX_RING_COUNT + 16 )
86
95struct wpi_softc;
96
97struct wpi_rbuf {
98 struct wpi_softc *sc;
99 bus_addr_t paddr;
100 caddr_t vaddr;
101 SLIST_ENTRY(wpi_rbuf) next;
102};
103
104struct wpi_rx_data {
87struct wpi_rx_data {
105 struct mbuf *m;
88 bus_dmamap_t map;
89 struct mbuf *m;
106};
107
108struct wpi_rx_ring {
109 struct wpi_dma_info desc_dma;
90};
91
92struct wpi_rx_ring {
93 struct wpi_dma_info desc_dma;
110 struct wpi_dma_info buf_dma;
111 uint32_t *desc;
112 struct wpi_rx_data data[WPI_RX_RING_COUNT];
94 uint32_t *desc;
95 struct wpi_rx_data data[WPI_RX_RING_COUNT];
113 struct wpi_rbuf rbuf[WPI_RBUF_COUNT];
114 SLIST_HEAD(, wpi_rbuf) freelist;
96 bus_dma_tag_t data_dmat;
115 int cur;
116};
117
118struct wpi_amrr {
119 struct ieee80211_node ni; /* must be the first */
120 int txcnt;
121 int retrycnt;
122 int success;

--- 37 unchanged lines hidden (view full) ---

160 * expects the hardware to be in
161 */
162 uint32_t flags;
163#define WPI_FLAG_HW_RADIO_OFF (1 << 0)
164#define WPI_FLAG_SCANNING (1 << 1)
165#define WPI_FLAG_BUSY (1 << 2)
166#define WPI_FLAG_AUTH (1 << 3)
167
97 int cur;
98};
99
100struct wpi_amrr {
101 struct ieee80211_node ni; /* must be the first */
102 int txcnt;
103 int retrycnt;
104 int success;

--- 37 unchanged lines hidden (view full) ---

142 * expects the hardware to be in
143 */
144 uint32_t flags;
145#define WPI_FLAG_HW_RADIO_OFF (1 << 0)
146#define WPI_FLAG_SCANNING (1 << 1)
147#define WPI_FLAG_BUSY (1 << 2)
148#define WPI_FLAG_AUTH (1 << 3)
149
168 /* Flags indicating the state of the firmware */
169 uint32_t fw_state;
170#define WPI_FW_IDLE (1 << 0 )
171
172 /* shared area */
173 struct wpi_dma_info shared_dma;
174 struct wpi_shared *shared;
175
176 struct wpi_tx_ring txq[WME_NUM_AC];
177 struct wpi_tx_ring cmdq;
178 struct wpi_rx_ring rxq;
179
180 /* TX Thermal Callibration */
181 struct callout calib_to;
182 int calib_cnt;
183
184 /* Watch dog timer */
185 struct callout watchdog_to;
150 /* shared area */
151 struct wpi_dma_info shared_dma;
152 struct wpi_shared *shared;
153
154 struct wpi_tx_ring txq[WME_NUM_AC];
155 struct wpi_tx_ring cmdq;
156 struct wpi_rx_ring rxq;
157
158 /* TX Thermal Callibration */
159 struct callout calib_to;
160 int calib_cnt;
161
162 /* Watch dog timer */
163 struct callout watchdog_to;
186 int watchdog_cnt;
164 /* Hardware switch polling timer */
165 struct callout hwswitch_to;
187
188 struct resource *irq;
189 struct resource *mem;
190 bus_space_tag_t sc_st;
191 bus_space_handle_t sc_sh;
192 void *sc_ih;
193 int mem_rid;
194 int irq_rid;
195
196 struct wpi_config config;
197 int temp;
198
199
200 int sc_tx_timer;
166
167 struct resource *irq;
168 struct resource *mem;
169 bus_space_tag_t sc_st;
170 bus_space_handle_t sc_sh;
171 void *sc_ih;
172 int mem_rid;
173 int irq_rid;
174
175 struct wpi_config config;
176 int temp;
177
178
179 int sc_tx_timer;
180 int sc_scan_timer;
201
202 struct bpf_if *sc_drvbpf;
203
204 struct wpi_rx_radiotap_header sc_rxtap;
205 int sc_rxtap_len;
206 struct wpi_tx_radiotap_header sc_txtap;
207 int sc_txtap_len;
208
209 /* firmware image */
210 const struct firmware *fw_fp;
211
212 /* firmware DMA transfer */
213 struct wpi_dma_info fw_dma;
214
215 /* command queue related variables */
181
182 struct bpf_if *sc_drvbpf;
183
184 struct wpi_rx_radiotap_header sc_rxtap;
185 int sc_rxtap_len;
186 struct wpi_tx_radiotap_header sc_txtap;
187 int sc_txtap_len;
188
189 /* firmware image */
190 const struct firmware *fw_fp;
191
192 /* firmware DMA transfer */
193 struct wpi_dma_info fw_dma;
194
195 /* command queue related variables */
216 #define WPI_CMD_MAXOPS 10
217 #define WPI_SCAN_START (1<<0)
218 #define WPI_SCAN_CURCHAN (1<<1)
219 #define WPI_SCAN_STOP (1<<2)
220 #define WPI_SET_CHAN (1<<3)
221 #define WPI_AUTH (1<<4)
222 #define WPI_SCAN_NEXT (1<<5)
196#define WPI_SCAN_START (1<<0)
197#define WPI_SCAN_CURCHAN (1<<1)
198#define WPI_SCAN_STOP (1<<2)
199#define WPI_SET_CHAN (1<<3)
200#define WPI_AUTH (1<<4)
201#define WPI_RUN (1<<5)
202#define WPI_SCAN_NEXT (1<<6)
203#define WPI_RESTART (1<<7)
204#define WPI_RF_RESTART (1<<8)
205#define WPI_CMD_MAXOPS 10
206 /* command queuing request type */
207#define WPI_QUEUE_NORMAL 0
208#define WPI_QUEUE_CLEAR 1
223 int sc_cmd[WPI_CMD_MAXOPS];
209 int sc_cmd[WPI_CMD_MAXOPS];
210 int sc_cmd_arg[WPI_CMD_MAXOPS];
224 int sc_cmd_cur; /* current queued scan task */
225 int sc_cmd_next; /* last queued scan task */
226 struct mtx sc_cmdlock;
227
228 /* Task queues used to control the driver */
229 struct taskqueue *sc_tq; /* Main command task queue */
230 struct taskqueue *sc_tq2;/* firmware reset task queue */
231

--- 9 unchanged lines hidden (view full) ---

241 uint8_t type;
242 struct wpi_power_group groups[WPI_POWER_GROUPS_COUNT];
243 int8_t maxpwr[IEEE80211_CHAN_MAX];
244 char domain[4]; //reglatory domain //XXX
245};
246#define WPI_LOCK_INIT(_sc) \
247 mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
248 MTX_NETWORK_LOCK, MTX_DEF)
211 int sc_cmd_cur; /* current queued scan task */
212 int sc_cmd_next; /* last queued scan task */
213 struct mtx sc_cmdlock;
214
215 /* Task queues used to control the driver */
216 struct taskqueue *sc_tq; /* Main command task queue */
217 struct taskqueue *sc_tq2;/* firmware reset task queue */
218

--- 9 unchanged lines hidden (view full) ---

228 uint8_t type;
229 struct wpi_power_group groups[WPI_POWER_GROUPS_COUNT];
230 int8_t maxpwr[IEEE80211_CHAN_MAX];
231 char domain[4]; //reglatory domain //XXX
232};
233#define WPI_LOCK_INIT(_sc) \
234 mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
235 MTX_NETWORK_LOCK, MTX_DEF)
249#define WPI_LOCK_DECL int __waslocked = 0
250#define WPI_LOCK(_sc) do {\
251 if (!(__waslocked = mtx_owned(&(_sc)->sc_mtx))) \
252 mtx_lock(&(_sc)->sc_mtx); \
253} while(0)
254#define WPI_UNLOCK(_sc) do { \
255 if (!__waslocked) \
256 mtx_unlock(&(_sc)->sc_mtx); \
257} while (0)
258
236#define WPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
237#define WPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
238#define WPI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED)
239#define WPI_LOCK_OWNED(_sc) mtx_owned(&(_sc)->sc_mtx)
259#define WPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
240#define WPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
241
260#define WPI_CMD_LOCK_INIT(_sc) \
242#define WPI_CMD_LOCK_INIT(_sc) \
261 mtx_init(&(_sc)->sc_cmdlock, device_get_nameunit((_sc)->sc_dev), NULL, MTX_DEF);
243 mtx_init(&(_sc)->sc_cmdlock, device_get_nameunit((_sc)->sc_dev), \
244 NULL, MTX_DEF)
262#define WPI_CMD_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_cmdlock)
263#define WPI_CMD_LOCK(_sc) mtx_lock(&(_sc)->sc_cmdlock)
264#define WPI_CMD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_cmdlock)
245#define WPI_CMD_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_cmdlock)
246#define WPI_CMD_LOCK(_sc) mtx_lock(&(_sc)->sc_cmdlock)
247#define WPI_CMD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_cmdlock)
265#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
266#define WPI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED)
267#else
268#define WPI_LOCK_ASSERT(sc)
269#endif