From owner-svn-src-stable-6@FreeBSD.ORG Mon Nov 2 16:25:15 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81D421065694; Mon, 2 Nov 2009 16:25:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F97D8FC18; Mon, 2 Nov 2009 16:25:15 +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 nA2GPFpC062535; Mon, 2 Nov 2009 16:25:15 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA2GPF3U062533; Mon, 2 Nov 2009 16:25:15 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200911021625.nA2GPF3U062533@svn.freebsd.org> From: Ed Maste Date: Mon, 2 Nov 2009 16:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198801 - in stable/6/sys: . conf contrib/pf dev/aac dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 16:25:15 -0000 Author: emaste Date: Mon Nov 2 16:25:15 2009 New Revision: 198801 URL: http://svn.freebsd.org/changeset/base/198801 Log: MFC r198541: Do first controller time sync after 1 minute, as in Adaptec's vendor driver. Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/aac/aac.c stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/dev/aac/aac.c ============================================================================== --- stable/6/sys/dev/aac/aac.c Mon Nov 2 16:25:00 2009 (r198800) +++ stable/6/sys/dev/aac/aac.c Mon Nov 2 16:25:15 2009 (r198801) @@ -354,7 +354,7 @@ aac_attach(struct aac_softc *sc) } mtx_lock(&sc->aac_io_lock); - callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc); + callout_reset(&sc->aac_daemontime, 60 * hz, aac_daemon, sc); mtx_unlock(&sc->aac_io_lock); return(0); From owner-svn-src-stable-6@FreeBSD.ORG Mon Nov 2 16:29:54 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B40CB106566C; Mon, 2 Nov 2009 16:29:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1FA68FC1F; Mon, 2 Nov 2009 16:29:54 +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 nA2GTsMY062782; Mon, 2 Nov 2009 16:29:54 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA2GTsmw062780; Mon, 2 Nov 2009 16:29:54 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200911021629.nA2GTsmw062780@svn.freebsd.org> From: Ed Maste Date: Mon, 2 Nov 2009 16:29:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198804 - in stable/6/usr.sbin/ntp: . doc X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 16:29:54 -0000 Author: emaste Date: Mon Nov 2 16:29:54 2009 New Revision: 198804 URL: http://svn.freebsd.org/changeset/base/198804 Log: MFC r198029: Correct typo: thetime -> the time PR: docs/139447 Submitted by: Guido Falsi mad at madpilot dot net Modified: stable/6/usr.sbin/ntp/ (props changed) stable/6/usr.sbin/ntp/doc/ (props changed) stable/6/usr.sbin/ntp/doc/ntpd.8 Modified: stable/6/usr.sbin/ntp/doc/ntpd.8 ============================================================================== --- stable/6/usr.sbin/ntp/doc/ntpd.8 Mon Nov 2 16:29:04 2009 (r198803) +++ stable/6/usr.sbin/ntp/doc/ntpd.8 Mon Nov 2 16:29:54 2009 (r198804) @@ -120,7 +120,7 @@ Normally, .Nm exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. -This option allows thetime to be set to any value without restriction; +This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, .Nm From owner-svn-src-stable-6@FreeBSD.ORG Mon Nov 2 16:49:57 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59BC91065694; Mon, 2 Nov 2009 16:49:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4712A8FC17; Mon, 2 Nov 2009 16:49: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 nA2Gnvr5063382; Mon, 2 Nov 2009 16:49:57 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA2GnvkY063380; Mon, 2 Nov 2009 16:49:57 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200911021649.nA2GnvkY063380@svn.freebsd.org> From: Ed Maste Date: Mon, 2 Nov 2009 16:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198808 - in stable/6/sys: . boot/i386/libi386 conf contrib/pf dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 16:49:57 -0000 Author: emaste Date: Mon Nov 2 16:49:57 2009 New Revision: 198808 URL: http://svn.freebsd.org/changeset/base/198808 Log: MFC r197082: If the pxe client is told to use / as the root path, honour that rather of trying to mount /pxeroot instead. PR: i386/106493 Submitted by: Andrey Russev Modified: stable/6/sys/ (props changed) stable/6/sys/boot/i386/libi386/pxe.c stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/boot/i386/libi386/pxe.c ============================================================================== --- stable/6/sys/boot/i386/libi386/pxe.c Mon Nov 2 16:46:53 2009 (r198807) +++ stable/6/sys/boot/i386/libi386/pxe.c Mon Nov 2 16:49:57 2009 (r198808) @@ -282,7 +282,7 @@ pxe_open(struct open_file *f, ...) bootp(pxe_sock, BOOTP_PXE); if (rootip.s_addr == 0) rootip.s_addr = bootplayer.sip; - if (!rootpath[1]) + if (!rootpath[0]) strcpy(rootpath, PXENFSROOTPATH); for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) From owner-svn-src-stable-6@FreeBSD.ORG Mon Nov 2 19:01:20 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 632EE106566B; Mon, 2 Nov 2009 19:01:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 507228FC12; Mon, 2 Nov 2009 19:01:20 +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 nA2J1K0r066730; Mon, 2 Nov 2009 19:01:20 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA2J1K8b066728; Mon, 2 Nov 2009 19:01:20 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200911021901.nA2J1K8b066728@svn.freebsd.org> From: Ed Maste Date: Mon, 2 Nov 2009 19:01:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198817 - in stable/6/sys: . conf contrib/pf dev/aac dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 19:01:20 -0000 Author: emaste Date: Mon Nov 2 19:01:20 2009 New Revision: 198817 URL: http://svn.freebsd.org/changeset/base/198817 Log: MFC r197011: Increase AAC_CMD_TIMEOUT from 30s to 120s to help avoid spurious "COMMAND 0x........ TIMEOUT AFTER .. SECONDS" messages. Any commands that get truly stuck will still trigger the warning and the hardware health check, just a little bit later. Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/aac/aacvar.h stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/dev/aac/aacvar.h ============================================================================== --- stable/6/sys/dev/aac/aacvar.h Mon Nov 2 18:51:24 2009 (r198816) +++ stable/6/sys/dev/aac/aacvar.h Mon Nov 2 19:01:20 2009 (r198817) @@ -88,7 +88,7 @@ /* * Timeout for normal commands */ -#define AAC_CMD_TIMEOUT 30 /* seconds */ +#define AAC_CMD_TIMEOUT 120 /* seconds */ /* * Rate at which we periodically check for timed out commands and kick the From owner-svn-src-stable-6@FreeBSD.ORG Wed Nov 4 10:47:05 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A85E91065759; Wed, 4 Nov 2009 10:47:03 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0438FC15; Wed, 4 Nov 2009 10:47:03 +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 nA4Al38v028820; Wed, 4 Nov 2009 10:47:03 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA4Al2Pe028816; Wed, 4 Nov 2009 10:47:02 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200911041047.nA4Al2Pe028816@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 4 Nov 2009 10:47:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198879 - stable/6/share/zoneinfo X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2009 10:47:05 -0000 Author: edwin Date: Wed Nov 4 10:47:02 2009 New Revision: 198879 URL: http://svn.freebsd.org/changeset/base/198879 Log: MFC of r198825: tzdata2009q - New region: Asia/Novokuznetsk - Kemerovo oblast' (Kemerovo region) in Russia will change current time zone on 29 March 2010 - Add historical data for Hongkong 1941 - 1980 - Syria will go to winter time in the last weekend of October 2009. Modified: stable/6/share/zoneinfo/asia stable/6/share/zoneinfo/europe stable/6/share/zoneinfo/zone.tab Directory Properties: stable/6/share/zoneinfo/ (props changed) Modified: stable/6/share/zoneinfo/asia ============================================================================== --- stable/6/share/zoneinfo/asia Wed Nov 4 10:46:55 2009 (r198878) +++ stable/6/share/zoneinfo/asia Wed Nov 4 10:47:02 2009 (r198879) @@ -1,5 +1,4 @@ -#
-# @(#)asia	8.42
+# @(#)asia	8.44
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -369,14 +368,84 @@ Zone	Asia/Kashgar	5:03:56	-	LMT	1928 # o
 			5:00	-	KAST	1980 May
 			8:00	PRC	C%sT
 
+
+# From Lee Yiu Chung (2009-10-24):
+# I found there are some mistakes for the historial DST rule for Hong
+# Kong. Accoring to the DST record from Hong Kong Observatory (actually,
+# it is not [an] observatory, but the official meteorological agency of HK,
+# and also serves as the official timing agency), there are some missing
+# and incorrect rules. Although the exact switch over time is missing, I
+# think 3:30 is correct. The official DST record for Hong Kong can be
+# obtained from
+# 
+# http://www.hko.gov.hk/gts/time/Summertime.htm
+# .
+
+# From Arthur David Olson (2009-10-28):
+# Here are the dates given at
+# 
+# http://www.hko.gov.hk/gts/time/Summertime.htm
+# 
+# as of 2009-10-28:
+# Year        Period
+# 1941        1 Apr to 30 Sep
+# 1942        Whole year 
+# 1943        Whole year
+# 1944        Whole year
+# 1945        Whole year
+# 1946        20 Apr to 1 Dec
+# 1947        13 Apr to 30 Dec
+# 1948        2 May to 31 Oct
+# 1949        3 Apr to 30 Oct
+# 1950        2 Apr to 29 Oct
+# 1951        1 Apr to 28 Oct
+# 1952        6 Apr to 25 Oct
+# 1953        5 Apr to 1 Nov
+# 1954        21 Mar to 31 Oct
+# 1955        20 Mar to 6 Nov
+# 1956        18 Mar to 4 Nov
+# 1957        24 Mar to 3 Nov
+# 1958        23 Mar to 2 Nov
+# 1959        22 Mar to 1 Nov
+# 1960        20 Mar to 6 Nov
+# 1961        19 Mar to 5 Nov
+# 1962        18 Mar to 4 Nov
+# 1963        24 Mar to 3 Nov
+# 1964        22 Mar to 1 Nov
+# 1965        18 Apr to 17 Oct
+# 1966        17 Apr to 16 Oct
+# 1967        16 Apr to 22 Oct
+# 1968        21 Apr to 20 Oct
+# 1969        20 Apr to 19 Oct
+# 1970        19 Apr to 18 Oct
+# 1971        18 Apr to 17 Oct
+# 1972        16 Apr to 22 Oct
+# 1973        22 Apr to 21 Oct
+# 1973/74     30 Dec 73 to 20 Oct 74
+# 1975        20 Apr to 19 Oct
+# 1976        18 Apr to 17 Oct
+# 1977        Nil
+# 1978        Nil
+# 1979        13 May to 21 Oct
+# 1980 to Now Nil
+# The page does not give start or end times of day.
+# The page does not give a start date for 1942.
+# The page does not givw an end date for 1945.
+# The Japanese occupation of Hong Kong began on 1941-12-25.
+# The Japanese surrender of Hong Kong was signed 1945-09-15.
+# For lack of anything better, use start of those days as the transition times.
+
 # Hong Kong (Xianggang)
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	HK	1941	only	-	Apr	1	3:30	1:00	S
+Rule	HK	1941	only	-	Sep	30	3:30	0	-
 Rule	HK	1946	only	-	Apr	20	3:30	1:00	S
 Rule	HK	1946	only	-	Dec	1	3:30	0	-
 Rule	HK	1947	only	-	Apr	13	3:30	1:00	S
 Rule	HK	1947	only	-	Dec	30	3:30	0	-
 Rule	HK	1948	only	-	May	2	3:30	1:00	S
