svn commit: r189176 - in projects/jbuild/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5312 ath_hal/ar5416 ath_rate/amrr ath_rate/onoe ath_rate/sample

John Birrell jb at FreeBSD.org
Sat Feb 28 09:54:27 PST 2009


Author: jb
Date: Sat Feb 28 17:54:25 2009
New Revision: 189176
URL: http://svn.freebsd.org/changeset/base/189176

Log:
  MFC

Modified:
  projects/jbuild/sys/dev/ath/ath_hal/ah.c
  projects/jbuild/sys/dev/ath/ath_hal/ah.h
  projects/jbuild/sys/dev/ath/ath_hal/ah_internal.h
  projects/jbuild/sys/dev/ath/ath_hal/ah_regdomain.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5210/ar5210.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5211/ar5211.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar2316.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar2317.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar2413.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar2425.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5111.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5112.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_gpio.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_phy.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5212/ar5413.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5312/ar5312.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5312/ar5312_gpio.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5312/ar5315_gpio.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar2133.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416.ini
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar9160.ini
  projects/jbuild/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c
  projects/jbuild/sys/dev/ath/ath_rate/amrr/amrr.c
  projects/jbuild/sys/dev/ath/ath_rate/onoe/onoe.c
  projects/jbuild/sys/dev/ath/ath_rate/sample/sample.c
  projects/jbuild/sys/dev/ath/if_ath.c
  projects/jbuild/sys/dev/ath/if_ath_pci.c
  projects/jbuild/sys/dev/ath/if_athioctl.h
  projects/jbuild/sys/dev/ath/if_athvar.h

Modified: projects/jbuild/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- projects/jbuild/sys/dev/ath/ath_hal/ah.c	Sat Feb 28 17:53:55 2009	(r189175)
+++ projects/jbuild/sys/dev/ath/ath_hal/ah.c	Sat Feb 28 17:54:25 2009	(r189176)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
  * Copyright (c) 2002-2008 Atheros Communications, Inc.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -22,6 +22,8 @@
 #include "ah_internal.h"
 #include "ah_devid.h"
 
+#include "ar5416/ar5416reg.h"		/* NB: includes ar5212reg.h */
+
 /* linker set of registered chips */
 OS_SET_DECLARE(ah_chips, struct ath_hal_chip);
 
@@ -78,6 +80,53 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC
 	return AH_NULL;
 }
 
+const char *
+ath_hal_mac_name(struct ath_hal *ah)
+{
+	switch (ah->ah_macVersion) {
+	case AR_SREV_VERSION_CRETE:
+	case AR_SREV_VERSION_MAUI_1:
+		return "5210";
+	case AR_SREV_VERSION_MAUI_2:
+	case AR_SREV_VERSION_OAHU:
+		return "5211";
+	case AR_SREV_VERSION_VENICE:
+		return "5212";
+	case AR_SREV_VERSION_GRIFFIN:
+		return "2413";
+	case AR_SREV_VERSION_CONDOR:
+		return "5424";
+	case AR_SREV_VERSION_EAGLE:
+		return "5413";
+	case AR_SREV_VERSION_COBRA:
+		return "2415";
+	case AR_SREV_2425:
+		return "2425";
+	case AR_SREV_2417:
+		return "2417";
+	case AR_XSREV_VERSION_OWL_PCI:
+		return "5416";
+	case AR_XSREV_VERSION_OWL_PCIE:
+		return "5418";
+	case AR_XSREV_VERSION_SOWL:
+		return "9160";
+	case AR_XSREV_VERSION_MERLIN:
+		return "9280";
+	case AR_XSREV_VERSION_KITE:
+		return "9285";
+	}
+	return "????";
+}
+
+/*
+ * Return the mask of available modes based on the hardware capabilities.
+ */
+u_int
+ath_hal_getwirelessmodes(struct ath_hal*ah)
+{
+	return ath_hal_getWirelessModes(ah);
+}
+
 /* linker set of registered RF backends */
 OS_SET_DECLARE(ah_rfs, struct ath_hal_rf);
 
@@ -99,6 +148,48 @@ ath_hal_rfprobe(struct ath_hal *ah, HAL_
 	return AH_NULL;
 }
 
+const char *
+ath_hal_rf_name(struct ath_hal *ah)
+{
+	switch (ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) {
+	case 0:			/* 5210 */
+		return "5110";	/* NB: made up */
+	case AR_RAD5111_SREV_MAJOR:
+	case AR_RAD5111_SREV_PROD:
+		return "5111";
+	case AR_RAD2111_SREV_MAJOR:
+		return "2111";
+	case AR_RAD5112_SREV_MAJOR:
+	case AR_RAD5112_SREV_2_0:
+	case AR_RAD5112_SREV_2_1:
+		return "5112";
+	case AR_RAD2112_SREV_MAJOR:
+	case AR_RAD2112_SREV_2_0:
+	case AR_RAD2112_SREV_2_1:
+		return "2112";
+	case AR_RAD2413_SREV_MAJOR:
+		return "2413";
+	case AR_RAD5413_SREV_MAJOR:
+		return "5413";
+	case AR_RAD2316_SREV_MAJOR:
+		return "2316";
+	case AR_RAD2317_SREV_MAJOR:
+		return "2317";
+	case AR_RAD5424_SREV_MAJOR:
+		return "5424";
+
+	case AR_RAD5133_SREV_MAJOR:
+		return "5133";
+	case AR_RAD2133_SREV_MAJOR:
+		return "2133";
+	case AR_RAD5122_SREV_MAJOR:
+		return "5122";
+	case AR_RAD2122_SREV_MAJOR:
+		return "2122";
+	}
+	return "????";
+}
+
 /*
  * Poll the register looking for a specific value.
  */
