svn commit: r204580 - in stable/8/sys: conf dev/ath/ath_hal dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5416 modules/ath

Rui Paulo rpaulo at FreeBSD.org
Tue Mar 2 13:13:13 UTC 2010


Author: rpaulo
Date: Tue Mar  2 13:13:12 2010
New Revision: 204580
URL: http://svn.freebsd.org/changeset/base/204580

Log:
  MFC r197948 r203156 r203158 r203159 r203680 r203682 r203750 r203882 r203930
      r203933 r203959 r204521 r204578:
  
  Atheros AR9285 support.

Added:
  stable/8/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
     - copied unchanged from r197948, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
  stable/8/sys/dev/ath/ath_hal/ah_eeprom_v4k.h
     - copied, changed from r197948, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9285.c
     - copied unchanged from r203930, head/sys/dev/ath/ath_hal/ar5416/ar9285.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9285.h
     - copied unchanged from r203930, head/sys/dev/ath/ath_hal/ar5416/ar9285.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9285.ini
     - copied unchanged from r203159, head/sys/dev/ath/ath_hal/ar5416/ar9285.ini
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
     - copied, changed from r203930, head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
     - copied unchanged from r203930, head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9285v2.ini
     - copied unchanged from r203159, head/sys/dev/ath/ath_hal/ar5416/ar9285v2.ini
Modified:
  stable/8/sys/conf/files
  stable/8/sys/dev/ath/ath_hal/ah.h
  stable/8/sys/dev/ath/ath_hal/ah_eeprom_v14.h
  stable/8/sys/dev/ath/ath_hal/ar5212/ar5212.h
  stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
  stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
  stable/8/sys/dev/ath/ath_hal/ar5212/ar5212reg.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_eeprom.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_keycache.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_phy.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416phy.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9280.h
  stable/8/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c
  stable/8/sys/modules/ath/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/conf/files
==============================================================================
--- stable/8/sys/conf/files	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/conf/files	Tue Mar  2 13:13:12 2010	(r204580)
@@ -554,6 +554,9 @@ dev/ath/ath_hal/ah_eeprom_v3.c	optional 
 dev/ath/ath_hal/ah_eeprom_v14.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
+dev/ath/ath_hal/ah_eeprom_v4k.c \
+	optional ath_hal | ath_ar9285 \
+	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_regdomain.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 # ar5210
@@ -600,104 +603,124 @@ dev/ath/ath_hal/ar5211/ar5211_xmit.c		op
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar5212
 dev/ath/ath_hal/ar5212/ar5212_ani.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_attach.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_beacon.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_eeprom.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_gpio.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_interrupts.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_keycache.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_misc.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_phy.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_power.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_recv.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_reset.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_rfgain.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_xmit.c \
-	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
+	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar5416 (depends on ar5212)
 dev/ath/ath_hal/ar5416/ar5416_ani.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_attach.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_beacon.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal_iq.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_eeprom.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_gpio.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_interrupts.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_keycache.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_misc.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_phy.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_power.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_recv.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_reset.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_xmit.c \
-	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
+	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9160 (depends on ar5416)
 dev/ath/ath_hal/ar5416/ar9160_attach.c optional ath_hal | ath_ar9160 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9280 (depends on ar5416)
-dev/ath/ath_hal/ar5416/ar9280_attach.c optional ath_hal | ath_ar9280 \
+dev/ath/ath_hal/ar5416/ar9280_attach.c optional ath_hal | ath_ar9280 | \
+	ath_ar9285 \ 
+	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
+# ar9285 (depends on ar5416 and ar9280)
+dev/ath/ath_hal/ar5416/ar9285_attach.c optional ath_hal | ath_ar9285 \ 
+	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
+dev/ath/ath_hal/ar5416/ar9285_reset.c optional ath_hal | ath_ar9285 \ 
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # rf backends
 dev/ath/ath_hal/ar5212/ar2316.c	optional ath_rf2316 \
@@ -716,7 +739,9 @@ dev/ath/ath_hal/ar5212/ar5413.c	optional
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar2133.c optional ath_hal | ath_ar5416 | ath_ar9160 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar5416/ar9280.c optional ath_hal | ath_ar9280 \
+dev/ath/ath_hal/ar5416/ar9280.c optional ath_hal | ath_ar9280 | ath_ar9285 \
+	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
+dev/ath/ath_hal/ar5416/ar9285.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ath rate control algorithms
 dev/ath/ath_rate/amrr/amrr.c	optional ath_rate_amrr \

