if_iwivar.h (166849) | if_iwivar.h (170530) |
---|---|
1/* $FreeBSD: head/sys/dev/iwi/if_iwivar.h 166849 2007-02-20 17:32:30Z luigi $ */ | 1/* $FreeBSD: head/sys/dev/iwi/if_iwivar.h 170530 2007-06-11 03:36:55Z sam $ */ |
2 3/*- 4 * Copyright (c) 2004, 2005 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 108 unchanged lines hidden (view full) --- 118 struct ifnet *sc_ifp; 119 struct ieee80211com sc_ic; 120 int (*sc_newstate)(struct ieee80211com *, 121 enum ieee80211_state, int); 122 void (*sc_node_free)(struct ieee80211_node *); 123 device_t sc_dev; 124 125 struct mtx sc_mtx; | 2 3/*- 4 * Copyright (c) 2004, 2005 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 108 unchanged lines hidden (view full) --- 118 struct ifnet *sc_ifp; 119 struct ieee80211com sc_ic; 120 int (*sc_newstate)(struct ieee80211com *, 121 enum ieee80211_state, int); 122 void (*sc_node_free)(struct ieee80211_node *); 123 device_t sc_dev; 124 125 struct mtx sc_mtx; |
126 struct mtx sc_cmdlock; 127 char sc_cmdname[12]; /* e.g. "iwi0_cmd" */ |
|
126 uint8_t sc_mcast[IEEE80211_ADDR_LEN]; 127 struct unrhdr *sc_unr; 128 struct taskqueue *sc_tq; /* private task queue */ 129#if __FreeBSD_version < 700000 130 struct proc *sc_tqproc; 131#endif 132 133 uint32_t flags; 134#define IWI_FLAG_FW_INITED (1 << 0) | 128 uint8_t sc_mcast[IEEE80211_ADDR_LEN]; 129 struct unrhdr *sc_unr; 130 struct taskqueue *sc_tq; /* private task queue */ 131#if __FreeBSD_version < 700000 132 struct proc *sc_tqproc; 133#endif 134 135 uint32_t flags; 136#define IWI_FLAG_FW_INITED (1 << 0) |
135#define IWI_FLAG_SCANNING (1 << 1) 136#define IWI_FLAG_FW_LOADING (1 << 2) | |
137#define IWI_FLAG_BUSY (1 << 3) /* busy sending a command */ 138#define IWI_FLAG_ASSOCIATED (1 << 4) /* currently associated */ | 137#define IWI_FLAG_BUSY (1 << 3) /* busy sending a command */ 138#define IWI_FLAG_ASSOCIATED (1 << 4) /* currently associated */ |
139 | 139#define IWI_FLAG_CHANNEL_SCAN (1 << 5) 140 uint32_t fw_state; 141#define IWI_FW_IDLE 0 142#define IWI_FW_LOADING 1 143#define IWI_FW_ASSOCIATING 2 144#define IWI_FW_DISASSOCIATING 3 145#define IWI_FW_SCANNING 4 |
140 struct iwi_cmd_ring cmdq; 141 struct iwi_tx_ring txq[WME_NUM_AC]; 142 struct iwi_rx_ring rxq; 143 144 struct resource *irq; 145 struct resource *mem; 146 bus_space_tag_t sc_st; 147 bus_space_handle_t sc_sh; --- 23 unchanged lines hidden (view full) --- 171 void *fw_virtaddr; 172 enum ieee80211_opmode fw_mode; /* mode of current firmware */ 173 struct iwi_fw fw_boot; /* boot firmware */ 174 struct iwi_fw fw_uc; /* microcode */ 175 struct iwi_fw fw_fw; /* operating mode support */ 176 177 int curchan; /* current h/w channel # */ 178 int antenna; | 146 struct iwi_cmd_ring cmdq; 147 struct iwi_tx_ring txq[WME_NUM_AC]; 148 struct iwi_rx_ring rxq; 149 150 struct resource *irq; 151 struct resource *mem; 152 bus_space_tag_t sc_st; 153 bus_space_handle_t sc_sh; --- 23 unchanged lines hidden (view full) --- 177 void *fw_virtaddr; 178 enum ieee80211_opmode fw_mode; /* mode of current firmware */ 179 struct iwi_fw fw_boot; /* boot firmware */ 180 struct iwi_fw fw_uc; /* microcode */ 181 struct iwi_fw fw_fw; /* operating mode support */ 182 183 int curchan; /* current h/w channel # */ 184 int antenna; |
179 int dwelltime; | |
180 int bluetooth; 181 struct iwi_associate assoc; 182 struct iwi_wme_params wme[3]; | 185 int bluetooth; 186 struct iwi_associate assoc; 187 struct iwi_wme_params wme[3]; |
188 u_int sc_scangen; |
|
183 184 struct task sc_radiontask; /* radio on processing */ 185 struct task sc_radiofftask; /* radio off processing */ | 189 190 struct task sc_radiontask; /* radio on processing */ 191 struct task sc_radiofftask; /* radio off processing */ |
186 struct task sc_scanstarttask;/* scan start processing */ 187 struct task sc_scanaborttask;/* scan abort processing */ 188 struct task sc_scandonetask;/* scan completed processing */ 189 struct task sc_scantask; /* scan channel processing */ 190 struct task sc_setwmetask; /* set wme params processing */ 191 struct task sc_downtask; /* disassociate processing */ | 192 struct task sc_scanaborttask; /* cancel active scan */ |
192 struct task sc_restarttask; /* restart adapter processing */ | 193 struct task sc_restarttask; /* restart adapter processing */ |
194 struct task sc_opstask; /* scan / auth processing */ |
|
193 194 unsigned int sc_softled : 1, /* enable LED gpio status */ 195 sc_ledstate: 1, /* LED on/off state */ 196 sc_blinking: 1; /* LED blink operation active */ 197 u_int sc_nictype; /* NIC type from EEPROM */ 198 u_int sc_ledpin; /* mask for activity LED */ 199 u_int sc_ledidle; /* idle polling interval */ 200 int sc_ledevent; /* time of last LED event */ 201 u_int8_t sc_rxrate; /* current rx rate for LED */ 202 u_int8_t sc_rxrix; 203 u_int8_t sc_txrate; /* current tx rate for LED */ 204 u_int8_t sc_txrix; 205 u_int16_t sc_ledoff; /* off time for current blink */ 206 struct callout sc_ledtimer; /* led off timer */ | 195 196 unsigned int sc_softled : 1, /* enable LED gpio status */ 197 sc_ledstate: 1, /* LED on/off state */ 198 sc_blinking: 1; /* LED blink operation active */ 199 u_int sc_nictype; /* NIC type from EEPROM */ 200 u_int sc_ledpin; /* mask for activity LED */ 201 u_int sc_ledidle; /* idle polling interval */ 202 int sc_ledevent; /* time of last LED event */ 203 u_int8_t sc_rxrate; /* current rx rate for LED */ 204 u_int8_t sc_rxrix; 205 u_int8_t sc_txrate; /* current tx rate for LED */ 206 u_int8_t sc_txrix; 207 u_int16_t sc_ledoff; /* off time for current blink */ 208 struct callout sc_ledtimer; /* led off timer */ |
209 struct callout sc_wdtimer; /* watchdog timer */ |
|
207 208 int sc_tx_timer; 209 int sc_rfkill_timer;/* poll for rfkill change */ | 210 211 int sc_tx_timer; 212 int sc_rfkill_timer;/* poll for rfkill change */ |
210 int sc_scan_timer; /* scan request timeout */ | 213 int sc_state_timer; /* firmware state timer */ 214 int sc_busy_timer; /* firmware cmd timer */ |
211 | 215 |
216#define IWI_SCAN_START (1 << 0) 217#define IWI_SET_CHANNEL (1 << 1) 218#define IWI_SCAN_END (1 << 2) 219#define IWI_ASSOC (1 << 3) 220#define IWI_DISASSOC (1 << 4) 221#define IWI_SCAN_CURCHAN (1 << 5) 222#define IWI_SCAN_ALLCHAN (1 << 6) 223#define IWI_SET_WME (1 << 7) 224#define IWI_CMD_MAXOPS 10 225 int sc_cmd[IWI_CMD_MAXOPS]; 226 int sc_cmd_cur; /* current queued scan task */ 227 int sc_cmd_next; /* last queued scan task */ 228 unsigned long sc_maxdwell; /* max dwell time for curchan */ |
|
212 struct bpf_if *sc_drvbpf; 213 214 union { 215 struct iwi_rx_radiotap_header th; 216 uint8_t pad[64]; 217 } sc_rxtapu; 218#define sc_rxtap sc_rxtapu.th 219 int sc_rxtap_len; 220 221 union { 222 struct iwi_tx_radiotap_header th; 223 uint8_t pad[64]; 224 } sc_txtapu; 225#define sc_txtap sc_txtapu.th 226 int sc_txtap_len; 227}; 228 | 229 struct bpf_if *sc_drvbpf; 230 231 union { 232 struct iwi_rx_radiotap_header th; 233 uint8_t pad[64]; 234 } sc_rxtapu; 235#define sc_rxtap sc_rxtapu.th 236 int sc_rxtap_len; 237 238 union { 239 struct iwi_tx_radiotap_header th; 240 uint8_t pad[64]; 241 } sc_txtapu; 242#define sc_txtap sc_txtapu.th 243 int sc_txtap_len; 244}; 245 |
246#define IWI_STATE_BEGIN(_sc, _state) do { \ 247 KASSERT(_sc->fw_state == IWI_FW_IDLE, \ 248 ("iwi firmware not idle")); \ 249 _sc->fw_state = _state; \ 250 _sc->sc_state_timer = 5; \ 251 DPRINTF(("enter FW state %d\n", _state)); \ 252} while (0) 253 254#define IWI_STATE_END(_sc, _state) do { \ 255 if (_sc->fw_state == _state) \ 256 DPRINTF(("exit FW state %d\n", _state)); \ 257 else \ 258 DPRINTF(("expected FW state %d, got %d\n", \ 259 _state, _sc->fw_state)); \ 260 _sc->fw_state = IWI_FW_IDLE; \ 261 wakeup(_sc); \ 262 _sc->sc_state_timer = 0; \ 263} while (0) |
|
229/* 230 * NB.: This models the only instance of async locking in iwi_init_locked 231 * and must be kept in sync. 232 */ | 264/* 265 * NB.: This models the only instance of async locking in iwi_init_locked 266 * and must be kept in sync. 267 */ |
268#define IWI_LOCK_INIT(sc) \ 269 mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \ 270 MTX_NETWORK_LOCK, MTX_DEF) 271#define IWI_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) |
|
233#define IWI_LOCK_DECL int __waslocked = 0 | 272#define IWI_LOCK_DECL int __waslocked = 0 |
234#define IWI_LOCK_CHECK(sc) do { \ 235 if (!mtx_owned(&(sc)->sc_mtx)) \ 236 DPRINTF(("%s iwi_lock not held\n", __func__)); \ 237} while (0) | 273#define IWI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) |
238#define IWI_LOCK(sc) do { \ 239 if (!(__waslocked = mtx_owned(&(sc)->sc_mtx))) \ 240 mtx_lock(&(sc)->sc_mtx); \ 241} while (0) 242#define IWI_UNLOCK(sc) do { \ 243 if (!__waslocked) \ 244 mtx_unlock(&(sc)->sc_mtx); \ 245} while (0) | 274#define IWI_LOCK(sc) do { \ 275 if (!(__waslocked = mtx_owned(&(sc)->sc_mtx))) \ 276 mtx_lock(&(sc)->sc_mtx); \ 277} while (0) 278#define IWI_UNLOCK(sc) do { \ 279 if (!__waslocked) \ 280 mtx_unlock(&(sc)->sc_mtx); \ 281} while (0) |
282#define IWI_CMD_LOCK_INIT(sc) do { \ 283 snprintf((sc)->sc_cmdname, sizeof((sc)->sc_cmdname), "%s_cmd", \ 284 device_get_nameunit((sc)->sc_dev)); \ 285 mtx_init(&(sc)->sc_cmdlock, (sc)->sc_cmdname, NULL, MTX_DEF); \ 286} while (0) 287#define IWI_CMD_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_cmdlock) 288#define IWI_CMD_LOCK(sc) mtx_lock(&(sc)->sc_cmdlock) 289#define IWI_CMD_UNLOCK(sc) mtx_unlock(&(sc)->sc_cmdlock) |
|