1 /* $FreeBSD: head/sys/dev/iwn/if_iwnvar.h 258035 2013-11-12 05:58:23Z adrian $ */
2 /* $OpenBSD: if_iwnvar.h,v 1.18 2010/04/30 16:06:46 damien Exp $ */
5 * Copyright (c) 2013 Cedric GROSS <cg@cgross.info>
6 * Copyright (c) 2011 Intel Corporation
7 * Copyright (c) 2007, 2008
8 * Damien Bergamini <damien.bergamini@free.fr>
9 * Copyright (c) 2008 Sam Leffler, Errno Consulting
11 * Permission to use, copy, modify, and distribute this software for any
12 * purpose with or without fee is hereby granted, provided that the above
13 * copyright notice and this permission notice appear in all copies.
15 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
16 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
18 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 #include <netproto/802_11/ieee80211_amrr.h>
26 enum iwn_rxon_ctx_id {
38 struct iwn_pan_params_cmd {
40 #define IWN_PAN_PARAMS_FLG_SLOTTED_MODE (1 << 3)
44 struct iwn_pan_slot slots[10];
53 uint64_t led_last_tpt;
59 struct iwn_rx_radiotap_header {
60 struct ieee80211_radiotap_header wr_ihdr;
64 uint16_t wr_chan_freq;
65 uint16_t wr_chan_flags;
66 int8_t wr_dbm_antsignal;
67 int8_t wr_dbm_antnoise;
70 #define IWN_RX_RADIOTAP_PRESENT \
71 ((1 << IEEE80211_RADIOTAP_TSFT) | \
72 (1 << IEEE80211_RADIOTAP_FLAGS) | \
73 (1 << IEEE80211_RADIOTAP_RATE) | \
74 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
75 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
76 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
78 struct iwn_tx_radiotap_header {
79 struct ieee80211_radiotap_header wt_ihdr;
82 uint16_t wt_chan_freq;
83 uint16_t wt_chan_flags;
86 #define IWN_TX_RADIOTAP_PRESENT \
87 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
88 (1 << IEEE80211_RADIOTAP_RATE) | \
89 (1 << IEEE80211_RADIOTAP_CHANNEL))
94 bus_dma_segment_t seg;
102 bus_addr_t cmd_paddr;
103 bus_addr_t scratch_paddr;
105 struct ieee80211_node *ni;
109 struct iwn_dma_info desc_dma;
110 struct iwn_dma_info cmd_dma;
111 struct iwn_tx_desc *desc;
112 struct iwn_tx_cmd *cmd;
113 struct iwn_tx_data data[IWN_TX_RING_COUNT];
114 bus_dma_tag_t data_dmat;
122 struct ieee80211_node ni; /* must be the first */
126 int success_threshold;
138 struct iwn_dma_info desc_dma;
139 struct iwn_dma_info stat_dma;
141 struct iwn_rx_status *stat;
142 struct iwn_rx_data data[IWN_RX_RING_COUNT];
143 bus_dma_tag_t data_dmat;
148 struct ieee80211_node ni; /* must be the first */
149 uint16_t disable_tid;
155 } agg[IEEE80211_TID_SIZE];
156 struct ieee80211_amrr_node amn;
159 struct iwn_calib_state {
161 #define IWN_CALIB_STATE_INIT 0
162 #define IWN_CALIB_STATE_ASSOC 1
163 #define IWN_CALIB_STATE_RUN 2
169 uint32_t ofdm_mrc_x1;
171 uint32_t ofdm_mrc_x4;
174 uint32_t bad_plcp_ofdm;
176 uint32_t bad_plcp_cck;
180 #define IWN_CCK_STATE_INIT 0
181 #define IWN_CCK_STATE_LOFA 1
182 #define IWN_CCK_STATE_HIFA 2
184 uint8_t noise_samples[20];
185 u_int cur_noise_sample;
187 uint32_t energy_samples[10];
188 u_int cur_energy_sample;
192 struct iwn_calib_info {
207 struct iwn_fw_part init;
208 struct iwn_fw_part main;
209 struct iwn_fw_part boot;
213 int (*load_firmware)(struct iwn_softc *);
214 void (*read_eeprom)(struct iwn_softc *);
215 int (*post_alive)(struct iwn_softc *);
216 int (*nic_config)(struct iwn_softc *);
217 void (*update_sched)(struct iwn_softc *, int, int, uint8_t,
219 int (*get_temperature)(struct iwn_softc *);
220 int (*get_rssi)(struct iwn_softc *, struct iwn_rx_stat *);
221 int (*set_txpower)(struct iwn_softc *,
222 struct ieee80211_channel *, int);
223 int (*init_gains)(struct iwn_softc *);
224 int (*set_gains)(struct iwn_softc *);
225 int (*add_node)(struct iwn_softc *, struct iwn_node_info *,
227 void (*tx_done)(struct iwn_softc *, struct iwn_rx_desc *,
228 struct iwn_rx_data *);
229 void (*ampdu_tx_start)(struct iwn_softc *,
230 struct ieee80211_node *, int, uint8_t, uint16_t);
231 void (*ampdu_tx_stop)(struct iwn_softc *, int, uint8_t,
236 struct ieee80211vap iv_vap;
239 int (*iv_newstate)(struct ieee80211vap *,
240 enum ieee80211_state, int);
241 struct ieee80211_amrr_node iv_amrr;
244 uint8_t macaddr[IEEE80211_ADDR_LEN];
247 #define IWN_VAP(_vap) ((struct iwn_vap *)(_vap))
250 struct arpcom arpcom;
253 struct ifnet *sc_ifp;
259 #define IWN_FLAG_HAS_OTPROM (1 << 1)
260 #define IWN_FLAG_CALIB_DONE (1 << 2)
261 #define IWN_FLAG_USE_ICT (1 << 3)
262 #define IWN_FLAG_INTERNAL_PA (1 << 4)
263 #define IWN_FLAG_HAS_11N (1 << 6)
264 #define IWN_FLAG_ENH_SENS (1 << 7)
265 #define IWN_FLAG_ADV_BTCOEX (1 << 8)
266 #define IWN_FLAG_PAN_SUPPORT (1 << 9)
267 #define IWN_FLAG_BTCOEX (1 << 10)
270 /* subdevice_id used to adjust configuration */
271 uint16_t subdevice_id;
275 const struct iwn_sensitivity_limits
280 uint8_t broadcast_id;
283 uint32_t fw_text_maxsz;
284 uint32_t fw_data_maxsz;
286 bus_size_t sched_txfact_addr;
287 uint32_t reset_noise_gain;
290 /* TX scheduler rings. */
291 struct iwn_dma_info sched_dma;
295 /* "Keep Warm" page. */
296 struct iwn_dma_info kw_dma;
298 /* Firmware image. */
299 const struct firmware *fw_fp;
301 /* Firmware DMA transfer. */
302 struct iwn_dma_info fw_dma;
305 struct iwn_dma_info ict_dma;
310 struct iwn_tx_ring txq[IWN5000_NTXQUEUES];
311 struct iwn_rx_ring rxq;
314 struct resource *mem;
315 bus_space_tag_t sc_st;
316 bus_space_handle_t sc_sh;
318 struct resource *irq;
319 bus_dma_tag_t sc_dmat;
322 int sc_cap_off; /* PCIe Capabilities. */
324 /* Tasks used by the driver */
325 struct task sc_reinit_task;
326 struct task sc_radioon_task;
327 struct task sc_radiooff_task;
329 struct callout calib_to;
331 struct iwn_calib_state calib;
332 struct callout watchdog_to;
333 struct callout ct_kill_exit_to;
334 struct iwn_fw_info fw;
335 struct iwn_calib_info calibcmd[IWN5000_PHY_CALIB_MAX_RESULT];
338 struct iwn_rx_stat last_rx_stat;
340 struct iwn_ucode_info ucode_info;
341 struct iwn_rxon rx_on[IWN_NUM_RXON_CTX];
342 struct iwn_rxon *rxon;
344 struct ieee80211vap *ivap[IWN_NUM_RXON_CTX];
346 uint8_t uc_scan_progress;
353 struct iwn4965_eeprom_band
355 struct iwn_eeprom_chan eeprom_channels[IWN_NBANDS][IWN_MAX_CHAN_PER_BAND];
358 char eeprom_domain[4];
359 uint32_t eeprom_crystal;
361 int16_t eeprom_temp_high;
362 int16_t eeprom_voltage;
365 int8_t maxpwr[IEEE80211_CHAN_MAX];
367 uint32_t tlv_feature_flags;
380 struct ieee80211_tx_ampdu *qid2tap[IWN5000_NTXQUEUES];
382 int (*sc_ampdu_rx_start)(struct ieee80211_node *,
383 struct ieee80211_rx_ampdu *, int, int, int);
384 void (*sc_ampdu_rx_stop)(struct ieee80211_node *,
385 struct ieee80211_rx_ampdu *);
386 int (*sc_addba_request)(struct ieee80211_node *,
387 struct ieee80211_tx_ampdu *, int, int, int);
388 int (*sc_addba_response)(struct ieee80211_node *,
389 struct ieee80211_tx_ampdu *, int, int, int);
390 void (*sc_addba_stop)(struct ieee80211_node *,
391 struct ieee80211_tx_ampdu *);
393 struct iwn_led_mode sc_led;
395 struct iwn_rx_radiotap_header sc_rxtap;
396 struct iwn_tx_radiotap_header sc_txtap;
398 /* The power save level originally configured by user */
399 int desired_pwrsave_level;
402 * The current power save level, this may differ from the
403 * configured value due to thermal throttling etc.
405 int current_pwrsave_level;
407 /* For specific params */
408 const struct iwn_base_params *base_params;
409 struct sysctl_ctx_list sc_sysctl_ctx;
410 struct sysctl_oid *sc_sysctl_tree;