From owner-svn-src-user@FreeBSD.ORG  Tue Jul 27 23:03:50 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B05141065676;
	Tue, 27 Jul 2010 23:03:50 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A01F28FC13;
	Tue, 27 Jul 2010 23:03:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6RN3obV035483;
	Tue, 27 Jul 2010 23:03:50 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6RN3oMB035481;
	Tue, 27 Jul 2010 23:03:50 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201007272303.o6RN3oMB035481@svn.freebsd.org>
From: Doug Barton <dougb@FreeBSD.org>
Date: Tue, 27 Jul 2010 23:03:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210554 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 27 Jul 2010 23:03:50 -0000

Author: dougb
Date: Tue Jul 27 23:03:50 2010
New Revision: 210554
URL: http://svn.freebsd.org/changeset/base/210554

Log:
  Brain-o fixes and other items noticed by bf:
  1. If $PM_LOG exists but is not writable, warn the user
  2. If PORTSDIR exists, but isn't a ports tree, warn the user
  3. Add some more things to avoid checking in read_distinfos_all()
  4. When setting PACKAGES run tests against $pd, not literal /usr/ports
  
  Other fixes:
  1. When using $INSTALLED_LIST don't output the terminal \n to PM_LOG
     so we don't get 2 empty lines in a row.
  2. In read_distinfos*() don't cd into the directory if /distinfo exists.
     For the _all() case the speedup is very noticable, around 30%.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Tue Jul 27 22:55:24 2010	(r210553)
+++ user/dougb/portmaster/portmaster	Tue Jul 27 23:03:50 2010	(r210554)
@@ -188,8 +188,10 @@ parent_exit () {
 			esac
 		fi
 		if [ -n "$PM_LOG" ]; then
-			if [ -f "$PM_LOG" ]; then
+			if [ -w "$PM_LOG" ]; then
 				echo '' >> $PM_LOG
+			elif [ -e "$PM_LOG" -a ! -w "$PM_LOG" ]; then
+				echo "===>>> Warning: $PM_LOG exists, but is not writable"
 			elif [ -e "$PM_LOG" -o -L "$PM_LOG" ]; then
 				echo "===>>> Warning: $PM_LOG exists, but is not a regular file"
 			else
@@ -203,7 +205,7 @@ parent_exit () {
 		case "$show_list" in
 		all)	echo "===>>> The following actions were performed:"
 			echo -e $INSTALLED_LIST
-			[ -n "$PM_LOG" ] && echo -e $INSTALLED_LIST >> $PM_LOG ;;
+			[ -n "$PM_LOG" ] && echo -e ${INSTALLED_LIST%\n} >> $PM_LOG ;;
 		one)	echo "===>>> $ilist complete" ; echo ''
 			[ -n "$PM_LOG" ] && echo "	$ilist" >> $PM_LOG ;;
 		esac
@@ -535,6 +537,9 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then
 		fi
 	fi
 
+	[ -n "$pd" ] && [ ! -r "${pd}/Mk/bsd.port.mk" ] &&
+		fail "The ports directory ($pd) does not seem to contain a ports tree"
+
 	if [ -n "$PM_INDEX" ]; then
 		if [ -z "$INDEXFILE" ]; then
 			ver=`uname -r`
@@ -876,11 +881,10 @@ read_distinfos () {
 			origin=$moved_npd
 		fi
 
-		pm_cd $pd/$origin || continue
-
-		if [ -s distinfo ]; then
-			distinfo=distinfo
+		if [ -s "${origin}/distinfo" ]; then
+			distinfo="${origin}/distinfo"
 		else
+			pm_cd $origin || continue
 			distinfo=`pm_make -V MD5_FILE`
 		fi
 
@@ -905,16 +909,17 @@ read_distinfos_all () {
 	echo "===>>> Gathering distinfo list for all ports"
 	echo '       (This will take several minutes)'
 	echo ''
+
 	for origin in ${pd}/*/*; do
 		case "${origin#$pd/}" in
-		Mk/*|T*|distfiles/*|packages/*|*/[Mm]akefile) continue ;; esac
+		Mk/*|T*|distfiles/*|packages/*|*/[Mm]akefile*|CVS/*|*/CVS) continue ;; esac
 
 		[ -d "$origin" ] || continue
-		pm_cd $origin || continue
 
-		if [ -s distinfo ]; then
-			distinfo=distinfo
+		if [ -s "${origin}/distinfo" ]; then
+			distinfo="${origin}/distinfo"
 		else
+			pm_cd $origin || continue
 			distinfo=`pm_make -V MD5_FILE`
 		fi
 
