Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Oct 2008 19:03:45 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 151677 for review
Message-ID:  <200810211903.m9LJ3jHZ051126@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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';



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810211903.m9LJ3jHZ051126>