1 /* $OpenBSD: if_iwnvar.h,v 1.8 2008/12/03 17:17:08 damien Exp $ */
2 /* $NetBSD: if_iwnvar.h,v 1.5 2008/12/22 11:32:04 blymn Exp $ */
5 * Copyright (c) 2007, 2008
6 * Damien Bergamini <damien.bergamini@free.fr>
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 #define IEEE80211_NO_HT
23 struct iwn_rx_radiotap_header
{
24 struct ieee80211_radiotap_header wr_ihdr
;
28 uint16_t wr_chan_freq
;
29 uint16_t wr_chan_flags
;
30 int8_t wr_dbm_antsignal
;
31 int8_t wr_dbm_antnoise
;
34 #define IWN_RX_RADIOTAP_PRESENT \
35 ((1 << IEEE80211_RADIOTAP_TSFT) | \
36 (1 << IEEE80211_RADIOTAP_FLAGS) | \
37 (1 << IEEE80211_RADIOTAP_RATE) | \
38 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
39 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
40 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
42 struct iwn_tx_radiotap_header
{
43 struct ieee80211_radiotap_header wt_ihdr
;
46 uint16_t wt_chan_freq
;
47 uint16_t wt_chan_flags
;
51 #define IWN_TX_RADIOTAP_PRESENT \
52 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
53 (1 << IEEE80211_RADIOTAP_RATE) | \
54 (1 << IEEE80211_RADIOTAP_CHANNEL))
59 bus_dma_segment_t seg
;
68 bus_addr_t scratch_paddr
;
70 struct ieee80211_node
*ni
;
74 struct iwn_dma_info desc_dma
;
75 struct iwn_dma_info cmd_dma
;
76 struct iwn_tx_desc
*desc
;
77 struct iwn_tx_cmd
*cmd
;
78 struct iwn_tx_data data
[IWN_TX_RING_COUNT
];
85 #define IWN_RBUF_COUNT (IWN_RX_RING_COUNT + 32)
93 SLIST_ENTRY(iwn_rbuf
) next
;
102 struct iwn_dma_info desc_dma
;
103 struct iwn_dma_info stat_dma
;
104 struct iwn_dma_info buf_dma
;
106 struct iwn_rx_status
*stat
;
107 struct iwn_rx_data data
[IWN_RX_RING_COUNT
];
108 struct iwn_rbuf rbuf
[IWN_RBUF_COUNT
];
109 kmutex_t freelist_mtx
;
110 SLIST_HEAD(, iwn_rbuf
) freelist
;
116 struct ieee80211_node ni
; /* must be the first */
117 struct ieee80211_amrr_node amn
;
118 uint16_t disable_tid
;
120 uint8_t ridx
[IEEE80211_RATE_MAXSIZE
];
123 struct iwn_calib_state
{
125 #define IWN_CALIB_STATE_INIT 0
126 #define IWN_CALIB_STATE_ASSOC 1
127 #define IWN_CALIB_STATE_RUN 2
133 uint32_t ofdm_mrc_x1
;
135 uint32_t ofdm_mrc_x4
;
138 uint32_t bad_plcp_ofdm
;
140 uint32_t bad_plcp_cck
;
144 #define IWN_CCK_STATE_INIT 0
145 #define IWN_CCK_STATE_LOFA 1
146 #define IWN_CCK_STATE_HIFA 2
148 uint8_t noise_samples
[20];
149 u_int cur_noise_sample
;
151 uint32_t energy_samples
[10];
152 u_int cur_energy_sample
;
156 struct iwn_calib_info
{
170 struct iwn_fw_part init
;
171 struct iwn_fw_part main
;
172 struct iwn_fw_part boot
;
176 int (*load_firmware
)(struct iwn_softc
*);
177 void (*read_eeprom
)(struct iwn_softc
*);
178 int (*post_alive
)(struct iwn_softc
*);
179 int (*apm_init
)(struct iwn_softc
*);
180 int (*nic_config
)(struct iwn_softc
*);
181 void (*update_sched
)(struct iwn_softc
*, int, int, uint8_t,
183 int (*get_temperature
)(struct iwn_softc
*);
184 int (*get_rssi
)(const struct iwn_rx_stat
*);
185 int (*set_txpower
)(struct iwn_softc
*, int);
186 int (*init_gains
)(struct iwn_softc
*);
187 int (*set_gains
)(struct iwn_softc
*);
188 int (*add_node
)(struct iwn_softc
*, struct iwn_node_info
*,
190 void (*tx_done
)(struct iwn_softc
*, struct iwn_rx_desc
*,
191 struct iwn_rx_data
*);
192 #ifndef IEEE80211_NO_HT
193 void (*ampdu_tx_start
)(struct iwn_softc
*,
194 struct ieee80211_node
*, uint8_t, uint16_t);
195 void (*ampdu_tx_stop
)(struct iwn_softc
*, uint8_t,
198 const struct iwn_sensitivity_limits
*limits
;
200 uint8_t broadcast_id
;
203 uint32_t fw_text_maxsz
;
204 uint32_t fw_data_maxsz
;
206 bus_size_t sched_txfact_addr
;
212 struct ethercom sc_ec
;
213 struct ieee80211com sc_ic
;
214 int (*sc_newstate
)(struct ieee80211com
*,
215 enum ieee80211_state
, int);
217 struct ieee80211_amrr amrr
;
220 bus_dma_tag_t sc_dmat
;
223 #define IWN_FLAG_HAS_5GHZ (1 << 0)
224 #define IWN_FLAG_FIRST_BOOT (1 << 1)
227 const struct iwn_hal
*sc_hal
;
230 /* TX scheduler rings. */
231 struct iwn_dma_info sched_dma
;
235 /* "Keep Warm" page. */
236 struct iwn_dma_info kw_dma
;
238 /* Firmware DMA transfer. */
239 struct iwn_dma_info fw_dma
;
242 struct iwn_tx_ring txq
[IWN5000_NTXQUEUES
];
243 struct iwn_rx_ring rxq
;
245 bus_space_tag_t sc_st
;
246 bus_space_handle_t sc_sh
;
248 pci_chipset_tag_t sc_pct
;
251 int sc_cap_off
; /* PCIe Capabilities. */
255 struct iwn_calib_state calib
;
257 struct iwn_fw_info fw
;
258 struct iwn_calib_info calibcmd
[5];
261 struct iwn_rx_stat last_rx_stat
;
263 struct iwn_ucode_info ucode_info
;
264 struct iwn_rxon rxon
;
270 struct iwn4965_eeprom_band
273 char eeprom_domain
[4];
274 uint32_t eeprom_crystal
;
275 int16_t eeprom_voltage
;
278 int8_t maxpwr
[IEEE80211_CHAN_MAX
];
280 uint32_t critical_temp
;
294 struct iwn_rx_radiotap_header th
;
295 uint8_t pad
[IEEE80211_RADIOTAP_HDRLEN
];
297 #define sc_rxtap sc_rxtapu.th
301 struct iwn_tx_radiotap_header th
;
302 uint8_t pad
[IEEE80211_RADIOTAP_HDRLEN
];
304 #define sc_txtap sc_txtapu.th