From owner-p4-projects@FreeBSD.ORG Tue Oct 21 19:03:46 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 12CB31065675; Tue, 21 Oct 2008 19:03:46 +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 CAC3510656A3 for ; Tue, 21 Oct 2008 19:03:45 +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 B94AC8FC13 for ; Tue, 21 Oct 2008 19:03:45 +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 m9LJ3jsO051128 for ; Tue, 21 Oct 2008 19:03:45 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9LJ3jHZ051126 for perforce@freebsd.org; Tue, 21 Oct 2008 19:03:45 GMT (envelope-from sam@freebsd.org) Date: Tue, 21 Oct 2008 19:03:45 GMT Message-Id: <200810211903.m9LJ3jHZ051126@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 151677 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: Tue, 21 Oct 2008 19:03:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=151677 Change 151677 by sam@sam_ebb on 2008/10/21 19:03:13 o add limited mapping between Atheros SKU's and net80211 SKU's so we can access the complete channel list for debugging o correct indoor/outdoor handling o add debug msg for when regdomain setup fails; may want to make this a debug msg before commit Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#112 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#112 (text+ko) ==== @@ -5900,6 +5900,10 @@ error = 0; if (!ath_hal_init_channels(ah, halchans, IEEE80211_CHAN_MAX, &nhalchans, NULL, 0, NULL, cc, HAL_MODE_ALL, outdoor, ecm)) { + u_int32_t rd; + (void) ath_hal_getregdomain(ah, &rd); + device_printf(sc->sc_dev, "ath_hal_init_channels failed, " + "rd %d cc %u outdoor %u ecm %u\n", rd, cc, outdoor, ecm); error = EINVAL; goto done; } @@ -5959,6 +5963,19 @@ return error; } +/* XXX hard to include ieee80211_regdomain.h right now */ +#define SKU_DEBUG 0x1ff + +static int +ath_maprd2sku(u_int32_t rd, u_int32_t cc) +{ + /* map SKU's to Atheros sku's */ + switch (rd) { + case SKU_DEBUG: return 0; + } + return rd; +} + static int ath_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain *rd, int nchans, struct ieee80211_channel chans[]) @@ -5969,11 +5986,10 @@ int error; (void) ath_hal_getregdomain(ah, &ord); - /* XXX map sku->rd */ - ath_hal_setregdomain(ah, rd->regdomain); + ath_hal_setregdomain(ah, ath_maprd2sku(rd->regdomain, rd->country)); error = getchannels(sc, &nchans, chans, rd->country, rd->ecm ? AH_TRUE : AH_FALSE, - rd->location == 'O' ? AH_TRUE : AH_FALSE); + rd->location != 'I' ? AH_TRUE : AH_FALSE); if (error != 0) { /* * Restore previous state. @@ -6008,10 +6024,13 @@ } static int -ath_mapregdomain(struct ath_softc *sc, u_int32_t rd) +ath_mapsku2rd(u_int32_t sku, u_int32_t cc) { - /* map Atheros rd's to SKU's */ - return rd; + /* map Atheros sku's to SKU's */ + switch (sku) { + case 0: return SKU_DEBUG; + } + return sku; } static int @@ -6038,7 +6057,7 @@ } return error; } - ic->ic_regdomain.regdomain = ath_mapregdomain(sc, sc->sc_eerd); + ic->ic_regdomain.regdomain = ath_mapsku2rd(sc->sc_eerd, sc->sc_eecc); ic->ic_regdomain.country = sc->sc_eecc; ic->ic_regdomain.ecm = 1; ic->ic_regdomain.location = 'I';