-Rule	HK	1948	1952	-	Oct	lastSun	3:30	0	-
+Rule	HK	1948	1951	-	Oct	lastSun	3:30	0	-
+Rule	HK	1952	only	-	Oct	25	3:30	0	-
 Rule	HK	1949	1953	-	Apr	Sun>=1	3:30	1:00	S
 Rule	HK	1953	only	-	Nov	1	3:30	0	-
 Rule	HK	1954	1964	-	Mar	Sun>=18	3:30	1:00	S
@@ -384,13 +453,15 @@ Rule	HK	1954	only	-	Oct	31	3:30	0	-
 Rule	HK	1955	1964	-	Nov	Sun>=1	3:30	0	-
 Rule	HK	1965	1977	-	Apr	Sun>=16	3:30	1:00	S
 Rule	HK	1965	1977	-	Oct	Sun>=16	3:30	0	-
-Rule	HK	1979	1980	-	May	Sun>=8	3:30	1:00	S
-Rule	HK	1979	1980	-	Oct	Sun>=16	3:30	0	-
+Rule	HK	1973	only	-	Dec	30	3:30	1:00	S
+Rule	HK	1979	only	-	May	Sun>=8	3:30	1:00	S
+Rule	HK	1979	only	-	Oct	Sun>=16	3:30	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Hong_Kong	7:36:36 -	LMT	1904 Oct 30
+			8:00	HK	HK%sT	1941 Dec 25
+			9:00	-	JST	1945 Sep 15
 			8:00	HK	HK%sT
 
-
 ###############################################################################
 
 # Taiwan
@@ -2236,9 +2307,23 @@ Rule	Syria	2007	only	-	Nov	 Fri>=1	0:00	
 # http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
 # 
 
+# From Steffen Thorsen (2009-10-27):
+# The Syrian Arab News Network on 2009-09-29 reported that Syria will 
+# revert back to winter (standard) time on midnight between Thursday 
+# 2009-10-29 and Friday 2009-10-30:
+# 
+# http://www.sana.sy/ara/2/2009/09/29/247012.htm (Arabic)
+# 
+
+# From Arthur David Olson (2009-10-28):
+# We'll see if future DST switching times turn out to be end of the last
+# Thursday of the month or the start of the last Friday of the month or
+# something else. For now, use the start of the last Friday.
+
 Rule	Syria	2008	only	-	Apr	Fri>=1	0:00	1:00	S
-Rule	Syria	2008	max	-	Nov	1	0:00	0	-
+Rule	Syria	2008	only	-	Nov	1	0:00	0	-
 Rule	Syria	2009	max	-	Mar	lastFri	0:00	1:00	S
+Rule	Syria	2009	max	-	Oct	lastFri	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Damascus	2:25:12 -	LMT	1920	# Dimashq

Modified: stable/6/share/zoneinfo/europe
==============================================================================
--- stable/6/share/zoneinfo/europe	Wed Nov  4 10:46:55 2009	(r198878)
+++ stable/6/share/zoneinfo/europe	Wed Nov  4 10:47:02 2009	(r198879)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.22
+# @(#)europe	8.24
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2072,9 +2072,43 @@ Zone Asia/Novosibirsk	 5:31:40 -	LMT	191
 			 6:00	Russia	NOV%sT	1992 Jan 19 2:00s
 			 7:00	Russia	NOV%sT	1993 May 23 # say Shanks & P.
 			 6:00	Russia	NOV%sT
+
+# From Alexander Krivenyshev (2009-10-13):
+# Kemerovo oblast' (Kemerovo region) in Russia will change current time zone on
+# March 28, 2010:
+# from current Russia Zone 6 - Krasnoyarsk Time Zone (KRA) UTC +0700
+# to Russia Zone 5 - Novosibirsk Time Zone (NOV) UTC +0600
+#
+# This is according to Government of Russia decree # 740, on September
+# 14, 2009 "Application in the territory of the Kemerovo region the Fifth
+# time zone." ("Russia Zone 5" or old "USSR Zone 5" is GMT +0600)
+#
+# Russian Government web site (Russian language)
+# 
+# http://www.government.ru/content/governmentactivity/rfgovernmentdecisions/archive/2009/09/14/991633.htm
+# 
+# or Russian-English translation by WorldTimeZone.com with reference
+# map to local region and new Russia Time Zone map after March 28, 2010
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_russia03.html
+# 
+#
+# Thus, when Russia will switch to DST on the night of March 28, 2010
+# Kemerovo region (Kemerovo oblast') will not change the clock.
+#
+# As a result, Kemerovo oblast' will be in the same time zone as
+# Novosibirsk, Omsk, Tomsk, Barnaul and Altai Republic.
+
+Zone Asia/Novokuznetsk	 5:48:48 -	NMT	1920 Jan  6
+			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
+			 7:00	Russia	KRA%sT	1991 Mar 31 2:00s
+			 6:00	Russia	KRA%sT	1992 Jan 19 2:00s
+			 7:00	Russia	KRA%sT	2010 Mar 28 2:00s
+			 6:00	Russia	NOV%sT # Novosibirsk/Novokuznetsk Time
+
 #
 # From Oscar van Vlijmen (2001-08-25): [This region consists of]
-# Kemerovskaya oblast', Krasnoyarskij kraj,
+# Krasnoyarskij kraj,
 # Tajmyrskij (Dolgano-Nenetskij) avtonomnyj okrug,
 # Respublika Tuva, Respublika Khakasiya, Evenkijskij avtonomnyj okrug.
 Zone Asia/Krasnoyarsk	 6:11:20 -	LMT	1920 Jan  6

Modified: stable/6/share/zoneinfo/zone.tab
==============================================================================
--- stable/6/share/zoneinfo/zone.tab	Wed Nov  4 10:46:55 2009	(r198878)
+++ stable/6/share/zoneinfo/zone.tab	Wed Nov  4 10:47:02 2009	(r198879)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.28
+# @(#)zone.tab	8.29
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -330,6 +330,7 @@ RU	+5312+05009	Europe/Samara	Moscow+01 -
 RU	+5651+06036	Asia/Yekaterinburg	Moscow+02 - Urals
 RU	+5500+07324	Asia/Omsk	Moscow+03 - west Siberia
 RU	+5502+08255	Asia/Novosibirsk	Moscow+03 - Novosibirsk
+RU	+5345+08707	Asia/Novokuznetsk	Moscow+03 - Novokuznetsk
 RU	+5601+09250	Asia/Krasnoyarsk	Moscow+04 - Yenisei River
 RU	+5216+10420	Asia/Irkutsk	Moscow+05 - Lake Baikal
 RU	+6200+12940	Asia/Yakutsk	Moscow+06 - Lena River

From owner-svn-src-stable-6@FreeBSD.ORG  Wed Nov  4 12:43:33 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93F67106566C;
	Wed,  4 Nov 2009 12:43:33 +0000 (UTC)
	(envelope-from brueffer@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 81DD18FC1D;
	Wed,  4 Nov 2009 12:43:33 +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 nA4ChWds031806;
	Wed, 4 Nov 2009 12:43:32 GMT (envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA4ChWQi031804;
	Wed, 4 Nov 2009 12:43:32 GMT (envelope-from brueffer@svn.freebsd.org)
Message-Id: <200911041243.nA4ChWQi031804@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 4 Nov 2009 12:43:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198883 - stable/6/sys/dev/amr
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 04 Nov 2009 12:43:33 -0000

Author: brueffer
Date: Wed Nov  4 12:43:31 2009
New Revision: 198883
URL: http://svn.freebsd.org/changeset/base/198883

Log:
  MFC: r198546
  
  Remove spurious `)`

Modified:
  stable/6/sys/dev/amr/amr.c
Directory Properties:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/dev/amr/amr.c
==============================================================================
--- stable/6/sys/dev/amr/amr.c	Wed Nov  4 12:38:21 2009	(r198882)
+++ stable/6/sys/dev/amr/amr.c	Wed Nov  4 12:43:31 2009	(r198883)
@@ -229,7 +229,7 @@ amr_attach(struct amr_softc *sc)
     }
 
 #ifdef AMR_BOARD_INIT
-    if ((AMR_IS_QUARTZ(sc) ? amr_quartz_init(sc) : amr_std_init(sc))))
+    if ((AMR_IS_QUARTZ(sc) ? amr_quartz_init(sc) : amr_std_init(sc)))
 	return(ENXIO);
 #endif
 

