svn commit: r187642 - user/sam/wifi/sys/dev/ath/ath_hal
Sam Leffler
sam at FreeBSD.org
Fri Jan 23 11:20:32 PST 2009
Author: sam
Date: Fri Jan 23 19:20:31 2009
New Revision: 187642
URL: http://svn.freebsd.org/changeset/base/187642
Log:
Minor fixups to ath_hal_checkchannel:
o move to an inline function unless building with AH_DEBUG
o add assertions
Modified:
user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h
user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h Fri Jan 23 18:58:43 2009 (r187641)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h Fri Jan 23 19:20:31 2009 (r187642)
@@ -437,32 +437,6 @@ isBigEndian(void)
#define OS_REG_CLR_BIT(_a, _r, _f) \
OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) &~ (_f))
-/*
- * Regulatory domain support.
- */
-
-/*
- * Return the max allowed antenna gain and apply any regulatory
- * domain specific changes.
- */
-u_int ath_hal_getantennareduction(struct ath_hal *ah,
- const struct ieee80211_channel *chan, u_int twiceGain);
-
-/*
- * Return the test group for the specific channel based on
- * the current regulatory setup.
- */
-u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *);
-
-/*
- * Map a public channel definition to the corresponding
- * internal data structure. This implicitly specifies
- * whether or not the specified channel is ok to use
- * based on the current regulatory domain constraints.
- */
-HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *,
- const struct ieee80211_channel *);
-
/* system-configurable parameters */
extern int ath_hal_dma_beacon_response_time; /* in TU's */
extern int ath_hal_sw_beacon_response_time; /* in TU's */
@@ -521,6 +495,46 @@ extern void ath_hal_assert_failed(const
#define HALASSERT(_x)
#endif /* AH_ASSERT */
+/*
+ * Regulatory domain support.
+ */
+
+/*
+ * Return the max allowed antenna gain and apply any regulatory
+ * domain specific changes.
+ */
+u_int ath_hal_getantennareduction(struct ath_hal *ah,
+ const struct ieee80211_channel *chan, u_int twiceGain);
+
+/*
+ * Return the test group for the specific channel based on
+ * the current regulatory setup.
+ */
+u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *);
+
+/*
+ * Map a public channel definition to the corresponding
+ * internal data structure. This implicitly specifies
+ * whether or not the specified channel is ok to use
+ * based on the current regulatory domain constraints.
+ */
+#ifndef AH_DEBUG
+static OS_INLINE HAL_CHANNEL_INTERNAL *
+ath_hal_checkchannel(struct ath_hal *ah, const struct ieee80211_channel *c)
+{
+ HAL_CHANNEL_INTERNAL *cc;
+
+ HALASSERT(c->ic_devdata < AH_PRIVATE(ah)->ah_nchan);
+ cc = &AH_PRIVATE(ah)->ah_channels[c->ic_devdata];
+ HALASSERT(c->ic_freq == cc->channel);
+ return cc;
+}
+#else
+/* NB: non-inline version that checks state */
+HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *,
+ const struct ieee80211_channel *);
+#endif /* AH_DEBUG */
+
/*
* Convert between microseconds and core system clocks.
*/
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c Fri Jan 23 18:58:43 2009 (r187641)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c Fri Jan 23 19:20:31 2009 (r187642)
@@ -2272,31 +2272,34 @@ ath_hal_set_channels(struct ath_hal *ah,
return status;
}
+#ifdef AH_DEBUG
/*
* Return the internal channel corresponding to a public channel.
+ * NB: normally this routine is inline'd (see ah_internal.h)
*/
HAL_CHANNEL_INTERNAL *
ath_hal_checkchannel(struct ath_hal *ah, const struct ieee80211_channel *c)
{
- /* XXX should not happen */
- if (c->ic_devdata < AH_PRIVATE(ah)->ah_nchan) {
- HAL_CHANNEL_INTERNAL *cc =
- &AH_PRIVATE(ah)->ah_channels[c->ic_devdata];
- if (c->ic_freq == cc->channel)
- return cc;
- }
+ HAL_CHANNEL_INTERNAL *cc = &AH_PRIVATE(ah)->ah_channels[c->ic_devdata];
+
+ if (c->ic_devdata < AH_PRIVATE(ah)->ah_nchan &&
+ c->ic_freq == cc->channel)
+ return cc;
if (c->ic_devdata >= AH_PRIVATE(ah)->ah_nchan) {
HALDEBUG(ah, HAL_DEBUG_ANY,
"%s: bad mapping, devdata %u nchans %u\n",
__func__, c->ic_devdata, AH_PRIVATE(ah)->ah_nchan);
+ HALASSERT(c->ic_devdata < AH_PRIVATE(ah)->ah_nchan);
} else {
HALDEBUG(ah, HAL_DEBUG_ANY,
"%s: no match for %u/0x%x devdata %u channel %u\n",
__func__, c->ic_freq, c->ic_flags, c->ic_devdata,
AH_PRIVATE(ah)->ah_channels[c->ic_devdata].channel);
+ HALASSERT(c->ic_freq == cc->channel);
}
return AH_NULL;
}
+#endif /* AH_DEBUG */
#define isWwrSKU(_ah) \
((getEepromRD((_ah)) & WORLD_SKU_MASK) == WORLD_SKU_PREFIX || \
More information about the svn-src-user
mailing list