prepare for a new hal

This commit is contained in:
Sam Leffler 2008-10-27 18:30:33 +00:00
parent 46d4d74c94
commit 411373ebc6
3 changed files with 36 additions and 9 deletions

View File

@ -71,8 +71,12 @@ extern void ath_hal_assert_failed(const char* filename,
int lineno, const char* msg);
#endif
#ifdef AH_DEBUG
#if HAL_ABI_VERSION >= 0x08090101
extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...);
#else
extern void HALDEBUG(struct ath_hal *ah, const char* fmt, ...);
extern void HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...);
#endif
#endif /* AH_DEBUG */
/* NB: put this here instead of the driver to avoid circular references */
@ -139,6 +143,18 @@ ath_hal_ether_sprintf(const u_int8_t *mac)
}
#ifdef AH_DEBUG
#if HAL_ABI_VERSION >= 0x08090101
void
HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
{
if (ath_hal_debug & mask) {
__va_list ap;
va_start(ap, fmt);
ath_hal_vprintf(ah, fmt, ap);
va_end(ap);
}
}
#else
void
HALDEBUG(struct ath_hal *ah, const char* fmt, ...)
{
@ -160,6 +176,7 @@ HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...)
va_end(ap);
}
}
#endif
#endif /* AH_DEBUG */
#ifdef AH_DEBUG_ALQ

View File

@ -298,6 +298,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
struct ath_hal *ah = NULL;
HAL_STATUS status;
int error = 0, i;
u_int wmodes;
DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
@ -605,7 +606,8 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
sc->sc_hastsfadd = ath_hal_hastsfadjust(ah);
if (ath_hal_hasfastframes(ah))
ic->ic_caps |= IEEE80211_C_FF;
if (ath_hal_getwirelessmodes(ah, ic->ic_regdomain.country) & (HAL_MODE_108G|HAL_MODE_TURBO))
wmodes = ath_hal_getwirelessmodes(ah, ic->ic_regdomain.country);
if (wmodes & (HAL_MODE_108G|HAL_MODE_TURBO))
ic->ic_caps |= IEEE80211_C_TURBOP;
/*
@ -2550,10 +2552,10 @@ ath_key_update_end(struct ieee80211vap *vap)
*
* o always accept unicast, broadcast, and multicast traffic
* o accept PHY error frames when hardware doesn't have MIB support
* to count and we need them for ANI (sta mode only at the moment)
* to count and we need them for ANI (sta mode only until recently)
* and we are not scanning (ANI is disabled)
* NB: only with recent hal's; older hal's add rx filter bits out
* of sight and we need to blindly preserve them
* NB: older hal's add rx filter bits out of sight and we need to
* blindly preserve them
* o probe request frames are accepted only when operating in
* hostap, adhoc, or monitor modes
* o enable promiscuous mode
@ -2580,15 +2582,17 @@ ath_calcrxfilter(struct ath_softc *sc)
struct ieee80211com *ic = ifp->if_l2com;
u_int32_t rfilt;
#if HAL_ABI_VERSION < 0x08011600
rfilt = (ath_hal_getrxfilter(sc->sc_ah) &
(HAL_RX_FILTER_PHYRADAR | HAL_RX_FILTER_PHYERR))
| HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
#else
rfilt = HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
#if HAL_ABI_VERSION < 0x08011600
rfilt |= (ath_hal_getrxfilter(sc->sc_ah) &
(HAL_RX_FILTER_PHYRADAR | HAL_RX_FILTER_PHYERR));
#elif HAL_ABI_VERSION < 0x08060100
if (ic->ic_opmode == IEEE80211_M_STA &&
!sc->sc_needmib && !sc->sc_scanning)
rfilt |= HAL_RX_FILTER_PHYERR;
#else
if (!sc->sc_needmib && !sc->sc_scanning)
rfilt |= HAL_RX_FILTER_PHYERR;
#endif
if (ic->ic_opmode != IEEE80211_M_STA)
rfilt |= HAL_RX_FILTER_PROBEREQ;

View File

@ -506,6 +506,8 @@ void ath_intr(void *);
(ath_hal_getcapability(_ah, HAL_CAP_CIPHER, _cipher, NULL) == HAL_OK)
#define ath_hal_getregdomain(_ah, _prd) \
(ath_hal_getcapability(_ah, HAL_CAP_REG_DMN, 0, (_prd)) == HAL_OK)
#if HAL_ABI_VERSION < 0x08090100
/* XXX wrong for anything but amd64 and i386 */
#if defined(__LP64__)
#define ath_hal_setregdomain(_ah, _rd) \
(*(uint16_t *)(((uint8_t *)&(_ah)[1]) + 176) = (_rd))
@ -513,6 +515,10 @@ void ath_intr(void *);
#define ath_hal_setregdomain(_ah, _rd) \
(*(uint16_t *)(((uint8_t *)&(_ah)[1]) + 128) = (_rd))
#endif
#else
#define ath_hal_setregdomain(_ah, _rd) \
ath_hal_setcapability(_ah, HAL_CAP_REG_DMN, 0, _rd, NULL)
#endif
#define ath_hal_getcountrycode(_ah, _pcc) \
(*(_pcc) = (_ah)->ah_countryCode)
#define ath_hal_gettkipmic(_ah) \