@@ -1001,11 +1006,11 @@ init_packages_var () {
 
 	PACKAGES=`pm_make -f/usr/share/mk/bsd.port.mk -V PACKAGES 2>/dev/null`
 	if [ -z "$PACKAGES" ]; then
-		if [ -d /usr/ports/packages -a -w /usr/ports/packages ]; then
-			PACKAGES='/usr/ports/packages'
+		if [ -d "${pd}/packages" -a -w "${pd}/packages" ]; then
+			PACKAGES="${pd}/packages"
 		else
-			if [ -d /usr/ports/ -a -w /usr/ports/ ]; then
-				PACKAGES='/usr/ports/packages'
+			if [ -d "${pd}/" -a -w "${pd}/" ]; then
+				PACKAGES="${pd}/packages"
 			else
 				fail 'The value of PACKAGES cannot be empty and the directory must be writable'
 			fi

From owner-svn-src-user@FreeBSD.ORG  Thu Jul 29 13:22:55 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 66ACC106567D;
	Thu, 29 Jul 2010 13:22:55 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5666D8FC1E;
	Thu, 29 Jul 2010 13:22:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6TDMt9G051511;
	Thu, 29 Jul 2010 13:22:55 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6TDMtu0051509;
	Thu, 29 Jul 2010 13:22:55 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007291322.o6TDMtu0051509@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Thu, 29 Jul 2010 13:22:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210602 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Jul 2010 13:22:55 -0000

Author: adrian
Date: Thu Jul 29 13:22:55 2010
New Revision: 210602
URL: http://svn.freebsd.org/changeset/base/210602

Log:
  Add in a local addition to the 9160 .ini which forces the calibration mode
  register (AR_PHY_CALMODE) to 0. It's done for the other chips so I'm doing it
  here just in case.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini	Thu Jul 29 12:08:46 2010	(r210601)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini	Thu Jul 29 13:22:55 2010	(r210602)
@@ -326,6 +326,7 @@ static const uint32_t ar9160Common[][2] 
     { 0x000099e4, 0xaaaaaaaa },
     { 0x000099e8, 0x3c466478 },
     { 0x000099ec, 0x0cc80caa },
+    { 0x000099f0, 0x00000000 },		/* XXX adrian's addition: AR_PHY_CALMODE == 0 */
     { 0x000099fc, 0x00001042 },
     { 0x00009b00, 0x00000000 },
     { 0x00009b04, 0x00000001 },

From owner-svn-src-user@FreeBSD.ORG  Thu Jul 29 13:34:41 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04B6A106566C;
	Thu, 29 Jul 2010 13:34:41 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E838F8FC13;
	Thu, 29 Jul 2010 13:34:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6TDYeH6054120;
	Thu, 29 Jul 2010 13:34:40 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6TDYeZr054118;
	Thu, 29 Jul 2010 13:34:40 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007291334.o6TDYeZr054118@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Thu, 29 Jul 2010 13:34:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210603 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Jul 2010 13:34:41 -0000

Author: adrian
Date: Thu Jul 29 13:34:40 2010
New Revision: 210603
URL: http://svn.freebsd.org/changeset/base/210603

Log:
  Grab the AR_PHY_CCA and AR_PHY_EXT_CCA initvals from Linux wireless-testing.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini	Thu Jul 29 13:22:55 2010	(r210602)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar9160.ini	Thu Jul 29 13:34:40 2010	(r210603)
@@ -39,6 +39,7 @@ static const uint32_t ar9160Modes[][6] =
     { 0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e },
     { 0x0000985c, 0x31395d5e, 0x31395d5e, 0x31395d5e, 0x31395d5e, 0x31395d5e },
     { 0x00009860, 0x00048d18, 0x00048d18, 0x00048d20, 0x00048d20, 0x00048d18 },
+    { 0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 },
     { 0x0000c864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 },
     { 0x00009868, 0x409a40d0, 0x409a40d0, 0x409a40d0, 0x409a40d0, 0x409a40d0 },
     { 0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 },
@@ -51,6 +52,7 @@ static const uint32_t ar9160Modes[][6] =
     { 0x0000b960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40 },
     { 0x00009964, 0x00001120, 0x00001120, 0x00001120, 0x00001120, 0x00001120 },
     { 0x0000c968, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce, 0x000003ce },
+    { 0x000099bc, 0x001a0600, 0x001a0600, 0x001a0c00, 0x001a0c00, 0x001a0c00 },
     { 0x0000c9bc, 0x001a0600, 0x001a0600, 0x001a0c00, 0x001a0c00, 0x001a0c00 },
     { 0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be, 0x038919be },
     { 0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77 },

From owner-svn-src-user@FreeBSD.ORG  Thu Jul 29 14:13:45 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B77391065672;
	Thu, 29 Jul 2010 14:13:45 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A6D118FC21;
	Thu, 29 Jul 2010 14:13:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6TEDjjc062926;
	Thu, 29 Jul 2010 14:13:45 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6TEDjrL062924;
	Thu, 29 Jul 2010 14:13:45 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007291413.o6TEDjrL062924@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Thu, 29 Jul 2010 14:13:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210607 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Jul 2010 14:13:45 -0000

Author: adrian
Date: Thu Jul 29 14:13:45 2010
New Revision: 210607
URL: http://svn.freebsd.org/changeset/base/210607

Log:
  Point out that the comment in ar5416InitCal() that NF calibration
  is delayed is wrong.
  
  Since it is wrong, and the current code immediately kicks off
  one of the periodic calibrations on interface reset, just delay
  the rest of the calibration setup until the NF calibration
  completes.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Thu Jul 29 14:04:29 2010	(r210606)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Thu Jul 29 14:13:45 2010	(r210607)
@@ -169,6 +169,7 @@ ar5416InitCal(struct ath_hal *ah, const 
 {
 	struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
 	HAL_CHANNEL_INTERNAL *ichan;
+	int i;
 
 	ichan = ath_hal_checkchannel(ah, chan);
 	HALASSERT(ichan != AH_NULL);
@@ -219,7 +220,24 @@ ar5416InitCal(struct ath_hal *ah, const 
 	 * higher than normal value if DC offset and noise floor cal are
 	 * triggered at the same time.
 	 */
+	/* XXX this actually kicks off a NF calibration -adrian */
 	OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
+	/*
+	 * Try to make sure the above NF cal completes, just so
+	 * it doesn't clash with subsequent percals -adrian
+	 */
+	for (i = 0; i < 100; i++) {
+		if (ath_hal_wait(ah, AR_PHY_AGC_CONTROL,
+		    AR_PHY_AGC_CONTROL_NF, 0) == AH_TRUE)
+			break;
+		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: (loop %d): initial NF "
+		"calibration didn't finish.\n", __func__, i);
+	}
+	if (i >= 100) {
+		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did "
+		"not complete in time; noisy environment?\n", __func__);
+		return AH_FALSE;
+	}               
 
 	/* Initialize list pointers */
 	cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL;

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 13:26:02 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9414C106566B;
	Fri, 30 Jul 2010 13:26:02 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 833628FC13;
	Fri, 30 Jul 2010 13:26:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UDQ2lm073069;
	Fri, 30 Jul 2010 13:26:02 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UDQ2Xx073067;
	Fri, 30 Jul 2010 13:26:02 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301326.o6UDQ2Xx073067@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 13:26:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210647 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 13:26:02 -0000

Author: adrian
Date: Fri Jul 30 13:26:02 2010
New Revision: 210647
URL: http://svn.freebsd.org/changeset/base/210647

Log:
  The HAL ath_hal_calibrateN() calls the ah_perCalibrationN method with
  rxchainmask set to 0x1. This means only the first radio chain is calibrated.
  
  Linux ath9k calibrates all three radio chains and a little investigation
  by a friendly atheros developer indicates this is what should occur. So for now,
  override what the OS dependant HAL macro does and set the current rxchainmask.
  
  This calibrates all three radio chains on the AR9160. The AR5416 doesn't
  do any periodic calibration aside from noise floor by default. I haven't
  yet tried it on any other chipsets supported by this code.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:23:21 2010	(r210646)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:26:02 2010	(r210647)
@@ -414,6 +414,13 @@ ar5416PerCalibrationN(struct ath_hal *ah
 
 	*isCalDone = AH_TRUE;
 
+	/*
+	 * Since ath_hal calls the PerCal method with rxchainmask=0x1;
+	 * override it with the current chainmask. The upper levels currently
+	 * doesn't know about the chainmask.
+	 */
+	rxchainmask = ahp->ah_rx_chainmask;
+
 	/* Invalid channel check */
 	ichan = ath_hal_checkchannel(ah, chan);
 	if (ichan == AH_NULL) {

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 13:40:52 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1015C106567B;
	Fri, 30 Jul 2010 13:40:52 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F2C6B8FC25;
	Fri, 30 Jul 2010 13:40:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UDepaP076372;
	Fri, 30 Jul 2010 13:40:51 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UDep1u076370;
	Fri, 30 Jul 2010 13:40:51 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301340.o6UDep1u076370@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 13:40:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210648 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 13:40:52 -0000

Author: adrian
Date: Fri Jul 30 13:40:51 2010
New Revision: 210648
URL: http://svn.freebsd.org/changeset/base/210648

Log:
  Abstract out NF-cal-in-progress checking into ar5416IsNFCalInProgress().
  Abstract out waiting for NF-cal to complete into ar5416WaitNfComplete().
  
  Begin using these functions in places where hard-coded register accesses
  are done. They'll start being used elsewhere soon.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:26:02 2010	(r210647)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:40:51 2010	(r210648)
@@ -34,6 +34,8 @@
 static void ar5416StartNFCal(struct ath_hal *ah);
 static void ar5416LoadNF(struct ath_hal *ah, const struct ieee80211_channel *);
 static int16_t ar5416GetNf(struct ath_hal *, struct ieee80211_channel *);
+static int ar5416IsNFCalInProgress(struct ath_hal *ah);
+static int ar5416WaitNfComplete(struct ath_hal *ah, int i);
 
 /*
  * Determine if calibration is supported by device and channel flags
@@ -226,14 +228,7 @@ ar5416InitCal(struct ath_hal *ah, const 
 	 * Try to make sure the above NF cal completes, just so
 	 * it doesn't clash with subsequent percals -adrian
 	 */
-	for (i = 0; i < 100; i++) {
-		if (ath_hal_wait(ah, AR_PHY_AGC_CONTROL,
-		    AR_PHY_AGC_CONTROL_NF, 0) == AH_TRUE)
-			break;
-		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: (loop %d): initial NF "
-		"calibration didn't finish.\n", __func__, i);
-	}
-	if (i >= 100) {
+	if (! ar5416WaitNfComplete(struct ath_hal *ah, 1000)) {
 		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did "
 		"not complete in time; noisy environment?\n", __func__);
 		return AH_FALSE;
@@ -570,22 +565,16 @@ ar5416LoadNF(struct ath_hal *ah, const s
 	OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
 
 	/* Wait for load to complete, should be fast, a few 10s of us. */
-	for (j = 0; j < 1000; j++) {
-		if ((OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) == 0)
-			break;
-		OS_DELAY(10);
-	}
-
-	/*
-	 * We timed out waiting for the noisefloor to load, probably due to an
-	 * in-progress rx. Simply return here and allow the load plenty of time
-	 * to complete before the next calibration interval.  We need to avoid
-	 * trying to load -50 (which happens below) while the previous load is
-	 * still in progress as this can cause rx deafness. Instead by returning
-	 * here, the baseband nf cal will just be capped by our present
-	 * noisefloor until the next calibration timer.
-	 */
-	if (j == 1000) {
+	if (! ar5416WaitNfComplete(ah, 1000)) {
+		/*
+		 * We timed out waiting for the noisefloor to load, probably due to an
+		 * in-progress rx. Simply return here and allow the load plenty of time
+		 * to complete before the next calibration interval.  We need to avoid
+		 * trying to load -50 (which happens below) while the previous load is
+		 * still in progress as this can cause rx deafness. Instead by returning
+		 * here, the baseband nf cal will just be capped by our present
+		 * noisefloor until the next calibration timer.
+		 */
 		HALDEBUG(ah, HAL_DEBUG_ANY, "Timeout while waiting for nf "
 		    "to load: AR_PHY_AGC_CONTROL=0x%x\n",
 		    OS_REG_READ(ah, AR_PHY_AGC_CONTROL));
@@ -648,6 +637,41 @@ ar5416UpdateNFHistBuff(struct ar5212NfCa
 }   
 
 /*
+ * Check whether there's an in-progress NF completion.
+ *
+ * Returns AH_TRUE if there's a in-progress NF calibration, AH_FALSE
+ * otherwise.
+ */
+static int
+ar5416IsNFCalInProgress(struct ath_hal *ah)
+{
+	if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF)
+		return AH_TRUE;
+	return FALSE;
+}
+
+/*
+ * Wait for an in-progress calibration to complete.
+ *
+ * The completion function waits "i" times 10uS.
+ * It returns AH_TRUE if the NF calibration completed (or was never
+ * in progress); AH_FALSE if it was still in progress after "i" checks.
+ */
+static int
+ar5416WaitNfComplete(struct ath_hal *ah, int i)
+{
+	int j;
+	if (i <= 0)
+		i = 1;		/* it should run at least once */
+	for (j = 0; j < i; j++) {
+		if (! ar5416IsNFCalInProgress(ah))
+			return AH_TRUE;
+		OS_DELAY(10);
+	}
+	return AH_FALSE;
+}
+
+/*
  * Read the NF and check it against the noise floor threshhold
  */
 static int16_t
@@ -655,7 +679,7 @@ ar5416GetNf(struct ath_hal *ah, struct i
 {
 	int16_t nf, nfThresh;
 
-	if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
+	if (ar5416IsNFCalInProgress(ah)) {
 		HALDEBUG(ah, HAL_DEBUG_ANY,
 		    "%s: NF didn't complete in calibration window\n", __func__);
 		nf = 0;

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 13:53:45 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C9F2E1065677;
	Fri, 30 Jul 2010 13:53:45 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B86298FC08;
	Fri, 30 Jul 2010 13:53:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UDrjA5079256;
	Fri, 30 Jul 2010 13:53:45 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UDrjfa079254;
	Fri, 30 Jul 2010 13:53:45 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301353.o6UDrjfa079254@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 13:53:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210649 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 13:53:46 -0000

Author: adrian
Date: Fri Jul 30 13:53:45 2010
New Revision: 210649
URL: http://svn.freebsd.org/changeset/base/210649

Log:
  My bad - make it compile.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:40:51 2010	(r210648)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:53:45 2010	(r210649)
@@ -171,7 +171,6 @@ ar5416InitCal(struct ath_hal *ah, const 
 {
 	struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
 	HAL_CHANNEL_INTERNAL *ichan;
-	int i;
 
 	ichan = ath_hal_checkchannel(ah, chan);
 	HALASSERT(ichan != AH_NULL);
@@ -228,7 +227,7 @@ ar5416InitCal(struct ath_hal *ah, const 
 	 * Try to make sure the above NF cal completes, just so
 	 * it doesn't clash with subsequent percals -adrian
 	 */
-	if (! ar5416WaitNfComplete(struct ath_hal *ah, 1000)) {
+	if (! ar5416WaitNfComplete(ah, 1000)) {
 		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did "
 		"not complete in time; noisy environment?\n", __func__);
 		return AH_FALSE;
@@ -414,7 +413,7 @@ ar5416PerCalibrationN(struct ath_hal *ah
 	 * override it with the current chainmask. The upper levels currently
 	 * doesn't know about the chainmask.
 	 */
-	rxchainmask = ahp->ah_rx_chainmask;
+	rxchainmask = AH5416(ah)->ah_rx_chainmask;
 
 	/* Invalid channel check */
 	ichan = ath_hal_checkchannel(ah, chan);
@@ -529,7 +528,7 @@ ar5416LoadNF(struct ath_hal *ah, const s
 		AR_PHY_CH2_EXT_CCA
 	};
 	struct ar5212NfCalHist *h;
-	int i, j;
+	int i;
 	int32_t val;
 	uint8_t chainmask;
 

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 13:58:44 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 512FF106564A;
	Fri, 30 Jul 2010 13:58:44 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FDFB8FC08;
	Fri, 30 Jul 2010 13:58:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UDwikr080435;
	Fri, 30 Jul 2010 13:58:44 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UDwiXa080433;
	Fri, 30 Jul 2010 13:58:44 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301358.o6UDwiXa080433@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 13:58:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210651 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 13:58:44 -0000

Author: adrian
Date: Fri Jul 30 13:58:43 2010
New Revision: 210651
URL: http://svn.freebsd.org/changeset/base/210651

Log:
  Oops, restore the previous delay. This restores functionality -
  it takes longer that 1ms to do the initial NF calibration.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:54:15 2010	(r210650)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 13:58:43 2010	(r210651)
@@ -227,7 +227,7 @@ ar5416InitCal(struct ath_hal *ah, const 
 	 * Try to make sure the above NF cal completes, just so
 	 * it doesn't clash with subsequent percals -adrian
 	 */
-	if (! ar5416WaitNfComplete(ah, 1000)) {
+	if (! ar5416WaitNfComplete(ah, 10000)) {
 		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did "
 		"not complete in time; noisy environment?\n", __func__);
 		return AH_FALSE;

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 14:29:55 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A2E11065678;
	Fri, 30 Jul 2010 14:29:55 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1EE628FC08;
	Fri, 30 Jul 2010 14:29:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UETt2j087354;
	Fri, 30 Jul 2010 14:29:55 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UETsmb087352;
	Fri, 30 Jul 2010 14:29:54 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301429.o6UETsmb087352@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 14:29:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210653 - user/adrian/if_ath_devel/sys/dev/ath
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 14:29:55 -0000

Author: adrian
Date: Fri Jul 30 14:29:54 2010
New Revision: 210653
URL: http://svn.freebsd.org/changeset/base/210653

Log:
  Don't delay updating the longcal timer - instead, update the longcal
  flag immediately so it's only set once per longcal interval.
  
  Without this, the current AR5416 code will continuously spam NF
  calibrations during a periodic calibration if the longcal flag
  is set. The longcal flag wouldn't be cleared until the calibration
  method indicates that calibrations are "complete".
  
  This drops the rate of NF calibration updates down from "once every
  shortcal" (ie, every 100ms) during a periodic calibration, to only
  once per "longcal" interval. Spamming NF calibrations every 100ms
  caused some potentially horrific issues in noisy environments as
  NF calibrations can take longer than 100ms and this spamming can
  cause invalid NF calibration results to be read back - leading to
  missed beacons, and thus leading to a stuck beacon situation.
  
  Stuck beacons cause interface resets, which restart calibrations.
  This means that the longcal calibration runs every 100ms (shortcal)
  until all initial calibrations are completed. This spamming can then
  cause the above issues which leads to stuck beacons, leading to
  interface resets, etc, etc. Quite annoying.
  
  This may be a temporary hack until I shoehorn more sensible calibration
  stuff into the AR5416 code. It shouldn't affect the other chipsets,
  they don't run a calibration FSM as complicated as AR5416.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/if_ath.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/if_ath.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/if_ath.c	Fri Jul 30 14:05:20 2010	(r210652)
+++ user/adrian/if_ath_devel/sys/dev/ath/if_ath.c	Fri Jul 30 14:29:54 2010	(r210653)
@@ -5421,6 +5421,7 @@ ath_calibrate(void *arg)
 	longCal = (ticks - sc->sc_lastlongcal >= ath_longcalinterval*hz);
 	if (longCal) {
 		sc->sc_stats.ast_per_cal++;
+		sc->sc_lastlongcal = ticks;
 		if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) {
 			/*
 			 * Rfgain is out of bounds, reset the chip
@@ -5469,7 +5470,6 @@ restart:
 			nextcal *= 10;
 	} else {
 		nextcal = ath_longcalinterval*hz;
-		sc->sc_lastlongcal = ticks;
 		if (sc->sc_lastcalreset == 0)
 			sc->sc_lastcalreset = sc->sc_lastlongcal;
 		else if (ticks - sc->sc_lastcalreset >= ath_resetcalinterval*hz)

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 14:53:26 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 28DA31065672;
	Fri, 30 Jul 2010 14:53:26 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 156F78FC08;
	Fri, 30 Jul 2010 14:53:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UErPxL092598;
	Fri, 30 Jul 2010 14:53:25 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UErPIm092596;
	Fri, 30 Jul 2010 14:53:25 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301453.o6UErPIm092596@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 14:53:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210655 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 14:53:26 -0000

Author: adrian
Date: Fri Jul 30 14:53:25 2010
New Revision: 210655
URL: http://svn.freebsd.org/changeset/base/210655

Log:
  Commit the AR5416 initvals from Linux-2.6.34. I've tested this in
  hostap mode.
  
  This unfortunately doesn't fix the issue where channel 11 leads
  to stuck beacons and thus interface resets in hostapd mode.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416.ini

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416.ini
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416.ini	Fri Jul 30 14:38:35 2010	(r210654)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416.ini	Fri Jul 30 14:53:25 2010	(r210655)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
- * Copyright (c) 2002-2008 Atheros Communications, Inc.
+ * Copyright (c) 2008-2009 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
@@ -24,29 +24,31 @@ static const uint32_t ar5416Modes[][6] =
     { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
     { 0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38, 0x00001180 },
     { 0x000010f0, 0x0000a000, 0x00014000, 0x00016000, 0x0000b000, 0x00014008 },
-    { 0x00008014, 0x03e803e8, 0x07d007d0, 0x10801080, 0x08400840, 0x06e006e0 },
+    { 0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00, 0x06e006e0 },
     { 0x0000801c, 0x128d93a7, 0x128d93cf, 0x12e013d7, 0x12e013ab, 0x098813cf },
+    { 0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810, 0x08f04810 },
+    { 0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a, 0x0000320a },
     { 0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300, 0x00000303 },
     { 0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, 0x02020200 },
     { 0x00009824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e },
     { 0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001 },
     { 0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e },
     { 0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0x00000007 },
-    { 0x00009844, 0x1372161e, 0x13721c1e, 0x13721c30, 0x137216a4, 0x13721c25 },
+    { 0x00009844, 0x1372161e, 0x1372161e, 0x137216a0, 0x137216a0, 0x137216a0 },
     { 0x00009848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 },
     { 0x0000a848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 },
     { 0x0000b848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 },
-    { 0x00009850, 0x6c28b4e0, 0x6c28b4e0, 0x6d68b0de, 0x6d68b0de, 0x6c28b0de },
+    { 0x00009850, 0x6c48b4e0, 0x6d48b4e0, 0x6d48b0de, 0x6c48b0de, 0x6c48b0de },
     { 0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e },
-    { 0x0000985c, 0x313a5d5e, 0x313a5d5e, 0x313a605e, 0x313a605e, 0x313a5d5e },
-    { 0x00009860, 0x00049d10, 0x00049d10, 0x00049d20, 0x00049d20, 0x00049d10 },
-    { 0x0000c864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 },
+    { 0x0000985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e, 0x31395d5e },
+    { 0x00009860, 0x00049d18, 0x00049d18, 0x00049d18, 0x00049d18, 0x00049d18 },
+    { 0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 },
     { 0x00009868, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 },
     { 0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 },
-    { 0x00009914, 0x000007d0, 0x000007d0, 0x00000898, 0x00000898, 0x000007d0 },
-    { 0x00009918, 0x000001b8, 0x00000370, 0x00000268, 0x00000134, 0x00000370 },
-    { 0x00009924, 0xd0058a0b, 0xd0058a0b, 0xd0058a19, 0xd0058a13, 0xd0058a0b },
-    { 0x00009944, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020 },
+    { 0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898, 0x000007d0 },
+    { 0x00009918, 0x000001b8, 0x00000370, 0x00000268, 0x00000134, 0x00000134 },
+    { 0x00009924, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b },
+    { 0x00009944, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020 },
 #ifdef TB243
     { 0x00009960, 0x00000900, 0x00000900, 0x00009b40, 0x00009b40, 0x00012d80 },
     { 0x0000a960, 0x00000900, 0x00000900, 0x00009b40, 0x00009b40, 0x00012d80 },
@@ -63,14 +65,16 @@ static const uint32_t ar5416Modes[][6] =
 #endif
 #endif
     { 0x0000c9bc, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00 },
+    { 0x00009964, 0x00000000, 0x00000000, 0x00001120, 0x00001120, 0x00001120 },
+    { 0x000099bc, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00 },
     { 0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be, 0x038919be },
     { 0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77 },
-    { 0x000099c8, 0x60f6532c, 0x60f6532c, 0x60f6532c, 0x60f6532c, 0x60f6532c },
+    { 0x000099c8, 0x6af6532c, 0x6af6532c, 0x6af6532c, 0x6af6532c, 0x6af6532c },
     { 0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8 },
     { 0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384, 0x00046384 },
     { 0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     { 0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
-    { 0x0000a204, 0x00000440, 0x00000440, 0x00000440, 0x00000440, 0x00000440 },
+    { 0x0000a204, 0x00000880, 0x00000880, 0x00000880, 0x00000880, 0x00000880 },
     { 0x0000a208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788, 0xd03e4788 },
     { 0x0000a20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 },
     { 0x0000b20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 },
@@ -219,7 +223,6 @@ static const uint32_t ar5416Common[][2] 
     { 0x00008110, 0x00000168 },
     { 0x00008118, 0x000100aa },
     { 0x0000811c, 0x00003210 },
-    { 0x00008120, 0x08f04800 },
     { 0x00008124, 0x00000000 },
     { 0x00008128, 0x00000000 },
     { 0x0000812c, 0x00000000 },
@@ -227,7 +230,7 @@ static const uint32_t ar5416Common[][2] 
     { 0x00008134, 0x00000000 },
     { 0x00008138, 0x00000000 },
     { 0x0000813c, 0x00000000 },
-    { 0x00008144, 0x00000000 },
+    { 0x00008144, 0xffffffff },
     { 0x00008168, 0x00000000 },
     { 0x0000816c, 0x00000000 },
     { 0x00008170, 0x32143320 },
@@ -235,7 +238,6 @@ static const uint32_t ar5416Common[][2] 
     { 0x00008178, 0x00000100 },
     { 0x0000817c, 0x00000000 },
     { 0x000081c4, 0x00000000 },
-    { 0x000081d0, 0x00003210 },
     { 0x000081ec, 0x00000000 },
     { 0x000081f0, 0x00000000 },
     { 0x000081f4, 0x00000000 },
@@ -266,6 +268,7 @@ static const uint32_t ar5416Common[][2] 
     { 0x00008258, 0x00000000 },
     { 0x0000825c, 0x400000ff },
     { 0x00008260, 0x00080922 },
+    { 0x00008264, 0xa8000010 },
     { 0x00008270, 0x00000000 },
     { 0x00008274, 0x40000000 },
     { 0x00008278, 0x003e4180 },
@@ -286,7 +289,7 @@ static const uint32_t ar5416Common[][2] 
     { 0x0000832c, 0x00000007 },
     { 0x00008330, 0x00000302 },
     { 0x00008334, 0x00000e00 },
-    { 0x00008338, 0x00000000 },
+    { 0x00008338, 0x00070000 },
     { 0x0000833c, 0x00000000 },
     { 0x00008340, 0x000107ff },
     { 0x00009808, 0x00000000 },
@@ -297,7 +300,7 @@ static const uint32_t ar5416Common[][2] 
     { 0x0000982c, 0x0000a000 },
     { 0x00009830, 0x00000000 },
     { 0x0000983c, 0x00200400 },
-    { 0x00009840, 0x206a016e },
+    { 0x00009840, 0x206a002e },
     { 0x0000984c, 0x1284233c },
     { 0x00009854, 0x00000859 },
     { 0x00009900, 0x00000000 },
@@ -319,7 +322,7 @@ static const uint32_t ar5416Common[][2] 
     { 0x00009958, 0x00081fff },
     { 0x0000c95c, 0x004b6a8e },
     { 0x0000c968, 0x000003ce },
-    { 0x00009970, 0x190c0514 },
+    { 0x00009970, 0x190fb515 },
     { 0x00009974, 0x00000000 },
     { 0x00009978, 0x00000001 },
     { 0x0000997c, 0x00000000 },
@@ -334,7 +337,7 @@ static const uint32_t ar5416Common[][2] 
     { 0x000099a0, 0x00000000 },
     { 0x000099a4, 0x00000001 },
     { 0x000099a8, 0x001fff00 },
-    { 0x000099ac, 0x000000c4 },
+    { 0x000099ac, 0x00000000 },
     { 0x000099b0, 0x03051000 },
     { 0x000099dc, 0x00000000 },
     { 0x000099e0, 0x00000200 },
@@ -426,9 +429,9 @@ static const uint32_t ar5416Common[][2] 
     { 0x0000a25c, 0x0f0f0f01 },
     { 0x0000a260, 0xdfa91f01 },
     { 0x0000a268, 0x00000000 },
-    { 0x0000a26c, 0x0ebae9c6 },
-    { 0x0000b26c, 0x0ebae9c6 },
-    { 0x0000c26c, 0x0ebae9c6 },
+    { 0x0000a26c, 0x0e79e5c6 },
+    { 0x0000b26c, 0x0e79e5c6 },
+    { 0x0000c26c, 0x0e79e5c6 },
     { 0x0000d270, 0x00820820 },
     { 0x0000a278, 0x1ce739ce },
     { 0x0000a27c, 0x051701ce },
@@ -441,15 +444,15 @@ static const uint32_t ar5416Common[][2] 
     { 0x0000a350, 0x3fffffff },
     { 0x0000a354, 0x0003ffff },
     { 0x0000a358, 0x79a8aa1f },
-    { 0x0000d35c, 0x066c420f },
-    { 0x0000d360, 0x0f282207 },
-    { 0x0000d364, 0x17601685 },
-    { 0x0000d368, 0x1f801104 },
-    { 0x0000d36c, 0x37a00c03 },
-    { 0x0000d370, 0x3fc40883 },
-    { 0x0000d374, 0x57c00803 },
-    { 0x0000d378, 0x5fd80682 },
-    { 0x0000d37c, 0x7fe00482 },
+    { 0x0000d35c, 0x07ffffef },
+    { 0x0000d360, 0x0fffffe7 },
+    { 0x0000d364, 0x17ffffe5 },
+    { 0x0000d368, 0x1fffffe4 },
+    { 0x0000d36c, 0x37ffffe3 },
+    { 0x0000d370, 0x3fffffe3 },
+    { 0x0000d374, 0x57ffffe3 },
+    { 0x0000d378, 0x5fffffe2 },
+    { 0x0000d37c, 0x7fffffe2 },
     { 0x0000d380, 0x7f3c7bba },
     { 0x0000d384, 0xf3307ff0 },
     { 0x0000a388, 0x08000000 },
@@ -625,8 +628,8 @@ static const uint32_t ar5416Bank6[][3] =
     { 0x0000989c, 0x00dc0000, 0x00dc0000 },
     { 0x0000989c, 0x00110000, 0x00110000 },
     { 0x0000989c, 0x006100a8, 0x006100a8 },
-    { 0x0000989c, 0x00421022, 0x00421022 },
-    { 0x0000989c, 0x001400df, 0x001400df },
+    { 0x0000989c, 0x00423022, 0x00423022 },
+    { 0x0000989c, 0x201400df, 0x201400df },
     { 0x0000989c, 0x00c40002, 0x00c40002 },
     { 0x0000989c, 0x003000f2, 0x003000f2 },
     { 0x0000989c, 0x00440016, 0x00440016 },
@@ -634,7 +637,7 @@ static const uint32_t ar5416Bank6[][3] =
     { 0x0000989c, 0x0001805e, 0x0001805e },
     { 0x0000989c, 0x0000c0ab, 0x0000c0ab },
     { 0x0000989c, 0x000000e1, 0x000000e1 },
-    { 0x0000989c, 0x00002081, 0x00002081 },
+    { 0x0000989c, 0x00007081, 0x00007081 },
     { 0x0000989c, 0x000000d4, 0x000000d4 },
     { 0x000098d0, 0x0000000f, 0x0010000f },
 };
@@ -684,7 +687,7 @@ static const uint32_t ar5416Addac[][2] =
     {0x0000989c,  0x00000000 },
     {0x0000989c,  0x00000000 },
     {0x0000989c,  0x00000000 },
-    {0x000098c4,  0x00000000 },
+    {0x000098cc,  0x00000000 },
 };
 
 /* hand-crafted from code that does explicit register writes */

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 15:36:57 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A85C31065670;
	Fri, 30 Jul 2010 15:36:57 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 96ACC8FC08;
	Fri, 30 Jul 2010 15:36:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UFavjt002327;
	Fri, 30 Jul 2010 15:36:57 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UFavSf002325;
	Fri, 30 Jul 2010 15:36:57 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301536.o6UFavSf002325@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 15:36:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210657 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 15:36:57 -0000

Author: adrian
Date: Fri Jul 30 15:36:57 2010
New Revision: 210657
URL: http://svn.freebsd.org/changeset/base/210657

Log:
  Don't perform any periodic or longcal calibrations if a noise floor (NF)
  calibration is in progress. Scheduling any kind of calibration whilst another
  is pending is a big no-no.
  
  This should fix the issue of periodic calibrations being performed during
  NF calibrations but it doesn't stop NF calibrations being scheduled during
  a periodic calibration. That'll come next.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 15:25:57 2010	(r210656)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 15:36:57 2010	(r210657)
@@ -406,6 +406,30 @@ ar5416PerCalibrationN(struct ath_hal *ah
 
 	OS_MARK(ah, AH_MARK_PERCAL, chan->ic_freq);
 
+	/*
+	 * Don't do any of these calibrations if there's a NF
+	 * calibration in progress. Long calibration will try to program
+	 * the CCA registers and kick another NF calibration ; periodic
+	 * calibrations shouldn't be occuring during a NF calibration.
+	 */
+	if (ar5416IsNFCalInProgress(ah)) {
+		HALDEBUG(ah, HAL_DEBUG_ANY,
+		    "%s: NF calibration in-progress; skipping\n",
+		    __func__);
+
+		/*
+		 * Is there a percal in progress? Return
+		 * "not-done" so we're re-prodded very soon.
+		 */
+		if (currCal && ((currCal->calState == CAL_WAITING) ||
+		    (currCal->calState == CAL_RUNNING)))
+			*isCalDone = AH_FALSE;
+		else
+			*isCalDone = AH_TRUE;
+
+		return AH_TRUE;
+	}
+
 	*isCalDone = AH_TRUE;
 
 	/*

From owner-svn-src-user@FreeBSD.ORG  Fri Jul 30 15:56:01 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 089631065678;
	Fri, 30 Jul 2010 15:56:01 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D0C138FC18;
	Fri, 30 Jul 2010 15:56:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6UFu0Ws006530;
	Fri, 30 Jul 2010 15:56:00 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UFu0LM006528;
	Fri, 30 Jul 2010 15:56:00 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201007301556.o6UFu0LM006528@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Fri, 30 Jul 2010 15:56:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210658 -
	user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jul 2010 15:56:01 -0000

Author: adrian
Date: Fri Jul 30 15:56:00 2010
New Revision: 210658
URL: http://svn.freebsd.org/changeset/base/210658

Log:
  Fix the NF calibration to only occur if a periodic calibration is not
  in progress.
  
  Since I've also seen periodic calibrations take forever (as in, up
  to an hour to do the 64 samples needed for a percal), longcal may
  never get set during a time where there isn't an in-progress percal.
  
  To avoid this, perform a longcal immediately after the last successful
  periodic calibration sample is read. There shouldn't be any further
  periodic calibrations performed if *isCalDone is set to AH_TRUE.
  This means that there'll be at least one NF calibration and sample
  done at the end of each periodic calibration.
  
  I'm not sure whether a NF sample and/or calibration can be taken in
  between calibration samples (whether it'll upset the calibration
  process, which I don't have any documentation on atm) so I'm not
  interleaving NF and periodic calibration sampling.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 15:36:57 2010	(r210657)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 15:56:00 2010	(r210658)
@@ -470,8 +470,26 @@ ar5416PerCalibrationN(struct ath_hal *ah
 		}
 	}
 
-	/* Do NF cal only at longer intervals */
-	if (longcal) {
+	/*
+	 * NF calibration can only be done if there's no in-progress periodic
+	 * calibration.
+	 *
+	 * To ensure it happens, an NF calibration is done at the end of the
+	 * periodic calibration run. That way if the periodic calibrations are
+	 * taking too long to run and prevent the "longcal" tick from actually
+	 * performing a successful NF calibration, the noise floor values still
+	 * get updated.
+	 */
+
+	/* Do NF cal only at longer intervals or at the end of a successful percal */
+	/*
+	 * XXX I don't know if there's some minimum delay between completing a percal
+	 * XXX and beginning a NF calibration. -adrian
+	 */
+	if ((*isCalDone == AH_TRUE) ||
+	    (longcal && currCal == AH_NULL) ||
+	    (longcal && currCal != AH_NULL &&
+		(currCal->calState == CAL_WAITING || currCal->calState == CAL_DONE))) {
 		/*
 		 * Get the value from the previous NF cal
 		 * and update the history buffer.

From owner-svn-src-user@FreeBSD.ORG  Sat Jul 31 23:15:51 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE94C106566C;
	Sat, 31 Jul 2010 23:15:51 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ADE168FC14;
	Sat, 31 Jul 2010 23:15:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6VNFpbw023514;
	Sat, 31 Jul 2010 23:15:51 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6VNFpgj023512;
	Sat, 31 Jul 2010 23:15:51 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201007312315.o6VNFpgj023512@svn.freebsd.org>
From: Doug Barton <dougb@FreeBSD.org>
Date: Sat, 31 Jul 2010 23:15:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r210705 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 31 Jul 2010 23:15:51 -0000

Author: dougb
Date: Sat Jul 31 23:15:51 2010
New Revision: 210705
URL: http://svn.freebsd.org/changeset/base/210705

Log:
  Make parse_index() more forgiving of PORTSDIR != /usr/ports

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sat Jul 31 21:35:15 2010	(r210704)
+++ user/dougb/portmaster/portmaster	Sat Jul 31 23:15:51 2010	(r210705)
@@ -1020,11 +1020,9 @@ init_packages_var () {
 }
 
 parse_index () {
-	local pd line
+	local line
 
-	[ -z "$pd" -a -n "$PM_INDEX_ONLY" ] && pd=/usr/ports
-
-	line=`grep -m1 .*\|${pd}/${1}\|.* $PM_INDEX` || return 1
+	line=`grep -m1 .*\|.*/${1}\|.* $PM_INDEX` || return 1
 
 	case "$2" in
 	name)		echo ${line%%|*} ;;