Modified: stable/8/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ah.h	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ah.h	Tue Mar  2 13:13:12 2010	(r204580)
@@ -638,7 +638,11 @@ struct ath_hal {
 			HAL_BOOL longCal, HAL_BOOL *isCalDone);
 	HAL_BOOL  __ahdecl(*ah_resetCalValid)(struct ath_hal *,
 			const struct ieee80211_channel *);
+	HAL_BOOL  __ahdecl(*ah_setTxPower)(struct ath_hal *,
+	    		const struct ieee80211_channel *, uint16_t *);
 	HAL_BOOL  __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
+	HAL_BOOL  __ahdecl(*ah_setBoardValues)(struct ath_hal *,
+	    		const struct ieee80211_channel *);
 
 	/* Transmit functions */
 	HAL_BOOL  __ahdecl(*ah_updateTxTrigLevel)(struct ath_hal*,

Modified: stable/8/sys/dev/ath/ath_hal/ah_eeprom_v14.h
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ah_eeprom_v14.h	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ah_eeprom_v14.h	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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_eeprom_v14.h,v 1.3 2008/11/10 04:08:00 sam Exp $
+ * $FreeBSD$
  */
 #ifndef _AH_EEPROM_V14_H_
 #define _AH_EEPROM_V14_H_
@@ -76,6 +76,7 @@
 #define AR5416_EEPMISC_BIG_ENDIAN    	0x01
 #define FREQ2FBIN(x,y) 			((y) ? ((x) - 2300) : (((x) - 4800) / 5))
 #define AR5416_MAX_CHAINS            	3
+#define	AR5416_PWR_TABLE_OFFSET_DB	-5
 #define AR5416_ANT_16S               	25
 
 #define AR5416_NUM_ANT_CHAIN_FIELDS     7

Copied: stable/8/sys/dev/ath/ath_hal/ah_eeprom_v4k.c (from r197948, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sys/dev/ath/ath_hal/ah_eeprom_v4k.c	Tue Mar  2 13:13:12 2010	(r204580, copy of r197948, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c)
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2009 Rui Paulo <rpaulo at FreeBSD.org>
+ * Copyright (c) 2008 Sam Leffler, Errno Consulting
+ * Copyright (c) 2008 Atheros Communications, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+#include "opt_ah.h"
+
+#include "ah.h"
+#include "ah_internal.h"
+#include "ah_eeprom_v14.h"
+#include "ah_eeprom_v4k.h"
+
+static HAL_STATUS
+v4kEepromGet(struct ath_hal *ah, int param, void *val)
+{
+#define	CHAN_A_IDX	0
+#define	CHAN_B_IDX	1
+#define	IS_VERS(op, v)	((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v))
+	HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+	const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader;
+	const BASE_EEP4K_HEADER  *pBase  = &ee->ee_base.baseEepHeader;
+	uint32_t sum;
+	uint8_t *macaddr;
+	int i;
+
+	switch (param) {
+        case AR_EEP_NFTHRESH_5:
+		*(int16_t *)val = pModal[0].noiseFloorThreshCh[0];
+		return HAL_OK;
+        case AR_EEP_NFTHRESH_2:
+		*(int16_t *)val = pModal[1].noiseFloorThreshCh[0];
+		return HAL_OK;
+        case AR_EEP_MACADDR:		/* Get MAC Address */
+		sum = 0;
+		macaddr = val;
+		for (i = 0; i < 6; i++) {
+			macaddr[i] = pBase->macAddr[i];
+			sum += pBase->macAddr[i];
+		}
+		if (sum == 0 || sum == 0xffff*3) {
+			HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n",
+			    __func__, ath_hal_ether_sprintf(macaddr));
+			return HAL_EEBADMAC;
+		}
+		return HAL_OK;
+        case AR_EEP_REGDMN_0:
+		return pBase->regDmn[0];
+        case AR_EEP_REGDMN_1:
+		return pBase->regDmn[1];
+        case AR_EEP_OPCAP:
+		return pBase->deviceCap;
+        case AR_EEP_OPMODE:
+		return pBase->opCapFlags;
+        case AR_EEP_RFSILENT:
+		return pBase->rfSilent;
+	case AR_EEP_OB_5:
+		return pModal[CHAN_A_IDX].ob;
+    	case AR_EEP_DB_5:
+		return pModal[CHAN_A_IDX].db;
+    	case AR_EEP_OB_2:
+		return pModal[CHAN_B_IDX].ob;
+    	case AR_EEP_DB_2:
+		return pModal[CHAN_B_IDX].db;
+	case AR_EEP_TXMASK:
+		return pBase->txMask;
+	case AR_EEP_RXMASK:
+		return pBase->rxMask;
+	case AR_EEP_RXGAIN_TYPE:
+		return AR5416_EEP_RXGAIN_ORIG;
+	case AR_EEP_TXGAIN_TYPE:
+		return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ?
+		    pBase->txGainType : AR5416_EEP_TXGAIN_ORIG;
+#if 0
+	case AR_EEP_OL_PWRCTRL:
+		HALASSERT(val == AH_NULL);
+		return pBase->openLoopPwrCntl ?  HAL_OK : HAL_EIO;
+#endif
+	case AR_EEP_AMODE:
+		HALASSERT(val == AH_NULL);
+		return pBase->opCapFlags & AR5416_OPFLAGS_11A ?
+		    HAL_OK : HAL_EIO;
+	case AR_EEP_BMODE:
+	case AR_EEP_GMODE:
+		HALASSERT(val == AH_NULL);
+		return pBase->opCapFlags & AR5416_OPFLAGS_11G ?
+		    HAL_OK : HAL_EIO;
+	case AR_EEP_32KHZCRYSTAL:
+	case AR_EEP_COMPRESS:
+	case AR_EEP_FASTFRAME:		/* XXX policy decision, h/w can do it */
+	case AR_EEP_WRITEPROTECT:	/* NB: no write protect bit */
+		HALASSERT(val == AH_NULL);
+		/* fall thru... */
+	case AR_EEP_MAXQCU:		/* NB: not in opCapFlags */
+	case AR_EEP_KCENTRIES:		/* NB: not in opCapFlags */
+		return HAL_EIO;
+	case AR_EEP_AES:
+	case AR_EEP_BURST:
+        case AR_EEP_RFKILL:
+	case AR_EEP_TURBO5DISABLE:
+	case AR_EEP_TURBO2DISABLE:
+		HALASSERT(val == AH_NULL);
+		return HAL_OK;
+	case AR_EEP_ANTGAINMAX_2:
+		*(int8_t *) val = ee->ee_antennaGainMax[1];
+		return HAL_OK;
+	case AR_EEP_ANTGAINMAX_5:
+		*(int8_t *) val = ee->ee_antennaGainMax[0];
+		return HAL_OK;
+        default:
+		HALASSERT(0);
+		return HAL_EINVAL;
+	}
+#undef IS_VERS
+#undef CHAN_A_IDX
+#undef CHAN_B_IDX
+}
+
+static HAL_BOOL
+v4kEepromSet(struct ath_hal *ah, int param, int v)
+{
+	HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+
+	switch (param) {
+	case AR_EEP_ANTGAINMAX_2:
+		ee->ee_antennaGainMax[1] = (int8_t) v;
+		return HAL_OK;
+	case AR_EEP_ANTGAINMAX_5:
+		ee->ee_antennaGainMax[0] = (int8_t) v;
+		return HAL_OK;
+	}
+	return HAL_EINVAL;
+}
+
+static HAL_BOOL
+v4kEepromDiag(struct ath_hal *ah, int request,
+     const void *args, uint32_t argsize, void **result, uint32_t *resultsize)
+{
+	HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+
+	switch (request) {
+	case HAL_DIAG_EEPROM:
+		*result = &ee->ee_base;
+		*resultsize = sizeof(ee->ee_base);
+		return AH_TRUE;
+	}
+	return AH_FALSE;
+}
+
+/* Do structure specific swaps if Eeprom format is non native to host */
+static void
+eepromSwap(struct ar5416eeprom_4k *ee)
+{
+	uint32_t integer, i;
+	uint16_t word;
+	MODAL_EEP4K_HEADER *pModal;
+
+	/* convert Base Eep header */
+	word = __bswap16(ee->baseEepHeader.length);
+	ee->baseEepHeader.length = word;
+
+	word = __bswap16(ee->baseEepHeader.checksum);
+	ee->baseEepHeader.checksum = word;
+
+	word = __bswap16(ee->baseEepHeader.version);
+	ee->baseEepHeader.version = word;
+
+	word = __bswap16(ee->baseEepHeader.regDmn[0]);
+	ee->baseEepHeader.regDmn[0] = word;
+
+	word = __bswap16(ee->baseEepHeader.regDmn[1]);
+	ee->baseEepHeader.regDmn[1] = word;
+
+	word = __bswap16(ee->baseEepHeader.rfSilent);
+	ee->baseEepHeader.rfSilent = word;
+
+	word = __bswap16(ee->baseEepHeader.blueToothOptions);
+	ee->baseEepHeader.blueToothOptions = word; 
+
+	word = __bswap16(ee->baseEepHeader.deviceCap);
+	ee->baseEepHeader.deviceCap = word;
+
+	/* convert Modal Eep header */
+	pModal = &ee->modalHeader;
+
+	/* XXX linux/ah_osdep.h only defines __bswap32 for BE */
+	integer = __bswap32(pModal->antCtrlCommon);
+	pModal->antCtrlCommon = integer;
+
+	for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) {
+		integer = __bswap32(pModal->antCtrlChain[i]);
+		pModal->antCtrlChain[i] = integer;
+	}
+
+	for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
+		word = __bswap16(pModal->spurChans[i].spurChan);
+		pModal->spurChans[i].spurChan = word;
+	}
+}
+
+static uint16_t 
+v4kEepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz)
+{ 
+	HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+	
+	HALASSERT(0 <= ix && ix <  AR5416_EEPROM_MODAL_SPURS);
+	HALASSERT(is2GHz);
+	return ee->ee_base.modalHeader.spurChans[ix].spurChan;
+}
+
+/**************************************************************************
+ * fbin2freq
+ *
+ * Get channel value from binary representation held in eeprom
+ * RETURNS: the frequency in MHz
+ */
+static uint16_t
+fbin2freq(uint8_t fbin, HAL_BOOL is2GHz)
+{
+	/*
+	 * Reserved value 0xFF provides an empty definition both as
+	 * an fbin and as a frequency - do not convert
+	 */
+	if (fbin == AR5416_BCHAN_UNUSED)
+		return fbin;
+	return (uint16_t)((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin));
+}
+
+/*
+ * Copy EEPROM Conformance Testing Limits contents 
+ * into the allocated space
+ */
+/* USE CTLS from chain zero */ 
+#define CTL_CHAIN	0 
+
+static void
+v4kEepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_v4k *ee)
+{
+	RD_EDGES_POWER *rep = ee->ee_rdEdgesPower;
+	int i, j;
+	
+	HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES);
+
+	for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) {
+		for (j = 0; j < NUM_EDGES; j ++) {
+			/* XXX Confirm this is the right thing to do when an invalid channel is stored */
+			if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) {
+				rep[j].rdEdge = 0;
+				rep[j].twice_rdEdgePower = 0;
+				rep[j].flag = 0;
+			} else {
+				rep[j].rdEdge = fbin2freq(
+				    ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel,
+				    (ee->ee_base.ctlIndex[i] & CTL_MODE_M) != CTL_11A);
+				rep[j].twice_rdEdgePower = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_POWER);
+				rep[j].flag = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_FLAG) != 0;
+			}
+		}
+		rep += NUM_EDGES;
+	}
+	ee->ee_numCtls = i;
+	HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM,
+	    "%s Numctls = %u\n",__func__,i);
+}
+
+/*
+ * Reclaim any EEPROM-related storage.
+ */
+static void
+v4kEepromDetach(struct ath_hal *ah)
+{
+	HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+
+	ath_hal_free(ee);
+	AH_PRIVATE(ah)->ah_eeprom = AH_NULL;
+}
+
+#define owl_get_eep_ver(_ee)   \
+    (((_ee)->ee_base.baseEepHeader.version >> 12) & 0xF)
+#define owl_get_eep_rev(_ee)   \
+    (((_ee)->ee_base.baseEepHeader.version) & 0xFFF)
+
+HAL_STATUS
+ath_hal_v4kEepromAttach(struct ath_hal *ah)
+{
+#define	NW(a)	(sizeof(a) / sizeof(uint16_t))
+	HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+	uint16_t *eep_data, magic;
+	HAL_BOOL need_swap;
+	u_int w, off, len;
+	uint32_t sum;
+
+	HALASSERT(ee == AH_NULL);
+ 
+	if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
+		HALDEBUG(ah, HAL_DEBUG_ANY,
+		    "%s Error reading Eeprom MAGIC\n", __func__);
+		return HAL_EEREAD;
+	}
+	HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
+	    __func__, magic);
+	if (magic != AR5416_EEPROM_MAGIC) {
+		HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n");
+		return HAL_EEMAGIC;
+	}
+
+	ee = ath_hal_malloc(sizeof(HAL_EEPROM_v4k));
+	if (ee == AH_NULL) {
+		/* XXX message */
+		return HAL_ENOMEM;
+	}
+
+	eep_data = (uint16_t *)&ee->ee_base;
+	for (w = 0; w < NW(struct ar5416eeprom_4k); w++) {
+		off = owl_eep_start_loc + w;	/* NB: AP71 starts at 0 */
+		if (!ath_hal_eepromRead(ah, off, &eep_data[w])) {
+			HALDEBUG(ah, HAL_DEBUG_ANY,
+			    "%s eeprom read error at offset 0x%x\n",
+			    __func__, off);
+			return HAL_EEREAD;
+		}
+	}
+	/* Convert to eeprom native eeprom endian format */
+	if (isBigEndian()) {
+		for (w = 0; w < NW(struct ar5416eeprom_4k); w++)
+			eep_data[w] = __bswap16(eep_data[w]);
+	}
+
+	/*
+	 * At this point, we're in the native eeprom endian format
+	 * Now, determine the eeprom endian by looking at byte 26??
+	 */
+	need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian();
+	if (need_swap) {
+		HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM,
+		    "Byte swap EEPROM contents.\n");
+		len = __bswap16(ee->ee_base.baseEepHeader.length);
+	} else {
+		len = ee->ee_base.baseEepHeader.length;
+	}
+	len = AH_MIN(len, sizeof(struct ar5416eeprom_4k)) / sizeof(uint16_t);
+	
+	/* Apply the checksum, done in native eeprom format */
+	/* XXX - Need to check to make sure checksum calculation is done
+	 * in the correct endian format.  Right now, it seems it would
+	 * cast the raw data to host format and do the calculation, which may
+	 * not be correct as the calculation may need to be done in the native
+	 * eeprom format 
+	 */
+	sum = 0;
+	for (w = 0; w < len; w++) {
+		sum ^= eep_data[w];
+	}
+	/* Check CRC - Attach should fail on a bad checksum */
+	if (sum != 0xffff) {
+		HALDEBUG(ah, HAL_DEBUG_ANY,
+		    "Bad EEPROM checksum 0x%x (Len=%u)\n", sum, len);
+		return HAL_EEBADSUM;
+	}
+
+	if (need_swap)
+		eepromSwap(&ee->ee_base);	/* byte swap multi-byte data */
+
+	/* swap words 0+2 so version is at the front */
+	magic = eep_data[0];
+	eep_data[0] = eep_data[2];
+	eep_data[2] = magic;
+
+	HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM,
+	    "%s Eeprom Version %u.%u\n", __func__,
+	    owl_get_eep_ver(ee), owl_get_eep_rev(ee));
+
+	/* NB: must be after all byte swapping */
+	if (owl_get_eep_ver(ee) != AR5416_EEP_VER) {
+		HALDEBUG(ah, HAL_DEBUG_ANY,
+		    "Bad EEPROM version 0x%x\n", owl_get_eep_ver(ee));
+		return HAL_EEBADSUM;
+	}
+
+	v4kEepromReadCTLInfo(ah, ee);		/* Get CTLs */
+
+	AH_PRIVATE(ah)->ah_eeprom = ee;
+	AH_PRIVATE(ah)->ah_eeversion = ee->ee_base.baseEepHeader.version;
+	AH_PRIVATE(ah)->ah_eepromDetach = v4kEepromDetach;
+	AH_PRIVATE(ah)->ah_eepromGet = v4kEepromGet;
+	AH_PRIVATE(ah)->ah_eepromSet = v4kEepromSet;
+	AH_PRIVATE(ah)->ah_getSpurChan = v4kEepromGetSpurChan;
+	AH_PRIVATE(ah)->ah_eepromDiag = v4kEepromDiag;
+	return HAL_OK;
+#undef NW
+}

