PERFORCE change 151542 for review
Sam Leffler
sam at FreeBSD.org
Sun Oct 19 06:16:25 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=151542
Change 151542 by sam at sam_ebb on 2008/10/19 06:16:08
add support for ubiquiti XR9 cards; they have a different
way of mapping between 900MHz and 2.4GHz frequencies than
SR9 cards, we use hack country codes to identify them (note
this requires a new hal)
Affected files ...
.. //depot/projects/vap/sys/dev/ath/if_ath.c#108 edit
Differences ...
==== //depot/projects/vap/sys/dev/ath/if_ath.c#108 (text+ko) ====
@@ -119,6 +119,8 @@
(HAL_MODE_11NG_HT40PLUS | HAL_MODE_11NG_HT40MINUS | \
HAL_MODE_11NA_HT40PLUS | HAL_MODE_11NA_HT40MINUS)
+#define CTRY_XR9 5001 /* Ubiquiti XR9 */
+
static struct ieee80211vap *ath_vap_create(struct ieee80211com *,
const char name[IFNAMSIZ], int unit, int opmode,
int flags, const uint8_t bssid[IEEE80211_ADDR_LEN],
@@ -1324,7 +1326,8 @@
* the frequency possibly mapped for GSM channels.
*/
static void
-ath_mapchan(HAL_CHANNEL *hc, const struct ieee80211_channel *chan)
+ath_mapchan(const struct ieee80211com *ic,
+ HAL_CHANNEL *hc, const struct ieee80211_channel *chan)
{
#define N(a) (sizeof(a) / sizeof(a[0]))
static const u_int modeflags[IEEE80211_MODE_MAX] = {
@@ -1355,8 +1358,13 @@
if (IEEE80211_IS_CHAN_HT40U(chan))
hc->channelFlags |= CHANNEL_HT40PLUS;
- hc->channel = IEEE80211_IS_CHAN_GSM(chan) ?
- 2422 + (922 - chan->ic_freq) : chan->ic_freq;
+ if (IEEE80211_IS_CHAN_GSM(chan)) {
+ if (ic->ic_regdomain.country == CTRY_XR9)
+ hc->channel = 2427 + (chan->ic_freq - 907);
+ else
+ hc->channel = 2422 + (922 - chan->ic_freq);
+ } else
+ hc->channel = chan->ic_freq;
#undef N
}
@@ -1409,7 +1417,7 @@
* be followed by initialization of the appropriate bits
* and then setup of the interrupt mask.
*/
- ath_mapchan(&sc->sc_curchan, ic->ic_curchan);
+ ath_mapchan(ic, &sc->sc_curchan, ic->ic_curchan);
ath_settkipmic(sc);
if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
if_printf(ifp, "unable to reset hardware; hal status %u\n",
@@ -1546,7 +1554,7 @@
* Convert to a HAL channel description with the flags
* constrained to reflect the current operating mode.
*/
- ath_mapchan(&sc->sc_curchan, ic->ic_curchan);
+ ath_mapchan(ic, &sc->sc_curchan, ic->ic_curchan);
ath_hal_intrset(ah, 0); /* disable interrupts */
ath_draintxq(sc); /* stop xmit side */
@@ -3731,7 +3739,7 @@
*rssi = ic->ic_node_getrssi(ni);
if (ni->ni_chan != IEEE80211_CHAN_ANYC) {
- ath_mapchan(&hchan, ni->ni_chan);
+ ath_mapchan(ic, &hchan, ni->ni_chan);
*noise = ath_hal_getchannoise(ah, &hchan);
} else
*noise = -95; /* nominally correct */
@@ -5449,7 +5457,7 @@
* the flags constrained to reflect the current
* operating mode.
*/
- ath_mapchan(&hchan, chan);
+ ath_mapchan(ic, &hchan, chan);
DPRINTF(sc, ATH_DEBUG_RESET,
"%s: %u (%u MHz, hal flags 0x%x) -> %u (%u MHz, hal flags 0x%x)\n",
@@ -5925,8 +5933,15 @@
}
if (ath_hal_isgsmsku(ah)) {
- /* remap to true frequencies */
- ichan->ic_freq = 922 + (2422 - ichan->ic_freq);
+ /*
+ * Remap to true frequencies: Ubiquiti XR9 cards use a
+ * frequency mapping different from their SR9 cards.
+ * We define special country codes to deal with this.
+ */
+ if (cc == CTRY_XR9)
+ ichan->ic_freq = 907 + (ichan->ic_freq - 2427);
+ else
+ ichan->ic_freq = 922 + (2422 - ichan->ic_freq);
ichan->ic_flags |= IEEE80211_CHAN_GSM;
ichan->ic_ieee = ieee80211_mhz2ieee(ichan->ic_freq,
ichan->ic_flags);
More information about the p4-projects
mailing list