From owner-svn-src-stable-6@FreeBSD.ORG  Wed Nov  4 13:41:43 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 903251065670;
	Wed,  4 Nov 2009 13:41:43 +0000 (UTC)
	(envelope-from brueffer@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E1938FC1A;
	Wed,  4 Nov 2009 13:41:43 +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 nA4DfhQ1033322;
	Wed, 4 Nov 2009 13:41:43 GMT (envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA4DfhNq033320;
	Wed, 4 Nov 2009 13:41:43 GMT (envelope-from brueffer@svn.freebsd.org)
Message-Id: <200911041341.nA4DfhNq033320@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 4 Nov 2009 13:41:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198890 - stable/6/lib/libstand
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 04 Nov 2009 13:41:43 -0000

Author: brueffer
Date: Wed Nov  4 13:41:43 2009
New Revision: 198890
URL: http://svn.freebsd.org/changeset/base/198890

Log:
  MFC: 198542
  
  Initialize f_rabuf in the raw device case. A subsequent close()
  later on would try to free it, leading to a crash.

Modified:
  stable/6/lib/libstand/open.c
Directory Properties:
  stable/6/lib/libstand/   (props changed)

Modified: stable/6/lib/libstand/open.c
==============================================================================
--- stable/6/lib/libstand/open.c	Wed Nov  4 13:40:50 2009	(r198889)
+++ stable/6/lib/libstand/open.c	Wed Nov  4 13:41:43 2009	(r198890)
@@ -117,6 +117,7 @@ open(const char *fname, int mode)
     /* see if we opened a raw device; otherwise, 'file' is the file name. */
     if (file == (char *)0 || *file == '\0') {
 	f->f_flags |= F_RAW;
+	f->f_rabuf = NULL;
 	return (fd);
     }
 

From owner-svn-src-stable-6@FreeBSD.ORG  Thu Nov  5 02:31:10 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E6E82106566C;
	Thu,  5 Nov 2009 02:31:10 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D500E8FC13;
	Thu,  5 Nov 2009 02:31:10 +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 nA52VADW054482;
	Thu, 5 Nov 2009 02:31:10 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA52VAAW054480;
	Thu, 5 Nov 2009 02:31:10 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200911050231.nA52VAAW054480@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 5 Nov 2009 02:31:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198937 - stable/6/usr.bin/gcore
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 05 Nov 2009 02:31:11 -0000

Author: emaste
Date: Thu Nov  5 02:31:10 2009
New Revision: 198937
URL: http://svn.freebsd.org/changeset/base/198937

Log:
  MFC r197437:
  
    Use %zu for size_t, not %zd.

Modified:
  stable/6/usr.bin/gcore/elfcore.c
Directory Properties:
  stable/6/usr.bin/gcore/   (props changed)

Modified: stable/6/usr.bin/gcore/elfcore.c
==============================================================================
--- stable/6/usr.bin/gcore/elfcore.c	Thu Nov  5 02:29:45 2009	(r198936)
+++ stable/6/usr.bin/gcore/elfcore.c	Thu Nov  5 02:31:10 2009	(r198937)
@@ -158,7 +158,7 @@ elf_coredump(int efd __unused, int fd, p
 				err(1, "read from %s", memname);
 			if ((size_t)ngot < nwant)
 				errx(1, "short read from %s:"
-				    " wanted %zd, got %zd", memname,
+				    " wanted %zu, got %zd", memname,
 				    nwant, ngot);
 			ngot = write(fd, buf, nwant);
 			if (ngot == -1)
@@ -414,7 +414,7 @@ readhdrinfo(pid_t pid, prstatus_t *statu
 	if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
 		err(1, "read error from %s", name);
 	if ((size_t)n < sizeof(status->pr_reg))
-		errx(1, "short read from %s: wanted %zd, got %d", name,
+		errx(1, "short read from %s: wanted %zu, got %d", name,
 		    sizeof status->pr_reg, n);
 	close(fd);
 
@@ -425,7 +425,7 @@ readhdrinfo(pid_t pid, prstatus_t *statu
 	if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
 		err(1, "read error from %s", name);
 	if ((size_t)n < sizeof(*fpregset))
-		errx(1, "short read from %s: wanted %zd, got %d", name,
+		errx(1, "short read from %s: wanted %zu, got %d", name,
 		    sizeof *fpregset, n);
 	close(fd);
 

From owner-svn-src-stable-6@FreeBSD.ORG  Fri Nov  6 07:02:16 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E30A106568F;
	Fri,  6 Nov 2009 07:02:16 +0000 (UTC)
	(envelope-from brueffer@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C5008FC17;
	Fri,  6 Nov 2009 07:02:16 +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 nA672G7Z006192;
	Fri, 6 Nov 2009 07:02:16 GMT (envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA672GFe006190;
	Fri, 6 Nov 2009 07:02:16 GMT (envelope-from brueffer@svn.freebsd.org)
Message-Id: <200911060702.nA672GFe006190@svn.freebsd.org>
From: Christian Brueffer 
Date: Fri, 6 Nov 2009 07:02:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198972 - stable/6/sys/dev/aic7xxx
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 06 Nov 2009 07:02:16 -0000

Author: brueffer
Date: Fri Nov  6 07:02:16 2009
New Revision: 198972
URL: http://svn.freebsd.org/changeset/base/198972

Log:
  MFC: r198684
  
  Add support for Adaptec 39320LPE adapters.

Modified:
  stable/6/sys/dev/aic7xxx/aic79xx_pci.c
Directory Properties:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/dev/aic7xxx/aic79xx_pci.c
==============================================================================
--- stable/6/sys/dev/aic7xxx/aic79xx_pci.c	Fri Nov  6 06:57:03 2009	(r198971)
+++ stable/6/sys/dev/aic7xxx/aic79xx_pci.c	Fri Nov  6 07:02:16 2009	(r198972)
@@ -89,6 +89,7 @@ ahd_compose_id(u_int device, u_int vendo
 #define ID_AHA_39320D_B			0x801C900500419005ull
 #define ID_AHA_39320D_HP		0x8011900500AC0E11ull
 #define ID_AHA_39320D_B_HP		0x801C900500AC0E11ull
+#define ID_AHA_39320LPE 		0x8017900500459005ull
 #define ID_AIC7902_PCI_REV_A4		0x3
 #define ID_AIC7902_PCI_REV_B0		0x10
 #define SUBID_HP			0x0E11
@@ -204,6 +205,12 @@ struct ahd_pci_identity ahd_pci_ident_ta
 		"Adaptec (HP OEM) 39320D Ultra320 SCSI adapter",
 		ahd_aic7902_setup
 	},
+	{
+		ID_AHA_39320LPE,
+		ID_ALL_MASK,
+		"Adaptec 39320LPE Ultra320 SCSI adapter",
+		ahd_aic7902_setup
+	},
 	/* Generic chip probes for devices we don't know 'exactly' */
 	{
 		ID_AIC7901 & ID_9005_GENERIC_MASK,

From owner-svn-src-stable-6@FreeBSD.ORG  Fri Nov  6 17:11:58 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9E17106568F;
	Fri,  6 Nov 2009 17:11:58 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A715A8FC14;
	Fri,  6 Nov 2009 17:11:58 +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 nA6HBwHR023274;
	Fri, 6 Nov 2009 17:11:58 GMT (envelope-from ambrisko@svn.freebsd.org)
Received: (from ambrisko@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA6HBwJv023271;
	Fri, 6 Nov 2009 17:11:58 GMT (envelope-from ambrisko@svn.freebsd.org)
Message-Id: <200911061711.nA6HBwJv023271@svn.freebsd.org>
From: Doug Ambrisko 
Date: Fri, 6 Nov 2009 17:11:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198992 - in stable/6/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 06 Nov 2009 17:11:58 -0000

Author: ambrisko
Date: Fri Nov  6 17:11:58 2009
New Revision: 198992
URL: http://svn.freebsd.org/changeset/base/198992

Log:
  MFC:  Adjust the way we number CPUs on x86 so that we attempt to "group" all
  logical CPUs in a package.
  
  Merged by:	Subra @ Cisco
  Reviewed by:	jhb

Modified:
  stable/6/sys/amd64/amd64/mp_machdep.c
  stable/6/sys/i386/i386/mp_machdep.c
Directory Properties:
  stable/6/sys/   (props changed)

Modified: stable/6/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- stable/6/sys/amd64/amd64/mp_machdep.c	Fri Nov  6 17:09:04 2009	(r198991)
+++ stable/6/sys/amd64/amd64/mp_machdep.c	Fri Nov  6 17:11:58 2009	(r198992)
@@ -341,7 +341,6 @@ cpu_mp_start(void)
 	} else
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
-	cpu_apic_ids[0] = boot_cpu_id;
 
 	assign_cpu_ids();
 
@@ -405,20 +404,29 @@ cpu_mp_start(void)
 void
 cpu_mp_announce(void)
 {
-	int i, x;
+	int i;
 
-	/* List CPUs */
+	/* List active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
-	for (i = 1, x = 0; x <= MAX_APIC_ID; x++) {
-		if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp)
+	for (i = 1; i < mp_ncpus; i++) {
+		if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread)
+			hyperthread = "/HT";
+		else
+			hyperthread = "";
+		printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread,
+		    cpu_apic_ids[i]);
+	}
+
+	/* List disabled CPUs last. */
+	for (i = 0; i <= MAX_APIC_ID; i++) {
+		if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled)
 			continue;
-		if (cpu_info[x].cpu_disabled)
-			printf("  cpu (AP): APIC ID: %2d (disabled)\n", x);
-		else {
-			KASSERT(i < mp_ncpus,
-			    ("mp_ncpus and actual cpus are out of whack"));
-			printf(" cpu%d (AP): APIC ID: %2d\n", i++, x);
-		}
+		if (cpu_info[i].cpu_hyperthread)
+			hyperthread = "/HT";
+		else
+			hyperthread = "";
+		printf("  cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread,
+		    i);
 	}
 }
 
@@ -646,11 +654,19 @@ assign_cpu_ids(void)
 
 	/*
 	 * Assign CPU IDs to local APIC IDs and disable any CPUs
-	 * beyond MAXCPU.  CPU 0 has already been assigned to the BSP,
-	 * so we only have to assign IDs for APs.
+	 * beyond MAXCPU.  CPU 0 is always assigned to the BSP.
+	 *
+	 * To minimize confusion for userland, we attempt to number
+	 * CPUs such that all threads and cores in a package are
+	 * grouped together.  For now we assume that the BSP is always
+	 * the first thread in a package and just start adding APs
+	 * starting with the BSP's APIC ID.
 	 */
 	mp_ncpus = 1;
-	for (i = 0; i <= MAX_APIC_ID; i++) {
+	cpu_apic_ids[0] = boot_cpu_id;
+	apic_cpuids[boot_cpu_id] = 0;
+	for (i = boot_cpu_id + 1; i != boot_cpu_id;
+	     i == MAX_APIC_ID ? i = 0 : i++) {
 		if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp ||
 		    cpu_info[i].cpu_disabled)
 			continue;

Modified: stable/6/sys/i386/i386/mp_machdep.c
==============================================================================
--- stable/6/sys/i386/i386/mp_machdep.c	Fri Nov  6 17:09:04 2009	(r198991)
+++ stable/6/sys/i386/i386/mp_machdep.c	Fri Nov  6 17:11:58 2009	(r198992)
@@ -417,7 +417,6 @@ cpu_mp_start(void)
 	} else
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
-	cpu_apic_ids[0] = boot_cpu_id;
 
 	assign_cpu_ids();
 
@@ -481,22 +480,31 @@ cpu_mp_start(void)
 void
 cpu_mp_announce(void)
 {
-	int i, x;
+	int i;
 
 	POSTCODE(MP_ANNOUNCE_POST);
 
-	/* List CPUs */
+	/* List active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
-	for (i = 1, x = 0; x <= MAX_APIC_ID; x++) {
-		if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp)
+	for (i = 1; i < mp_ncpus; i++) {
+		if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread)
+			hyperthread = "/HT";
+		else
+			hyperthread = "";
+		printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread,
+		    cpu_apic_ids[i]);
+	}
+
+	/* List disabled CPUs last. */
+	for (i = 0; i <= MAX_APIC_ID; i++) {
+		if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled)
 			continue;
-		if (cpu_info[x].cpu_disabled)
-			printf("  cpu (AP): APIC ID: %2d (disabled)\n", x);
-		else {
-			KASSERT(i < mp_ncpus,
-			    ("mp_ncpus and actual cpus are out of whack"));
-			printf(" cpu%d (AP): APIC ID: %2d\n", i++, x);
-		}
+		if (cpu_info[i].cpu_hyperthread)
+			hyperthread = "/HT";
+		else
+			hyperthread = "";
+		printf("  cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread,
+		    i);
 	}
 }
 
@@ -724,11 +732,19 @@ assign_cpu_ids(void)
 
 	/*
 	 * Assign CPU IDs to local APIC IDs and disable any CPUs
-	 * beyond MAXCPU.  CPU 0 has already been assigned to the BSP,
-	 * so we only have to assign IDs for APs.
+	 * beyond MAXCPU.  CPU 0 is always assigned to the BSP.
+	 *
+	 * To minimize confusion for userland, we attempt to number
+	 * CPUs such that all threads and cores in a package are
+	 * grouped together.  For now we assume that the BSP is always
+	 * the first thread in a package and just start adding APs
+	 * starting with the BSP's APIC ID.
 	 */
 	mp_ncpus = 1;
-	for (i = 0; i <= MAX_APIC_ID; i++) {
+	cpu_apic_ids[0] = boot_cpu_id;
+	apic_cpuids[boot_cpu_id] = 0;
+	for (i = boot_cpu_id + 1; i != boot_cpu_id;
+	     i == MAX_APIC_ID ? i = 0 : i++) {
 		if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp ||
 		    cpu_info[i].cpu_disabled)
 			continue;

From owner-svn-src-stable-6@FreeBSD.ORG  Fri Nov  6 17:58:44 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2CD91065695;
	Fri,  6 Nov 2009 17:58:44 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CEFA38FC1D;
	Fri,  6 Nov 2009 17: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 nA6HwikF024310;
	Fri, 6 Nov 2009 17:58:44 GMT (envelope-from ambrisko@svn.freebsd.org)
Received: (from ambrisko@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA6Hwic2024307;
	Fri, 6 Nov 2009 17:58:44 GMT (envelope-from ambrisko@svn.freebsd.org)
Message-Id: <200911061758.nA6Hwic2024307@svn.freebsd.org>
From: Doug Ambrisko 
Date: Fri, 6 Nov 2009 17:58:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198994 - in stable/6/sys/dev: bce mii
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 06 Nov 2009 17:58:45 -0000

Author: ambrisko
Date: Fri Nov  6 17:58:44 2009
New Revision: 198994
URL: http://svn.freebsd.org/changeset/base/198994

Log:
  MFC: Merge in minimal 5709/5716 support into 6.X extracted from current.
  This is not a direct merge since I tried to only extra the changes to
  support the 5709 from all of the other changes that have happened in
  head.  This should not introduce any issues that the other changes may
  have caused.  We have been running this code for months on Dell r710's.
  It has been lightly tested on systems with 5716's.
  
  This is to allow people to run newer hardware on 6.X.

Modified:
  stable/6/sys/dev/bce/if_bce.c
  stable/6/sys/dev/bce/if_bcefw.h
  stable/6/sys/dev/bce/if_bcereg.h
  stable/6/sys/dev/mii/brgphy.c
  stable/6/sys/dev/mii/miidevs

Modified: stable/6/sys/dev/bce/if_bce.c
==============================================================================
--- stable/6/sys/dev/bce/if_bce.c	Fri Nov  6 17:34:26 2009	(r198993)
+++ stable/6/sys/dev/bce/if_bce.c	Fri Nov  6 17:58:44 2009	(r198994)
@@ -110,6 +110,19 @@ static struct bce_type bce_devs[] = {
 	/* BCM5708S controllers and OEM boards. */
 	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5708S,  PCI_ANY_ID,  PCI_ANY_ID,
 		"Broadcom NetXtreme II BCM5708 1000Base-SX" },
+
+	/* BCM5709C controllers and OEM boards. */
+	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5709,  PCI_ANY_ID,  PCI_ANY_ID,
+		"Broadcom NetXtreme II BCM5709 1000Base-T" },
+
+	/* BCM5709S controllers and OEM boards. */
+	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5709S,  PCI_ANY_ID,  PCI_ANY_ID,
+		"Broadcom NetXtreme II BCM5709 1000Base-SX" },
+
+	/* BCM5716 controllers and OEM boards. */
+	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5716,  PCI_ANY_ID,  PCI_ANY_ID,
+		"Broadcom NetXtreme II BCM5716 1000Base-T" },
+
 	{ 0, 0, 0, 0, NULL }
 };
 
@@ -119,91 +132,109 @@ static struct bce_type bce_devs[] = {
 /****************************************************************************/
 static struct flash_spec flash_table[] =
 {
+#define BUFFERED_FLAGS		(BCE_NV_BUFFERED | BCE_NV_TRANSLATE)
+#define NONBUFFERED_FLAGS	(BCE_NV_WREN)
+
 	/* Slow EEPROM */
 	{0x00000000, 0x40830380, 0x009f0081, 0xa184a053, 0xaf000400,
-	 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE,
+	 BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE,
 	 SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE,
 	 "EEPROM - slow"},
 	/* Expansion entry 0001 */
 	{0x08000002, 0x4b808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 0001"},
 	/* Saifun SA25F010 (non-buffered flash) */
 	/* strap, cfg1, & write1 need updates */
 	{0x04000001, 0x47808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*2,
 	 "Non-buffered flash (128kB)"},
 	/* Saifun SA25F020 (non-buffered flash) */
 	/* strap, cfg1, & write1 need updates */
 	{0x0c000003, 0x4f808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*4,
 	 "Non-buffered flash (256kB)"},
 	/* Expansion entry 0100 */
 	{0x11000000, 0x53808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 0100"},
 	/* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */
 	{0x19000002, 0x5b808201, 0x000500db, 0x03840253, 0xaf020406,
-	 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE,
 	 ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*2,
 	 "Entry 0101: ST M45PE10 (128kB non-bufferred)"},
 	/* Entry 0110: ST M45PE20 (non-buffered flash)*/
 	{0x15000001, 0x57808201, 0x000500db, 0x03840253, 0xaf020406,
-	 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE,
 	 ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*4,
 	 "Entry 0110: ST M45PE20 (256kB non-bufferred)"},
 	/* Saifun SA25F005 (non-buffered flash) */
 	/* strap, cfg1, & write1 need updates */
 	{0x1d000003, 0x5f808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE,
 	 "Non-buffered flash (64kB)"},
 	/* Fast EEPROM */
 	{0x22000000, 0x62808380, 0x009f0081, 0xa184a053, 0xaf000400,
-	 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE,
+	 BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE,
 	 SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE,
 	 "EEPROM - fast"},
 	/* Expansion entry 1001 */
 	{0x2a000002, 0x6b808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 1001"},
 	/* Expansion entry 1010 */
 	{0x26000001, 0x67808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 1010"},
 	/* ATMEL AT45DB011B (buffered flash) */
 	{0x2e000003, 0x6e808273, 0x00570081, 0x68848353, 0xaf000400,
-	 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
+	 BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
 	 BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE,
 	 "Buffered flash (128kB)"},
 	/* Expansion entry 1100 */
 	{0x33000000, 0x73808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 1100"},
 	/* Expansion entry 1101 */
 	{0x3b000002, 0x7b808201, 0x00050081, 0x03840253, 0xaf020406,
-	 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
+	 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
 	 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 1101"},
 	/* Ateml Expansion entry 1110 */
 	{0x37000001, 0x76808273, 0x00570081, 0x68848353, 0xaf000400,
-	 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
+	 BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
 	 BUFFERED_FLASH_BYTE_ADDR_MASK, 0,
 	 "Entry 1110 (Atmel)"},
 	/* ATMEL AT45DB021B (buffered flash) */
 	{0x3f000003, 0x7e808273, 0x00570081, 0x68848353, 0xaf000400,
-	 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
+	 BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
 	 BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE*2,
 	 "Buffered flash (256kB)"},
 };
 
+/*
+ * The BCM5709 controllers transparently handle the
+ * differences between Atmel 264 byte pages and all
+ * flash devices which use 256 byte pages, so no
+ * logical-to-physical mapping is required in the
+ * driver.
+ */
+static struct flash_spec flash_5709 = {
+	.flags		= BCE_NV_BUFFERED,
+	.page_bits	= BCM5709_FLASH_PAGE_BITS,
+	.page_size	= BCM5709_FLASH_PAGE_SIZE,
+	.addr_mask	= BCM5709_FLASH_BYTE_ADDR_MASK,
+	.total_size	= BUFFERED_FLASH_TOTAL_SIZE * 2,
+	.name		= "5709 buffered flash (256kB)",
+};
 
 /****************************************************************************/
 /* FreeBSD device entry points.                                             */
@@ -268,6 +299,7 @@ static int  bce_nvram_write			(struct bc
 /****************************************************************************/
 /*                                                                          */
 /****************************************************************************/
+static void bce_get_media		(struct bce_softc *);
 static void bce_dma_map_addr		(void *, bus_dma_segment_t *, int, int);
 static int  bce_dma_alloc			(device_t);
 static void bce_dma_free			(struct bce_softc *);
@@ -279,19 +311,28 @@ static void bce_release_resources	(struc
 static int  bce_fw_sync				(struct bce_softc *, u32);
 static void bce_load_rv2p_fw		(struct bce_softc *, u32 *, u32, u32);
 static void bce_load_cpu_fw			(struct bce_softc *, struct cpu_reg *, struct fw_info *);
+static void bce_init_rxp_cpu		(struct bce_softc *);
+static void bce_init_txp_cpu 		(struct bce_softc *);
+static void bce_init_tpat_cpu		(struct bce_softc *);
+static void bce_init_cp_cpu		  	(struct bce_softc *);
+static void bce_init_com_cpu	  	(struct bce_softc *);
 static void bce_init_cpus			(struct bce_softc *);
 
+static void	bce_print_adapter_info	(struct bce_softc *);
+static void bce_probe_pci_caps		(device_t, struct bce_softc *);
 static void bce_stop				(struct bce_softc *);
 static int  bce_reset				(struct bce_softc *, u32);
 static int  bce_chipinit 			(struct bce_softc *);
 static int  bce_blockinit 			(struct bce_softc *);
-static int  bce_get_buf				(struct bce_softc *, struct mbuf *, u16 *, u16 *, u32 *);
 
 static int  bce_init_tx_chain		(struct bce_softc *);
-static void bce_fill_rx_chain		(struct bce_softc *);
+static void bce_free_tx_chain		(struct bce_softc *);
+
+static int  bce_get_buf			(struct bce_softc *, struct mbuf *, u16 *, u16 *, u32 *);
 static int  bce_init_rx_chain		(struct bce_softc *);
+static void bce_fill_rx_chain		(struct bce_softc *);
 static void bce_free_rx_chain		(struct bce_softc *);
-static void bce_free_tx_chain		(struct bce_softc *);
+static void bce_init_rx_context		(struct bce_softc *);
 
 static int  bce_tx_encap			(struct bce_softc *, struct mbuf **);
 static void bce_start_locked		(struct ifnet *);
@@ -437,6 +478,90 @@ bce_probe(device_t dev)
 	return(ENXIO);
 }
 
+static void
+bce_print_adapter_info(struct bce_softc *sc)
+{
+	BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid);
+	printf("Rev (%c%d); ", ((BCE_CHIP_ID(sc) & 0xf000) >> 12) + 'A',
+		((BCE_CHIP_ID(sc) & 0x0ff0) >> 4));
+
+	/* Bus info. */
+	if (sc->bce_flags & BCE_PCIE_FLAG) {
+		printf("Bus (PCIe x%d, ", sc->link_width);
+		switch (sc->link_speed) {
+			case 1: printf("2.5Gbps); "); break;
+			case 2:	printf("5Gbps); "); break;
+			default: printf("Unknown link speed); ");
+		}
+	} else {
+		printf("Bus (PCI%s, %s, %dMHz); ",
+			((sc->bce_flags & BCE_PCIX_FLAG) ? "-X" : ""),
+			((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? "32-bit" : "64-bit"),
+			sc->bus_speed_mhz);
+	}
+
+	/* Firmware version and device features. */
+	printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver);
+#ifdef BCE_USE_SPLIT_HEADER
+	printf("SPLT ");
+#endif
+	if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
+		printf("MFW ");
+	if (sc->bce_flags & BCE_USING_MSI_FLAG)
+		printf("MSI ");
+	if (sc->bce_flags & BCE_USING_MSIX_FLAG)
+		printf("MSI-X ");
+	if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG)
+		printf("2.5G ");
+	printf(")\n");
+}
+
+/****************************************************************************/
+/* PCI Capabilities Probe Function.                                         */
+/*                                                                          */
+/* Walks the PCI capabiites list for the device to find what features are   */
+/* supported.                                                               */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   None.                                                                  */
+/****************************************************************************/
+static void
+bce_probe_pci_caps(device_t dev, struct bce_softc *sc)
+{
+	u32 reg;
+
+	/* Check if PCI-X capability is enabled. */
+	if (pci_find_extcap(dev, PCIY_PCIX, ®) == 0) {
+		if (reg != 0)
+			sc->bce_cap_flags |= BCE_PCIX_CAPABLE_FLAG;
+	}
+
+	/* Check if PCIe capability is enabled. */
+	if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) {
+		if (reg != 0) {
+			u16 link_status = pci_read_config(dev, reg + 0x12, 2);
+			DBPRINT(sc, BCE_INFO_LOAD, "PCIe link_status = 0x%08X\n",
+				link_status);
+			sc->link_speed = link_status & 0xf;
+			sc->link_width = (link_status >> 4) & 0x3f;
+			sc->bce_cap_flags |= BCE_PCIE_CAPABLE_FLAG;
+			sc->bce_flags |= BCE_PCIE_FLAG;
+		}
+	}
+
+	/* Check if MSI capability is enabled. */
+	if (pci_find_extcap(dev, PCIY_MSI, ®) == 0) {
+		if (reg != 0)
+			sc->bce_cap_flags |= BCE_MSI_CAPABLE_FLAG;
+	}
+
+	/* Check if MSI-X capability is enabled. */
+	if (pci_find_extcap(dev, PCIY_MSIX, ®) == 0) {
+		if (reg != 0)
+			sc->bce_cap_flags |= BCE_MSIX_CAPABLE_FLAG;
+	}
+
+}
 
 /****************************************************************************/
 /* Device attach function.                                                  */
@@ -488,6 +613,7 @@ bce_attach(device_t dev)
 	sc->bce_bhandle = rman_get_bushandle(sc->bce_res_mem);
 	sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res_mem);
 
+	bce_probe_pci_caps(dev, sc);
 	/* If MSI is enabled in the driver, get the vector count. */
 	count = bce_msi_enable ? pci_msi_count(dev) : 0;
 
@@ -534,6 +660,10 @@ bce_attach(device_t dev)
 		case BCE_CHIP_ID_5706_A1:
 		case BCE_CHIP_ID_5708_A0:
 		case BCE_CHIP_ID_5708_B0:
+		case BCE_CHIP_ID_5709_A0:
+		case BCE_CHIP_ID_5709_B0:
+		case BCE_CHIP_ID_5709_B1:
+		case BCE_CHIP_ID_5709_B2:
 			BCE_PRINTF("%s(%d): Unsupported controller revision (%c%d)!\n",
 				__FILE__, __LINE__, 
 				(((pci_read_config(dev, PCIR_REVID, 4) & 0xf0) >> 4) + 'A'),
@@ -559,7 +689,9 @@ bce_attach(device_t dev)
 	 */
 	val = REG_RD_IND(sc, BCE_SHM_HDR_SIGNATURE);
 	if ((val & BCE_SHM_HDR_SIGNATURE_SIG_MASK) == BCE_SHM_HDR_SIGNATURE_SIG)
-		sc->bce_shmem_base = REG_RD_IND(sc, BCE_SHM_HDR_ADDR_0);
+		/* Multi-port devices use different offsets in shared memory. */
+		sc->bce_shmem_base = REG_RD_IND(sc, BCE_SHM_HDR_ADDR_0 +
+			(pci_get_function(sc->bce_dev) << 2));
 	else
 		sc->bce_shmem_base = HOST_VIEW_SHMEM_BASE;
 
@@ -687,33 +819,14 @@ bce_attach(device_t dev)
 	/* Update statistics once every second. */
 	sc->bce_stats_ticks = 1000000 & 0xffff00;
 
-	/*
-	 * The SerDes based NetXtreme II controllers
-	 * that support 2.5Gb operation (currently 
-	 * 5708S) use a PHY at address 2, otherwise 
-	 * the PHY is present at address 1.
-	 */
-	sc->bce_phy_addr = 1;
-
-	if (BCE_CHIP_BOND_ID(sc) & BCE_CHIP_BOND_ID_SERDES_BIT) {
-		sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG;
-		sc->bce_flags |= BCE_NO_WOL_FLAG;
-		if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) {
-			sc->bce_phy_addr = 2;
-			val = REG_RD_IND(sc, sc->bce_shmem_base +
-					 BCE_SHARED_HW_CFG_CONFIG);
-			if (val & BCE_SHARED_HW_CFG_PHY_2_5G) {
-				sc->bce_phy_flags |= BCE_PHY_2_5G_CAPABLE_FLAG;
-				DBPRINT(sc, BCE_INFO_LOAD, "Found 2.5Gb capable adapter\n");
-			}
-		}
-	}
+	/* Find the media type for the adapter. */
+	bce_get_media(sc);
 
 	/* Store data needed by PHY driver for backplane applications */
 	sc->bce_shared_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base +
 		BCE_SHARED_HW_CFG_CONFIG);
 	sc->bce_port_hw_cfg   = REG_RD_IND(sc, sc->bce_shmem_base +
-		BCE_SHARED_HW_CFG_CONFIG);
+		BCE_PORT_HW_CFG_CONFIG);
 
 	/* Allocate DMA memory resources. */
 	if (bce_dma_alloc(dev)) {
@@ -820,21 +933,7 @@ bce_attach(device_t dev)
 	BCE_UNLOCK(sc);
 
 	/* Finally, print some useful adapter info */
-	BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid);
-	printf("Rev (%c%d); ", ((BCE_CHIP_ID(sc) & 0xf000) >> 12) + 'A',
-		((BCE_CHIP_ID(sc) & 0x0ff0) >> 4));
-	printf("Bus (PCI%s, %s, %dMHz); ",
-		((sc->bce_flags & BCE_PCIX_FLAG) ? "-X" : ""),
-		((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? "32-bit" : "64-bit"),
-		sc->bus_speed_mhz);
-	printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver);
-	if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
-		printf("MFW ");
-	if (sc->bce_flags & BCE_USING_MSI_FLAG)
-		printf("MSI ");
-	if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG)
-		printf("2.5G ");
-	printf(")\n");
+	bce_print_adapter_info(sc);
 
 	goto bce_attach_exit;
 
@@ -995,15 +1094,39 @@ bce_reg_wr_ind(struct bce_softc *sc, u32
 /*   Nothing.                                                               */
 /****************************************************************************/
 static void
-bce_ctx_wr(struct bce_softc *sc, u32 cid_addr, u32 offset, u32 val)
+bce_ctx_wr(struct bce_softc *sc, u32 cid_addr, u32 ctx_offset, u32 ctx_val)
 {
+	u32 idx, offset = ctx_offset + cid_addr;
+	u32 val = 0, retry_cnt = 5;
+
+	DBPRINT(sc, BCE_EXTREME_CTX, "%s(); cid_addr = 0x%08X, offset = 0x%08X, "
+		"val = 0x%08X\n", __FUNCTION__, cid_addr, ctx_offset, ctx_val);
+
+	DBRUNIF((cid_addr > MAX_CID_ADDR || ctx_offset & 0x3 || cid_addr & CTX_MASK),
+		BCE_PRINTF("%s(): Invalid CID address: 0x%08X.\n",
+			__FUNCTION__, cid_addr));
+
+	if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
+
+		REG_WR(sc, BCE_CTX_CTX_DATA, ctx_val);
+		REG_WR(sc, BCE_CTX_CTX_CTRL, (offset | BCE_CTX_CTX_CTRL_WRITE_REQ));
 
-	DBPRINT(sc, BCE_EXCESSIVE, "%s(); cid_addr = 0x%08X, offset = 0x%08X, "
-		"val = 0x%08X\n", __FUNCTION__, cid_addr, offset, val);
+		for (idx = 0; idx < retry_cnt; idx++) {
+			val = REG_RD(sc, BCE_CTX_CTX_CTRL);
+			if ((val & BCE_CTX_CTX_CTRL_WRITE_REQ) == 0)
+				break;
+			DELAY(5);
+		}
 
-	offset += cid_addr;
-	REG_WR(sc, BCE_CTX_DATA_ADR, offset);
-	REG_WR(sc, BCE_CTX_DATA, val);
+		if (val & BCE_CTX_CTX_CTRL_WRITE_REQ)
+			BCE_PRINTF("%s(%d); Unable to write CTX memory: "
+				"cid_addr = 0x%08X, offset = 0x%08X!\n",
+				__FILE__, __LINE__, cid_addr, ctx_offset);
+
+	} else {
+		REG_WR(sc, BCE_CTX_DATA_ADR, offset);
+		REG_WR(sc, BCE_CTX_DATA, ctx_val);
+	}
 }
 
 
@@ -1323,7 +1446,7 @@ bce_enable_nvram_write(struct bce_softc 
 	val = REG_RD(sc, BCE_MISC_CFG);
 	REG_WR(sc, BCE_MISC_CFG, val | BCE_MISC_CFG_NVM_WR_EN_PCI);
 
-	if (!sc->bce_flash_info->buffered) {
+	if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) {
 		int j;
 
 		REG_WR(sc, BCE_NVM_COMMAND, BCE_NVM_COMMAND_DONE);
@@ -1339,9 +1462,11 @@ bce_enable_nvram_write(struct bce_softc 
 
 		if (j >= NVRAM_TIMEOUT_COUNT) {
 			DBPRINT(sc, BCE_WARN, "Timeout writing NVRAM!\n");
-			return EBUSY;
+			rc = EBUSY;
 		}
 	}
+
+
 	return 0;
 }
 
@@ -1412,6 +1537,7 @@ bce_disable_nvram_access(struct bce_soft
 	REG_WR(sc, BCE_NVM_ACCESS_ENABLE,
 		val & ~(BCE_NVM_ACCESS_ENABLE_EN |
 			BCE_NVM_ACCESS_ENABLE_WR_EN));
+
 }
 
 
@@ -1429,13 +1555,11 @@ static int
 bce_nvram_erase_page(struct bce_softc *sc, u32 offset)
 {
 	u32 cmd;
-	int j;
+	int j, rc = 0;
 
 	/* Buffered flash doesn't require an erase. */
-	if (sc->bce_flash_info->buffered)
-		return 0;
-
-	DBPRINT(sc, BCE_VERBOSE_NVRAM, "Erasing NVRAM page.\n");
+	if (sc->bce_flash_info->flags & BCE_NV_BUFFERED)
+		goto bce_nvram_erase_page_exit;
 
 	/* Build an erase command. */
 	cmd = BCE_NVM_COMMAND_ERASE | BCE_NVM_COMMAND_WR |
@@ -1462,10 +1586,12 @@ bce_nvram_erase_page(struct bce_softc *s
 
 	if (j >= NVRAM_TIMEOUT_COUNT) {
 		DBPRINT(sc, BCE_WARN, "Timeout erasing NVRAM.\n");
-		return EBUSY;
+		rc = EBUSY;
 	}
 
-	return 0;
+bce_nvram_erase_page_exit:
+
+	return rc;
 }
 #endif /* BCE_NVRAM_WRITE_SUPPORT */
 
@@ -1486,11 +1612,12 @@ bce_nvram_read_dword(struct bce_softc *s
 	u32 cmd;
 	int i, rc = 0;
 
+
 	/* Build the command word. */
 	cmd = BCE_NVM_COMMAND_DOIT | cmd_flags;
 
-	/* Calculate the offset for buffered flash. */
-	if (sc->bce_flash_info->buffered) {
+	/* Calculate the offset for buffered flash if translation is used. */
+	if (sc->bce_flash_info->flags & BCE_NV_TRANSLATE) {
 		offset = ((offset / sc->bce_flash_info->page_size) <<
 			   sc->bce_flash_info->page_bits) +
 			  (offset % sc->bce_flash_info->page_size);
@@ -1547,13 +1674,14 @@ bce_nvram_write_dword(struct bce_softc *
 	u32 cmd_flags)
 {
 	u32 cmd, val32;
-	int j;
+	int j, rc = 0;
+
 
 	/* Build the command word. */
 	cmd = BCE_NVM_COMMAND_DOIT | BCE_NVM_COMMAND_WR | cmd_flags;
 
-	/* Calculate the offset for buffered flash. */
-	if (sc->bce_flash_info->buffered) {
+	/* Calculate the offset for buffered flash if translation is used. */
+	if (sc->bce_flash_info->flags & BCE_NV_TRANSLATE) {
 		offset = ((offset / sc->bce_flash_info->page_size) <<
 			  sc->bce_flash_info->page_bits) +
 			 (offset % sc->bce_flash_info->page_size);
@@ -1580,10 +1708,10 @@ bce_nvram_write_dword(struct bce_softc *
 	if (j >= NVRAM_TIMEOUT_COUNT) {
 		BCE_PRINTF("%s(%d): Timeout error writing NVRAM at offset 0x%08X\n",
 			__FILE__, __LINE__, offset);
-		return EBUSY;
+		rc = EBUSY;
 	}
 
-	return 0;
+	return (rc);
 }
 #endif /* BCE_NVRAM_WRITE_SUPPORT */
 
@@ -1601,18 +1729,20 @@ static int
 bce_init_nvram(struct bce_softc *sc)
 {
 	u32 val;
-	int j, entry_count, rc;
+	int j, entry_count, rc = 0;
 	struct flash_spec *flash;
 
-	DBPRINT(sc, BCE_VERBOSE_NVRAM, "Entering %s()\n", __FUNCTION__);
+
+	if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
+		sc->bce_flash_info = &flash_5709;
+		goto bce_init_nvram_get_flash_size;
+	}
 
 	/* Determine the selected interface. */
 	val = REG_RD(sc, BCE_NVM_CFG1);
 
 	entry_count = sizeof(flash_table) / sizeof(struct flash_spec);
 
-	rc = 0;
-
 	/*
 	 * Flash reconfiguration is required to support additional
 	 * NVRAM devices not directly supported in hardware.
@@ -1623,7 +1753,7 @@ bce_init_nvram(struct bce_softc *sc)
 	if (val & 0x40000000) {
 		/* Flash interface reconfigured by bootcode. */
 
-		DBPRINT(sc,BCE_INFO_LOAD, 
+		DBPRINT(sc,BCE_INFO_LOAD,
 			"bce_init_nvram(): Flash WAS reconfigured.\n");
 
 		for (j = 0, flash = &flash_table[0]; j < entry_count;
@@ -1638,8 +1768,8 @@ bce_init_nvram(struct bce_softc *sc)
 		/* Flash interface not yet reconfigured. */
 		u32 mask;
 
-		DBPRINT(sc,BCE_INFO_LOAD, 
-			"bce_init_nvram(): Flash was NOT reconfigured.\n");
+		DBPRINT(sc, BCE_INFO_LOAD, "%s(): Flash was NOT reconfigured.\n",
+			__FUNCTION__);
 
 		if (val & (1 << 23))
 			mask = FLASH_BACKUP_STRAP_MASK;
@@ -1675,11 +1805,12 @@ bce_init_nvram(struct bce_softc *sc)
 	/* Check if a matching device was found. */
 	if (j == entry_count) {
 		sc->bce_flash_info = NULL;
-		BCE_PRINTF("%s(%d): Unknown Flash NVRAM found!\n", 
+		BCE_PRINTF("%s(%d): Unknown Flash NVRAM found!\n",
 			__FILE__, __LINE__);
 		rc = ENODEV;
 	}
 
+bce_init_nvram_get_flash_size:
 	/* Write the flash config data to the shared memory interface. */
 	val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_SHARED_HW_CFG_CONFIG2);
 	val &= BCE_SHARED_HW_CFG2_NVM_SIZE_MASK;
@@ -1688,11 +1819,10 @@ bce_init_nvram(struct bce_softc *sc)
 	else
 		sc->bce_flash_size = sc->bce_flash_info->total_size;
 
-	DBPRINT(sc, BCE_INFO_LOAD, "bce_init_nvram() flash->total_size = 0x%08X\n",
+	DBPRINT(sc, BCE_INFO_LOAD, "%s(): Found %s, size = 0x%08X\n",
+		__FUNCTION__, sc->bce_flash_info->name,
 		sc->bce_flash_info->total_size);
 
-	DBPRINT(sc, BCE_VERBOSE_NVRAM, "Exiting %s()\n", __FUNCTION__);
-
 	return rc;
 }
 
@@ -1713,12 +1843,13 @@ bce_nvram_read(struct bce_softc *sc, u32
 	int rc = 0;
 	u32 cmd_flags, offset32, len32, extra;
 
+
 	if (buf_size == 0)
-		return 0;
+		goto bce_nvram_read_exit;
 
 	/* Request access to the flash interface. */
 	if ((rc = bce_acquire_nvram_lock(sc)) != 0)
-		return rc;
+		goto bce_nvram_read_exit;
 
 	/* Enable access to flash interface */
 	bce_enable_nvram_access(sc);
@@ -1800,7 +1931,7 @@ bce_nvram_read(struct bce_softc *sc, u32
 		}
 
 		if (rc)
-			return rc;
+			goto bce_nvram_read_locked_exit;
 
 		cmd_flags = BCE_NVM_COMMAND_LAST;
 		rc = bce_nvram_read_dword(sc, offset32, buf, cmd_flags);
@@ -1808,10 +1939,12 @@ bce_nvram_read(struct bce_softc *sc, u32
 		memcpy(ret_buf, buf, 4 - extra);
 	}
 
+bce_nvram_read_locked_exit:
 	/* Disable access to flash interface and release the lock. */
 	bce_disable_nvram_access(sc);
 	bce_release_nvram_lock(sc);
 
+bce_nvram_read_exit:
 	return rc;
 }
 
@@ -1836,6 +1969,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 	int rc = 0;
 	int align_start, align_end;
 
+
 	buf = data_buf;
 	offset32 = offset;
 	len32 = buf_size;
@@ -1845,7 +1979,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 		offset32 &= ~3;
 		len32 += align_start;
 		if ((rc = bce_nvram_read(sc, offset32, start, 4)))
-			return rc;
+			goto bce_nvram_write_exit;
 	}
 
 	if (len32 & 3) {
@@ -1854,18 +1988,22 @@ bce_nvram_write(struct bce_softc *sc, u3
 			len32 += align_end;
 			if ((rc = bce_nvram_read(sc, offset32 + len32 - 4,
 				end, 4))) {
-				return rc;
+				goto bce_nvram_write_exit;
 			}
 		}
 	}
 
 	if (align_start || align_end) {
 		buf = malloc(len32, M_DEVBUF, M_NOWAIT);
-		if (buf == 0)
-			return ENOMEM;
+		if (buf == 0) {
+			rc = ENOMEM;
+			goto bce_nvram_write_exit;
+		}
+
 		if (align_start) {
 			memcpy(buf, start, 4);
 		}
+
 		if (align_end) {
 			memcpy(buf + len32 - 4, end, 4);
 		}
@@ -1892,13 +2030,13 @@ bce_nvram_write(struct bce_softc *sc, u3
 
 		/* Request access to the flash interface. */
 		if ((rc = bce_acquire_nvram_lock(sc)) != 0)
-			goto nvram_write_end;
+			goto bce_nvram_write_exit;
 
 		/* Enable access to flash interface */
 		bce_enable_nvram_access(sc);
 
 		cmd_flags = BCE_NVM_COMMAND_FIRST;
-		if (sc->bce_flash_info->buffered == 0) {
+		if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) {
 			int j;
 
 			/* Read the whole page into the buffer
@@ -1913,7 +2051,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 					cmd_flags);
 
 				if (rc)
-					goto nvram_write_end;
+					goto bce_nvram_write_locked_exit;
 
 				cmd_flags = 0;
 			}
@@ -1921,11 +2059,11 @@ bce_nvram_write(struct bce_softc *sc, u3
 
 		/* Enable writes to flash interface (unlock write-protect) */
 		if ((rc = bce_enable_nvram_write(sc)) != 0)
-			goto nvram_write_end;
+			goto bce_nvram_write_locked_exit;
 
 		/* Erase the page */
 		if ((rc = bce_nvram_erase_page(sc, page_start)) != 0)
-			goto nvram_write_end;
+			goto bce_nvram_write_locked_exit;
 
 		/* Re-enable the write again for the actual write */
 		bce_enable_nvram_write(sc);
@@ -1933,7 +2071,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 		/* Loop to write back the buffer data from page_start to
 		 * data_start */
 		i = 0;
-		if (sc->bce_flash_info->buffered == 0) {
+		if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) {
 			for (addr = page_start; addr < data_start;
 				addr += 4, i += 4) {
 
@@ -1941,7 +2079,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 					&flash_buffer[i], cmd_flags);
 
 				if (rc != 0)
-					goto nvram_write_end;
+					goto bce_nvram_write_locked_exit;
 
 				cmd_flags = 0;
 			}
@@ -1950,8 +2088,8 @@ bce_nvram_write(struct bce_softc *sc, u3
 		/* Loop to write the new data from data_start to data_end */
 		for (addr = data_start; addr < data_end; addr += 4, i++) {
 			if ((addr == page_end - 4) ||
-				((sc->bce_flash_info->buffered) &&
-				 (addr == data_end - 4))) {
+				((sc->bce_flash_info->flags & BCE_NV_BUFFERED) &&
+				(addr == data_end - 4))) {
 
 				cmd_flags |= BCE_NVM_COMMAND_LAST;
 			}
@@ -1959,7 +2097,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 				cmd_flags);
 
 			if (rc != 0)
-				goto nvram_write_end;
+				goto bce_nvram_write_locked_exit;
 
 			cmd_flags = 0;
 			buf += 4;
@@ -1967,7 +2105,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 
 		/* Loop to write back the buffer data from data_end
 		 * to page_end */
-		if (sc->bce_flash_info->buffered == 0) {
+		if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) {
 			for (addr = data_end; addr < page_end;
 				addr += 4, i += 4) {
 
@@ -1978,7 +2116,7 @@ bce_nvram_write(struct bce_softc *sc, u3
 					&flash_buffer[i], cmd_flags);
 
 				if (rc != 0)
-					goto nvram_write_end;
+					goto bce_nvram_write_locked_exit;
 
 				cmd_flags = 0;
 			}
@@ -1995,11 +2133,18 @@ bce_nvram_write(struct bce_softc *sc, u3
 		written += data_end - data_start;
 	}
 
-nvram_write_end:
+	goto bce_nvram_write_exit;
+
+bce_nvram_write_locked_exit:
+		bce_disable_nvram_write(sc);
+		bce_disable_nvram_access(sc);
+		bce_release_nvram_lock(sc);
+
+bce_nvram_write_exit:
 	if (align_start || align_end)
 		free(buf, M_DEVBUF);
 
-	return rc;
+	return (rc);
 }
 #endif /* BCE_NVRAM_WRITE_SUPPORT */
 
@@ -2026,25 +2171,33 @@ bce_nvram_test(struct bce_softc *sc)
 	 * Check that the device NVRAM is valid by reading
 	 * the magic value at offset 0.
 	 */
-	if ((rc = bce_nvram_read(sc, 0, data, 4)) != 0)
-		goto bce_nvram_test_done;
-
+	if ((rc = bce_nvram_read(sc, 0, data, 4)) != 0) {
+		BCE_PRINTF("%s(%d): Unable to read NVRAM!\n", __FILE__, __LINE__);
+		goto bce_nvram_test_exit;
+	}
 
+	/*
+	 * Verify that offset 0 of the NVRAM contains
+	 * a valid magic number.
+	 */
     magic = bce_be32toh(buf[0]);
 	if (magic != BCE_NVRAM_MAGIC) {
 		rc = ENODEV;
 		BCE_PRINTF("%s(%d): Invalid NVRAM magic value! Expected: 0x%08X, "
 			"Found: 0x%08X\n",
 			__FILE__, __LINE__, BCE_NVRAM_MAGIC, magic);
-		goto bce_nvram_test_done;
+		goto bce_nvram_test_exit;
 	}
 
 	/*
 	 * Verify that the device NVRAM includes valid
 	 * configuration data.
 	 */
-	if ((rc = bce_nvram_read(sc, 0x100, data, BCE_NVRAM_SIZE)) != 0)
-		goto bce_nvram_test_done;
+	if ((rc = bce_nvram_read(sc, 0x100, data, BCE_NVRAM_SIZE)) != 0) {
+		BCE_PRINTF("%s(%d): Unable to read Manufacturing Information from "
+			"NVRAM!\n", __FILE__, __LINE__);
+		goto bce_nvram_test_exit;
+	}
 
 	csum = ether_crc32_le(data, 0x100);
 	if (csum != BCE_CRC32_RESIDUAL) {
@@ -2052,21 +2205,106 @@ bce_nvram_test(struct bce_softc *sc)
 		BCE_PRINTF("%s(%d): Invalid Manufacturing Information NVRAM CRC! "
 			"Expected: 0x%08X, Found: 0x%08X\n",
 			__FILE__, __LINE__, BCE_CRC32_RESIDUAL, csum);
-		goto bce_nvram_test_done;
+		goto bce_nvram_test_exit;
 	}
 
 	csum = ether_crc32_le(data + 0x100, 0x100);
 	if (csum != BCE_CRC32_RESIDUAL) {
+		rc = ENODEV;
 		BCE_PRINTF("%s(%d): Invalid Feature Configuration Information "
 			"NVRAM CRC! Expected: 0x%08X, Found: 08%08X\n",
 			__FILE__, __LINE__, BCE_CRC32_RESIDUAL, csum);
-		rc = ENODEV;
 	}
 
-bce_nvram_test_done:
+bce_nvram_test_exit:
 	return rc;
 }
 
+/****************************************************************************/
+/* Identifies the current media type of the controller and sets the PHY     */
+/* address.                                                                 */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
+static void
+bce_get_media(struct bce_softc *sc)
+{
+	u32 val;
+
+	sc->bce_phy_addr = 1;
+
+	if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
+ 		u32 val = REG_RD(sc, BCE_MISC_DUAL_MEDIA_CTRL);
+		u32 bond_id = val & BCE_MISC_DUAL_MEDIA_CTRL_BOND_ID;
+		u32 strap;
+
+		/*
+		 * The BCM5709S is software configurable
+		 * for Copper or SerDes operation.
+		 */
+		if (bond_id == BCE_MISC_DUAL_MEDIA_CTRL_BOND_ID_C) {
+			DBPRINT(sc, BCE_INFO_LOAD, "5709 bonded for copper.\n");
+			goto bce_get_media_exit;
+		} else if (bond_id == BCE_MISC_DUAL_MEDIA_CTRL_BOND_ID_S) {
+			DBPRINT(sc, BCE_INFO_LOAD, "5709 bonded for dual media.\n");
+			sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG;
+			goto bce_get_media_exit;
+		}
+
+		if (val & BCE_MISC_DUAL_MEDIA_CTRL_STRAP_OVERRIDE)
+			strap = (val & BCE_MISC_DUAL_MEDIA_CTRL_PHY_CTRL) >> 21;
+		else
+			strap = (val & BCE_MISC_DUAL_MEDIA_CTRL_PHY_CTRL_STRAP) >> 8;
+
+		if (pci_get_function(sc->bce_dev) == 0) {
+			switch (strap) {
+			case 0x4:
+			case 0x5:
+			case 0x6:
+				DBPRINT(sc, BCE_INFO_LOAD, 
+					"BCM5709 s/w configured for SerDes.\n");
+				sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG;
+			default:
+				DBPRINT(sc, BCE_INFO_LOAD, 
+					"BCM5709 s/w configured for Copper.\n");
+			}
+		} else {
+			switch (strap) {
+			case 0x1:
+			case 0x2:
+			case 0x4:
+				DBPRINT(sc, BCE_INFO_LOAD, 
+					"BCM5709 s/w configured for SerDes.\n");
+				sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG;
+			default:
+				DBPRINT(sc, BCE_INFO_LOAD, 
+					"BCM5709 s/w configured for Copper.\n");
+			}
+		}
+
+	} else if (BCE_CHIP_BOND_ID(sc) & BCE_CHIP_BOND_ID_SERDES_BIT)
+		sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG;
+
+	if (sc->bce_phy_flags && BCE_PHY_SERDES_FLAG) {
+		sc->bce_flags |= BCE_NO_WOL_FLAG;
+		if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) {
+			sc->bce_phy_addr = 2;
+			val = REG_RD_IND(sc, sc->bce_shmem_base +
+				 BCE_SHARED_HW_CFG_CONFIG);
+			if (val & BCE_SHARED_HW_CFG_PHY_2_5G) {
+				sc->bce_phy_flags |= BCE_PHY_2_5G_CAPABLE_FLAG;
+				DBPRINT(sc, BCE_INFO_LOAD, "Found 2.5Gb capable adapter\n");
+			}
+		}
+	} else if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5706) ||
+		   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5708))
+		sc->bce_phy_flags |= BCE_PHY_CRC_FIX_FLAG;
+
+bce_get_media_exit:
+	DBPRINT(sc, (BCE_INFO_LOAD | BCE_INFO_PHY),
+		"Using PHY address %d.\n", sc->bce_phy_addr);
+}
 
 /****************************************************************************/
 /* Free any DMA memory owned by the driver.                                 */
@@ -2121,6 +2359,34 @@ bce_dma_free(struct bce_softc *sc)
 	if (sc->stats_tag != NULL)
 		bus_dma_tag_destroy(sc->stats_tag);
 
+	/* Free, unmap and destroy all context memory pages. */
+	if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
+		for (i = 0; i < sc->ctx_pages; i++ ) {
+			if (sc->ctx_block[i] != NULL) {
+				bus_dmamem_free(
+					sc->ctx_tag,
+				    sc->ctx_block[i],
+				    sc->ctx_map[i]);
+				sc->ctx_block[i] = NULL;
+			}
+
+			if (sc->ctx_map[i] != NULL) {
+				bus_dmamap_unload(
+					sc->ctx_tag,
+		    		sc->ctx_map[i]);
+				bus_dmamap_destroy(
+					sc->ctx_tag,
+				    sc->ctx_map[i]);
+				sc->ctx_map[i] = NULL;
+			}
+		}
+
+		/* Destroy the context memory tag. */
+		if (sc->ctx_tag != NULL) {
+			bus_dma_tag_destroy(sc->ctx_tag);
+			sc->ctx_tag = NULL;
+		}
+	}
 
 	/* Free, unmap and destroy all TX buffer descriptor chain pages. */
 	for (i = 0; i < TX_PAGES; i++ ) {
@@ -2250,6 +2516,21 @@ bce_dma_map_addr(void *arg, bus_dma_segm
 /* Allocates DMA memory needed for the various global structures needed by  */
 /* hardware.                                                                */
 /*                                                                          */
+/*                                                                          */
+/* Memory alignment requirements:                                           */
+/* -----------------+----------+----------+                                 */
+/*                  |   5706   |   5708   |   5709   |   5716   |           */
+/* -----------------+----------+----------+----------+----------+           */
+/* Status Block     | 8 bytes  | 8 bytes  | 16 bytes | 16 bytes |           */
+/* Statistics Block | 8 bytes  | 8 bytes  | 16 bytes | 16 bytes |           */
+/* RX Buffers       | 16 bytes | 16 bytes | 16 bytes | 16 bytes |           */
+/* PG Buffers       |   none   |   none   |   none   |   none   |           */
+/* TX Buffers       |   none   |   none   |   none   |   none   |           */
+/* Chain Pages(1)   |   4KiB   |   4KiB   |   4KiB   |   4KiB   |           */
+/* -----------------+----------+----------+----------+----------+           */
+/*                                                                          */
+/* (1) Must align with CPU page size (BCM_PAGE_SZIE).                       */
+/*                                                                          */
 /* Returns:                                                                 */
 /*   0 for success, positive value for failure.                             */
 /****************************************************************************/

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

From owner-svn-src-stable-6@FreeBSD.ORG  Fri Nov  6 19:16:34 2009
Return-Path: 
Delivered-To: svn-src-stable-6@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B599106566C;
	Fri,  6 Nov 2009 19:16:34 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 38E328FC0C;
	Fri,  6 Nov 2009 19:16:34 +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 nA6JGYYX026356;
	Fri, 6 Nov 2009 19:16:34 GMT (envelope-from ambrisko@svn.freebsd.org)
Received: (from ambrisko@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA6JGYrm026353;
	Fri, 6 Nov 2009 19:16:34 GMT (envelope-from ambrisko@svn.freebsd.org)
Message-Id: <200911061916.nA6JGYrm026353@svn.freebsd.org>
From: Doug Ambrisko 
Date: Fri, 6 Nov 2009 19:16:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198998 - in stable/6/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-stable-6@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 6-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 06 Nov 2009 19:16:34 -0000

Author: ambrisko
Date: Fri Nov  6 19:16:33 2009
New Revision: 198998
URL: http://svn.freebsd.org/changeset/base/198998

Log:
  Fix botched merge.  This was in an old repo. that I thought was current.
  Check in the real working code.
  
  Pointy hat to:	ambrisko

Modified:
  stable/6/sys/amd64/amd64/mp_machdep.c
  stable/6/sys/i386/i386/mp_machdep.c

Modified: stable/6/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- stable/6/sys/amd64/amd64/mp_machdep.c	Fri Nov  6 18:51:05 2009	(r198997)
+++ stable/6/sys/amd64/amd64/mp_machdep.c	Fri Nov  6 19:16:33 2009	(r198998)
@@ -133,6 +133,7 @@ struct cpu_info {
 	int	cpu_present:1;
 	int	cpu_bsp:1;
 	int	cpu_disabled:1;
+	int	cpu_hyperthread:1;
 } static cpu_info[MAX_APIC_ID + 1];
 static int cpu_apic_ids[MAXCPU];
 
@@ -342,11 +343,6 @@ cpu_mp_start(void)
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
 
-	assign_cpu_ids();
-
-	/* Start each Application Processor */
-	start_all_aps();
-
 	/* Setup the initial logical CPUs info. */
 	logical_cpus = logical_cpus_mask = 0;
 	if (cpu_feature & CPUID_HTT)
@@ -394,6 +390,12 @@ cpu_mp_start(void)
 			hyperthreading_cpus = logical_cpus;
 	}
 
+	assign_cpu_ids();
+
+	/* Start each Application Processor */
+	start_all_aps();
+
+
 	set_interrupt_apic_ids();
 }
 
@@ -404,9 +406,10 @@ cpu_mp_start(void)
 void
 cpu_mp_announce(void)
 {
+	const char *hyperthread;
 	int i;
 
-	/* List active CPUs first. */
+	/* List Active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
 	for (i = 1; i < mp_ncpus; i++) {
 		if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread)
@@ -414,7 +417,7 @@ cpu_mp_announce(void)
 		else
 			hyperthread = "";
 		printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread,
-		    cpu_apic_ids[i]);
+			cpu_apic_ids[i]);
 	}
 
 	/* List disabled CPUs last. */
@@ -426,7 +429,7 @@ cpu_mp_announce(void)
 		else
 			hyperthread = "";
 		printf("  cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread,
-		    i);
+			i);
 	}
 }
 
@@ -645,6 +648,9 @@ assign_cpu_ids(void)
 		if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp)
 			continue;
 
+		if (hyperthreading_cpus > 1 && i % hyperthreading_cpus != 0)
+			cpu_info[i].cpu_hyperthread = 1;
+
 		/* Don't use this CPU if it has been disabled by a tunable. */
 		if (resource_disabled("lapic", i)) {
 			cpu_info[i].cpu_disabled = 1;
@@ -655,18 +661,17 @@ assign_cpu_ids(void)
 	/*
 	 * Assign CPU IDs to local APIC IDs and disable any CPUs
 	 * beyond MAXCPU.  CPU 0 is always assigned to the BSP.
-	 *
+	 * 
 	 * To minimize confusion for userland, we attempt to number
-	 * CPUs such that all threads and cores in a package are
-	 * grouped together.  For now we assume that the BSP is always
+	 * CPUs such that all the threads and cores in a package are
+	 * grouped together. For now we assume that the BSP is always
 	 * the first thread in a package and just start adding APs
 	 * starting with the BSP's APIC ID.
 	 */
 	mp_ncpus = 1;
 	cpu_apic_ids[0] = boot_cpu_id;
-	apic_cpuids[boot_cpu_id] = 0;
-	for (i = boot_cpu_id + 1; i != boot_cpu_id;
-	     i == MAX_APIC_ID ? i = 0 : i++) {
+	for (i = boot_cpu_id + 1; i != boot_cpu_id; 
+		 i == MAX_APIC_ID ? i = 0 : i++) {
 		if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp ||
 		    cpu_info[i].cpu_disabled)
 			continue;

Modified: stable/6/sys/i386/i386/mp_machdep.c
==============================================================================
--- stable/6/sys/i386/i386/mp_machdep.c	Fri Nov  6 18:51:05 2009	(r198997)
+++ stable/6/sys/i386/i386/mp_machdep.c	Fri Nov  6 19:16:33 2009	(r198998)
@@ -217,6 +217,7 @@ struct cpu_info {
 	int	cpu_present:1;
 	int	cpu_bsp:1;
 	int	cpu_disabled:1;
+	int	cpu_hyperthread:1;
 } static cpu_info[MAX_APIC_ID + 1];
 static int cpu_apic_ids[MAXCPU];
 
@@ -418,11 +419,6 @@ cpu_mp_start(void)
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
 
-	assign_cpu_ids();
-
-	/* Start each Application Processor */
-	start_all_aps();
-
 	/* Setup the initial logical CPUs info. */
 	logical_cpus = logical_cpus_mask = 0;
 	if (cpu_feature & CPUID_HTT)
@@ -470,6 +466,11 @@ cpu_mp_start(void)
 			hyperthreading_cpus = logical_cpus;
 	}
 
+	assign_cpu_ids();
+
+	/* Start each Application Processor */
+	start_all_aps();
+
 	set_interrupt_apic_ids();
 }
 
@@ -480,11 +481,12 @@ cpu_mp_start(void)
 void
 cpu_mp_announce(void)
 {
+	const char *hyperthread;
 	int i;
 
 	POSTCODE(MP_ANNOUNCE_POST);
 
-	/* List active CPUs first. */
+	/* List Active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
 	for (i = 1; i < mp_ncpus; i++) {
 		if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread)
@@ -492,11 +494,11 @@ cpu_mp_announce(void)
 		else
 			hyperthread = "";
 		printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread,
-		    cpu_apic_ids[i]);
+				cpu_apic_ids[i]);
 	}
 
 	/* List disabled CPUs last. */
-	for (i = 0; i <= MAX_APIC_ID; i++) {
+	for (i=0 ; i<= MAX_APIC_ID; i++ ) {
 		if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled)
 			continue;
 		if (cpu_info[i].cpu_hyperthread)
@@ -504,7 +506,7 @@ cpu_mp_announce(void)
 		else
 			hyperthread = "";
 		printf("  cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread,
-		    i);
+			i);
 	}
 }
 
@@ -723,6 +725,9 @@ assign_cpu_ids(void)
 		if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp)
 			continue;
 
+		if (hyperthreading_cpus > 1 && i % hyperthreading_cpus != 0)
+			cpu_info[i].cpu_hyperthread = 1;
+
 		/* Don't use this CPU if it has been disabled by a tunable. */
 		if (resource_disabled("lapic", i)) {
 			cpu_info[i].cpu_disabled = 1;
@@ -735,16 +740,15 @@ assign_cpu_ids(void)
 	 * beyond MAXCPU.  CPU 0 is always assigned to the BSP.
 	 *
 	 * To minimize confusion for userland, we attempt to number
-	 * CPUs such that all threads and cores in a package are
-	 * grouped together.  For now we assume that the BSP is always
+	 * CPUs such that all the threads and cores in a package are
+	 * grouped together. For now we assume that the BSP is always
 	 * the first thread in a package and just start adding APs
 	 * starting with the BSP's APIC ID.
 	 */
 	mp_ncpus = 1;
 	cpu_apic_ids[0] = boot_cpu_id;
-	apic_cpuids[boot_cpu_id] = 0;
 	for (i = boot_cpu_id + 1; i != boot_cpu_id;
-	     i == MAX_APIC_ID ? i = 0 : i++) {
+		 i == MAX_APIC_ID ? i = 0 : i++) {
 		if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp ||
 		    cpu_info[i].cpu_disabled)
 			continue;