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.3 2005/06/27 11:28:54 corecode 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;
136 struct bpf_if *sc_drvbpf;
139 struct iwi_rx_radiotap_header th;
142 #define sc_rxtap sc_rxtapu.th
146 struct iwi_tx_radiotap_header th;
149 #define sc_txtap sc_txtapu.th
152 u_int8_t stations[IWI_FW_MAX_STATIONS][ETHER_ADDR_LEN];
154 struct lwkt_token sc_lock;
155 struct lwkt_token sc_intrlock;
157 struct sysctl_ctx_list sysctl_ctx;
158 struct sysctl_oid *sysctl_tree;
162 int enable_bg_autodetect;
163 int enable_bt_coexist;
164 int enable_cts_to_self;
165 int antenna_diversity; /* 1 = A, 3 = B, 0 = A + B */
166 int enable_neg_best_first;
167 int disable_unicast_decryption;
168 int disable_multicast_decryption;
170 struct thread *event_thread;
172 struct iwi_associate assoc;
178 #define SIOCSLOADFW _IOW('i', 137, struct ifreq)
179 #define SIOCSLOADIBSSFW _IOW('i', 138, struct ifreq)
180 #define SIOCSKILLFW _IOW('i', 139, struct ifreq)
182 #define IWI_LOCK_INIT(tok) lwkt_token_init(tok)
183 #define IWI_LOCK_DESTROY(tok) lwkt_token_uninit(tok)
185 #define IWI_LOCK_INFO struct lwkt_tokref tokinfo
186 #define IWI_INTRLOCK_INFO struct lwkt_tokref intrtokinfo
187 #define IWI_INTRLOCK(_sc) lwkt_gettoken(&intrtokinfo,(&(_sc)->sc_intrlock))
188 #define IWI_INTRUNLOCK(SC) lwkt_reltoken(&intrtokinfo)
189 #define IWI_LOCK(_sc) lwkt_gettoken(&tokinfo,&((_sc)->sc_lock))
190 #define IWI_UNLOCK(SC) lwkt_reltoken(&tokinfo)
193 * Holding a token is not enough for iwi_tx_start() the DMA send
194 * routine. Revert back to the old ipl mechanism for now.
197 #define IWI_IPLLOCK_INFO
198 #define IWI_IPLLOCK(_sc) crit_enter()
199 #define IWI_IPLUNLOCK(_sc) crit_exit()
201 /* tsleepable events */
202 #define IWI_FW_WAKE_MONITOR(sc) (sc + 1)
203 #define IWI_FW_INITIALIZED(sc) (sc + 2)
204 #define IWI_FW_CMD_ACKED(sc) (sc + 3)
205 #define IWI_FW_SCAN_COMPLETED(sc) (sc + 4)
206 #define IWI_FW_DEASSOCIATED(sc) (sc + 5)
207 #define IWI_FW_MON_EXIT(sc) (sc + 6)