1 /* $OpenBSD: athvar.h,v 1.25 2008/08/29 11:15:32 reyk Exp $ */ 2 /* $NetBSD: athvar.h,v 1.10 2004/08/10 01:03:53 dyoung Exp $ */ 3 4 /*- 5 * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer, 13 * without modification. 14 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 15 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 16 * redistribution must be conditioned upon including a substantially 17 * similar Disclaimer requirement for further binary redistribution. 18 * 3. Neither the names of the above-listed copyright holders nor the names 19 * of any contributors may be used to endorse or promote products derived 20 * from this software without specific prior written permission. 21 * 22 * NO WARRANTY 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 26 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 27 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 28 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 33 * THE POSSIBILITY OF SUCH DAMAGES. 34 * 35 * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.14 2004/04/03 03:33:02 sam Exp $ 36 */ 37 38 /* 39 * Definitions for the Atheros Wireless LAN controller driver. 40 */ 41 #ifndef _DEV_ATH_ATHVAR_H 42 #define _DEV_ATH_ATHVAR_H 43 44 #include <net80211/ieee80211_radiotap.h> 45 #include <dev/ic/ar5xxx.h> 46 47 #include "bpfilter.h" 48 49 #ifdef notyet 50 #include "gpio.h" 51 #endif 52 53 #define ATH_TIMEOUT 1000 54 55 #define ATH_RXBUF 40 /* number of RX buffers */ 56 #define ATH_TXBUF 60 /* number of TX buffers */ 57 #define ATH_TXDESC 8 /* number of descriptors per buffer */ 58 #define ATH_MAXGPIO 10 /* maximal number of gpio pins */ 59 60 struct ath_recv_hist { 61 int arh_ticks; /* sample time by system clock */ 62 u_int8_t arh_rssi; /* rssi */ 63 u_int8_t arh_antenna; /* antenna */ 64 }; 65 #define ATH_RHIST_SIZE 16 /* number of samples */ 66 #define ATH_RHIST_NOTIME (~0) 67 68 /* 69 * Ioctl-related definitions for the Atheros Wireless LAN controller driver. 70 */ 71 struct ath_stats { 72 u_int32_t ast_watchdog; /* device reset by watchdog */ 73 u_int32_t ast_hardware; /* fatal hardware error interrupts */ 74 u_int32_t ast_bmiss; /* beacon miss interrupts */ 75 u_int32_t ast_mib; /* MIB counter interrupts */ 76 u_int32_t ast_rxorn; /* rx overrun interrupts */ 77 u_int32_t ast_rxeol; /* rx eol interrupts */ 78 u_int32_t ast_txurn; /* tx underrun interrupts */ 79 u_int32_t ast_intrcoal; /* interrupts coalesced */ 80 u_int32_t ast_tx_mgmt; /* management frames transmitted */ 81 u_int32_t ast_tx_discard; /* frames discarded prior to assoc */ 82 u_int32_t ast_tx_qstop; /* output stopped 'cuz no buffer */ 83 u_int32_t ast_tx_encap; /* tx encapsulation failed */ 84 u_int32_t ast_tx_nonode; /* tx failed 'cuz no node */ 85 u_int32_t ast_tx_nombuf; /* tx failed 'cuz no mbuf */ 86 u_int32_t ast_tx_nomcl; /* tx failed 'cuz no cluster */ 87 u_int32_t ast_tx_linear; /* tx linearized to cluster */ 88 u_int32_t ast_tx_nodata; /* tx discarded empty frame */ 89 u_int32_t ast_tx_busdma; /* tx failed for dma resrcs */ 90 u_int32_t ast_tx_xretries;/* tx failed 'cuz too many retries */ 91 u_int32_t ast_tx_fifoerr; /* tx failed 'cuz FIFO underrun */ 92 u_int32_t ast_tx_filtered;/* tx failed 'cuz xmit filtered */ 93 u_int32_t ast_tx_shortretry;/* tx on-chip retries (short) */ 94 u_int32_t ast_tx_longretry;/* tx on-chip retries (long) */ 95 u_int32_t ast_tx_badrate; /* tx failed 'cuz bogus xmit rate */ 96 u_int32_t ast_tx_noack; /* tx frames with no ack marked */ 97 u_int32_t ast_tx_rts; /* tx frames with rts enabled */ 98 u_int32_t ast_tx_cts; /* tx frames with cts enabled */ 99 u_int32_t ast_tx_shortpre;/* tx frames with short preamble */ 100 u_int32_t ast_tx_altrate; /* tx frames with alternate rate */ 101 u_int32_t ast_tx_protect; /* tx frames with protection */ 102 u_int32_t ast_rx_nombuf; /* rx setup failed 'cuz no mbuf */ 103 u_int32_t ast_rx_busdma; /* rx setup failed for dma resrcs */ 104 u_int32_t ast_rx_orn; /* rx failed 'cuz of desc overrun */ 105 u_int32_t ast_rx_crcerr; /* rx failed 'cuz of bad CRC */ 106 u_int32_t ast_rx_fifoerr; /* rx failed 'cuz of FIFO overrun */ 107 u_int32_t ast_rx_badcrypt;/* rx failed 'cuz decryption */ 108 u_int32_t ast_rx_phyerr; /* rx failed 'cuz of PHY err */ 109 u_int32_t ast_rx_phy[32]; /* rx PHY error per-code counts */ 110 u_int32_t ast_rx_tooshort;/* rx discarded 'cuz frame too short */ 111 u_int32_t ast_rx_toobig; /* rx discarded 'cuz frame too large */ 112 u_int32_t ast_rx_ctl; /* rx discarded 'cuz ctl frame */ 113 u_int32_t ast_be_nombuf; /* beacon setup failed 'cuz no mbuf */ 114 u_int32_t ast_per_cal; /* periodic calibration calls */ 115 u_int32_t ast_per_calfail;/* periodic calibration failed */ 116 u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */ 117 u_int32_t ast_rate_calls; /* rate control checks */ 118 u_int32_t ast_rate_raise; /* rate control raised xmit rate */ 119 u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ 120 }; 121 122 #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) 123 124 /* 125 * Radio capture format. 126 */ 127 #define ATH_RX_RADIOTAP_PRESENT ( \ 128 (1 << IEEE80211_RADIOTAP_FLAGS) | \ 129 (1 << IEEE80211_RADIOTAP_RATE) | \ 130 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 131 (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 132 (1 << IEEE80211_RADIOTAP_RSSI) | \ 133 0) 134 135 struct ath_rx_radiotap_header { 136 struct ieee80211_radiotap_header wr_ihdr; 137 u_int8_t wr_flags; 138 u_int8_t wr_rate; 139 u_int16_t wr_chan_freq; 140 u_int16_t wr_chan_flags; 141 u_int8_t wr_antenna; 142 u_int8_t wr_rssi; 143 u_int8_t wr_max_rssi; 144 } __packed; 145 146 #define ATH_TX_RADIOTAP_PRESENT ( \ 147 (1 << IEEE80211_RADIOTAP_FLAGS) | \ 148 (1 << IEEE80211_RADIOTAP_RATE) | \ 149 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 150 (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \ 151 (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 152 (1 << IEEE80211_RADIOTAP_HWQUEUE) | \ 153 0) 154 155 struct ath_tx_radiotap_header { 156 struct ieee80211_radiotap_header wt_ihdr; 157 u_int8_t wt_flags; 158 u_int8_t wt_rate; 159 u_int16_t wt_chan_freq; 160 u_int16_t wt_chan_flags; 161 u_int8_t wt_txpower; 162 u_int8_t wt_antenna; 163 u_int8_t wt_hwqueue; 164 } __packed; 165 166 /* 167 * driver-specific node 168 */ 169 struct ath_node { 170 struct ieee80211_node an_node; /* base class */ 171 struct ieee80211_rssadapt an_rssadapt; /* rate adaption */ 172 u_int an_tx_antenna; /* antenna for last good frame */ 173 u_int an_rx_antenna; /* antenna for last rcvd frame */ 174 struct ath_recv_hist an_rx_hist[ATH_RHIST_SIZE]; 175 u_int an_rx_hist_next;/* index of next ``free entry'' */ 176 }; 177 #define ATH_NODE(_n) ((struct ath_node *)(_n)) 178 179 struct ath_buf { 180 TAILQ_ENTRY(ath_buf) bf_list; 181 bus_dmamap_t bf_dmamap; /* DMA map of the buffer */ 182 #define bf_nseg bf_dmamap->dm_nsegs 183 #define bf_mapsize bf_dmamap->dm_mapsize 184 #define bf_segs bf_dmamap->dm_segs 185 struct ath_desc *bf_desc; /* virtual addr of desc */ 186 bus_addr_t bf_daddr; /* physical addr of desc */ 187 struct mbuf *bf_m; /* mbuf for buf */ 188 struct ieee80211_node *bf_node; /* pointer to the node */ 189 struct ieee80211_rssdesc bf_id; 190 #define ATH_MAX_SCATTER 64 191 }; 192 193 typedef struct ath_task { 194 void (*t_func)(void*, int); 195 void *t_context; 196 } ath_task_t; 197 198 struct ath_softc { 199 #ifndef __FreeBSD__ 200 struct device sc_dev; 201 #endif 202 struct ieee80211com sc_ic; /* IEEE 802.11 common */ 203 #ifndef __FreeBSD__ 204 int (*sc_enable)(struct ath_softc *); 205 void (*sc_disable)(struct ath_softc *); 206 void (*sc_power)(struct ath_softc *, int); 207 #endif 208 int (*sc_newstate)(struct ieee80211com *, 209 enum ieee80211_state, int); 210 void (*sc_node_free)(struct ieee80211com *, 211 struct ieee80211_node *); 212 void (*sc_node_copy)(struct ieee80211com *, 213 struct ieee80211_node *, 214 const struct ieee80211_node *); 215 void (*sc_recv_mgmt)(struct ieee80211com *, 216 struct mbuf *, struct ieee80211_node *, 217 struct ieee80211_rxinfo *, int); 218 #ifdef __FreeBSD__ 219 device_t sc_dev; 220 #endif 221 bus_space_tag_t sc_st; /* bus space tag */ 222 bus_space_handle_t sc_sh; /* bus space handle */ 223 bus_size_t sc_ss; /* bus space size */ 224 bus_dma_tag_t sc_dmat; /* bus DMA tag */ 225 #ifdef __FreeBSD__ 226 struct mtx sc_mtx; /* master lock (recursive) */ 227 #endif 228 struct ath_hal *sc_ah; /* Atheros HAL */ 229 unsigned int sc_invalid : 1, /* disable hardware accesses */ 230 sc_doani : 1, /* dynamic noise immunity */ 231 sc_veol : 1, /* tx VEOL support */ 232 sc_softled : 1, /* GPIO software LED */ 233 sc_probing : 1, /* probing AP on beacon miss */ 234 sc_pcie : 1; /* indicates PCI Express */ 235 u_int sc_nchan; /* number of valid channels */ 236 const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX]; 237 const HAL_RATE_TABLE *sc_currates; /* current rate table */ 238 enum ieee80211_phymode sc_curmode; /* current phy mode */ 239 u_int8_t sc_rixmap[256]; /* IEEE to h/w rate table ix */ 240 u_int8_t sc_hwmap[32]; /* h/w rate ix to IEEE table */ 241 HAL_INT sc_imask; /* interrupt mask copy */ 242 243 #if NBPFILTER > 0 244 caddr_t sc_drvbpf; 245 246 union { 247 struct ath_rx_radiotap_header th; 248 uint8_t pad[IEEE80211_RADIOTAP_HDRLEN]; 249 } sc_rxtapu; 250 #define sc_rxtap sc_rxtapu.th 251 int sc_rxtap_len; 252 253 union { 254 struct ath_tx_radiotap_header th; 255 uint8_t pad[IEEE80211_RADIOTAP_HDRLEN]; 256 } sc_txtapu; 257 #define sc_txtap sc_txtapu.th 258 int sc_txtap_len; 259 #endif 260 261 struct ath_desc *sc_desc; /* TX/RX descriptors */ 262 bus_dma_segment_t sc_dseg; 263 #ifndef __NetBSD__ 264 int sc_dnseg; /* number of segments */ 265 #endif 266 bus_dmamap_t sc_ddmamap; /* DMA map for descriptors */ 267 bus_addr_t sc_desc_paddr; /* physical addr of sc_desc */ 268 bus_addr_t sc_desc_len; /* size of sc_desc */ 269 270 ath_task_t sc_fataltask; /* fatal int processing */ 271 ath_task_t sc_rxorntask; /* rxorn int processing */ 272 273 TAILQ_HEAD(, ath_buf) sc_rxbuf; /* receive buffer */ 274 u_int32_t *sc_rxlink; /* link ptr in last RX desc */ 275 ath_task_t sc_rxtask; /* rx int processing */ 276 277 u_int sc_txhalq[HAL_NUM_TX_QUEUES]; /* HAL q for outgoing frames */ 278 u_int32_t *sc_txlink; /* link ptr in last TX desc */ 279 int sc_tx_timer; /* transmit timeout */ 280 TAILQ_HEAD(, ath_buf) sc_txbuf; /* transmit buffer */ 281 #ifdef __FreeBSD__ 282 struct mtx sc_txbuflock; /* txbuf lock */ 283 #endif 284 TAILQ_HEAD(, ath_buf) sc_txq; /* transmitting queue */ 285 #ifdef __FreeBSD__ 286 struct mtx sc_txqlock; /* lock on txq and txlink */ 287 #endif 288 ath_task_t sc_txtask; /* tx int processing */ 289 290 u_int sc_bhalq; /* HAL q for outgoing beacons */ 291 struct ath_buf *sc_bcbuf; /* beacon buffer */ 292 struct ath_buf *sc_bufptr; /* allocated buffer ptr */ 293 ath_task_t sc_swbatask; /* swba int processing */ 294 ath_task_t sc_bmisstask; /* bmiss int processing */ 295 296 #ifdef __OpenBSD__ 297 struct timeval sc_last_ch; 298 struct timeout sc_cal_to; 299 struct timeval sc_last_beacon; 300 struct timeout sc_scan_to; 301 struct timeout sc_rssadapt_to; 302 #else 303 struct callout sc_cal_ch; /* callout handle for cals */ 304 struct callout sc_scan_ch; /* callout handle for scan */ 305 #endif 306 struct ath_stats sc_stats; /* interface statistics */ 307 HAL_MIB_STATS sc_mib_stats; /* MIB counter statistics */ 308 309 #ifndef __FreeBSD__ 310 void *sc_sdhook; /* shutdown hook */ 311 void *sc_powerhook; /* power management hook */ 312 u_int sc_flags; /* misc flags */ 313 #endif 314 315 u_int8_t sc_broadcast_addr[IEEE80211_ADDR_LEN]; 316 317 struct gpio_chipset_tag sc_gpio_gc; /* gpio(4) framework */ 318 gpio_pin_t sc_gpio_pins[ATH_MAXGPIO]; 319 }; 320 321 /* unaligned little endian access */ 322 #define LE_READ_2(p) \ 323 ((u_int16_t) \ 324 ((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8))) 325 #define LE_READ_4(p) \ 326 ((u_int32_t) \ 327 ((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8) | \ 328 (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24))) 329 330 #ifdef AR_DEBUG 331 enum { 332 ATH_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ 333 ATH_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */ 334 ATH_DEBUG_RECV = 0x00000004, /* basic recv operation */ 335 ATH_DEBUG_RECV_DESC = 0x00000008, /* recv descriptors */ 336 ATH_DEBUG_RATE = 0x00000010, /* rate control */ 337 ATH_DEBUG_RESET = 0x00000020, /* reset processing */ 338 ATH_DEBUG_MODE = 0x00000040, /* mode init/setup */ 339 ATH_DEBUG_BEACON = 0x00000080, /* beacon handling */ 340 ATH_DEBUG_WATCHDOG = 0x00000100, /* watchdog timeout */ 341 ATH_DEBUG_INTR = 0x00001000, /* ISR */ 342 ATH_DEBUG_TX_PROC = 0x00002000, /* tx ISR proc */ 343 ATH_DEBUG_RX_PROC = 0x00004000, /* rx ISR proc */ 344 ATH_DEBUG_BEACON_PROC = 0x00008000, /* beacon ISR proc */ 345 ATH_DEBUG_CALIBRATE = 0x00010000, /* periodic calibration */ 346 ATH_DEBUG_ANY = 0xffffffff 347 }; 348 #define IFF_DUMPPKTS(_ifp, _m) \ 349 ((ath_debug & _m) || \ 350 ((_ifp)->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2)) 351 #define DPRINTF(_m,X) if (ath_debug & (_m)) printf X 352 #else 353 #define IFF_DUMPPKTS(_ifp, _m) \ 354 (((_ifp)->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2)) 355 #define DPRINTF(_m, X) 356 #endif 357 358 /* 359 * Wrapper code 360 */ 361 #ifndef __FreeBSD__ 362 #undef KASSERT 363 #define KASSERT(cond, complaint) if (!(cond)) panic complaint 364 365 #define ATH_ATTACHED 0x0001 /* attach has succeeded */ 366 #define ATH_ENABLED 0x0002 /* chip is enabled */ 367 #define ATH_GPIO 0x0004 /* gpio device attached */ 368 369 #define ATH_IS_ENABLED(sc) ((sc)->sc_flags & ATH_ENABLED) 370 #endif 371 372 #define ATH_LOCK_INIT(_sc) \ 373 mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ 374 MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE) 375 #define ATH_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) 376 #define ATH_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 377 #define ATH_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 378 #define ATH_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) 379 380 #define ATH_TXBUF_LOCK_INIT(_sc) \ 381 mtx_init(&(_sc)->sc_txbuflock, \ 382 device_get_nameunit((_sc)->sc_dev), "xmit buf q", MTX_DEF) 383 #define ATH_TXBUF_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_txbuflock) 384 #define ATH_TXBUF_LOCK(_sc) mtx_lock(&(_sc)->sc_txbuflock) 385 #define ATH_TXBUF_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_txbuflock) 386 #define ATH_TXBUF_LOCK_ASSERT(_sc) \ 387 mtx_assert(&(_sc)->sc_txbuflock, MA_OWNED) 388 389 #define ATH_TXQ_LOCK_INIT(_sc) \ 390 mtx_init(&(_sc)->sc_txqlock, \ 391 device_get_nameunit((_sc)->sc_dev), "xmit q", MTX_DEF) 392 #define ATH_TXQ_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_txqlock) 393 #define ATH_TXQ_LOCK(_sc) mtx_lock(&(_sc)->sc_txqlock) 394 #define ATH_TXQ_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_txqlock) 395 #define ATH_TXQ_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_txqlock, MA_OWNED) 396 397 #define ATH_TICKS() (tick) 398 #define ATH_CALLOUT_INIT(chp) callout_init((chp)) 399 #define ATH_TASK_INIT(task, func, context) \ 400 do { \ 401 (task)->t_func = (func); \ 402 (task)->t_context = (context); \ 403 } while (0) 404 #define ATH_TASK_RUN_OR_ENQUEUE(task) ((*(task)->t_func)((task)->t_context, 1)) 405 406 typedef unsigned long u_intptr_t; 407 408 int ath_attach(u_int16_t, struct ath_softc *); 409 int ath_detach(struct ath_softc *, int); 410 int ath_enable(struct ath_softc *); 411 void ath_resume(struct ath_softc *, int); 412 void ath_suspend(struct ath_softc *, int); 413 #ifdef __NetBSD__ 414 int ath_activate(struct device *, enum devact); 415 void ath_power(int, void *); 416 #endif 417 void ath_shutdown(void *); 418 int ath_intr(void *); 419 int ath_enable(struct ath_softc *); 420 421 /* 422 * HAL definitions to comply with local coding convention. 423 */ 424 #define ath_hal_reset(_ah, _opmode, _chan, _outdoor, _pstatus) \ 425 ((*(_ah)->ah_reset)((_ah), (_opmode), (_chan), (_outdoor), (_pstatus))) 426 #define ath_hal_get_rate_table(_ah, _mode) \ 427 ((*(_ah)->ah_get_rate_table)((_ah), (_mode))) 428 #define ath_hal_get_lladdr(_ah, _mac) \ 429 ((*(_ah)->ah_get_lladdr)((_ah), (_mac))) 430 #define ath_hal_set_lladdr(_ah, _mac) \ 431 ((*(_ah)->ah_set_lladdr)((_ah), (_mac))) 432 #define ath_hal_set_intr(_ah, _mask) \ 433 ((*(_ah)->ah_set_intr)((_ah), (_mask))) 434 #define ath_hal_get_intr(_ah) \ 435 ((*(_ah)->ah_get_intr)((_ah))) 436 #define ath_hal_is_intr_pending(_ah) \ 437 ((*(_ah)->ah_is_intr_pending)((_ah))) 438 #define ath_hal_get_isr(_ah, _pmask) \ 439 ((*(_ah)->ah_get_isr)((_ah), (_pmask))) 440 #define ath_hal_update_tx_triglevel(_ah, _inc) \ 441 ((*(_ah)->ah_update_tx_triglevel)((_ah), (_inc))) 442 #define ath_hal_set_power(_ah, _mode, _sleepduration) \ 443 ((*(_ah)->ah_set_power)((_ah), (_mode), AH_TRUE, (_sleepduration))) 444 #define ath_hal_reset_key(_ah, _ix) \ 445 ((*(_ah)->ah_reset_key)((_ah), (_ix))) 446 #define ath_hal_set_key(_ah, _ix, _pk) \ 447 ((*(_ah)->ah_set_key)((_ah), (_ix), (_pk), NULL, AH_FALSE)) 448 #define ath_hal_is_key_valid(_ah, _ix) \ 449 (((*(_ah)->ah_is_key_valid)((_ah), (_ix)))) 450 #define ath_hal_set_key_lladdr(_ah, _ix, _mac) \ 451 ((*(_ah)->ah_set_key_lladdr)((_ah), (_ix), (_mac))) 452 #define ath_hal_softcrypto(_ah, _val ) \ 453 ((*(_ah)->ah_softcrypto)((_ah), (_val))) 454 #define ath_hal_get_rx_filter(_ah) \ 455 ((*(_ah)->ah_get_rx_filter)((_ah))) 456 #define ath_hal_set_rx_filter(_ah, _filter) \ 457 ((*(_ah)->ah_set_rx_filter)((_ah), (_filter))) 458 #define ath_hal_set_mcast_filter(_ah, _mfilt0, _mfilt1) \ 459 ((*(_ah)->ah_set_mcast_filter)((_ah), (_mfilt0), (_mfilt1))) 460 #define ath_hal_wait_for_beacon(_ah, _bf) \ 461 ((*(_ah)->ah_wait_for_beacon)((_ah), (_bf)->bf_daddr)) 462 #define ath_hal_put_rx_buf(_ah, _bufaddr) \ 463 ((*(_ah)->ah_put_rx_buf)((_ah), (_bufaddr))) 464 #define ath_hal_get_tsf32(_ah) \ 465 ((*(_ah)->ah_get_tsf32)((_ah))) 466 #define ath_hal_get_tsf64(_ah) \ 467 ((*(_ah)->ah_get_tsf64)((_ah))) 468 #define ath_hal_reset_tsf(_ah) \ 469 ((*(_ah)->ah_reset_tsf)((_ah))) 470 #define ath_hal_start_rx(_ah) \ 471 ((*(_ah)->ah_start_rx)((_ah))) 472 #define ath_hal_put_tx_buf(_ah, _q, _bufaddr) \ 473 ((*(_ah)->ah_put_tx_buf)((_ah), (_q), (_bufaddr))) 474 #define ath_hal_get_tx_buf(_ah, _q) \ 475 ((*(_ah)->ah_get_tx_buf)((_ah), (_q))) 476 #define ath_hal_get_rx_buf(_ah) \ 477 ((*(_ah)->ah_get_rx_buf)((_ah))) 478 #define ath_hal_tx_start(_ah, _q) \ 479 ((*(_ah)->ah_tx_start)((_ah), (_q))) 480 #define ath_hal_setchannel(_ah, _chan) \ 481 ((*(_ah)->ah_setchannel)((_ah), (_chan))) 482 #define ath_hal_calibrate(_ah, _chan) \ 483 ((*(_ah)->ah_calibrate)((_ah), (_chan))) 484 #define ath_hal_set_ledstate(_ah, _state) \ 485 ((*(_ah)->ah_set_ledstate)((_ah), (_state))) 486 #define ath_hal_init_beacon(_ah, _nextb, _bperiod) \ 487 ((*(_ah)->ah_init_beacon)((_ah), (_nextb), (_bperiod))) 488 #define ath_hal_reset_beacon(_ah) \ 489 ((*(_ah)->ah_reset_beacon)((_ah))) 490 #define ath_hal_set_beacon_timers(_ah, _bs, _tsf, _dc, _cc) \ 491 ((*(_ah)->ah_set_beacon_timers)((_ah), (_bs), (_tsf), \ 492 (_dc), (_cc))) 493 #define ath_hal_set_associd(_ah, _bss, _associd) \ 494 ((*(_ah)->ah_set_associd)((_ah), (_bss), (_associd), 0)) 495 #define ath_hal_get_regdomain(_ah, _prd) \ 496 (*(_prd) = (_ah)->ah_get_regdomain(_ah)) 497 #define ath_hal_detach(_ah) \ 498 ((*(_ah)->ah_detach)(_ah)) 499 #define ath_hal_set_slot_time(_ah, _t) \ 500 ((*(_ah)->ah_set_slot_time)(_ah, _t)) 501 #define ath_hal_set_gpio_output(_ah, _gpio) \ 502 ((*(_ah)->ah_set_gpio_output)((_ah), (_gpio))) 503 #define ath_hal_set_gpio_input(_ah, _gpio) \ 504 ((*(_ah)->ah_set_gpio_input)((_ah), (_gpio))) 505 #define ath_hal_get_gpio(_ah, _gpio) \ 506 ((*(_ah)->ah_get_gpio)((_ah), (_gpio))) 507 #define ath_hal_set_gpio(_ah, _gpio, _b) \ 508 ((*(_ah)->ah_set_gpio)((_ah), (_gpio), (_b))) 509 #define ath_hal_set_gpio_intr(_ah, _gpio, _b) \ 510 ((*(_ah)->ah_set_gpio_intr)((_ah), (_gpio), (_b))) 511 512 #define ath_hal_set_opmode(_ah) \ 513 ((*(_ah)->ah_set_opmode)((_ah))) 514 #define ath_hal_stop_tx_dma(_ah, _qnum) \ 515 ((*(_ah)->ah_stop_tx_dma)((_ah), (_qnum))) 516 #define ath_hal_stop_pcu_recv(_ah) \ 517 ((*(_ah)->ah_stop_pcu_recv)((_ah))) 518 #define ath_hal_start_rx_pcu(_ah) \ 519 ((*(_ah)->ah_start_rx_pcu)((_ah))) 520 #define ath_hal_stop_rx_dma(_ah) \ 521 ((*(_ah)->ah_stop_rx_dma)((_ah))) 522 #define ath_hal_get_diag_state(_ah, _id, _indata, _insize, _outdata, _outsize) \ 523 ((*(_ah)->ah_get_diag_state)((_ah), (_id), \ 524 (_indata), (_insize), (_outdata), (_outsize))) 525 526 #define ath_hal_setup_tx_queue(_ah, _type, _qinfo) \ 527 ((*(_ah)->ah_setup_tx_queue)((_ah), (_type), (_qinfo))) 528 #define ath_hal_reset_tx_queue(_ah, _q) \ 529 ((*(_ah)->ah_reset_tx_queue)((_ah), (_q))) 530 #define ath_hal_release_tx_queue(_ah, _q) \ 531 ((*(_ah)->ah_release_tx_queue)((_ah), (_q))) 532 #define ath_hal_has_veol(_ah) \ 533 ((*(_ah)->ah_has_veol)((_ah))) 534 #define ath_hal_update_mib_counters(_ah, _stats) \ 535 ((*(_ah)->ah_update_mib_counters)((_ah), (_stats))) 536 #define ath_hal_get_rf_gain(_ah) \ 537 ((*(_ah)->ah_get_rf_gain)((_ah))) 538 #define ath_hal_set_rx_signal(_ah) \ 539 ((*(_ah)->ah_set_rx_signal)((_ah))) 540 541 #define ath_hal_setup_rx_desc(_ah, _ds, _size, _intreq) \ 542 ((*(_ah)->ah_setup_rx_desc)((_ah), (_ds), (_size), (_intreq))) 543 #define ath_hal_proc_rx_desc(_ah, _ds, _dspa, _dsnext) \ 544 ((*(_ah)->ah_proc_rx_desc)((_ah), (_ds), (_dspa), (_dsnext))) 545 #define ath_hal_setup_tx_desc(_ah, _ds, _plen, _hlen, _atype, _txpow, \ 546 _txr0, _txtr0, _keyix, _ant, _flags, \ 547 _rtsrate, _rtsdura) \ 548 ((*(_ah)->ah_setup_tx_desc)((_ah), (_ds), (_plen), (_hlen), (_atype), \ 549 (_txpow), (_txr0), (_txtr0), (_keyix), (_ant), \ 550 (_flags), (_rtsrate), (_rtsdura))) 551 #define ath_hal_setup_xtx_desc(_ah, _ds, \ 552 _txr1, _txtr1, _txr2, _txtr2, _txr3, _txtr3) \ 553 ((*(_ah)->ah_setup_xtx_desc)((_ah), (_ds), \ 554 (_txr1), (_txtr1), (_txr2), (_txtr2), (_txr3), (_txtr3))) 555 #define ath_hal_fill_tx_desc(_ah, _ds, _l, _first, _last) \ 556 ((*(_ah)->ah_fill_tx_desc)((_ah), (_ds), (_l), (_first), (_last))) 557 #define ath_hal_proc_tx_desc(_ah, _ds) \ 558 ((*(_ah)->ah_proc_tx_desc)((_ah), (_ds))) 559 560 #endif /* _DEV_ATH_ATHVAR_H */ 561