2 * Copyright (c) 2008 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Sepherosa Ziehau <sepherosa@gmail.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * $DragonFly: src/sys/dev/netif/iwl/iwl2100var.h,v 1.2 2008/03/08 06:43:52 sephe Exp $
42 #define IWL2100_NSEG_MAX 6
43 #define IWL2100_TX_NDESC 256
44 #define IWL2100_RX_NDESC 256
46 #define IWL2100_SPARE_NDESC 6
47 #define IWL2100_TX_USED_MAX (IWL2100_TX_NDESC - IWL2100_SPARE_NDESC)
49 #define IWL2100_TXRING_SIZE (IWL2100_TX_NDESC * sizeof(struct iwl2100_desc))
50 #define IWL2100_RXRING_SIZE (IWL2100_RX_NDESC * sizeof(struct iwl2100_desc))
51 #define IWL2100_RXSTATUS_SIZE \
52 (IWL2100_RX_NDESC * sizeof(struct iwl2100_rx_status))
55 #define DPRINTF(sc, flags, fmt, ...) ((void)0)
57 #define DPRINTF(sc, flags, fmt, ...) \
59 if ((sc)->sc_debug & (flags)) \
60 if_printf(&(sc)->sc_ic.ic_if, fmt, __VA_ARGS__); \
62 #endif /* !IWL2100_DEBUG */
67 uint8_t d_flags
; /* IWL2100_TXD_F_ */
69 uint8_t d_reserved
[6];
72 #define IWL2100_TXD_F_NOTLAST 0x1
73 #define IWL2100_TXD_F_CMD 0x2
74 #define IWL2100_TXD_F_INTR 0x8
76 struct iwl2100_tx_hdr
{
83 uint8_t th_key
[IEEE80211_KEYBUF_SIZE
];
84 uint8_t th_reserved
[10];
85 uint8_t th_src
[IEEE80211_ADDR_LEN
];
86 uint8_t th_dst
[IEEE80211_ADDR_LEN
];
87 uint16_t th_frag_size
;
90 struct iwl2100_rx_status
{
92 uint16_t r_status
; /* IWL2100_RXS_ */
97 #define IWL2100_RXS_TYPE_MASK 0xf
98 #define IWL2100_RXS_TYPE_CMD 0
99 #define IWL2100_RXS_TYPE_STATUS 1
100 #define IWL2100_RXS_TYPE_DATA 2
101 #define IWL2100_RXS_TYPE_DATA1 3
102 #define IWL2100_RXS_TYPE_NOTE 4
104 #define IWL2100_STATUS_RUNNING (1 << 2)
105 #define IWL2100_STATUS_BMISS (1 << 3)
106 #define IWL2100_STATUS_SCANDONE (1 << 5)
107 #define IWL2100_STATUS_SCANNING (1 << 11)
109 struct iwl2100_note
{
114 #define IWL2100_CMD_PARAMSZ 100
120 uint32_t c_param_len
;
121 uint32_t c_param
[IWL2100_CMD_PARAMSZ
];
123 uint32_t c_unused
[17];
126 struct iwl2100_cmdparam_sec
{
127 uint32_t sec_cipher_mask
; /* IWL2100_CIPHER_ */
129 uint8_t sec_authmode
; /* IWL2100_AUTH_ */
130 uint8_t sec_replay_counter
;
134 #define IWL2100_CIPHER_NONE (1 << 0)
135 #define IWL2100_CIPHER_WEP40 (1 << 1)
136 #define IWL2100_CIPHER_TKIP (1 << 2)
137 #define IWL2100_CIPHER_CCMP (1 << 4)
138 #define IWL2100_CIPHER_WEP104 (1 << 5)
140 #define IWL2100_AUTH_OPEN 0
141 #define IWL2100_AUTH_SHARED 1
143 #define IWL2100_KEYDATA_SIZE 13
145 struct iwl2100_cmdparam_wepkey
{
148 uint8_t key_data
[IWL2100_KEYDATA_SIZE
];
151 /* 16: ie_fixed_mask + ie_fixed + ie_optlen */
152 #define IWL2100_OPTIE_MAX ((IWL2100_CMD_PARAMSZ * sizeof(uint32_t)) - 16)
154 struct iwl2100_cmdparam_ie
{
155 uint16_t ie_fixed_mask
;
159 uint8_t bssid
[IEEE80211_ADDR_LEN
];
162 uint8_t ie_opt
[IWL2100_OPTIE_MAX
];
165 struct iwl2100_ucode_resp
{
169 uint8_t eeprom_valid
;
170 uint16_t valid_flags
;
174 uint16_t clk_settle_time
;
175 uint16_t pwr_settle_time
;
176 uint16_t hop_settle_time
;
177 uint8_t date_time
[5];
181 struct iwl2100_fwdata_hdr
{
187 struct iwl2100_fwimg_hdr
{
189 uint16_t mode
; /* IWL2100_FW_M_ */
194 #define IWL2100_FW_M_STA 0
195 #define IWL2100_FW_M_IBSS 1
196 #define IWL2100_FW_M_MONITOR 2
198 struct iwl2100_txbuf
{
199 struct mbuf
*tb_mbuf
;
200 bus_dmamap_t tb_dmap
;
201 uint32_t tb_flags
; /* IWL2100_TBF_ */
204 #define IWL2100_TBF_CMDBUF 0x1
206 struct iwl2100_rxbuf
{
207 struct mbuf
*rb_mbuf
;
208 bus_dmamap_t rb_dmap
;
212 struct iwl2100_tx_ring
{
213 bus_dma_tag_t tr_dtag
;
214 bus_dmamap_t tr_dmap
;
216 struct iwl2100_desc
*tr_desc
;
222 struct iwl2100_txbuf tr_buf
[IWL2100_TX_NDESC
];
225 struct iwl2100_rx_ring
{
226 bus_dma_tag_t rr_dtag
;
227 bus_dmamap_t rr_dmap
;
229 struct iwl2100_desc
*rr_desc
;
231 bus_dma_tag_t rr_st_dtag
;
232 bus_dmamap_t rr_st_dmap
;
233 bus_addr_t rr_st_paddr
;
234 struct iwl2100_rx_status
*rr_status
;
238 bus_dmamap_t rr_tmp_dmap
;
239 struct iwl2100_rxbuf rr_buf
[IWL2100_RX_NDESC
];
244 struct iwl2100_firmware
{
245 struct fw_image
*fw_image
;
246 const uint8_t *fw_data
;
248 const uint8_t *fw_ucode
;
252 #define IWL2100_TX_RADIOTAP_PRESENT \
253 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
254 (1 << IEEE80211_RADIOTAP_CHANNEL))
256 struct iwl2100_tx_radiotap_hdr
{
257 struct ieee80211_radiotap_header wt_ihdr
;
259 uint16_t wt_chan_freq
;
260 uint16_t wt_chan_flags
;
263 #define IWL2100_RX_RADIOTAP_PRESENT \
264 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
265 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
266 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
267 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
269 struct iwl2100_rx_radiotap_hdr
{
270 struct ieee80211_radiotap_header wr_ihdr
;
272 uint16_t wr_chan_freq
;
273 uint16_t wr_chan_flags
;
278 struct iwl2100_softc
{
279 struct iwlcom iwlcom
;
283 uint32_t sc_caps
; /* IWL2100_C_ */
284 uint32_t sc_flags
; /* IWL2100_F_ */
287 uint16_t sc_ibss_chans
;
288 uint16_t sc_bss_chans
;
290 bus_dma_tag_t sc_dtag
;
291 bus_dma_tag_t sc_mbuf_dtag
;
292 struct iwl2100_tx_ring sc_txring
;
293 struct iwl2100_rx_ring sc_rxring
;
295 struct iwl2100_firmware sc_fw_sta
;
296 struct iwl2100_firmware sc_fw_ibss
;
297 struct iwl2100_firmware sc_fw_monitor
;
301 struct callout sc_restart_bmiss
;
302 struct callout sc_ibss
;
303 struct callout sc_reinit
;
305 struct iwlmsg sc_scanend_msg
;
306 struct iwlmsg sc_assoc_msg
;
307 struct iwlmsg sc_run_msg
;
308 struct iwlmsg sc_restart_msg
;
309 struct iwlmsg sc_bmiss_msg
;
310 struct iwlmsg sc_reinit_msg
;
312 struct bpf_if
*sc_drvbpf
;
315 struct iwl2100_tx_radiotap_hdr u_tx_th
;
316 uint8_t u_pad
[IEEE80211_RADIOTAP_HDRLEN
];
321 struct iwl2100_rx_radiotap_hdr u_rx_th
;
322 uint8_t u_pad
[IEEE80211_RADIOTAP_HDRLEN
];
327 (struct ieee80211com
*,
328 enum ieee80211_state
, int);
333 uint32_t sc_debug
; /* IWL2100_DBG_ */
336 #define IWL2100_C_RFKILL 0x1
338 #define IWL2100_F_WAITCMD 0x1
339 #define IWL2100_F_INITED 0x2
340 #define IWL2100_F_IN_INTR 0x4 /* for sanity check */
341 #define IWL2100_F_SCANNING 0x8
342 #define IWL2100_F_RESTARTING 0x10
343 #define IWL2100_F_IFSTART 0x20 /* if_start could run */
344 #define IWL2100_F_ERROR 0x40
345 #define IWL2100_F_ZERO_CMD 0x80
346 #define IWL2100_F_DETACH 0x100 /* detaching */
348 #define IWL2100_DBG_IBSS 0x01
349 #define IWL2100_DBG_SCAN 0x02
350 #define IWL2100_DBG_STATUS 0x04
351 #define IWL2100_DBG_RESTART 0x08
352 #define IWL2100_DBG_NOTE 0x10
353 #define IWL2100_DBG_CMD 0x20
355 #define IWL2100_PCIR_BAR PCIR_BAR(0)
356 #define IWL2100_DESC "Intel PRO/Wireless LAN 2100"
357 #define IWL2100_FW_PATH IWL_FW_PATH "2100/1.3/ipw2100-1.3%s.fw"
359 int iwl2100_attach(device_t
);
360 void iwl2100_detach(device_t
);
361 int iwl2100_shutdown(device_t
);
363 #endif /* _IWL2100VAR_H */