From owner-p4-projects@FreeBSD.ORG Sun Oct 19 06:16:25 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DEA4410656A2; Sun, 19 Oct 2008 06:16:24 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2713106569E for ; Sun, 19 Oct 2008 06:16:24 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9101A8FC0C for ; Sun, 19 Oct 2008 06:16:24 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J6GOxI037409 for ; Sun, 19 Oct 2008 06:16:24 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9J6GO02037407 for perforce@freebsd.org; Sun, 19 Oct 2008 06:16:24 GMT (envelope-from sam@freebsd.org) Date: Sun, 19 Oct 2008 06:16:24 GMT Message-Id: <200810190616.m9J6GO02037407@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 151542 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2008 06:16:25 -0000 http://perforce.freebsd.org/chv.cgi?CH=151542 Change 151542 by sam@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);