2 * Copyright (c) 2004, 2005
3 * Damien Bergamini <damien.bergamini@free.fr>.
4 * Copyright (c) 2004, 2005
5 * Andrew Atrens <atrens@nortelnetworks.com>.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice unmodified, this list of conditions, and the following
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * $DragonFly: src/sys/dev/netif/iwi/if_iwivar.h,v 1.1 2005/03/06 05:02:02 dillon Exp $
43 struct iwi_rx_radiotap_header {
44 struct ieee80211_radiotap_header wr_ihdr;
47 u_int16_t wr_chan_freq;
48 u_int16_t wr_chan_flags;
49 u_int8_t wr_antsignal;
54 #define IWI_RX_RADIOTAP_PRESENT \
55 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
56 (1 << IEEE80211_RADIOTAP_RATE) | \
57 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
58 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
59 (1 << IEEE80211_RADIOTAP_DB_ANTNOISE) | \
60 (1 << IEEE80211_RADIOTAP_ANTENNA))
62 struct iwi_tx_radiotap_header {
63 struct ieee80211_radiotap_header wt_ihdr;
65 u_int16_t wt_chan_freq;
66 u_int16_t wt_chan_flags;
69 #define IWI_TX_RADIOTAP_PRESENT \
70 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
71 (1 << IEEE80211_RADIOTAP_CHANNEL))
74 struct ieee80211com sc_ic;
75 int (*sc_newstate)(struct ieee80211com *,
76 enum ieee80211_state, int);
80 struct iwi_firmware fw;
82 #define IWI_FLAG_FW_CACHED (1 << 0)
83 #define IWI_FLAG_FW_IBSS (1 << 1)
84 #define IWI_FLAG_FW_INITED (1 << 2)
85 #define IWI_FLAG_SCANNING (1 << 3)
86 #define IWI_FLAG_SCAN_COMPLETE (1 << 4)
87 #define IWI_FLAG_SCAN_ABORT (1 << 5)
88 #define IWI_FLAG_ASSOCIATED (1 << 6)
89 #define IWI_FLAG_RF_DISABLED (1 << 7)
90 #define IWI_FLAG_RESET (1 << 8)
91 #define IWI_FLAG_EXIT (1 << 9)
93 struct iwi_tx_desc *tx_desc;
94 bus_dma_tag_t iwi_parent_tag;
95 bus_dma_tag_t tx_ring_dmat;
96 bus_dmamap_t tx_ring_map;
97 bus_addr_t tx_ring_pa;
98 bus_dma_tag_t tx_buf_dmat;
103 struct ieee80211_node *ni;
104 } tx_buf[IWI_TX_RING_SIZE];
110 struct iwi_cmd_desc *cmd_desc;
111 bus_dma_tag_t cmd_ring_dmat;
112 bus_dmamap_t cmd_ring_map;
113 bus_addr_t cmd_ring_pa;
116 bus_dma_tag_t rx_buf_dmat;
122 } rx_buf[IWI_RX_RING_SIZE];
126 struct resource *irq;
127 struct resource *mem;
128 bus_space_tag_t sc_st;
129 bus_space_handle_t sc_sh;
137 struct bpf_if *sc_drvbpf;
140 struct iwi_rx_radiotap_header th;
143 #define sc_rxtap sc_rxtapu.th
147 struct iwi_tx_radiotap_header th;
150 #define sc_txtap sc_txtapu.th
154 u_int8_t stations[IWI_FW_MAX_STATIONS][ETHER_ADDR_LEN];
156 struct lwkt_token sc_lock;
157 struct lwkt_token sc_intrlock;
159 struct sysctl_ctx_list sysctl_ctx;
160 struct sysctl_oid *sysctl_tree;
164 int enable_bg_autodetect;
165 int enable_bt_coexist;
166 int enable_cts_to_self;
167 int antenna_diversity; /* 1 = A, 3 = B, 0 = A + B */
168 int enable_neg_best_first;
169 int disable_unicast_decryption;
170 int disable_multicast_decryption;
172 struct thread *event_thread;
174 struct iwi_associate assoc;
180 #define SIOCSLOADFW _IOW('i', 137, struct ifreq)
181 #define SIOCSLOADIBSSFW _IOW('i', 138, struct ifreq)
182 #define SIOCSKILLFW _IOW('i', 139, struct ifreq)
184 #define IWI_LOCK_INIT(tok) lwkt_token_init(tok)
185 #define IWI_LOCK_DESTROY(tok) lwkt_token_uninit(tok)
187 #define IWI_LOCK_INFO struct lwkt_tokref tokinfo
188 #define IWI_INTRLOCK_INFO struct lwkt_tokref intrtokinfo
189 #define IWI_INTRLOCK(_sc) lwkt_gettoken(&intrtokinfo,(&(_sc)->sc_intrlock))
190 #define IWI_INTRUNLOCK(SC) lwkt_reltoken(&intrtokinfo)
191 #define IWI_LOCK(_sc) lwkt_gettoken(&tokinfo,&((_sc)->sc_lock))
192 #define IWI_UNLOCK(SC) lwkt_reltoken(&tokinfo)
195 * Holding a token is not enough for iwi_tx_start() the DMA send
196 * routine. Revert back to the old ipl mechanism for now.
199 #define IWI_IPLLOCK_INFO int saved_ipl_level
200 #define IWI_IPLLOCK(_sc) saved_ipl_level = splimp()
201 #define IWI_IPLUNLOCK(_sc) splx(saved_ipl_level)
203 /* tsleepable events */
204 #define IWI_FW_WAKE_MONITOR(sc) (sc + 1)
205 #define IWI_FW_INITIALIZED(sc) (sc + 2)
206 #define IWI_FW_CMD_ACKED(sc) (sc + 3)
207 #define IWI_FW_SCAN_COMPLETED(sc) (sc + 4)
208 #define IWI_FW_DEASSOCIATED(sc) (sc + 5)
209 #define IWI_FW_MON_EXIT(sc) (sc + 6)