@@ -152,14 +243,12 @@ ath_hal_computetxtime(struct ath_hal *ah
 	kbps = rates->info[rateix].rateKbps;
 	/*
 	 * index can be invalid duting dynamic Turbo transitions. 
+	 * XXX
 	 */
-	if(kbps == 0) return 0;
+	if (kbps == 0)
+		return 0;
 	switch (rates->info[rateix].phy) {
-
 	case IEEE80211_T_CCK:
-#define CCK_SIFS_TIME        10
-#define CCK_PREAMBLE_BITS   144
-#define CCK_PLCP_BITS        48
 		phyTime		= CCK_PREAMBLE_BITS + CCK_PLCP_BITS;
 		if (shortPreamble && rates->info[rateix].shortPreamble)
 			phyTime >>= 1;
@@ -167,81 +256,47 @@ ath_hal_computetxtime(struct ath_hal *ah
 		txTime		= CCK_SIFS_TIME + phyTime
 				+ ((numBits * 1000)/kbps);
 		break;
-#undef CCK_SIFS_TIME
-#undef CCK_PREAMBLE_BITS
-#undef CCK_PLCP_BITS
-
 	case IEEE80211_T_OFDM:
-#define OFDM_SIFS_TIME        16
-#define OFDM_PREAMBLE_TIME    20
-#define OFDM_PLCP_BITS        22
-#define OFDM_SYMBOL_TIME       4
-
-#define OFDM_SIFS_TIME_HALF	32
-#define OFDM_PREAMBLE_TIME_HALF	40
-#define OFDM_PLCP_BITS_HALF	22
-#define OFDM_SYMBOL_TIME_HALF	8
-
-#define OFDM_SIFS_TIME_QUARTER 		64
-#define OFDM_PREAMBLE_TIME_QUARTER	80
-#define OFDM_PLCP_BITS_QUARTER		22
-#define OFDM_SYMBOL_TIME_QUARTER	16
-
-		if (AH_PRIVATE(ah)->ah_curchan && 
-			IS_CHAN_QUARTER_RATE(AH_PRIVATE(ah)->ah_curchan)) {
-			bitsPerSymbol	= (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000;
-			HALASSERT(bitsPerSymbol != 0);
-
-			numBits		= OFDM_PLCP_BITS + (frameLen << 3);
-			numSymbols	= howmany(numBits, bitsPerSymbol);
-			txTime		= OFDM_SIFS_TIME_QUARTER 
-						+ OFDM_PREAMBLE_TIME_QUARTER
-					+ (numSymbols * OFDM_SYMBOL_TIME_QUARTER);
-		} else if (AH_PRIVATE(ah)->ah_curchan &&
-				IS_CHAN_HALF_RATE(AH_PRIVATE(ah)->ah_curchan)) {
-			bitsPerSymbol	= (kbps * OFDM_SYMBOL_TIME_HALF) / 1000;
-			HALASSERT(bitsPerSymbol != 0);
-
-			numBits		= OFDM_PLCP_BITS + (frameLen << 3);
-			numSymbols	= howmany(numBits, bitsPerSymbol);
-			txTime		= OFDM_SIFS_TIME_HALF + 
-						OFDM_PREAMBLE_TIME_HALF
-					+ (numSymbols * OFDM_SYMBOL_TIME_HALF);
-		} else { /* full rate channel */
-			bitsPerSymbol	= (kbps * OFDM_SYMBOL_TIME) / 1000;
-			HALASSERT(bitsPerSymbol != 0);
-
-			numBits		= OFDM_PLCP_BITS + (frameLen << 3);
-			numSymbols	= howmany(numBits, bitsPerSymbol);
-			txTime		= OFDM_SIFS_TIME + OFDM_PREAMBLE_TIME
-					+ (numSymbols * OFDM_SYMBOL_TIME);
-		}
+		bitsPerSymbol	= (kbps * OFDM_SYMBOL_TIME) / 1000;
+		HALASSERT(bitsPerSymbol != 0);
+
+		numBits		= OFDM_PLCP_BITS + (frameLen << 3);
+		numSymbols	= howmany(numBits, bitsPerSymbol);
+		txTime		= OFDM_SIFS_TIME
+				+ OFDM_PREAMBLE_TIME
+				+ (numSymbols * OFDM_SYMBOL_TIME);
 		break;
+	case IEEE80211_T_OFDM_HALF:
+		bitsPerSymbol	= (kbps * OFDM_HALF_SYMBOL_TIME) / 1000;
+		HALASSERT(bitsPerSymbol != 0);
 
-#undef OFDM_SIFS_TIME
-#undef OFDM_PREAMBLE_TIME
-#undef OFDM_PLCP_BITS
-#undef OFDM_SYMBOL_TIME
+		numBits		= OFDM_HALF_PLCP_BITS + (frameLen << 3);
+		numSymbols	= howmany(numBits, bitsPerSymbol);
+		txTime		= OFDM_HALF_SIFS_TIME
+				+ OFDM_HALF_PREAMBLE_TIME
+				+ (numSymbols * OFDM_HALF_SYMBOL_TIME);
+		break;
+	case IEEE80211_T_OFDM_QUARTER:
+		bitsPerSymbol	= (kbps * OFDM_QUARTER_SYMBOL_TIME) / 1000;
+		HALASSERT(bitsPerSymbol != 0);
 
+		numBits		= OFDM_QUARTER_PLCP_BITS + (frameLen << 3);
+		numSymbols	= howmany(numBits, bitsPerSymbol);
+		txTime		= OFDM_QUARTER_SIFS_TIME
+				+ OFDM_QUARTER_PREAMBLE_TIME
+				+ (numSymbols * OFDM_QUARTER_SYMBOL_TIME);
+		break;
 	case IEEE80211_T_TURBO:
-#define TURBO_SIFS_TIME         8
-#define TURBO_PREAMBLE_TIME    14
-#define TURBO_PLCP_BITS        22
-#define TURBO_SYMBOL_TIME       4
 		/* we still save OFDM rates in kbps - so double them */
 		bitsPerSymbol = ((kbps << 1) * TURBO_SYMBOL_TIME) / 1000;
 		HALASSERT(bitsPerSymbol != 0);
 
-		numBits       = TURBO_PLCP_BITS + (frameLen << 3);
-		numSymbols    = howmany(numBits, bitsPerSymbol);
-		txTime        = TURBO_SIFS_TIME + TURBO_PREAMBLE_TIME
-			      + (numSymbols * TURBO_SYMBOL_TIME);
+		numBits		= TURBO_PLCP_BITS + (frameLen << 3);
+		numSymbols	= howmany(numBits, bitsPerSymbol);
+		txTime		= TURBO_SIFS_TIME
+				+ TURBO_PREAMBLE_TIME
+				+ (numSymbols * TURBO_SYMBOL_TIME);
 		break;
-#undef TURBO_SIFS_TIME
-#undef TURBO_PREAMBLE_TIME
-#undef TURBO_PLCP_BITS
-#undef TURBO_SYMBOL_TIME
-
 	default:
 		HALDEBUG(ah, HAL_DEBUG_PHYIO,
 		    "%s: unknown phy %u (rate ix %u)\n",
@@ -252,71 +307,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,
@@ -328,15 +318,15 @@ typedef enum {
 } WIRELESS_MODE;
 
 static WIRELESS_MODE
-ath_hal_chan2wmode(struct ath_hal *ah, const HAL_CHANNEL *chan)
+ath_hal_chan2wmode(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
-	if (IS_CHAN_CCK(chan))
+	if (IEEE80211_IS_CHAN_B(chan))
 		return WIRELESS_MODE_11b;
-	if (IS_CHAN_G(chan))
+	if (IEEE80211_IS_CHAN_G(chan))
 		return WIRELESS_MODE_11g;
-	if (IS_CHAN_108G(chan))
+	if (IEEE80211_IS_CHAN_108G(chan))
 		return WIRELESS_MODE_108g;
-	if (IS_CHAN_TURBO(chan))
+	if (IEEE80211_IS_CHAN_TURBO(chan))
 		return WIRELESS_MODE_TURBO;
 	return WIRELESS_MODE_11a;
 }
@@ -350,18 +340,14 @@ static const uint8_t CLOCK_RATE[]  = { 4
 u_int
 ath_hal_mac_clks(struct ath_hal *ah, u_int usecs)
 {
-	const HAL_CHANNEL *c = (const HAL_CHANNEL *) AH_PRIVATE(ah)->ah_curchan;
+	const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan;
 	u_int clks;
 
 	/* NB: ah_curchan may be null when called attach time */
 	if (c != AH_NULL) {
 		clks = usecs * CLOCK_RATE[ath_hal_chan2wmode(ah, c)];
-		if (IS_CHAN_HT40(c))
+		if (IEEE80211_IS_CHAN_HT40(c))
 			clks <<= 1;
-		else if (IS_CHAN_HALF_RATE(c))
-			clks >>= 1;
-		else if (IS_CHAN_QUARTER_RATE(c))
-			clks >>= 2;
 	} else
 		clks = usecs * CLOCK_RATE[WIRELESS_MODE_11b];
 	return clks;
@@ -370,18 +356,14 @@ ath_hal_mac_clks(struct ath_hal *ah, u_i
 u_int
 ath_hal_mac_usec(struct ath_hal *ah, u_int clks)
 {
-	const HAL_CHANNEL *c = (const HAL_CHANNEL *) AH_PRIVATE(ah)->ah_curchan;
+	const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan;
 	u_int usec;
 
 	/* NB: ah_curchan may be null when called attach time */
 	if (c != AH_NULL) {
 		usec = clks / CLOCK_RATE[ath_hal_chan2wmode(ah, c)];
-		if (IS_CHAN_HT40(c))
+		if (IEEE80211_IS_CHAN_HT40(c))
 			usec >>= 1;
-		else if (IS_CHAN_HALF_RATE(c))
-			usec <<= 1;
-		else if (IS_CHAN_QUARTER_RATE(c))
-			usec <<= 2;
 	} else
 		usec = clks / CLOCK_RATE[WIRELESS_MODE_11b];
 	return usec;
@@ -505,11 +487,7 @@ ath_hal_getcapability(struct ath_hal *ah
 		}
 		return HAL_ENOTSUPP;
 	case HAL_CAP_11D:
-#ifdef AH_SUPPORT_11D
 		return HAL_OK;
-#else
-		return HAL_ENOTSUPP;
-#endif
 	case HAL_CAP_RXORN_FATAL:	/* HAL_INT_RXORN treated as fatal  */
 		return AH_PRIVATE(ah)->ah_rxornIsFatal ? HAL_OK : HAL_ENOTSUPP;
 	case HAL_CAP_HT:
@@ -597,6 +575,15 @@ ath_hal_getregdump(struct ath_hal *ah, c
 	}
 	return (char *) dp - (char *) dstbuf;
 }
+ 
+static void
+ath_hal_setregs(struct ath_hal *ah, const HAL_REGWRITE *regs, int space)
+{
+	while (space >= sizeof(HAL_REGWRITE)) {
+		OS_REG_WRITE(ah, regs->addr, regs->value);
+		regs++, space -= sizeof(HAL_REGWRITE);
+	}
+}
 
 HAL_BOOL
 ath_hal_getdiagstate(struct ath_hal *ah, int request,
@@ -611,6 +598,10 @@ ath_hal_getdiagstate(struct ath_hal *ah,
 	case HAL_DIAG_REGS:
 		*resultsize = ath_hal_getregdump(ah, args, *result,*resultsize);
 		return AH_TRUE;
+	case HAL_DIAG_SETREGS:
+		ath_hal_setregs(ah, args, argsize);
+		*resultsize = 0;
+		return AH_TRUE;
 	case HAL_DIAG_FATALERR:
 		*result = &AH_PRIVATE(ah)->ah_fatalState[0];
 		*resultsize = sizeof(AH_PRIVATE(ah)->ah_fatalState);
@@ -764,7 +755,7 @@ static const int16_t NOISE_FLOOR[] = { -
  *     implement the ah_getChanNoise method.
  */
 int16_t
-ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan)
+ath_hal_getChanNoise(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
 	HAL_CHANNEL_INTERNAL *ichan;
 
@@ -772,7 +763,7 @@ ath_hal_getChanNoise(struct ath_hal *ah,
 	if (ichan == AH_NULL) {
 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
 		    "%s: invalid channel %u/0x%x; no mapping\n",
-		    __func__, chan->channel, chan->channelFlags);
+		    __func__, chan->ic_freq, chan->ic_flags);
 		return 0;
 	}
 	if (ichan->rawNoiseFloor == 0) {
@@ -811,8 +802,8 @@ ath_hal_process_noisefloor(struct ath_ha
 		c = &AH_PRIVATE(ah)->ah_channels[i];
 		if (c->rawNoiseFloor >= 0)
 			continue;
-		mode = ath_hal_chan2wmode(ah, (HAL_CHANNEL *) c);
-		HALASSERT(mode < WIRELESS_MODE_MAX);
+		/* XXX can't identify proper mode */
+		mode = IS_CHAN_5GHZ(c) ? WIRELESS_MODE_11a : WIRELESS_MODE_11g;
 		nf = c->rawNoiseFloor + NOISE_FLOOR[mode] +
 			ath_hal_getNfAdjust(ah, c);
 		if (IS_CHAN_5GHZ(c)) {
@@ -838,9 +829,8 @@ ath_hal_process_noisefloor(struct ath_ha
 		/* Apply correction factor */
 		c->noiseFloorAdjust = ath_hal_getNfAdjust(ah, c) +
 			(IS_CHAN_5GHZ(c) ? correct5 : correct2);
-		HALDEBUG(ah, HAL_DEBUG_NFCAL, "%u/0x%x raw nf %d adjust %d\n",
-		    c->channel, c->channelFlags, c->rawNoiseFloor,
-		    c->noiseFloorAdjust);
+		HALDEBUG(ah, HAL_DEBUG_NFCAL, "%u raw nf %d adjust %d\n",
+		    c->channel, c->rawNoiseFloor, c->noiseFloorAdjust);
 	}
 }
 

Modified: projects/jbuild/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- projects/jbuild/sys/dev/ath/ath_hal/ah.h	Sat Feb 28 17:53:55 2009	(r189175)
+++ projects/jbuild/sys/dev/ath/ath_hal/ah.h	Sat Feb 28 17:54:25 2009	(r189176)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
  * Copyright (c) 2002-2008 Atheros Communications, Inc.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ah.h,v 1.15 2008/11/15 03:43:50 sam Exp $
+ * $FreeBSD$
  */
 
 #ifndef _ATH_AH_H_
@@ -63,6 +63,8 @@ typedef enum {
 	HAL_ENOTSUPP	= 13,	/* Hardware revision not supported */
 	HAL_ESELFTEST	= 14,	/* Hardware self-test failed */
 	HAL_EINPROGRESS	= 15,	/* Operation incomplete */
+	HAL_EEBADREG	= 16,	/* EEPROM invalid regulatory contents */
+	HAL_EEBADCC	= 17,	/* EEPROM invalid country code */
 } HAL_STATUS;
 
 typedef enum {
@@ -357,69 +359,29 @@ typedef enum {
 } HAL_INT;
 
 typedef enum {
+	HAL_GPIO_MUX_OUTPUT		= 0,
+	HAL_GPIO_MUX_PCIE_ATTENTION_LED	= 1,
+	HAL_GPIO_MUX_PCIE_POWER_LED	= 2,
+	HAL_GPIO_MUX_TX_FRAME		= 3,
+	HAL_GPIO_MUX_RX_CLEAR_EXTERNAL	= 4,
+	HAL_GPIO_MUX_MAC_NETWORK_LED	= 5,
+	HAL_GPIO_MUX_MAC_POWER_LED	= 6
+} HAL_GPIO_MUX_TYPE;
+
+typedef enum {
+	HAL_GPIO_INTR_LOW		= 0,
+	HAL_GPIO_INTR_HIGH		= 1,
+	HAL_GPIO_INTR_DISABLE		= 2
+} HAL_GPIO_INTR_TYPE;
+
+typedef enum {
 	HAL_RFGAIN_INACTIVE		= 0,
 	HAL_RFGAIN_READ_REQUESTED	= 1,
 	HAL_RFGAIN_NEED_CHANGE		= 2
 } HAL_RFGAIN;
 
-/*
- * Channels are specified by frequency.
- */
-typedef struct {
-	uint32_t	channelFlags;	/* see below */
-	uint16_t	channel;	/* setting in Mhz */
-	uint8_t		privFlags;
-	int8_t		maxRegTxPower;	/* max regulatory tx power in dBm */
-	int8_t		maxTxPower;	/* max true tx power in 0.5 dBm */
-	int8_t		minTxPower;	/* min true tx power in 0.5 dBm */
-} HAL_CHANNEL;
-
-/* channelFlags */
-#define	CHANNEL_CW_INT	0x00002	/* CW interference detected on channel */
-#define	CHANNEL_TURBO	0x00010	/* Turbo Channel */
-#define	CHANNEL_CCK	0x00020	/* CCK channel */
-#define	CHANNEL_OFDM	0x00040	/* OFDM channel */
-#define	CHANNEL_2GHZ	0x00080	/* 2 GHz spectrum channel */
-#define	CHANNEL_5GHZ	0x00100	/* 5 GHz spectrum channel */
-#define	CHANNEL_PASSIVE	0x00200	/* Only passive scan allowed in the channel */
-#define	CHANNEL_DYN	0x00400	/* dynamic CCK-OFDM channel */
-#define	CHANNEL_STURBO	0x02000	/* Static turbo, no 11a-only usage */
-#define	CHANNEL_HALF    0x04000 /* Half rate channel */
-#define	CHANNEL_QUARTER 0x08000 /* Quarter rate channel */
-#define	CHANNEL_HT20	0x10000 /* 11n 20MHZ channel */ 
-#define	CHANNEL_HT40PLUS 0x20000 /* 11n 40MHZ channel w/ ext chan above */
-#define	CHANNEL_HT40MINUS 0x40000 /* 11n 40MHZ channel w/ ext chan below */
-
-/* privFlags */
-#define CHANNEL_INTERFERENCE   	0x01 /* Software use: channel interference 
-				        used for as AR as well as RADAR 
-				        interference detection */
-#define CHANNEL_DFS		0x02 /* DFS required on channel */
-#define CHANNEL_4MS_LIMIT	0x04 /* 4msec packet limit on this channel */
-#define CHANNEL_DFS_CLEAR	0x08 /* if channel has been checked for DFS */
-
-#define	CHANNEL_A	(CHANNEL_5GHZ|CHANNEL_OFDM)
-#define	CHANNEL_B	(CHANNEL_2GHZ|CHANNEL_CCK)
-#define	CHANNEL_PUREG	(CHANNEL_2GHZ|CHANNEL_OFDM)
-#ifdef notdef
-#define	CHANNEL_G	(CHANNEL_2GHZ|CHANNEL_DYN)
-#else
-#define	CHANNEL_G	(CHANNEL_2GHZ|CHANNEL_OFDM)
-#endif
-#define	CHANNEL_T	(CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
-#define CHANNEL_ST	(CHANNEL_T|CHANNEL_STURBO)
-#define	CHANNEL_108G	(CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
-#define	CHANNEL_108A	CHANNEL_T
-#define	CHANNEL_G_HT20		(CHANNEL_G|CHANNEL_HT20)
-#define	CHANNEL_A_HT20		(CHANNEL_A|CHANNEL_HT20)
-#define	CHANNEL_G_HT40PLUS	(CHANNEL_G|CHANNEL_HT40PLUS)
-#define	CHANNEL_G_HT40MINUS	(CHANNEL_G|CHANNEL_HT40MINUS)
-#define	CHANNEL_A_HT40PLUS	(CHANNEL_A|CHANNEL_HT40PLUS)
-#define	CHANNEL_A_HT40MINUS	(CHANNEL_A|CHANNEL_HT40MINUS)
-#define	CHANNEL_ALL \
-	(CHANNEL_OFDM | CHANNEL_CCK| CHANNEL_2GHZ | CHANNEL_5GHZ | \
-	 CHANNEL_TURBO | CHANNEL_HT20 | CHANNEL_HT40PLUS | CHANNEL_HT40MINUS)
-#define	CHANNEL_ALL_NOTURBO 	(CHANNEL_ALL &~ CHANNEL_TURBO)
+typedef uint16_t HAL_CTRY_CODE;		/* country code */
+typedef uint16_t HAL_REG_DOMAIN;		/* regulatory domain code */
 
 #define HAL_ANTENNA_MIN_MODE  0
 #define HAL_ANTENNA_FIXED_A   1
@@ -434,14 +396,6 @@ typedef struct {
 	uint32_t	beacons;
 } HAL_MIB_STATS;
 
-typedef uint16_t HAL_CTRY_CODE;		/* country code */
-typedef uint16_t HAL_REG_DOMAIN;		/* regulatory domain code */
-
-enum {
-	CTRY_DEBUG	= 0x1ff,		/* debug country code */
-	CTRY_DEFAULT	= 0			/* default country code */
-};
-
 enum {
 	HAL_MODE_11A	= 0x001,		/* 11a channels */
 	HAL_MODE_TURBO	= 0x002,		/* 11a turbo-only channels */
@@ -471,8 +425,8 @@ typedef struct {
 	int		rateCount;		/* NB: for proper padding */
 	uint8_t		rateCodeToIndex[144];	/* back mapping */
 	struct {
-		uint8_t	valid;		/* valid for rate control use */
-		uint8_t	phy;		/* CCK/OFDM/XR */
+		uint8_t		valid;		/* valid for rate control use */
+		uint8_t		phy;		/* CCK/OFDM/XR */
 		uint32_t	rateKbps;	/* transfer rate in kbs */
 		uint8_t		rateCode;	/* rate for h/w descriptors */
 		uint8_t		shortPreamble;	/* mask for enabling short
@@ -630,6 +584,7 @@ typedef struct {
 struct ath_desc;
 struct ath_tx_status;
 struct ath_rx_status;
+struct ieee80211_channel;
 
 /*
  * Hardware Access Layer (HAL) API.
@@ -665,16 +620,20 @@ struct ath_hal {
 
 	/* Reset functions */
 	HAL_BOOL  __ahdecl(*ah_reset)(struct ath_hal *, HAL_OPMODE,
-				HAL_CHANNEL *, HAL_BOOL bChannelChange,
-				HAL_STATUS *status);
+				struct ieee80211_channel *,
+				HAL_BOOL bChannelChange, HAL_STATUS *status);
 	HAL_BOOL  __ahdecl(*ah_phyDisable)(struct ath_hal *);
 	HAL_BOOL  __ahdecl(*ah_disable)(struct ath_hal *);
+	void	  __ahdecl(*ah_configPCIE)(struct ath_hal *, HAL_BOOL restore);
+	void	  __ahdecl(*ah_disablePCIE)(struct ath_hal *);
 	void	  __ahdecl(*ah_setPCUConfig)(struct ath_hal *);
-	HAL_BOOL  __ahdecl(*ah_perCalibration)(struct ath_hal*, HAL_CHANNEL *,
-			HAL_BOOL *);
-	HAL_BOOL  __ahdecl(*ah_perCalibrationN)(struct ath_hal *, HAL_CHANNEL *,
-			u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone);
-	HAL_BOOL  __ahdecl(*ah_resetCalValid)(struct ath_hal *, HAL_CHANNEL *);
+	HAL_BOOL  __ahdecl(*ah_perCalibration)(struct ath_hal*,
+			struct ieee80211_channel *, HAL_BOOL *);
+	HAL_BOOL  __ahdecl(*ah_perCalibrationN)(struct ath_hal *,
+			struct ieee80211_channel *, u_int chainMask,
+			HAL_BOOL longCal, HAL_BOOL *isCalDone);
+	HAL_BOOL  __ahdecl(*ah_resetCalValid)(struct ath_hal *,
+			const struct ieee80211_channel *);
 	HAL_BOOL  __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
 
 	/* Transmit functions */
@@ -735,7 +694,8 @@ struct ath_hal {
 				struct ath_desc *next, uint64_t tsf,
 				struct ath_rx_status *);
 	void	  __ahdecl(*ah_rxMonitor)(struct ath_hal *,
-				const HAL_NODE_STATS *, HAL_CHANNEL *);
+				const HAL_NODE_STATS *,
+				const struct ieee80211_channel *);
 	void	  __ahdecl(*ah_procMibEvent)(struct ath_hal *,
 				const HAL_NODE_STATS *);
 
@@ -758,7 +718,8 @@ struct ath_hal {
 	void	  __ahdecl(*ah_setLedState)(struct ath_hal*, HAL_LED_STATE);
 	void	  __ahdecl(*ah_writeAssocid)(struct ath_hal*,
 				const uint8_t *bssid, uint16_t assocId);
-	HAL_BOOL  __ahdecl(*ah_gpioCfgOutput)(struct ath_hal *, uint32_t gpio);
+	HAL_BOOL  __ahdecl(*ah_gpioCfgOutput)(struct ath_hal *,
+				uint32_t gpio, HAL_GPIO_MUX_TYPE);
 	HAL_BOOL  __ahdecl(*ah_gpioCfgInput)(struct ath_hal *, uint32_t gpio);
 	uint32_t __ahdecl(*ah_gpioGet)(struct ath_hal *, uint32_t gpio);
 	HAL_BOOL  __ahdecl(*ah_gpioSet)(struct ath_hal *,
@@ -804,7 +765,8 @@ struct ath_hal {
 	HAL_BOOL  __ahdecl(*ah_setPowerMode)(struct ath_hal*,
 				HAL_POWER_MODE mode, int setChip);
 	HAL_POWER_MODE __ahdecl(*ah_getPowerMode)(struct ath_hal*);
-	int16_t   __ahdecl(*ah_getChanNoise)(struct ath_hal *, HAL_CHANNEL *);
+	int16_t   __ahdecl(*ah_getChanNoise)(struct ath_hal *,
+				const struct ieee80211_channel *);
 
 	/* Beacon Management Functions */
 	void	  __ahdecl(*ah_setBeaconTimers)(struct ath_hal*,
@@ -846,54 +808,68 @@ extern	const char *__ahdecl ath_hal_prob
 extern	struct ath_hal * __ahdecl ath_hal_attach(uint16_t devid, HAL_SOFTC,
 		HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS* status);
 
+extern	const char *ath_hal_mac_name(struct ath_hal *);
+extern	const char *ath_hal_rf_name(struct ath_hal *);
+
 /*
- * Return a list of channels available for use with the hardware.
- * The list is based on what the hardware is capable of, the specified
- * country code, the modeSelect mask, and whether or not outdoor
- * channels are to be permitted.
+ * Regulatory interfaces.  Drivers should use ath_hal_init_channels to
+ * request a set of channels for a particular country code and/or
+ * regulatory domain.  If CTRY_DEFAULT and SKU_NONE are specified then
+ * this list is constructed according to the contents of the EEPROM.
+ * ath_hal_getchannels acts similarly but does not alter the operating
+ * state; this can be used to collect information for a particular
+ * regulatory configuration.  Finally ath_hal_set_channels installs a
+ * channel list constructed outside the driver.  The HAL will adopt the
+ * channel list and setup internal state according to the specified
+ * regulatory configuration (e.g. conformance test limits).
  *
- * The channel list is returned in the supplied array.  maxchans
- * defines the maximum size of this array.  nchans contains the actual
- * number of channels returned.  If a problem occurred or there were
- * no channels that met the criteria then AH_FALSE is returned.
- */
-extern	HAL_BOOL __ahdecl ath_hal_init_channels(struct ath_hal *,
-		HAL_CHANNEL *chans, u_int maxchans, u_int *nchans,
-		uint8_t *regclassids, u_int maxregids, u_int *nregids,
-		HAL_CTRY_CODE cc, u_int modeSelect,
-		HAL_BOOL enableOutdoor, HAL_BOOL enableExtendedChannels);
+ * For all interfaces the channel list is returned in the supplied array.
+ * maxchans defines the maximum size of this array.  nchans contains the
+ * actual number of channels returned.  If a problem occurred then a
+ * status code != HAL_OK is returned.
+ */
+struct ieee80211_channel;
 
 /*
- * Calibrate noise floor data following a channel scan or similar.
- * This must be called prior retrieving noise floor data.
+ * Return a list of channels according to the specified regulatory.
  */
-extern	void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah);
+extern	HAL_STATUS __ahdecl ath_hal_getchannels(struct ath_hal *,
+    struct ieee80211_channel *chans, u_int maxchans, int *nchans,
+    u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn,
+    HAL_BOOL enableExtendedChannels);
 
 /*
- * Return bit mask of wireless modes supported by the hardware.
+ * Return a list of channels and install it as the current operating
+ * regulatory list.
  */
-extern	u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*, HAL_CTRY_CODE);
+extern	HAL_STATUS __ahdecl ath_hal_init_channels(struct ath_hal *,
+    struct ieee80211_channel *chans, u_int maxchans, int *nchans,
+    u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN rd,
+    HAL_BOOL enableExtendedChannels);
 
 /*
- * Calculate the transmit duration of a frame.
+ * Install the list of channels as the current operating regulatory
+ * and setup related state according to the country code and sku.
  */
-extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *,
-		const HAL_RATE_TABLE *rates, uint32_t frameLen,
-		uint16_t rateix, HAL_BOOL shortPreamble);
+extern	HAL_STATUS __ahdecl ath_hal_set_channels(struct ath_hal *,
+    struct ieee80211_channel *chans, int nchans,
+    HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn);
 
 /*
- * Return if device is public safety.
+ * Calibrate noise floor data following a channel scan or similar.
+ * This must be called prior retrieving noise floor data.
  */
-extern HAL_BOOL __ahdecl ath_hal_ispublicsafetysku(struct ath_hal *);
+extern	void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah);
 
 /*
- * Return if device is operating in 900 MHz band.
+ * Return bit mask of wireless modes supported by the hardware.
  */
-extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *);
+extern	u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*);
 
 /*
- * Convert between IEEE channel number and channel frequency
- * using the specified channel flags; e.g. CHANNEL_2GHZ.
+ * Calculate the transmit duration of a frame.
  */
-extern	int __ahdecl ath_hal_mhz2ieee(struct ath_hal *, u_int mhz, u_int flags);
+extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *,
+		const HAL_RATE_TABLE *rates, uint32_t frameLen,
+		uint16_t rateix, HAL_BOOL shortPreamble);
 #endif /* _ATH_AH_H_ */

Modified: projects/jbuild/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- projects/jbuild/sys/dev/ath/ath_hal/ah_internal.h	Sat Feb 28 17:53:55 2009	(r189175)
+++ projects/jbuild/sys/dev/ath/ath_hal/ah_internal.h	Sat Feb 28 17:54:25 2009	(r189176)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
  * Copyright (c) 2002-2008 Atheros Communications, Inc.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -27,6 +27,8 @@
 #define	AH_MIN(a,b)	((a)<(b)?(a):(b))
 #define	AH_MAX(a,b)	((a)>(b)?(a):(b))
 
+#include <net80211/_ieee80211.h>
+
 #ifndef NBBY
 #define	NBBY	8			/* number of bits/byte */
 #endif
@@ -47,6 +49,11 @@ typedef struct {
 	uint16_t	end;		/* ending register or zero */
 } HAL_REGRANGE;
 
+typedef struct {
+	uint32_t	addr;		/* regiser address/offset */
+	uint32_t	value;		/* value to write */
+} HAL_REGWRITE;
+
 /*
  * Transmit power scale factor.
  *
@@ -77,12 +84,12 @@ struct ath_hal_chip {
 };
 #ifndef AH_CHIP
 #define	AH_CHIP(_name, _probe, _attach)				\
-static struct ath_hal_chip name##_chip = {			\
+static struct ath_hal_chip _name##_chip = {			\
 	.name		= #_name,				\
 	.probe		= _probe,				\
 	.attach		= _attach				\
 };								\
-OS_DATA_SET(ah_chips, name##_chip)
+OS_DATA_SET(ah_chips, _name##_chip)
 #endif
 
 /*
@@ -108,32 +115,44 @@ OS_DATA_SET(ah_rfs, _name##_rf)
 struct ath_hal_rf *ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode);
 
 /*
- * Internal form of a HAL_CHANNEL.  Note that the structure
- * must be defined such that you can cast references to a
- * HAL_CHANNEL so don't shuffle the first two members.
+ * Maximum number of internal channels.  Entries are per unique
+ * frequency so this might be need to be increased to handle all
+ * usage cases; typically no more than 32 are really needed but
+ * dynamically allocating the data structures is a bit painful
+ * right now.
+ */
+#ifndef AH_MAXCHAN
+#define	AH_MAXCHAN	96
+#endif
+
+/*
+ * Internal per-channel state.  These are found
+ * using ic_devdata in the ieee80211_channel.
  */
 typedef struct {
-	uint32_t	channelFlags;
-	uint16_t	channel;	/* NB: must be first for casting */
+	uint16_t	channel;	/* h/w frequency, NB: may be mapped */
 	uint8_t		privFlags;
-	int8_t		maxRegTxPower;
-	int8_t		maxTxPower;
-	int8_t		minTxPower;	/* as above... */
-
-	HAL_BOOL	bssSendHere;
-	uint8_t		gainI;
-	HAL_BOOL	iqCalValid;
-	uint8_t		calValid;		/* bitmask of cal types */
+#define	CHANNEL_IQVALID		0x01	/* IQ calibration valid */
+#define	CHANNEL_ANI_INIT	0x02	/* ANI state initialized */
+#define	CHANNEL_ANI_SETUP	0x04	/* ANI state setup */
+	uint8_t		calValid;	/* bitmask of cal types */
 	int8_t		iCoff;
 	int8_t		qCoff;
 	int16_t		rawNoiseFloor;
 	int16_t		noiseFloorAdjust;
-	int8_t		antennaMax;
-	uint32_t	regDmnFlags;		/* Flags for channel use in reg */
-	uint32_t	conformanceTestLimit;	/* conformance test limit from reg domain */
-	uint16_t	mainSpur;		/* cached spur value for this cahnnel */
+	uint16_t	mainSpur;	/* cached spur value for this channel */
 } HAL_CHANNEL_INTERNAL;
 
+/* channel requires noise floor check */
+#define	CHANNEL_NFCREQUIRED	IEEE80211_CHAN_PRIV0
+
+/* all full-width channels */
+#define	IEEE80211_CHAN_ALLFULL \
+	(IEEE80211_CHAN_ALL - (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER))
+#define	IEEE80211_CHAN_ALLTURBOFULL \
+	(IEEE80211_CHAN_ALLTURBO - \
+	 (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER))
+
 typedef struct {
 	uint32_t	halChanSpreadSupport 		: 1,
 			halSleepAfterBeaconBroken	: 1,
@@ -189,6 +208,8 @@ typedef struct {
 	uint8_t		halNumAntCfg5GHz;
 } HAL_CAPABILITIES;
 
+struct regDomain;
+
 /*
  * The ``private area'' follows immediately after the ``public area''
  * in the data structure returned by ath_hal_attach.  Private data are
@@ -221,14 +242,8 @@ struct ath_hal_private {
 				uint16_t *data);
 	HAL_BOOL	(*ah_eepromWrite)(struct ath_hal *, u_int off,
 				uint16_t data);
-	HAL_BOOL	(*ah_gpioCfgOutput)(struct ath_hal *, uint32_t gpio);
-	HAL_BOOL	(*ah_gpioCfgInput)(struct ath_hal *, uint32_t gpio);
-	uint32_t	(*ah_gpioGet)(struct ath_hal *, uint32_t gpio);
-	HAL_BOOL	(*ah_gpioSet)(struct ath_hal *,
-				uint32_t gpio, uint32_t val);
-	void		(*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t);
 	HAL_BOOL	(*ah_getChipPowerLimits)(struct ath_hal *,
-				HAL_CHANNEL *, uint32_t);
+				struct ieee80211_channel *);
 	int16_t		(*ah_getNfAdjust)(struct ath_hal *,
 				const HAL_CHANNEL_INTERNAL*);
 	void		(*ah_getNoiseFloor)(struct ath_hal *,
@@ -254,9 +269,10 @@ struct ath_hal_private {
 	uint16_t	ah_phyRev;		/* PHY revision */
 	uint16_t	ah_analog5GhzRev;	/* 2GHz radio revision */
 	uint16_t	ah_analog2GhzRev;	/* 5GHz radio revision */
-
+	uint8_t		ah_ispcie;		/* PCIE, special treatment */
 
 	HAL_OPMODE	ah_opmode;		/* operating mode from reset */
+	const struct ieee80211_channel *ah_curchan;/* operating channel */
 	HAL_CAPABILITIES ah_caps;		/* device capabilities */
 	uint32_t	ah_diagreg;		/* user-specified AR_DIAG_SW */
 	int16_t		ah_powerLimit;		/* tx power cap */
@@ -267,14 +283,13 @@ struct ath_hal_private {
 	/*
 	 * State for regulatory domain handling.
 	 */
-	HAL_REG_DOMAIN	ah_currentRD;		/* Current regulatory domain */
-	HAL_CTRY_CODE	ah_countryCode;		/* current country code */
-	HAL_CHANNEL_INTERNAL ah_channels[256];	/* calculated channel list */
-	u_int		ah_nchan;		/* valid channels in list */
-	HAL_CHANNEL_INTERNAL *ah_curchan;	/* current channel */
+	HAL_REG_DOMAIN	ah_currentRD;		/* EEPROM regulatory domain */
+	HAL_CHANNEL_INTERNAL ah_channels[AH_MAXCHAN]; /* private chan state */
+	u_int		ah_nchan;		/* valid items in ah_channels */
+	const struct regDomain *ah_rd2GHz;	/* reg state for 2G band */
+	const struct regDomain *ah_rd5GHz;	/* reg state for 5G band */
 
 	uint8_t    	ah_coverageClass;   	/* coverage class */
-	HAL_BOOL    	ah_regdomainUpdate;     /* regdomain is updated? */
 	/*
 	 * RF Silent handling; setup according to the EEPROM.
 	 */
@@ -297,22 +312,26 @@ struct ath_hal_private {
 	AH_PRIVATE(_ah)->ah_eepromRead(_ah, _off, _data)
 #define	ath_hal_eepromWrite(_ah, _off, _data) \
 	AH_PRIVATE(_ah)->ah_eepromWrite(_ah, _off, _data)
-#define	ath_hal_gpioCfgOutput(_ah, _gpio) \
-	AH_PRIVATE(_ah)->ah_gpioCfgOutput(_ah, _gpio)
+#define	ath_hal_gpioCfgOutput(_ah, _gpio, _type) \
+	(_ah)->ah_gpioCfgOutput(_ah, _gpio, _type)
 #define	ath_hal_gpioCfgInput(_ah, _gpio) \
-	AH_PRIVATE(_ah)->ah_gpioCfgInput(_ah, _gpio)
+	(_ah)->ah_gpioCfgInput(_ah, _gpio)
 #define	ath_hal_gpioGet(_ah, _gpio) \
-	AH_PRIVATE(_ah)->ah_gpioGet(_ah, _gpio)
+	(_ah)->ah_gpioGet(_ah, _gpio)
 #define	ath_hal_gpioSet(_ah, _gpio, _val) \
-	AH_PRIVATE(_ah)->ah_gpioGet(_ah, _gpio, _val)
+	(_ah)->ah_gpioSet(_ah, _gpio, _val)
 #define	ath_hal_gpioSetIntr(_ah, _gpio, _ilevel) \
-	AH_PRIVATE(_ah)->ah_gpioSetIntr(_ah, _gpio, _ilevel)
-#define	ath_hal_getpowerlimits(_ah, _chans, _nchan) \
-	AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chans, _nchan)
+	(_ah)->ah_gpioSetIntr(_ah, _gpio, _ilevel)
+#define	ath_hal_getpowerlimits(_ah, _chan) \
+	AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chan)
 #define ath_hal_getNfAdjust(_ah, _c) \
 	AH_PRIVATE(_ah)->ah_getNfAdjust(_ah, _c)
 #define	ath_hal_getNoiseFloor(_ah, _nfArray) \
 	AH_PRIVATE(_ah)->ah_getNoiseFloor(_ah, _nfArray)
+#define	ath_hal_configPCIE(_ah, _reset) \
+	(_ah)->ah_configPCIE(_ah, _reset)
+#define	ath_hal_disablePCIE(_ah) \
+	(_ah)->ah_disablePCIE(_ah)
 
 #define	ath_hal_eepromDetach(_ah) \
 	AH_PRIVATE(_ah)->ah_eepromDetach(_ah)
@@ -327,38 +346,22 @@ struct ath_hal_private {
 #define	ath_hal_eepromDiag(_ah, _request, _a, _asize, _r, _rsize) \
 	AH_PRIVATE(_ah)->ah_eepromDiag(_ah, _request, _a, _asize,  _r, _rsize)
 
-#if !defined(_NET_IF_IEEE80211_H_) && !defined(_NET80211__IEEE80211_H_)
+#ifndef _NET_IF_IEEE80211_H_
 /*
  * Stuff that would naturally come from _ieee80211.h
  */
 #define	IEEE80211_ADDR_LEN		6
 
-#define	IEEE80211_WEP_KEYLEN			5	/* 40bit */
 #define	IEEE80211_WEP_IVLEN			3	/* 24bit */
 #define	IEEE80211_WEP_KIDLEN			1	/* 1 octet */
 #define	IEEE80211_WEP_CRCLEN			4	/* CRC-32 */
 
 #define	IEEE80211_CRC_LEN			4
 
-#define	IEEE80211_MTU				1500
 #define	IEEE80211_MAX_LEN			(2300 + IEEE80211_CRC_LEN + \
     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
-
-enum {
-	IEEE80211_T_DS,			/* direct sequence spread spectrum */
-	IEEE80211_T_FH,			/* frequency hopping */
-	IEEE80211_T_OFDM,		/* frequency division multiplexing */
-	IEEE80211_T_TURBO,		/* high rate DS */
-	IEEE80211_T_HT,			/* HT - full GI */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list