Copied and modified: stable/8/sys/dev/ath/ath_hal/ah_eeprom_v4k.h (from r197948, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h)
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h	Sat Oct 10 22:29:34 2009	(r197948, copy source)
+++ stable/8/sys/dev/ath/ath_hal/ah_eeprom_v4k.h	Tue Mar  2 13:13:12 2010	(r204580)
@@ -39,8 +39,6 @@
 #define AR5416_4K_NUM_CTLS              12
 #define AR5416_4K_NUM_BAND_EDGES       	4
 #define AR5416_4K_NUM_PD_GAINS         	2
-#define AR5416_4K_PD_GAINS_IN_MASK     	4
-#define AR5416_4K_PD_GAIN_ICEPTS        5
 #define AR5416_4K_MAX_CHAINS           	1
 
 /*
@@ -127,8 +125,8 @@ typedef struct CalCtlData4k {
 } __packed CAL_CTL_DATA_4K;
 
 typedef struct calDataPerFreq4k {
-	uint8_t		pwrPdg[AR5416_4K_NUM_PD_GAINS][AR5416_4K_PD_GAIN_ICEPTS];
-	uint8_t		vpdPdg[AR5416_4K_NUM_PD_GAINS][AR5416_4K_PD_GAIN_ICEPTS];
+	uint8_t		pwrPdg[AR5416_4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+	uint8_t		vpdPdg[AR5416_4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
 } __packed CAL_DATA_PER_FREQ_4K;
 
 struct ar5416eeprom_4k {

Modified: stable/8/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5212/ar5212.h	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5212/ar5212.h	Tue Mar  2 13:13:12 2010	(r204580)
@@ -327,6 +327,9 @@ struct ath_hal_5212 {
 	uint16_t	*ah_pcdacTable;
 	u_int		ah_pcdacTableSize;
 	uint16_t	ah_ratesArray[16];
+
+	uint8_t		ah_txTrigLev;		/* current Tx trigger level */
+	uint8_t		ah_maxTxTrigLev;	/* max tx trigger level */
 };
 #define	AH5212(_ah)	((struct ath_hal_5212 *)(_ah))
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -248,6 +248,9 @@ ar5212InitState(struct ath_hal_5212 *ahp
 	ahp->ah_acktimeout = (u_int) -1;
 	ahp->ah_ctstimeout = (u_int) -1;
 	ahp->ah_sifstime = (u_int) -1;
+	ahp->ah_txTrigLev = INIT_TX_FIFO_THRESHOLD,
+	ahp->ah_maxTxTrigLev = MAX_TX_FIFO_THRESHOLD,
+
 	OS_MEMCPY(&ahp->ah_bssidmask, defbssidmask, IEEE80211_ADDR_LEN);
 #undef N
 }

