summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2008-10-27 18:30:33 +0000
committersam <sam@FreeBSD.org>2008-10-27 18:30:33 +0000
commit9e6bb8a8ae343ea61719e7d0d5cef327ae33ce87 (patch)
tree85ee583b1aeda558fcf2e8e155e60aebfe76bf22
parent3a67cd452005bbfb125d20983e298b56f76b5e31 (diff)
downloadFreeBSD-src-9e6bb8a8ae343ea61719e7d0d5cef327ae33ce87.zip
FreeBSD-src-9e6bb8a8ae343ea61719e7d0d5cef327ae33ce87.tar.gz
prepare for a new hal
-rw-r--r--sys/dev/ath/ah_osdep.c17
-rw-r--r--sys/dev/ath/if_ath.c22
-rw-r--r--sys/dev/ath/if_athvar.h6
3 files changed, 36 insertions, 9 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index 249c260..8ddb425 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -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
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 1ba573f..712b0cc 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -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;
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index 1bd248f..f67c44a 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -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) \
OpenPOWER on IntegriCloud