From owner-svn-src-user@FreeBSD.ORG Wed Jan 14 19:43:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA18110656DA; Wed, 14 Jan 2009 19:43:30 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB1168FC2D; Wed, 14 Jan 2009 19:43:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0EJhT50052036; Wed, 14 Jan 2009 19:43:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0EJhTR0052033; Wed, 14 Jan 2009 19:43:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901141943.n0EJhTR0052033@svn.freebsd.org> From: Sam Leffler Date: Wed, 14 Jan 2009 19:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187233 - in user/sam/wifi/sys/dev/ath: . ath_hal X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2009 19:43:32 -0000 Author: sam Date: Wed Jan 14 19:43:28 2009 New Revision: 187233 URL: http://svn.freebsd.org/changeset/base/187233 Log: Remove code to map frequency to IEEE channel numbers as it was used solely to setup state for net80211 according to SKU but with net80211 having proper channel attributes this is no longer needed; the driver can just check SKU info and set the needed flags so net80211's routine can do the right thing. Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah.c user/sam/wifi/sys/dev/ath/ath_hal/ah.h user/sam/wifi/sys/dev/ath/if_ath.c Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah.c ============================================================================== --- user/sam/wifi/sys/dev/ath/ath_hal/ah.c Wed Jan 14 19:22:06 2009 (r187232) +++ user/sam/wifi/sys/dev/ath/ath_hal/ah.c Wed Jan 14 19:43:28 2009 (r187233) @@ -252,71 +252,6 @@ ath_hal_computetxtime(struct ath_hal *ah return txTime; } -static __inline int -mapgsm(u_int freq, u_int flags) -{ - freq *= 10; - if (flags & CHANNEL_QUARTER) - freq += 5; - else if (flags & CHANNEL_HALF) - freq += 10; - else - freq += 20; - return (freq - 24220) / 5; -} - -static __inline int -mappsb(u_int freq, u_int flags) -{ - return ((freq * 10) + (((freq % 5) == 2) ? 5 : 0) - 49400) / 5; -} - -/* - * Convert GHz frequency to IEEE channel number. - */ -int -ath_hal_mhz2ieee(struct ath_hal *ah, u_int freq, u_int flags) -{ - if (flags & CHANNEL_2GHZ) { /* 2GHz band */ - if (freq == 2484) - return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); - return ((int)freq - 2407) / 5; - } else - return 15 + ((freq - 2512) / 20); - } else if (flags & CHANNEL_5GHZ) {/* 5Ghz band */ - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { - return mappsb(freq, flags); - } else if ((flags & CHANNEL_A) && (freq <= 5000)) { - return (freq - 4000) / 5; - } else { - return (freq - 5000) / 5; - } - } else { /* either, guess */ - if (freq == 2484) - return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); - return ((int)freq - 2407) / 5; - } - if (freq < 5000) { - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { - return mappsb(freq, flags); - } else if (freq > 4900) { - return (freq - 4000) / 5; - } else { - return 15 + ((freq - 2512) / 20); - } - } - return (freq - 5000) / 5; - } -} - typedef enum { WIRELESS_MODE_11a = 0, WIRELESS_MODE_TURBO = 1, Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah.h ============================================================================== --- user/sam/wifi/sys/dev/ath/ath_hal/ah.h Wed Jan 14 19:22:06 2009 (r187232) +++ user/sam/wifi/sys/dev/ath/ath_hal/ah.h Wed Jan 14 19:43:28 2009 (r187233) @@ -891,10 +891,4 @@ extern HAL_BOOL __ahdecl ath_hal_ispubli * Return if device is operating in 900 MHz band. */ extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *); - -/* - * Convert between IEEE channel number and channel frequency - * using the specified channel flags; e.g. CHANNEL_2GHZ. - */ -extern int __ahdecl ath_hal_mhz2ieee(struct ath_hal *, u_int mhz, u_int flags); #endif /* _ATH_AH_H_ */ Modified: user/sam/wifi/sys/dev/ath/if_ath.c ============================================================================== --- user/sam/wifi/sys/dev/ath/if_ath.c Wed Jan 14 19:22:06 2009 (r187232) +++ user/sam/wifi/sys/dev/ath/if_ath.c Wed Jan 14 19:43:28 2009 (r187233) @@ -5729,12 +5729,10 @@ ath_chan_set(struct ath_softc *sc, struc 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", + "%s: %u (%u MHz, hal flags 0x%x) -> (%u MHz, hal flags 0x%x)\n", __func__, - ath_hal_mhz2ieee(ah, sc->sc_curchan.channel, - sc->sc_curchan.channelFlags), + ieee80211_mhz2ieee(chan->ic_freq, chan->ic_flags), sc->sc_curchan.channel, sc->sc_curchan.channelFlags, - ath_hal_mhz2ieee(ah, hchan.channel, hchan.channelFlags), hchan.channel, hchan.channelFlags); if (hchan.channel != sc->sc_curchan.channel || hchan.channelFlags != sc->sc_curchan.channelFlags) { @@ -6221,18 +6219,10 @@ getchannels(struct ath_softc *sc, int *n * Convert HAL channels to ieee80211 ones. */ for (i = 0; i < nhalchans; i++) { - HAL_CHANNEL *c = &halchans[i]; + const HAL_CHANNEL *c = &halchans[i]; struct ieee80211_channel *ichan = &chans[i]; - ichan->ic_ieee = ath_hal_mhz2ieee(ah, c->channel, - c->channelFlags); - if (bootverbose) - device_printf(sc->sc_dev, "hal channel %u/%x -> %u " - "maxpow %d minpow %d maxreg %d\n", - c->channel, c->channelFlags, ichan->ic_ieee, - c->maxTxPower, c->minTxPower, c->maxRegTxPower); ichan->ic_freq = c->channel; - if ((c->channelFlags & CHANNEL_PUREG) == CHANNEL_PUREG) { /* * Except for AR5211, HAL's PUREG means mixed @@ -6257,9 +6247,16 @@ getchannels(struct ath_softc *sc, int *n else ichan->ic_freq = 3344 - ichan->ic_freq; ichan->ic_flags |= IEEE80211_CHAN_GSM; - ichan->ic_ieee = ieee80211_mhz2ieee(ichan->ic_freq, - ichan->ic_flags); } + + ichan->ic_ieee = ieee80211_mhz2ieee(ichan->ic_freq, + ichan->ic_flags); + if (bootverbose) + device_printf(sc->sc_dev, "hal channel %u/%x -> %u " + "maxpow %d minpow %d maxreg %d\n", + c->channel, c->channelFlags, ichan->ic_ieee, + c->maxTxPower, c->minTxPower, c->maxRegTxPower); + ichan->ic_maxregpower = c->maxRegTxPower; /* dBm */ /* XXX: old hal's don't provide maxTxPower for some parts */ ichan->ic_maxpower = (c->maxTxPower != 0) ?