Modified: stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_power.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_power.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5212_power.c,v 1.4 2008/11/10 04:08:03 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 
@@ -38,8 +38,8 @@ static HAL_BOOL
 ar5212SetPowerModeAwake(struct ath_hal *ah, int setChip)
 {
 #define	AR_SCR_MASK \
-    (AR_SCR_SLDUR|AR_SCR_SLE|AR_SCR_SLE|AR_SCR_SLDTP|AR_SCR_SLDWP|\
-     AR_SCR_SLEPOL|AR_SCR_MIBIE)
+    (AR_SCR_SLDUR|AR_SCR_SLE|AR_SCR_SLDTP|AR_SCR_SLDWP|\
+     AR_SCR_SLEPOL|AR_SCR_MIBIE|AR_SCR_UNKNOWN)
 #define	POWER_UP_TIME	2000
 	uint32_t scr, val;
 	int i;

Modified: stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -48,16 +48,19 @@ ar5212UpdateTxTrigLevel(struct ath_hal *
 	uint32_t txcfg, curLevel, newLevel;
 	HAL_INT omask;
 
+	if (ahp->ah_txTrigLev >= ahp->ah_maxTxTrigLev)
+		return AH_FALSE;
+
 	/*
 	 * Disable interrupts while futzing with the fifo level.
 	 */
-	omask = ar5212SetInterrupts(ah, ahp->ah_maskReg &~ HAL_INT_GLOBAL);
+	omask = ah->ah_setInterrupts(ah, ahp->ah_maskReg &~ HAL_INT_GLOBAL);
 
 	txcfg = OS_REG_READ(ah, AR_TXCFG);
 	curLevel = MS(txcfg, AR_FTRIG);
 	newLevel = curLevel;
 	if (bIncTrigLevel) {		/* increase the trigger level */
-		if (curLevel < MAX_TX_FIFO_THRESHOLD)
+		if (curLevel < ahp->ah_maxTxTrigLev)
 			newLevel++;
 	} else if (curLevel > MIN_TX_FIFO_THRESHOLD)
 		newLevel--;
@@ -66,8 +69,10 @@ ar5212UpdateTxTrigLevel(struct ath_hal *
 		OS_REG_WRITE(ah, AR_TXCFG,
 			(txcfg &~ AR_FTRIG) | SM(newLevel, AR_FTRIG));
 
+	ahp->ah_txTrigLev = newLevel;
+
 	/* re-enable chip interrupts */
-	ar5212SetInterrupts(ah, omask);
+	ah->ah_setInterrupts(ah, omask);
 
 	return (newLevel != curLevel);
 }

Modified: stable/8/sys/dev/ath/ath_hal/ar5212/ar5212reg.h
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5212/ar5212reg.h	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5212/ar5212reg.h	Tue Mar  2 13:13:12 2010	(r204580)
@@ -700,6 +700,7 @@
 #define	AR_SCR_SLDWP		0x00080000 /* sleep duration write policy */
 #define	AR_SCR_SLEPOL		0x00100000 /* sleep policy mode */
 #define	AR_SCR_MIBIE		0x00200000 /* sleep perf cntrs MIB intr ena */
+#define	AR_SCR_UNKNOWN		0x00400000
 
 #define	AR_INTPEND_TRUE		0x00000001 /* interrupt pending */
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416.h	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416.h	Tue Mar  2 13:13:12 2010	(r204580)
@@ -21,6 +21,7 @@
 
 #include "ar5212/ar5212.h"
 #include "ar5416_cal.h"
+#include "ah_eeprom_v14.h"	/* for CAL_TARGET_POWER_* */
 
 #define	AR5416_MAGIC	0x20065416
 
@@ -44,6 +45,7 @@ typedef struct {
 #define	AR5416_CCA_MAX_GOOD_VALUE	-85
 #define	AR5416_CCA_MAX_HIGH_VALUE	-62
 #define	AR5416_CCA_MIN_BAD_VALUE	-140
+#define	AR9285_CCA_MAX_GOOD_VALUE	-118
 
 #define AR5416_SPUR_RSSI_THRESH		40
 
@@ -178,12 +180,27 @@ extern	HAL_RFGAIN ar5416GetRfgain(struct
 extern	HAL_BOOL ar5416Disable(struct ath_hal *ah);
 extern	HAL_BOOL ar5416ChipReset(struct ath_hal *ah,
 		const struct ieee80211_channel *);
+extern	HAL_BOOL ar5416SetBoardValues(struct ath_hal *,
+		const struct ieee80211_channel *);
 extern	HAL_BOOL ar5416SetResetReg(struct ath_hal *, uint32_t type);
 extern	HAL_BOOL ar5416SetTxPowerLimit(struct ath_hal *ah, uint32_t limit);
+extern	HAL_BOOL ar5416SetTransmitPower(struct ath_hal *,
+    		const struct ieee80211_channel *, uint16_t *);
 extern	HAL_BOOL ar5416GetChipPowerLimits(struct ath_hal *ah,
 		struct ieee80211_channel *chan);
 extern	void ar5416GetChannelCenters(struct ath_hal *,
 		const struct ieee80211_channel *chan, CHAN_CENTERS *centers);
+extern	void ar5416GetTargetPowers(struct ath_hal *ah, 
+		const struct ieee80211_channel *chan,
+		CAL_TARGET_POWER_HT *powInfo,
+		uint16_t numChannels, CAL_TARGET_POWER_HT *pNewPower,
+		uint16_t numRates, HAL_BOOL isHt40Target);
+extern	void ar5416GetTargetPowersLeg(struct ath_hal *ah, 
+		const struct ieee80211_channel *chan,
+		CAL_TARGET_POWER_LEG *powInfo,
+		uint16_t numChannels, CAL_TARGET_POWER_LEG *pNewPower,
+		uint16_t numRates, HAL_BOOL isExtTarget);
+
 
 extern	HAL_BOOL ar5416StopTxDma(struct ath_hal *ah, u_int q);
 extern	HAL_BOOL ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -183,7 +183,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
 
 		if (level >= params->maxNoiseImmunityLevel) {
 			HALDEBUG(ah, HAL_DEBUG_ANY,
-			    "%s: level out of range (%u > %u)\n",
+			    "%s: immunity level out of range (%u > %u)\n",
 			    __func__, level, params->maxNoiseImmunityLevel);
 			return AH_FALSE;
 		}
@@ -267,7 +267,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
 
 		if (level >= params->maxFirstepLevel) {
 			HALDEBUG(ah, HAL_DEBUG_ANY,
-			    "%s: level out of range (%u > %u)\n",
+			    "%s: firstep level out of range (%u > %u)\n",
 			    __func__, level, params->maxFirstepLevel);
 			return AH_FALSE;
 		}
@@ -285,7 +285,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
 
 		if (level >= params->maxSpurImmunityLevel) {
 			HALDEBUG(ah, HAL_DEBUG_ANY,
-			    "%s: level out of range (%u > %u)\n",
+			    "%s: spur immunity level out of range (%u > %u)\n",
 			    __func__, level, params->maxSpurImmunityLevel);
 			return AH_FALSE;
 		}

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -89,6 +89,8 @@ ar5416InitState(struct ath_hal_5416 *ahp
 	ah->ah_perCalibrationN		= ar5416PerCalibrationN,
 	ah->ah_resetCalValid		= ar5416ResetCalValid,
 	ah->ah_setTxPowerLimit		= ar5416SetTxPowerLimit;
+	ah->ah_setTxPower		= ar5416SetTransmitPower;
+	ah->ah_setBoardValues		= ar5416SetBoardValues;
 
 	/* Transmit functions */
 	ah->ah_stopTxDma		= ar5416StopTxDma;

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_beacon.c,v 1.8 2008/11/11 01:03:12 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_cal_adcdc.c,v 1.2 2008/11/11 17:43:23 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_cal_adcgain.c,v 1.2 2008/11/11 17:43:23 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_cal_iq.c,v 1.2 2008/11/11 17:43:23 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_eeprom.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_eeprom.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_eeprom.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_eeprom.c,v 1.6 2008/11/10 04:08:04 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_gpio.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -146,7 +146,9 @@ ar5416GpioGet(struct ath_hal *ah, uint32
 	 * Read output value for all gpio's, shift it,
 	 * and verify whether the specific bit is set.
 	 */
-	if (AR_SREV_MERLIN_10_OR_LATER(ah))
+	if (AR_SREV_KITE_10_OR_LATER(ah))
+		bits = MS(OS_REG_READ(ah, AR_GPIO_IN_OUT), AR9285_GPIO_IN_VAL);
+	else if (AR_SREV_MERLIN_10_OR_LATER(ah))
 		bits = MS(OS_REG_READ(ah, AR_GPIO_IN_OUT), AR928X_GPIO_IN_VAL);
 	else
 		bits = MS(OS_REG_READ(ah, AR_GPIO_IN_OUT), AR_GPIO_IN_VAL);

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_keycache.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_keycache.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_keycache.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_keycache.c,v 1.3 2008/11/10 04:08:04 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_misc.c,v 1.12 2008/11/27 22:30:07 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 
@@ -30,7 +30,7 @@
 #include "ar5416/ar5416phy.h"
 
 /*
- * Return the wireless modes (a,b,g,t) supported by hardware.
+ * Return the wireless modes (a,b,g,n,t) supported by hardware.
  *
  * This value is what is actually supported by the hardware
  * and is unaffected by regulatory/country code settings.

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_phy.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_phy.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_phy.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_phy.c,v 1.4 2008/11/27 22:30:08 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_power.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_power.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_power.c,v 1.6 2008/11/11 00:11:30 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -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: ar5416_recv.c,v 1.7 2008/11/11 20:46:06 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 

Modified: stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Tue Mar  2 12:59:42 2010	(r204579)
+++ stable/8/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Tue Mar  2 13:13:12 2010	(r204580)
@@ -45,9 +45,6 @@ static void ar5416InitIMR(struct ath_hal
 static void ar5416InitQoS(struct ath_hal *ah);
 static void ar5416InitUserSettings(struct ath_hal *ah);
 
-static HAL_BOOL ar5416SetTransmitPower(struct ath_hal *ah, 
-	const struct ieee80211_channel *chan, uint16_t *rfXpdGain);
-
 #if 0
 static HAL_BOOL	ar5416ChannelChange(struct ath_hal *, const struct ieee80211_channel *);
 #endif
@@ -56,7 +53,6 @@ static void ar5416SetDeltaSlope(struct a
 static HAL_BOOL ar5416SetResetPowerOn(struct ath_hal *ah);
 static HAL_BOOL ar5416SetReset(struct ath_hal *ah, int type);
 static void ar5416InitPLL(struct ath_hal *ah, const struct ieee80211_channel *chan);
-static HAL_BOOL ar5416SetBoardValues(struct ath_hal *, const struct ieee80211_channel *);
 static HAL_BOOL ar5416SetPowerPerRateTable(struct ath_hal *ah,
 	struct ar5416eeprom *pEepData, 
 	const struct ieee80211_channel *chan, int16_t *ratesArray,
@@ -69,14 +65,6 @@ static HAL_BOOL ar5416SetPowerCalTable(s
 	int16_t *pTxPowerIndexOffset);
 static uint16_t ar5416GetMaxEdgePower(uint16_t freq,
 	CAL_CTL_EDGES *pRdEdgesPower, HAL_BOOL is2GHz);
-static void ar5416GetTargetPowers(struct ath_hal *ah, 
-	const struct ieee80211_channel *chan, CAL_TARGET_POWER_HT *powInfo,
-	uint16_t numChannels, CAL_TARGET_POWER_HT *pNewPower,
-	uint16_t numRates, HAL_BOOL isHt40Target);
-static void ar5416GetTargetPowersLeg(struct ath_hal *ah, 
-	const struct ieee80211_channel *chan, CAL_TARGET_POWER_LEG *powInfo,
-	uint16_t numChannels, CAL_TARGET_POWER_LEG *pNewPower,
-	uint16_t numRates, HAL_BOOL isExtTarget);
 
 static int16_t interpolate(uint16_t target, uint16_t srcLeft,
 	uint16_t srcRight, int16_t targetLeft, int16_t targetRight);
@@ -224,7 +212,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO
 	OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask);
 
 	/* Setup the transmit power values. */
-	if (!ar5416SetTransmitPower(ah, chan, rfXpdGain)) {
+	if (!ah->ah_setTxPower(ah, chan, rfXpdGain)) {
 		HALDEBUG(ah, HAL_DEBUG_ANY,
 		    "%s: error init'ing transmit power\n", __func__);
 		FAIL(HAL_EIO);
@@ -245,7 +233,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO
 	AH5416(ah)->ah_spurMitigate(ah, chan);
 
 	/* Setup board specific options for EEPROM version 3 */

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


More information about the svn-src-all mailing list