From owner-svn-src-stable-9@FreeBSD.ORG Sun Mar 25 00:44:54 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C001E106564A; Sun, 25 Mar 2012 00:44:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9E828FC16; Sun, 25 Mar 2012 00:44:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P0isW8055866; Sun, 25 Mar 2012 00:44:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P0is1O055864; Sun, 25 Mar 2012 00:44:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203250044.q2P0is1O055864@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 25 Mar 2012 00:44:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233439 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2012 00:44:54 -0000 Author: kib Date: Sun Mar 25 00:44:54 2012 New Revision: 233439 URL: http://svn.freebsd.org/changeset/base/233439 Log: MFC r232834: In ffs_syncvnode(), pass boolean false as second argument of ffs_update(). Synchronous inode block update is not needed for MNT_LAZY callers (syncer), and since waitfor values are not zero, code did unneccessary synchronous update. Modified: stable/9/sys/ufs/ffs/ffs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vnops.c Sun Mar 25 00:02:37 2012 (r233438) +++ stable/9/sys/ufs/ffs/ffs_vnops.c Sun Mar 25 00:44:54 2012 (r233439) @@ -300,7 +300,7 @@ next: } if (waitfor != MNT_WAIT) { BO_UNLOCK(bo); - return (ffs_update(vp, waitfor)); + return (ffs_update(vp, 0)); } /* Drain IO to see if we're done. */ bufobj_wwait(bo, 0, 0); From owner-svn-src-stable-9@FreeBSD.ORG Sun Mar 25 01:00:32 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 00057106566C; Sun, 25 Mar 2012 01:00:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C53448FC1B; Sun, 25 Mar 2012 01:00:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P10V7c056437; Sun, 25 Mar 2012 01:00:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P10V1N056435; Sun, 25 Mar 2012 01:00:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203250100.q2P10V1N056435@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 25 Mar 2012 01:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233440 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2012 01:00:32 -0000 Author: kib Date: Sun Mar 25 01:00:31 2012 New Revision: 233440 URL: http://svn.freebsd.org/changeset/base/233440 Log: MFC r232836: Do schedule delayed writes for async mounts. While there, make some style adjustments, like missed () around return values. Modified: stable/9/sys/ufs/ffs/ffs_inode.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_inode.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_inode.c Sun Mar 25 00:44:54 2012 (r233439) +++ stable/9/sys/ufs/ffs/ffs_inode.c Sun Mar 25 01:00:31 2012 (r233440) @@ -217,7 +217,7 @@ ffs_truncate(vp, length, flags, cred, td ip->i_din2->di_extb[i] = 0; } ip->i_flag |= IN_CHANGE; - if ((error = ffs_update(vp, 1))) + if ((error = ffs_update(vp, !DOINGASYNC(vp)))) return (error); for (i = 0; i < NXADDR; i++) { if (oldblks[i] == 0) @@ -243,13 +243,13 @@ ffs_truncate(vp, length, flags, cred, td ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) goto extclean; - return ffs_update(vp, 1); + return (ffs_update(vp, !DOINGASYNC(vp))); } if (ip->i_size == length) { ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) goto extclean; - return ffs_update(vp, 0); + return (ffs_update(vp, 0)); } if (fs->fs_ronly) panic("ffs_truncate: read-only filesystem"); @@ -276,10 +276,12 @@ ffs_truncate(vp, length, flags, cred, td bp->b_flags |= B_CLUSTEROK; if (flags & IO_SYNC) bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); else bawrite(bp); ip->i_flag |= IN_CHANGE | IN_UPDATE; - return ffs_update(vp, 1); + return (ffs_update(vp, !DOINGASYNC(vp))); } if (DOINGSOFTDEP(vp)) { if (softdeptrunc == 0 && journaltrunc == 0) { @@ -351,6 +353,8 @@ ffs_truncate(vp, length, flags, cred, td bp->b_flags |= B_CLUSTEROK; if (flags & IO_SYNC) bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); else bawrite(bp); } @@ -384,7 +388,7 @@ ffs_truncate(vp, length, flags, cred, td DIP_SET(ip, i_db[i], 0); } ip->i_flag |= IN_CHANGE | IN_UPDATE; - allerror = ffs_update(vp, 1); + allerror = ffs_update(vp, !DOINGASYNC(vp)); /* * Having written the new inode to disk, save its new configuration @@ -516,7 +520,7 @@ extclean: softdep_journal_freeblocks(ip, cred, length, IO_EXT); else softdep_setup_freeblocks(ip, length, IO_EXT); - return ffs_update(vp, MNT_WAIT); + return (ffs_update(vp, !DOINGASYNC(vp))); } /* @@ -597,7 +601,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, lev else bap2[i] = 0; if (DOINGASYNC(vp)) { - bawrite(bp); + bdwrite(bp); } else { error = bwrite(bp); if (error) From owner-svn-src-stable-9@FreeBSD.ORG Sun Mar 25 02:16:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2AF5106566B; Sun, 25 Mar 2012 02:16:57 +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 C59B58FC12; Sun, 25 Mar 2012 02:16:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P2Gv6b059086; Sun, 25 Mar 2012 02:16:57 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P2GvxP059080; Sun, 25 Mar 2012 02:16:57 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201203250216.q2P2GvxP059080@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 25 Mar 2012 02:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233446 - stable/9/contrib/tzdata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2012 02:16:58 -0000 Author: edwin Date: Sun Mar 25 02:16:57 2012 New Revision: 233446 URL: http://svn.freebsd.org/changeset/base/233446 Log: MFC of 226976, tzdata2011n - Fiji will end DST on 22 January 2012. - Moldova split into two timezones has been cancelled. - Cuba will end DST on 13 November 2011 Modified: stable/9/contrib/tzdata/australasia stable/9/contrib/tzdata/backward stable/9/contrib/tzdata/europe stable/9/contrib/tzdata/northamerica stable/9/contrib/tzdata/zone.tab Directory Properties: stable/9/contrib/tzdata/ (props changed) Modified: stable/9/contrib/tzdata/australasia ============================================================================== --- stable/9/contrib/tzdata/australasia Sun Mar 25 02:10:31 2012 (r233445) +++ stable/9/contrib/tzdata/australasia Sun Mar 25 02:16:57 2012 (r233446) @@ -1,5 +1,5 @@ #
-# @(#)australasia	8.28
+# @(#)australasia	8.29
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -308,6 +308,20 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # advance at 2am to 3am on October 23, 2011 and one hour back at 3am to 
 # 2am on February 26 next year.
 
+# From Ken Rylander (2011-10-24)
+# Another change to the Fiji DST end date. In the TZ database the end date for
+# Fiji DST 2012, is currently Feb 26. This has been changed to Jan 22.
+#
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# states:
+#
+# The end of daylight saving scheduled initially for the 26th of February 2012
+# has been brought forward to the 22nd of January 2012.
+# The commencement of daylight saving will remain unchanged and start
+# on the  23rd of October, 2011.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
@@ -316,7 +330,7 @@ Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
 Rule	Fiji	2011	only	-	Oct	23	2:00	1:00	S
-Rule	Fiji	2012	only	-	Feb	26	3:00	0	-
+Rule	Fiji	2012	only	-	Jan	22	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:53:40 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time

Modified: stable/9/contrib/tzdata/backward
==============================================================================
--- stable/9/contrib/tzdata/backward	Sun Mar 25 02:10:31 2012	(r233445)
+++ stable/9/contrib/tzdata/backward	Sun Mar 25 02:16:57 2012	(r233446)
@@ -1,5 +1,5 @@
 # 
-# @(#)backward	8.10
+# @(#)backward	8.11
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -67,6 +67,7 @@ Link	America/Havana		Cuba
 Link	Africa/Cairo		Egypt
 Link	Europe/Dublin		Eire
 Link	Europe/London		Europe/Belfast
+Link	Europe/Chisinau		Europe/Tiraspol
 Link	Europe/London		GB
 Link	Europe/London		GB-Eire
 Link	Etc/GMT			GMT+0

Modified: stable/9/contrib/tzdata/europe
==============================================================================
--- stable/9/contrib/tzdata/europe	Sun Mar 25 02:10:31 2012	(r233445)
+++ stable/9/contrib/tzdata/europe	Sun Mar 25 02:16:57 2012	(r233446)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.39
+# @(#)europe	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1678,6 +1678,18 @@ Zone	Europe/Malta	0:58:04 -	LMT	1893 Nov
 # a pre-1880 LMT offset of 1:58:32.
 #
 # (which agrees with the earlier entry that had been removed)
+#
+# From Alexander Krivenyshev (2011-10-26)
+# NO need to divide Moldova into two timezones at this point.
+# As of today, Transnistria (Pridnestrovie)- Tiraspol reversed its own
+# decision to abolish DST this winter. 
+# Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
+# Tiraspol will go back to winter time on October 30, 2011.
+# News from Moldova (in russian):
+# 
+# http://ru.publika.md/link_317061.html
+# 
+
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Chisinau	1:55:20 -	LMT	1880
@@ -1694,21 +1706,6 @@ Zone	Europe/Chisinau	1:55:20 -	LMT	1880
 # See Romania commentary for the guessed 1997 transition to EU rules.
 			2:00	EU	EE%sT
 
-Zone	Europe/Tiraspol	1:58:32 -	LMT	1880
-			1:55	-	CMT	1918 Feb 15 # Chisinau MT
-			1:44:24	-	BMT	1931 Jul 24 # Bucharest MT
-			2:00	Romania	EE%sT	1940 Aug 15
-			2:00	1:00	EEST	1941 Jul 17
-			1:00	C-Eur	CE%sT	1944 Aug 24
-			3:00	Russia	MSK/MSD	1990
-			3:00	-	MSK	1990 May 6
-			2:00	-	EET	1991
-			2:00	Russia	EE%sT	1992
-			2:00	E-Eur	EE%sT	1997
-# See Romania commentary for the guessed 1997 transition to EU rules.
-			2:00	EU	EE%sT	2011 Mar lastSun 1:00u
-			3:00	-	FET # Further-eastern European Time
-
 # Monaco
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.

Modified: stable/9/contrib/tzdata/northamerica
==============================================================================
--- stable/9/contrib/tzdata/northamerica	Sun Mar 25 02:10:31 2012	(r233445)
+++ stable/9/contrib/tzdata/northamerica	Sun Mar 25 02:16:57 2012	(r233446)
@@ -1,5 +1,5 @@
 # 
-# @(#)northamerica	8.50
+# @(#)northamerica	8.51
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2690,6 +2690,20 @@ Zone America/Costa_Rica	-5:36:20 -	LMT	1
 # 
 # http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
 # 
+#
+# From Steffen Thorsen (2011-10-30)
+# Cuba will end DST two weeks later this year. Instead of going back 
+# tonight, it has been delayed to 2011-11-13 at 01:00.
+#
+# One source (Spanish)
+# 
+# http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
+# 
+#
+# Our page:
+# 
+# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
+# 
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
@@ -2721,12 +2735,14 @@ Rule	Cuba	1997	only	-	Oct	12	0:00s	0	S
 Rule	Cuba	1998	1999	-	Mar	lastSun	0:00s	1:00	D
 Rule	Cuba	1998	2003	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2000	2004	-	Apr	Sun>=1	0:00s	1:00	D
-Rule	Cuba	2006	max	-	Oct	lastSun	0:00s	0	S
+Rule	Cuba	2006	2010	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2007	only	-	Mar	Sun>=8	0:00s	1:00	D
 Rule	Cuba	2008	only	-	Mar	Sun>=15	0:00s	1:00	D
 Rule	Cuba	2009	2010	-	Mar	Sun>=8	0:00s	1:00	D
 Rule	Cuba	2011	only	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2011	only	-	Nov	13	0:00s	0	S
 Rule	Cuba	2012	max	-	Mar	Sun>=8	0:00s	1:00	D
+Rule	Cuba	2012	max	-	Oct	lastSun	0:00s	0	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Havana	-5:29:28 -	LMT	1890

Modified: stable/9/contrib/tzdata/zone.tab
==============================================================================
--- stable/9/contrib/tzdata/zone.tab	Sun Mar 25 02:10:31 2012	(r233445)
+++ stable/9/contrib/tzdata/zone.tab	Sun Mar 25 02:16:57 2012	(r233446)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.50
+# @(#)zone.tab	8.52
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -257,8 +257,7 @@ LV	+5657+02406	Europe/Riga
 LY	+3254+01311	Africa/Tripoli
 MA	+3339-00735	Africa/Casablanca
 MC	+4342+00723	Europe/Monaco
-MD	+4700+02850	Europe/Chisinau	most locations
-MD	+4651+02938	Europe/Tiraspol	Pridnestrovie
+MD	+4700+02850	Europe/Chisinau
 ME	+4226+01916	Europe/Podgorica
 MF	+1804-06305	America/Marigot
 MG	-1855+04731	Indian/Antananarivo

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 02:18:23 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A7CF1065670;
	Sun, 25 Mar 2012 02:18:23 +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 43B1E8FC1B;
	Sun, 25 Mar 2012 02:18:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P2IN6t059193;
	Sun, 25 Mar 2012 02:18:23 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P2INfp059183;
	Sun, 25 Mar 2012 02:18:23 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201203250218.q2P2INfp059183@svn.freebsd.org>
From: Edwin Groothuis 
Date: Sun, 25 Mar 2012 02:18:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233447 - stable/9/contrib/tzdata
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 02:18:23 -0000

Author: edwin
Date: Sun Mar 25 02:18:22 2012
New Revision: 233447
URL: http://svn.freebsd.org/changeset/base/233447

Log:
  MFC of r233445, tzdata2012a
  
  - Updates to various locations in Antarctica.
  - Armenia will abolish DST this year.
  - Not only Samoa has moved to UTC+14, also Fakaofo did.
  - There will be a leap second in 30 June 2012.
  - Historical updates of 1918 to Canada, Winn, Regina, Edm, Vanc, Creston.
  - Chili stays on DST until 28 April 2012
  - The Falkland islands will stay on DST this year.

Modified:
  stable/9/contrib/tzdata/antarctica
  stable/9/contrib/tzdata/asia
  stable/9/contrib/tzdata/australasia
  stable/9/contrib/tzdata/europe
  stable/9/contrib/tzdata/leapseconds
  stable/9/contrib/tzdata/northamerica
  stable/9/contrib/tzdata/southamerica
  stable/9/contrib/tzdata/zone.tab
Directory Properties:
  stable/9/contrib/tzdata/   (props changed)

Modified: stable/9/contrib/tzdata/antarctica
==============================================================================
--- stable/9/contrib/tzdata/antarctica	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/antarctica	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)antarctica	8.9
+# @(#)antarctica	8.10
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -42,8 +42,19 @@ Rule	ChileAQ	1997	only	-	Mar	30	3:00u	0	
 Rule	ChileAQ	1998	only	-	Mar	Sun>=9	3:00u	0	-
 Rule	ChileAQ	1998	only	-	Sep	27	4:00u	1:00	S
 Rule	ChileAQ	1999	only	-	Apr	 4	3:00u	0	-
-Rule	ChileAQ	1999	max	-	Oct	Sun>=9	4:00u	1:00	S
-Rule	ChileAQ	2000	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	ChileAQ	1999	2010	-	Oct	Sun>=9	4:00u	1:00	S
+Rule	ChileAQ	2000	2007	-	Mar	Sun>=9	3:00u	0	-
+# N.B.: the end of March 29 in Chile is March 30 in Universal time,
+# which is used below in specifying the transition.
+Rule	ChileAQ	2008	only	-	Mar	30	3:00u	0	-
+Rule	ChileAQ	2009	only	-	Mar	Sun>=9	3:00u	0	-
+Rule	ChileAQ	2010	only	-	Apr	Sun>=1	3:00u	0	-
+Rule	ChileAQ	2011	only	-	May	Sun>=2	3:00u	0	-
+Rule	ChileAQ	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
+Rule	ChileAQ	2012	only	-	Apr	Sun>=23	3:00u	0	-
+Rule	ChileAQ	2012	only	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	ChileAQ	2013	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	ChileAQ	2013	max	-	Oct	Sun>=9	4:00u	1:00	S
 
 # These rules are stolen from the `australasia' file.
 Rule	AusAQ	1917	only	-	Jan	 1	0:01	1:00	-
@@ -142,12 +153,16 @@ Zone Antarctica/Casey	0	-	zzz	1969
 						# Western (Aus) Standard Time
 			11:00	-	CAST	2010 Mar 5 2:00
 						# Casey Time
+			8:00	-	WST	2011 Oct 28 2:00
+			11:00	-	CAST	2012 Feb 21 17:00u
 			8:00	-	WST
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
 			7:00	-	DAVT	2009 Oct 18 2:00
 			5:00	-	DAVT	2010 Mar 10 20:00u
+			7:00	-	DAVT	2011 Oct 28 2:00
+			5:00	-	DAVT	2012 Feb 21 20:00u
 			7:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18 2:00

Modified: stable/9/contrib/tzdata/asia
==============================================================================
--- stable/9/contrib/tzdata/asia	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/asia	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,4 +1,4 @@
-# @(#)asia	8.69
+# @(#)asia	8.70
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -77,10 +77,6 @@ Rule RussiaAsia	1993	max	-	Mar	lastSun	 
 Rule RussiaAsia	1993	1995	-	Sep	lastSun	 2:00s	0	-
 Rule RussiaAsia	1996	max	-	Oct	lastSun	 2:00s	0	-
 
-# From Arthur David Olson (2011-06-15):
-# While Russia abandoned DST in 2011, Armenia may choose to
-# follow Russia's "old" rules.
-
 # Afghanistan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Kabul	4:36:48 -	LMT	1890
@@ -97,6 +93,21 @@ Zone	Asia/Kabul	4:36:48 -	LMT	1890
 # in 1996, though it did use DST in 1995.  IATA SSIM (1991/1998) reports that
 # Armenia switched from 3:00 to 4:00 in 1998 and observed DST after 1991,
 # but started switching at 3:00s in 1998.
+
+# From Arthur David Olson (2011-06-15):
+# While Russia abandoned DST in 2011, Armenia may choose to
+# follow Russia's "old" rules.
+
+# From Alexander Krivenyshev (2012-02-10):
+# According to News Armenia, on Feb 9, 2012,
+# http://newsarmenia.ru/society/20120209/42609695.html
+# 
+# The Armenia National Assembly adopted final reading of Amendments to the
+# Law "On procedure of calculation time on the territory of the Republic of
+# Armenia" according to which Armenia [is] abolishing Daylight Saving Time.
+# or
+# (brief)
+# http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
 			3:00	-	YERT	1957 Mar    # Yerevan Time
@@ -104,7 +115,8 @@ Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May
 			3:00	1:00	YERST	1991 Sep 23 # independence
 			3:00 RussiaAsia	AM%sT	1995 Sep 24 2:00s
 			4:00	-	AMT	1997
-			4:00 RussiaAsia	AM%sT
+			4:00 RussiaAsia	AM%sT	2012 Mar 25 2:00s
+			4:00	-	AMT
 
 # Azerbaijan
 # From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23):

Modified: stable/9/contrib/tzdata/australasia
==============================================================================
--- stable/9/contrib/tzdata/australasia	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/australasia	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.29
+# @(#)australasia	8.30
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -616,6 +616,11 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # Dateline Change skip Friday 30th Dec 2011
 # Thursday 29th December 2011	23:59:59 Hours
 # Saturday 31st December 2011	00:00:00 Hours
+#
+# Clarification by Tim Parenti (2012-01-03):
+# Although Samoa has used Daylight Saving Time in the 2010-2011 and 2011-2012
+# seasons, there is not yet any indication that this trend will continue on
+# a regular basis. For now, we have explicitly listed the transitions below.
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
@@ -633,9 +638,28 @@ Zone Pacific/Guadalcanal 10:39:48 -	LMT	
 			11:00	-	SBT	# Solomon Is Time
 
 # Tokelau Is
+#
+# From Gwillim Law (2011-12-29)
+# A correspondent informed me that Tokelau, like Samoa, will be skipping
+# December 31 this year, thereby changing its time zone from UTC-10 to
+# UTC+14. When I tried to verify this statement, I found a confirming
+# article in Time magazine online
+# 
+# (http://www.time.com/time/world/article/0,8599,2103243,00.html).
+# 
+#
+# From Jonathan Leffler (2011-12-29)
+# Information from the BBC to the same effect:
+# 
+# http://www.bbc.co.uk/news/world-asia-16351377
+# 
+#
+# Patch supplied by Tim Parenti (2011-12-29)
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fakaofo	-11:24:56 -	LMT	1901
-			-10:00	-	TKT	# Tokelau Time
+			-10:00	-	TKT 2011 Dec 30	# Tokelau Time
+			14:00	-	TKT
 
 # Tonga
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S

Modified: stable/9/contrib/tzdata/europe
==============================================================================
--- stable/9/contrib/tzdata/europe	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/europe	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.40
+# @(#)europe	8.41
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -211,9 +211,15 @@
 # the history of summer time legislation in the United Kingdom.
 # Since 1998 Joseph S. Myers has been updating
 # and extending this list, which can be found in
-# 
+# http://student.cusu.cam.ac.uk/~jsm28/british-time/
+# 
 # History of legal time in Britain
 # 
+# Rob Crowther (2012-01-04) reports that that URL no longer
+# exists, and the article can now be found at:
+# 
+# http://www.polyomino.org.uk/british-time/
+# 
 
 # From Joseph S. Myers (1998-01-06):
 #
@@ -1151,10 +1157,10 @@ Rule	France	1940	only	-	Feb	25	 2:00	1:0
 # write that they were used in Monaco and in many French locations.
 # Le Corre writes that the upper limit of the free zone was Arneguy, Orthez,
 # Mont-de-Marsan, Bazas, Langon, Lamotte-Montravel, Marouil, La
-# Rochefoucault, Champagne-Mouton, La Roche-Posay, La Haye-Decartes,
+# Rochefoucault, Champagne-Mouton, La Roche-Posay, La Haye-Descartes,
 # Loches, Montrichard, Vierzon, Bourges, Moulins, Digoin,
 # Paray-le-Monial, Montceau-les-Mines, Chalons-sur-Saone, Arbois,
-# Dole, Morez, St-Claude, and Collognes (Haute-Savioe).
+# Dole, Morez, St-Claude, and Collonges (Haute-Savoie).
 Rule	France	1941	only	-	May	 5	 0:00	2:00	M # Midsummer
 # Shanks & Pottenger say this transition occurred at Oct 6 1:00,
 # but go with Denis Excoffier (1997-12-12),

Modified: stable/9/contrib/tzdata/leapseconds
==============================================================================
--- stable/9/contrib/tzdata/leapseconds	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/leapseconds	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.11
+# @(#)leapseconds	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -48,40 +48,54 @@ Leap	1997	Jun	30	23:59:60	+	S
 Leap	1998	Dec	31	23:59:60	+	S
 Leap	2005	Dec	31	23:59:60	+	S
 Leap	2008	Dec	31	23:59:60	+	S
+Leap	2012	Jun	30	23:59:60	+	S
 
 # INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
 #
 # SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
 #
+#
 # SERVICE DE LA ROTATION TERRESTRE
 # OBSERVATOIRE DE PARIS
 # 61, Av. de l'Observatoire 75014 PARIS (France)
-# Tel.      : 33 (0) 1 40 51 22 29
+# Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# Internet  : services.iers@obspm.fr
+# e-mail    : (E-Mail Removed)
+# http://hpiers.obspm.fr/eop-pc
+#
+# Paris, 5 January 2012
 #
-# Paris, 2 February 2011
 #
-# Bulletin C 41
+# Bulletin C 43
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# INFORMATION ON UTC - TAI
 #
-# NO positive leap second will be introduced at the end of June 2011.
-# The difference between Coordinated Universal Time UTC and the
-# International Atomic Time TAI is :		
+# UTC TIME STEP
+# on the 1st of July 2012
+#
 #
-# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# A positive leap second will be introduced at the end of June 2012.
+# The sequence of dates of the UTC second markers will be:		
+# 		
+#                          2012 June 30,     23h 59m 59s
+#                          2012 June 30,     23h 59m 60s
+#                          2012 July  1,      0h  0m  0s
+#
+# The difference between UTC and the International Atomic Time TAI is:
+#
+# from 2009 January 1, 0h UTC, to 2012 July 1  0h UTC  : UTC-TAI = - 34s
+# from 2012 July 1,    0h UTC, until further notice    : UTC-TAI = - 35s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC, or to confirm that there
+# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC or to confirm that there
 # will be no time step at the next possible date.
 #
+#
 # Daniel GAMBIS
-# Head			
-# Earth Orientation Center of the IERS
+# Head		
+# Earth Orientation Center of IERS
 # Observatoire de Paris, France

Modified: stable/9/contrib/tzdata/northamerica
==============================================================================
--- stable/9/contrib/tzdata/northamerica	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/northamerica	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)northamerica	8.51
+# @(#)northamerica	8.52
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1120,9 +1120,26 @@ Zone America/Menominee	-5:50:27 -	LMT	18
 # For now, assume all of DST-observing Canada will fall into line with the
 # new US DST rules,
 
+# From Chris Walton (2011-12-01)
+# In the first of Tammy Hardwick's articles
+# 
+# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
+# 
+# she quotes the Friday November 1/1918 edition of the Creston Review.
+# The quote includes these two statements:
+# 'Sunday the CPR went back to the old system of time...'
+# '... The daylight saving scheme was dropped all over Canada at the same time,'
+# These statements refer to a transition from daylight time to standard time
+# that occurred nationally on Sunday October 27/1918.  This transition was
+# also documented in the Saturday October 26/1918 edition of the Toronto Star.
+
+# In light of that evidence, we alter the date from the earlier believed
+# Oct 31, to Oct 27, 1918 (and Sunday is a more likely transition day
+# than Thursday) in all Canadian rulesets.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Canada	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Canada	1918	only	-	Oct	31	2:00	0	S
+Rule	Canada	1918	only	-	Oct	27	2:00	0	S
 Rule	Canada	1942	only	-	Feb	 9	2:00	1:00	W # War
 Rule	Canada	1945	only	-	Aug	14	23:00u	1:00	P # Peace
 Rule	Canada	1945	only	-	Sep	30	2:00	0	S
@@ -1645,7 +1662,7 @@ Zone America/Atikokan	-6:06:28 -	LMT	189
 Rule	Winn	1916	only	-	Apr	23	0:00	1:00	D
 Rule	Winn	1916	only	-	Sep	17	0:00	0	S
 Rule	Winn	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Winn	1918	only	-	Oct	31	2:00	0	S
+Rule	Winn	1918	only	-	Oct	27	2:00	0	S
 Rule	Winn	1937	only	-	May	16	2:00	1:00	D
 Rule	Winn	1937	only	-	Sep	26	2:00	0	S
 Rule	Winn	1942	only	-	Feb	 9	2:00	1:00	W # War
@@ -1728,7 +1745,7 @@ Zone America/Winnipeg	-6:28:36 -	LMT	188
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Regina	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Regina	1918	only	-	Oct	31	2:00	0	S
+Rule	Regina	1918	only	-	Oct	27	2:00	0	S
 Rule	Regina	1930	1934	-	May	Sun>=1	0:00	1:00	D
 Rule	Regina	1930	1934	-	Oct	Sun>=1	0:00	0	S
 Rule	Regina	1937	1941	-	Apr	Sun>=8	0:00	1:00	D
@@ -1765,7 +1782,7 @@ Zone America/Swift_Current -7:11:20 -	LM
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Edm	1918	1919	-	Apr	Sun>=8	2:00	1:00	D
-Rule	Edm	1918	only	-	Oct	31	2:00	0	S
+Rule	Edm	1918	only	-	Oct	27	2:00	0	S
 Rule	Edm	1919	only	-	May	27	2:00	0	S
 Rule	Edm	1920	1923	-	Apr	lastSun	2:00	1:00	D
 Rule	Edm	1920	only	-	Oct	lastSun	2:00	0	S
@@ -1795,9 +1812,68 @@ Zone America/Edmonton	-7:33:52 -	LMT	190
 # Dawson Creek uses MST.  Much of east BC is like Edmonton.
 # Matthews and Vincent (1998) write that Creston is like Dawson Creek.
 
+# It seems though that (re: Creston) is not entirely correct:
+
+# From Chris Walton (2011-12-01):
+# There are two areas within the Canadian province of British Columbia
+# that do not currently observe daylight saving:
+# a) The Creston Valley (includes the town of Creston and surrounding area)
+# b) The eastern half of the Peace River Regional District
+# (includes the cities of Dawson Creek and Fort St. John)
+
+# Earlier this year I stumbled across a detailed article about the time
+# keeping history of Creston; it was written by Tammy Hardwick who is the
+# manager of the Creston & District Museum. The article was written in May 2009.
+# 
+# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
+# 
+# According to the article, Creston has not changed its clocks since June 1918.
+# i.e. Creston has been stuck on UTC-7 for 93 years.
+# Dawson Creek, on the other hand, changed its clocks as recently as April 1972.
+
+# Unfortunately the exact date for the time change in June 1918 remains
+# unknown and will be difficult to ascertain.  I e-mailed Tammy a few months
+# ago to ask if Sunday June 2 was a reasonable guess.  She said it was just
+# as plausible as any other date (in June).  She also said that after writing the
+# article she had discovered another time change in 1916; this is the subject
+# of another article which she wrote in October 2010.
+# 
+# http://www.creston.museum.bc.ca/index.php?module=comments&uop=view_comment&cm+id=56
+# 
+
+# Here is a summary of the three clock change events in Creston's history:
+# 1. 1884 or 1885: adoption of Mountain Standard Time (GMT-7)
+# Exact date unknown
+# 2. Oct 1916: switch to Pacific Standard Time (GMT-8) 
+# Exact date in October unknown;  Sunday October 1 is a reasonable guess.
+# 3. June 1918: switch to Pacific Daylight Time (GMT-7)
+# Exact date in June unknown; Sunday June 2 is a reasonable guess.
+# note#1:
+# On Oct 27/1918 when daylight saving ended in the rest of Canada,
+# Creston did not change its clocks.
+# note#2:
+# During WWII when the Federal Government legislated a mandatory clock change,
+# Creston did not oblige.
+# note#3:
+# There is no guarantee that Creston will remain on Mountain Standard Time
+# (UTC-7) forever.
+# The subject was debated at least once this year by the town Council.
+# 
+# http://www.bclocalnews.com/kootenay_rockies/crestonvalleyadvance/news/116760809.html
+# 
+
+# During a period WWII, summer time (Daylight saying) was mandatory in Canada.
+# In Creston, that was handled by shifting the area to PST (-8:00) then applying
+# summer time to cause the offset to be -7:00, the same as it had been before
+# the change.  It can be argued that the timezone abbreviation during this
+# period should be PDT rather than MST, but that doesn't seem important enough
+# (to anyone) to further complicate the rules.
+
+# The transition dates (and times) are guesses.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Vanc	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Vanc	1918	only	-	Oct	31	2:00	0	S
+Rule	Vanc	1918	only	-	Oct	27	2:00	0	S
 Rule	Vanc	1942	only	-	Feb	 9	2:00	1:00	W # War
 Rule	Vanc	1945	only	-	Aug	14	23:00u	1:00	P # Peace
 Rule	Vanc	1945	only	-	Sep	30	2:00	0	S
@@ -1813,7 +1889,10 @@ Zone America/Dawson_Creek -8:00:56 -	LMT
 			-8:00	Canada	P%sT	1947
 			-8:00	Vanc	P%sT	1972 Aug 30 2:00
 			-7:00	-	MST
-
+Zone America/Creston	-7:46:04 -	LMT	1884
+			-7:00	-	MST	1916 Oct 1
+			-8:00	-	PST	1918 Jun 2
+			-7:00	-	MST
 
 # Northwest Territories, Nunavut, Yukon
 

Modified: stable/9/contrib/tzdata/southamerica
==============================================================================
--- stable/9/contrib/tzdata/southamerica	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/southamerica	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.52
+# @(#)southamerica	8.53
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1218,6 +1218,28 @@ Zone America/Rio_Branco	-4:31:12 -	LMT	1
 # August, not in October as they have since 1968. This is a pilot plan
 # which will be reevaluated in 2012.
 
+# From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23):
+# As stated in the website of the Chilean Energy Ministry
+# http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html
+# The Chilean Government has decided to postpone the entrance into winter time
+# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not
+# been yet formalized but it will within the next days.
+# Quote from the website communication:
+#
+# 6. For the year 2012, the dates of entry into winter time will be as follows:
+# a. Saturday April 28, 2012, clocks should go back 60 minutes; that is, at
+# 23:59:59, instead of passing to 0:00, the time should be adjusted to be 23:00
+# of the same day.
+# b. Saturday, September 1, 2012, clocks should go forward 60 minutes; that is,
+# at 23:59:59, instead of passing to 0:00, the time should be adjusted to be
+# 01:00 on September 2.
+#
+# Note that...this is yet another "temporary" change that will be reevaluated
+# AGAIN in 2013.
+
+# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
+# 'antarctica' file.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Chile	1927	1932	-	Sep	 1	0:00	1:00	S
 Rule	Chile	1928	1932	-	Apr	 1	0:00	0	-
@@ -1248,8 +1270,6 @@ Rule	Chile	1998	only	-	Mar	Sun>=9	3:00u	
 Rule	Chile	1998	only	-	Sep	27	4:00u	1:00	S
 Rule	Chile	1999	only	-	Apr	 4	3:00u	0	-
 Rule	Chile	1999	2010	-	Oct	Sun>=9	4:00u	1:00	S
-Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
-Rule	Chile	2012	max	-	Oct	Sun>=9	4:00u	1:00	S
 Rule	Chile	2000	2007	-	Mar	Sun>=9	3:00u	0	-
 # N.B.: the end of March 29 in Chile is March 30 in Universal time,
 # which is used below in specifying the transition.
@@ -1257,7 +1277,11 @@ Rule	Chile	2008	only	-	Mar	30	3:00u	0	-
 Rule	Chile	2009	only	-	Mar	Sun>=9	3:00u	0	-
 Rule	Chile	2010	only	-	Apr	Sun>=1	3:00u	0	-
 Rule	Chile	2011	only	-	May	Sun>=2	3:00u	0	-
-Rule	Chile	2012	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
+Rule	Chile	2012	only	-	Apr	Sun>=23	3:00u	0	-
+Rule	Chile	2012	only	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	Chile	2013	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	Chile	2013	max	-	Oct	Sun>=9	4:00u	1:00	S
 # IATA SSIM anomalies: (1992-02) says 1992-03-14;
 # (1996-09) says 1998-03-08.  Ignore these.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1403,6 +1427,21 @@ Zone Pacific/Galapagos	-5:58:24 -	LMT	19
 # will not revert to local mean time, but clocks will remain on Summer
 # time (UTC/GMT - 3 hours) throughout the whole of 2011.  Any long term
 # change to local time following the trial period will be notified.
+#
+# From Andrew Newman (2012-02-24)
+# A letter from Justin McPhee, Chief Executive,
+# Cable & Wireless Falkland Islands (dated 2012-02-22)
+# states...
+#   The current Atlantic/Stanley entry under South America expects the
+#   clocks to go back to standard Falklands Time (FKT) on the 15th April.
+#   The database entry states that in 2011 Stanley was staying on fixed
+#   summer time on a trial basis only.  FIG need to contact IANA and/or
+#   the maintainers of the database to inform them we're adopting
+#   the same policy this year and suggest recommendations for future years.
+#
+# For now we will assume permanent summer time for the Falklands
+# until advised differently (to apply for 2012 and beyond, after the 2011
+# experiment was apparently successful.)
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Falk	1937	1938	-	Sep	lastSun	0:00	1:00	S
 Rule	Falk	1938	1942	-	Mar	Sun>=19	0:00	0	-
@@ -1415,14 +1454,14 @@ Rule	Falk	1984	only	-	Sep	16	0:00	1:00	S
 Rule	Falk	1985	2000	-	Sep	Sun>=9	0:00	1:00	S
 Rule	Falk	1986	2000	-	Apr	Sun>=16	0:00	0	-
 Rule	Falk	2001	2010	-	Apr	Sun>=15	2:00	0	-
-Rule	Falk	2012	max	-	Apr	Sun>=15	2:00	0	-
-Rule	Falk	2001	max	-	Sep	Sun>=1	2:00	1:00	S
+Rule	Falk	2001	2010	-	Sep	Sun>=1	2:00	1:00	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Atlantic/Stanley	-3:51:24 -	LMT	1890
 			-3:51:24 -	SMT	1912 Mar 12  # Stanley Mean Time
 			-4:00	Falk	FK%sT	1983 May     # Falkland Is Time
 			-3:00	Falk	FK%sT	1985 Sep 15
-			-4:00	Falk	FK%sT
+			-4:00	Falk	FK%sT	2010 Sep 5 02:00
+			-3:00	-	FKST
 
 # French Guiana
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: stable/9/contrib/tzdata/zone.tab
==============================================================================
--- stable/9/contrib/tzdata/zone.tab	Sun Mar 25 02:16:57 2012	(r233446)
+++ stable/9/contrib/tzdata/zone.tab	Sun Mar 25 02:18:22 2012	(r233447)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.52
+# @(#)zone.tab	8.54
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -131,6 +131,7 @@ CA	+5333-11328	America/Edmonton	Mountain
 CA	+690650-1050310	America/Cambridge_Bay	Mountain Time - west Nunavut
 CA	+6227-11421	America/Yellowknife	Mountain Time - central Northwest Territories
 CA	+682059-1334300	America/Inuvik	Mountain Time - west Northwest Territories
+CA	+4906-11631	America/Creston		Mountain Standard Time - Creston, British Columbia
 CA	+5946-12014	America/Dawson_Creek	Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
 CA	+4916-12307	America/Vancouver	Pacific Time - west British Columbia
 CA	+6043-13503	America/Whitehorse	Pacific Time - south Yukon
@@ -333,7 +334,7 @@ RS	+4450+02030	Europe/Belgrade
 RU	+5443+02030	Europe/Kaliningrad	Moscow-01 - Kaliningrad
 RU	+5545+03735	Europe/Moscow	Moscow+00 - west Russia
 RU	+4844+04425	Europe/Volgograd	Moscow+00 - Caspian Sea
-RU	+5312+05009	Europe/Samara	Moscow - Samara, Udmurtia
+RU	+5312+05009	Europe/Samara	Moscow+00 - Samara, Udmurtia
 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

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 10:59:42 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 19B951065865;
	Sun, 25 Mar 2012 10:59:40 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AF1668FC1E;
	Sun, 25 Mar 2012 10:59:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PAxeER078443;
	Sun, 25 Mar 2012 10:59:40 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PAxeAh078441;
	Sun, 25 Mar 2012 10:59:40 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201203251059.q2PAxeAh078441@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Sun, 25 Mar 2012 10:59:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233460 - stable/9/sys/dev/usb/wlan
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 10:59:42 -0000

Author: bschmidt
Date: Sun Mar 25 10:59:40 2012
New Revision: 233460
URL: http://svn.freebsd.org/changeset/base/233460

Log:
  MFC r233283:
  Load the firmware during init not attach, as a root filesystem might
  not yet be available. While here, also print the firmware version.
  
  Submitted by:	PseudoCylon

Modified:
  stable/9/sys/dev/usb/wlan/if_run.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/9/sys/dev/usb/wlan/if_run.c	Sun Mar 25 09:23:10 2012	(r233459)
+++ stable/9/sys/dev/usb/wlan/if_run.c	Sun Mar 25 10:59:40 2012	(r233460)
@@ -600,12 +600,6 @@ run_attach(device_t self)
 	    sc->mac_ver, sc->mac_rev, run_get_rf(sc->rf_rev),
 	    sc->ntxchains, sc->nrxchains, ether_sprintf(sc->sc_bssid));
 
-	if ((error = run_load_microcode(sc)) != 0) {
-		device_printf(sc->sc_dev, "could not load 8051 microcode\n");
-		RUN_UNLOCK(sc);
-		goto detach;
-	}
-
 	RUN_UNLOCK(sc);
 
 	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
@@ -1050,8 +1044,9 @@ run_load_microcode(struct run_softc *sc)
 		error = ETIMEDOUT;
 		goto fail;
 	}
-	device_printf(sc->sc_dev, "firmware %s loaded\n",
-	    (base == fw->data) ? "RT2870" : "RT3071");
+	device_printf(sc->sc_dev, "firmware %s ver. %u.%u loaded\n",
+	    (base == fw->data) ? "RT2870" : "RT3071",
+	    *(base + 4092), *(base + 4093));
 
 fail:
 	firmware_put(fw, FIRMWARE_UNLOAD);
@@ -4677,6 +4672,11 @@ run_init_locked(struct run_softc *sc)
 
 	run_stop(sc);
 
+	if (run_load_microcode(sc) != 0) {
+		device_printf(sc->sc_dev, "could not load 8051 microcode\n");
+		goto fail;
+	}
+
 	for (ntries = 0; ntries < 100; ntries++) {
 		if (run_read(sc, RT2860_ASIC_VER_ID, &tmp) != 0)
 			goto fail;

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 13:20:39 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5F1361065670;
	Sun, 25 Mar 2012 13:20:39 +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 4885D8FC1F;
	Sun, 25 Mar 2012 13:20:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PDKdSn083254;
	Sun, 25 Mar 2012 13:20:39 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PDKdd0083251;
	Sun, 25 Mar 2012 13:20:39 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <201203251320.q2PDKdd0083251@svn.freebsd.org>
From: Christian Brueffer 
Date: Sun, 25 Mar 2012 13:20:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233464 - in stable/9/release/doc:
	en_US.ISO8859-1/hardware share/misc
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 13:20:39 -0000

Author: brueffer
Date: Sun Mar 25 13:20:38 2012
New Revision: 233464
URL: http://svn.freebsd.org/changeset/base/233464

Log:
  MFC: r232355
  
  Add snd_hdspe(4) to the hardware notes.

Modified:
  stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml
  stable/9/release/doc/share/misc/dev.archlist.txt
Directory Properties:
  stable/9/release/   (props changed)
  stable/9/release/doc/en_US.ISO8859-1/hardware/   (props changed)
  stable/9/release/picobsd/tinyware/passwd/   (props changed)

Modified: stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml
==============================================================================
--- stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml	Sun Mar 25 12:53:19 2012	(r233463)
+++ stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml	Sun Mar 25 13:20:38 2012	(r233464)
@@ -1415,6 +1415,8 @@
 
       &hwlist.snd.hda;
 
+      &hwlist.snd.hdspe;
+
       &hwlist.snd.ich;
 
       &hwlist.snd.maestro;

Modified: stable/9/release/doc/share/misc/dev.archlist.txt
==============================================================================
--- stable/9/release/doc/share/misc/dev.archlist.txt	Sun Mar 25 12:53:19 2012	(r233463)
+++ stable/9/release/doc/share/misc/dev.archlist.txt	Sun Mar 25 13:20:38 2012	(r233464)
@@ -131,6 +131,7 @@ snd_ess	i386,amd64
 snd_fm801	i386,amd64
 snd_gusc	i386,amd64
 snd_hda	i386,amd64
+snd_hdspe	i386,amd64
 snd_ich	i386,amd64
 snd_maestro	i386,amd64
 snd_maestro3	i386,amd64

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 16:20:02 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 095CC1065674;
	Sun, 25 Mar 2012 16:20:02 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E32468FC19;
	Sun, 25 Mar 2012 16:20:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PGK1ko089614;
	Sun, 25 Mar 2012 16:20:01 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PGK1PV089613;
	Sun, 25 Mar 2012 16:20:01 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203251620.q2PGK1PV089613@svn.freebsd.org>
From: Marius Strobl 
Date: Sun, 25 Mar 2012 16:20:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233467 - stable/9/share/mk
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 16:20:02 -0000

Author: marius
Date: Sun Mar 25 16:20:01 2012
New Revision: 233467
URL: http://svn.freebsd.org/changeset/base/233467

Log:
  MFC: r232754 (remaining part)
  
  Make boot2 build with Clang again.
  
  Submitted by:	dim (bsd.sys.mk)
  Reviewed by:	dim, jhb

Modified:
  stable/9/share/mk/bsd.sys.mk   (contents, props changed)

Modified: stable/9/share/mk/bsd.sys.mk
==============================================================================
--- stable/9/share/mk/bsd.sys.mk	Sun Mar 25 16:00:56 2012	(r233466)
+++ stable/9/share/mk/bsd.sys.mk	Sun Mar 25 16:20:01 2012	(r233467)
@@ -100,8 +100,10 @@ CWARNFLAGS	+=	-Wno-unknown-pragmas
 
 .if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
 CLANG_NO_IAS	=	-no-integrated-as
-CLANG_OPT_SMALL	=	-mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \
-			-mllvm -enable-load-pre=false
+CLANG_OPT_SMALL	=	-mllvm -stack-alignment=8 \
+			-mllvm -inline-threshold=3 \
+			-mllvm -enable-load-pre=false \
+			-mllvm -simplifycfg-dup-ret
 .endif
 
 .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 16:24:42 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A8155106566B;
	Sun, 25 Mar 2012 16:24:42 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 915BB8FC18;
	Sun, 25 Mar 2012 16:24:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PGOg8o089850;
	Sun, 25 Mar 2012 16:24:42 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PGOg06089848;
	Sun, 25 Mar 2012 16:24:42 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203251624.q2PGOg06089848@svn.freebsd.org>
From: Marius Strobl 
Date: Sun, 25 Mar 2012 16:24:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233468 - in stable/9/sys: boot/common i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 16:24:42 -0000

Author: marius
Date: Sun Mar 25 16:24:42 2012
New Revision: 233468
URL: http://svn.freebsd.org/changeset/base/233468

Log:
  MFC: r233105
  
  Declare some variables static in order to reduce the object size and
  redo r232822 (MFC'ed to stable/9 in r232962) in a less hackish way.
  The latter now no longer breaks compiling the x86 boot2 with clang.

Modified:
  stable/9/sys/boot/common/ufsread.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/boot/common/ufsread.c
==============================================================================
--- stable/9/sys/boot/common/ufsread.c	Sun Mar 25 16:20:01 2012	(r233467)
+++ stable/9/sys/boot/common/ufsread.c	Sun Mar 25 16:24:42 2012	(r233468)
@@ -46,8 +46,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-
 #include 
 #include 
 #include 
@@ -96,7 +94,7 @@ static uint32_t fs_off;
 static __inline uint8_t
 fsfind(const char *name, ino_t * ino)
 {
-	char buf[DEV_BSIZE];
+	static char buf[DEV_BSIZE];
 	struct direct *d;
 	char *s;
 	ssize_t n;
@@ -121,7 +119,7 @@ fsfind(const char *name, ino_t * ino)
 static ino_t
 lookup(const char *path)
 {
-	char name[MAXNAMLEN + 1];
+	static char name[MAXNAMLEN + 1];
 	const char *s;
 	ino_t ino;
 	ssize_t n;
@@ -169,18 +167,19 @@ fsread(ino_t inode, void *buf, size_t nb
 {
 #ifndef UFS2_ONLY
 	static struct ufs1_dinode dp1;
+	ufs1_daddr_t addr1;
 #endif
 #ifndef UFS1_ONLY
 	static struct ufs2_dinode dp2;
 #endif
+	static struct fs fs;
 	static ino_t inomap;
 	char *blkbuf;
 	void *indbuf;
-	struct fs fs;
 	char *s;
 	size_t n, nb, size, off, vboff;
 	ufs_lbn_t lbn;
-	ufs2_daddr_t addr, vbaddr;
+	ufs2_daddr_t addr2, vbaddr;
 	static ufs2_daddr_t blkmap, indmap;
 	u_int u;
 
@@ -251,12 +250,12 @@ fsread(ino_t inode, void *buf, size_t nb
 		lbn = lblkno(&fs, fs_off);
 		off = blkoff(&fs, fs_off);
 		if (lbn < NDADDR) {
-			addr = DIP(di_db[lbn]);
+			addr2 = DIP(di_db[lbn]);
 		} else if (lbn < NDADDR + NINDIR(&fs)) {
 			n = INDIRPERVBLK(&fs);
-			addr = DIP(di_ib[0]);
+			addr2 = DIP(di_ib[0]);
 			u = (u_int)(lbn - NDADDR) / n * DBPERVBLK;
-			vbaddr = fsbtodb(&fs, addr) + u;
+			vbaddr = fsbtodb(&fs, addr2) + u;
 			if (indmap != vbaddr) {
 				if (dskread(indbuf, vbaddr, DBPERVBLK))
 					return -1;
@@ -264,36 +263,24 @@ fsread(ino_t inode, void *buf, size_t nb
 			}
 			n = (lbn - NDADDR) & (n - 1);
 #if defined(UFS1_ONLY)
-#if BYTE_ORDER == BIG_ENDIAN
-			memcpy((char *)&addr + sizeof(addr) -
-			    sizeof(ufs1_daddr_t), (ufs1_daddr_t *)indbuf + n,
-			    sizeof(ufs1_daddr_t));
-#else
-			memcpy(&addr, (ufs1_daddr_t *)indbuf + n,
+			memcpy(&addr1, (ufs1_daddr_t *)indbuf + n,
 			    sizeof(ufs1_daddr_t));
-#endif
+			addr2 = addr1;
 #elif defined(UFS2_ONLY)
-			memcpy(&addr, (ufs2_daddr_t *)indbuf + n,
+			memcpy(&addr2, (ufs2_daddr_t *)indbuf + n,
 			    sizeof(ufs2_daddr_t));
 #else
-			if (fs.fs_magic == FS_UFS1_MAGIC)
-#if BYTE_ORDER == BIG_ENDIAN
-				memcpy((char *)&addr + sizeof(addr) -
-				    sizeof(ufs1_daddr_t),
-				    (ufs1_daddr_t *)indbuf + n,
-			    	sizeof(ufs1_daddr_t));
-#else
-				memcpy(&addr, (ufs1_daddr_t *)indbuf + n,
+			if (fs.fs_magic == FS_UFS1_MAGIC) {
+				memcpy(&addr1, (ufs1_daddr_t *)indbuf + n,
 				    sizeof(ufs1_daddr_t));
-#endif
-			else
-				memcpy(&addr, (ufs2_daddr_t *)indbuf + n,
+				addr2 = addr1;
+			} else
+				memcpy(&addr2, (ufs2_daddr_t *)indbuf + n,
 				    sizeof(ufs2_daddr_t));
 #endif
-		} else {
+		} else
 			return -1;
-		}
-		vbaddr = fsbtodb(&fs, addr) + (off >> VBLKSHIFT) * DBPERVBLK;
+		vbaddr = fsbtodb(&fs, addr2) + (off >> VBLKSHIFT) * DBPERVBLK;
 		vboff = off & VBLKMASK;
 		n = sblksize(&fs, size, lbn) - (off & ~VBLKMASK);
 		if (n > VBLKSIZE)

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 18:42:19 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EE525106566C;
	Sun, 25 Mar 2012 18:42:19 +0000 (UTC)
	(envelope-from andreast@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D640D8FC1D;
	Sun, 25 Mar 2012 18:42:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PIgJ4X094412;
	Sun, 25 Mar 2012 18:42:19 GMT
	(envelope-from andreast@svn.freebsd.org)
Received: (from andreast@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PIgJuc094410;
	Sun, 25 Mar 2012 18:42:19 GMT
	(envelope-from andreast@svn.freebsd.org)
Message-Id: <201203251842.q2PIgJuc094410@svn.freebsd.org>
From: Andreas Tobler 
Date: Sun, 25 Mar 2012 18:42:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233471 - stable/9/sys/powerpc/powermac
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 18:42:20 -0000

Author: andreast
Date: Sun Mar 25 18:42:19 2012
New Revision: 233471
URL: http://svn.freebsd.org/changeset/base/233471

Log:
  MFC: r232482
  Add support for PWM controlled fans. I found these fans on my PowerMac9,1.
  These fans are not located under the same node as the the RPM controlled ones,
  So I had to adapt the current source to parse and fill the properties correctly.
  To control the fans we can set the PWM ratio via sysctl between 20 and 100%.

Modified:
  stable/9/sys/powerpc/powermac/smu.c

Modified: stable/9/sys/powerpc/powermac/smu.c
==============================================================================
--- stable/9/sys/powerpc/powermac/smu.c	Sun Mar 25 16:25:18 2012	(r233470)
+++ stable/9/sys/powerpc/powermac/smu.c	Sun Mar 25 18:42:19 2012	(r233471)
@@ -74,8 +74,21 @@ struct smu_fan {
 	device_t dev;
 	cell_t	reg;
 
+	enum {
+		SMU_FAN_RPM,
+		SMU_FAN_PWM
+	} type;
 	int	old_style;
 	int	setpoint;
+	int     rpm;
+};
+
+/* We can read the PWM and the RPM from a PWM controlled fan.
+ * Offer both values via sysctl.
+ */
+enum {
+	SMU_PWM_SYSCTL_PWM   = 1 << 8,
+	SMU_PWM_SYSCTL_RPM   = 2 << 8
 };
 
 struct smu_sensor {
@@ -197,7 +210,7 @@ static driver_t smu_driver = {
 static devclass_t smu_devclass;
 
 DRIVER_MODULE(smu, nexus, smu_driver, smu_devclass, 0, 0);
-MALLOC_DEFINE(M_SMU, "smu", "SMU Sensor Information");
+static MALLOC_DEFINE(M_SMU, "smu", "SMU Sensor Information");
 
 #define SMU_MAILBOX		0x8000860c
 #define SMU_FANMGT_INTERVAL	1000 /* ms */
@@ -205,6 +218,10 @@ MALLOC_DEFINE(M_SMU, "smu", "SMU Sensor 
 /* Command types */
 #define SMU_ADC			0xd8
 #define SMU_FAN			0x4a
+#define SMU_RPM_STATUS		0x01
+#define SMU_RPM_SETPOINT	0x02
+#define SMU_PWM_STATUS		0x11
+#define SMU_PWM_SETPOINT	0x12
 #define SMU_I2C			0x9a
 #define  SMU_I2C_SIMPLE		0x00
 #define  SMU_I2C_NORMAL		0x01
@@ -303,19 +320,21 @@ smu_attach(device_t dev)
 	EVENTHANDLER_REGISTER(cpufreq_post_change, smu_cpufreq_post_change, dev,
 	    EVENTHANDLER_PRI_ANY);
 
+	node = ofw_bus_get_node(dev);
+
+	/* Some SMUs have RPM and PWM controlled fans which do not sit
+	 * under the same node. So we have to attach them separately.
+	 */
+	smu_attach_fans(dev, node);
+
 	/*
-	 * Detect and attach child devices.
+	 * Now detect and attach the other child devices.
 	 */
-	node = ofw_bus_get_node(dev);
 	for (child = OF_child(node); child != 0; child = OF_peer(child)) {
 		char name[32];
 		memset(name, 0, sizeof(name));
 		OF_getprop(child, "name", name, sizeof(name));
 
-		if (strncmp(name, "rpm-fans", 9) == 0 ||
-		    strncmp(name, "fans", 5) == 0)
-			smu_attach_fans(dev, child);
-
 		if (strncmp(name, "sensors", 8) == 0)
 			smu_attach_sensors(dev, child);
 
@@ -660,7 +679,7 @@ smu_fan_set_rpm(struct smu_fan *fan, int
 		cmd.data[1] = fan->reg;
 		cmd.data[2] = (rpm >> 8) & 0xff;
 		cmd.data[3] = rpm & 0xff;
-	
+
 		error = smu_run_cmd(smu, &cmd, 1);
 		if (error && error != EWOULDBLOCK)
 			fan->old_style = 1;
@@ -668,7 +687,7 @@ smu_fan_set_rpm(struct smu_fan *fan, int
 
 	if (fan->old_style) {
 		cmd.len = 14;
-		cmd.data[0] = 0;
+		cmd.data[0] = 0x00; /* RPM fan. */
 		cmd.data[1] = 1 << fan->reg;
 		cmd.data[2 + 2*fan->reg] = (rpm >> 8) & 0xff;
 		cmd.data[3 + 2*fan->reg] = rpm & 0xff;
@@ -704,7 +723,7 @@ smu_fan_read_rpm(struct smu_fan *fan)
 	if (fan->old_style) {
 		cmd.cmd = SMU_FAN;
 		cmd.len = 1;
-		cmd.data[0] = 1;
+		cmd.data[0] = SMU_RPM_STATUS;
 
 		error = smu_run_cmd(smu, &cmd, 1);
 		if (error)
@@ -715,6 +734,98 @@ smu_fan_read_rpm(struct smu_fan *fan)
 
 	return (rpm);
 }
+static int
+smu_fan_set_pwm(struct smu_fan *fan, int pwm)
+{
+	device_t smu = fan->dev;
+	struct smu_cmd cmd;
+	int error;
+
+	cmd.cmd = SMU_FAN;
+	error = EIO;
+
+	/* Clamp to allowed range */
+	pwm = max(fan->fan.min_rpm, pwm);
+	pwm = min(fan->fan.max_rpm, pwm);
+
+	/*
+	 * Apple has two fan control mechanisms. We can't distinguish
+	 * them except by seeing if the new one fails. If the new one
+	 * fails, use the old one.
+	 */
+	
+	if (!fan->old_style) {
+		cmd.len = 4;
+		cmd.data[0] = 0x30;
+		cmd.data[1] = fan->reg;
+		cmd.data[2] = (pwm >> 8) & 0xff;
+		cmd.data[3] = pwm & 0xff;
+	
+		error = smu_run_cmd(smu, &cmd, 1);
+		if (error && error != EWOULDBLOCK)
+			fan->old_style = 1;
+	}
+
+	if (fan->old_style) {
+		cmd.len = 14;
+		cmd.data[0] = 0x10; /* PWM fan. */
+		cmd.data[1] = 1 << fan->reg;
+		cmd.data[2 + 2*fan->reg] = (pwm >> 8) & 0xff;
+		cmd.data[3 + 2*fan->reg] = pwm & 0xff;
+		error = smu_run_cmd(smu, &cmd, 1);
+	}
+
+	if (error == 0)
+		fan->setpoint = pwm;
+
+	return (error);
+}
+
+static int
+smu_fan_read_pwm(struct smu_fan *fan, int *pwm, int *rpm)
+{
+	device_t smu = fan->dev;
+	struct smu_cmd cmd;
+	int error;
+
+	if (!fan->old_style) {
+		cmd.cmd = SMU_FAN;
+		cmd.len = 2;
+		cmd.data[0] = 0x31;
+		cmd.data[1] = fan->reg;
+
+		error = smu_run_cmd(smu, &cmd, 1);
+		if (error && error != EWOULDBLOCK)
+			fan->old_style = 1;
+
+		*rpm = (cmd.data[0] << 8) | cmd.data[1];
+	}
+
+	if (fan->old_style) {
+		cmd.cmd = SMU_FAN;
+		cmd.len = 1;
+		cmd.data[0] = SMU_PWM_STATUS;
+
+		error = smu_run_cmd(smu, &cmd, 1);
+		if (error)
+			return (error);
+
+		*rpm = (cmd.data[fan->reg*2+1] << 8) | cmd.data[fan->reg*2+2];
+	}
+	if (fan->old_style) {
+		cmd.cmd = SMU_FAN;
+		cmd.len = 14;
+		cmd.data[0] = SMU_PWM_SETPOINT;
+		cmd.data[1] = 1 << fan->reg;
+
+		error = smu_run_cmd(smu, &cmd, 1);
+		if (error)
+			return (error);
+
+		*pwm = cmd.data[fan->reg*2+2];
+	}
+	return (0);
+}
 
 static int
 smu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS)
@@ -722,24 +833,127 @@ smu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS)
 	device_t smu;
 	struct smu_softc *sc;
 	struct smu_fan *fan;
-	int rpm, error;
+	int pwm = 0, rpm, error = 0;
 
 	smu = arg1;
 	sc = device_get_softc(smu);
-	fan = &sc->sc_fans[arg2];
+	fan = &sc->sc_fans[arg2 & 0xff];
 
-	rpm = smu_fan_read_rpm(fan);
-	if (rpm < 0)
-		return (rpm);
+	if (fan->type == SMU_FAN_RPM) {
+		rpm = smu_fan_read_rpm(fan);
+		if (rpm < 0)
+			return (rpm);
 
-	error = sysctl_handle_int(oidp, &rpm, 0, req);
+		error = sysctl_handle_int(oidp, &rpm, 0, req);
+	} else {
+		error = smu_fan_read_pwm(fan, &pwm, &rpm);
+		if (error < 0)
+			return (EIO);
+
+		switch (arg2 & 0xff00) {
+		case SMU_PWM_SYSCTL_PWM:
+			error = sysctl_handle_int(oidp, &pwm, 0, req);
+			break;
+		case SMU_PWM_SYSCTL_RPM:
+			error = sysctl_handle_int(oidp, &rpm, 0, req);
+			break;
+		default:
+			/* This should never happen */
+			return (EINVAL);
+		};
+	}
+	/* We can only read the RPM from a PWM controlled fan, so return. */
+	if ((arg2 & 0xff00) == SMU_PWM_SYSCTL_RPM)
+		return (0);
 
 	if (error || !req->newptr)
 		return (error);
 
 	sc->sc_lastuserchange = time_uptime;
 
-	return (smu_fan_set_rpm(fan, rpm));
+	if (fan->type == SMU_FAN_RPM)
+		return (smu_fan_set_rpm(fan, rpm));
+	else
+		return (smu_fan_set_pwm(fan, pwm));
+}
+
+static void
+smu_fill_fan_prop(device_t dev, phandle_t child, int id)
+{
+	struct smu_fan *fan;
+	struct smu_softc *sc;
+	char type[32];
+
+	sc = device_get_softc(dev);
+	fan = &sc->sc_fans[id];
+
+	OF_getprop(child, "device_type", type, sizeof(type));
+	/* We have either RPM or PWM controlled fans. */
+	if (strcmp(type, "fan-rpm-control") == 0)
+		fan->type = SMU_FAN_RPM;
+	else
+		fan->type = SMU_FAN_PWM;
+
+	fan->dev = dev;
+	fan->old_style = 0;
+	OF_getprop(child, "reg", &fan->reg,
+		   sizeof(cell_t));
+	OF_getprop(child, "min-value", &fan->fan.min_rpm,
+		   sizeof(int));
+	OF_getprop(child, "max-value", &fan->fan.max_rpm,
+		   sizeof(int));
+	OF_getprop(child, "zone", &fan->fan.zone,
+		   sizeof(int));
+
+	if (OF_getprop(child, "unmanaged-value",
+		       &fan->fan.default_rpm,
+		       sizeof(int)) != sizeof(int))
+		fan->fan.default_rpm = fan->fan.max_rpm;
+
+	OF_getprop(child, "location", fan->fan.name,
+		   sizeof(fan->fan.name));
+
+	if (fan->type == SMU_FAN_RPM)
+		fan->setpoint = smu_fan_read_rpm(fan);
+	else
+		smu_fan_read_pwm(fan, &fan->setpoint, &fan->rpm);
+}
+
+/* On the first call count the number of fans. In the second call,
+ * after allocating the fan struct, fill the properties of the fans.
+ */
+static int
+smu_count_fans(device_t dev)
+{
+	struct smu_softc *sc;
+	phandle_t child, node, root;
+	int nfans = 0;
+
+	node = ofw_bus_get_node(dev);
+	sc = device_get_softc(dev);
+
+	/* First find the fanroots and count the number of fans. */
+	for (root = OF_child(node); root != 0; root = OF_peer(root)) {
+		char name[32];
+		memset(name, 0, sizeof(name));
+		OF_getprop(root, "name", name, sizeof(name));
+		if (strncmp(name, "rpm-fans", 9) == 0 ||
+		    strncmp(name, "pwm-fans", 9) == 0 ||
+		    strncmp(name, "fans", 5) == 0)
+			for (child = OF_child(root); child != 0;
+			     child = OF_peer(child)) {
+				nfans++;
+				/* When allocated, fill the fan properties. */
+				if (sc->sc_fans != NULL)
+					smu_fill_fan_prop(dev, child,
+							  nfans - 1);
+			}
+	}
+	if (nfans == 0) {
+		device_printf(dev, "WARNING: No fans detected!\n");
+		return (0);
+	}
+	return (nfans);
 }
 
 static void
@@ -749,79 +963,92 @@ smu_attach_fans(device_t dev, phandle_t 
 	struct smu_softc *sc;
 	struct sysctl_oid *oid, *fanroot_oid;
 	struct sysctl_ctx_list *ctx;
-	phandle_t child;
-	char type[32], sysctl_name[32];
-	int i;
+	char sysctl_name[32];
+	int i, j;
 
 	sc = device_get_softc(dev);
-	sc->sc_nfans = 0;
 
-	for (child = OF_child(fanroot); child != 0; child = OF_peer(child))
-		sc->sc_nfans++;
-
-	if (sc->sc_nfans == 0) {
-		device_printf(dev, "WARNING: No fans detected!\n");
+	/* Get the number of fans. */
+	sc->sc_nfans = smu_count_fans(dev);
+	if (sc->sc_nfans == 0)
 		return;
-	}
 
+	/* Now we're able to allocate memory for the fans struct. */
 	sc->sc_fans = malloc(sc->sc_nfans * sizeof(struct smu_fan), M_SMU,
 	    M_WAITOK | M_ZERO);
 
-	fan = sc->sc_fans;
-	sc->sc_nfans = 0;
+	/* Now fill in the properties. */
+	smu_count_fans(dev);
+	
+	/* Register fans with pmac_thermal */
+	for (i = 0; i < sc->sc_nfans; i++)
+		pmac_thermal_fan_register(&sc->sc_fans[i].fan);
 
 	ctx = device_get_sysctl_ctx(dev);
 	fanroot_oid = SYSCTL_ADD_NODE(ctx,
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fans",
 	    CTLFLAG_RD, 0, "SMU Fan Information");
 
-	for (child = OF_child(fanroot); child != 0; child = OF_peer(child)) {
-		OF_getprop(child, "device_type", type, sizeof(type));
-		if (strcmp(type, "fan-rpm-control") != 0)
-			continue;
+	/* Add sysctls */
+	for (i = 0; i < sc->sc_nfans; i++) {
+		fan = &sc->sc_fans[i];
+		for (j = 0; j < strlen(fan->fan.name); j++) {
+			sysctl_name[j] = tolower(fan->fan.name[j]);
+			if (isspace(sysctl_name[j]))
+				sysctl_name[j] = '_';
+		}
+		sysctl_name[j] = 0;
+		if (fan->type == SMU_FAN_RPM) {
+			oid = SYSCTL_ADD_NODE(ctx,
+					      SYSCTL_CHILDREN(fanroot_oid),
+					      OID_AUTO, sysctl_name,
+					      CTLFLAG_RD, 0, "Fan Information");
+			SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+				       "minrpm", CTLTYPE_INT | CTLFLAG_RD,
+				       &fan->fan.min_rpm, sizeof(int),
+				       "Minimum allowed RPM");
+			SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+				       "maxrpm", CTLTYPE_INT | CTLFLAG_RD,
+				       &fan->fan.max_rpm, sizeof(int),
+				       "Maximum allowed RPM");
+			SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+					"rpm",CTLTYPE_INT | CTLFLAG_RW |
+					CTLFLAG_MPSAFE, dev, i,
+					smu_fanrpm_sysctl, "I", "Fan RPM");
 
-		fan->dev = dev;
-		fan->old_style = 0;
-		OF_getprop(child, "reg", &fan->reg, sizeof(cell_t));
-		OF_getprop(child, "min-value", &fan->fan.min_rpm, sizeof(int));
-		OF_getprop(child, "max-value", &fan->fan.max_rpm, sizeof(int));
-		OF_getprop(child, "zone", &fan->fan.zone, sizeof(int));
-
-		if (OF_getprop(child, "unmanaged-value", &fan->fan.default_rpm,
-		    sizeof(int)) != sizeof(int))
-			fan->fan.default_rpm = fan->fan.max_rpm;
+			fan->fan.read = (int (*)(struct pmac_fan *))smu_fan_read_rpm;
+			fan->fan.set = (int (*)(struct pmac_fan *, int))smu_fan_set_rpm;
 
-		fan->setpoint = smu_fan_read_rpm(fan);
+		} else {
+			oid = SYSCTL_ADD_NODE(ctx,
+					      SYSCTL_CHILDREN(fanroot_oid),
+					      OID_AUTO, sysctl_name,
+					      CTLFLAG_RD, 0, "Fan Information");
+			SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+				       "minpwm", CTLTYPE_INT | CTLFLAG_RD,
+				       &fan->fan.min_rpm, sizeof(int),
+				       "Minimum allowed PWM in %");
+			SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+				       "maxpwm", CTLTYPE_INT | CTLFLAG_RD,
+				       &fan->fan.max_rpm, sizeof(int),
+				       "Maximum allowed PWM in %");
+			SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+					"pwm",CTLTYPE_INT | CTLFLAG_RW |
+					CTLFLAG_MPSAFE, dev,
+					SMU_PWM_SYSCTL_PWM | i,
+					smu_fanrpm_sysctl, "I", "Fan PWM in %");
+			SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+					"rpm",CTLTYPE_INT | CTLFLAG_RD |
+					CTLFLAG_MPSAFE, dev,
+					SMU_PWM_SYSCTL_RPM | i,
+					smu_fanrpm_sysctl, "I", "Fan RPM");
+			fan->fan.read = NULL;
+			fan->fan.set = (int (*)(struct pmac_fan *, int))smu_fan_set_pwm;
 
-		OF_getprop(child, "location", fan->fan.name,
-		    sizeof(fan->fan.name));
-	
-		/* Add sysctls */
-		for (i = 0; i < strlen(fan->fan.name); i++) {
-			sysctl_name[i] = tolower(fan->fan.name[i]);
-			if (isspace(sysctl_name[i]))
-				sysctl_name[i] = '_';
 		}
-		sysctl_name[i] = 0;
-
-		oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid),
-		    OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information");
-		SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minrpm",
-		    CTLTYPE_INT | CTLFLAG_RD, &fan->fan.min_rpm, sizeof(int),
-		    "Minimum allowed RPM");
-		SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxrpm",
-		    CTLTYPE_INT | CTLFLAG_RD, &fan->fan.max_rpm, sizeof(int),
-		    "Maximum allowed RPM");
-		SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm",
-		    CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev,
-		    sc->sc_nfans, smu_fanrpm_sysctl, "I", "Fan RPM");
-
-		fan->fan.read = (int (*)(struct pmac_fan *))smu_fan_read_rpm;
-		fan->fan.set = (int (*)(struct pmac_fan *, int))smu_fan_set_rpm;
-		pmac_thermal_fan_register(&fan->fan);
-
-		fan++;
-		sc->sc_nfans++;
+		if (bootverbose)
+			device_printf(dev, "Fan: %s type: %d\n",
+				      fan->fan.name, fan->type);
 	}
 }
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 18:43:15 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 746C5106564A;
	Sun, 25 Mar 2012 18:43:15 +0000 (UTC)
	(envelope-from andreast@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 452098FC22;
	Sun, 25 Mar 2012 18:43:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PIhFO0094470;
	Sun, 25 Mar 2012 18:43:15 GMT
	(envelope-from andreast@svn.freebsd.org)
Received: (from andreast@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PIhFuO094468;
	Sun, 25 Mar 2012 18:43:15 GMT
	(envelope-from andreast@svn.freebsd.org)
Message-Id: <201203251843.q2PIhFuO094468@svn.freebsd.org>
From: Andreas Tobler 
Date: Sun, 25 Mar 2012 18:43:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233472 - stable/9/sys/powerpc/powermac
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 18:43:15 -0000

Author: andreast
Date: Sun Mar 25 18:43:14 2012
New Revision: 233472
URL: http://svn.freebsd.org/changeset/base/233472

Log:
  MFC: r233188
  Provide a fix for certain PowerMacs where the U3 i2c lacks the interrupt
  info.

Modified:
  stable/9/sys/powerpc/powermac/uninorth.c

Modified: stable/9/sys/powerpc/powermac/uninorth.c
==============================================================================
--- stable/9/sys/powerpc/powermac/uninorth.c	Sun Mar 25 18:42:19 2012	(r233471)
+++ stable/9/sys/powerpc/powermac/uninorth.c	Sun Mar 25 18:43:14 2012	(r233472)
@@ -262,9 +262,11 @@ unin_chip_attach(device_t dev)
 	struct unin_chip_devinfo *dinfo;
 	phandle_t  root;
 	phandle_t  child;
+	phandle_t  iparent;
 	device_t   cdev;
 	char compat[32];
-	u_int reg[3];
+	char name[32];
+	u_int irq, reg[3];
 	int error, i = 0;
 
 	sc = device_get_softc(dev);
@@ -315,6 +317,33 @@ unin_chip_attach(device_t dev)
 		dinfo->udi_ninterrupts = 0;
 		unin_chip_add_intr(child, dinfo);
 
+		/*
+		 * Some Apple machines do have a bug in OF, they miss
+		 * the interrupt entries on the U3 I2C node. That means they
+		 * do not have an entry with number of interrupts nor the
+		 * entry of the interrupt parent handle.
+		 * We define an interrupt and hardwire it to the /u3/mpic
+		 * handle.
+		 */
+
+		if (OF_getprop(child, "name", name, sizeof(name)) <= 0)
+			device_printf(dev, "device has no name!\n");
+		if (dinfo->udi_ninterrupts == 0 &&
+		    (strcmp(name, "i2c-bus") == 0 ||
+		     strcmp(name, "i2c")  == 0)) {
+			if (OF_getprop(child, "interrupt-parent", &iparent,
+				       sizeof(iparent)) <= 0) {
+				iparent = OF_finddevice("/u3/mpic");
+				device_printf(dev, "Set /u3/mpic as iparent!\n");
+			}
+			/* Add an interrupt number 0 to the parent. */
+			irq = MAP_IRQ(iparent, 0);
+			resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ,
+					  dinfo->udi_ninterrupts, irq, irq, 1);
+			dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq;
+			dinfo->udi_ninterrupts++;
+		}
+
 		unin_chip_add_reg(child, dinfo);
 
 		cdev = device_add_child(dev, NULL, -1);

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 20:01:04 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 36411106566C;
	Sun, 25 Mar 2012 20:01:04 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2117C8FC1E;
	Sun, 25 Mar 2012 20:01:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PK13v2097239;
	Sun, 25 Mar 2012 20:01:03 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PK13Je097237;
	Sun, 25 Mar 2012 20:01:03 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201203252001.q2PK13Je097237@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sun, 25 Mar 2012 20:01:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233474 - stable/9/lib/libc/gen
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 20:01:04 -0000

Author: jilles
Date: Sun Mar 25 20:01:03 2012
New Revision: 233474
URL: http://svn.freebsd.org/changeset/base/233474

Log:
  MFC r233130: fts(3): Document cases where FTS_NOCHDIR is set implicitly.
  
  PR:		docs/166091
  Submitted by:	Matthew Story

Modified:
  stable/9/lib/libc/gen/fts.3
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/fts.3
==============================================================================
--- stable/9/lib/libc/gen/fts.3	Sun Mar 25 19:34:05 2012	(r233473)
+++ stable/9/lib/libc/gen/fts.3	Sun Mar 25 20:01:03 2012	(r233474)
@@ -28,7 +28,7 @@
 .\"     @(#)fts.3	8.5 (Berkeley) 4/16/94
 .\" $FreeBSD$
 .\"
-.Dd November 25, 2009
+.Dd March 18, 2012
 .Dt FTS 3
 .Os
 .Sh NAME
@@ -798,3 +798,13 @@ functions were introduced in
 principally to provide for alternative interfaces to the
 .Nm
 functionality using different data structures.
+.Sh BUGS
+The 
+.Fn fts_open
+function will automatically set the
+.Dv FTS_NOCHDIR
+option if the 
+.Dv FTS_LOGICAL
+option is provided, or if it cannot 
+.Xr open 2
+the current directory.

From owner-svn-src-stable-9@FreeBSD.ORG  Sun Mar 25 20:03:13 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A6032106566C;
	Sun, 25 Mar 2012 20:03:13 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9171B8FC1B;
	Sun, 25 Mar 2012 20:03:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PK3DGl097348;
	Sun, 25 Mar 2012 20:03:13 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PK3DE2097346;
	Sun, 25 Mar 2012 20:03:13 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201203252003.q2PK3DE2097346@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sun, 25 Mar 2012 20:03:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233475 - stable/9/lib/libc/gen
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sun, 25 Mar 2012 20:03:13 -0000

Author: jilles
Date: Sun Mar 25 20:03:13 2012
New Revision: 233475
URL: http://svn.freebsd.org/changeset/base/233475

Log:
  MFC r233132: fts(3): Mention that FTS_NOCHDIR imposes {PATH_MAX} limits on
  the returned pathnames.
  
  With the current API (no *at functions), FTS_NOCHDIR requires that the
  fts_accpath start with the original path passed to fts_open(); therefore,
  the depth that can be reached is limited by the {PATH_MAX} constraint on
  this pathname.

Modified:
  stable/9/lib/libc/gen/fts.3
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/fts.3
==============================================================================
--- stable/9/lib/libc/gen/fts.3	Sun Mar 25 20:01:03 2012	(r233474)
+++ stable/9/lib/libc/gen/fts.3	Sun Mar 25 20:03:13 2012	(r233475)
@@ -419,14 +419,17 @@ be provided to the
 .Fn fts_open
 function.
 .It Dv FTS_NOCHDIR
-As a performance optimization, the
+To allow descending to arbitrary depths
+(independent of
+.Brq Dv PATH_MAX )
+and improve performance, the
 .Nm
 functions change directories as they walk the file hierarchy.
 This has the side-effect that an application cannot rely on being
 in any particular directory during the traversal.
 The
 .Dv FTS_NOCHDIR
-option turns off this optimization, and the
+option turns off this feature, and the
 .Nm
 functions will not change the current directory.
 Note that applications should not themselves change their current directory

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 01:15:39 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6ABC0106564A;
	Mon, 26 Mar 2012 01:15:39 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 553F08FC17;
	Mon, 26 Mar 2012 01:15:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q1Fdr4007444;
	Mon, 26 Mar 2012 01:15:39 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q1FdAX007442;
	Mon, 26 Mar 2012 01:15:39 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203260115.q2Q1FdAX007442@svn.freebsd.org>
From: Eitan Adler 
Date: Mon, 26 Mar 2012 01:15:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233481 - stable/9/lib/libc/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 01:15:39 -0000

Author: eadler
Date: Mon Mar 26 01:15:38 2012
New Revision: 233481
URL: http://svn.freebsd.org/changeset/base/233481

Log:
  MFC r233138:
  	 draft-ietf-ipv6-scoping-arch-02.txt is now RFC 4007
  
  PR:		phk
  Approved by:	cperciva (implicit)

Modified:
  stable/9/lib/libc/net/getnameinfo.3
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/net/getnameinfo.3
==============================================================================
--- stable/9/lib/libc/net/getnameinfo.3	Sun Mar 25 23:50:34 2012	(r233480)
+++ stable/9/lib/libc/net/getnameinfo.3	Mon Mar 26 01:15:38 2012	(r233481)
@@ -135,7 +135,7 @@ and
 .El
 .Pp
 This implementation allows numeric IPv6 address notation with scope identifier,
-as documented in chapter 11 of draft-ietf-ipv6-scoping-arch-02.txt.
+as documented in chapter 11 of RFC 4007.
 IPv6 link-local address will appear as a string like
 .Dq Li fe80::1%ne0 .
 Refer to

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 02:40:55 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 41255106566B;
	Mon, 26 Mar 2012 02:40:55 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21A2E8FC1F;
	Mon, 26 Mar 2012 02:40:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q2esnD010297;
	Mon, 26 Mar 2012 02:40:54 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q2esNC010294;
	Mon, 26 Mar 2012 02:40:54 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260240.q2Q2esNC010294@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 02:40:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233485 - in stable/9/sys: dev/mii i386/conf modules/mii
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 02:40:55 -0000

Author: yongari
Date: Mon Mar 26 02:40:54 2012
New Revision: 233485
URL: http://svn.freebsd.org/changeset/base/233485

Log:
  MFC r232015-232016:
  r232015:
    Add Seeq Technology 80220 PHY support to smcphy(4).  This PHY is
    found on Adaptec AIC-6915 Starfire ethernet controller.
    While here, use status register to know resolved speed/duplex.
    With this change, sf(4) correctly reports speed/duplex of
    established link.
  
  r232016:
    Connect smcphy(4) to mii module build.

Modified:
  stable/9/sys/dev/mii/smcphy.c
  stable/9/sys/modules/mii/Makefile
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/mii/smcphy.c
==============================================================================
--- stable/9/sys/dev/mii/smcphy.c	Mon Mar 26 01:26:33 2012	(r233484)
+++ stable/9/sys/dev/mii/smcphy.c	Mon Mar 26 02:40:54 2012	(r233485)
@@ -55,6 +55,7 @@ static int	smcphy_attach(device_t);
 static int	smcphy_service(struct mii_softc *, struct mii_data *, int);
 static void	smcphy_reset(struct mii_softc *);
 static void	smcphy_auto(struct mii_softc *, int);
+static void	smcphy_status(struct mii_softc *);
 
 static device_method_t smcphy_methods[] = {
 	/* device interface */
@@ -76,13 +77,20 @@ static driver_t smcphy_driver = {
 DRIVER_MODULE(smcphy, miibus, smcphy_driver, smcphy_devclass, 0, 0);
 
 static const struct mii_phydesc smcphys[] = {
+	MII_PHY_DESC(SEEQ, 80220),
 	MII_PHY_DESC(SEEQ, 84220),
 	MII_PHY_END
 };
 
+static const struct mii_phy_funcs smcphy80220_funcs = {
+	smcphy_service,
+	smcphy_status,
+	mii_phy_reset
+};
+
 static const struct mii_phy_funcs smcphy_funcs = {
 	smcphy_service,
-	ukphy_status,	
+	smcphy_status,
 	smcphy_reset
 };
 
@@ -97,11 +105,16 @@ static int
 smcphy_attach(device_t dev)
 {
 	struct mii_softc *sc;
+	struct mii_attach_args *ma;
+	const struct mii_phy_funcs *mpf;
 
 	sc = device_get_softc(dev);
-
-	mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
-	    &smcphy_funcs, 1);
+	ma = device_get_ivars(dev);
+	if (MII_MODEL(ma->mii_id2) == MII_MODEL_SEEQ_80220)
+		mpf = &smcphy80220_funcs;
+	else
+		mpf = &smcphy_funcs;
+	mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, mpf, 1);
 	mii_phy_setmedia(sc);
 
 	return (0);
@@ -214,3 +227,46 @@ smcphy_auto(struct mii_softc *sc, int me
 	anar = PHY_READ(sc, MII_ANAR);
 	PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG);
 }
+
+static void
+smcphy_status(struct mii_softc *sc)
+{
+	struct mii_data *mii;
+	uint32_t bmcr, bmsr, status;
+
+	mii = sc->mii_pdata;
+	mii->mii_media_status = IFM_AVALID;
+	mii->mii_media_active = IFM_ETHER;
+
+	bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
+	if ((bmsr & BMSR_LINK) != 0)
+		mii->mii_media_status |= IFM_ACTIVE;
+
+	bmcr = PHY_READ(sc, MII_BMCR);
+	if ((bmcr & BMCR_ISO) != 0) {
+		mii->mii_media_active |= IFM_NONE;
+		mii->mii_media_status = 0;
+		return;
+	}
+
+	if ((bmcr & BMCR_LOOP) != 0)
+		mii->mii_media_active |= IFM_LOOP;
+
+	if ((bmcr & BMCR_AUTOEN) != 0) {
+		if ((bmsr & BMSR_ACOMP) == 0) {
+			/* Erg, still trying, I guess... */
+			mii->mii_media_active |= IFM_NONE;
+			return;
+		}
+	}
+
+	status = PHY_READ(sc, 0x12);
+	if (status & 0x0080)
+		mii->mii_media_active |= IFM_100_TX;
+	else
+		mii->mii_media_active |= IFM_10_T;
+	if (status & 0x0040)
+		mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc);
+	else
+		mii->mii_media_active |= IFM_HDX;
+}

Modified: stable/9/sys/modules/mii/Makefile
==============================================================================
--- stable/9/sys/modules/mii/Makefile	Mon Mar 26 01:26:33 2012	(r233484)
+++ stable/9/sys/modules/mii/Makefile	Mon Mar 26 02:40:54 2012	(r233485)
@@ -8,7 +8,7 @@ SRCS+=	ciphy.c device_if.h
 SRCS+=	e1000phy.c gentbi.c icsphy.c ip1000phy.c jmphy.c lxtphy.c
 SRCS+=	miibus_if.c miibus_if.h mii.c miidevs.h mii_bitbang.c mii_physubr.c
 SRCS+=	mlphy.c nsgphy.c nsphy.c nsphyter.c pci_if.h pnaphy.c qsphy.c
-SRCS+=	rdcphy.c rgephy.c rlphy.c tdkphy.c tlphy.c truephy.c
+SRCS+=	rdcphy.c rgephy.c rlphy.c smcphy.c tdkphy.c tlphy.c truephy.c
 SRCS+=	ukphy.c ukphy_subr.c
 SRCS+=	xmphy.c
 

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 03:45:47 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0BE8B106564A;
	Mon, 26 Mar 2012 03:45:47 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E9D488FC14;
	Mon, 26 Mar 2012 03:45:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q3jkwS012868;
	Mon, 26 Mar 2012 03:45:46 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q3jkx7012865;
	Mon, 26 Mar 2012 03:45:46 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260345.q2Q3jkx7012865@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 03:45:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233486 - in stable/9/sys: dev/sf i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 03:45:47 -0000

Author: yongari
Date: Mon Mar 26 03:45:46 2012
New Revision: 233486
URL: http://svn.freebsd.org/changeset/base/233486

Log:
  MFC r232019,232021,232025,232027,232029,232031,232040:
  r232019:
    Give hardware chance to drain active DMA cycles.
  
  r232021:
    If there are not enough RX buffers, release partially allocated RX
    buffers.
  
  r232025:
    Introduce sf_ifmedia_upd_locked() and have driver reset PHY before
    switching to selected media.  While here, set if_drv_flags before
    switching to selected media.
  
  r232027:
    No need to reprogram hardware RX filter when driver is not running.
  
  r232029:
    Remove taskqueue based MII stat change handler.
    Driver does not need deferred link state change processing.
    While I'm here, do not report current link status if interface is
    not UP.
  
  r232031:
    With r232015, sf(4) gets correct speed/duplex of established link.
    Add more strict speed check in sf_miibus_statchg() and do not touch
    MAC config registers when driver lost a link.
  
  r232040:
    Add check for IFF_DRV_RUNNING flag after serving an interrupt and
    don't give RX path more priority than TX path.
    Also remove infinite loop in interrupt handler and limit number of
    iteration to 32. This change addresses system load fluctuations
    under high network load.

Modified:
  stable/9/sys/dev/sf/if_sf.c
  stable/9/sys/dev/sf/if_sfreg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/sf/if_sf.c
==============================================================================
--- stable/9/sys/dev/sf/if_sf.c	Mon Mar 26 02:40:54 2012	(r233485)
+++ stable/9/sys/dev/sf/if_sf.c	Mon Mar 26 03:45:46 2012	(r233486)
@@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -172,6 +171,7 @@ static void sf_init_locked(struct sf_sof
 static void sf_stop(struct sf_softc *);
 static void sf_watchdog(struct sf_softc *);
 static int sf_ifmedia_upd(struct ifnet *);
+static int sf_ifmedia_upd_locked(struct ifnet *);
 static void sf_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 static void sf_reset(struct sf_softc *);
 static int sf_dma_alloc(struct sf_softc *);
@@ -191,7 +191,6 @@ static uint8_t sf_read_eeprom(struct sf_
 static int sf_miibus_readreg(device_t, int, int);
 static int sf_miibus_writereg(device_t, int, int, int);
 static void sf_miibus_statchg(device_t);
-static void sf_link_task(void *, int);
 #ifdef DEVICE_POLLING
 static int sf_poll(struct ifnet *ifp, enum poll_cmd cmd, int count);
 #endif
@@ -393,36 +392,30 @@ static void
 sf_miibus_statchg(device_t dev)
 {
 	struct sf_softc		*sc;
-
-	sc = device_get_softc(dev);
-	taskqueue_enqueue(taskqueue_swi, &sc->sf_link_task);
-}
-
-static void
-sf_link_task(void *arg, int pending)
-{
-	struct sf_softc		*sc;
 	struct mii_data		*mii;
 	struct ifnet		*ifp;
 	uint32_t		val;
 
-	sc = (struct sf_softc *)arg;
-
-	SF_LOCK(sc);
-
+	sc = device_get_softc(dev);
 	mii = device_get_softc(sc->sf_miibus);
 	ifp = sc->sf_ifp;
 	if (mii == NULL || ifp == NULL ||
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-		SF_UNLOCK(sc);
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 		return;
-	}
 
-	if (mii->mii_media_status & IFM_ACTIVE) {
-		if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
+	sc->sf_link = 0;
+	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+	    (IFM_ACTIVE | IFM_AVALID)) {
+		switch (IFM_SUBTYPE(mii->mii_media_active)) {
+		case IFM_10_T:
+		case IFM_100_TX:
+		case IFM_100_FX:
 			sc->sf_link = 1;
-	} else
-		sc->sf_link = 0;
+			break;
+		}
+	}
+	if (sc->sf_link == 0)
+		return;
 
 	val = csr_read_4(sc, SF_MACCFG_1);
 	val &= ~SF_MACCFG1_FULLDUPLEX;
@@ -453,8 +446,6 @@ sf_link_task(void *arg, int pending)
 	else
 		val &= ~SF_TIMER_TIMES_TEN;
 	csr_write_4(sc, SF_TIMER_CTL, val);
-
-	SF_UNLOCK(sc);
 }
 
 static void
@@ -523,20 +514,27 @@ static int
 sf_ifmedia_upd(struct ifnet *ifp)
 {
 	struct sf_softc		*sc;
-	struct mii_data		*mii;
-	struct mii_softc        *miisc;
 	int			error;
 
 	sc = ifp->if_softc;
 	SF_LOCK(sc);
+	error = sf_ifmedia_upd_locked(ifp);
+	SF_UNLOCK(sc);
+	return (error);
+}
+
+static int
+sf_ifmedia_upd_locked(struct ifnet *ifp)
+{
+	struct sf_softc		*sc;
+	struct mii_data		*mii;
+	struct mii_softc        *miisc;
 
+	sc = ifp->if_softc;
 	mii = device_get_softc(sc->sf_miibus);
 	LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
 		PHY_RESET(miisc);
-	error = mii_mediachg(mii);
-	SF_UNLOCK(sc);
-
-	return (error);
+	return (mii_mediachg(mii));
 }
 
 /*
@@ -550,8 +548,12 @@ sf_ifmedia_sts(struct ifnet *ifp, struct
 
 	sc = ifp->if_softc;
 	SF_LOCK(sc);
-	mii = device_get_softc(sc->sf_miibus);
+	if ((ifp->if_flags & IFF_UP) == 0) {
+		SF_UNLOCK(sc);
+		return;
+	}
 
+	mii = device_get_softc(sc->sf_miibus);
 	mii_pollstat(mii);
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;
@@ -592,7 +594,8 @@ sf_ioctl(struct ifnet *ifp, u_long comma
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		SF_LOCK(sc);
-		sf_rxfilter(sc);
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			sf_rxfilter(sc);
 		SF_UNLOCK(sc);
 		break;
 	case SIOCGIFMEDIA:
@@ -744,7 +747,6 @@ sf_attach(device_t dev)
 	mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 	    MTX_DEF);
 	callout_init_mtx(&sc->sf_co, &sc->sf_mtx, 0);
-	TASK_INIT(&sc->sf_link_task, 0, sf_link_task, sc);
 
 	/*
 	 * Map control/status registers.
@@ -946,7 +948,6 @@ sf_detach(device_t dev)
 		sf_stop(sc);
 		SF_UNLOCK(sc);
 		callout_drain(&sc->sf_co);
-		taskqueue_drain(taskqueue_swi, &sc->sf_link_task);
 		if (ifp != NULL)
 			ether_ifdetach(ifp);
 	}
@@ -1548,7 +1549,9 @@ sf_rxeof(struct sf_softc *sc)
 	 */
 	eidx = 0;
 	prog = 0;
-	for (cons = sc->sf_cdata.sf_rxc_cons; ; SF_INC(cons, SF_RX_CLIST_CNT)) {
+	for (cons = sc->sf_cdata.sf_rxc_cons;
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0;
+	    SF_INC(cons, SF_RX_CLIST_CNT)) {
 		cur_cmp = &sc->sf_rdata.sf_rx_cring[cons];
 		status = le32toh(cur_cmp->sf_rx_status1);
 		if (status == 0)
@@ -1851,6 +1854,7 @@ sf_intr(void *arg)
 	struct sf_softc		*sc;
 	struct ifnet		*ifp;
 	uint32_t		status;
+	int			cnt;
 
 	sc = (struct sf_softc *)arg;
 	SF_LOCK(sc);
@@ -1869,13 +1873,13 @@ sf_intr(void *arg)
 	if ((ifp->if_capenable & IFCAP_POLLING) != 0)
 		goto done_locked;
 #endif
-	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
-		goto done_locked;
 
 	/* Disable interrupts. */
 	csr_write_4(sc, SF_IMR, 0x00000000);
 
-	for (; (status & SF_INTRS) != 0;) {
+	for (cnt = 32; (status & SF_INTRS) != 0;) {
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+			break;
 		if ((status & SF_ISR_RXDQ1_DMADONE) != 0)
 			sf_rxeof(sc);
 
@@ -1910,15 +1914,19 @@ sf_intr(void *arg)
 #endif
 			}
 		}
+		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+			sf_start_locked(ifp);
+		if (--cnt <= 0)
+			break;
 		/* Reading the ISR register clears all interrrupts. */
 		status = csr_read_4(sc, SF_ISR);
 	}
 
-	/* Re-enable interrupts. */
-	csr_write_4(sc, SF_IMR, SF_INTRS);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+		/* Re-enable interrupts. */
+		csr_write_4(sc, SF_IMR, SF_INTRS);
+	}
 
-	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-		sf_start_locked(ifp);
 done_locked:
 	SF_UNLOCK(sc);
 }
@@ -2010,6 +2018,7 @@ sf_init_locked(struct sf_softc *sc)
 	if (sf_init_rx_ring(sc) == ENOBUFS) {
 		device_printf(sc->sf_dev,
 		    "initialization failed: no memory for rx buffers\n");
+		sf_stop(sc);
 		return;
 	}
 
@@ -2135,12 +2144,12 @@ sf_init_locked(struct sf_softc *sc)
 	else
 		SF_CLRBIT(sc, SF_GEN_ETH_CTL, SF_ETHCTL_RXGFP_ENB);
 
-	sc->sf_link = 0;
-	mii_mediachg(mii);
-
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
+	sc->sf_link = 0;
+	sf_ifmedia_upd_locked(ifp);
+
 	callout_reset(&sc->sf_co, hz, sf_tick, sc);
 }
 
@@ -2329,6 +2338,9 @@ sf_stop(struct sf_softc *sc)
 	/* Disable Tx/Rx egine. */
 	csr_write_4(sc, SF_GEN_ETH_CTL, 0);
 
+	/* Give hardware chance to drain active DMA cycles. */
+	DELAY(1000);
+
 	csr_write_4(sc, SF_CQ_CONSIDX, 0);
 	csr_write_4(sc, SF_CQ_PRODIDX, 0);
 	csr_write_4(sc, SF_RXDQ_ADDR_Q1, 0);

Modified: stable/9/sys/dev/sf/if_sfreg.h
==============================================================================
--- stable/9/sys/dev/sf/if_sfreg.h	Mon Mar 26 02:40:54 2012	(r233485)
+++ stable/9/sys/dev/sf/if_sfreg.h	Mon Mar 26 03:45:46 2012	(r233486)
@@ -1083,7 +1083,6 @@ struct sf_softc {
 	int			sf_if_flags;
 	struct callout		sf_co;
 	int			sf_watchdog_timer;
-	struct task		sf_link_task;
 	int			sf_link;
 	int			sf_suspended;
 	int			sf_detach;

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 03:54:20 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A07741065670;
	Mon, 26 Mar 2012 03:54:20 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4CE448FC22;
	Mon, 26 Mar 2012 03:54:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q3sKwl013273;
	Mon, 26 Mar 2012 03:54:20 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q3sKKq013269;
	Mon, 26 Mar 2012 03:54:20 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260354.q2Q3sKKq013269@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 03:54:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233489 - in stable/9/sys: dev/re i386/conf pci
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 03:54:20 -0000

Author: yongari
Date: Mon Mar 26 03:54:19 2012
New Revision: 233489
URL: http://svn.freebsd.org/changeset/base/233489

Log:
  MFC r232145:
    Use correct Config registers for RTL8139 family. Unlike RTL8168 and
    RTL810x family , RTL8139 has different register map for Config
    registers.
  
    While here, follow the lead of re(4) in WOL configuration.
     - Disable WOL_UCAST and WOL_MCAST capabilities by default.
     - Config5 register write does not need to unlock EEPROM access
       on RTL8139 family but unlocking EEPROM access does not affect
       its operation and make it consistent with re(4).
  
    Reported by:	Matt Renzelmann  mjr <> cs dot wisc dot edu

Modified:
  stable/9/sys/dev/re/if_re.c
  stable/9/sys/pci/if_rl.c
  stable/9/sys/pci/if_rlreg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/re/if_re.c
==============================================================================
--- stable/9/sys/dev/re/if_re.c	Mon Mar 26 03:49:46 2012	(r233488)
+++ stable/9/sys/dev/re/if_re.c	Mon Mar 26 03:54:19 2012	(r233489)
@@ -1473,6 +1473,22 @@ re_attach(device_t dev)
 		break;
 	}
 
+	if (sc->rl_hwrev->rl_rev == RL_HWREV_8139CPLUS) {
+		sc->rl_cfg0 = RL_8139_CFG0;
+		sc->rl_cfg1 = RL_8139_CFG1;
+		sc->rl_cfg2 = 0;
+		sc->rl_cfg3 = RL_8139_CFG3;
+		sc->rl_cfg4 = RL_8139_CFG4;
+		sc->rl_cfg5 = RL_8139_CFG5;
+	} else {
+		sc->rl_cfg0 = RL_CFG0;
+		sc->rl_cfg1 = RL_CFG1;
+		sc->rl_cfg2 = RL_CFG2;
+		sc->rl_cfg3 = RL_CFG3;
+		sc->rl_cfg4 = RL_CFG4;
+		sc->rl_cfg5 = RL_CFG5;
+	}
+
 	/* Reset the adapter. */
 	RL_LOCK(sc);
 	re_reset(sc);
@@ -1480,12 +1496,12 @@ re_attach(device_t dev)
 
 	/* Enable PME. */
 	CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
-	cfg = CSR_READ_1(sc, RL_CFG1);
+	cfg = CSR_READ_1(sc, sc->rl_cfg1);
 	cfg |= RL_CFG1_PME;
-	CSR_WRITE_1(sc, RL_CFG1, cfg);
-	cfg = CSR_READ_1(sc, RL_CFG5);
+	CSR_WRITE_1(sc, sc->rl_cfg1, cfg);
+	cfg = CSR_READ_1(sc, sc->rl_cfg5);
 	cfg &= RL_CFG5_PME_STS;
-	CSR_WRITE_1(sc, RL_CFG5, cfg);
+	CSR_WRITE_1(sc, sc->rl_cfg5, cfg);
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
 
 	if ((sc->rl_flags & RL_FLAG_PAR) != 0) {
@@ -2908,32 +2924,32 @@ re_set_jumbo(struct rl_softc *sc, int ju
 
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_WRITECFG);
 	if (jumbo != 0) {
-		CSR_WRITE_1(sc, RL_CFG3, CSR_READ_1(sc, RL_CFG3) |
+		CSR_WRITE_1(sc, sc->rl_cfg3, CSR_READ_1(sc, sc->rl_cfg3) |
 		    RL_CFG3_JUMBO_EN0);
 		switch (sc->rl_hwrev->rl_rev) {
 		case RL_HWREV_8168DP:
 			break;
 		case RL_HWREV_8168E:
-			CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) |
-			    0x01);
+			CSR_WRITE_1(sc, sc->rl_cfg4,
+			    CSR_READ_1(sc, sc->rl_cfg4) | 0x01);
 			break;
 		default:
-			CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) |
-			    RL_CFG4_JUMBO_EN1);
+			CSR_WRITE_1(sc, sc->rl_cfg4,
+			    CSR_READ_1(sc, sc->rl_cfg4) | RL_CFG4_JUMBO_EN1);
 		}
 	} else {
-		CSR_WRITE_1(sc, RL_CFG3, CSR_READ_1(sc, RL_CFG3) &
+		CSR_WRITE_1(sc, sc->rl_cfg3, CSR_READ_1(sc, sc->rl_cfg3) &
 		    ~RL_CFG3_JUMBO_EN0);
 		switch (sc->rl_hwrev->rl_rev) {
 		case RL_HWREV_8168DP:
 			break;
 		case RL_HWREV_8168E:
-			CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) &
-			    ~0x01);
+			CSR_WRITE_1(sc, sc->rl_cfg4,
+			    CSR_READ_1(sc, sc->rl_cfg4) & ~0x01);
 			break;
 		default:
-			CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) &
-			    ~RL_CFG4_JUMBO_EN1);
+			CSR_WRITE_1(sc, sc->rl_cfg4,
+			    CSR_READ_1(sc, sc->rl_cfg4) & ~RL_CFG4_JUMBO_EN1);
 		}
 	}
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
@@ -3046,7 +3062,7 @@ re_init_locked(struct rl_softc *sc)
 	if (sc->rl_hwrev->rl_rev == RL_HWREV_8169_8110SC ||
 	    sc->rl_hwrev->rl_rev == RL_HWREV_8169_8110SCE) {
 		reg = 0x000fff00;
-		if ((CSR_READ_1(sc, RL_CFG2) & RL_CFG2_PCI66MHZ) != 0)
+		if ((CSR_READ_1(sc, sc->rl_cfg2) & RL_CFG2_PCI66MHZ) != 0)
 			reg |= 0x000000ff;
 		if (sc->rl_hwrev->rl_rev == RL_HWREV_8169_8110SCE)
 			reg |= 0x00f00000;
@@ -3211,7 +3227,8 @@ re_init_locked(struct rl_softc *sc)
 	if (sc->rl_testmode)
 		return;
 
-	CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD);
+	CSR_WRITE_1(sc, sc->rl_cfg1, CSR_READ_1(sc, sc->rl_cfg1) |
+	    RL_CFG1_DRVLOAD);
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -3744,19 +3761,19 @@ re_setwol(struct rl_softc *sc)
 	CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
 
 	/* Enable PME. */
-	v = CSR_READ_1(sc, RL_CFG1);
+	v = CSR_READ_1(sc, sc->rl_cfg1);
 	v &= ~RL_CFG1_PME;
 	if ((ifp->if_capenable & IFCAP_WOL) != 0)
 		v |= RL_CFG1_PME;
-	CSR_WRITE_1(sc, RL_CFG1, v);
+	CSR_WRITE_1(sc, sc->rl_cfg1, v);
 
-	v = CSR_READ_1(sc, RL_CFG3);
+	v = CSR_READ_1(sc, sc->rl_cfg3);
 	v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC);
 	if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
 		v |= RL_CFG3_WOL_MAGIC;
-	CSR_WRITE_1(sc, RL_CFG3, v);
+	CSR_WRITE_1(sc, sc->rl_cfg3, v);
 
-	v = CSR_READ_1(sc, RL_CFG5);
+	v = CSR_READ_1(sc, sc->rl_cfg5);
 	v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST |
 	    RL_CFG5_WOL_LANWAKE);
 	if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0)
@@ -3765,7 +3782,7 @@ re_setwol(struct rl_softc *sc)
 		v |= RL_CFG5_WOL_MCAST | RL_CFG5_WOL_BCAST;
 	if ((ifp->if_capenable & IFCAP_WOL) != 0)
 		v |= RL_CFG5_WOL_LANWAKE;
-	CSR_WRITE_1(sc, RL_CFG5, v);
+	CSR_WRITE_1(sc, sc->rl_cfg5, v);
 
 	/* Config register write done. */
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
@@ -3801,17 +3818,17 @@ re_clrwol(struct rl_softc *sc)
 	/* Enable config register write. */
 	CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
 
-	v = CSR_READ_1(sc, RL_CFG3);
+	v = CSR_READ_1(sc, sc->rl_cfg3);
 	v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC);
-	CSR_WRITE_1(sc, RL_CFG3, v);
+	CSR_WRITE_1(sc, sc->rl_cfg3, v);
 
 	/* Config register write done. */
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
 
-	v = CSR_READ_1(sc, RL_CFG5);
+	v = CSR_READ_1(sc, sc->rl_cfg5);
 	v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST);
 	v &= ~RL_CFG5_WOL_LANWAKE;
-	CSR_WRITE_1(sc, RL_CFG5, v);
+	CSR_WRITE_1(sc, sc->rl_cfg5, v);
 }
 
 static void

Modified: stable/9/sys/pci/if_rl.c
==============================================================================
--- stable/9/sys/pci/if_rl.c	Mon Mar 26 03:49:46 2012	(r233488)
+++ stable/9/sys/pci/if_rl.c	Mon Mar 26 03:54:19 2012	(r233489)
@@ -717,6 +717,13 @@ rl_attach(device_t dev)
 		goto fail;
 	}
 
+	sc->rl_cfg0 = RL_8139_CFG0;
+	sc->rl_cfg1 = RL_8139_CFG1;
+	sc->rl_cfg2 = 0;
+	sc->rl_cfg3 = RL_8139_CFG3;
+	sc->rl_cfg4 = RL_8139_CFG4;
+	sc->rl_cfg5 = RL_8139_CFG5;
+
 	/*
 	 * Reset the adapter. Only take the lock here as it's needed in
 	 * order to call rl_reset().
@@ -818,6 +825,7 @@ rl_attach(device_t dev)
 		}
 	}
 	ifp->if_capenable = ifp->if_capabilities;
+	ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST);
 #ifdef DEVICE_POLLING
 	ifp->if_capabilities |= IFCAP_POLLING;
 #endif
@@ -1754,7 +1762,7 @@ rl_init_locked(struct rl_softc *sc)
 	sc->rl_flags &= ~RL_FLAG_LINK;
 	mii_mediachg(mii);
 
-	CSR_WRITE_1(sc, RL_CFG1, RL_CFG1_DRVLOAD|RL_CFG1_FULLDUPLEX);
+	CSR_WRITE_1(sc, sc->rl_cfg1, RL_CFG1_DRVLOAD|RL_CFG1_FULLDUPLEX);
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -2055,22 +2063,19 @@ rl_setwol(struct rl_softc *sc)
 	CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
 
 	/* Enable PME. */
-	v = CSR_READ_1(sc, RL_CFG1);
+	v = CSR_READ_1(sc, sc->rl_cfg1);
 	v &= ~RL_CFG1_PME;
 	if ((ifp->if_capenable & IFCAP_WOL) != 0)
 		v |= RL_CFG1_PME;
-	CSR_WRITE_1(sc, RL_CFG1, v);
+	CSR_WRITE_1(sc, sc->rl_cfg1, v);
 
-	v = CSR_READ_1(sc, RL_CFG3);
+	v = CSR_READ_1(sc, sc->rl_cfg3);
 	v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC);
 	if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
 		v |= RL_CFG3_WOL_MAGIC;
-	CSR_WRITE_1(sc, RL_CFG3, v);
-
-	/* Config register write done. */
-	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
+	CSR_WRITE_1(sc, sc->rl_cfg3, v);
 
-	v = CSR_READ_1(sc, RL_CFG5);
+	v = CSR_READ_1(sc, sc->rl_cfg5);
 	v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST);
 	v &= ~RL_CFG5_WOL_LANWAKE;
 	if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0)
@@ -2079,7 +2084,11 @@ rl_setwol(struct rl_softc *sc)
 		v |= RL_CFG5_WOL_MCAST | RL_CFG5_WOL_BCAST;
 	if ((ifp->if_capenable & IFCAP_WOL) != 0)
 		v |= RL_CFG5_WOL_LANWAKE;
-	CSR_WRITE_1(sc, RL_CFG5, v);
+	CSR_WRITE_1(sc, sc->rl_cfg5, v);
+
+	/* Config register write done. */
+	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
+
 	/* Request PME if WOL is requested. */
 	pmstat = pci_read_config(sc->rl_dev, pmc + PCIR_POWER_STATUS, 2);
 	pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
@@ -2101,15 +2110,15 @@ rl_clrwol(struct rl_softc *sc)
 	/* Enable config register write. */
 	CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
 
-	v = CSR_READ_1(sc, RL_CFG3);
+	v = CSR_READ_1(sc, sc->rl_cfg3);
 	v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC);
-	CSR_WRITE_1(sc, RL_CFG3, v);
+	CSR_WRITE_1(sc, sc->rl_cfg3, v);
 
 	/* Config register write done. */
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
 
-	v = CSR_READ_1(sc, RL_CFG5);
+	v = CSR_READ_1(sc, sc->rl_cfg5);
 	v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST);
 	v &= ~RL_CFG5_WOL_LANWAKE;
-	CSR_WRITE_1(sc, RL_CFG5, v);
+	CSR_WRITE_1(sc, sc->rl_cfg5, v);
 }

Modified: stable/9/sys/pci/if_rlreg.h
==============================================================================
--- stable/9/sys/pci/if_rlreg.h	Mon Mar 26 03:49:46 2012	(r233488)
+++ stable/9/sys/pci/if_rlreg.h	Mon Mar 26 03:54:19 2012	(r233489)
@@ -74,6 +74,14 @@
 #define	RL_TIMERCNT	0x0048		/* timer count register */
 #define	RL_MISSEDPKT	0x004C		/* missed packet counter */
 #define	RL_EECMD	0x0050		/* EEPROM command register */
+
+/* RTL8139/RTL8139C+ only */
+#define	RL_8139_CFG0	0x0051		/* config register #0 */
+#define	RL_8139_CFG1	0x0052		/* config register #1 */
+#define	RL_8139_CFG3	0x0059		/* config register #3 */
+#define	RL_8139_CFG4	0x005A		/* config register #4 */
+#define	RL_8139_CFG5	0x00D8		/* config register #5 */
+
 #define	RL_CFG0		0x0051		/* config register #0 */
 #define	RL_CFG1		0x0052		/* config register #1 */
 #define	RL_CFG2		0x0053		/* config register #2 */
@@ -873,6 +881,12 @@ struct rl_softc {
 	int			rl_eewidth;
 	int			rl_expcap;
 	int			rl_txthresh;
+	bus_size_t		rl_cfg0;
+	bus_size_t		rl_cfg1;
+	bus_size_t		rl_cfg2;
+	bus_size_t		rl_cfg3;
+	bus_size_t		rl_cfg4;
+	bus_size_t		rl_cfg5;
 	struct rl_chain_data	rl_cdata;
 	struct rl_list_data	rl_ldata;
 	struct callout		rl_stat_callout;

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 04:27:02 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 285921065670;
	Mon, 26 Mar 2012 04:27:02 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 087EC8FC21;
	Mon, 26 Mar 2012 04:27:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q4R12u014450;
	Mon, 26 Mar 2012 04:27:01 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q4R1El014447;
	Mon, 26 Mar 2012 04:27:01 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260427.q2Q4R1El014447@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 04:27:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233492 - in stable/9/sys: dev/mii dev/re i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 04:27:02 -0000

Author: yongari
Date: Mon Mar 26 04:27:01 2012
New Revision: 233492
URL: http://svn.freebsd.org/changeset/base/233492

Log:
  MFC r232246:
    Prefer RL_GMEDIASTAT register to RGEPHY_MII_SSR register to
    extract a link status of PHY when parent driver is re(4).
    RGEPHY_MII_SSR register does not seem to report correct PHY status
    on some integrated PHYs used with re(4).
    Unfortunately, RealTek PHYs have no additional information to
    differentiate integrated PHYs from external ones so relying on PHY
    model number is not enough to know that.  However, it seems
    RGEPHY_MII_SSR register exists for external RealTek PHYs so
    checking parent driver would be good indication to know which PHY
    was used. In other words, for non-re(4) controllers, the PHY is
    external one and its revision number is greater than or equal to 2.
    This change fixes intermittent link UP/DOWN messages reported on
    RTL8169 controller.
  
    Also, mii_attach(9) is tried after setting interface name since
    rgephy(4) have to know parent driver name.
  
    PR:	kern/165509

Modified:
  stable/9/sys/dev/mii/rgephy.c
  stable/9/sys/dev/re/if_re.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/mii/rgephy.c
==============================================================================
--- stable/9/sys/dev/mii/rgephy.c	Mon Mar 26 03:56:52 2012	(r233491)
+++ stable/9/sys/dev/mii/rgephy.c	Mon Mar 26 04:27:01 2012	(r233492)
@@ -110,10 +110,15 @@ static int
 rgephy_attach(device_t dev)
 {
 	struct mii_softc *sc;
+	struct mii_attach_args *ma;
+	u_int flags;
 
 	sc = device_get_softc(dev);
-
-	mii_phy_dev_attach(dev, 0, &rgephy_funcs, 0);
+	ma = device_get_ivars(dev);
+	flags = 0;
+	if (strcmp(ma->mii_data->mii_ifp->if_dname, "re") == 0)
+		flags |= MIIF_PHYPRIV0;
+	mii_phy_dev_attach(dev, flags, &rgephy_funcs, 0);
 
 	/* RTL8169S do not report auto-sense; add manually. */
 	sc->mii_capabilities = (PHY_READ(sc, MII_BMSR) | BMSR_ANEG) &
@@ -243,7 +248,8 @@ setit:
 		 * Check to see if we have link.  If we do, we don't
 		 * need to restart the autonegotiation process.
 		 */
-		if (sc->mii_mpd_rev >= 2) {
+		if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 &&
+		    sc->mii_mpd_rev >= 2) {
 			/* RTL8211B(L) */
 			reg = PHY_READ(sc, RGEPHY_MII_SSR);
 			if (reg & RGEPHY_SSR_LINK) {
@@ -298,7 +304,7 @@ rgephy_status(struct mii_softc *sc)
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
 
-	if (sc->mii_mpd_rev >= 2) {
+	if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) {
 		ssr = PHY_READ(sc, RGEPHY_MII_SSR);
 		if (ssr & RGEPHY_SSR_LINK)
 			mii->mii_media_status |= IFM_ACTIVE;
@@ -328,7 +334,7 @@ rgephy_status(struct mii_softc *sc)
 		}
 	}
 
-	if (sc->mii_mpd_rev >= 2) {
+	if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) {
 		ssr = PHY_READ(sc, RGEPHY_MII_SSR);
 		switch (ssr & RGEPHY_SSR_SPD_MASK) {
 		case RGEPHY_SSR_S1000:
@@ -484,7 +490,7 @@ rgephy_reset(struct mii_softc *sc)
 {
 	uint16_t ssr;
 
-	if (sc->mii_mpd_rev == 3) {
+	if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev == 3) {
 		/* RTL8211C(L) */
 		ssr = PHY_READ(sc, RGEPHY_MII_SSR);
 		if ((ssr & RGEPHY_SSR_ALDPS) != 0) {

Modified: stable/9/sys/dev/re/if_re.c
==============================================================================
--- stable/9/sys/dev/re/if_re.c	Mon Mar 26 03:56:52 2012	(r233491)
+++ stable/9/sys/dev/re/if_re.c	Mon Mar 26 04:27:01 2012	(r233492)
@@ -1573,19 +1573,6 @@ re_attach(device_t dev)
 		re_gmii_writereg(dev, 1, 0x0e, 0);
 	}
 
-#define	RE_PHYAD_INTERNAL	 0
-
-	/* Do MII setup. */
-	phy = RE_PHYAD_INTERNAL;
-	if (sc->rl_type == RL_8169)
-		phy = 1;
-	error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd,
-	    re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE);
-	if (error != 0) {
-		device_printf(dev, "attaching PHYs failed\n");
-		goto fail;
-	}
-
 	ifp->if_softc = sc;
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
@@ -1610,6 +1597,19 @@ re_attach(device_t dev)
 
 	TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc);
 
+#define	RE_PHYAD_INTERNAL	 0
+
+	/* Do MII setup. */
+	phy = RE_PHYAD_INTERNAL;
+	if (sc->rl_type == RL_8169)
+		phy = 1;
+	error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd,
+	    re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
+		goto fail;
+	}
+
 	/*
 	 * Call MI attach routine.
 	 */

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 04:36:22 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id EF6BA106566C;
	Mon, 26 Mar 2012 04:36:22 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFA778FC17;
	Mon, 26 Mar 2012 04:36:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q4aMs2014938;
	Mon, 26 Mar 2012 04:36:22 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q4aM3p014935;
	Mon, 26 Mar 2012 04:36:22 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260436.q2Q4aM3p014935@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 04:36:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233495 - in stable/9/sys: dev/bge i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 04:36:23 -0000

Author: yongari
Date: Mon Mar 26 04:36:22 2012
New Revision: 233495
URL: http://svn.freebsd.org/changeset/base/233495

Log:
  MFC r232848:
    Add workaround for PCI-X BCM5704 controller that live behind
    AMD-8131 PCI-X bridge.  The bridge seems to reorder write access to
    mailbox registers such that it caused watchdog timeouts by
    out-of-order TX completions.
  
    Tested by:	Michael L. Squires  siralan dot org >

Modified:
  stable/9/sys/dev/bge/if_bge.c
  stable/9/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/bge/if_bge.c
==============================================================================
--- stable/9/sys/dev/bge/if_bge.c	Mon Mar 26 04:30:46 2012	(r233494)
+++ stable/9/sys/dev/bge/if_bge.c	Mon Mar 26 04:36:22 2012	(r233495)
@@ -380,6 +380,8 @@ static void bge_dma_free(struct bge_soft
 static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t,
     bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *);
 
+static int bge_mbox_reorder(struct bge_softc *);
+
 static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]);
 static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]);
 static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]);
@@ -635,6 +637,8 @@ bge_writembx(struct bge_softc *sc, int o
 		off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI;
 
 	CSR_WRITE_4(sc, off, val);
+	if ((sc->bge_flags & BGE_FLAG_MBOX_REORDER) != 0)
+		CSR_READ_4(sc, off);
 }
 
 /*
@@ -2609,10 +2613,10 @@ bge_dma_alloc(struct bge_softc *sc)
 		 * XXX
 		 * watchdog timeout issue was observed on BCM5704 which
 		 * lives behind PCI-X bridge(e.g AMD 8131 PCI-X bridge).
-		 * Limiting DMA address space to 32bits seems to address
-		 * it.
+		 * Both limiting DMA address space to 32bits and flushing
+		 * mailbox write seem to address the issue.
 		 */
-		if (sc->bge_flags & BGE_FLAG_PCIX)
+		if (sc->bge_pcixcap != 0)
 			lowaddr = BUS_SPACE_MAXADDR_32BIT;
 	}
 	error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev),
@@ -2775,6 +2779,56 @@ bge_can_use_msi(struct bge_softc *sc)
 }
 
 static int
+bge_mbox_reorder(struct bge_softc *sc)
+{
+	/* Lists of PCI bridges that are known to reorder mailbox writes. */
+	static const struct mbox_reorder {
+		const uint16_t vendor;
+		const uint16_t device;
+		const char *desc;
+	} const mbox_reorder_lists[] = {
+		{ 0x1022, 0x7450, "AMD-8131 PCI-X Bridge" },
+	};
+	devclass_t pci, pcib;
+	device_t bus, dev;
+	int count, i;
+
+	count = sizeof(mbox_reorder_lists) / sizeof(mbox_reorder_lists[0]);
+	pci = devclass_find("pci");
+	pcib = devclass_find("pcib");
+	dev = sc->bge_dev;
+	bus = device_get_parent(dev);
+	for (;;) {
+		dev = device_get_parent(bus);
+		bus = device_get_parent(dev);
+		device_printf(sc->bge_dev, "dev : %s%d, bus : %s%d\n",
+		    device_get_name(dev), device_get_unit(dev),
+		    device_get_name(bus), device_get_unit(bus));
+		if (device_get_devclass(dev) != pcib)
+			break;
+		for (i = 0; i < count; i++) {
+			device_printf(sc->bge_dev,
+			    "probing dev : %s%d, vendor : 0x%04x "
+			    "device : 0x%04x\n",
+			    device_get_name(dev), device_get_unit(dev),
+			    pci_get_vendor(dev), pci_get_device(dev));
+			if (pci_get_vendor(dev) ==
+			    mbox_reorder_lists[i].vendor &&
+			    pci_get_device(dev) ==
+			    mbox_reorder_lists[i].device) {
+				device_printf(sc->bge_dev,
+				    "enabling MBOX workaround for %s\n",
+				    mbox_reorder_lists[i].desc);
+				return (1);
+			}
+		}
+		if (device_get_devclass(bus) != pci)
+			break;
+	}
+	return (0);
+}
+
+static int
 bge_attach(device_t dev)
 {
 	struct ifnet *ifp;
@@ -3094,6 +3148,16 @@ bge_attach(device_t dev)
 	if (BGE_IS_5714_FAMILY(sc) && (sc->bge_flags & BGE_FLAG_PCIX))
 		sc->bge_flags |= BGE_FLAG_40BIT_BUG;
 	/*
+	 * Some PCI-X bridges are known to trigger write reordering to
+	 * the mailbox registers. Typical phenomena is watchdog timeouts
+	 * caused by out-of-order TX completions.  Enable workaround for
+	 * PCI-X devices that live behind these bridges.
+	 * Note, PCI-X controllers can run in PCI mode so we can't use
+	 * BGE_FLAG_PCIX flag to detect PCI-X controllers.
+	 */
+	if (sc->bge_pcixcap != 0 && bge_mbox_reorder(sc) != 0)
+		sc->bge_flags |= BGE_FLAG_MBOX_REORDER;
+	/*
 	 * Allocate the interrupt, using MSI if possible.  These devices
 	 * support 8 MSI messages, but only the first one is used in
 	 * normal operation.

Modified: stable/9/sys/dev/bge/if_bgereg.h
==============================================================================
--- stable/9/sys/dev/bge/if_bgereg.h	Mon Mar 26 04:30:46 2012	(r233494)
+++ stable/9/sys/dev/bge/if_bgereg.h	Mon Mar 26 04:36:22 2012	(r233495)
@@ -2828,6 +2828,7 @@ struct bge_softc {
 #define	BGE_FLAG_RX_ALIGNBUG	0x04000000
 #define	BGE_FLAG_SHORT_DMA_BUG	0x08000000
 #define	BGE_FLAG_4K_RDMA_BUG	0x10000000
+#define	BGE_FLAG_MBOX_REORDER	0x20000000
 	uint32_t		bge_phy_flags;
 #define	BGE_PHY_NO_WIRESPEED	0x00000001
 #define	BGE_PHY_ADC_BUG		0x00000002

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 04:47:07 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21DDB1065672;
	Mon, 26 Mar 2012 04:47:07 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D4358FC1C;
	Mon, 26 Mar 2012 04:47:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q4l6JV015502;
	Mon, 26 Mar 2012 04:47:06 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q4l6QR015499;
	Mon, 26 Mar 2012 04:47:06 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260447.q2Q4l6QR015499@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 04:47:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233498 - in stable/9/sys: dev/bge i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 04:47:07 -0000

Author: yongari
Date: Mon Mar 26 04:47:06 2012
New Revision: 233498
URL: http://svn.freebsd.org/changeset/base/233498

Log:
  MFC r232849-232850:
  r232849:
    Show PCI bus speed and width as well as running mode of PCI-X
    device in device attach.  This would help to narrow down issue to a
    specific controller and operating mode of the controller.
    While I'm here rename BGE_MISCCFG_BOARD_ID with
    BGE_MISCCFG_BOARD_ID_MASK.
  
  r232850:
    Make if_ierrors updated whenever any of the following counters are
    updated.
     o Number of times NIC ran out of RX buffer descriptors
     o Number of inbound packet errors
     o Number of inbound packets that were chosen to be discarded
    Previously only the discarded packet counter was used to update
    if_ierrors.  This change fixes wrong if_ierrors counter on
    BCM570[0-4] controllers.  For BCM5705 and later controllers bge(4)
    already correctly counted it.
  
    Reported by:	Eugene Grosbein  rdtc dot ru>

Modified:
  stable/9/sys/dev/bge/if_bge.c
  stable/9/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/bge/if_bge.c
==============================================================================
--- stable/9/sys/dev/bge/if_bge.c	Mon Mar 26 04:39:10 2012	(r233497)
+++ stable/9/sys/dev/bge/if_bge.c	Mon Mar 26 04:47:06 2012	(r233498)
@@ -380,6 +380,7 @@ static void bge_dma_free(struct bge_soft
 static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t,
     bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *);
 
+static void bge_devinfo(struct bge_softc *);
 static int bge_mbox_reorder(struct bge_softc *);
 
 static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]);
@@ -2828,6 +2829,59 @@ bge_mbox_reorder(struct bge_softc *sc)
 	return (0);
 }
 
+static void
+bge_devinfo(struct bge_softc *sc)
+{
+	uint32_t cfg, clk;
+
+	device_printf(sc->bge_dev,
+	    "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; ",
+	    sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev);
+	if (sc->bge_flags & BGE_FLAG_PCIE)
+		printf("PCI-E\n");
+	else if (sc->bge_flags & BGE_FLAG_PCIX) {
+		printf("PCI-X ");
+		cfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK;
+		if (cfg == BGE_MISCCFG_BOARD_ID_5704CIOBE)
+			clk = 133;
+		else {
+			clk = CSR_READ_4(sc, BGE_PCI_CLKCTL) & 0x1F;
+			switch (clk) {
+			case 0:
+				clk = 33;
+				break;
+			case 2:
+				clk = 50;
+				break;
+			case 4:
+				clk = 66;
+				break;
+			case 6:
+				clk = 100;
+				break;
+			case 7:
+				clk = 133;
+				break;
+			}
+		}
+		printf("%u MHz\n", clk);
+	} else {
+		if (sc->bge_pcixcap != 0)
+			printf("PCI on PCI-X ");
+		else
+			printf("PCI ");
+		cfg = pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4);
+		if (cfg & BGE_PCISTATE_PCI_BUSSPEED)
+			clk = 66;
+		else
+			clk = 33;
+		if (cfg & BGE_PCISTATE_32BIT_BUS)
+			printf("%u MHz; 32bit\n", clk);
+		else
+			printf("%u MHz; 64bit\n", clk);
+	}
+}
+
 static int
 bge_attach(device_t dev)
 {
@@ -3056,7 +3110,7 @@ bge_attach(device_t dev)
 	if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
 		sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG;
 
-	misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
+	misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK;
 	if (sc->bge_asicrev == BGE_ASICREV_BCM5705) {
 		if (misccfg == BGE_MISCCFG_BOARD_ID_5788 ||
 		    misccfg == BGE_MISCCFG_BOARD_ID_5788M)
@@ -3196,11 +3250,7 @@ bge_attach(device_t dev)
 		goto fail;
 	}
 
-	device_printf(dev,
-	    "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n",
-	    sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev,
-	    (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" :
-	    ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI"));
+	bge_devinfo(sc);
 
 	BGE_LOCK_INIT(sc, device_get_nameunit(dev));
 
@@ -4464,6 +4514,12 @@ bge_stats_update(struct bge_softc *sc)
 	ifp->if_collisions += (uint32_t)(cnt - sc->bge_tx_collisions);
 	sc->bge_tx_collisions = cnt;
 
+	cnt = READ_STAT(sc, stats, nicNoMoreRxBDs.bge_addr_lo);
+	ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_nobds);
+	sc->bge_rx_nobds = cnt;
+	cnt = READ_STAT(sc, stats, ifInErrors.bge_addr_lo);
+	ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_inerrs);
+	sc->bge_rx_inerrs = cnt;
 	cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo);
 	ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_discards);
 	sc->bge_rx_discards = cnt;

Modified: stable/9/sys/dev/bge/if_bgereg.h
==============================================================================
--- stable/9/sys/dev/bge/if_bgereg.h	Mon Mar 26 04:39:10 2012	(r233497)
+++ stable/9/sys/dev/bge/if_bgereg.h	Mon Mar 26 04:47:06 2012	(r233498)
@@ -1989,7 +1989,9 @@
 /* Misc. config register */
 #define	BGE_MISCCFG_RESET_CORE_CLOCKS	0x00000001
 #define	BGE_MISCCFG_TIMER_PRESCALER	0x000000FE
-#define	BGE_MISCCFG_BOARD_ID		0x0001E000
+#define	BGE_MISCCFG_BOARD_ID_MASK	0x0001E000
+#define	BGE_MISCCFG_BOARD_ID_5704	0x00000000
+#define	BGE_MISCCFG_BOARD_ID_5704CIOBE	0x00004000
 #define	BGE_MISCCFG_BOARD_ID_5788	0x00010000
 #define	BGE_MISCCFG_BOARD_ID_5788M	0x00018000
 #define	BGE_MISCCFG_EPHY_IDDQ		0x00200000
@@ -2869,6 +2871,8 @@ struct bge_softc {
 	int			bge_csum_features;
 	struct callout		bge_stat_ch;
 	uint32_t		bge_rx_discards;
+	uint32_t		bge_rx_inerrs;
+	uint32_t		bge_rx_nobds;
 	uint32_t		bge_tx_discards;
 	uint32_t		bge_tx_collisions;
 #ifdef DEVICE_POLLING

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 05:14:05 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 29FA11065673;
	Mon, 26 Mar 2012 05:14:05 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0B7368FC17;
	Mon, 26 Mar 2012 05:14:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q5E4TN016737;
	Mon, 26 Mar 2012 05:14:04 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q5E4Mk016735;
	Mon, 26 Mar 2012 05:14:04 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203260514.q2Q5E4Mk016735@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 26 Mar 2012 05:14:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233501 - in stable/9/sys: dev/fxp i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 05:14:05 -0000

Author: yongari
Date: Mon Mar 26 05:14:04 2012
New Revision: 233501
URL: http://svn.freebsd.org/changeset/base/233501

Log:
  MFC r232951,232953,233158:
  r232951:
    fxp(4) does not handle deferred dma map loading.  Tell
    bus_dmamap_load(9) that it should return immediately with error
    when there are insufficient mapping resources.
  
  r232953:
    Fix white space nits.
  
  r233158:
    Do not change current media when driver is already running.  If
    driver is running driver would have already completed flow control
    configuration.  This change removes unnecessary media changes in
    controller reconfiguration cases such that it does not trigger link
    reestablishment for configuration change requests like promiscuous
    mode change.
  
    Reported by:	Many
    Tested by:	Mike Tancsa  sentex dot net>

Modified:
  stable/9/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/9/sys/dev/fxp/if_fxp.c	Mon Mar 26 04:51:04 2012	(r233500)
+++ stable/9/sys/dev/fxp/if_fxp.c	Mon Mar 26 05:14:04 2012	(r233501)
@@ -236,11 +236,11 @@ static int		fxp_ioctl(struct ifnet *ifp,
 			    caddr_t data);
 static void 		fxp_watchdog(struct fxp_softc *sc);
 static void		fxp_add_rfabuf(struct fxp_softc *sc,
-    			    struct fxp_rx *rxp);
+			    struct fxp_rx *rxp);
 static void		fxp_discard_rfabuf(struct fxp_softc *sc,
-    			    struct fxp_rx *rxp);
+			    struct fxp_rx *rxp);
 static int		fxp_new_rfabuf(struct fxp_softc *sc,
-    			    struct fxp_rx *rxp);
+			    struct fxp_rx *rxp);
 static int		fxp_mc_addrs(struct fxp_softc *sc);
 static void		fxp_mc_setup(struct fxp_softc *sc);
 static uint16_t		fxp_eeprom_getword(struct fxp_softc *sc, int offset,
@@ -272,7 +272,7 @@ static int		sysctl_hw_fxp_int_delay(SYSC
 static void 		fxp_scb_wait(struct fxp_softc *sc);
 static void		fxp_scb_cmd(struct fxp_softc *sc, int cmd);
 static void		fxp_dma_wait(struct fxp_softc *sc,
-    			    volatile uint16_t *status, bus_dma_tag_t dmat,
+			    volatile uint16_t *status, bus_dma_tag_t dmat,
 			    bus_dmamap_t map);
 
 static device_method_t fxp_methods[] = {
@@ -681,7 +681,8 @@ fxp_attach(device_t dev)
 		goto fail;
 	}
 	error = bus_dmamap_load(sc->fxp_stag, sc->fxp_smap, sc->fxp_stats,
-	    sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, 0);
+	    sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr,
+	    BUS_DMA_NOWAIT);
 	if (error) {
 		device_printf(dev, "could not load the stats DMA buffer\n");
 		goto fail;
@@ -705,7 +706,7 @@ fxp_attach(device_t dev)
 
 	error = bus_dmamap_load(sc->cbl_tag, sc->cbl_map,
 	    sc->fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr,
-	    &sc->fxp_desc.cbl_addr, 0);
+	    &sc->fxp_desc.cbl_addr, BUS_DMA_NOWAIT);
 	if (error) {
 		device_printf(dev, "could not load TxCB DMA buffer\n");
 		goto fail;
@@ -729,7 +730,8 @@ fxp_attach(device_t dev)
 		goto fail;
 	}
 	error = bus_dmamap_load(sc->mcs_tag, sc->mcs_map, sc->mcsp,
-	    sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, 0);
+	    sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr,
+	    BUS_DMA_NOWAIT);
 	if (error) {
 		device_printf(dev,
 		    "can't load the multicast setup DMA buffer\n");
@@ -900,7 +902,7 @@ fxp_attach(device_t dev)
 		FXP_LOCK(sc);
 		/* Clear wakeup events. */
 		CSR_WRITE_1(sc, FXP_CSR_PMDR, CSR_READ_1(sc, FXP_CSR_PMDR));
-		fxp_init_body(sc, 1);
+		fxp_init_body(sc, 0);
 		fxp_stop(sc);
 		FXP_UNLOCK(sc);
 	}
@@ -1541,7 +1543,7 @@ fxp_encap(struct fxp_softc *sc, struct m
 		}
 		*m_head = m;
 		error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map,
-	    	    *m_head, segs, &nseg, 0);
+		    *m_head, segs, &nseg, 0);
 		if (error != 0) {
 			m_freem(*m_head);
 			*m_head = NULL;
@@ -2048,7 +2050,7 @@ fxp_update_stats(struct fxp_softc *sc)
 			 */
 			sc->rx_idle_secs++;
 		}
-		ifp->if_ierrors += 
+		ifp->if_ierrors +=
 		    le32toh(sp->rx_crc_errors) +
 		    le32toh(sp->rx_alignment_errors) +
 		    le32toh(sp->rx_rnr_errors) +
@@ -2175,7 +2177,7 @@ fxp_stop(struct fxp_softc *sc)
 	txp = sc->fxp_desc.tx_list;
 	if (txp != NULL) {
 		for (i = 0; i < FXP_NTXCB; i++) {
- 			if (txp[i].tx_mbuf != NULL) {
+			if (txp[i].tx_mbuf != NULL) {
 				bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map,
 				    BUS_DMASYNC_POSTWRITE);
 				bus_dmamap_unload(sc->fxp_txmtag,
@@ -2808,7 +2810,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 			if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) &&
 			    ((ifp->if_flags ^ sc->if_flags) &
 			    (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0)
-				fxp_init_body(sc, 1);
+				fxp_init_body(sc, 0);
 			else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 				fxp_init_body(sc, 1);
 		} else {
@@ -2914,7 +2916,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 			reinit++;
 		}
 		if (reinit > 0 && ifp->if_flags & IFF_UP)
-			fxp_init_body(sc, 1);
+			fxp_init_body(sc, 0);
 		FXP_UNLOCK(sc);
 		VLAN_CAPABILITIES(ifp);
 		break;

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 09:31:15 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD77B1065672;
	Mon, 26 Mar 2012 09:31:15 +0000 (UTC)
	(envelope-from pluknet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C79538FC15;
	Mon, 26 Mar 2012 09:31:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q9VFkA025451;
	Mon, 26 Mar 2012 09:31:15 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q9VFoi025449;
	Mon, 26 Mar 2012 09:31:15 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201203260931.q2Q9VFoi025449@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Mon, 26 Mar 2012 09:31:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233504 - stable/9
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 09:31:16 -0000

Author: pluknet
Date: Mon Mar 26 09:31:15 2012
New Revision: 233504
URL: http://svn.freebsd.org/changeset/base/233504

Log:
  MFC r227214 (by antoine, partially):
  
   Add more obsolete files.
  
  PR:		misc/165523 (RELENG_9)

Modified:
  stable/9/ObsoleteFiles.inc   (contents, props changed)

Modified: stable/9/ObsoleteFiles.inc
==============================================================================
--- stable/9/ObsoleteFiles.inc	Mon Mar 26 05:17:59 2012	(r233503)
+++ stable/9/ObsoleteFiles.inc	Mon Mar 26 09:31:15 2012	(r233504)
@@ -62,11 +62,22 @@ OLD_LIBS+=usr/lib32/libdwarf.so.2
 OLD_LIBS+=usr/lib32/libopie.so.6
 OLD_LIBS+=usr/lib32/librtld_db.so.1
 OLD_LIBS+=usr/lib32/libtacplus.so.4
+# 20110817: no more acd.4, ad.4, afd.4 and ast.4
+OLD_FILES+=usr/share/man/man4/acd.4.gz
+OLD_FILES+=usr/share/man/man4/ad.4.gz
+OLD_FILES+=usr/share/man/man4/afd.4.gz
+OLD_FILES+=usr/share/man/man4/ast.4.gz
 # 20110718: no longer useful in the age of rc.d
 OLD_FILES+=usr/sbin/named.reconfig
 OLD_FILES+=usr/sbin/named.reload
+OLD_FILES+=usr/share/man/man8/named.reconfig.8.gz
+OLD_FILES+=usr/share/man/man8/named.reload.8.gz
 # 20110716: bind 9.8.0 import
 OLD_LIBS+=usr/lib/liblwres.so.50
+OLD_FILES+=usr/share/doc/bind9/KNOWN-DEFECTS
+OLD_FILES+=usr/share/doc/bind9/NSEC3-NOTES
+OLD_FILES+=usr/share/doc/bind9/README.idnkit
+OLD_FILES+=usr/share/doc/bind9/README.pkcs11
 # 20110709: vm_map_clean.9 -> vm_map_sync.9
 OLD_FILES+=usr/share/man/man9/vm_map_clean.9.gz
 # 20110709: Catch up with removal of these functions.

From owner-svn-src-stable-9@FreeBSD.ORG  Mon Mar 26 09:32:50 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7E9D3106566C;
	Mon, 26 Mar 2012 09:32:50 +0000 (UTC)
	(envelope-from pluknet@gmail.com)
Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com
	[209.85.215.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 6749D8FC21;
	Mon, 26 Mar 2012 09:32:49 +0000 (UTC)
Received: by lagv3 with SMTP id v3so5044891lag.13
	for ; Mon, 26 Mar 2012 02:32:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=RfGv2FsOGrj4Qn45S4xQ/kSBlOzEc1gO8vGeylTk8XQ=;
	b=h5rjB/C76dJj5TlgtuICxR4Hw+CHDdDkRqdE3ZfOGMjAVuxu0OpHorcz01rofO5ur9
	z1L7XeFHe544P03pMFh1OmyXDeclxCNd4uaC+2rHTW/gXmE3RClEhSv1QQOyADrcZ1fm
	RKMl8td3K5w9pQHKvzmH0k8b5vSTI+5i3QzIPiikLThxyjGKD40V+ox8colPjIgIKFVK
	WvN2SEOtRKrjmYhsScsd5vbznaFeWW1Pd10v123MWdFPdsVX6ROdPgyDawabQ4yCNeNk
	3R2jTw1vegkvD4YoYhT2RvbAg5/lyX9rzaw1/4vH7/ZnlbNa3AkQjI9PJJBGKUtq/q/X
	hVLA==
MIME-Version: 1.0
Received: by 10.112.43.163 with SMTP id x3mr5201978lbl.58.1332754368372; Mon,
	26 Mar 2012 02:32:48 -0700 (PDT)
Sender: pluknet@gmail.com
Received: by 10.152.21.73 with HTTP; Mon, 26 Mar 2012 02:32:48 -0700 (PDT)
In-Reply-To: <4F6D9A2D.8060708@zonov.org>
References: <201203140944.q2E9ilvF094386@svn.freebsd.org>
	<4F6D9A2D.8060708@zonov.org>
Date: Mon, 26 Mar 2012 13:32:48 +0400
X-Google-Sender-Auth: E7DtdFS3G1XJtEDzCm95af_yTwE
Message-ID: 
From: Sergey Kandaurov 
To: Andrey Zonov 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject: Re: svn commit: r232961 - stable/9
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 26 Mar 2012 09:32:50 -0000

On 24 March 2012 13:55, Andrey Zonov  wrote:
> On 14.03.2012 13:44, Sergey Kandaurov wrote:
>>
>> Author: pluknet
>> Date: Wed Mar 14 09:44:46 2012
>> New Revision: 232961
>> URL: http://svn.freebsd.org/changeset/base/232961
>>
>> Log:
>> =A0 MFC r232671: Add lib32 part for libutil after its version bump to 9.
>>
>> =A0 PR: =A0 =A0 =A0 =A0 =A0misc/165523
>> =A0 Submitted by: =A0 =A0 =A0 =A0Andrey Zonov
>>
>> Modified:
>> =A0 stable/9/ObsoleteFiles.inc =A0 (contents, props changed)
>>
>> Modified: stable/9/ObsoleteFiles.inc
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- stable/9/ObsoleteFiles.inc =A0Wed Mar 14 09:15:50 2012 =A0 =A0 =A0 =
=A0(r232960)
>> +++ stable/9/ObsoleteFiles.inc =A0Wed Mar 14 09:44:46 2012 =A0 =A0 =A0 =
=A0(r232961)
>> @@ -352,6 +352,9 @@ OLD_FILES+=3Dusr/share/man/man5/lastlog.5.
>> =A0OLD_FILES+=3Dusr/share/man/man5/utmp.5.gz
>> =A0OLD_FILES+=3Dusr/share/man/man5/wtmp.5.gz
>> =A0OLD_LIBS+=3Dlib/libutil.so.8
>> +.if ${TARGET_ARCH} =3D=3D "amd64"
>> +OLB_LIBS+=3Dusr/lib32/libutil.so.8
>> +.endif
>> =A0# 20100105: new userland semaphore implementation
>> =A0OLD_FILES+=3Dusr/include/sys/semaphore.h
>> =A0# 20100103: ntptrace(8) removed
>
>
> Thanks! =A0But what about other files which I reported?


It turned that r227214 was not merged to stable/9, now merged as r233504.

--=20
wbr,
pluknet

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 00:51:29 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 82778106566C;
	Tue, 27 Mar 2012 00:51:29 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BBFD8FC08;
	Tue, 27 Mar 2012 00:51:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R0pT9S057347;
	Tue, 27 Mar 2012 00:51:29 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R0pThu057338;
	Tue, 27 Mar 2012 00:51:29 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203270051.q2R0pThu057338@svn.freebsd.org>
From: Eitan Adler 
Date: Tue, 27 Mar 2012 00:51:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233526 - stable/9/share/examples/cvsup
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 00:51:29 -0000

Author: eadler
Date: Tue Mar 27 00:51:28 2012
New Revision: 233526
URL: http://svn.freebsd.org/changeset/base/233526

Log:
  MFC r233428:
  	 - Direct users to csup instead of cvsup in the csup-file boilerplate text.
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/share/examples/cvsup/cvs-supfile
  stable/9/share/examples/cvsup/doc-supfile
  stable/9/share/examples/cvsup/gnats-supfile
  stable/9/share/examples/cvsup/ports-supfile
  stable/9/share/examples/cvsup/stable-supfile
  stable/9/share/examples/cvsup/standard-supfile
  stable/9/share/examples/cvsup/www-supfile
Directory Properties:
  stable/9/share/examples/cvsup/   (props changed)

Modified: stable/9/share/examples/cvsup/cvs-supfile
==============================================================================
--- stable/9/share/examples/cvsup/cvs-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/cvs-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # CVS development tree of the FreeBSD system.
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup cvs-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup cvs-supfile
 #
-#	cvsup -g -L 2 cvs-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

Modified: stable/9/share/examples/cvsup/doc-supfile
==============================================================================
--- stable/9/share/examples/cvsup/doc-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/doc-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # source of the FreeBSD doc tree
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup doc-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup doc-supfile
 #
-#	cvsup -g -L 2 doc-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

Modified: stable/9/share/examples/cvsup/gnats-supfile
==============================================================================
--- stable/9/share/examples/cvsup/gnats-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/gnats-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # FreeBSD GNATS bug report database.
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup gnats-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup gnats-supfile
 #
-#	cvsup -g -L 2 gnats-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

Modified: stable/9/share/examples/cvsup/ports-supfile
==============================================================================
--- stable/9/share/examples/cvsup/ports-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/ports-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # FreeBSD-current ports collection.
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup ports-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup ports-supfile
 #
-#	cvsup -g -L 2 ports-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

Modified: stable/9/share/examples/cvsup/stable-supfile
==============================================================================
--- stable/9/share/examples/cvsup/stable-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/stable-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # FreeBSD-stable source tree.
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup stable-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup stable-supfile
 #
-#	cvsup -g -L 2 stable-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

Modified: stable/9/share/examples/cvsup/standard-supfile
==============================================================================
--- stable/9/share/examples/cvsup/standard-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/standard-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # FreeBSD-current source tree.
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup standard-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup standard-supfile
 #
-#	cvsup -g -L 2 standard-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

Modified: stable/9/share/examples/cvsup/www-supfile
==============================================================================
--- stable/9/share/examples/cvsup/www-supfile	Mon Mar 26 21:47:06 2012	(r233525)
+++ stable/9/share/examples/cvsup/www-supfile	Tue Mar 27 00:51:28 2012	(r233526)
@@ -3,19 +3,16 @@
 # This file contains all of the "CVSup collections" that make up the
 # source of the FreeBSD www tree
 #
-# CVSup (CVS Update Protocol) allows you to download the latest CVS
+# csup (CVS Update Protocol) allows you to download the latest CVS
 # tree (or any branch of development therefrom) to your system easily
-# and efficiently (far more so than with sup, which CVSup is aimed
-# at replacing).  If you're running CVSup interactively, and are
-# currently using an X display server, you should run CVSup as follows
-# to keep your CVS tree up-to-date:
+# and efficiently
 #
-#	cvsup www-supfile
+# To keep your CVS tree up-to-date run:
 #
-# If not running X, or invoking cvsup from a non-interactive script, then
-# run it as follows:
+#	csup www-supfile
 #
-#	cvsup -g -L 2 www-supfile
+# Note that this only updates the tree contents and does not
+# update what is actually installed.
 #
 # You may wish to change some of the settings in this file to better
 # suit your system:
@@ -29,7 +26,7 @@
 #		with cvsup's "-h host" option.
 #
 # base=/var/db
-#		This specifies the root where CVSup will store information
+#		This specifies the root where csup will store information
 #		about the collections you have transferred to your system.
 #		A setting of "/var/db" will generate this information in
 #		/var/db/sup.  You can override the "base" setting on the

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 14:01:10 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2B187106568E;
	Tue, 27 Mar 2012 14:01:10 +0000 (UTC) (envelope-from jh@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 143168FC08;
	Tue, 27 Mar 2012 14:01:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RE19b8088684;
	Tue, 27 Mar 2012 14:01:09 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RE19Ig088682;
	Tue, 27 Mar 2012 14:01:09 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <201203271401.q2RE19Ig088682@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 27 Mar 2012 14:01:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233543 - in stable/9/sys: i386/conf kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 14:01:10 -0000

Author: jh
Date: Tue Mar 27 14:01:09 2012
New Revision: 233543
URL: http://svn.freebsd.org/changeset/base/233543

Log:
  MFC r233126:
  
  Cast wallclock.tv_sec to uint64_t to avoid overflow in the calculation.
  
  PR:		kern/161552

Modified:
  stable/9/sys/kern/kern_racct.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/kern/kern_racct.c
==============================================================================
--- stable/9/sys/kern/kern_racct.c	Tue Mar 27 12:25:47 2012	(r233542)
+++ stable/9/sys/kern/kern_racct.c	Tue Mar 27 14:01:09 2012	(r233543)
@@ -736,7 +736,8 @@ racctd(void)
 			mtx_lock(&racct_lock);
 			racct_set_locked(p, RACCT_CPU, runtime);
 			racct_set_locked(p, RACCT_WALLCLOCK,
-			    wallclock.tv_sec * 1000000 + wallclock.tv_usec);
+			    (uint64_t)wallclock.tv_sec * 1000000 +
+			    wallclock.tv_usec);
 			mtx_unlock(&racct_lock);
 			PROC_UNLOCK(p);
 		}

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 15:27:36 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E56B31065784;
	Tue, 27 Mar 2012 15:27:36 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D00C78FC12;
	Tue, 27 Mar 2012 15:27:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFRaww092146;
	Tue, 27 Mar 2012 15:27:36 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFRa2J092144;
	Tue, 27 Mar 2012 15:27:36 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203271527.q2RFRa2J092144@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Tue, 27 Mar 2012 15:27:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233559 - stable/9/usr.sbin/moused
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 15:27:37 -0000

Author: hselasky
Date: Tue Mar 27 15:27:36 2012
New Revision: 233559
URL: http://svn.freebsd.org/changeset/base/233559

Log:
  MFC r233090:
  The UMS module is now loaded by rules in /etc/devd/usb.conf which
  are executed by devd. Remove duplicate kldload.

Modified:
  stable/9/usr.sbin/moused/moused.c
Directory Properties:
  stable/9/usr.sbin/moused/   (props changed)

Modified: stable/9/usr.sbin/moused/moused.c
==============================================================================
--- stable/9/usr.sbin/moused/moused.c	Tue Mar 27 15:27:20 2012	(r233558)
+++ stable/9/usr.sbin/moused/moused.c	Tue Mar 27 15:27:36 2012	(r233559)
@@ -564,8 +564,6 @@ static void	mremote_clientchg(int add);
 static int	kidspad(u_char rxc, mousestatus_t *act);
 static int	gtco_digipad(u_char, mousestatus_t *);
 
-static int	usbmodule(void);
-
 int
 main(int argc, char *argv[])
 {
@@ -880,8 +878,7 @@ main(int argc, char *argv[])
 
     retry = 1;
     if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
-	if (usbmodule() != 0)
-	    retry = 5;
+	retry = 5;
     }
 
     for (;;) {
@@ -953,12 +950,6 @@ main(int argc, char *argv[])
     exit(0);
 }
 
-static int
-usbmodule(void)
-{
-    return (kld_isloaded("uhub/ums") || kld_load("ums") != -1);
-}
-
 /*
  * Function to calculate linear acceleration.
  *

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 15:29:52 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CF4B1065672;
	Tue, 27 Mar 2012 15:29:52 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D2AB8FC17;
	Tue, 27 Mar 2012 15:29:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFTpEW092282;
	Tue, 27 Mar 2012 15:29:51 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFTprZ092279;
	Tue, 27 Mar 2012 15:29:51 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203271529.q2RFTprZ092279@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Tue, 27 Mar 2012 15:29:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233560 - stable/9/sbin/kldload
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 15:29:52 -0000

Author: hselasky
Date: Tue Mar 27 15:29:51 2012
New Revision: 233560
URL: http://svn.freebsd.org/changeset/base/233560

Log:
  MFC r233109:
  Add option to ignore error codes if the module specified is already loaded.

Modified:
  stable/9/sbin/kldload/kldload.8
  stable/9/sbin/kldload/kldload.c
Directory Properties:
  stable/9/sbin/kldload/   (props changed)

Modified: stable/9/sbin/kldload/kldload.8
==============================================================================
--- stable/9/sbin/kldload/kldload.8	Tue Mar 27 15:27:36 2012	(r233559)
+++ stable/9/sbin/kldload/kldload.8	Tue Mar 27 15:29:51 2012	(r233560)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 5, 2009
+.Dd March 18, 2012
 .Dt KLDLOAD 8
 .Os
 .Sh NAME
@@ -33,7 +33,7 @@
 .Nd load a file into the kernel
 .Sh SYNOPSIS
 .Nm
-.Op Fl qv
+.Op Fl nqv
 .Ar
 .Sh DESCRIPTION
 The
@@ -62,6 +62,8 @@ in the current directory.
 .Pp
 The following options are available:
 .Bl -tag -width indent
+.It Fl n
+Don't try to load module if already loaded.
 .It Fl v
 Be more verbose.
 .It Fl q

Modified: stable/9/sbin/kldload/kldload.c
==============================================================================
--- stable/9/sbin/kldload/kldload.c	Tue Mar 27 15:27:36 2012	(r233559)
+++ stable/9/sbin/kldload/kldload.c	Tue Mar 27 15:29:51 2012	(r233560)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	PATHCTL	"kern.module_path"
 
@@ -129,7 +130,7 @@ path_check(const char *kldname, int quie
 static void
 usage(void)
 {
-	fprintf(stderr, "usage: kldload [-qv] file ...\n");
+	fprintf(stderr, "usage: kldload [-nqv] file ...\n");
 	exit(1);
 }
 
@@ -141,12 +142,14 @@ main(int argc, char** argv)
 	int fileid;
 	int verbose;
 	int quiet;
+	int check_loaded;
 
 	errors = 0;
 	verbose = 0;
 	quiet = 0;
+	check_loaded = 0;
     
-	while ((c = getopt(argc, argv, "qv")) != -1) {
+	while ((c = getopt(argc, argv, "nqv")) != -1) {
 		switch (c) {
 		case 'q':
 			quiet = 1;
@@ -156,6 +159,9 @@ main(int argc, char** argv)
 			verbose = 1;
 			quiet = 0;
 			break;
+		case 'n':
+			check_loaded = 1;
+			break;
 		default:
 			usage();
 		}
@@ -170,8 +176,14 @@ main(int argc, char** argv)
 		if (path_check(argv[0], quiet) == 0) {
 			fileid = kldload(argv[0]);
 			if (fileid < 0) {
-				warn("can't load %s", argv[0]);
-				errors++;
+				if (check_loaded != 0 && errno == EEXIST) {
+					if (verbose)
+						printf("%s is already "
+						    "loaded\n", argv[0]);
+				} else {
+					warn("can't load %s", argv[0]);
+					errors++;
+				}
 			} else {
 				if (verbose)
 					printf("Loaded %s, id=%d\n", argv[0],

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 15:32:10 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 439841065674;
	Tue, 27 Mar 2012 15:32:10 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DCC68FC18;
	Tue, 27 Mar 2012 15:32:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFWAGA092419;
	Tue, 27 Mar 2012 15:32:10 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFW9qE092417;
	Tue, 27 Mar 2012 15:32:09 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203271532.q2RFW9qE092417@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Tue, 27 Mar 2012 15:32:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233561 - stable/9/tools/tools/bus_autoconf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 15:32:10 -0000

Author: hselasky
Date: Tue Mar 27 15:32:09 2012
New Revision: 233561
URL: http://svn.freebsd.org/changeset/base/233561

Log:
  MFC r233110:
  Use new -n option when executing kldload, to
  not warn about already loaded module(s).

Modified:
  stable/9/tools/tools/bus_autoconf/bus_usb.c
Directory Properties:
  stable/9/tools/   (props changed)
  stable/9/tools/tools/   (props changed)

Modified: stable/9/tools/tools/bus_autoconf/bus_usb.c
==============================================================================
--- stable/9/tools/tools/bus_autoconf/bus_usb.c	Tue Mar 27 15:29:51 2012	(r233560)
+++ stable/9/tools/tools/bus_autoconf/bus_usb.c	Tue Mar 27 15:32:09 2012	(r233561)
@@ -317,7 +317,7 @@ usb_dump(struct usb_device_id *id, uint3
 		printf("	match \"intprotocol\" \"0x%02x\";\n",
 		    id->bInterfaceProtocol);
 	}
-	printf("	action \"kldload %s\";\n"
+	printf("	action \"kldload -n %s\";\n"
 	    "};\n\n", id->module_name);
 
 	return (n);

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 15:33:38 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A79E8106564A;
	Tue, 27 Mar 2012 15:33:38 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 90F218FC18;
	Tue, 27 Mar 2012 15:33:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFXcdj092542;
	Tue, 27 Mar 2012 15:33:38 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFXcNH092540;
	Tue, 27 Mar 2012 15:33:38 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203271533.q2RFXcNH092540@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Tue, 27 Mar 2012 15:33:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233562 - stable/9/etc/devd
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 15:33:38 -0000

Author: hselasky
Date: Tue Mar 27 15:33:38 2012
New Revision: 233562
URL: http://svn.freebsd.org/changeset/base/233562

Log:
  MFC r233111:
  Regenerate usb.conf to use new -n option when doing kldload.

Modified:
  stable/9/etc/devd/usb.conf
Directory Properties:
  stable/9/etc/   (props changed)

Modified: stable/9/etc/devd/usb.conf
==============================================================================
--- stable/9/etc/devd/usb.conf	Tue Mar 27 15:32:09 2012	(r233561)
+++ stable/9/etc/devd/usb.conf	Tue Mar 27 15:33:38 2012	(r233562)
@@ -13,7 +13,7 @@ nomatch 32 {
 	match "intclass" "0xff";
 	match "intsubclass" "0xfd";
 	match "intprotocol" "0x01";
-	action "kldload if_ipheth";
+	action "kldload -n if_ipheth";
 };
 
 nomatch 32 {
@@ -24,7 +24,7 @@ nomatch 32 {
 	match "intclass" "0xff";
 	match "intsubclass" "0xfd";
 	match "intprotocol" "0x01";
-	action "kldload if_ipheth";
+	action "kldload -n if_ipheth";
 };
 
 nomatch 32 {
@@ -35,7 +35,7 @@ nomatch 32 {
 	match "intclass" "0xff";
 	match "intsubclass" "0xfd";
 	match "intprotocol" "0x01";
-	action "kldload if_ipheth";
+	action "kldload -n if_ipheth";
 };
 
 nomatch 32 {
@@ -46,7 +46,7 @@ nomatch 32 {
 	match "intclass" "0xff";
 	match "intsubclass" "0xfd";
 	match "intprotocol" "0x01";
-	action "kldload if_ipheth";
+	action "kldload -n if_ipheth";
 };
 
 nomatch 32 {
@@ -54,7 +54,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0104";
 	match "product" "0x00be";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -62,7 +62,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0123";
 	match "product" "0x0001";
-	action "kldload uep";
+	action "kldload -n uep";
 };
 
 nomatch 32 {
@@ -70,7 +70,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03e8";
 	match "product" "0x0008";
-	action "kldload if_kue";
+	action "kldload -n if_kue";
 };
 
 nomatch 32 {
@@ -78,7 +78,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03eb";
 	match "product" "0x2109";
-	action "kldload uftdi";
+	action "kldload -n uftdi";
 };
 
 nomatch 32 {
@@ -86,7 +86,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "0x0121";
-	action "kldload ugensa";
+	action "kldload -n ugensa";
 };
 
 nomatch 32 {
@@ -94,7 +94,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "(0x1016|0x1116|0x1216)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -102,7 +102,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "(0x1b1d|0x1e1d)";
-	action "kldload u3g";
+	action "kldload -n u3g";
 };
 
 nomatch 32 {
@@ -110,7 +110,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "(0x2016|0x2116|0x2216|0x3016|0x3116|0x3216)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -118,7 +118,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "0x3524";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -126,7 +126,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "(0x4016|0x4116|0x4216|0x5016|0x5116|0x5216)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -134,7 +134,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "0x811c";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -142,7 +142,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x03f0";
 	match "product" "0xca02";
-	action "kldload if_urtw";
+	action "kldload -n if_urtw";
 };
 
 nomatch 32 {
@@ -150,7 +150,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0402";
 	match "product" "0x5632";
-	action "kldload if_cdce";
+	action "kldload -n if_cdce";
 };
 
 nomatch 32 {
@@ -158,7 +158,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0403";
 	match "product" "(0x6001|0x6004|0x6010|0x6011|0x8372|0x9e90|0xa6d0|0xa6d0|0xcc48|0xcc49|0xcc4a|0xd678|0xe6c8|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xee18|0xf608|0xf60b|0xf850|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfc08|0xfc09|0xfc0b|0xfc0c|0xfc0d|0xfc82)";
-	action "kldload uftdi";
+	action "kldload -n uftdi";
 };
 
 nomatch 32 {
@@ -166,7 +166,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0408";
 	match "product" "0x0304";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -174,7 +174,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0408";
 	match "product" "(0x1000|0xea02|0xea03|0xea04|0xea05|0xea06)";
-	action "kldload u3g";
+	action "kldload -n u3g";
 };
 
 nomatch 32 {
@@ -182,7 +182,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0409";
 	match "product" "(0x00d5|0x00d6|0x00d7|0x8024|0x8025)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -190,7 +190,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "(0x0001|0x0005|0x0009)";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -198,7 +198,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x0012";
-	action "kldload if_rue";
+	action "kldload -n if_rue";
 };
 
 nomatch 32 {
@@ -206,7 +206,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x003d";
-	action "kldload if_axe";
+	action "kldload -n if_axe";
 };
 
 nomatch 32 {
@@ -214,7 +214,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "(0x005e|0x0066|0x0067)";
-	action "kldload if_ural";
+	action "kldload -n if_ural";
 };
 
 nomatch 32 {
@@ -222,7 +222,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x006e";
-	action "kldload if_axe";
+	action "kldload -n if_axe";
 };
 
 nomatch 32 {
@@ -230,7 +230,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x008b";
-	action "kldload if_ural";
+	action "kldload -n if_ural";
 };
 
 nomatch 32 {
@@ -238,7 +238,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x00b3";
-	action "kldload uftdi";
+	action "kldload -n uftdi";
 };
 
 nomatch 32 {
@@ -246,7 +246,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "(0x00d8|0x00d9)";
-	action "kldload if_rum";
+	action "kldload -n if_rum";
 };
 
 nomatch 32 {
@@ -254,7 +254,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x00da";
-	action "kldload if_zyd";
+	action "kldload -n if_zyd";
 };
 
 nomatch 32 {
@@ -262,7 +262,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x00e8";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -270,7 +270,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "(0x0116|0x0119)";
-	action "kldload if_rum";
+	action "kldload -n if_rum";
 };
 
 nomatch 32 {
@@ -278,7 +278,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x012e";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -286,7 +286,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "0x0137";
-	action "kldload if_rum";
+	action "kldload -n if_rum";
 };
 
 nomatch 32 {
@@ -294,7 +294,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0411";
 	match "product" "(0x0148|0x0150|0x015d|0x016f|0x01a2)";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -302,7 +302,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0413";
 	match "product" "0x2101";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -310,7 +310,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0423";
 	match "product" "(0x000a|0x000c)";
-	action "kldload if_cue";
+	action "kldload -n if_cue";
 };
 
 nomatch 32 {
@@ -318,7 +318,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x043e";
 	match "product" "0x9c01";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -326,7 +326,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x045a";
 	match "product" "(0x5001|0x5002)";
-	action "kldload urio";
+	action "kldload -n urio";
 };
 
 nomatch 32 {
@@ -334,7 +334,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x045b";
 	match "product" "0x0053";
-	action "kldload uslcom";
+	action "kldload -n uslcom";
 };
 
 nomatch 32 {
@@ -342,7 +342,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x045e";
 	match "product" "0x0079";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -350,7 +350,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x045e";
 	match "product" "0x007a";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -358,7 +358,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x045e";
 	match "product" "(0x00ce|0x0400|0x0401|0x0402|0x0403|0x0404|0x0405|0x0406|0x0407|0x0408|0x0409|0x040a|0x040b|0x040c|0x040d|0x040e|0x040f|0x0410|0x0411|0x0412|0x0413|0x0414|0x0415|0x0416|0x0417|0x0432|0x0433|0x0434|0x0435|0x0436|0x0437|0x0438|0x0439|0x043a|0x043b|0x043c|0x043d|0x043e|0x043f|0x0440|0x0441|0x0442|0x0443|0x0444|0x0445|0x0446|0x0447|0x0448|0x0449|0x044a|0x044b|0x044c|0x044d|0x044e|0x044f|0x0450|0x0451|0x0452|0x0453|0x0454|0x0455|0x0456|0x0457|0x0458|0x0459|0x045a|0x045b|0x045c|0x045d|0x045e|0x045f|0x0460|0x0461|0x0462|0x0463|0x0464|0x0465|0x0466|0x0467|0x0468|0x0469|0x046a|0x046b|0x046c|0x046d|0x046e|0x046f|0x0470|0x0471|0x0472|0x0473|0x0474|0x0475|0x0476|0x0477|0x0478|0x0479|0x047a|0x047b|0x04c8|0x04c9|0x04ca|0x04cb|0x04cc|0x04cd|0x04ce|0x04d7|0x04d8|0x04d9|0x04da|0x04db|0x04dc|0x04dd|0x04de|0x04df|0x04e0|0x04e1|0x04e2|0x04e3|0x04e4|0x04e5|0x04e6|0x04e7|0x04e8|0x04e9|0x04ea)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -366,7 +366,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0471";
 	match "product" "0x066a";
-	action "kldload uslcom";
+	action "kldload -n uslcom";
 };
 
 nomatch 32 {
@@ -374,7 +374,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0471";
 	match "product" "0x1236";
-	action "kldload if_zyd";
+	action "kldload -n if_zyd";
 };
 
 nomatch 32 {
@@ -382,7 +382,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0471";
 	match "product" "0x200f";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -390,7 +390,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0482";
 	match "product" "0x0203";
-	action "kldload umodem";
+	action "kldload -n umodem";
 };
 
 nomatch 32 {
@@ -398,7 +398,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0489";
 	match "product" "(0xe000|0xe003)";
-	action "kldload uslcom";
+	action "kldload -n uslcom";
 };
 
 nomatch 32 {
@@ -406,7 +406,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x049f";
 	match "product" "(0x0003|0x0032)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -414,7 +414,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x049f";
 	match "product" "0x505a";
-	action "kldload if_cdce";
+	action "kldload -n if_cdce";
 };
 
 nomatch 32 {
@@ -422,7 +422,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04a4";
 	match "product" "0x0014";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -430,7 +430,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04a5";
 	match "product" "0x4027";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -438,7 +438,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04a5";
 	match "product" "0x4068";
-	action "kldload u3g";
+	action "kldload -n u3g";
 };
 
 nomatch 32 {
@@ -446,7 +446,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04ad";
 	match "product" "(0x0301|0x0302|0x0303|0x0306)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -454,7 +454,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04b4";
 	match "product" "0x1002";
-	action "kldload ufm";
+	action "kldload -n ufm";
 };
 
 nomatch 32 {
@@ -462,7 +462,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04b7";
 	match "product" "0x0531";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -470,7 +470,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04b8";
 	match "product" "(0x0521|0x0522)";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -478,7 +478,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04bb";
 	match "product" "0x0901";
-	action "kldload if_kue";
+	action "kldload -n if_kue";
 };
 
 nomatch 32 {
@@ -486,7 +486,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04bb";
 	match "product" "(0x0904|0x0913)";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -494,7 +494,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04bb";
 	match "product" "0x0930";
-	action "kldload if_axe";
+	action "kldload -n if_axe";
 };
 
 nomatch 32 {
@@ -502,7 +502,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04bb";
 	match "product" "(0x0944|0x0945|0x0947|0x0948)";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -510,7 +510,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04bb";
 	match "product" "(0x0a03|0x0a0e)";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -518,7 +518,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04bf";
 	match "product" "(0x0115|0x0117)";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -526,7 +526,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04c5";
 	match "product" "(0x1058|0x1079)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -534,7 +534,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04da";
 	match "product" "0x2500";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -542,7 +542,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04da";
 	match "product" "0x3900";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -550,7 +550,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04dd";
 	match "product" "(0x8004|0x8005|0x8006|0x8007|0x9031)";
-	action "kldload if_cdce";
+	action "kldload -n if_cdce";
 };
 
 nomatch 32 {
@@ -558,7 +558,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04dd";
 	match "product" "(0x9102|0x9121|0x9123|0x9151|0x91ac|0x9242)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -566,7 +566,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04e8";
 	match "product" "0x2018";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -574,7 +574,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04e8";
 	match "product" "(0x5f00|0x5f01|0x5f02|0x5f03|0x5f04)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -582,7 +582,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04e8";
 	match "product" "0x6601";
-	action "kldload uvisor";
+	action "kldload -n uvisor";
 };
 
 nomatch 32 {
@@ -590,7 +590,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04e8";
 	match "product" "(0x6611|0x6613|0x6615|0x6617|0x6619|0x661b|0x662e|0x6630|0x6632)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -598,7 +598,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04e8";
 	match "product" "0x8001";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -606,7 +606,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04f1";
 	match "product" "0x3008";
-	action "kldload if_axe";
+	action "kldload -n if_axe";
 };
 
 nomatch 32 {
@@ -614,7 +614,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x04f1";
 	match "product" "(0x3011|0x3012)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -622,7 +622,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0502";
 	match "product" "(0x1631|0x1632|0x16e1|0x16e2|0x16e3)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -630,7 +630,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0506";
 	match "product" "(0x03e8|0x11f8)";
-	action "kldload if_kue";
+	action "kldload -n if_kue";
 };
 
 nomatch 32 {
@@ -638,7 +638,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0506";
 	match "product" "0x4601";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -646,7 +646,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x0103";
-	action "kldload ubsa";
+	action "kldload -n ubsa";
 };
 
 nomatch 32 {
@@ -654,7 +654,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x0109";
-	action "kldload umct";
+	action "kldload -n umct";
 };
 
 nomatch 32 {
@@ -662,7 +662,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x0121";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -670,7 +670,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x0257";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -678,7 +678,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x0409";
-	action "kldload umct";
+	action "kldload -n umct";
 };
 
 nomatch 32 {
@@ -686,7 +686,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x1203";
-	action "kldload ubsa";
+	action "kldload -n ubsa";
 };
 
 nomatch 32 {
@@ -694,7 +694,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x4050";
-	action "kldload if_zyd";
+	action "kldload -n if_zyd";
 };
 
 nomatch 32 {
@@ -702,7 +702,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x5055";
-	action "kldload if_axe";
+	action "kldload -n if_axe";
 };
 
 nomatch 32 {
@@ -710,7 +710,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x7050";
-	action "kldload if_upgt";
+	action "kldload -n if_upgt";
 };
 
 nomatch 32 {
@@ -718,7 +718,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "(0x7050|0x7051)";
-	action "kldload if_ural";
+	action "kldload -n if_ural";
 };
 
 nomatch 32 {
@@ -726,7 +726,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x705a";
-	action "kldload if_rum";
+	action "kldload -n if_rum";
 };
 
 nomatch 32 {
@@ -734,7 +734,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x705c";
-	action "kldload if_zyd";
+	action "kldload -n if_zyd";
 };
 
 nomatch 32 {
@@ -742,7 +742,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x705e";
-	action "kldload if_urtw";
+	action "kldload -n if_urtw";
 };
 
 nomatch 32 {
@@ -750,7 +750,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "(0x8053|0x805c|0x815c|0x825a|0x825b)";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -758,7 +758,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x905b";
-	action "kldload if_rum";
+	action "kldload -n if_rum";
 };
 
 nomatch 32 {
@@ -766,7 +766,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x050d";
 	match "product" "0x935a";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -774,7 +774,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0525";
 	match "product" "0x1080";
-	action "kldload udbp";
+	action "kldload -n udbp";
 };
 
 nomatch 32 {
@@ -782,7 +782,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0525";
 	match "product" "0xa4a2";
-	action "kldload if_cdce";
+	action "kldload -n if_cdce";
 };
 
 nomatch 32 {
@@ -790,7 +790,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0536";
 	match "product" "0x01a0";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -798,7 +798,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0543";
 	match "product" "(0x0ed9|0x1527|0x1529|0x152b|0x152e|0x1921|0x1922|0x1923)";
-	action "kldload uipaq";
+	action "kldload -n uipaq";
 };
 
 nomatch 32 {
@@ -806,7 +806,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0547";
 	match "product" "0x2008";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -814,7 +814,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0547";
 	match "product" "0x2720";
-	action "kldload udbp";
+	action "kldload -n udbp";
 };
 
 nomatch 32 {
@@ -822,7 +822,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x054c";
 	match "product" "(0x0038|0x0066|0x0095|0x009a|0x00da|0x0169)";
-	action "kldload uvisor";
+	action "kldload -n uvisor";
 };
 
 nomatch 32 {
@@ -830,7 +830,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x054c";
 	match "product" "0x0437";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -838,7 +838,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0557";
 	match "product" "0x2002";
-	action "kldload if_kue";
+	action "kldload -n if_kue";
 };
 
 nomatch 32 {
@@ -846,7 +846,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0557";
 	match "product" "0x2007";
-	action "kldload if_aue";
+	action "kldload -n if_aue";
 };
 
 nomatch 32 {
@@ -854,7 +854,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0557";
 	match "product" "0x2008";
-	action "kldload uplcom";
+	action "kldload -n uplcom";
 };
 
 nomatch 32 {
@@ -862,7 +862,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0557";
 	match "product" "0x2009";
-	action "kldload if_axe";
+	action "kldload -n if_axe";
 };
 
 nomatch 32 {
@@ -870,7 +870,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0557";
 	match "product" "0x4000";
-	action "kldload if_kue";
+	action "kldload -n if_kue";
 };
 
 nomatch 32 {
@@ -878,7 +878,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x055d";
 	match "product" "0x2018";
-	action "kldload if_run";
+	action "kldload -n if_run";
 };
 
 nomatch 32 {
@@ -886,7 +886,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0565";
 	match "product" "0x0001";
-	action "kldload ubsa";
+	action "kldload -n ubsa";
 };
 
 nomatch 32 {
@@ -894,7 +894,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0565";
 	match "product" "(0x0002|0x0003|0x0005)";
-	action "kldload if_kue";
+	action "kldload -n if_kue";
 };
 
 nomatch 32 {
@@ -902,7 +902,7 @@ nomatch 32 {
 	match "mode" "host";
 	match "vendor" "0x0567";
 	match "product" "(0x2000|0x2002)";
-	action "kldload if_upgt";
+	action "kldload -n if_upgt";
 };
 

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

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 17:24:51 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AD307106564A;
	Tue, 27 Mar 2012 17:24:51 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 972958FC08;
	Tue, 27 Mar 2012 17:24:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RHOp9Z096386;
	Tue, 27 Mar 2012 17:24:51 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RHOpHJ096384;
	Tue, 27 Mar 2012 17:24:51 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201203271724.q2RHOpHJ096384@svn.freebsd.org>
From: Martin Matuska 
Date: Tue, 27 Mar 2012 17:24:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233566 - stable/9/etc/defaults
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 17:24:51 -0000

Author: mm
Date: Tue Mar 27 17:24:51 2012
New Revision: 233566
URL: http://svn.freebsd.org/changeset/base/233566

Log:
  MFC r233048:
  Unhide /dev/zfs in devfsrules_jail.
  
  The /dev/zfs device is required for managing jailed ZFS datasets.
  
  Discussed with:	pjd, jamie

Modified:
  stable/9/etc/defaults/devfs.rules
Directory Properties:
  stable/9/etc/   (props changed)

Modified: stable/9/etc/defaults/devfs.rules
==============================================================================
--- stable/9/etc/defaults/devfs.rules	Tue Mar 27 15:55:56 2012	(r233565)
+++ stable/9/etc/defaults/devfs.rules	Tue Mar 27 17:24:51 2012	(r233566)
@@ -84,3 +84,4 @@ add path stderr unhide
 add include $devfsrules_hide_all
 add include $devfsrules_unhide_basic
 add include $devfsrules_unhide_login
+add path zfs unhide

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 18:59:59 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 28404106564A;
	Tue, 27 Mar 2012 18:59:59 +0000 (UTC)
	(envelope-from jpaetzel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 11DAD8FC1C;
	Tue, 27 Mar 2012 18:59:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RIxwnl099491;
	Tue, 27 Mar 2012 18:59:58 GMT
	(envelope-from jpaetzel@svn.freebsd.org)
Received: (from jpaetzel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RIxwLh099489;
	Tue, 27 Mar 2012 18:59:58 GMT
	(envelope-from jpaetzel@svn.freebsd.org)
Message-Id: <201203271859.q2RIxwLh099489@svn.freebsd.org>
From: Josh Paetzel 
Date: Tue, 27 Mar 2012 18:59:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233572 - stable/9/usr.sbin/pc-sysinstall/backend-query
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 18:59:59 -0000

Author: jpaetzel
Date: Tue Mar 27 18:59:58 2012
New Revision: 233572
URL: http://svn.freebsd.org/changeset/base/233572

Log:
  MFC: 233131
  
  Redirect camcontrol stderr to /dev/null.

Modified:
  stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
Directory Properties:
  stable/9/usr.sbin/pc-sysinstall/   (props changed)

Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==============================================================================
--- stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh	Tue Mar 27 18:27:45 2012	(r233571)
+++ stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh	Tue Mar 27 18:59:58 2012	(r233572)
@@ -86,7 +86,7 @@ do
   fi
 
   # Try and find some identification information with camcontrol or atacontrol
-  NEWLINE=$(camcontrol identify $DEV | sed -ne 's/^device model *//p')
+  NEWLINE=$(camcontrol identify $DEV 2>/dev/null | sed -ne 's/^device model *//p')
   if [ -z "$NEWLINE" ]; then
 	# Now try atacontrol
   	NEWLINE=$(atacontrol list 2>/dev/null | sed -n "s|^.*$DEV <\(.*\)>.*|\1|p")

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 19:05:49 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE4621065670;
	Tue, 27 Mar 2012 19:05:49 +0000 (UTC)
	(envelope-from jpaetzel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A80588FC0A;
	Tue, 27 Mar 2012 19:05:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RJ5nnG099781;
	Tue, 27 Mar 2012 19:05:49 GMT
	(envelope-from jpaetzel@svn.freebsd.org)
Received: (from jpaetzel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RJ5nl9099779;
	Tue, 27 Mar 2012 19:05:49 GMT
	(envelope-from jpaetzel@svn.freebsd.org)
Message-Id: <201203271905.q2RJ5nl9099779@svn.freebsd.org>
From: Josh Paetzel 
Date: Tue, 27 Mar 2012 19:05:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233573 - stable/9/usr.sbin/pc-sysinstall/backend-query
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 19:05:49 -0000

Author: jpaetzel
Date: Tue Mar 27 19:05:49 2012
New Revision: 233573
URL: http://svn.freebsd.org/changeset/base/233573

Log:
  MFC: 233186
  
  An intel RAID can have any arbitrary name.

Modified:
  stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
Directory Properties:
  stable/9/usr.sbin/pc-sysinstall/   (props changed)

Modified: stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==============================================================================
--- stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh	Tue Mar 27 18:59:58 2012	(r233572)
+++ stable/9/usr.sbin/pc-sysinstall/backend-query/disk-list.sh	Tue Mar 27 19:05:49 2012	(r233573)
@@ -63,10 +63,7 @@ if [ -d "/dev/raid" ] ; then
   cd /dev/raid
   for i in `ls`
   do
-    case ${i} in
-      r0|r1|r2|r3|r4|r5) SYSDISK="${SYSDISK} ${i}" ;;
-      *) ;;
-    esac
+      SYSDISK="${SYSDISK} ${i}"
   done
 fi
 

From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 20:44:49 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0841E1065673
	for ;
	Tue, 27 Mar 2012 20:44:49 +0000 (UTC)
	(envelope-from pfrankymee@ymail.com)
Received: from mail.flm.ro (frontline1.mediasat.ro [193.226.85.171])
	by mx1.freebsd.org (Postfix) with ESMTP id 39AE08FC2C
	for ;
	Tue, 27 Mar 2012 20:44:47 +0000 (UTC)
Received: (qmail 3092 invoked by uid 512); 27 Mar 2012 23:44:44 +0300
Received: from 216.59.3.82 by mail.flm.ro (envelope-from
	, uid 508) with qmail-scanner-1.25-st-qms 
	(spamassassin: 3.2.4. perlscan: 1.25-st-qms.  
	Clear:RC:0(216.59.3.82):SA:0(4.4/5.0):. 
	Processed in 0.868255 secs); 27 Mar 2012 20:44:44 -0000
X-Spam-Status: No, hits=4.4 required=5.0
X-Spam-Level: ++++
X-Antivirus-MYDOMAIN-Mail-From: pfrankymee@ymail.com via mail.flm.ro
X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(216.59.3.82):SA:0(4.4/5.0):.
	Processed in 0.868255 secs Process 3009)
Received: from unknown (HELO WIN-TF1IF2F94JN) (test@flm.ro@216.59.3.82)
	by mail.flm.ro with SMTP; 27 Mar 2012 23:44:43 +0300
Message-ID: <02e975ec-40995-0e5c5725810648@win-tf1if2f94jn>
From: "Franky Meersman" 
To: svn-src-stable-9@freebsd.org
Date: Tue, 27 Mar 2012 13:43:32 -0700
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Priority: 3
Subject: Re: Important Reply.
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: Franky Meersman 
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 20:44:49 -0000

Good day,
My name is Franky Meersman, a senior staff and an executive of a bank here in United Kingdom. I am writing to seek your indulgence and assistance. I wish to make a transfer involving an amount of money estimated at 20,000.000.00 (Twenty Million British Pounds Sterling) and I feel strongly that you will be capable of receiving this fund into your account in your country.

I am proposing to make this transfer to a designated bank account of your choice. I could not do this project alone since I am an insider in the bank. A zero account balance or a new account may be opened for this purpose. Thus, for your indulgence and support, I propose an offer of 25% of the total amount to be your compensation and commission after the transfer has been successfully concluded. reply me private (meersmanfr@ymail.com) 447045709908
Thanks and God bless.
Regards
Franky Meersman


From owner-svn-src-stable-9@FreeBSD.ORG  Tue Mar 27 23:59:49 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A03F106564A;
	Tue, 27 Mar 2012 23:59:49 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 43BDB8FC14;
	Tue, 27 Mar 2012 23:59:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RNxnaV009179;
	Tue, 27 Mar 2012 23:59:49 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RNxnPw009177;
	Tue, 27 Mar 2012 23:59:49 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203272359.q2RNxnPw009177@svn.freebsd.org>
From: Jung-uk Kim 
Date: Tue, 27 Mar 2012 23:59:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233581 - stable/9/sys/dev/fb
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 27 Mar 2012 23:59:49 -0000

Author: jkim
Date: Tue Mar 27 23:59:48 2012
New Revision: 233581
URL: http://svn.freebsd.org/changeset/base/233581

Log:
  MFC:	r233042, r233054, r233056, r233187
  
  - Do not unnecessarily clear display memory when switching modes.
  - Remove unnecessary static variable initializations and duplicate codes.
  - Consistently use bcopy(9) over memcpy(9).
  - Save and restore linear frame buffer between suspend and resume.

Modified:
  stable/9/sys/dev/fb/vesa.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/fb/vesa.c
==============================================================================
--- stable/9/sys/dev/fb/vesa.c	Tue Mar 27 23:43:01 2012	(r233580)
+++ stable/9/sys/dev/fb/vesa.c	Tue Mar 27 23:59:48 2012	(r233581)
@@ -81,23 +81,25 @@ typedef struct adp_state adp_state_t;
 static struct mtx vesa_lock;
 
 static int vesa_state;
-static void *vesa_state_buf = NULL;
-static uint32_t vesa_state_buf_offs = 0;
-static ssize_t vesa_state_buf_size = 0;
-
-static u_char *vesa_palette = NULL;
-static uint32_t vesa_palette_offs = 0;
-
-static void *vesa_bios = NULL;
-static uint32_t vesa_bios_offs = VESA_BIOS_OFFSET;
-static uint32_t vesa_bios_int10 = 0;
-static size_t vesa_bios_size = 0;
+static void *vesa_state_buf;
+static uint32_t vesa_state_buf_offs;
+static ssize_t vesa_state_buf_size;
+
+static u_char *vesa_palette;
+static uint32_t vesa_palette_offs;
+
+static void *vesa_vmem_buf;
+
+static void *vesa_bios;
+static uint32_t vesa_bios_offs;
+static uint32_t vesa_bios_int10;
+static size_t vesa_bios_size;
 
 /* VESA video adapter */
-static video_adapter_t *vesa_adp = NULL;
+static video_adapter_t *vesa_adp;
 
 SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD, NULL, "VESA debugging");
-static int vesa_shadow_rom = 0;
+static int vesa_shadow_rom;
 TUNABLE_INT("debug.vesa.shadow_rom", &vesa_shadow_rom);
 SYSCTL_INT(_debug_vesa, OID_AUTO, shadow_rom, CTLFLAG_RDTUN, &vesa_shadow_rom,
     0, "Enable video BIOS shadow");
@@ -171,18 +173,16 @@ static video_switch_t *prevvidsw;
 
 #define MODE_TABLE_DELTA 8
 
-static int vesa_vmode_max = 0;
-static video_info_t vesa_vmode_empty = { EOT };
-static video_info_t *vesa_vmode = &vesa_vmode_empty;
-
-static int vesa_init_done = FALSE;
-static int has_vesa_bios = FALSE;
-static struct vesa_info *vesa_adp_info = NULL;
-static u_int16_t *vesa_vmodetab = NULL;
-static char *vesa_oemstr = NULL;
-static char *vesa_venderstr = NULL;
-static char *vesa_prodstr = NULL;
-static char *vesa_revstr = NULL;
+static int vesa_vmode_max;
+static video_info_t *vesa_vmode;
+
+static int vesa_init_done;
+static struct vesa_info *vesa_adp_info;
+static u_int16_t *vesa_vmodetab;
+static char *vesa_oemstr;
+static char *vesa_venderstr;
+static char *vesa_prodstr;
+static char *vesa_revstr;
 
 /* local macros and functions */
 #define BIOS_SADDRTOLADDR(p) ((((p) & 0xffff0000) >> 12) + ((p) & 0x0000ffff))
@@ -221,6 +221,7 @@ static int vesa_translate_flags(u_int16_
 static int vesa_translate_mmodel(u_int8_t vmodel);
 static int vesa_get_bpscanline(struct vesa_mode *vmode);
 static int vesa_bios_init(void);
+static void vesa_bios_uninit(void);
 static void vesa_clear_modes(video_info_t *info, int color);
 
 #if 0
@@ -773,11 +774,7 @@ vesa_bios_init(void)
 	if (vesa_init_done)
 		return (0);
 
-	has_vesa_bios = FALSE;
-	vesa_adp_info = NULL;
 	vesa_bios_offs = VESA_BIOS_OFFSET;
-	vesa_vmode_max = 0;
-	vesa_vmode[0].vi_mode = EOT;
 
 	/*
 	 * If the VBE real mode interrupt vector is not found, try BIOS POST.
@@ -804,7 +801,7 @@ vesa_bios_init(void)
 			    vesa_bios_size > (vesa_bios_int10 & 0xffff)) {
 				vesa_bios = x86bios_alloc(&vesa_bios_offs,
 				    vesa_bios_size, M_WAITOK);
-				memcpy(vesa_bios, vbios, vesa_bios_size);
+				bcopy(vbios, vesa_bios, vesa_bios_size);
 				offs = ((vesa_bios_offs << 12) & 0xffff0000) +
 				    (vesa_bios_int10 & 0xffff);
 				x86bios_set_intr(0x10, offs);
@@ -1030,8 +1027,7 @@ vesa_bios_init(void)
 	if (bootverbose)
 		printf("VESA: %d mode(s) found\n", modes);
 
-	has_vesa_bios = (modes > 0);
-	if (!has_vesa_bios)
+	if (modes == 0)
 		goto fail;
 
 	x86bios_free(vmbuf, sizeof(*buf));
@@ -1052,14 +1048,21 @@ vesa_bios_init(void)
 	return (0);
 
 fail:
+	x86bios_free(vmbuf, sizeof(buf));
+	vesa_bios_uninit();
+	return (1);
+}
+
+static void
+vesa_bios_uninit(void)
+{
+
 	if (vesa_bios != NULL) {
 		x86bios_set_intr(0x10, vesa_bios_int10);
 		vesa_bios_offs = VESA_BIOS_OFFSET;
 		x86bios_free(vesa_bios, vesa_bios_size);
 		vesa_bios = NULL;
 	}
-	if (vmbuf != NULL)
-		x86bios_free(vmbuf, sizeof(buf));
 	if (vesa_adp_info != NULL) {
 		free(vesa_adp_info, M_DEVBUF);
 		vesa_adp_info = NULL;
@@ -1080,7 +1083,15 @@ fail:
 		free(vesa_revstr, M_DEVBUF);
 		vesa_revstr = NULL;
 	}
-	return (1);
+	if (vesa_vmode != NULL) {
+		free(vesa_vmode, M_DEVBUF);
+		vesa_vmode = NULL;
+	}
+	if (vesa_palette != NULL) {
+		x86bios_free(vesa_palette,
+		    VESA_PALETTE_SIZE + vesa_state_buf_size);
+		vesa_palette = NULL;
+	}
 }
 
 static void
@@ -1313,7 +1324,7 @@ vesa_set_mode(video_adapter_t *adp, int 
 
 	if ((info.vi_flags & V_INFO_LINEAR) != 0)
 		mode |= 0x4000;
-	if (vesa_bios_set_mode(mode))
+	if (vesa_bios_set_mode(mode | 0x8000))
 		return (1);
 
 	/* Palette format is reset by the above VBE function call. */
@@ -1450,6 +1461,8 @@ vesa_set_border(video_adapter_t *adp, in
 static int
 vesa_save_state(video_adapter_t *adp, void *p, size_t size)
 {
+	vm_offset_t buf;
+	size_t bsize;
 
 	if (adp != vesa_adp || vesa_state_buf_size == 0)
 		return ((*prevvidsw->save_state)(adp, p, size));
@@ -1459,6 +1472,14 @@ vesa_save_state(video_adapter_t *adp, vo
 	if (size < (offsetof(adp_state_t, regs) + vesa_state_buf_size))
 		return (EINVAL);
 
+	buf = adp->va_buffer;
+	if (buf != 0) {
+		bsize = adp->va_buffer_size;
+		vesa_vmem_buf = malloc(bsize, M_DEVBUF, M_NOWAIT);
+		if (vesa_vmem_buf != NULL)
+			bcopy((void *)buf, vesa_vmem_buf, bsize);
+	} else
+		vesa_vmem_buf = NULL;
 	((adp_state_t *)p)->sig = V_STATE_SIG;
 	bzero(((adp_state_t *)p)->regs, vesa_state_buf_size);
 	return (vesa_bios_save_restore(STATE_SAVE, ((adp_state_t *)p)->regs));
@@ -1467,6 +1488,8 @@ vesa_save_state(video_adapter_t *adp, vo
 static int
 vesa_load_state(video_adapter_t *adp, void *p)
 {
+	vm_offset_t buf;
+	size_t bsize;
 	int mode;
 
 	if (adp != vesa_adp)
@@ -1474,6 +1497,7 @@ vesa_load_state(video_adapter_t *adp, vo
 
 	/* Try BIOS POST to restore a sane state. */
 	(void)vesa_bios_post();
+	bsize = adp->va_buffer_size;
 	mode = adp->va_mode;
 	(void)vesa_set_mode(adp, adp->va_initial_mode);
 	if (mode != adp->va_initial_mode)
@@ -1481,6 +1505,12 @@ vesa_load_state(video_adapter_t *adp, vo
 
 	if (((adp_state_t *)p)->sig != V_STATE_SIG)
 		return ((*prevvidsw->load_state)(adp, p));
+	if (vesa_vmem_buf != NULL) {
+		buf = adp->va_buffer;
+		if (buf != 0)
+			bcopy(vesa_vmem_buf, (void *)buf, bsize);
+		free(vesa_vmem_buf, M_DEVBUF);
+	}
 	return (vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs));
 }
 
@@ -1911,26 +1941,7 @@ vesa_unload(void)
 		}
 	}
 
-	if (vesa_bios != NULL) {
-		x86bios_set_intr(0x10, vesa_bios_int10);
-		x86bios_free(vesa_bios, vesa_bios_size);
-	}
-	if (vesa_adp_info != NULL)
-		free(vesa_adp_info, M_DEVBUF);
-	if (vesa_oemstr != NULL)
-		free(vesa_oemstr, M_DEVBUF);
-	if (vesa_venderstr != NULL)
-		free(vesa_venderstr, M_DEVBUF);
-	if (vesa_prodstr != NULL)
-		free(vesa_prodstr, M_DEVBUF);
-	if (vesa_revstr != NULL)
-		free(vesa_revstr, M_DEVBUF);
-	if (vesa_vmode != &vesa_vmode_empty)
-		free(vesa_vmode, M_DEVBUF);
-	if (vesa_palette != NULL)
-		x86bios_free(vesa_palette,
-		    VESA_PALETTE_SIZE + vesa_state_buf_size);
-
+	vesa_bios_uninit();
 	mtx_destroy(&vesa_lock);
 
 	return (error);

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 00:06:53 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 06F18106564A;
	Wed, 28 Mar 2012 00:06:53 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E5DFC8FC08;
	Wed, 28 Mar 2012 00:06:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S06q0B009475;
	Wed, 28 Mar 2012 00:06:52 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S06qj7009473;
	Wed, 28 Mar 2012 00:06:52 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203280006.q2S06qj7009473@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 28 Mar 2012 00:06:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233582 - stable/9/sys/amd64/acpica
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 00:06:53 -0000

Author: jkim
Date: Wed Mar 28 00:06:52 2012
New Revision: 233582
URL: http://svn.freebsd.org/changeset/base/233582

Log:
  MFC:	r233208, r233249
  
  Fix a witness panic.  We cannot enter critical section here.

Modified:
  stable/9/sys/amd64/acpica/acpi_wakeup.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/acpica/acpi_wakeup.c
==============================================================================
--- stable/9/sys/amd64/acpica/acpi_wakeup.c	Tue Mar 27 23:59:48 2012	(r233581)
+++ stable/9/sys/amd64/acpica/acpi_wakeup.c	Wed Mar 28 00:06:52 2012	(r233582)
@@ -223,6 +223,7 @@ acpi_sleep_machdep(struct acpi_softc *sc
 #ifdef SMP
 	cpuset_t	wakeup_cpus;
 #endif
+	register_t	rf;
 	ACPI_STATUS	status;
 	int		ret;
 
@@ -241,7 +242,7 @@ acpi_sleep_machdep(struct acpi_softc *sc
 
 	AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
 
-	spinlock_enter();
+	rf = intr_disable();
 	intr_suspend();
 
 	if (savectx(susppcbs[0])) {
@@ -300,7 +301,7 @@ out:
 
 	mca_resume();
 	intr_resume();
-	spinlock_exit();
+	intr_restore(rf);
 
 	AcpiSetFirmwareWakingVector(0);
 

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 00:11:07 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 705F0106566B;
	Wed, 28 Mar 2012 00:11:07 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5A2C68FC16;
	Wed, 28 Mar 2012 00:11:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S0B7kR009679;
	Wed, 28 Mar 2012 00:11:07 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S0B7hK009677;
	Wed, 28 Mar 2012 00:11:07 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203280011.q2S0B7hK009677@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 28 Mar 2012 00:11:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233583 - stable/9/sys/dev/acpica
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 00:11:07 -0000

Author: jkim
Date: Wed Mar 28 00:11:06 2012
New Revision: 233583
URL: http://svn.freebsd.org/changeset/base/233583

Log:
  MFC:	r233313
  
  Add ACPI_LV_REPAIR debug level, available since ACPICA 20091214.

Modified:
  stable/9/sys/dev/acpica/acpi.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/acpica/acpi.c
==============================================================================
--- stable/9/sys/dev/acpica/acpi.c	Wed Mar 28 00:06:52 2012	(r233582)
+++ stable/9/sys/dev/acpica/acpi.c	Wed Mar 28 00:11:06 2012	(r233583)
@@ -3529,6 +3529,7 @@ static struct debugtag dbg_level[] = {
     {"ACPI_LV_INIT",		ACPI_LV_INIT},
     {"ACPI_LV_DEBUG_OBJECT",	ACPI_LV_DEBUG_OBJECT},
     {"ACPI_LV_INFO",		ACPI_LV_INFO},
+    {"ACPI_LV_REPAIR",		ACPI_LV_REPAIR},
     {"ACPI_LV_ALL_EXCEPTIONS",	ACPI_LV_ALL_EXCEPTIONS},
 
     /* Trace verbosity level 1 [Standard Trace Level] */

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 02:33:51 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C515106564A;
	Wed, 28 Mar 2012 02:33:51 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 05C468FC18;
	Wed, 28 Mar 2012 02:33:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S2XoKS014235;
	Wed, 28 Mar 2012 02:33:50 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S2XofY014233;
	Wed, 28 Mar 2012 02:33:50 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203280233.q2S2XofY014233@svn.freebsd.org>
From: Eitan Adler 
Date: Wed, 28 Mar 2012 02:33:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233588 - stable/9/usr.sbin/ppp
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 02:33:51 -0000

Author: eadler
Date: Wed Mar 28 02:33:50 2012
New Revision: 233588
URL: http://svn.freebsd.org/changeset/base/233588

Log:
  MFC r230348:
  	 - Fix warning when compiling with gcc46:
  	        error: variable 'extra_async_bytes' set but not used
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/usr.sbin/ppp/lqr.c
Directory Properties:
  stable/9/usr.sbin/ppp/   (props changed)

Modified: stable/9/usr.sbin/ppp/lqr.c
==============================================================================
--- stable/9/usr.sbin/ppp/lqr.c	Wed Mar 28 01:52:38 2012	(r233587)
+++ stable/9/usr.sbin/ppp/lqr.c	Wed Mar 28 02:33:50 2012	(r233588)
@@ -417,7 +417,7 @@ lqr_LayerPush(struct bundle *b __unused,
               int pri __unused, u_short *proto)
 {
   struct physical *p = link2physical(l);
-  int len, layer, extra_async_bytes;
+  int len, layer;
 
   if (!p) {
     /* Oops - can't happen :-] */
@@ -445,7 +445,6 @@ lqr_LayerPush(struct bundle *b __unused,
    * acf layers (to avoid alignment issues), so deal with this too.
    */
 
-  extra_async_bytes = 0;
   p->hdlc.lqm.ifOutUniPackets++;
   p->hdlc.lqm.ifOutOctets += len + 1;		/* plus 1 flag octet! */
   for (layer = 0; layer < l->nlayers; layer++)

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 06:49:05 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 9916F106564A;
	Wed, 28 Mar 2012 06:49:05 +0000 (UTC) (envelope-from ae@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 83CB48FC17;
	Wed, 28 Mar 2012 06:49:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S6n5LW022585;
	Wed, 28 Mar 2012 06:49:05 GMT (envelope-from ae@svn.freebsd.org)
Received: (from ae@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S6n57B022583;
	Wed, 28 Mar 2012 06:49:05 GMT (envelope-from ae@svn.freebsd.org)
Message-Id: <201203280649.q2S6n57B022583@svn.freebsd.org>
From: "Andrey V. Elsukov" 
Date: Wed, 28 Mar 2012 06:49:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233595 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 06:49:05 -0000

Author: ae
Date: Wed Mar 28 06:49:04 2012
New Revision: 233595
URL: http://svn.freebsd.org/changeset/base/233595

Log:
  MFC r233276:
    Acquire modules lock before call module_getname() in the KLD_DEBUG case.

Modified:
  stable/9/sys/kern/kern_linker.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_linker.c
==============================================================================
--- stable/9/sys/kern/kern_linker.c	Wed Mar 28 05:37:20 2012	(r233594)
+++ stable/9/sys/kern/kern_linker.c	Wed Mar 28 06:49:04 2012	(r233595)
@@ -636,8 +636,12 @@ linker_file_unload(linker_file_t file, i
 		 * Give the module a chance to veto the unload.
 		 */
 		if ((error = module_unload(mod)) != 0) {
+#ifdef KLD_DEBUG
+			MOD_SLOCK;
 			KLD_DPF(FILE, ("linker_file_unload: module %s"
 			    " failed unload\n", module_getname(mod)));
+			MOD_SUNLOCK;
+#endif
 			return (error);
 		}
 		MOD_XLOCK;

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 10:15:43 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5EEA11065670;
	Wed, 28 Mar 2012 10:15:43 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 301AA8FC12;
	Wed, 28 Mar 2012 10:15:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SAFhsH029634;
	Wed, 28 Mar 2012 10:15:43 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SAFglt029632;
	Wed, 28 Mar 2012 10:15:42 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201203281015.q2SAFglt029632@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 28 Mar 2012 10:15:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233598 - stable/9/sys/sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 10:15:43 -0000

Author: mav
Date: Wed Mar 28 10:15:42 2012
New Revision: 233598
URL: http://svn.freebsd.org/changeset/base/233598

Log:
  MFC r232852:
  Tune cpuset macros to optimize cases when CPU_SETSIZE fits into single
  machine word. For example, it turns CPU_SET() into expected shift and OR,
  removing extra shift, AND and additional index on memory access.
  
  Generated code checked for kernel (optimized) and user-level (unoptimized)
  cases with GCC and CLANG.

Modified:
  stable/9/sys/sys/cpuset.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/sys/cpuset.h
==============================================================================
--- stable/9/sys/sys/cpuset.h	Wed Mar 28 08:11:46 2012	(r233597)
+++ stable/9/sys/sys/cpuset.h	Wed Mar 28 10:15:42 2012	(r233598)
@@ -36,11 +36,18 @@
 
 #define	CPUSETBUFSIZ	((2 + sizeof(long) * 2) * _NCPUWORDS)
 
-#define	__cpuset_mask(n)	((long)1 << ((n) % _NCPUBITS))
-#define	CPU_CLR(n, p)	((p)->__bits[(n)/_NCPUBITS] &= ~__cpuset_mask(n))
+/*
+ * Macros addressing word and bit within it, tuned to make compiler
+ * optimize cases when CPU_SETSIZE fits into single machine word.
+ */
+#define	__cpuset_mask(n)				\
+	((long)1 << ((_NCPUWORDS == 1) ? (__size_t)(n) : ((n) % _NCPUBITS)))
+#define	__cpuset_word(n)	((_NCPUWORDS == 1) ? 0 : ((n) / _NCPUBITS))
+
+#define	CPU_CLR(n, p)	((p)->__bits[__cpuset_word(n)] &= ~__cpuset_mask(n))
 #define	CPU_COPY(f, t)	(void)(*(t) = *(f))
-#define	CPU_ISSET(n, p)	(((p)->__bits[(n)/_NCPUBITS] & __cpuset_mask(n)) != 0)
-#define	CPU_SET(n, p)	((p)->__bits[(n)/_NCPUBITS] |= __cpuset_mask(n))
+#define	CPU_ISSET(n, p)	(((p)->__bits[__cpuset_word(n)] & __cpuset_mask(n)) != 0)
+#define	CPU_SET(n, p)	((p)->__bits[__cpuset_word(n)] |= __cpuset_mask(n))
 #define	CPU_ZERO(p) do {				\
 	__size_t __i;					\
 	for (__i = 0; __i < _NCPUWORDS; __i++)		\
@@ -55,7 +62,7 @@
 
 #define	CPU_SETOF(n, p) do {					\
 	CPU_ZERO(p);						\
-	((p)->__bits[(n)/_NCPUBITS] = __cpuset_mask(n));	\
+	((p)->__bits[__cpuset_word(n)] = __cpuset_mask(n));	\
 } while (0)
 
 /* Is p empty. */
@@ -126,10 +133,10 @@
 } while (0)
 
 #define	CPU_CLR_ATOMIC(n, p)						\
-	atomic_clear_long(&(p)->__bits[(n)/_NCPUBITS], __cpuset_mask(n))
+	atomic_clear_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
 
 #define	CPU_SET_ATOMIC(n, p)						\
-	atomic_set_long(&(p)->__bits[(n)/_NCPUBITS], __cpuset_mask(n))
+	atomic_set_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
 
 /* Convenience functions catering special cases. */ 
 #define	CPU_OR_ATOMIC(d, s) do {			\

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 11:37:06 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D28D7106564A;
	Wed, 28 Mar 2012 11:37:06 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BBD1C8FC14;
	Wed, 28 Mar 2012 11:37:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SBb677033658;
	Wed, 28 Mar 2012 11:37:06 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SBb65O033656;
	Wed, 28 Mar 2012 11:37:06 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201203281137.q2SBb65O033656@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 28 Mar 2012 11:37:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233599 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 11:37:06 -0000

Author: mav
Date: Wed Mar 28 11:37:06 2012
New Revision: 233599
URL: http://svn.freebsd.org/changeset/base/233599

Log:
  MFC r232207, r232454:
  Rework CPU load balancing in SCHED_ULE:
   - In sched_pickcpu() be more careful taking previous CPU on SMT systems.
  Do it only if all other logical CPUs of that physical one are idle to avoid
  extra resource sharing.
   - In sched_pickcpu() change general logic of CPU selection. First
  look for idle CPU, sharing last level cache with previously used one,
  skipping SMT CPU groups. If none found, search all CPUs for the least loaded
  one, where the thread with its priority can run now. If none found, search
  just for the least loaded CPU.
   - Make cpu_search() compare lowest/highest CPU load when comparing CPU
  groups with equal load. That allows to differentiate 1+1 and 2+0 loads.
   - Make cpu_search() to prefer specified (previous) CPU or group if load
  is equal. This improves cache affinity for more complicated topologies.
   - Randomize CPU selection if above factors are equal. Previous code tend
  to prefer CPUs with lower IDs, causing unneeded collisions.
   - Rework periodic balancer in sched_balance_group(). With cpu_search()
  more intelligent now, make balansing process flat, removing recursion
  over the topology tree. That fixes double swap problem and makes load
  distribution more even and predictable.
  
  All together this gives 10-15% performance improvement in many tests on
  CPUs with SMT, such as Core i7, for number of threads is less then number
  of logical CPUs. In some tests it also gives positive effect to systems
  without SMT.
  
  Sponsored by:	iXsystems, Inc.

Modified:
  stable/9/sys/kern/sched_ule.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/sched_ule.c
==============================================================================
--- stable/9/sys/kern/sched_ule.c	Wed Mar 28 10:15:42 2012	(r233598)
+++ stable/9/sys/kern/sched_ule.c	Wed Mar 28 11:37:06 2012	(r233599)
@@ -258,7 +258,6 @@ struct cpu_group *cpu_top;		/* CPU topol
 static int rebalance = 1;
 static int balance_interval = 128;	/* Default set in sched_initticks(). */
 static int affinity;
-static int steal_htt = 1;
 static int steal_idle = 1;
 static int steal_thresh = 2;
 
@@ -268,6 +267,7 @@ static int steal_thresh = 2;
 static struct tdq	tdq_cpu[MAXCPU];
 static struct tdq	*balance_tdq;
 static int balance_ticks;
+static DPCPU_DEFINE(uint32_t, randomval);
 
 #define	TDQ_SELF()	(&tdq_cpu[PCPU_GET(cpuid)])
 #define	TDQ_CPU(x)	(&tdq_cpu[(x)])
@@ -553,9 +553,11 @@ tdq_setlowpri(struct tdq *tdq, struct th
 #ifdef SMP
 struct cpu_search {
 	cpuset_t cs_mask;
-	u_int	cs_load;
-	u_int	cs_cpu;
-	int	cs_limit;	/* Min priority for low min load for high. */
+	u_int	cs_prefer;
+	int	cs_pri;		/* Min priority for low. */
+	int	cs_limit;	/* Max load for low, min load for high. */
+	int	cs_cpu;
+	int	cs_load;
 };
 
 #define	CPU_SEARCH_LOWEST	0x1
@@ -566,44 +568,14 @@ struct cpu_search {
 	for ((cpu) = 0; (cpu) <= mp_maxid; (cpu)++)		\
 		if (CPU_ISSET(cpu, &mask))
 
-static __inline int cpu_search(struct cpu_group *cg, struct cpu_search *low,
+static __inline int cpu_search(const struct cpu_group *cg, struct cpu_search *low,
     struct cpu_search *high, const int match);
-int cpu_search_lowest(struct cpu_group *cg, struct cpu_search *low);
-int cpu_search_highest(struct cpu_group *cg, struct cpu_search *high);
-int cpu_search_both(struct cpu_group *cg, struct cpu_search *low,
+int cpu_search_lowest(const struct cpu_group *cg, struct cpu_search *low);
+int cpu_search_highest(const struct cpu_group *cg, struct cpu_search *high);
+int cpu_search_both(const struct cpu_group *cg, struct cpu_search *low,
     struct cpu_search *high);
 
 /*
- * This routine compares according to the match argument and should be
- * reduced in actual instantiations via constant propagation and dead code
- * elimination.
- */ 
-static __inline int
-cpu_compare(int cpu, struct cpu_search *low, struct cpu_search *high,
-    const int match)
-{
-	struct tdq *tdq;
-
-	tdq = TDQ_CPU(cpu);
-	if (match & CPU_SEARCH_LOWEST)
-		if (CPU_ISSET(cpu, &low->cs_mask) &&
-		    tdq->tdq_load < low->cs_load &&
-		    tdq->tdq_lowpri > low->cs_limit) {
-			low->cs_cpu = cpu;
-			low->cs_load = tdq->tdq_load;
-		}
-	if (match & CPU_SEARCH_HIGHEST)
-		if (CPU_ISSET(cpu, &high->cs_mask) &&
-		    tdq->tdq_load >= high->cs_limit && 
-		    tdq->tdq_load > high->cs_load &&
-		    tdq->tdq_transferable) {
-			high->cs_cpu = cpu;
-			high->cs_load = tdq->tdq_load;
-		}
-	return (tdq->tdq_load);
-}
-
-/*
  * Search the tree of cpu_groups for the lowest or highest loaded cpu
  * according to the match argument.  This routine actually compares the
  * load on all paths through the tree and finds the least loaded cpu on
@@ -615,33 +587,42 @@ cpu_compare(int cpu, struct cpu_search *
  * also recursive to the depth of the tree.
  */
 static __inline int
-cpu_search(struct cpu_group *cg, struct cpu_search *low,
+cpu_search(const struct cpu_group *cg, struct cpu_search *low,
     struct cpu_search *high, const int match)
 {
-	int total;
+	struct cpu_search lgroup;
+	struct cpu_search hgroup;
+	cpuset_t cpumask;
+	struct cpu_group *child;
+	struct tdq *tdq;
+	int cpu, i, hload, lload, load, total, rnd;
 
 	total = 0;
-	if (cg->cg_children) {
-		struct cpu_search lgroup;
-		struct cpu_search hgroup;
-		struct cpu_group *child;
-		u_int lload;
-		int hload;
-		int load;
-		int i;
-
-		lload = -1;
+	cpumask = cg->cg_mask;
+	if (match & CPU_SEARCH_LOWEST) {
+		lload = INT_MAX;
+		low->cs_load = INT_MAX;
+		lgroup = *low;
+	}
+	if (match & CPU_SEARCH_HIGHEST) {
 		hload = -1;
-		for (i = 0; i < cg->cg_children; i++) {
+		high->cs_load = -1;
+		hgroup = *high;
+	}
+
+	/* Iterate through the child CPU groups and then remaining CPUs. */
+	for (i = 0, cpu = 0; i <= cg->cg_children; ) {
+		if (i >= cg->cg_children) {
+			while (cpu <= mp_maxid && !CPU_ISSET(cpu, &cpumask))
+				cpu++;
+			if (cpu > mp_maxid)
+				break;
+			child = NULL;
+		} else
 			child = &cg->cg_child[i];
-			if (match & CPU_SEARCH_LOWEST) {
-				lgroup = *low;
-				lgroup.cs_load = -1;
-			}
-			if (match & CPU_SEARCH_HIGHEST) {
-				hgroup = *high;
-				lgroup.cs_load = 0;
-			}
+
+		if (child) {			/* Handle child CPU group. */
+			CPU_NAND(&cpumask, &child->cg_mask);
 			switch (match) {
 			case CPU_SEARCH_LOWEST:
 				load = cpu_search_lowest(child, &lgroup);
@@ -653,23 +634,54 @@ cpu_search(struct cpu_group *cg, struct 
 				load = cpu_search_both(child, &lgroup, &hgroup);
 				break;
 			}
-			total += load;
-			if (match & CPU_SEARCH_LOWEST)
-				if (load < lload || low->cs_cpu == -1) {
-					*low = lgroup;
-					lload = load;
+		} else {			/* Handle child CPU. */
+			tdq = TDQ_CPU(cpu);
+			load = tdq->tdq_load * 256;
+			rnd = DPCPU_SET(randomval,
+			    DPCPU_GET(randomval) * 69069 + 5) >> 26;
+			if (match & CPU_SEARCH_LOWEST) {
+				if (cpu == low->cs_prefer)
+					load -= 64;
+				/* If that CPU is allowed and get data. */
+				if (CPU_ISSET(cpu, &lgroup.cs_mask) &&
+				    tdq->tdq_lowpri > lgroup.cs_pri &&
+				    tdq->tdq_load <= lgroup.cs_limit) {
+					lgroup.cs_cpu = cpu;
+					lgroup.cs_load = load - rnd;
 				}
-			if (match & CPU_SEARCH_HIGHEST) 
-				if (load > hload || high->cs_cpu == -1) {
-					hload = load;
-					*high = hgroup;
+			}
+			if (match & CPU_SEARCH_HIGHEST)
+				if (CPU_ISSET(cpu, &hgroup.cs_mask) &&
+				    tdq->tdq_load >= hgroup.cs_limit &&
+				    tdq->tdq_transferable) {
+					hgroup.cs_cpu = cpu;
+					hgroup.cs_load = load - rnd;
 				}
 		}
-	} else {
-		int cpu;
+		total += load;
 
-		CPUSET_FOREACH(cpu, cg->cg_mask)
-			total += cpu_compare(cpu, low, high, match);
+		/* We have info about child item. Compare it. */
+		if (match & CPU_SEARCH_LOWEST) {
+			if (lgroup.cs_load != INT_MAX &&
+			    (load < lload ||
+			     (load == lload && lgroup.cs_load < low->cs_load))) {
+				lload = load;
+				low->cs_cpu = lgroup.cs_cpu;
+				low->cs_load = lgroup.cs_load;
+			}
+		}
+		if (match & CPU_SEARCH_HIGHEST)
+			if (hgroup.cs_load != -1 &&
+			    (load > hload ||
+			     (load == hload && hgroup.cs_load > high->cs_load))) {
+				hload = load;
+				high->cs_cpu = hgroup.cs_cpu;
+				high->cs_load = hgroup.cs_load;
+			}
+		if (child)
+			i++;
+		else
+			cpu++;
 	}
 	return (total);
 }
@@ -679,19 +691,19 @@ cpu_search(struct cpu_group *cg, struct 
  * optimization.
  */
 int
-cpu_search_lowest(struct cpu_group *cg, struct cpu_search *low)
+cpu_search_lowest(const struct cpu_group *cg, struct cpu_search *low)
 {
 	return cpu_search(cg, low, NULL, CPU_SEARCH_LOWEST);
 }
 
 int
-cpu_search_highest(struct cpu_group *cg, struct cpu_search *high)
+cpu_search_highest(const struct cpu_group *cg, struct cpu_search *high)
 {
 	return cpu_search(cg, NULL, high, CPU_SEARCH_HIGHEST);
 }
 
 int
-cpu_search_both(struct cpu_group *cg, struct cpu_search *low,
+cpu_search_both(const struct cpu_group *cg, struct cpu_search *low,
     struct cpu_search *high)
 {
 	return cpu_search(cg, low, high, CPU_SEARCH_BOTH);
@@ -703,14 +715,16 @@ cpu_search_both(struct cpu_group *cg, st
  * acceptable.
  */
 static inline int
-sched_lowest(struct cpu_group *cg, cpuset_t mask, int pri)
+sched_lowest(const struct cpu_group *cg, cpuset_t mask, int pri, int maxload,
+    int prefer)
 {
 	struct cpu_search low;
 
 	low.cs_cpu = -1;
-	low.cs_load = -1;
+	low.cs_prefer = prefer;
 	low.cs_mask = mask;
-	low.cs_limit = pri;
+	low.cs_pri = pri;
+	low.cs_limit = maxload;
 	cpu_search_lowest(cg, &low);
 	return low.cs_cpu;
 }
@@ -719,12 +733,11 @@ sched_lowest(struct cpu_group *cg, cpuse
  * Find the cpu with the highest load via the highest loaded path.
  */
 static inline int
-sched_highest(struct cpu_group *cg, cpuset_t mask, int minload)
+sched_highest(const struct cpu_group *cg, cpuset_t mask, int minload)
 {
 	struct cpu_search high;
 
 	high.cs_cpu = -1;
-	high.cs_load = 0;
 	high.cs_mask = mask;
 	high.cs_limit = minload;
 	cpu_search_highest(cg, &high);
@@ -735,17 +748,17 @@ sched_highest(struct cpu_group *cg, cpus
  * Simultaneously find the highest and lowest loaded cpu reachable via
  * cg.
  */
-static inline void 
-sched_both(struct cpu_group *cg, cpuset_t mask, int *lowcpu, int *highcpu)
+static inline void
+sched_both(const struct cpu_group *cg, cpuset_t mask, int *lowcpu, int *highcpu)
 {
 	struct cpu_search high;
 	struct cpu_search low;
 
 	low.cs_cpu = -1;
-	low.cs_limit = -1;
-	low.cs_load = -1;
+	low.cs_prefer = -1;
+	low.cs_pri = -1;
+	low.cs_limit = INT_MAX;
 	low.cs_mask = mask;
-	high.cs_load = 0;
 	high.cs_cpu = -1;
 	high.cs_limit = -1;
 	high.cs_mask = mask;
@@ -758,30 +771,45 @@ sched_both(struct cpu_group *cg, cpuset_
 static void
 sched_balance_group(struct cpu_group *cg)
 {
-	cpuset_t mask;
-	int high;
-	int low;
-	int i;
+	cpuset_t hmask, lmask;
+	int high, low, anylow;
 
-	CPU_FILL(&mask);
+	CPU_FILL(&hmask);
 	for (;;) {
-		sched_both(cg, mask, &low, &high);
-		if (low == high || low == -1 || high == -1)
+		high = sched_highest(cg, hmask, 1);
+		/* Stop if there is no more CPU with transferrable threads. */
+		if (high == -1)
 			break;
-		if (sched_balance_pair(TDQ_CPU(high), TDQ_CPU(low)))
+		CPU_CLR(high, &hmask);
+		CPU_COPY(&hmask, &lmask);
+		/* Stop if there is no more CPU left for low. */
+		if (CPU_EMPTY(&lmask))
 			break;
-		/*
-		 * If we failed to move any threads determine which cpu
-		 * to kick out of the set and try again.
-	 	 */
-		if (TDQ_CPU(high)->tdq_transferable == 0)
-			CPU_CLR(high, &mask);
-		else
-			CPU_CLR(low, &mask);
+		anylow = 1;
+nextlow:
+		low = sched_lowest(cg, lmask, -1,
+		    TDQ_CPU(high)->tdq_load - 1, high);
+		/* Stop if we looked well and found no less loaded CPU. */
+		if (anylow && low == -1)
+			break;
+		/* Go to next high if we found no less loaded CPU. */
+		if (low == -1)
+			continue;
+		/* Transfer thread from high to low. */
+		if (sched_balance_pair(TDQ_CPU(high), TDQ_CPU(low))) {
+			/* CPU that got thread can no longer be a donor. */
+			CPU_CLR(low, &hmask);
+		} else {
+			/*
+			 * If failed, then there is no threads on high
+			 * that can run on this low. Drop low from low
+			 * mask and look for different one.
+			 */
+			CPU_CLR(low, &lmask);
+			anylow = 0;
+			goto nextlow;
+		}
 	}
-
-	for (i = 0; i < cg->cg_children; i++)
-		sched_balance_group(&cg->cg_child[i]);
 }
 
 static void
@@ -834,32 +862,17 @@ tdq_unlock_pair(struct tdq *one, struct 
 static int
 sched_balance_pair(struct tdq *high, struct tdq *low)
 {
-	int transferable;
-	int high_load;
-	int low_load;
 	int moved;
-	int move;
 	int cpu;
-	int diff;
-	int i;
 
 	tdq_lock_pair(high, low);
-	transferable = high->tdq_transferable;
-	high_load = high->tdq_load;
-	low_load = low->tdq_load;
 	moved = 0;
 	/*
 	 * Determine what the imbalance is and then adjust that to how many
 	 * threads we actually have to give up (transferable).
 	 */
-	if (transferable != 0) {
-		diff = high_load - low_load;
-		move = diff / 2;
-		if (diff & 0x1)
-			move++;
-		move = min(move, transferable);
-		for (i = 0; i < move; i++)
-			moved += tdq_move(high, low);
+	if (high->tdq_transferable != 0 && high->tdq_load > low->tdq_load &&
+	    (moved = tdq_move(high, low)) > 0) {
 		/*
 		 * In case the target isn't the current cpu IPI it to force a
 		 * reschedule with the new workload.
@@ -1003,8 +1016,7 @@ runq_steal_from(struct runq *rq, int cpu
 {
 	struct rqbits *rqb;
 	struct rqhead *rqh;
-	struct thread *td;
-	int first;
+	struct thread *td, *first;
 	int bit;
 	int pri;
 	int i;
@@ -1012,7 +1024,7 @@ runq_steal_from(struct runq *rq, int cpu
 	rqb = &rq->rq_status;
 	bit = start & (RQB_BPW -1);
 	pri = 0;
-	first = 0;
+	first = NULL;
 again:
 	for (i = RQB_WORD(start); i < RQB_LEN; bit = 0, i++) {
 		if (rqb->rqb_bits[i] == 0)
@@ -1031,7 +1043,7 @@ again:
 			if (first && THREAD_CAN_MIGRATE(td) &&
 			    THREAD_CAN_SCHED(td, cpu))
 				return (td);
-			first = 1;
+			first = td;
 		}
 	}
 	if (start != 0) {
@@ -1039,6 +1051,9 @@ again:
 		goto again;
 	}
 
+	if (first && THREAD_CAN_MIGRATE(first) &&
+	    THREAD_CAN_SCHED(first, cpu))
+		return (first);
 	return (NULL);
 }
 
@@ -1140,13 +1155,11 @@ SCHED_STAT_DEFINE(pickcpu_migration, "Se
 static int
 sched_pickcpu(struct thread *td, int flags)
 {
-	struct cpu_group *cg;
+	struct cpu_group *cg, *ccg;
 	struct td_sched *ts;
 	struct tdq *tdq;
 	cpuset_t mask;
-	int self;
-	int pri;
-	int cpu;
+	int cpu, pri, self;
 
 	self = PCPU_GET(cpuid);
 	ts = td->td_sched;
@@ -1161,52 +1174,77 @@ sched_pickcpu(struct thread *td, int fla
 	 * Prefer to run interrupt threads on the processors that generate
 	 * the interrupt.
 	 */
+	pri = td->td_priority;
 	if (td->td_priority <= PRI_MAX_ITHD && THREAD_CAN_SCHED(td, self) &&
 	    curthread->td_intr_nesting_level && ts->ts_cpu != self) {
 		SCHED_STAT_INC(pickcpu_intrbind);
 		ts->ts_cpu = self;
+		if (TDQ_CPU(self)->tdq_lowpri > pri) {
+			SCHED_STAT_INC(pickcpu_affinity);
+			return (ts->ts_cpu);
+		}
 	}
 	/*
 	 * If the thread can run on the last cpu and the affinity has not
 	 * expired or it is idle run it there.
 	 */
-	pri = td->td_priority;
 	tdq = TDQ_CPU(ts->ts_cpu);
-	if (THREAD_CAN_SCHED(td, ts->ts_cpu)) {
-		if (tdq->tdq_lowpri > PRI_MIN_IDLE) {
+	cg = tdq->tdq_cg;
+	if (THREAD_CAN_SCHED(td, ts->ts_cpu) &&
+	    tdq->tdq_lowpri >= PRI_MIN_IDLE &&
+	    SCHED_AFFINITY(ts, CG_SHARE_L2)) {
+		if (cg->cg_flags & CG_FLAG_THREAD) {
+			CPUSET_FOREACH(cpu, cg->cg_mask) {
+				if (TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE)
+					break;
+			}
+		} else
+			cpu = INT_MAX;
+		if (cpu > mp_maxid) {
 			SCHED_STAT_INC(pickcpu_idle_affinity);
 			return (ts->ts_cpu);
 		}
-		if (SCHED_AFFINITY(ts, CG_SHARE_L2) && tdq->tdq_lowpri > pri) {
-			SCHED_STAT_INC(pickcpu_affinity);
-			return (ts->ts_cpu);
-		}
 	}
 	/*
-	 * Search for the highest level in the tree that still has affinity.
+	 * Search for the last level cache CPU group in the tree.
+	 * Skip caches with expired affinity time and SMT groups.
+	 * Affinity to higher level caches will be handled less aggressively.
 	 */
-	cg = NULL;
-	for (cg = tdq->tdq_cg; cg != NULL; cg = cg->cg_parent)
-		if (SCHED_AFFINITY(ts, cg->cg_level))
-			break;
+	for (ccg = NULL; cg != NULL; cg = cg->cg_parent) {
+		if (cg->cg_flags & CG_FLAG_THREAD)
+			continue;
+		if (!SCHED_AFFINITY(ts, cg->cg_level))
+			continue;
+		ccg = cg;
+	}
+	if (ccg != NULL)
+		cg = ccg;
 	cpu = -1;
+	/* Search the group for the less loaded idle CPU we can run now. */
 	mask = td->td_cpuset->cs_mask;
-	if (cg)
-		cpu = sched_lowest(cg, mask, pri);
+	if (cg != NULL && cg != cpu_top &&
+	    CPU_CMP(&cg->cg_mask, &cpu_top->cg_mask) != 0)
+		cpu = sched_lowest(cg, mask, max(pri, PRI_MAX_TIMESHARE),
+		    INT_MAX, ts->ts_cpu);
+	/* Search globally for the less loaded CPU we can run now. */
+	if (cpu == -1)
+		cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu);
+	/* Search globally for the less loaded CPU. */
 	if (cpu == -1)
-		cpu = sched_lowest(cpu_top, mask, -1);
+		cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu);
+	KASSERT(cpu != -1, ("sched_pickcpu: Failed to find a cpu."));
 	/*
 	 * Compare the lowest loaded cpu to current cpu.
 	 */
 	if (THREAD_CAN_SCHED(td, self) && TDQ_CPU(self)->tdq_lowpri > pri &&
-	    TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE) {
+	    TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE &&
+	    TDQ_CPU(self)->tdq_load <= TDQ_CPU(cpu)->tdq_load + 1) {
 		SCHED_STAT_INC(pickcpu_local);
 		cpu = self;
 	} else
 		SCHED_STAT_INC(pickcpu_lowest);
 	if (cpu != ts->ts_cpu)
 		SCHED_STAT_INC(pickcpu_migration);
-	KASSERT(cpu != -1, ("sched_pickcpu: Failed to find a cpu."));
 	return (cpu);
 }
 #endif
@@ -2750,8 +2788,6 @@ SYSCTL_INT(_kern_sched, OID_AUTO, balanc
 SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval, CTLFLAG_RW,
     &balance_interval, 0,
     "Average frequency in stathz ticks to run the long-term balancer");
-SYSCTL_INT(_kern_sched, OID_AUTO, steal_htt, CTLFLAG_RW, &steal_htt, 0,
-    "Steals work from another hyper-threaded core on idle");
 SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_RW, &steal_idle, 0,
     "Attempts to steal work from other cores before idling");
 SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0,

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 12:40:31 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8FB70106566B;
	Wed, 28 Mar 2012 12:40:31 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7AAB18FC16;
	Wed, 28 Mar 2012 12:40:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SCeVKw036249;
	Wed, 28 Mar 2012 12:40:31 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SCeVub036247;
	Wed, 28 Mar 2012 12:40:31 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <201203281240.q2SCeVub036247@svn.freebsd.org>
From: Marko Zec 
Date: Wed, 28 Mar 2012 12:40:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233602 - in stable/9/sys: i386/conf net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 12:40:31 -0000

Author: zec
Date: Wed Mar 28 12:40:30 2012
New Revision: 233602
URL: http://svn.freebsd.org/changeset/base/233602

Log:
  MFC: 232487
    Properly restore curvnet context when returning early from
    ether_input_internal().
  
    This change only affects options VIMAGE kernel builds.
  
    PR:           kern/165643
    Submitted by: Vijay Singh
    MFC after:    3 days

Modified:
  stable/9/sys/net/if_ethersubr.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/net/if_ethersubr.c
==============================================================================
--- stable/9/sys/net/if_ethersubr.c	Wed Mar 28 12:30:16 2012	(r233601)
+++ stable/9/sys/net/if_ethersubr.c	Wed Mar 28 12:40:30 2012	(r233602)
@@ -661,8 +661,10 @@ ether_input_internal(struct ifnet *ifp, 
 		m = (*lagg_input_p)(ifp, m);
 		if (m != NULL)
 			ifp = m->m_pkthdr.rcvif;
-		else 
+		else {
+			CURVNET_RESTORE();
 			return;
+		}
 	}
 
 	/*
@@ -681,6 +683,7 @@ ether_input_internal(struct ifnet *ifp, 
 #endif
 			ifp->if_ierrors++;
 			m_freem(m);
+			CURVNET_RESTORE();
 			return;
 		}
 

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 12:45:36 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 75AAF106564A;
	Wed, 28 Mar 2012 12:45:36 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 46BA98FC0A;
	Wed, 28 Mar 2012 12:45:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SCjaHO036518;
	Wed, 28 Mar 2012 12:45:36 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SCjamc036515;
	Wed, 28 Mar 2012 12:45:36 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <201203281245.q2SCjamc036515@svn.freebsd.org>
From: Marko Zec 
Date: Wed, 28 Mar 2012 12:45:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233604 - in stable/9/sys: i386/conf netinet
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 12:45:36 -0000

Author: zec
Date: Wed Mar 28 12:45:35 2012
New Revision: 233604
URL: http://svn.freebsd.org/changeset/base/233604

Log:
  MFC r232517:
    Change SYSINIT priorities so that ip_mroute_modevent() is executed
    before vnet_mroute_init(), since vnet_mroute_init() depends on mfchashsize
    tunable to be set, and that is done in in ip_mroute_modevent().
    Apparently I broke that ordering with r208744 almost 2 years ago...
  
    PR:           kern/162201
    Submitted by: Stevan Markovic (mcafee.com)
    MFC after:    3 days

Modified:
  stable/9/sys/netinet/ip_mroute.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/netinet/ip_mroute.c
==============================================================================
--- stable/9/sys/netinet/ip_mroute.c	Wed Mar 28 12:41:17 2012	(r233603)
+++ stable/9/sys/netinet/ip_mroute.c	Wed Mar 28 12:45:35 2012	(r233604)
@@ -2822,7 +2822,7 @@ vnet_mroute_init(const void *unused __un
 	callout_init(&V_bw_meter_ch, CALLOUT_MPSAFE);
 }
 
-VNET_SYSINIT(vnet_mroute_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, vnet_mroute_init,
+VNET_SYSINIT(vnet_mroute_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mroute_init,
 	NULL);
 
 static void
@@ -2945,4 +2945,4 @@ static moduledata_t ip_mroutemod = {
     0
 };
 
-DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE);

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 16:32:15 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A12BB1065670;
	Wed, 28 Mar 2012 16:32:15 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8BFAA8FC08;
	Wed, 28 Mar 2012 16:32:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SGWF6h044539;
	Wed, 28 Mar 2012 16:32:15 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SGWF3c044537;
	Wed, 28 Mar 2012 16:32:15 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203281632.q2SGWF3c044537@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 28 Mar 2012 16:32:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233612 - stable/9/share/man/man4
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 16:32:15 -0000

Author: jkim
Date: Wed Mar 28 16:32:15 2012
New Revision: 233612
URL: http://svn.freebsd.org/changeset/base/233612

Log:
  MFC:	r233313
  
  Add ACPI_LV_REPAIR debug level, available since ACPICA 20091214.

Modified:
  stable/9/share/man/man4/acpi.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/acpi.4
==============================================================================
--- stable/9/share/man/man4/acpi.4	Wed Mar 28 16:23:40 2012	(r233611)
+++ stable/9/share/man/man4/acpi.4	Wed Mar 28 16:32:15 2012	(r233612)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 26, 2010
+.Dd March 22, 2012
 .Dt ACPI 4
 .Os
 .Sh NAME
@@ -483,6 +483,8 @@ Initialization progress
 Stores to objects
 .It Li ACPI_LV_INFO
 General information and progress
+.It Li ACPI_LV_REPAIR
+Repair a common problem with predefined methods
 .It Li ACPI_LV_ALL_EXCEPTIONS
 All the previous levels
 .It Li ACPI_LV_PARSE

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 19:07:18 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D901B1065670;
	Wed, 28 Mar 2012 19:07:18 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A9D1B8FC1B;
	Wed, 28 Mar 2012 19:07:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SJ7IYs050290;
	Wed, 28 Mar 2012 19:07:18 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SJ7IuX050289;
	Wed, 28 Mar 2012 19:07:18 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203281907.q2SJ7IuX050289@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Mar 2012 19:07:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233624 - stable/9/lib/csu/common
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 19:07:19 -0000

Author: kib
Date: Wed Mar 28 19:07:18 2012
New Revision: 233624
URL: http://svn.freebsd.org/changeset/base/233624

Log:
  MFC r232830:
  Add a header with definitions useful for constructing ELF notes.

Added:
  stable/9/lib/csu/common/notes.h
     - copied unchanged from r232830, head/lib/csu/common/notes.h
Modified:
Directory Properties:
  stable/9/lib/csu/   (props changed)

Copied: stable/9/lib/csu/common/notes.h (from r232830, head/lib/csu/common/notes.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/csu/common/notes.h	Wed Mar 28 19:07:18 2012	(r233624, copy of r232830, head/lib/csu/common/notes.h)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright 2012 Konstantin Belousov 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	CSU_COMMON_NOTES_H
+#define	CSU_COMMON_NOTES_H
+
+#define NOTE_FREEBSD_VENDOR	"FreeBSD"
+
+#define NOTE_SECTION		".note.tag"
+
+#define ABI_NOTETYPE		1
+#define	CRT_NOINIT_NOTETYPE	2
+
+#endif

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 19:40:59 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5945E1065670;
	Wed, 28 Mar 2012 19:40:59 +0000 (UTC)
	(envelope-from gibbs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2AA728FC1C;
	Wed, 28 Mar 2012 19:40:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SJex8b051412;
	Wed, 28 Mar 2012 19:40:59 GMT (envelope-from gibbs@svn.freebsd.org)
Received: (from gibbs@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SJew95051410;
	Wed, 28 Mar 2012 19:40:58 GMT (envelope-from gibbs@svn.freebsd.org)
Message-Id: <201203281940.q2SJew95051410@svn.freebsd.org>
From: "Justin T. Gibbs" 
Date: Wed, 28 Mar 2012 19:40:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233626 - stable/9/sys/dev/xen/blkfront
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 19:40:59 -0000

Author: gibbs
Date: Wed Mar 28 19:40:58 2012
New Revision: 233626
URL: http://svn.freebsd.org/changeset/base/233626

Log:
  MFC Revision 233465
  
  Correct failure to attach the PV block front device on Citrix
  XenServer configurations that advertise the multi-page ring extension,
  but only allow a single page of ring space.
  
  sys/dev/xen/blkfront/blkfront.c:
  	If only one page of ring space is being used, do not publish
  	in the XenStore the number of pages in use (1), via either
  	of the supported multi-page ring extension schemes.
  
  	Single page operation is the same with or without the
  	ring-page extension being negotiated.   Relying on the
  	legacy behavior avoids an incompatible difference in how
  	the two ring-page extension schemes that are out in the
  	wild, deal with the base case of a single page.  The
  	Amazon/Red Hat drivers use the same XenStore variable as
  	if the extension was not negotiated.  The Citrix drivers
  	assume the new ring reference XenStore variables will be
  	available
  
  Reported by:	Oliver Schonefeld 

Modified:
  stable/9/sys/dev/xen/blkfront/blkfront.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/xen/blkfront/blkfront.c
==============================================================================
--- stable/9/sys/dev/xen/blkfront/blkfront.c	Wed Mar 28 19:20:28 2012	(r233625)
+++ stable/9/sys/dev/xen/blkfront/blkfront.c	Wed Mar 28 19:40:58 2012	(r233626)
@@ -698,21 +698,25 @@ blkfront_initialize(struct xb_softc *sc)
 		return;
 
 	/* Support both backend schemes for relaying ring page limits. */
-	error = xs_printf(XST_NIL, node_path,
-			 "num-ring-pages","%u", sc->ring_pages);
-	if (error) {
-		xenbus_dev_fatal(sc->xb_dev, error,
-				 "writing %s/num-ring-pages",
-				 node_path);
-		return;
-	}
-	error = xs_printf(XST_NIL, node_path,
-			 "ring-page-order","%u", fls(sc->ring_pages) - 1);
-	if (error) {
-		xenbus_dev_fatal(sc->xb_dev, error,
-				 "writing %s/ring-page-order",
-				 node_path);
-		return;
+	if (sc->ring_pages > 1) {
+		error = xs_printf(XST_NIL, node_path,
+				 "num-ring-pages","%u", sc->ring_pages);
+		if (error) {
+			xenbus_dev_fatal(sc->xb_dev, error,
+					 "writing %s/num-ring-pages",
+					 node_path);
+			return;
+		}
+
+		error = xs_printf(XST_NIL, node_path,
+				 "ring-page-order", "%u",
+				 fls(sc->ring_pages) - 1);
+		if (error) {
+			xenbus_dev_fatal(sc->xb_dev, error,
+					 "writing %s/ring-page-order",
+					 node_path);
+			return;
+		}
 	}
 
 	error = xs_printf(XST_NIL, node_path,

From owner-svn-src-stable-9@FreeBSD.ORG  Wed Mar 28 21:34:56 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 474A2106564A;
	Wed, 28 Mar 2012 21:34:56 +0000 (UTC)
	(envelope-from mckusick@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E8C38FC12;
	Wed, 28 Mar 2012 21:34:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SLYuU3055217;
	Wed, 28 Mar 2012 21:34:56 GMT
	(envelope-from mckusick@svn.freebsd.org)
Received: (from mckusick@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SLYt7k055205;
	Wed, 28 Mar 2012 21:34:55 GMT
	(envelope-from mckusick@svn.freebsd.org)
Message-Id: <201203282134.q2SLYt7k055205@svn.freebsd.org>
From: Kirk McKusick 
Date: Wed, 28 Mar 2012 21:34:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233630 - in stable/9/sys: i386/conf kern sys ufs/ffs
	ufs/ufs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 28 Mar 2012 21:34:56 -0000

Author: mckusick
Date: Wed Mar 28 21:34:55 2012
New Revision: 233630
URL: http://svn.freebsd.org/changeset/base/233630

Log:
  MFC of 232351, 233438, and 233629
  
  MFC reviewed by: kib
  
  MFC 232351:
  
  This change avoids a kernel deadlock on "snaplk" when using
  snapshots on UFS filesystems running with journaled soft updates.
  This is the first of several bugs that need to be fixed before
  removing the restriction added in -r230250 to prevent the use
  of snapshots on filesystems running with journaled soft updates.
  
  The deadlock occurs when holding the snapshot lock (snaplk)
  and then trying to flush an inode via ffs_update(). We become
  blocked by another process trying to flush a different inode
  contained in the same inode block that we need. It holds the
  inode block for which we are waiting locked. When it tries to
  write the inode block, it gets blocked waiting for the our
  snaplk when it calls ffs_copyonwrite() to see if the inode
  block needs to be copied in our snapshot.
  
  The most obvious place that this deadlock arises is in the
  ffs_copyonwrite() routine when it updates critical metadata
  in a snapshot and tries to write it out before proceeding.
  The fix here is to write the data and indirect block pointer
  for the snapshot, but to skip the call to ffs_update() to
  write the snapshot inode. To ensure that we will never have
  to update a pointer in the inode itself, the ffs_snapshot()
  routine that creates the snapshot has to ensure that all the
  direct blocks are allocated as part of the creation of the
  snapshot.
  
  A less obvious place that this deadlock occurs is when we hold
  the snaplk because we are deleting a snapshot. In the course of
  doing the deletion, we need to allocate various soft update
  dependency structures and allocate some journal space. If we
  hit a resource limit while doing this we decrease the resources
  in use by flushing out an existing dirty file to get it to give
  up the soft dependency resources that it holds. The flush can
  cause an ffs_update() to be done on the inode for the file that
  we have selected to flush resulting in the same deadlock as
  described above when the inode that we have chosen to flush
  resides in the same inode block as the snapshot inode that we hold.
  The fix is to defer cleaning up any time that the inode on which
  we are operating is a snapshot.
  
  Help and review by:    Jeff Roberson
  Tested by:             Peter Holm
  
  MFC 233438:
  
  Add a third flags argument to ffs_syncvnode to avoid a possible conflict
  with MNT_WAIT flags that passed in its second argument.
  
  Discussed with: kib
  
  MFC 233629:
  
  A refinement of change 232351 to avoid a race with a forcible unmount.
  While we have a snapshot vnode unlocked to avoid a deadlock with another
  inode in the same inode block being updated, the filesystem containing
  it may be forcibly unmounted. When that happens the snapshot vnode is
  revoked. We need to check for that condition and fail appropriately.
  
  Spotted by:  kib
  Reviewed by: kib

Modified:
  stable/9/sys/kern/vfs_bio.c
  stable/9/sys/sys/buf.h
  stable/9/sys/ufs/ffs/ffs_balloc.c
  stable/9/sys/ufs/ffs/ffs_extern.h
  stable/9/sys/ufs/ffs/ffs_inode.c
  stable/9/sys/ufs/ffs/ffs_rawread.c
  stable/9/sys/ufs/ffs/ffs_snapshot.c
  stable/9/sys/ufs/ffs/ffs_softdep.c
  stable/9/sys/ufs/ffs/ffs_vfsops.c
  stable/9/sys/ufs/ffs/ffs_vnops.c
  stable/9/sys/ufs/ufs/inode.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/kern/vfs_bio.c
==============================================================================
--- stable/9/sys/kern/vfs_bio.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/kern/vfs_bio.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -782,19 +782,15 @@ bremfreel(struct buf *bp)
 	}
 }
 
-
 /*
- * Get a buffer with the specified data.  Look in the cache first.  We
- * must clear BIO_ERROR and B_INVAL prior to initiating I/O.  If B_CACHE
- * is set, the buffer is valid and we do not have to do anything ( see
- * getblk() ).  This is really just a special case of breadn().
+ * Get a buffer with the specified data.
  */
 int
 bread(struct vnode * vp, daddr_t blkno, int size, struct ucred * cred,
     struct buf **bpp)
 {
 
-	return (breadn(vp, blkno, size, 0, 0, 0, cred, bpp));
+	return (breadn_flags(vp, blkno, size, 0, 0, 0, cred, 0, bpp));
 }
 
 /*
@@ -842,11 +838,34 @@ breadn(struct vnode * vp, daddr_t blkno,
     daddr_t * rablkno, int *rabsize,
     int cnt, struct ucred * cred, struct buf **bpp)
 {
+
+	return (breadn_flags(vp, blkno, size, rablkno, rabsize, cnt,
+		    cred, 0, bpp));
+}
+
+/*
+ * Entry point for bread() and breadn().
+ *
+ * Get a buffer with the specified data.  Look in the cache first.  We
+ * must clear BIO_ERROR and B_INVAL prior to initiating I/O.  If B_CACHE
+ * is set, the buffer is valid and we do not have to do anything, see
+ * getblk(). Also starts asynchronous I/O on read-ahead blocks.
+ */
+int
+breadn_flags(struct vnode * vp, daddr_t blkno, int size,
+    daddr_t * rablkno, int *rabsize, int cnt,
+    struct ucred * cred, int flags, struct buf **bpp)
+{
 	struct buf *bp;
 	int rv = 0, readwait = 0;
 
 	CTR3(KTR_BUF, "breadn(%p, %jd, %d)", vp, blkno, size);
-	*bpp = bp = getblk(vp, blkno, size, 0, 0, 0);
+	/*
+	 * Can only return NULL if GB_LOCK_NOWAIT flag is specified.
+	 */
+	*bpp = bp = getblk(vp, blkno, size, 0, 0, flags);
+	if (bp == NULL)
+		return (EBUSY);
 
 	/* if not found in cache, do some I/O */
 	if ((bp->b_flags & B_CACHE) == 0) {

Modified: stable/9/sys/sys/buf.h
==============================================================================
--- stable/9/sys/sys/buf.h	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/sys/buf.h	Wed Mar 28 21:34:55 2012	(r233630)
@@ -483,6 +483,8 @@ int	bread(struct vnode *, daddr_t, int, 
 void	breada(struct vnode *, daddr_t *, int *, int, struct ucred *);
 int	breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int,
 	    struct ucred *, struct buf **);
+int	breadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int,
+	    struct ucred *, int, struct buf **);
 void	bdwrite(struct buf *);
 void	bawrite(struct buf *);
 void	bdirty(struct buf *);

Modified: stable/9/sys/ufs/ffs/ffs_balloc.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_balloc.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_balloc.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -450,7 +450,7 @@ fail:
 	 *
 	 * XXX Still have to journal the free below
 	 */
-	(void) ffs_syncvnode(vp, MNT_WAIT);
+	(void) ffs_syncvnode(vp, MNT_WAIT, 0);
 	for (deallocated = 0, blkp = allociblk, lbns_remfree = lbns;
 	     blkp < allocblk; blkp++, lbns_remfree++) {
 		/*
@@ -497,7 +497,7 @@ fail:
 		dp->di_blocks -= btodb(deallocated);
 		ip->i_flag |= IN_CHANGE | IN_UPDATE;
 	}
-	(void) ffs_syncvnode(vp, MNT_WAIT);
+	(void) ffs_syncvnode(vp, MNT_WAIT, 0);
 	/*
 	 * After the buffers are invalidated and on-disk pointers are
 	 * cleared, free the blocks.
@@ -994,7 +994,7 @@ fail:
 	 *
 	 * XXX Still have to journal the free below
 	 */
-	(void) ffs_syncvnode(vp, MNT_WAIT);
+	(void) ffs_syncvnode(vp, MNT_WAIT, 0);
 	for (deallocated = 0, blkp = allociblk, lbns_remfree = lbns;
 	     blkp < allocblk; blkp++, lbns_remfree++) {
 		/*
@@ -1041,7 +1041,7 @@ fail:
 		dp->di_blocks -= btodb(deallocated);
 		ip->i_flag |= IN_CHANGE | IN_UPDATE;
 	}
-	(void) ffs_syncvnode(vp, MNT_WAIT);
+	(void) ffs_syncvnode(vp, MNT_WAIT, 0);
 	/*
 	 * After the buffers are invalidated and on-disk pointers are
 	 * cleared, free the blocks.

Modified: stable/9/sys/ufs/ffs/ffs_extern.h
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_extern.h	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_extern.h	Wed Mar 28 21:34:55 2012	(r233630)
@@ -92,7 +92,7 @@ void	ffs_snapshot_mount(struct mount *mp
 void	ffs_snapshot_unmount(struct mount *mp);
 void	process_deferred_inactive(struct mount *mp);
 void	ffs_sync_snap(struct mount *, int);
-int	ffs_syncvnode(struct vnode *vp, int waitfor);
+int	ffs_syncvnode(struct vnode *vp, int waitfor, int flags);
 int	ffs_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *);
 int	ffs_update(struct vnode *, int);
 int	ffs_valloc(struct vnode *, int, struct ucred *, struct vnode **);
@@ -167,6 +167,12 @@ void	softdep_freework(struct workhead *)
 #define FLUSH_INODES_WAIT	2
 #define FLUSH_BLOCKS		3
 #define FLUSH_BLOCKS_WAIT	4
+/*
+ * Flag to ffs_syncvnode() to request flushing of data only,
+ * but skip the ffs_update() on the inode itself. Used to avoid
+ * deadlock when flushing snapshot inodes while holding snaplk.
+ */
+#define	NO_INO_UPDT		0x00000001
 
 int	ffs_rdonly(struct inode *);
 

Modified: stable/9/sys/ufs/ffs/ffs_inode.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_inode.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_inode.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -81,7 +81,7 @@ ffs_update(vp, waitfor)
 	struct fs *fs;
 	struct buf *bp;
 	struct inode *ip;
-	int error;
+	int flags, error;
 
 	ASSERT_VOP_ELOCKED(vp, "ffs_update");
 	ufs_itimes(vp);
@@ -92,11 +92,51 @@ ffs_update(vp, waitfor)
 	fs = ip->i_fs;
 	if (fs->fs_ronly && ip->i_ump->um_fsckpid == 0)
 		return (0);
-	error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
-		(int)fs->fs_bsize, NOCRED, &bp);
-	if (error) {
-		brelse(bp);
-		return (error);
+	/*
+	 * If we are updating a snapshot and another process is currently
+	 * writing the buffer containing the inode for this snapshot then
+	 * a deadlock can occur when it tries to check the snapshot to see
+	 * if that block needs to be copied. Thus when updating a snapshot
+	 * we check to see if the buffer is already locked, and if it is
+	 * we drop the snapshot lock until the buffer has been written
+	 * and is available to us. We have to grab a reference to the
+	 * snapshot vnode to prevent it from being removed while we are
+	 * waiting for the buffer.
+	 */
+	flags = 0;
+	if (IS_SNAPSHOT(ip))
+		flags = GB_LOCK_NOWAIT;
+loop:
+	error = breadn_flags(ip->i_devvp,
+	     fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
+	     (int) fs->fs_bsize, 0, 0, 0, NOCRED, flags, &bp);
+	if (error != 0) {
+		if (error != EBUSY) {
+			brelse(bp);
+			return (error);
+		}
+		KASSERT((IS_SNAPSHOT(ip)), ("EBUSY from non-snapshot"));
+		/*
+		 * Wait for our inode block to become available.
+		 *
+		 * Hold a reference to the vnode to protect against
+		 * ffs_snapgone(). Since we hold a reference, it can only
+		 * get reclaimed (VI_DOOMED flag) in a forcible downgrade
+		 * or unmount. For an unmount, the entire filesystem will be
+		 * gone, so we cannot attempt to touch anything associated
+		 * with it while the vnode is unlocked; all we can do is 
+		 * pause briefly and try again. If when we relock the vnode
+		 * we discover that it has been reclaimed, updating it is no
+		 * longer necessary and we can just return an error.
+		 */
+		vref(vp);
+		VOP_UNLOCK(vp, 0);
+		pause("ffsupd", 1);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		vrele(vp);
+		if ((vp->v_iflag & VI_DOOMED) != 0)
+			return (ENOENT);
+		goto loop;
 	}
 	if (DOINGSOFTDEP(vp))
 		softdep_update_inodeblock(ip, bp, waitfor);
@@ -108,16 +148,16 @@ ffs_update(vp, waitfor)
 	else
 		*((struct ufs2_dinode *)bp->b_data +
 		    ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2;
-	if (waitfor && !DOINGASYNC(vp)) {
-		return (bwrite(bp));
-	} else if (vm_page_count_severe() || buf_dirty_count_severe()) {
-		return (bwrite(bp));
+	if ((waitfor && !DOINGASYNC(vp)) ||
+	    (vm_page_count_severe() || buf_dirty_count_severe())) {
+		error = bwrite(bp);
 	} else {
 		if (bp->b_bufsize == fs->fs_bsize)
 			bp->b_flags |= B_CLUSTEROK;
 		bdwrite(bp);
-		return (0);
+		error = 0;
 	}
+	return (error);
 }
 
 #define	SINGLE	0	/* index of single indirect block */
@@ -201,7 +241,7 @@ ffs_truncate(vp, length, flags, cred, td
 				goto extclean;
 			needextclean = 1;
 		} else {
-			if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0)
+			if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
 				return (error);
 #ifdef QUOTA
 			(void) chkdq(ip, -extblocks, NOCRED, 0);
@@ -253,7 +293,7 @@ ffs_truncate(vp, length, flags, cred, td
 	}
 	if (fs->fs_ronly)
 		panic("ffs_truncate: read-only filesystem");
-	if ((ip->i_flags & SF_SNAPSHOT) != 0)
+	if (IS_SNAPSHOT(ip))
 		ffs_snapremove(vp);
 	vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0;
 	osize = ip->i_size;
@@ -294,7 +334,7 @@ ffs_truncate(vp, length, flags, cred, td
 			 * rarely, we solve the problem by syncing the file
 			 * so that it will have no data structures left.
 			 */
-			if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0)
+			if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
 				return (error);
 		} else {
 			flags = IO_NORMAL | (needextclean ? IO_EXT: 0);
@@ -339,7 +379,7 @@ ffs_truncate(vp, length, flags, cred, td
 		 */
 		if (DOINGSOFTDEP(vp) && lbn < NDADDR &&
 		    fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize &&
-		    (error = ffs_syncvnode(vp, MNT_WAIT)) != 0)
+		    (error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
 			return (error);
 		ip->i_size = length;
 		DIP_SET(ip, i_size, length);

Modified: stable/9/sys/ufs/ffs/ffs_rawread.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_rawread.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_rawread.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -163,7 +163,7 @@ ffs_rawread_sync(struct vnode *vp)
 		/* Flush dirty buffers */
 		if (bo->bo_dirty.bv_cnt > 0) {
 			BO_UNLOCK(bo);
-			if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) {
+			if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) {
 				if (upgraded != 0)
 					VOP_LOCK(vp, LK_DOWNGRADE);
 				vn_finished_write(mp);

Modified: stable/9/sys/ufs/ffs/ffs_snapshot.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_snapshot.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_snapshot.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -203,6 +203,7 @@ ffs_snapshot(mp, snapfile)
 	ufs2_daddr_t numblks, blkno, *blkp, *snapblklist;
 	int error, cg, snaploc;
 	int i, size, len, loc;
+	ufs2_daddr_t blockno;
 	uint64_t flag;
 	struct timespec starttime = {0, 0}, endtime;
 	char saved_nice = 0;
@@ -361,7 +362,7 @@ restart:
 			goto out;
 		bawrite(nbp);
 		if (cg % 10 == 0)
-			ffs_syncvnode(vp, MNT_WAIT);
+			ffs_syncvnode(vp, MNT_WAIT, 0);
 	}
 	/*
 	 * Copy all the cylinder group maps. Although the
@@ -384,7 +385,7 @@ restart:
 		error = cgaccount(cg, vp, nbp, 1);
 		bawrite(nbp);
 		if (cg % 10 == 0)
-			ffs_syncvnode(vp, MNT_WAIT);
+			ffs_syncvnode(vp, MNT_WAIT, 0);
 		if (error)
 			goto out;
 	}
@@ -399,7 +400,7 @@ restart:
 	 * Since we have marked it as a snapshot it is safe to
 	 * unlock it as no process will be allowed to write to it.
 	 */
-	if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0)
+	if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
 		goto out;
 	VOP_UNLOCK(vp, 0);
 	/*
@@ -529,7 +530,7 @@ loop:
 		    (xvp->v_usecount == 0 &&
 		     (xvp->v_iflag & (VI_OWEINACT | VI_DOINGINACT)) == 0) ||
 		    xvp->v_type == VNON ||
-		    (VTOI(xvp)->i_flags & SF_SNAPSHOT)) {
+		    IS_SNAPSHOT(VTOI(xvp))) {
 			VI_UNLOCK(xvp);
 			MNT_ILOCK(mp);
 			continue;
@@ -815,21 +816,26 @@ out1:
 	if (space != NULL)
 		free(space, M_UFSMNT);
 	/*
-	 * If another process is currently writing the buffer containing
-	 * the inode for this snapshot then a deadlock can occur. Drop
-	 * the snapshot lock until the buffer has been written.
+	 * Preallocate all the direct blocks in the snapshot inode so
+	 * that we never have to write the inode itself to commit an
+	 * update to the contents of the snapshot. Note that once
+	 * created, the size of the snapshot will never change, so
+	 * there will never be a need to write the inode except to
+	 * update the non-integrity-critical time fields and
+	 * allocated-block count.
 	 */
-	VREF(vp);	/* Protect against ffs_snapgone() */
-	VOP_UNLOCK(vp, 0);
-	(void) bread(ip->i_devvp,
-		     fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
-		     (int) fs->fs_bsize, NOCRED, &nbp);
-	brelse(nbp);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	if (ip->i_effnlink == 0)
-		error = ENOENT;		/* Snapshot file unlinked */
-	else
-		vrele(vp);		/* Drop extra reference */
+	for (blockno = 0; blockno < NDADDR; blockno++) {
+		if (DIP(ip, i_db[blockno]) != 0)
+			continue;
+		error = UFS_BALLOC(vp, lblktosize(fs, blockno),
+		    fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp);
+		if (error)
+			break;
+		error = readblock(vp, bp, blockno);
+		bawrite(bp);
+		if (error != 0)
+			break;
+	}
 done:
 	free(copy_fs->fs_csp, M_UFSMNT);
 	free(copy_fs, M_UFSMNT);
@@ -855,7 +861,7 @@ out:
 	MNT_IUNLOCK(mp);
 	if (error)
 		(void) ffs_truncate(vp, (off_t)0, 0, NOCRED, td);
-	(void) ffs_syncvnode(vp, MNT_WAIT);
+	(void) ffs_syncvnode(vp, MNT_WAIT, 0);
 	if (error)
 		vput(vp);
 	else
@@ -1708,7 +1714,7 @@ ffs_snapremove(vp)
 	 * may find indirect pointers using the magic BLK_* values.
 	 */
 	if (DOINGSOFTDEP(vp))
-		ffs_syncvnode(vp, MNT_WAIT);
+		ffs_syncvnode(vp, MNT_WAIT, 0);
 #ifdef QUOTA
 	/*
 	 * Reenable disk quotas for ex-snapshot file.
@@ -1902,7 +1908,7 @@ retry:
 			bawrite(cbp);
 			if ((vtype == VDIR || dopersistence) &&
 			    ip->i_effnlink > 0)
-				(void) ffs_syncvnode(vp, MNT_WAIT);
+				(void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT);
 			continue;
 		}
 		/*
@@ -1913,7 +1919,7 @@ retry:
 			bawrite(cbp);
 			if ((vtype == VDIR || dopersistence) &&
 			    ip->i_effnlink > 0)
-				(void) ffs_syncvnode(vp, MNT_WAIT);
+				(void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT);
 			break;
 		}
 		savedcbp = cbp;
@@ -1931,7 +1937,7 @@ retry:
 		bawrite(savedcbp);
 		if ((vtype == VDIR || dopersistence) &&
 		    VTOI(vp)->i_effnlink > 0)
-			(void) ffs_syncvnode(vp, MNT_WAIT);
+			(void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT);
 	}
 	/*
 	 * If we have been unable to allocate a block in which to do
@@ -1987,14 +1993,14 @@ ffs_snapshot_mount(mp)
 			continue;
 		}
 		ip = VTOI(vp);
-		if ((ip->i_flags & SF_SNAPSHOT) == 0 || ip->i_size ==
+		if (!IS_SNAPSHOT(ip) || ip->i_size ==
 		    lblktosize(fs, howmany(fs->fs_size, fs->fs_frag))) {
-			if ((ip->i_flags & SF_SNAPSHOT) == 0) {
+			if (!IS_SNAPSHOT(ip)) {
 				reason = "non-snapshot";
 			} else {
 				reason = "old format snapshot";
 				(void)ffs_truncate(vp, (off_t)0, 0, NOCRED, td);
-				(void)ffs_syncvnode(vp, MNT_WAIT);
+				(void)ffs_syncvnode(vp, MNT_WAIT, 0);
 			}
 			printf("ffs_snapshot_mount: %s inode %d\n",
 			    reason, fs->fs_snapinum[snaploc]);
@@ -2250,7 +2256,7 @@ ffs_copyonwrite(devvp, bp)
 	int launched_async_io, prev_norunningbuf;
 	long saved_runningbufspace;
 
-	if (devvp != bp->b_vp && (VTOI(bp->b_vp)->i_flags & SF_SNAPSHOT) != 0)
+	if (devvp != bp->b_vp && IS_SNAPSHOT(VTOI(bp->b_vp)))
 		return (0);		/* Update on a snapshot file */
 	if (td->td_pflags & TDP_COWINPROGRESS)
 		panic("ffs_copyonwrite: recursive call");
@@ -2395,7 +2401,7 @@ ffs_copyonwrite(devvp, bp)
 			bawrite(cbp);
 			if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR ||
 			    dopersistence) && ip->i_effnlink > 0)
-				(void) ffs_syncvnode(vp, MNT_WAIT);
+				(void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT);
 			else
 				launched_async_io = 1;
 			continue;
@@ -2408,7 +2414,7 @@ ffs_copyonwrite(devvp, bp)
 			bawrite(cbp);
 			if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR ||
 			    dopersistence) && ip->i_effnlink > 0)
-				(void) ffs_syncvnode(vp, MNT_WAIT);
+				(void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT);
 			else
 				launched_async_io = 1;
 			break;
@@ -2428,7 +2434,7 @@ ffs_copyonwrite(devvp, bp)
 		bawrite(savedcbp);
 		if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR ||
 		    dopersistence) && VTOI(vp)->i_effnlink > 0)
-			(void) ffs_syncvnode(vp, MNT_WAIT);
+			(void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT);
 		else
 			launched_async_io = 1;
 	}
@@ -2478,7 +2484,7 @@ ffs_sync_snap(mp, waitfor)
 	}
 	TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) {
 		vp = ITOV(ip);
-		ffs_syncvnode(vp, waitfor);
+		ffs_syncvnode(vp, waitfor, NO_INO_UPDT);
 	}
 	lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
 }

Modified: stable/9/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_softdep.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_softdep.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -2825,7 +2825,12 @@ softdep_prealloc(vp, waitok)
 {
 	struct ufsmount *ump;
 
-	if (DOINGSUJ(vp) == 0)
+	/*
+	 * Nothing to do if we are not running journaled soft updates.
+	 * If we currently hold the snapshot lock, we must avoid handling
+	 * other resources that could cause deadlock.
+	 */
+	if (DOINGSUJ(vp) == 0 || IS_SNAPSHOT(VTOI(vp)))
 		return (0);
 	ump = VFSTOUFS(vp->v_mount);
 	ACQUIRE_LOCK(&lk);
@@ -2842,7 +2847,7 @@ softdep_prealloc(vp, waitok)
 	 * work attached to it.
 	 */
 	if ((curthread->td_pflags & TDP_COWINPROGRESS) == 0)
-		ffs_syncvnode(vp, waitok);
+		ffs_syncvnode(vp, waitok, 0);
 	ACQUIRE_LOCK(&lk);
 	process_removes(vp);
 	process_truncates(vp);
@@ -2871,13 +2876,18 @@ softdep_prelink(dvp, vp)
 
 	ump = VFSTOUFS(dvp->v_mount);
 	mtx_assert(&lk, MA_OWNED);
-	if (journal_space(ump, 0))
+	/*
+	 * Nothing to do if we have sufficient journal space.
+	 * If we currently hold the snapshot lock, we must avoid
+	 * handling other resources that could cause deadlock.
+	 */
+	if (journal_space(ump, 0) || (vp && IS_SNAPSHOT(VTOI(vp))))
 		return;
 	stat_journal_low++;
 	FREE_LOCK(&lk);
 	if (vp)
-		ffs_syncvnode(vp, MNT_NOWAIT);
-	ffs_syncvnode(dvp, MNT_WAIT);
+		ffs_syncvnode(vp, MNT_NOWAIT, 0);
+	ffs_syncvnode(dvp, MNT_WAIT, 0);
 	ACQUIRE_LOCK(&lk);
 	/* Process vp before dvp as it may create .. removes. */
 	if (vp) {
@@ -4302,11 +4312,15 @@ inodedep_lookup_ip(ip)
 	struct inode *ip;
 {
 	struct inodedep *inodedep;
+	int dflags;
 
 	KASSERT(ip->i_nlink >= ip->i_effnlink,
 	    ("inodedep_lookup_ip: bad delta"));
-	(void) inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number,
-	    DEPALLOC, &inodedep);
+	dflags = DEPALLOC;
+	if (IS_SNAPSHOT(ip))
+		dflags |= NODELAY;
+	(void) inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, dflags,
+	    &inodedep);
 	inodedep->id_nlinkdelta = ip->i_nlink - ip->i_effnlink;
 
 	return (inodedep);
@@ -4694,7 +4708,7 @@ softdep_setup_inomapdep(bp, ip, newinum,
 	 * the cylinder group map from which it was allocated.
 	 */
 	ACQUIRE_LOCK(&lk);
-	if ((inodedep_lookup(mp, newinum, DEPALLOC|NODELAY, &inodedep)))
+	if ((inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep)))
 		panic("softdep_setup_inomapdep: dependency %p for new"
 		    "inode already exists", inodedep);
 	bmsafemap = bmsafemap_lookup(mp, bp, ino_to_cg(fs, newinum));
@@ -5435,6 +5449,7 @@ softdep_setup_allocindir_page(ip, lbn, b
 	struct allocindir *aip;
 	struct pagedep *pagedep;
 	struct mount *mp;
+	int dflags;
 
 	if (lbn != nbp->b_lblkno)
 		panic("softdep_setup_allocindir_page: lbn %jd != lblkno %jd",
@@ -5442,7 +5457,10 @@ softdep_setup_allocindir_page(ip, lbn, b
 	ASSERT_VOP_LOCKED(ITOV(ip), "softdep_setup_allocindir_page");
 	mp = UFSTOVFS(ip->i_ump);
 	aip = newallocindir(ip, ptrno, newblkno, oldblkno, lbn);
-	(void) inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep);
+	dflags = DEPALLOC;
+	if (IS_SNAPSHOT(ip))
+		dflags |= NODELAY;
+	(void) inodedep_lookup(mp, ip->i_number, dflags, &inodedep);
 	/*
 	 * If we are allocating a directory page, then we must
 	 * allocate an associated pagedep to track additions and
@@ -5472,11 +5490,15 @@ softdep_setup_allocindir_meta(nbp, ip, b
 	struct inodedep *inodedep;
 	struct allocindir *aip;
 	ufs_lbn_t lbn;
+	int dflags;
 
 	lbn = nbp->b_lblkno;
 	ASSERT_VOP_LOCKED(ITOV(ip), "softdep_setup_allocindir_meta");
 	aip = newallocindir(ip, ptrno, newblkno, 0, lbn);
-	inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, DEPALLOC, &inodedep);
+	dflags = DEPALLOC;
+	if (IS_SNAPSHOT(ip))
+		dflags |= NODELAY;
+	inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, dflags, &inodedep);
 	WORKLIST_INSERT(&nbp->b_dep, &aip->ai_block.nb_list);
 	if (setup_allocindir_phase2(bp, ip, inodedep, aip, lbn))
 		panic("softdep_setup_allocindir_meta: Block already existed");
@@ -6083,11 +6105,7 @@ softdep_journal_freeblocks(ip, cred, len
 	struct mount *mp;
 	ufs2_daddr_t extblocks, datablocks;
 	ufs_lbn_t tmpval, lbn, lastlbn;
-	int frags;
-	int lastoff, iboff;
-	int allocblock;
-	int error, i;
-	int needj;
+	int frags, lastoff, iboff, allocblock, needj, dflags, error, i;
 
 	fs = ip->i_fs;
 	mp = UFSTOVFS(ip->i_ump);
@@ -6105,7 +6123,10 @@ softdep_journal_freeblocks(ip, cred, len
 	 * we don't need to journal the block frees.  The canceled journals
 	 * for the allocations will suffice.
 	 */
-	inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep);
+	dflags = DEPALLOC;
+	if (IS_SNAPSHOT(ip))
+		dflags |= NODELAY;
+	inodedep_lookup(mp, ip->i_number, dflags, &inodedep);
 	if ((inodedep->id_state & (UNLINKED | DEPCOMPLETE)) == UNLINKED &&
 	    length == 0)
 		needj = 0;
@@ -6230,7 +6251,7 @@ softdep_journal_freeblocks(ip, cred, len
 		*((struct ufs2_dinode *)bp->b_data +
 		    ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2;
 	ACQUIRE_LOCK(&lk);
-	(void) inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep);
+	(void) inodedep_lookup(mp, ip->i_number, dflags, &inodedep);
 	if ((inodedep->id_state & IOSTARTED) != 0)
 		panic("softdep_setup_freeblocks: inode busy");
 	/*
@@ -6308,7 +6329,7 @@ softdep_journal_freeblocks(ip, cred, len
 
 	}
 	ACQUIRE_LOCK(&lk);
-	inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep);
+	inodedep_lookup(mp, ip->i_number, dflags, &inodedep);
 	TAILQ_INSERT_TAIL(&inodedep->id_freeblklst, freeblks, fb_next);
 	freeblks->fb_state |= DEPCOMPLETE | ONDEPLIST;
 	/*
@@ -6396,7 +6417,7 @@ softdep_setup_freeblocks(ip, length, fla
 	struct fs *fs;
 	ufs2_daddr_t extblocks, datablocks;
 	struct mount *mp;
-	int i, delay, error;
+	int i, delay, error, dflags;
 	ufs_lbn_t tmpval;
 	ufs_lbn_t lbn;
 
@@ -6461,7 +6482,10 @@ softdep_setup_freeblocks(ip, length, fla
 	 * Find and eliminate any inode dependencies.
 	 */
 	ACQUIRE_LOCK(&lk);
-	(void) inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep);
+	dflags = DEPALLOC;
+	if (IS_SNAPSHOT(ip))
+		dflags |= NODELAY;
+	(void) inodedep_lookup(mp, ip->i_number, dflags, &inodedep);
 	if ((inodedep->id_state & IOSTARTED) != 0)
 		panic("softdep_setup_freeblocks: inode busy");
 	/*
@@ -8027,7 +8051,7 @@ softdep_setup_directory_add(bp, dp, diro
 	dap->da_pagedep = pagedep;
 	LIST_INSERT_HEAD(&pagedep->pd_diraddhd[DIRADDHASH(offset)], dap,
 	    da_pdlist);
-	inodedep_lookup(mp, newinum, DEPALLOC, &inodedep);
+	inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep);
 	/*
 	 * If we're journaling, link the diradd into the jaddref so it
 	 * may be completed after the journal entry is written.  Otherwise,
@@ -8629,8 +8653,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirre
 	 * the number of freefile and freeblks structures.
 	 */
 	ACQUIRE_LOCK(&lk);
-	if (!(ip->i_flags & SF_SNAPSHOT) &&
-	    dep_current[D_DIRREM] > max_softdeps / 2)
+	if (!IS_SNAPSHOT(ip) && dep_current[D_DIRREM] > max_softdeps / 2)
 		(void) request_cleanup(ITOV(dp)->v_mount, FLUSH_BLOCKS);
 	FREE_LOCK(&lk);
 	dirrem = malloc(sizeof(struct dirrem),
@@ -8864,11 +8887,11 @@ softdep_setup_directory_change(bp, dp, i
 	/*
 	 * Lookup the jaddref for this journal entry.  We must finish
 	 * initializing it and make the diradd write dependent on it.
-	 * If we're not journaling Put it on the id_bufwait list if the inode
-	 * is not yet written. If it is written, do the post-inode write
-	 * processing to put it on the id_pendinghd list.
+	 * If we're not journaling, put it on the id_bufwait list if the
+	 * inode is not yet written. If it is written, do the post-inode
+	 * write processing to put it on the id_pendinghd list.
 	 */
-	inodedep_lookup(mp, newinum, DEPALLOC, &inodedep);
+	inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep);
 	if (MOUNTEDSUJ(mp)) {
 		jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst,
 		    inoreflst);
@@ -8910,9 +8933,13 @@ softdep_change_linkcnt(ip)
 	struct inode *ip;	/* the inode with the increased link count */
 {
 	struct inodedep *inodedep;
+	int dflags;
 
 	ACQUIRE_LOCK(&lk);
-	inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, DEPALLOC, &inodedep);
+	dflags = DEPALLOC;
+	if (IS_SNAPSHOT(ip))
+		dflags |= NODELAY;
+	inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, dflags, &inodedep);
 	if (ip->i_nlink < ip->i_effnlink)
 		panic("softdep_change_linkcnt: bad delta");
 	inodedep->id_nlinkdelta = ip->i_nlink - ip->i_effnlink;
@@ -11813,8 +11840,8 @@ restart:
 					pagedep_new_block = pagedep->pd_state & NEWBLOCK;
 					FREE_LOCK(&lk);
 					locked = 0;
-					if (pagedep_new_block &&
-					    (error = ffs_syncvnode(pvp, MNT_WAIT))) {
+					if (pagedep_new_block && (error =
+					    ffs_syncvnode(pvp, MNT_WAIT, 0))) {
 						vput(pvp);
 						return (error);
 					}
@@ -12542,22 +12569,25 @@ softdep_request_cleanup(fs, vp, cred, re
 	ufs2_daddr_t needed;
 	int error;
 
-	mp = vp->v_mount;
-	ump = VFSTOUFS(mp);
-	mtx_assert(UFS_MTX(ump), MA_OWNED);
-	if (resource == FLUSH_BLOCKS_WAIT)
-		stat_cleanup_blkrequests += 1;
-	else
-		stat_cleanup_inorequests += 1;
-
 	/*
 	 * If we are being called because of a process doing a
 	 * copy-on-write, then it is not safe to process any
 	 * worklist items as we will recurse into the copyonwrite
 	 * routine.  This will result in an incoherent snapshot.
+	 * If the vnode that we hold is a snapshot, we must avoid
+	 * handling other resources that could cause deadlock.
 	 */
-	if (curthread->td_pflags & TDP_COWINPROGRESS)
+	if ((curthread->td_pflags & TDP_COWINPROGRESS) || IS_SNAPSHOT(VTOI(vp)))
 		return (0);
+
+	if (resource == FLUSH_BLOCKS_WAIT)
+		stat_cleanup_blkrequests += 1;
+	else
+		stat_cleanup_inorequests += 1;
+
+	mp = vp->v_mount;
+	ump = VFSTOUFS(mp);
+	mtx_assert(UFS_MTX(ump), MA_OWNED);
 	UFS_UNLOCK(ump);
 	error = ffs_update(vp, 1);
 	if (error != 0) {
@@ -12652,7 +12682,7 @@ retry:
 				MNT_ILOCK(mp);
 				continue;
 			}
-			(void) ffs_syncvnode(lvp, MNT_NOWAIT);
+			(void) ffs_syncvnode(lvp, MNT_NOWAIT, 0);
 			vput(lvp);
 			MNT_ILOCK(mp);
 		}
@@ -12825,7 +12855,7 @@ clear_remove(td)
 				softdep_error("clear_remove: vget", error);
 				goto finish_write;
 			}
-			if ((error = ffs_syncvnode(vp, MNT_NOWAIT)))
+			if ((error = ffs_syncvnode(vp, MNT_NOWAIT, 0)))
 				softdep_error("clear_remove: fsync", error);
 			bo = &vp->v_bufobj;
 			BO_LOCK(bo);
@@ -12908,10 +12938,10 @@ clear_inodedeps(td)
 		}
 		vfs_unbusy(mp);
 		if (ino == lastino) {
-			if ((error = ffs_syncvnode(vp, MNT_WAIT)))
+			if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)))
 				softdep_error("clear_inodedeps: fsync1", error);
 		} else {
-			if ((error = ffs_syncvnode(vp, MNT_NOWAIT)))
+			if ((error = ffs_syncvnode(vp, MNT_NOWAIT, 0)))
 				softdep_error("clear_inodedeps: fsync2", error);
 			BO_LOCK(&vp->v_bufobj);
 			drain_output(vp);

Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -1505,7 +1505,7 @@ loop:
 			}
 			continue;
 		}
-		if ((error = ffs_syncvnode(vp, waitfor)) != 0)
+		if ((error = ffs_syncvnode(vp, waitfor, 0)) != 0)
 			allerror = error;
 		vput(vp);
 		MNT_ILOCK(mp);

Modified: stable/9/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_vnops.c	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ffs/ffs_vnops.c	Wed Mar 28 21:34:55 2012	(r233630)
@@ -184,7 +184,7 @@ ffs_fsync(struct vop_fsync_args *ap)
 	vp = ap->a_vp;
 	bo = &vp->v_bufobj;
 retry:
-	error = ffs_syncvnode(vp, ap->a_waitfor);
+	error = ffs_syncvnode(vp, ap->a_waitfor, 0);
 	if (error)
 		return (error);
 	if (ap->a_waitfor == MNT_WAIT && DOINGSOFTDEP(vp)) {
@@ -209,7 +209,7 @@ retry:
 }
 
 int
-ffs_syncvnode(struct vnode *vp, int waitfor)
+ffs_syncvnode(struct vnode *vp, int waitfor, int flags)
 {
 	struct inode *ip;
 	struct bufobj *bo;
@@ -300,7 +300,10 @@ next:
 	}
 	if (waitfor != MNT_WAIT) {
 		BO_UNLOCK(bo);
-		return (ffs_update(vp, 0));
+		if ((flags & NO_INO_UPDT) != 0)
+			return (0);
+		else
+			return (ffs_update(vp, 0));
 	}
 	/* Drain IO to see if we're done. */
 	bufobj_wwait(bo, 0, 0);
@@ -317,7 +320,7 @@ next:
 	 */
 	if (bo->bo_dirty.bv_cnt > 0) {
 		/* Write the inode after sync passes to flush deps. */
-		if (wait && DOINGSOFTDEP(vp)) {
+		if (wait && DOINGSOFTDEP(vp) && (flags & NO_INO_UPDT) == 0) {
 			BO_UNLOCK(bo);
 			ffs_update(vp, MNT_WAIT);
 			BO_LOCK(bo);
@@ -332,7 +335,9 @@ next:
 #endif
 	}
 	BO_UNLOCK(bo);
-	error = ffs_update(vp, MNT_WAIT);
+	error = 0;
+	if ((flags & NO_INO_UPDT) == 0)
+		error = ffs_update(vp, MNT_WAIT);
 	if (DOINGSUJ(vp))
 		softdep_journal_fsync(VTOI(vp));
 	return (error);

Modified: stable/9/sys/ufs/ufs/inode.h
==============================================================================
--- stable/9/sys/ufs/ufs/inode.h	Wed Mar 28 21:21:19 2012	(r233629)
+++ stable/9/sys/ufs/ufs/inode.h	Wed Mar 28 21:34:55 2012	(r233630)
@@ -158,6 +158,7 @@ struct inode {
 #define	SHORTLINK(ip) \
 	(((ip)->i_ump->um_fstype == UFS1) ? \
 	(caddr_t)(ip)->i_din1->di_db : (caddr_t)(ip)->i_din2->di_db)
+#define IS_SNAPSHOT(ip)		((ip)->i_flags & SF_SNAPSHOT)
 
 /*
  * Structure used to pass around logical block paths generated by

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 01:46:02 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A9E8A1065678;
	Thu, 29 Mar 2012 01:46:02 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A0888FC1B;
	Thu, 29 Mar 2012 01:46:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T1k2rs069252;
	Thu, 29 Mar 2012 01:46:02 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T1k2L2069249;
	Thu, 29 Mar 2012 01:46:02 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203290146.q2T1k2L2069249@svn.freebsd.org>
From: Eitan Adler 
Date: Thu, 29 Mar 2012 01:46:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233632 - in stable/9/secure: usr.bin/ssh usr.sbin/sshd
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 01:46:02 -0000

Author: eadler
Date: Thu Mar 29 01:46:01 2012
New Revision: 233632
URL: http://svn.freebsd.org/changeset/base/233632

Log:
  MFC r233136, r233432:
  	Restore the ability to use a non-standard LOCALBASE to sshd
  	Add the ability to use a non-standard LOCALBASE to ssh
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/secure/usr.bin/ssh/Makefile
  stable/9/secure/usr.sbin/sshd/Makefile
Directory Properties:
  stable/9/secure/usr.bin/ssh/   (props changed)
  stable/9/secure/usr.sbin/sshd/   (props changed)

Modified: stable/9/secure/usr.bin/ssh/Makefile
==============================================================================
--- stable/9/secure/usr.bin/ssh/Makefile	Wed Mar 28 23:51:06 2012	(r233631)
+++ stable/9/secure/usr.bin/ssh/Makefile	Thu Mar 29 01:46:01 2012	(r233632)
@@ -25,22 +25,13 @@ DPADD+=	 ${LIBGSSAPI}
 LDADD+=	 -lgssapi
 .endif
 
-.if defined(X11BASE) || defined(LOCALBASE)
-# Recommended /etc/make.conf setting is X11BASE=${LOCALBASE} for x.org
-# 7.x upgrade on <= 6.2, but LOCALBASE has moved out of scope of src/
-# so we need to provide the default for users with old make.conf
-# settings.
-LOCALBASE?=	/usr/local
-
-# Users may override either LOCALBASE or X11BASE to move the location
-# of xauth
-X11BASE?=	${LOCALBASE}
-CFLAGS+= -DXAUTH_PATH=\"${X11BASE}/bin/xauth\"
-.endif
-
 DPADD+=	${LIBCRYPT} ${LIBCRYPTO}
 LDADD+=	-lcrypt -lcrypto
 
+.if defined(LOCALBASE)
+CFLAGS+= -DXAUTH_PATH=\"${LOCALBASE}/bin/xauth\"
+.endif
+
 .include 
 
 .PATH:	${SSHDIR}

Modified: stable/9/secure/usr.sbin/sshd/Makefile
==============================================================================
--- stable/9/secure/usr.sbin/sshd/Makefile	Wed Mar 28 23:51:06 2012	(r233631)
+++ stable/9/secure/usr.sbin/sshd/Makefile	Thu Mar 29 01:46:01 2012	(r233632)
@@ -39,22 +39,13 @@ DPADD+=	 ${LIBGSSAPI_KRB5} ${LIBGSSAPI} 
 LDADD+=	 -lgssapi_krb5 -lgssapi -lkrb5 -lasn1
 .endif
 
-.if defined(X11BASE)
-# Recommended /etc/make.conf setting is X11BASE=${LOCALBASE} for x.org
-# 7.x upgrade on <= 6.2, but LOCALBASE has moved out of scope of src/
-# so we need to provide the default for users with old make.conf
-# settings.
-LOCALBASE?=	/usr/local
-
-# Users may override either LOCALBASE or X11BASE to move the location
-# of xauth
-X11BASE?=	${LOCALBASE}
-CFLAGS+= -DXAUTH_PATH=\"${X11BASE}/bin/xauth\"
-.endif
-
 DPADD+=	${LIBCRYPTO} ${LIBCRYPT}
 LDADD+=	-lcrypto -lcrypt
 
+.if defined(LOCALBASE)
+CFLAGS+= -DXAUTH_PATH=\"${LOCALBASE}/bin/xauth\"
+.endif
+
 .include 
 
 .PATH:	${SSHDIR}

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 02:45:29 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 723EF106564A;
	Thu, 29 Mar 2012 02:45:29 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B60D8FC0A;
	Thu, 29 Mar 2012 02:45:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T2jT9R071941;
	Thu, 29 Mar 2012 02:45:29 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T2jTxQ071939;
	Thu, 29 Mar 2012 02:45:29 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203290245.q2T2jTxQ071939@svn.freebsd.org>
From: Eitan Adler 
Date: Thu, 29 Mar 2012 02:45:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233640 - stable/9/sbin/gvinum
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 02:45:29 -0000

Author: eadler
Date: Thu Mar 29 02:45:28 2012
New Revision: 233640
URL: http://svn.freebsd.org/changeset/base/233640

Log:
  MFC r227489:
  	- fix duplicate "a a" in some comments
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/sbin/gvinum/gvinum.c
Directory Properties:
  stable/9/sbin/gvinum/   (props changed)

Modified: stable/9/sbin/gvinum/gvinum.c
==============================================================================
--- stable/9/sbin/gvinum/gvinum.c	Thu Mar 29 02:05:11 2012	(r233639)
+++ stable/9/sbin/gvinum/gvinum.c	Thu Mar 29 02:45:28 2012	(r233640)
@@ -557,7 +557,7 @@ find_pattern(char *line, char *pattern)
 	return (NULL);
 }
 
-/* Find a free name for an object given a a prefix. */
+/* Find a free name for an object given a prefix. */
 char *
 find_name(const char *prefix, int type, int namelen)
 {

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 04:54:34 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E657D106566B;
	Thu, 29 Mar 2012 04:54:34 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CEB2E8FC08;
	Thu, 29 Mar 2012 04:54:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T4sYED076567;
	Thu, 29 Mar 2012 04:54:34 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T4sYKR076558;
	Thu, 29 Mar 2012 04:54:34 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201203290454.q2T4sYKR076558@svn.freebsd.org>
From: Alan Cox 
Date: Thu, 29 Mar 2012 04:54:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233647 - in stable/9/sys: amd64/amd64 amd64/include
	i386/conf i386/i386 i386/include kern sys vm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 04:54:35 -0000

Author: alc
Date: Thu Mar 29 04:54:34 2012
New Revision: 233647
URL: http://svn.freebsd.org/changeset/base/233647

Log:
  MFC r233291
    Handle spurious page faults that may occur in no-fault sections of the
    kernel.

Modified:
  stable/9/sys/amd64/amd64/trap.c
  stable/9/sys/amd64/include/proc.h
  stable/9/sys/i386/i386/trap.c
  stable/9/sys/i386/include/proc.h
  stable/9/sys/kern/kern_sysctl.c
  stable/9/sys/kern/subr_uio.c
  stable/9/sys/sys/proc.h
  stable/9/sys/vm/vm_fault.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/amd64/amd64/trap.c
==============================================================================
--- stable/9/sys/amd64/amd64/trap.c	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/amd64/amd64/trap.c	Thu Mar 29 04:54:34 2012	(r233647)
@@ -301,26 +301,6 @@ trap(struct trapframe *frame)
 	}
 
 	code = frame->tf_err;
-	if (type == T_PAGEFLT) {
-		/*
-		 * If we get a page fault while in a critical section, then
-		 * it is most likely a fatal kernel page fault.  The kernel
-		 * is already going to panic trying to get a sleep lock to
-		 * do the VM lookup, so just consider it a fatal trap so the
-		 * kernel can print out a useful trap message and even get
-		 * to the debugger.
-		 *
-		 * If we get a page fault while holding a non-sleepable
-		 * lock, then it is most likely a fatal kernel page fault.
-		 * If WITNESS is enabled, then it's going to whine about
-		 * bogus LORs with various VM locks, so just skip to the
-		 * fatal trap handling directly.
-		 */
-		if (td->td_critnest != 0 ||
-		    WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
-		    "Kernel page fault") != 0)
-			trap_fatal(frame, frame->tf_addr);
-	}
 
         if (ISPL(frame->tf_cs) == SEL_UPL) {
 		/* user trap */
@@ -653,6 +633,50 @@ trap_pfault(frame, usermode)
 	struct proc *p = td->td_proc;
 	vm_offset_t eva = frame->tf_addr;
 
+	if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) {
+		/*
+		 * Due to both processor errata and lazy TLB invalidation when
+		 * access restrictions are removed from virtual pages, memory
+		 * accesses that are allowed by the physical mapping layer may
+		 * nonetheless cause one spurious page fault per virtual page. 
+		 * When the thread is executing a "no faulting" section that
+		 * is bracketed by vm_fault_{disable,enable}_pagefaults(),
+		 * every page fault is treated as a spurious page fault,
+		 * unless it accesses the same virtual address as the most
+		 * recent page fault within the same "no faulting" section.
+		 */
+		if (td->td_md.md_spurflt_addr != eva ||
+		    (td->td_pflags & TDP_RESETSPUR) != 0) {
+			/*
+			 * Do nothing to the TLB.  A stale TLB entry is
+			 * flushed automatically by a page fault.
+			 */
+			td->td_md.md_spurflt_addr = eva;
+			td->td_pflags &= ~TDP_RESETSPUR;
+			return (0);
+		}
+	} else {
+		/*
+		 * If we get a page fault while in a critical section, then
+		 * it is most likely a fatal kernel page fault.  The kernel
+		 * is already going to panic trying to get a sleep lock to
+		 * do the VM lookup, so just consider it a fatal trap so the
+		 * kernel can print out a useful trap message and even get
+		 * to the debugger.
+		 *
+		 * If we get a page fault while holding a non-sleepable
+		 * lock, then it is most likely a fatal kernel page fault.
+		 * If WITNESS is enabled, then it's going to whine about
+		 * bogus LORs with various VM locks, so just skip to the
+		 * fatal trap handling directly.
+		 */
+		if (td->td_critnest != 0 ||
+		    WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
+		    "Kernel page fault") != 0) {
+			trap_fatal(frame, eva);
+			return (-1);
+		}
+	}
 	va = trunc_page(eva);
 	if (va >= VM_MIN_KERNEL_ADDRESS) {
 		/*

Modified: stable/9/sys/amd64/include/proc.h
==============================================================================
--- stable/9/sys/amd64/include/proc.h	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/amd64/include/proc.h	Thu Mar 29 04:54:34 2012	(r233647)
@@ -46,6 +46,7 @@ struct proc_ldt {
 struct mdthread {
 	int	md_spinlock_count;	/* (k) */
 	register_t md_saved_flags;	/* (k) */
+	register_t md_spurflt_addr;	/* (k) Spurious page fault address. */
 };
 
 struct mdproc {

Modified: stable/9/sys/i386/i386/trap.c
==============================================================================
--- stable/9/sys/i386/i386/trap.c	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/i386/i386/trap.c	Thu Mar 29 04:54:34 2012	(r233647)
@@ -329,28 +329,13 @@ trap(struct trapframe *frame)
 		 * For some Cyrix CPUs, %cr2 is clobbered by
 		 * interrupts.  This problem is worked around by using
 		 * an interrupt gate for the pagefault handler.  We
-		 * are finally ready to read %cr2 and then must
-		 * reenable interrupts.
-		 *
-		 * If we get a page fault while in a critical section, then
-		 * it is most likely a fatal kernel page fault.  The kernel
-		 * is already going to panic trying to get a sleep lock to
-		 * do the VM lookup, so just consider it a fatal trap so the
-		 * kernel can print out a useful trap message and even get
-		 * to the debugger.
-		 *
-		 * If we get a page fault while holding a non-sleepable
-		 * lock, then it is most likely a fatal kernel page fault.
-		 * If WITNESS is enabled, then it's going to whine about
-		 * bogus LORs with various VM locks, so just skip to the
-		 * fatal trap handling directly.
+		 * are finally ready to read %cr2 and conditionally
+		 * reenable interrupts.  If we hold a spin lock, then
+		 * we must not reenable interrupts.  This might be a
+		 * spurious page fault.
 		 */
 		eva = rcr2();
-		if (td->td_critnest != 0 ||
-		    WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
-		    "Kernel page fault") != 0)
-			trap_fatal(frame, eva);
-		else
+		if (td->td_md.md_spinlock_count == 0)
 			enable_intr();
 	}
 
@@ -803,6 +788,50 @@ trap_pfault(frame, usermode, eva)
 	struct thread *td = curthread;
 	struct proc *p = td->td_proc;
 
+	if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) {
+		/*
+		 * Due to both processor errata and lazy TLB invalidation when
+		 * access restrictions are removed from virtual pages, memory
+		 * accesses that are allowed by the physical mapping layer may
+		 * nonetheless cause one spurious page fault per virtual page. 
+		 * When the thread is executing a "no faulting" section that
+		 * is bracketed by vm_fault_{disable,enable}_pagefaults(),
+		 * every page fault is treated as a spurious page fault,
+		 * unless it accesses the same virtual address as the most
+		 * recent page fault within the same "no faulting" section.
+		 */
+		if (td->td_md.md_spurflt_addr != eva ||
+		    (td->td_pflags & TDP_RESETSPUR) != 0) {
+			/*
+			 * Do nothing to the TLB.  A stale TLB entry is
+			 * flushed automatically by a page fault.
+			 */
+			td->td_md.md_spurflt_addr = eva;
+			td->td_pflags &= ~TDP_RESETSPUR;
+			return (0);
+		}
+	} else {
+		/*
+		 * If we get a page fault while in a critical section, then
+		 * it is most likely a fatal kernel page fault.  The kernel
+		 * is already going to panic trying to get a sleep lock to
+		 * do the VM lookup, so just consider it a fatal trap so the
+		 * kernel can print out a useful trap message and even get
+		 * to the debugger.
+		 *
+		 * If we get a page fault while holding a non-sleepable
+		 * lock, then it is most likely a fatal kernel page fault.
+		 * If WITNESS is enabled, then it's going to whine about
+		 * bogus LORs with various VM locks, so just skip to the
+		 * fatal trap handling directly.
+		 */
+		if (td->td_critnest != 0 ||
+		    WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
+		    "Kernel page fault") != 0) {
+			trap_fatal(frame, eva);
+			return (-1);
+		}
+	}
 	va = trunc_page(eva);
 	if (va >= KERNBASE) {
 		/*

Modified: stable/9/sys/i386/include/proc.h
==============================================================================
--- stable/9/sys/i386/include/proc.h	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/i386/include/proc.h	Thu Mar 29 04:54:34 2012	(r233647)
@@ -51,6 +51,7 @@ struct proc_ldt {
 struct mdthread {
 	int	md_spinlock_count;	/* (k) */
 	register_t md_saved_flags;	/* (k) */
+	register_t md_spurflt_addr;	/* (k) Spurious page fault address. */
 };
 
 struct mdproc {

Modified: stable/9/sys/kern/kern_sysctl.c
==============================================================================
--- stable/9/sys/kern/kern_sysctl.c	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/kern/kern_sysctl.c	Thu Mar 29 04:54:34 2012	(r233647)
@@ -1294,8 +1294,8 @@ kernel_sysctlbyname(struct thread *td, c
 static int
 sysctl_old_user(struct sysctl_req *req, const void *p, size_t l)
 {
-	int error = 0;
 	size_t i, len, origidx;
+	int error;
 
 	origidx = req->oldidx;
 	req->oldidx += l;
@@ -1316,10 +1316,14 @@ sysctl_old_user(struct sysctl_req *req, 
 	else {
 		if (i > len - origidx)
 			i = len - origidx;
-		error = copyout(p, (char *)req->oldptr + origidx, i);
+		if (req->lock == REQ_WIRED) {
+			error = copyout_nofault(p, (char *)req->oldptr +
+			    origidx, i);
+		} else
+			error = copyout(p, (char *)req->oldptr + origidx, i);
+		if (error != 0)
+			return (error);
 	}
-	if (error)
-		return (error);
 	if (i < l)
 		return (ENOMEM);
 	return (0);

Modified: stable/9/sys/kern/subr_uio.c
==============================================================================
--- stable/9/sys/kern/subr_uio.c	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/kern/subr_uio.c	Thu Mar 29 04:54:34 2012	(r233647)
@@ -187,8 +187,12 @@ uiomove_faultflag(void *cp, int n, struc
 
 	/* XXX does it make a sense to set TDP_DEADLKTREAT for UIO_SYSSPACE ? */
 	newflags = TDP_DEADLKTREAT;
-	if (uio->uio_segflg == UIO_USERSPACE && nofault)
-		newflags |= TDP_NOFAULTING;
+	if (uio->uio_segflg == UIO_USERSPACE && nofault) {
+		/*
+		 * Fail if a non-spurious page fault occurs.
+		 */
+		newflags |= TDP_NOFAULTING | TDP_RESETSPUR;
+	}
 	save = curthread_pflags_set(newflags);
 
 	while (n > 0 && uio->uio_resid) {

Modified: stable/9/sys/sys/proc.h
==============================================================================
--- stable/9/sys/sys/proc.h	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/sys/proc.h	Thu Mar 29 04:54:34 2012	(r233647)
@@ -416,6 +416,7 @@ do {									\
 #define	TDP_IGNSUSP	0x00800000 /* Permission to ignore the MNTK_SUSPEND* */
 #define	TDP_AUDITREC	0x01000000 /* Audit record pending on thread */
 #define	TDP_RFPPWAIT	0x02000000 /* Handle RFPPWAIT on syscall exit */
+#define	TDP_RESETSPUR	0x04000000 /* Reset spurious page fault history. */
 
 /*
  * Reasons that the current thread can not be run yet.

Modified: stable/9/sys/vm/vm_fault.c
==============================================================================
--- stable/9/sys/vm/vm_fault.c	Thu Mar 29 03:13:43 2012	(r233646)
+++ stable/9/sys/vm/vm_fault.c	Thu Mar 29 04:54:34 2012	(r233647)
@@ -1468,11 +1468,17 @@ vm_fault_additional_pages(m, rbehind, ra
 	return i;
 }
 
+/*
+ * Block entry into the machine-independent layer's page fault handler by
+ * the calling thread.  Subsequent calls to vm_fault() by that thread will
+ * return KERN_PROTECTION_FAILURE.  Enable machine-dependent handling of
+ * spurious page faults. 
+ */
 int
 vm_fault_disable_pagefaults(void)
 {
 
-	return (curthread_pflags_set(TDP_NOFAULTING));
+	return (curthread_pflags_set(TDP_NOFAULTING | TDP_RESETSPUR));
 }
 
 void

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 09:16:11 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C26D106567C;
	Thu, 29 Mar 2012 09:16:11 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EAF228FC12;
	Thu, 29 Mar 2012 09:16:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T9GA52084985;
	Thu, 29 Mar 2012 09:16:10 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T9GA4c084983;
	Thu, 29 Mar 2012 09:16:10 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203290916.q2T9GA4c084983@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Mar 2012 09:16:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233653 - stable/9/sys/ufs/ffs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 09:16:11 -0000

Author: kib
Date: Thu Mar 29 09:16:10 2012
New Revision: 233653
URL: http://svn.freebsd.org/changeset/base/233653

Log:
  MFC r232835:
  Do not fall back to slow synchronous i/o when low on memory or buffers.
  The bawrite() schedules the write to happen immediately, and its use
  frees the current thread to do more cleanups.
  
  MFC r232837:
  Remove superfluous brackets.

Modified:
  stable/9/sys/ufs/ffs/ffs_inode.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ffs/ffs_inode.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_inode.c	Thu Mar 29 07:29:27 2012	(r233652)
+++ stable/9/sys/ufs/ffs/ffs_inode.c	Thu Mar 29 09:16:10 2012	(r233653)
@@ -148,9 +148,11 @@ loop:
 	else
 		*((struct ufs2_dinode *)bp->b_data +
 		    ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2;
-	if ((waitfor && !DOINGASYNC(vp)) ||
-	    (vm_page_count_severe() || buf_dirty_count_severe())) {
+	if (waitfor && !DOINGASYNC(vp))
 		error = bwrite(bp);
+	else if (vm_page_count_severe() || buf_dirty_count_severe()) {
+		bawrite(bp);
+		error = 0;
 	} else {
 		if (bp->b_bufsize == fs->fs_bsize)
 			bp->b_flags |= B_CLUSTEROK;

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 09:19:01 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F29F7106564A;
	Thu, 29 Mar 2012 09:19:00 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C390E8FC0A;
	Thu, 29 Mar 2012 09:19:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T9J0CF085120;
	Thu, 29 Mar 2012 09:19:00 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T9J0hZ085117;
	Thu, 29 Mar 2012 09:19:00 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203290919.q2T9J0hZ085117@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Mar 2012 09:19:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233654 - stable/9/sys/ufs/ffs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 09:19:01 -0000

Author: kib
Date: Thu Mar 29 09:19:00 2012
New Revision: 233654
URL: http://svn.freebsd.org/changeset/base/233654

Log:
  MFC r232948:
  Supply boolean as the second argument to ffs_update(), and not a
  MNT_[NO]WAIT constants, which in fact always caused sync operation.

Modified:
  stable/9/sys/ufs/ffs/ffs_softdep.c
  stable/9/sys/ufs/ffs/ffs_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_softdep.c	Thu Mar 29 09:16:10 2012	(r233653)
+++ stable/9/sys/ufs/ffs/ffs_softdep.c	Thu Mar 29 09:19:00 2012	(r233654)
@@ -6310,7 +6310,7 @@ softdep_journal_freeblocks(ip, cred, len
 		DIP_SET(ip, i_size, length);
 		ip->i_flag |= IN_CHANGE | IN_UPDATE;
 		allocbuf(bp, frags);
-		ffs_update(vp, MNT_NOWAIT);
+		ffs_update(vp, 0);
 		bawrite(bp);
 	} else if (lastoff != 0 && vp->v_type != VDIR) {
 		int size;
@@ -12345,7 +12345,7 @@ flush_newblk_dep(vp, mp, lbn)
 		 * point at the newdirblk before the dependency
 		 * will go away.
 		 */
-		error = ffs_update(vp, MNT_WAIT);
+		error = ffs_update(vp, 1);
 		if (error)
 			break;
 		ACQUIRE_LOCK(&lk);
@@ -12381,7 +12381,7 @@ restart:
 		 */
 		if (dap->da_state & MKDIR_PARENT) {
 			FREE_LOCK(&lk);
-			if ((error = ffs_update(pvp, MNT_WAIT)) != 0)
+			if ((error = ffs_update(pvp, 1)) != 0)
 				break;
 			ACQUIRE_LOCK(&lk);
 			/*
@@ -12423,7 +12423,7 @@ restart:
 			 * disk.
 			 */
 			if (error == 0 && dap == LIST_FIRST(diraddhdp))
-				error = ffs_update(vp, MNT_WAIT);
+				error = ffs_update(vp, 1);
 			vput(vp);
 			if (error != 0)
 				break;
@@ -12480,7 +12480,7 @@ retry:
 			if ((error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &vp,
 			    FFSV_FORCEINSMQ)))
 				break;
-			error = ffs_update(vp, MNT_WAIT);
+			error = ffs_update(vp, 1);
 			vput(vp);
 			if (error)
 				break;

Modified: stable/9/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_vnops.c	Thu Mar 29 09:16:10 2012	(r233653)
+++ stable/9/sys/ufs/ffs/ffs_vnops.c	Thu Mar 29 09:19:00 2012	(r233654)
@@ -322,7 +322,7 @@ next:
 		/* Write the inode after sync passes to flush deps. */
 		if (wait && DOINGSOFTDEP(vp) && (flags & NO_INO_UPDT) == 0) {
 			BO_UNLOCK(bo);
-			ffs_update(vp, MNT_WAIT);
+			ffs_update(vp, 1);
 			BO_LOCK(bo);
 		}
 		/* switch between sync/async. */
@@ -337,7 +337,7 @@ next:
 	BO_UNLOCK(bo);
 	error = 0;
 	if ((flags & NO_INO_UPDT) == 0)
-		error = ffs_update(vp, MNT_WAIT);
+		error = ffs_update(vp, 1);
 	if (DOINGSUJ(vp))
 		softdep_journal_fsync(VTOI(vp));
 	return (error);

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 13:01:30 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 11BC6106566B;
	Thu, 29 Mar 2012 13:01:30 +0000 (UTC) (envelope-from rmh@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D6CE38FC12;
	Thu, 29 Mar 2012 13:01:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TD1TY0093882;
	Thu, 29 Mar 2012 13:01:29 GMT (envelope-from rmh@svn.freebsd.org)
Received: (from rmh@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TD1Teh093880;
	Thu, 29 Mar 2012 13:01:29 GMT (envelope-from rmh@svn.freebsd.org)
Message-Id: <201203291301.q2TD1Teh093880@svn.freebsd.org>
From: Robert Millan 
Date: Thu, 29 Mar 2012 13:01:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233659 - in stable/9/sys: i386/conf netinet
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 13:01:30 -0000

Author: rmh
Date: Thu Mar 29 13:01:29 2012
New Revision: 233659
URL: http://svn.freebsd.org/changeset/base/233659

Log:
  MFC r233096:
  
    Hide a few declarations from userland (including `struct inpcbgroup'). This
    removes the dependency on  which was introduced with SVN
    rev 222748 (due to CACHE_LINE_SIZE).
  
    Reviewed by:    bde
    MFC after:      10 days

Modified:
  stable/9/sys/netinet/in_pcb.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/netinet/in_pcb.h
==============================================================================
--- stable/9/sys/netinet/in_pcb.h	Thu Mar 29 12:03:06 2012	(r233658)
+++ stable/9/sys/netinet/in_pcb.h	Thu Mar 29 13:01:29 2012	(r233659)
@@ -364,6 +364,7 @@ struct inpcbinfo {
 	void 			*ipi_pspare[2];
 };
 
+#ifdef _KERNEL
 /*
  * Connection groups hold sets of connections that have similar CPU/thread
  * affinity.  Each connection belongs to exactly one connection group.
@@ -406,7 +407,6 @@ struct inpcbgroup {
 #define	INP_WLOCK_ASSERT(inp)	rw_assert(&(inp)->inp_lock, RA_WLOCKED)
 #define	INP_UNLOCK_ASSERT(inp)	rw_assert(&(inp)->inp_lock, RA_UNLOCKED)
 
-#ifdef _KERNEL
 /*
  * These locking functions are for inpcb consumers outside of sys/netinet,
  * more specifically, they were added for the benefit of TOE drivers. The

From owner-svn-src-stable-9@FreeBSD.ORG  Thu Mar 29 23:57:54 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AE214106564A;
	Thu, 29 Mar 2012 23:57:54 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 97A098FC0A;
	Thu, 29 Mar 2012 23:57:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TNvsfB015808;
	Thu, 29 Mar 2012 23:57:54 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TNvs54015806;
	Thu, 29 Mar 2012 23:57:54 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203292357.q2TNvs54015806@svn.freebsd.org>
From: Eitan Adler 
Date: Thu, 29 Mar 2012 23:57:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233685 - stable/9/usr.sbin/pkg_install/create
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 29 Mar 2012 23:57:54 -0000

Author: eadler
Date: Thu Mar 29 23:57:54 2012
New Revision: 233685
URL: http://svn.freebsd.org/changeset/base/233685

Log:
  MFC r231300, r231328:
  	Permit the use of relative paths for the prefix argument.
  	Remove an unnecessary cwd from created plists when -p is specified
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/usr.sbin/pkg_install/create/perform.c
Directory Properties:
  stable/9/usr.sbin/pkg_install/   (props changed)

Modified: stable/9/usr.sbin/pkg_install/create/perform.c
==============================================================================
--- stable/9/usr.sbin/pkg_install/create/perform.c	Thu Mar 29 23:31:48 2012	(r233684)
+++ stable/9/usr.sbin/pkg_install/create/perform.c	Thu Mar 29 23:57:54 2012	(r233685)
@@ -214,8 +214,12 @@ pkg_perform(char **pkgs)
     read_plist(&plist, pkg_in);
 
     /* Prefix should add an @cwd to the packing list */
-    if (Prefix)
-	add_plist_top(&plist, PLIST_CWD, Prefix);
+    if (Prefix) {
+        char resolved_prefix[PATH_MAX];
+        if (realpath(Prefix, resolved_prefix) == NULL)
+	    err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
+	add_plist_top(&plist, PLIST_CWD, resolved_prefix);
+    }
 
     /* Add the origin if asked, at the top */
     if (Origin)
@@ -260,7 +264,9 @@ pkg_perform(char **pkgs)
     /* mark_plist(&plist); */
 
     /* Now put the release specific items in */
-    add_plist(&plist, PLIST_CWD, ".");
+    if (!Prefix) {
+	add_plist(&plist, PLIST_CWD, ".");
+    }
     write_file(COMMENT_FNAME, Comment);
     add_plist(&plist, PLIST_IGNORE, NULL);
     add_plist(&plist, PLIST_FILE, COMMENT_FNAME);

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 09:34:20 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 70C8C106564A;
	Fri, 30 Mar 2012 09:34:20 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 572E28FC12;
	Fri, 30 Mar 2012 09:34:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U9YKM4034201;
	Fri, 30 Mar 2012 09:34:20 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U9YK0O034187;
	Fri, 30 Mar 2012 09:34:20 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203300934.q2U9YK0O034187@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 30 Mar 2012 09:34:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233694 - in stable/9/libexec/rtld-elf: . amd64 arm
	i386 ia64 mips powerpc powerpc64 sparc64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 09:34:20 -0000

Author: kib
Date: Fri Mar 30 09:34:19 2012
New Revision: 233694
URL: http://svn.freebsd.org/changeset/base/233694

Log:
  MFC r232831:
  Add support for preinit, init and fini arrays to rtld.
  Only binaries marked with proper ABI note gets array ctr/dtrs called.
  
  MFC r232856:
  When iterating over the dso program headers, the object is not initialized
  yet, and object segments are not yet mapped.  Only parse the notes that
  appear in the first page of the dso (as it should be anyway), and use
  the preloaded page content.
  
  MFC r232857 (by dim):
  Fix a warning/error with clang.
  
  MFC r232859 (by dim):
  Amend r232857, now dropping the casts entirely, as they were not
  necessary at all.

Modified:
  stable/9/libexec/rtld-elf/Makefile
  stable/9/libexec/rtld-elf/amd64/rtld_machdep.h
  stable/9/libexec/rtld-elf/arm/rtld_machdep.h
  stable/9/libexec/rtld-elf/i386/rtld_machdep.h
  stable/9/libexec/rtld-elf/ia64/reloc.c
  stable/9/libexec/rtld-elf/ia64/rtld_machdep.h
  stable/9/libexec/rtld-elf/map_object.c
  stable/9/libexec/rtld-elf/mips/rtld_machdep.h
  stable/9/libexec/rtld-elf/powerpc/rtld_machdep.h
  stable/9/libexec/rtld-elf/powerpc64/rtld_machdep.h
  stable/9/libexec/rtld-elf/rtld.c
  stable/9/libexec/rtld-elf/rtld.h
  stable/9/libexec/rtld-elf/sparc64/rtld_machdep.h
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/Makefile
==============================================================================
--- stable/9/libexec/rtld-elf/Makefile	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/Makefile	Fri Mar 30 09:34:19 2012	(r233694)
@@ -10,6 +10,7 @@ SRCS=		rtld_start.S \
 MAN=		rtld.1
 CSTD?=		gnu99
 CFLAGS+=	-Wall -DFREEBSD_ELF -DIN_RTLD
+CFLAGS+=	-I${.CURDIR}/../../lib/csu/common
 .if exists(${.CURDIR}/${MACHINE_ARCH})
 RTLD_ARCH=	${MACHINE_ARCH}
 .else

Modified: stable/9/libexec/rtld-elf/amd64/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/amd64/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/amd64/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -58,6 +58,9 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 #define round(size, align) \
 	(((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \

Modified: stable/9/libexec/rtld-elf/arm/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/arm/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/arm/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -48,6 +48,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 	
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 typedef struct {
 	unsigned long ti_module;
 	unsigned long ti_offset;

Modified: stable/9/libexec/rtld-elf/i386/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/i386/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/i386/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -58,6 +58,9 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 #define round(size, align) \
 	(((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \

Modified: stable/9/libexec/rtld-elf/ia64/reloc.c
==============================================================================
--- stable/9/libexec/rtld-elf/ia64/reloc.c	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/ia64/reloc.c	Fri Mar 30 09:34:19 2012	(r233694)
@@ -586,6 +586,18 @@ call_initfini_pointer(const Obj_Entry *o
 	((InitFunc) &fptr)();
 }
 
+void
+call_init_pointer(const Obj_Entry *obj, Elf_Addr target)
+{
+	struct fptr fptr;
+
+	fptr.gp = (Elf_Addr) obj->pltgot;
+	fptr.target = target;
+	dbg(" initfini: target=%p, gp=%p",
+	    (void *) fptr.target, (void *) fptr.gp);
+	((InitArrFunc) &fptr)(main_argc, main_argv, environ);
+}
+
 /* Initialize the special PLT entries. */
 void
 init_pltgot(Obj_Entry *obj)

Modified: stable/9/libexec/rtld-elf/ia64/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/ia64/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/ia64/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -52,6 +52,7 @@ Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_A
 		       const struct Struct_Obj_Entry *, const Elf_Rel *);
 void *make_function_pointer(const Elf_Sym *, const struct Struct_Obj_Entry *);
 void call_initfini_pointer(const struct Struct_Obj_Entry *, Elf_Addr);
+void call_init_pointer(const struct Struct_Obj_Entry *, Elf_Addr);
 
 #define	TLS_TCB_SIZE	16
 

Modified: stable/9/libexec/rtld-elf/map_object.c
==============================================================================
--- stable/9/libexec/rtld-elf/map_object.c	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/map_object.c	Fri Mar 30 09:34:19 2012	(r233694)
@@ -85,6 +85,8 @@ map_object(int fd, const char *path, con
     Elf_Word stack_flags;
     Elf_Addr relro_page;
     size_t relro_size;
+    Elf_Addr note_start;
+    Elf_Addr note_end;
 
     hdr = get_elf_header(fd, path);
     if (hdr == NULL)
@@ -103,6 +105,8 @@ map_object(int fd, const char *path, con
     phdr_vaddr = 0;
     relro_page = 0;
     relro_size = 0;
+    note_start = 0;
+    note_end = 0;
     segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
     stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
     while (phdr < phlimit) {
@@ -142,6 +146,15 @@ map_object(int fd, const char *path, con
 	    relro_page = phdr->p_vaddr;
 	    relro_size = phdr->p_memsz;
 	    break;
+
+	case PT_NOTE:
+	    if (phdr->p_offset > PAGE_SIZE ||
+	      phdr->p_offset + phdr->p_filesz > PAGE_SIZE)
+		break;
+	    note_start = (Elf_Addr)(char *)hdr + phdr->p_offset;
+	    note_end = note_start + phdr->p_filesz;
+	    digest_notes(obj, note_start, note_end);
+	    break;
 	}
 
 	++phdr;

Modified: stable/9/libexec/rtld-elf/mips/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/mips/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/mips/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -48,6 +48,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 	
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 typedef struct {
 	unsigned long ti_module;
 	unsigned long ti_offset;

Modified: stable/9/libexec/rtld-elf/powerpc/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/powerpc/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/powerpc/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -48,6 +48,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 /*
  * Lazy binding entry point, called via PLT.
  */

Modified: stable/9/libexec/rtld-elf/powerpc64/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/powerpc64/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/powerpc64/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -48,6 +48,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 /*
  * Lazy binding entry point, called via PLT.
  */

Modified: stable/9/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.c	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/rtld.c	Fri Mar 30 09:34:19 2012	(r233694)
@@ -61,6 +61,7 @@
 #include "libmap.h"
 #include "rtld_tls.h"
 #include "rtld_printf.h"
+#include "notes.h"
 
 #ifndef COMPAT_32BIT
 #define PATH_RTLD	"/libexec/ld-elf.so.1"
@@ -139,6 +140,7 @@ static void ref_dag(Obj_Entry *);
 static int origin_subst_one(char **, const char *, const char *,
   const char *, char *);
 static char *origin_subst(const char *, const char *);
+static void preinit_main(void);
 static int  rtld_verify_versions(const Objlist *);
 static int  rtld_verify_object_versions(Obj_Entry *);
 static void object_add_name(Obj_Entry *, const char *);
@@ -205,6 +207,12 @@ char *__progname;
 char **environ;
 
 /*
+ * Used to pass argc, argv to init functions.
+ */
+int main_argc;
+char **main_argv;
+
+/*
  * Globals to control TLS allocation.
  */
 size_t tls_last_offset;		/* Static TLS offset of last module */
@@ -335,6 +343,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
     __progname = obj_rtld.path;
     argv0 = argv[0] != NULL ? argv[0] : "(null)";
     environ = env;
+    main_argc = argc;
+    main_argv = argv;
 
     trust = !issetugid();
 
@@ -458,8 +468,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
     obj_tail = &obj_main->next;
     obj_count++;
     obj_loads++;
-    /* Make sure we don't call the main program's init and fini functions. */
-    obj_main->init = obj_main->fini = (Elf_Addr)NULL;
 
     /* Initialize a fake symbol for resolving undefined weak references. */
     sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE);
@@ -551,7 +559,20 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
       ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
 	die();
 
+    if (!obj_main->crt_no_init) {
+	/*
+	 * Make sure we don't call the main program's init and fini
+	 * functions for binaries linked with old crt1 which calls
+	 * _init itself.
+	 */
+	obj_main->init = obj_main->fini = (Elf_Addr)NULL;
+	obj_main->preinit_array = obj_main->init_array =
+	    obj_main->fini_array = (Elf_Addr)NULL;
+    }
+
     wlock_acquire(rtld_bind_lock, &lockstate);
+    if (obj_main->crt_no_init)
+	preinit_main();
     objlist_call_init(&initlist, &lockstate);
     objlist_clear(&initlist);
     dbg("loading filtees");
@@ -936,10 +957,34 @@ digest_dynamic1(Obj_Entry *obj, int earl
 	    obj->init = (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr);
 	    break;
 
+	case DT_PREINIT_ARRAY:
+	    obj->preinit_array = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr);
+	    break;
+
+	case DT_PREINIT_ARRAYSZ:
+	    obj->preinit_array_num = dynp->d_un.d_val / sizeof(Elf_Addr);
+	    break;
+
+	case DT_INIT_ARRAY:
+	    obj->init_array = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr);
+	    break;
+
+	case DT_INIT_ARRAYSZ:
+	    obj->init_array_num = dynp->d_un.d_val / sizeof(Elf_Addr);
+	    break;
+
 	case DT_FINI:
 	    obj->fini = (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr);
 	    break;
 
+	case DT_FINI_ARRAY:
+	    obj->fini_array = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr);
+	    break;
+
+	case DT_FINI_ARRAYSZ:
+	    obj->fini_array_num = dynp->d_un.d_val / sizeof(Elf_Addr);
+	    break;
+
 	/*
 	 * Don't process DT_DEBUG on MIPS as the dynamic section
 	 * is mapped read-only. DT_MIPS_RLD_MAP is used instead.
@@ -1065,6 +1110,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph
     Obj_Entry *obj;
     const Elf_Phdr *phlimit = phdr + phnum;
     const Elf_Phdr *ph;
+    Elf_Addr note_start, note_end;
     int nsegs = 0;
 
     obj = obj_new();
@@ -1120,6 +1166,12 @@ digest_phdr(const Elf_Phdr *phdr, int ph
 	    obj->relro_page = obj->relocbase + trunc_page(ph->p_vaddr);
 	    obj->relro_size = round_page(ph->p_memsz);
 	    break;
+
+	case PT_NOTE:
+	    note_start = (Elf_Addr)obj->relocbase + ph->p_vaddr;
+	    note_end = note_start + ph->p_filesz;
+	    digest_notes(obj, note_start, note_end);
+	    break;
 	}
     }
     if (nsegs < 1) {
@@ -1131,6 +1183,44 @@ digest_phdr(const Elf_Phdr *phdr, int ph
     return obj;
 }
 
+void
+digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_Addr note_end)
+{
+	const Elf_Note *note;
+	const char *note_name;
+	uintptr_t p;
+
+	for (note = (const Elf_Note *)note_start; (Elf_Addr)note < note_end;
+	    note = (const Elf_Note *)((const char *)(note + 1) +
+	      roundup2(note->n_namesz, sizeof(Elf32_Addr)) +
+	      roundup2(note->n_descsz, sizeof(Elf32_Addr)))) {
+		if (note->n_namesz != sizeof(NOTE_FREEBSD_VENDOR) ||
+		    note->n_descsz != sizeof(int32_t))
+			continue;
+		if (note->n_type != ABI_NOTETYPE &&
+		    note->n_type != CRT_NOINIT_NOTETYPE)
+			continue;
+		note_name = (const char *)(note + 1);
+		if (strncmp(NOTE_FREEBSD_VENDOR, note_name,
+		    sizeof(NOTE_FREEBSD_VENDOR)) != 0)
+			continue;
+		switch (note->n_type) {
+		case ABI_NOTETYPE:
+			/* FreeBSD osrel note */
+			p = (uintptr_t)(note + 1);
+			p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+			obj->osrel = *(const int32_t *)(p);
+			dbg("note osrel %d", obj->osrel);
+			break;
+		case CRT_NOINIT_NOTETYPE:
+			/* FreeBSD 'crt does not call init' note */
+			obj->crt_no_init = true;
+			dbg("note crt_no_init");
+			break;
+		}
+	}
+}
+
 static Obj_Entry *
 dlcheck(void *handle)
 {
@@ -1504,11 +1594,13 @@ initlist_add_objects(Obj_Entry *obj, Obj
 	initlist_add_neededs(obj->needed, list);
 
     /* Add the object to the init list. */
-    if (obj->init != (Elf_Addr)NULL)
+    if (obj->preinit_array != (Elf_Addr)NULL || obj->init != (Elf_Addr)NULL ||
+      obj->init_array != (Elf_Addr)NULL)
 	objlist_push_tail(list, obj);
 
     /* Add the object to the global fini list in the reverse order. */
-    if (obj->fini != (Elf_Addr)NULL && !obj->on_fini_list) {
+    if ((obj->fini != (Elf_Addr)NULL || obj->fini_array != (Elf_Addr)NULL)
+      && !obj->on_fini_list) {
 	objlist_push_head(&list_fini, obj);
 	obj->on_fini_list = true;
     }
@@ -1796,6 +1888,27 @@ obj_from_addr(const void *addr)
     return NULL;
 }
 
+static void
+preinit_main(void)
+{
+    Elf_Addr *preinit_addr;
+    int index;
+
+    preinit_addr = (Elf_Addr *)obj_main->preinit_array;
+    if (preinit_addr == NULL)
+	return;
+
+    for (index = 0; index < obj_main->preinit_array_num; index++) {
+	if (preinit_addr[index] != 0 && preinit_addr[index] != 1) {
+	    dbg("calling preinit function for %s at %p", obj_main->path,
+	      (void *)preinit_addr[index]);
+	    LD_UTRACE(UTRACE_INIT_CALL, obj_main, (void *)preinit_addr[index],
+	      0, 0, obj_main->path);
+	    call_init_pointer(obj_main, preinit_addr[index]);
+	}
+    }
+}
+
 /*
  * Call the finalization functions for each of the objects in "list"
  * belonging to the DAG of "root" and referenced once. If NULL "root"
@@ -1808,6 +1921,8 @@ objlist_call_fini(Objlist *list, Obj_Ent
 {
     Objlist_Entry *elm;
     char *saved_msg;
+    Elf_Addr *fini_addr;
+    int index;
 
     assert(root == NULL || root->refcount == 1);
 
@@ -1821,10 +1936,6 @@ objlist_call_fini(Objlist *list, Obj_Ent
 	    if (root != NULL && (elm->obj->refcount != 1 ||
 	      objlist_find(&root->dagmembers, elm->obj) == NULL))
 		continue;
-	    dbg("calling fini function for %s at %p", elm->obj->path,
-	        (void *)elm->obj->fini);
-	    LD_UTRACE(UTRACE_FINI_CALL, elm->obj, (void *)elm->obj->fini, 0, 0,
-		elm->obj->path);
 	    /* Remove object from fini list to prevent recursive invocation. */
 	    STAILQ_REMOVE(list, elm, Struct_Objlist_Entry, link);
 	    /*
@@ -1835,7 +1946,31 @@ objlist_call_fini(Objlist *list, Obj_Ent
 	     * called.
 	     */
 	    lock_release(rtld_bind_lock, lockstate);
-	    call_initfini_pointer(elm->obj, elm->obj->fini);
+
+	    /*
+	     * It is legal to have both DT_FINI and DT_FINI_ARRAY defined.
+	     * When this happens, DT_FINI_ARRAY is processed first.
+	     */
+	    fini_addr = (Elf_Addr *)elm->obj->fini_array;
+	    if (fini_addr != NULL && elm->obj->fini_array_num > 0) {
+		for (index = elm->obj->fini_array_num - 1; index >= 0;
+		  index--) {
+		    if (fini_addr[index] != 0 && fini_addr[index] != 1) {
+			dbg("calling fini function for %s at %p",
+			    elm->obj->path, (void *)fini_addr[index]);
+			LD_UTRACE(UTRACE_FINI_CALL, elm->obj,
+			    (void *)fini_addr[index], 0, 0, elm->obj->path);
+			call_initfini_pointer(elm->obj, fini_addr[index]);
+		    }
+		}
+	    }
+	    if (elm->obj->fini != (Elf_Addr)NULL) {
+		dbg("calling fini function for %s at %p", elm->obj->path,
+		    (void *)elm->obj->fini);
+		LD_UTRACE(UTRACE_FINI_CALL, elm->obj, (void *)elm->obj->fini,
+		    0, 0, elm->obj->path);
+		call_initfini_pointer(elm->obj, elm->obj->fini);
+	    }
 	    wlock_acquire(rtld_bind_lock, lockstate);
 	    /* No need to free anything if process is going down. */
 	    if (root != NULL)
@@ -1862,6 +1997,8 @@ objlist_call_init(Objlist *list, RtldLoc
     Objlist_Entry *elm;
     Obj_Entry *obj;
     char *saved_msg;
+    Elf_Addr *init_addr;
+    int index;
 
     /*
      * Clean init_scanned flag so that objects can be rechecked and
@@ -1879,10 +2016,6 @@ objlist_call_init(Objlist *list, RtldLoc
     STAILQ_FOREACH(elm, list, link) {
 	if (elm->obj->init_done) /* Initialized early. */
 	    continue;
-	dbg("calling init function for %s at %p", elm->obj->path,
-	    (void *)elm->obj->init);
-	LD_UTRACE(UTRACE_INIT_CALL, elm->obj, (void *)elm->obj->init, 0, 0,
-	    elm->obj->path);
 	/*
 	 * Race: other thread might try to use this object before current
 	 * one completes the initilization. Not much can be done here
@@ -1890,7 +2023,30 @@ objlist_call_init(Objlist *list, RtldLoc
 	 */
 	elm->obj->init_done = true;
 	lock_release(rtld_bind_lock, lockstate);
-	call_initfini_pointer(elm->obj, elm->obj->init);
+
+        /*
+         * It is legal to have both DT_INIT and DT_INIT_ARRAY defined.
+         * When this happens, DT_INIT is processed first.
+         */
+	if (elm->obj->init != (Elf_Addr)NULL) {
+	    dbg("calling init function for %s at %p", elm->obj->path,
+	        (void *)elm->obj->init);
+	    LD_UTRACE(UTRACE_INIT_CALL, elm->obj, (void *)elm->obj->init,
+	        0, 0, elm->obj->path);
+	    call_initfini_pointer(elm->obj, elm->obj->init);
+	}
+	init_addr = (Elf_Addr *)elm->obj->init_array;
+	if (init_addr != NULL) {
+	    for (index = 0; index < elm->obj->init_array_num; index++) {
+		if (init_addr[index] != 0 && init_addr[index] != 1) {
+		    dbg("calling init function for %s at %p", elm->obj->path,
+			(void *)init_addr[index]);
+		    LD_UTRACE(UTRACE_INIT_CALL, elm->obj,
+			(void *)init_addr[index], 0, 0, elm->obj->path);
+		    call_init_pointer(elm->obj, init_addr[index]);
+		}
+	    }
+	}
 	wlock_acquire(rtld_bind_lock, lockstate);
     }
     errmsg_restore(saved_msg);

Modified: stable/9/libexec/rtld-elf/rtld.h
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/rtld.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -71,6 +71,10 @@ extern size_t tls_static_space;
 extern int tls_dtv_generation;
 extern int tls_max_index;
 
+extern int main_argc;
+extern char **main_argv;
+extern char **environ;
+
 struct stat;
 struct Struct_Obj_Entry;
 
@@ -84,6 +88,7 @@ typedef STAILQ_HEAD(Struct_Objlist, Stru
 
 /* Types of init and fini functions */
 typedef void (*InitFunc)(void);
+typedef void (*InitArrFunc)(int, char **, char **);
 
 /* Lists of shared object dependencies */
 typedef struct Struct_Needed_Entry {
@@ -213,6 +218,14 @@ typedef struct Struct_Obj_Entry {
 
     Elf_Addr init;		/* Initialization function to call */
     Elf_Addr fini;		/* Termination function to call */
+    Elf_Addr preinit_array;	/* Pre-initialization array of functions */
+    Elf_Addr init_array;	/* Initialization array of functions */
+    Elf_Addr fini_array;	/* Termination array of functions */
+    int preinit_array_num;	/* Number of entries in preinit_array */
+    int init_array_num; 	/* Number of entries in init_array */
+    int fini_array_num; 	/* Number of entries in fini_array */
+
+    int32_t osrel;		/* OSREL note value */
 
     bool mainprog : 1;		/* True if this is the main program */
     bool rtld : 1;		/* True if this is the dynamic linker */
@@ -235,6 +248,7 @@ typedef struct Struct_Obj_Entry {
     bool filtees_loaded : 1;	/* Filtees loaded */
     bool irelative : 1;		/* Object has R_MACHDEP_IRELATIVE relocs */
     bool gnu_ifunc : 1;		/* Object has references to STT_GNU_IFUNC */
+    bool crt_no_init : 1;	/* Object' crt does not call _init/_fini */
 
     struct link_map linkmap;	/* For GDB and dlinfo() */
     Objlist dldags;		/* Object belongs to these dlopened DAGs (%) */
@@ -319,6 +333,7 @@ const Elf_Sym *find_symdef(unsigned long
   const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *);
 void init_pltgot(Obj_Entry *);
 void lockdflt_init(void);
+void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr);
 void obj_free(Obj_Entry *);
 Obj_Entry *obj_new(void);
 void _rtld_bind_start(void);

Modified: stable/9/libexec/rtld-elf/sparc64/rtld_machdep.h
==============================================================================
--- stable/9/libexec/rtld-elf/sparc64/rtld_machdep.h	Fri Mar 30 09:03:53 2012	(r233693)
+++ stable/9/libexec/rtld-elf/sparc64/rtld_machdep.h	Fri Mar 30 09:34:19 2012	(r233694)
@@ -50,6 +50,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_A
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+	(((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 #define round(size, align) \
 	(((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 09:36:13 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2AC5B106564A;
	Fri, 30 Mar 2012 09:36:13 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF8198FC12;
	Fri, 30 Mar 2012 09:36:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U9aCs2034314;
	Fri, 30 Mar 2012 09:36:12 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U9aCDH034312;
	Fri, 30 Mar 2012 09:36:12 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203300936.q2U9aCDH034312@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 30 Mar 2012 09:36:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233695 - stable/9/libexec/rtld-elf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 09:36:13 -0000

Author: kib
Date: Fri Mar 30 09:36:12 2012
New Revision: 233695
URL: http://svn.freebsd.org/changeset/base/233695

Log:
  MFC r232861:
  Provide rtld-private implementations of __stack_chk_guard,
  __stack_chk_fail() and __chk_fail() symbols, to be used by functions
  linked from libc_pic.a.

Modified:
  stable/9/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.c	Fri Mar 30 09:34:19 2012	(r233694)
+++ stable/9/libexec/rtld-elf/rtld.c	Fri Mar 30 09:36:12 2012	(r233695)
@@ -196,6 +196,8 @@ extern Elf_Dyn _DYNAMIC;
 
 int osreldate, pagesize;
 
+long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+
 static int stack_prot = PROT_READ | PROT_WRITE | RTLD_DEFAULT_STACK_EXEC;
 static int max_stack_flags;
 
@@ -311,6 +313,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
     Obj_Entry **preload_tail;
     Objlist initlist;
     RtldLockState lockstate;
+    int mib[2];
+    size_t len;
 
     /*
      * On entry, the dynamic linker itself has not been relocated yet.
@@ -346,6 +350,26 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
     main_argc = argc;
     main_argv = argv;
 
+    if (aux_info[AT_CANARY]->a_un.a_ptr != NULL) {
+	    i = aux_info[AT_CANARYLEN]->a_un.a_val;
+	    if (i > sizeof(__stack_chk_guard))
+		    i = sizeof(__stack_chk_guard);
+	    memcpy(__stack_chk_guard, aux_info[AT_CANARY]->a_un.a_ptr, i);
+    } else {
+	mib[0] = CTL_KERN;
+	mib[1] = KERN_ARND;
+
+	len = sizeof(__stack_chk_guard);
+	if (sysctl(mib, 2, __stack_chk_guard, &len, NULL, 0) == -1 ||
+	    len != sizeof(__stack_chk_guard)) {
+		/* If sysctl was unsuccessful, use the "terminator canary". */
+		((unsigned char *)(void *)__stack_chk_guard)[0] = 0;
+		((unsigned char *)(void *)__stack_chk_guard)[1] = 0;
+		((unsigned char *)(void *)__stack_chk_guard)[2] = '\n';
+		((unsigned char *)(void *)__stack_chk_guard)[3] = 255;
+	}
+    }
+
     trust = !issetugid();
 
     ld_bind_now = getenv(LD_ "BIND_NOW");
@@ -4316,3 +4340,19 @@ void
 __pthread_cxa_finalize(struct dl_phdr_info *a)
 {
 }
+
+void
+__stack_chk_fail(void)
+{
+
+	_rtld_error("stack overflow detected; terminated");
+	die();
+}
+
+void
+__chk_fail(void)
+{
+
+	_rtld_error("buffer overflow detected; terminated");
+	die();
+}

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 09:37:26 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 09C851065672;
	Fri, 30 Mar 2012 09:37:26 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE7D18FC08;
	Fri, 30 Mar 2012 09:37:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U9bPWs034401;
	Fri, 30 Mar 2012 09:37:25 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U9bPxq034399;
	Fri, 30 Mar 2012 09:37:25 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203300937.q2U9bPxq034399@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 30 Mar 2012 09:37:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233696 - stable/9/libexec/rtld-elf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 09:37:26 -0000

Author: kib
Date: Fri Mar 30 09:37:25 2012
New Revision: 233696
URL: http://svn.freebsd.org/changeset/base/233696

Log:
  MFC r232862:
  Do not use stdio for libmap.conf read.  Directly map the file and
  parse lines from the mappings.

Modified:
  stable/9/libexec/rtld-elf/libmap.c
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/libmap.c
==============================================================================
--- stable/9/libexec/rtld-elf/libmap.c	Fri Mar 30 09:36:12 2012	(r233695)
+++ stable/9/libexec/rtld-elf/libmap.c	Fri Mar 30 09:37:25 2012	(r233696)
@@ -2,11 +2,14 @@
  * $FreeBSD$
  */
 
-#include 
-#include 
-#include 
-#include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "debug.h"
 #include "rtld.h"
@@ -25,7 +28,6 @@ TAILQ_HEAD(lm_list, lm);
 struct lm {
 	char *f;
 	char *t;
-
 	TAILQ_ENTRY(lm)	lm_link;
 };
 
@@ -37,17 +39,15 @@ struct lmp {
 	TAILQ_ENTRY(lmp) lmp_link;
 };
 
-static int	lm_count;
+static int lm_count;
 
-static void		lmc_parse	(FILE *);
-static void		lm_add		(const char *, const char *, const char *);
-static void		lm_free		(struct lm_list *);
-static char *		lml_find	(struct lm_list *, const char *);
-static struct lm_list *	lmp_find	(const char *);
-static struct lm_list *	lmp_init	(char *);
-static const char * quickbasename	(const char *);
-static int	readstrfn	(void * cookie, char *buf, int len);
-static int	closestrfn	(void * cookie);
+static void lmc_parse(char *, size_t);
+static void lm_add(const char *, const char *, const char *);
+static void lm_free(struct lm_list *);
+static char *lml_find(struct lm_list *, const char *);
+static struct lm_list *lmp_find(const char *);
+static struct lm_list *lmp_init(char *);
+static const char *quickbasename(const char *);
 
 #define	iseol(c)	(((c) == '#') || ((c) == '\0') || \
 			 ((c) == '\n') || ((c) == '\r'))
@@ -59,56 +59,88 @@ static int	closestrfn	(void * cookie);
 #define	rtld_isspace(c)	((c) == ' ' || (c) == '\t')
 
 int
-lm_init (char *libmap_override)
+lm_init(char *libmap_override)
 {
-	FILE	*fp;
-
-	dbg("%s(\"%s\")", __func__, libmap_override);
+	struct stat st;
+	char *lm_map, *p;
+	int fd;
 
+	dbg("lm_init(\"%s\")", libmap_override);
 	TAILQ_INIT(&lmp_head);
 
-	fp = fopen(_PATH_LIBMAP_CONF, "r");
-	if (fp) {
-		lmc_parse(fp);
-		fclose(fp);
+	fd = open(_PATH_LIBMAP_CONF, O_RDONLY);
+	if (fd == -1) {
+		dbg("lm_init: open(\"%s\") failed, %s", _PATH_LIBMAP_CONF,
+		    strerror(errno));
+		goto override;
+	}
+	if (fstat(fd, &st) == -1) {
+		close(fd);
+		dbg("lm_init: fstat(\"%s\") failed, %s", _PATH_LIBMAP_CONF,
+		    strerror(errno));
+		goto override;
 	}
+	lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+	if (lm_map == (const char *)MAP_FAILED) {
+		close(fd);
+		dbg("lm_init: mmap(\"%s\") failed, %s", _PATH_LIBMAP_CONF,
+		    strerror(errno));
+		goto override;
+	}
+	close(fd);
+	lmc_parse(lm_map, st.st_size);
+	munmap(lm_map, st.st_size);
 
+override:
 	if (libmap_override) {
-		char	*p;
-		/* do some character replacement to make $LIBMAP look like a
-		   text file, then "open" it with funopen */
+		/*
+		 * Do some character replacement to make $LIBMAP look
+		 * like a text file, then parse it.
+		 */
 		libmap_override = xstrdup(libmap_override);
-
 		for (p = libmap_override; *p; p++) {
 			switch (*p) {
-				case '=':
-					*p = ' '; break;
-				case ',':
-					*p = '\n'; break;
+			case '=':
+				*p = ' ';
+				break;
+			case ',':
+				*p = '\n';
+				break;
 			}
 		}
-		fp = funopen(libmap_override, readstrfn, NULL, NULL, closestrfn);
-		if (fp) {
-			lmc_parse(fp);
-			fclose(fp);
-		}
+		lmc_parse(p, strlen(p));
+		free(p);
 	}
 
 	return (lm_count == 0);
 }
 
 static void
-lmc_parse (FILE *fp)
+lmc_parse(char *lm_p, size_t lm_len)
 {
-	char	*cp;
-	char	*f, *t, *c, *p;
-	char	prog[MAXPATHLEN];
-	char	line[MAXPATHLEN + 2];
-
-	dbg("%s(%p)", __func__, fp);
+	char *cp, *f, *t, *c, *p;
+	char prog[MAXPATHLEN];
+	char line[MAXPATHLEN + 2];
+	size_t cnt;
+	int i;
 	
+	cnt = 0;
 	p = NULL;
-	while ((cp = fgets(line, MAXPATHLEN + 1, fp)) != NULL) {
+	while (cnt < lm_len) {
+		i = 0;
+		while (lm_p[cnt] != '\n' && cnt < lm_len &&
+		    i < sizeof(line) - 1) {
+			line[i] = lm_p[cnt];
+			cnt++;
+			i++;
+		}
+		line[i] = '\0';
+		while (lm_p[cnt] != '\n' && cnt < lm_len)
+			cnt++;
+		/* skip over nl */
+		cnt++;
+
+		cp = &line[0];
 		t = f = c = NULL;
 
 		/* Skip over leading space */
@@ -344,31 +376,3 @@ quickbasename (const char *path)
 	}
 	return (p);
 }
-
-static int
-readstrfn(void * cookie, char *buf, int len)
-{
-	static char	*current;
-	static int	left;
-	int 	copied;
-	
-	copied = 0;
-	if (!current) {
-		current = cookie;
-		left = strlen(cookie);
-	}
-	while (*current && left && len) {
-		*buf++ = *current++;
-		left--;
-		len--;
-		copied++;
-	}
-	return copied;
-}
-
-static int
-closestrfn(void * cookie)
-{
-	free(cookie);
-	return 0;
-}

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 09:38:36 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10002106566B;
	Fri, 30 Mar 2012 09:38:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E3E088FC1E;
	Fri, 30 Mar 2012 09:38:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U9cZ6P034490;
	Fri, 30 Mar 2012 09:38:35 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U9cZiJ034485;
	Fri, 30 Mar 2012 09:38:35 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203300938.q2U9cZiJ034485@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 30 Mar 2012 09:38:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233697 - stable/9/libexec/rtld-elf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 09:38:36 -0000

Author: kib
Date: Fri Mar 30 09:38:35 2012
New Revision: 233697
URL: http://svn.freebsd.org/changeset/base/233697

Log:
  MFC r232974:
  Stop using strerror(3) in rtld, which brings in msgcat and stdio.
  Directly access sys_errlist array of errno messages with private
  rtld_strerror() function.

Modified:
  stable/9/libexec/rtld-elf/libmap.c
  stable/9/libexec/rtld-elf/map_object.c
  stable/9/libexec/rtld-elf/rtld.c
  stable/9/libexec/rtld-elf/rtld.h
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/libmap.c
==============================================================================
--- stable/9/libexec/rtld-elf/libmap.c	Fri Mar 30 09:37:25 2012	(r233696)
+++ stable/9/libexec/rtld-elf/libmap.c	Fri Mar 30 09:38:35 2012	(r233697)
@@ -71,20 +71,20 @@ lm_init(char *libmap_override)
 	fd = open(_PATH_LIBMAP_CONF, O_RDONLY);
 	if (fd == -1) {
 		dbg("lm_init: open(\"%s\") failed, %s", _PATH_LIBMAP_CONF,
-		    strerror(errno));
+		    rtld_strerror(errno));
 		goto override;
 	}
 	if (fstat(fd, &st) == -1) {
 		close(fd);
 		dbg("lm_init: fstat(\"%s\") failed, %s", _PATH_LIBMAP_CONF,
-		    strerror(errno));
+		    rtld_strerror(errno));
 		goto override;
 	}
 	lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
 	if (lm_map == (const char *)MAP_FAILED) {
 		close(fd);
 		dbg("lm_init: mmap(\"%s\") failed, %s", _PATH_LIBMAP_CONF,
-		    strerror(errno));
+		    rtld_strerror(errno));
 		goto override;
 	}
 	close(fd);

Modified: stable/9/libexec/rtld-elf/map_object.c
==============================================================================
--- stable/9/libexec/rtld-elf/map_object.c	Fri Mar 30 09:37:25 2012	(r233696)
+++ stable/9/libexec/rtld-elf/map_object.c	Fri Mar 30 09:38:35 2012	(r233697)
@@ -182,7 +182,7 @@ map_object(int fd, const char *path, con
       MAP_NOCORE, -1, 0);
     if (mapbase == (caddr_t) -1) {
 	_rtld_error("%s: mmap of entire address space failed: %s",
-	  path, strerror(errno));
+	  path, rtld_strerror(errno));
 	return NULL;
     }
     if (base_addr != NULL && mapbase != base_addr) {
@@ -202,7 +202,8 @@ map_object(int fd, const char *path, con
 	data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED;
 	if (mmap(data_addr, data_vlimit - data_vaddr, data_prot,
 	  data_flags, fd, data_offset) == (caddr_t) -1) {
-	    _rtld_error("%s: mmap of data failed: %s", path, strerror(errno));
+	    _rtld_error("%s: mmap of data failed: %s", path,
+		rtld_strerror(errno));
 	    return NULL;
 	}
 
@@ -219,7 +220,7 @@ map_object(int fd, const char *path, con
 		if ((data_prot & PROT_WRITE) == 0 && -1 ==
 		     mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) {
 			_rtld_error("%s: mprotect failed: %s", path,
-			    strerror(errno));
+			    rtld_strerror(errno));
 			return NULL;
 		}
 
@@ -238,7 +239,7 @@ map_object(int fd, const char *path, con
 		if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot,
 		    data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) {
 		    _rtld_error("%s: mmap of bss failed: %s", path,
-			strerror(errno));
+			rtld_strerror(errno));
 		    return NULL;
 		}
 	    }
@@ -305,7 +306,7 @@ get_elf_header (int fd, const char *path
     ssize_t nbytes;
 
     if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) {
-	_rtld_error("%s: read error: %s", path, strerror(errno));
+	_rtld_error("%s: read error: %s", path, rtld_strerror(errno));
 	return NULL;
     }
 

Modified: stable/9/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.c	Fri Mar 30 09:37:25 2012	(r233696)
+++ stable/9/libexec/rtld-elf/rtld.c	Fri Mar 30 09:38:35 2012	(r233697)
@@ -2163,7 +2163,7 @@ relocate_objects(Obj_Entry *first, bool 
 	    if (mprotect(obj->mapbase, obj->textsize,
 	      PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
 		_rtld_error("%s: Cannot write-enable text segment: %s",
-		  obj->path, strerror(errno));
+		  obj->path, rtld_strerror(errno));
 		return -1;
 	    }
 	}
@@ -2176,7 +2176,7 @@ relocate_objects(Obj_Entry *first, bool 
 	    if (mprotect(obj->mapbase, obj->textsize,
 	      PROT_READ|PROT_EXEC) == -1) {
 		_rtld_error("%s: Cannot write-protect text segment: %s",
-		  obj->path, strerror(errno));
+		  obj->path, rtld_strerror(errno));
 		return -1;
 	    }
 	}
@@ -2196,7 +2196,7 @@ relocate_objects(Obj_Entry *first, bool 
 	if (obj->relro_size > 0) {
 	    if (mprotect(obj->relro_page, obj->relro_size, PROT_READ) == -1) {
 		_rtld_error("%s: Cannot enforce relro protection: %s",
-		  obj->path, strerror(errno));
+		  obj->path, rtld_strerror(errno));
 		return -1;
 	    }
 	}
@@ -4356,3 +4356,12 @@ __chk_fail(void)
 	_rtld_error("buffer overflow detected; terminated");
 	die();
 }
+
+const char *
+rtld_strerror(int errnum)
+{
+
+	if (errnum < 0 || errnum >= sys_nerr)
+		return ("Unknown error");
+	return (sys_errlist[errnum]);
+}

Modified: stable/9/libexec/rtld-elf/rtld.h
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.h	Fri Mar 30 09:37:25 2012	(r233696)
+++ stable/9/libexec/rtld-elf/rtld.h	Fri Mar 30 09:38:35 2012	(r233697)
@@ -313,6 +313,7 @@ typedef struct Struct_SymLook {
 } SymLook;
 
 extern void _rtld_error(const char *, ...) __printflike(1, 2);
+extern const char *rtld_strerror(int);
 extern Obj_Entry *map_object(int, const char *, const struct stat *);
 extern void *xcalloc(size_t);
 extern void *xmalloc(size_t);

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 12:31:12 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A70001065670;
	Fri, 30 Mar 2012 12:31:12 +0000 (UTC) (envelope-from slw@zxy.spb.ru)
Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98])
	by mx1.freebsd.org (Postfix) with ESMTP id EDF1C8FC15;
	Fri, 30 Mar 2012 12:31:11 +0000 (UTC)
Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD))
	(envelope-from )
	id 1SDazQ-000G2r-Pj; Fri, 30 Mar 2012 16:31:36 +0400
Date: Fri, 30 Mar 2012 16:31:36 +0400
From: Slawa Olhovchenkov 
To: Alexander Motin 
Message-ID: <20120330123136.GF61230@zxy.spb.ru>
References: <201203281137.q2SBb65O033656@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201203281137.q2SBb65O033656@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-SA-Exim-Connect-IP: 
X-SA-Exim-Mail-From: slw@zxy.spb.ru
X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject: Re: svn commit: r233599 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 12:31:12 -0000

On Wed, Mar 28, 2012 at 11:37:06AM +0000, Alexander Motin wrote:

> Author: mav
> Date: Wed Mar 28 11:37:06 2012
> New Revision: 233599
> URL: http://svn.freebsd.org/changeset/base/233599
> 
> Log:
>   MFC r232207, r232454:
>   Rework CPU load balancing in SCHED_ULE:
>    - In sched_pickcpu() be more careful taking previous CPU on SMT systems.
>   Do it only if all other logical CPUs of that physical one are idle to avoid
>   extra resource sharing.
>    - In sched_pickcpu() change general logic of CPU selection. First
>   look for idle CPU, sharing last level cache with previously used one,
>   skipping SMT CPU groups. If none found, search all CPUs for the least loaded
>   one, where the thread with its priority can run now. If none found, search
>   just for the least loaded CPU.
>    - Make cpu_search() compare lowest/highest CPU load when comparing CPU
>   groups with equal load. That allows to differentiate 1+1 and 2+0 loads.
>    - Make cpu_search() to prefer specified (previous) CPU or group if load
>   is equal. This improves cache affinity for more complicated topologies.
>    - Randomize CPU selection if above factors are equal. Previous code tend
>   to prefer CPUs with lower IDs, causing unneeded collisions.
>    - Rework periodic balancer in sched_balance_group(). With cpu_search()
>   more intelligent now, make balansing process flat, removing recursion
>   over the topology tree. That fixes double swap problem and makes load
>   distribution more even and predictable.
>   
>   All together this gives 10-15% performance improvement in many tests on
>   CPUs with SMT, such as Core i7, for number of threads is less then number
>   of logical CPUs. In some tests it also gives positive effect to systems
>   without SMT.
>   
>   Sponsored by:	iXsystems, Inc.

Nice! Now X3430 completely silent in idle system.

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 17:38:29 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10CAD1065670;
	Fri, 30 Mar 2012 17:38:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D66128FC17;
	Fri, 30 Mar 2012 17:38:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UHcSG1051407;
	Fri, 30 Mar 2012 17:38:28 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UHcSiX051404;
	Fri, 30 Mar 2012 17:38:28 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203301738.q2UHcSiX051404@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 30 Mar 2012 17:38:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233705 - in stable/9/sys: dev/twa i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 17:38:30 -0000

Author: jhb
Date: Fri Mar 30 17:38:28 2012
New Revision: 233705
URL: http://svn.freebsd.org/changeset/base/233705

Log:
  MFC 232669:
  Use bus_get_dma_tag() to inherit the 4G boundary restriction from the
  parent PCI bus and remove the home-grown version in this driver.

Modified:
  stable/9/sys/dev/twa/tw_osl.h
  stable/9/sys/dev/twa/tw_osl_freebsd.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/twa/tw_osl.h
==============================================================================
--- stable/9/sys/dev/twa/tw_osl.h	Fri Mar 30 17:03:06 2012	(r233704)
+++ stable/9/sys/dev/twa/tw_osl.h	Fri Mar 30 17:38:28 2012	(r233705)
@@ -55,12 +55,6 @@
 #define TW_OSLI_MAX_NUM_IOS		(TW_OSLI_MAX_NUM_REQUESTS - 2)
 #define TW_OSLI_MAX_NUM_AENS		0x100
 
-#ifdef PAE
-#define	TW_OSLI_DMA_BOUNDARY		(1u << 31)
-#else
-#define	TW_OSLI_DMA_BOUNDARY		((bus_size_t)((uint64_t)1 << 32))
-#endif
-
 /* Possible values of req->state. */
 #define TW_OSLI_REQ_STATE_INIT		0x0	/* being initialized */
 #define TW_OSLI_REQ_STATE_BUSY		0x1	/* submitted to CL */

Modified: stable/9/sys/dev/twa/tw_osl_freebsd.c
==============================================================================
--- stable/9/sys/dev/twa/tw_osl_freebsd.c	Fri Mar 30 17:03:06 2012	(r233704)
+++ stable/9/sys/dev/twa/tw_osl_freebsd.c	Fri Mar 30 17:38:28 2012	(r233705)
@@ -562,9 +562,9 @@ tw_osli_alloc_mem(struct twa_softc *sc)
 	}
 
 	/* Create the parent dma tag. */
-	if (bus_dma_tag_create(NULL,			/* parent */
+	if (bus_dma_tag_create(bus_get_dma_tag(sc->bus_dev), /* parent */
 				sc->alignment,		/* alignment */
-				TW_OSLI_DMA_BOUNDARY,	/* boundary */
+				0,			/* boundary */
 				BUS_SPACE_MAXADDR,	/* lowaddr */
 				BUS_SPACE_MAXADDR, 	/* highaddr */
 				NULL, NULL, 		/* filter, filterarg */

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 23:24:45 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B42E81065673;
	Fri, 30 Mar 2012 23:24:45 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 85D9F8FC1B;
	Fri, 30 Mar 2012 23:24:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UNOjs3062523;
	Fri, 30 Mar 2012 23:24:45 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UNOjOj062521;
	Fri, 30 Mar 2012 23:24:45 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203302324.q2UNOjOj062521@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 30 Mar 2012 23:24:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233712 - in stable/9/sys: conf i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 23:24:45 -0000

Author: marius
Date: Fri Mar 30 23:24:44 2012
New Revision: 233712
URL: http://svn.freebsd.org/changeset/base/233712

Log:
  MFC: r233273
  
  Exclude devices which are mutually exclusive with ATA_CAM. For better
  or worse, the former are still built as modules as part of the LINT
  builds.
  
  Reviewed by:	mav

Modified:
  stable/9/sys/conf/NOTES
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/conf/NOTES
==============================================================================
--- stable/9/sys/conf/NOTES	Fri Mar 30 23:05:48 2012	(r233711)
+++ stable/9/sys/conf/NOTES	Fri Mar 30 23:24:44 2012	(r233712)
@@ -1701,12 +1701,12 @@ device		siis
 # For example to build a system which only supports a VIA chipset,
 # omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers.
 device		ata
-device		atadisk		# ATA disk drives
-device		ataraid		# ATA RAID drives
-device		atapicd		# ATAPI CDROM drives
-device		atapifd		# ATAPI floppy drives
-device		atapist		# ATAPI tape drives
-device		atapicam	# emulate ATAPI devices as SCSI ditto via CAM
+#device		atadisk		# ATA disk drives
+#device		ataraid		# ATA RAID drives
+#device		atapicd		# ATAPI CDROM drives
+#device		atapifd		# ATAPI floppy drives
+#device		atapist		# ATAPI tape drives
+#device		atapicam	# emulate ATAPI devices as SCSI ditto via CAM
 				# needs CAM to be present (scbus & pass)
 
 # Modular ATA

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 23:50:16 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D5E92106564A;
	Fri, 30 Mar 2012 23:50:16 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BE63B8FC14;
	Fri, 30 Mar 2012 23:50:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UNoGe1063616;
	Fri, 30 Mar 2012 23:50:16 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UNoGgW063609;
	Fri, 30 Mar 2012 23:50:16 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203302350.q2UNoGgW063609@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 30 Mar 2012 23:50:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233715 - in stable/9/sys: dev/ata dev/ata/chipsets
	i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 23:50:16 -0000

Author: marius
Date: Fri Mar 30 23:50:16 2012
New Revision: 233715
URL: http://svn.freebsd.org/changeset/base/233715

Log:
  MFC: r233274
  
  Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap it
  along with functions, SYSCTLs and tunables that are not used with
  ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM
  code for the other way around. This makes it easier to understand
  which parts of ata(4) actually are used in the new world order and
  to later on remove the !ATA_CAM bits. It also makes it obvious that
  there is something fishy with the C-bus front-end as well as in the
  ATP850 support, as these used ATA_LOCKING which is defunct in the
  ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to
  be brought back in some form or other.
  
  Reviewed by:	mav

Modified:
  stable/9/sys/dev/ata/ata-all.c
  stable/9/sys/dev/ata/ata-cbus.c
  stable/9/sys/dev/ata/ata-pci.c
  stable/9/sys/dev/ata/ata-pci.h
  stable/9/sys/dev/ata/ata-queue.c
  stable/9/sys/dev/ata/chipsets/ata-acard.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/ata/ata-all.c
==============================================================================
--- stable/9/sys/dev/ata/ata-all.c	Fri Mar 30 23:48:15 2012	(r233714)
+++ stable/9/sys/dev/ata/ata-all.c	Fri Mar 30 23:50:16 2012	(r233715)
@@ -79,9 +79,11 @@ static void ataaction(struct cam_sim *si
 static void atapoll(struct cam_sim *sim);
 #endif
 static void ata_conn_event(void *, int);
+#ifndef ATA_CAM
 static void bswap(int8_t *, int);
 static void btrim(int8_t *, int);
 static void bpack(int8_t *, int8_t *, int);
+#endif
 static void ata_interrupt_locked(void *data);
 #ifdef ATA_CAM
 static void ata_periodic_poll(void *data);
@@ -90,27 +92,36 @@ static void ata_periodic_poll(void *data
 /* global vars */
 MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer");
 int (*ata_raid_ioctl_func)(u_long cmd, caddr_t data) = NULL;
+#ifndef ATA_CAM
 struct intr_config_hook *ata_delayed_attach = NULL;
+#endif
 devclass_t ata_devclass;
 uma_zone_t ata_request_zone;
 uma_zone_t ata_composite_zone;
+#ifndef ATA_CAM
 int ata_wc = 1;
 int ata_setmax = 0;
+#endif
 int ata_dma_check_80pin = 1;
 
 /* local vars */
+#ifndef ATA_CAM
 static int ata_dma = 1;
 static int atapi_dma = 1;
+#endif
 
 /* sysctl vars */
 SYSCTL_NODE(_hw, OID_AUTO, ata, CTLFLAG_RD, 0, "ATA driver parameters");
+#ifndef ATA_CAM
 TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
 SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma, CTLFLAG_RDTUN, &ata_dma, 0,
 	   "ATA disk DMA mode control");
+#endif
 TUNABLE_INT("hw.ata.ata_dma_check_80pin", &ata_dma_check_80pin);
 SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma_check_80pin,
 	   CTLFLAG_RW, &ata_dma_check_80pin, 1,
 	   "Check for 80pin cable before setting ATA DMA mode");
+#ifndef ATA_CAM
 TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
 SYSCTL_INT(_hw_ata, OID_AUTO, atapi_dma, CTLFLAG_RDTUN, &atapi_dma, 0,
 	   "ATAPI device DMA mode control");
@@ -120,6 +131,7 @@ SYSCTL_INT(_hw_ata, OID_AUTO, wc, CTLFLA
 TUNABLE_INT("hw.ata.setmax", &ata_setmax);
 SYSCTL_INT(_hw_ata, OID_AUTO, setmax, CTLFLAG_RDTUN, &ata_setmax, 0,
 	   "ATA disk set max native address");
+#endif
 #ifdef ATA_CAM
 FEATURE(ata_cam, "ATA devices are accessed through the cam(4) driver");
 #endif
@@ -186,13 +198,13 @@ ata_attach(device_t dev)
 	callout_init(&ch->poll_callout, 1);
 #endif
 
+#ifndef ATA_CAM
     /* reset the controller HW, the channel and device(s) */
     while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit)
 	pause("ataatch", 1);
-#ifndef ATA_CAM
     ATA_RESET(dev);
-#endif
     ATA_LOCKING(dev, ATA_LF_UNLOCK);
+#endif
 
     /* allocate DMA resources if DMA HW present*/
     if (ch->dma.alloc)
@@ -606,6 +618,7 @@ ata_print_cable(device_t dev, u_int8_t *
                   "DMA limited to UDMA33, %s found non-ATA66 cable\n", who);
 }
 
+#ifndef ATA_CAM
 int
 ata_check_80pin(device_t dev, int mode)
 {
@@ -623,7 +636,9 @@ ata_check_80pin(device_t dev, int mode)
     }
     return mode;
 }
+#endif
 
+#ifndef ATA_CAM
 void
 ata_setmode(device_t dev)
 {
@@ -644,6 +659,7 @@ ata_setmode(device_t dev)
 		    (error) ? "FAILURE " : "", ata_mode2str(mode));
 	atadev->mode = mode;
 }
+#endif
 
 /*
  * device related interfaces
@@ -732,6 +748,7 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
 }
 #endif
 
+#ifndef ATA_CAM
 int
 ata_device_ioctl(device_t dev, u_long cmd, caddr_t data)
 {
@@ -830,6 +847,7 @@ ata_device_ioctl(device_t dev, u_long cm
 	return ENOTTY;
     }
 }
+#endif
 
 #ifndef ATA_CAM
 static void
@@ -878,6 +896,7 @@ ata_add_child(device_t parent, struct at
 }
 #endif
 
+#ifndef ATA_CAM
 int
 ata_getparam(struct ata_device *atadev, int init)
 {
@@ -983,6 +1002,7 @@ ata_getparam(struct ata_device *atadev, 
     }
     return error;
 }
+#endif
 
 #ifndef ATA_CAM
 int
@@ -1188,6 +1208,7 @@ ata_udelay(int interval)
 	pause("ataslp", interval/(1000000/hz));
 }
 
+#ifndef ATA_CAM
 char *
 ata_unit2str(struct ata_device *atadev)
 {
@@ -1200,6 +1221,7 @@ ata_unit2str(struct ata_device *atadev)
 	sprintf(str, "%s", atadev->unit == ATA_MASTER ? "master" : "slave");
     return str;
 }
+#endif
 
 const char *
 ata_mode2str(int mode)
@@ -1260,6 +1282,7 @@ ata_str2mode(const char *str)
 	return (-1);
 }
 
+#ifndef ATA_CAM
 const char *
 ata_satarev2str(int rev)
 {
@@ -1272,6 +1295,7 @@ ata_satarev2str(int rev)
 	default: return "???";
 	}
 }
+#endif
 
 int
 ata_atapi(device_t dev, int target)
@@ -1281,6 +1305,7 @@ ata_atapi(device_t dev, int target)
     return (ch->devices & (ATA_ATAPI_MASTER << target));
 }
 
+#ifndef ATA_CAM
 int
 ata_pmode(struct ata_params *ap)
 {
@@ -1304,7 +1329,9 @@ ata_pmode(struct ata_params *ap)
 	return ATA_PIO0;
     return ATA_PIO0;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_wmode(struct ata_params *ap)
 {
@@ -1316,7 +1343,9 @@ ata_wmode(struct ata_params *ap)
 	return ATA_WDMA0;
     return -1;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_umode(struct ata_params *ap)
 {
@@ -1338,7 +1367,9 @@ ata_umode(struct ata_params *ap)
     }
     return -1;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_limit_mode(device_t dev, int mode, int maxmode)
 {
@@ -1358,7 +1389,9 @@ ata_limit_mode(device_t dev, int mode, i
 
     return mode;
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 bswap(int8_t *buf, int len)
 {
@@ -1367,7 +1400,9 @@ bswap(int8_t *buf, int len)
     while (--ptr >= (u_int16_t*)buf)
 	*ptr = ntohs(*ptr);
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 btrim(int8_t *buf, int len)
 {
@@ -1379,7 +1414,9 @@ btrim(int8_t *buf, int len)
     for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr)
 	*ptr = 0;
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 bpack(int8_t *src, int8_t *dst, int len)
 {
@@ -1402,6 +1439,7 @@ bpack(int8_t *src, int8_t *dst, int len)
     if (j < len)
 	dst[j] = 0x00;
 }
+#endif
 
 #ifdef ATA_CAM
 void

Modified: stable/9/sys/dev/ata/ata-cbus.c
==============================================================================
--- stable/9/sys/dev/ata/ata-cbus.c	Fri Mar 30 23:48:15 2012	(r233714)
+++ stable/9/sys/dev/ata/ata-cbus.c	Fri Mar 30 23:50:16 2012	(r233715)
@@ -339,11 +339,14 @@ static int
 ata_cbuschannel_banking(device_t dev, int flags)
 {
     struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev));
+#ifndef ATA_CAM
     struct ata_channel *ch = device_get_softc(dev);
+#endif
     int res;
 
     mtx_lock(&ctlr->bank_mtx);
     switch (flags) {
+#ifndef ATA_CAM
     case ATA_LF_LOCK:
 	if (ctlr->locked_bank == -1)
 	    ctlr->locked_bank = ch->unit;
@@ -368,6 +371,7 @@ ata_cbuschannel_banking(device_t dev, in
 	    }
 	}
 	break;
+#endif
 
     case ATA_LF_WHICH:
 	break;
@@ -385,8 +389,10 @@ static device_method_t ata_cbuschannel_m
     DEVMETHOD(device_suspend,   ata_cbuschannel_suspend),
     DEVMETHOD(device_resume,    ata_cbuschannel_resume),
 
+#ifndef ATA_CAM
     /* ATA methods */
     DEVMETHOD(ata_locking,      ata_cbuschannel_banking),
+#endif
     { 0, 0 }
 };
 

Modified: stable/9/sys/dev/ata/ata-pci.c
==============================================================================
--- stable/9/sys/dev/ata/ata-pci.c	Fri Mar 30 23:48:15 2012	(r233714)
+++ stable/9/sys/dev/ata/ata-pci.c	Fri Mar 30 23:50:16 2012	(r233715)
@@ -699,6 +699,7 @@ ata_pcichannel_resume(device_t dev)
 }
 
 
+#ifndef ATA_CAM
 static int
 ata_pcichannel_locking(device_t dev, int mode)
 {
@@ -710,6 +711,7 @@ ata_pcichannel_locking(device_t dev, int
     else
 	return ch->unit;
 }
+#endif
 
 static void
 ata_pcichannel_reset(device_t dev)
@@ -766,7 +768,9 @@ static device_method_t ata_pcichannel_me
     /* ATA methods */
     DEVMETHOD(ata_setmode,      ata_pcichannel_setmode),
     DEVMETHOD(ata_getrev,       ata_pcichannel_getrev),
+#ifndef ATA_CAM
     DEVMETHOD(ata_locking,      ata_pcichannel_locking),
+#endif
     DEVMETHOD(ata_reset,        ata_pcichannel_reset),
 
     { 0, 0 }

Modified: stable/9/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/9/sys/dev/ata/ata-pci.h	Fri Mar 30 23:48:15 2012	(r233714)
+++ stable/9/sys/dev/ata/ata-pci.h	Fri Mar 30 23:50:16 2012	(r233715)
@@ -62,7 +62,9 @@ struct ata_pci_controller {
     int                 (*ch_detach)(device_t);
     int                 (*ch_suspend)(device_t);
     int                 (*ch_resume)(device_t);
+#ifndef ATA_CAM
     int                 (*locking)(device_t, int);
+#endif
     void                (*reset)(device_t);
     int                 (*setmode)(device_t, int, int);
     int                 (*getrev)(device_t, int);

Modified: stable/9/sys/dev/ata/ata-queue.c
==============================================================================
--- stable/9/sys/dev/ata/ata-queue.c	Fri Mar 30 23:48:15 2012	(r233714)
+++ stable/9/sys/dev/ata/ata-queue.c	Fri Mar 30 23:50:16 2012	(r233715)
@@ -43,11 +43,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifndef ATA_CAM
 /* prototypes */
 static void ata_completed(void *, int);
 static void ata_sort_queue(struct ata_channel *ch, struct ata_request *request);
-static char *ata_skey2str(u_int8_t);
+static const char *ata_skey2str(u_int8_t);
+#endif
 
+#ifndef ATA_CAM
 void
 ata_queue_request(struct ata_request *request)
 {
@@ -123,7 +126,9 @@ ata_queue_request(struct ata_request *re
 	sema_destroy(&request->done);
     }
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature,
 	       u_int64_t lba, u_int16_t count)
@@ -153,7 +158,9 @@ ata_controlcmd(device_t dev, u_int8_t co
     }
     return error;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_atapicmd(device_t dev, u_int8_t *ccb, caddr_t data,
 	     int count, int flags, int timeout)
@@ -176,7 +183,9 @@ ata_atapicmd(device_t dev, u_int8_t *ccb
     }
     return error;
 }
+#endif
 
+#ifndef ATA_CAM
 void
 ata_start(device_t dev)
 {
@@ -235,7 +244,9 @@ ata_start(device_t dev)
 	}
     }
 }
+#endif
 
+#ifndef ATA_CAM
 void
 ata_finish(struct ata_request *request)
 {
@@ -263,7 +274,9 @@ ata_finish(struct ata_request *request)
 	}
     }
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 ata_completed(void *context, int dummy)
 {
@@ -495,6 +508,7 @@ ata_completed(void *context, int dummy)
     if (ch)
 	ata_start(ch->dev);
 }
+#endif
 
 void
 ata_timeout(struct ata_request *request)
@@ -520,8 +534,8 @@ ata_timeout(struct ata_request *request)
 	ata_cam_end_transaction(ch->dev, request);
 #endif
 	mtx_unlock(&ch->state_mtx);
-	ATA_LOCKING(ch->dev, ATA_LF_UNLOCK);
 #ifndef ATA_CAM
+	ATA_LOCKING(ch->dev, ATA_LF_UNLOCK);
 	ata_finish(request);
 #endif
     }
@@ -530,6 +544,7 @@ ata_timeout(struct ata_request *request)
     }
 }
 
+#ifndef ATA_CAM
 void
 ata_fail_requests(device_t dev)
 {
@@ -568,7 +583,9 @@ ata_fail_requests(device_t dev)
         ata_finish(request);
     }
 }
+#endif
 
+#ifndef ATA_CAM
 /*
  * Rudely drop all requests queued to the channel of specified device.
  * XXX: The requests are leaked, use only in fatal case.
@@ -586,7 +603,9 @@ ata_drop_requests(device_t dev)
     }
     mtx_unlock(&ch->queue_mtx);
 }
+#endif
 
+#ifndef ATA_CAM
 static u_int64_t
 ata_get_lba(struct ata_request *request)
 {
@@ -608,7 +627,9 @@ ata_get_lba(struct ata_request *request)
     else
 	return request->u.ata.lba;
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 ata_sort_queue(struct ata_channel *ch, struct ata_request *request)
 {
@@ -661,6 +682,7 @@ ata_sort_queue(struct ata_channel *ch, s
 	ch->freezepoint = request;
     TAILQ_INSERT_AFTER(&ch->ata_queue, this, request, chain);
 }
+#endif
 
 char *
 ata_cmd2str(struct ata_request *request)
@@ -776,7 +798,8 @@ ata_cmd2str(struct ata_request *request)
     return buffer;
 }
 
-static char *
+#ifndef ATA_CAM
+static const char *
 ata_skey2str(u_int8_t skey)
 {
     switch (skey) {
@@ -799,3 +822,4 @@ ata_skey2str(u_int8_t skey)
     default: return("UNKNOWN");
     }
 }
+#endif

Modified: stable/9/sys/dev/ata/chipsets/ata-acard.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-acard.c	Fri Mar 30 23:48:15 2012	(r233714)
+++ stable/9/sys/dev/ata/chipsets/ata-acard.c	Fri Mar 30 23:50:16 2012	(r233715)
@@ -51,26 +51,29 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifndef ATA_CAM
 struct ata_serialize {
     struct mtx  locked_mtx;
     int         locked_ch;
     int         restart_ch;
 };
+#endif
 
 /* local prototypes */
 static int ata_acard_chipinit(device_t dev);
-static int ata_acard_chipdeinit(device_t dev);
 static int ata_acard_ch_attach(device_t dev);
 static int ata_acard_status(device_t dev);
 static int ata_acard_850_setmode(device_t dev, int target, int mode);
 static int ata_acard_86X_setmode(device_t dev, int target, int mode);
+#ifndef ATA_CAM
+static int ata_acard_chipdeinit(device_t dev);
 static int ata_serialize(device_t dev, int flags);
 static void ata_serialize_init(struct ata_serialize *serial);
+#endif
 
 /* misc defines */
 #define ATP_OLD		1
 
-
 /*
  * Acard chipset support functions
  */
@@ -94,7 +97,9 @@ ata_acard_probe(device_t dev)
 
     ata_set_desc(dev);
     ctlr->chipinit = ata_acard_chipinit;
+#ifndef ATA_CAM
     ctlr->chipdeinit = ata_acard_chipdeinit;
+#endif
     return (BUS_PROBE_DEFAULT);
 }
 
@@ -102,7 +107,9 @@ static int
 ata_acard_chipinit(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
+#ifndef ATA_CAM
     struct ata_serialize *serial;
+#endif
 
     if (ata_setup_interrupt(dev, ata_generic_intr))
 	return ENXIO;
@@ -111,17 +118,20 @@ ata_acard_chipinit(device_t dev)
     ctlr->ch_detach = ata_pci_ch_detach;
     if (ctlr->chip->cfg1 == ATP_OLD) {
 	ctlr->setmode = ata_acard_850_setmode;
+#ifndef ATA_CAM
 	ctlr->locking = ata_serialize;
 	serial = malloc(sizeof(struct ata_serialize),
 			      M_ATAPCI, M_WAITOK | M_ZERO);
 	ata_serialize_init(serial);
 	ctlr->chipset_data = serial;
+#endif
     }
     else
 	ctlr->setmode = ata_acard_86X_setmode;
     return 0;
 }
 
+#ifndef ATA_CAM
 static int
 ata_acard_chipdeinit(device_t dev)
 {
@@ -136,6 +146,7 @@ ata_acard_chipdeinit(device_t dev)
 	}
 	return (0);
 }
+#endif
 
 static int
 ata_acard_ch_attach(device_t dev)
@@ -228,6 +239,7 @@ ata_acard_86X_setmode(device_t dev, int 
 	return (mode);
 }
 
+#ifndef ATA_CAM
 static void
 ata_serialize_init(struct ata_serialize *serial)
 {
@@ -277,5 +289,6 @@ ata_serialize(device_t dev, int flags)
     mtx_unlock(&serial->locked_mtx);
     return res;
 }
+#endif
 
 ATA_DECLARE_DRIVER(ata_acard);

From owner-svn-src-stable-9@FreeBSD.ORG  Fri Mar 30 23:56:17 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D9998106566B;
	Fri, 30 Mar 2012 23:56:17 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C1FF98FC0C;
	Fri, 30 Mar 2012 23:56:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UNuHCB063943;
	Fri, 30 Mar 2012 23:56:17 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UNuHc2063909;
	Fri, 30 Mar 2012 23:56:17 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203302356.q2UNuHc2063909@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 30 Mar 2012 23:56:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233717 - in stable/9/sys: dev/ata dev/ata/chipsets
	i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 30 Mar 2012 23:56:18 -0000

Author: marius
Date: Fri Mar 30 23:56:16 2012
New Revision: 233717
URL: http://svn.freebsd.org/changeset/base/233717

Log:
  MFC: r233282
  
  - First pass at const'ifying ata(4) as appropriate.
  - Use DEVMETHOD_END.
  - Use NULL instead of 0 for pointers.

Modified:
  stable/9/sys/dev/ata/ata-all.c
  stable/9/sys/dev/ata/ata-all.h
  stable/9/sys/dev/ata/ata-card.c
  stable/9/sys/dev/ata/ata-cbus.c
  stable/9/sys/dev/ata/ata-disk.c
  stable/9/sys/dev/ata/ata-pci.c
  stable/9/sys/dev/ata/ata-pci.h
  stable/9/sys/dev/ata/ata-queue.c
  stable/9/sys/dev/ata/ata-raid.c
  stable/9/sys/dev/ata/atapi-cam.c
  stable/9/sys/dev/ata/atapi-cd.c
  stable/9/sys/dev/ata/atapi-fd.c
  stable/9/sys/dev/ata/atapi-tape.c
  stable/9/sys/dev/ata/chipsets/ata-acard.c
  stable/9/sys/dev/ata/chipsets/ata-acerlabs.c
  stable/9/sys/dev/ata/chipsets/ata-adaptec.c
  stable/9/sys/dev/ata/chipsets/ata-ahci.c
  stable/9/sys/dev/ata/chipsets/ata-amd.c
  stable/9/sys/dev/ata/chipsets/ata-ati.c
  stable/9/sys/dev/ata/chipsets/ata-cyrix.c
  stable/9/sys/dev/ata/chipsets/ata-highpoint.c
  stable/9/sys/dev/ata/chipsets/ata-intel.c
  stable/9/sys/dev/ata/chipsets/ata-ite.c
  stable/9/sys/dev/ata/chipsets/ata-jmicron.c
  stable/9/sys/dev/ata/chipsets/ata-marvell.c
  stable/9/sys/dev/ata/chipsets/ata-national.c
  stable/9/sys/dev/ata/chipsets/ata-nvidia.c
  stable/9/sys/dev/ata/chipsets/ata-promise.c
  stable/9/sys/dev/ata/chipsets/ata-serverworks.c
  stable/9/sys/dev/ata/chipsets/ata-siliconimage.c
  stable/9/sys/dev/ata/chipsets/ata-sis.c
  stable/9/sys/dev/ata/chipsets/ata-via.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/ata/ata-all.c
==============================================================================
--- stable/9/sys/dev/ata/ata-all.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-all.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -1209,7 +1209,7 @@ ata_udelay(int interval)
 }
 
 #ifndef ATA_CAM
-char *
+const char *
 ata_unit2str(struct ata_device *atadev)
 {
     struct ata_channel *ch = device_get_softc(device_get_parent(atadev->dev));

Modified: stable/9/sys/dev/ata/ata-all.h
==============================================================================
--- stable/9/sys/dev/ata/ata-all.h	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-all.h	Fri Mar 30 23:56:16 2012	(r233717)
@@ -622,7 +622,7 @@ int ata_identify(device_t dev);
 void ata_default_registers(device_t dev);
 void ata_modify_if_48bit(struct ata_request *request);
 void ata_udelay(int interval);
-char *ata_unit2str(struct ata_device *atadev);
+const char *ata_unit2str(struct ata_device *atadev);
 const char *ata_mode2str(int mode);
 int ata_str2mode(const char *str);
 const char *ata_satarev2str(int rev);
@@ -649,7 +649,7 @@ void ata_timeout(struct ata_request *);
 void ata_catch_inflight(device_t dev);
 void ata_fail_requests(device_t dev);
 void ata_drop_requests(device_t dev);
-char *ata_cmd2str(struct ata_request *request);
+const char *ata_cmd2str(struct ata_request *request);
 
 /* ata-lowlevel.c: */
 void ata_generic_hw(device_t dev);

Modified: stable/9/sys/dev/ata/ata-card.c
==============================================================================
--- stable/9/sys/dev/ata/ata-card.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-card.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 
 #include "pccarddevs.h"
 
-static const struct pccard_product ata_pccard_products[] = {
+static const struct pccard_product const ata_pccard_products[] = {
 	PCMCIA_CARD(FREECOM, PCCARDIDE),
 	PCMCIA_CARD(EXP, EXPMULTIMEDIA),
 	PCMCIA_CARD(IODATA3, CBIDE2),
@@ -172,7 +172,7 @@ static device_method_t ata_pccard_method
     DEVMETHOD(device_attach,            ata_pccard_attach),
     DEVMETHOD(device_detach,            ata_pccard_detach),
 
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 static driver_t ata_pccard_driver = {
@@ -181,5 +181,5 @@ static driver_t ata_pccard_driver = {
     sizeof(struct ata_channel),
 };
 
-DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, 0, 0);
+DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, NULL, NULL);
 MODULE_DEPEND(ata, ata, 1, 1, 1);

Modified: stable/9/sys/dev/ata/ata-cbus.c
==============================================================================
--- stable/9/sys/dev/ata/ata-cbus.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-cbus.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -248,7 +248,7 @@ static device_method_t ata_cbus_methods[
     DEVMETHOD(bus_setup_intr,           ata_cbus_setup_intr),
     DEVMETHOD(bus_print_child,          ata_cbus_print_child),
 
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 static driver_t ata_cbus_driver = {
@@ -393,7 +393,7 @@ static device_method_t ata_cbuschannel_m
     /* ATA methods */
     DEVMETHOD(ata_locking,      ata_cbuschannel_banking),
 #endif
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 static driver_t ata_cbuschannel_driver = {
@@ -402,5 +402,5 @@ static driver_t ata_cbuschannel_driver =
     sizeof(struct ata_channel),
 };
 
-DRIVER_MODULE(ata, atacbus, ata_cbuschannel_driver, ata_devclass, 0, 0);
+DRIVER_MODULE(ata, atacbus, ata_cbuschannel_driver, ata_devclass, NULL, NULL);
 MODULE_DEPEND(ata, ata, 1, 1, 1);

Modified: stable/9/sys/dev/ata/ata-disk.c
==============================================================================
--- stable/9/sys/dev/ata/ata-disk.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-disk.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -591,7 +591,7 @@ static device_method_t ad_methods[] = {
     /* ATA methods */
     DEVMETHOD(ata_reinit,       ad_reinit),
 
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 static driver_t ad_driver = {

Modified: stable/9/sys/dev/ata/ata-pci.c
==============================================================================
--- stable/9/sys/dev/ata/ata-pci.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-pci.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -595,7 +595,7 @@ static device_method_t ata_pci_methods[]
     DEVMETHOD(bus_print_child,		ata_pci_print_child),
     DEVMETHOD(bus_child_location_str,	ata_pci_child_location_str),
 
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 devclass_t ata_pci_devclass;
@@ -606,7 +606,7 @@ static driver_t ata_pci_driver = {
     sizeof(struct ata_pci_controller),
 };
 
-DRIVER_MODULE(atapci, pci, ata_pci_driver, ata_pci_devclass, 0, 0);
+DRIVER_MODULE(atapci, pci, ata_pci_driver, ata_pci_devclass, NULL, NULL);
 MODULE_VERSION(atapci, 1);
 MODULE_DEPEND(atapci, ata, 1, 1, 1);
 
@@ -773,7 +773,7 @@ static device_method_t ata_pcichannel_me
 #endif
     DEVMETHOD(ata_reset,        ata_pcichannel_reset),
 
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 driver_t ata_pcichannel_driver = {
@@ -782,7 +782,7 @@ driver_t ata_pcichannel_driver = {
     sizeof(struct ata_channel),
 };
 
-DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, 0, 0);
+DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, NULL, NULL);
 
 /*
  * misc support fucntions
@@ -863,8 +863,8 @@ ata_set_desc(device_t dev)
     device_set_desc_copy(dev, buffer);
 }
 
-struct ata_chip_id *
-ata_match_chip(device_t dev, struct ata_chip_id *index)
+const struct ata_chip_id *
+ata_match_chip(device_t dev, const struct ata_chip_id *index)
 {
     uint32_t devid;
     uint8_t revid;
@@ -879,10 +879,10 @@ ata_match_chip(device_t dev, struct ata_
     return (NULL);
 }
 
-struct ata_chip_id *
-ata_find_chip(device_t dev, struct ata_chip_id *index, int slot)
+const struct ata_chip_id *
+ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot)
 {
-    struct ata_chip_id *idx;
+    const struct ata_chip_id *idx;
     device_t *children;
     int nchildren, i;
     uint8_t s;
@@ -904,7 +904,7 @@ ata_find_chip(device_t dev, struct ata_c
     return (NULL);
 }
 
-char *
+const char *
 ata_pcivendor2str(device_t dev)
 {
     switch (pci_get_vendor(dev)) {

Modified: stable/9/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/9/sys/dev/ata/ata-pci.h	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-pci.h	Fri Mar 30 23:56:16 2012	(r233717)
@@ -33,7 +33,7 @@ struct ata_chip_id {
     int                 cfg1;
     int                 cfg2;
     u_int8_t            max_dma;
-    char                *text;
+    const char          *text;
 };
 
 #define ATA_PCI_MAX_CH	8
@@ -50,7 +50,7 @@ struct ata_pci_controller {
     int                 r_irq_rid;
     struct resource     *r_irq;
     void                *handle;
-    struct ata_chip_id  *chip;
+    const struct ata_chip_id *chip;
     int			legacy;
     int                 channels;
     int			ichannels;
@@ -569,15 +569,15 @@ int ata_pci_status(device_t dev);
 void ata_pci_hw(device_t dev);
 void ata_pci_dmainit(device_t dev);
 void ata_pci_dmafini(device_t dev);
-char *ata_pcivendor2str(device_t dev);
+const char *ata_pcivendor2str(device_t dev);
 int ata_legacy(device_t);
 void ata_generic_intr(void *data);
 int ata_generic_chipinit(device_t dev);
 int ata_generic_setmode(device_t dev, int target, int mode);
 int ata_setup_interrupt(device_t dev, void *intr_func);
 void ata_set_desc(device_t dev);
-struct ata_chip_id *ata_match_chip(device_t dev, struct ata_chip_id *index);
-struct ata_chip_id *ata_find_chip(device_t dev, struct ata_chip_id *index, int slot);
+const struct ata_chip_id *ata_match_chip(device_t dev, const struct ata_chip_id *index);
+const struct ata_chip_id *ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot);
 int ata_mode2idx(int mode);
 
 /* global prototypes from chipsets/ata-*.c */
@@ -611,15 +611,14 @@ static device_method_t __CONCAT(dname,_m
     DEVMETHOD(pci_write_config,		ata_pci_write_config), \
     DEVMETHOD(bus_print_child,		ata_pci_print_child), \
     DEVMETHOD(bus_child_location_str,	ata_pci_child_location_str), \
-    { 0, 0 } \
+    DEVMETHOD_END \
 }; \
 static driver_t __CONCAT(dname,_driver) = { \
         "atapci", \
         __CONCAT(dname,_methods), \
         sizeof(struct ata_pci_controller) \
 }; \
-DRIVER_MODULE(dname, pci, __CONCAT(dname,_driver), ata_pci_devclass, 0, 0); \
+DRIVER_MODULE(dname, pci, __CONCAT(dname,_driver), ata_pci_devclass, NULL, NULL); \
 MODULE_VERSION(dname, 1); \
 MODULE_DEPEND(dname, ata, 1, 1, 1); \
 MODULE_DEPEND(dname, atapci, 1, 1, 1);
-

Modified: stable/9/sys/dev/ata/ata-queue.c
==============================================================================
--- stable/9/sys/dev/ata/ata-queue.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-queue.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -684,7 +684,7 @@ ata_sort_queue(struct ata_channel *ch, s
 }
 #endif
 
-char *
+const char *
 ata_cmd2str(struct ata_request *request)
 {
     static char buffer[20];

Modified: stable/9/sys/dev/ata/ata-raid.c
==============================================================================
--- stable/9/sys/dev/ata/ata-raid.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/ata-raid.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -4546,7 +4546,7 @@ static device_method_t ata_raid_sub_meth
     DEVMETHOD(device_probe,     ata_raid_subdisk_probe),
     DEVMETHOD(device_attach,    ata_raid_subdisk_attach),
     DEVMETHOD(device_detach,    ata_raid_subdisk_detach),
-    { 0, 0 }
+    DEVMETHOD_END
 };
 
 static driver_t ata_raid_sub_driver = {

Modified: stable/9/sys/dev/ata/atapi-cam.c
==============================================================================
--- stable/9/sys/dev/ata/atapi-cam.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/atapi-cam.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -122,7 +122,7 @@ static device_method_t atapi_cam_methods
 	DEVMETHOD(device_attach,        atapi_cam_attach),
 	DEVMETHOD(device_detach,        atapi_cam_detach),
 	DEVMETHOD(ata_reinit,           atapi_cam_reinit),
-	{0, 0}
+	DEVMETHOD_END
 };
 
 static driver_t atapi_cam_driver = {

Modified: stable/9/sys/dev/ata/atapi-cd.c
==============================================================================
--- stable/9/sys/dev/ata/atapi-cd.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/atapi-cd.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -1899,7 +1899,7 @@ static device_method_t acd_methods[] = {
     /* ATA methods */
     DEVMETHOD(ata_reinit,       acd_reinit),
     
-    { 0, 0 }
+    DEVMETHOD_END
 };
     
 static driver_t acd_driver = {

Modified: stable/9/sys/dev/ata/atapi-fd.c
==============================================================================
--- stable/9/sys/dev/ata/atapi-fd.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/atapi-fd.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -423,7 +423,7 @@ static device_method_t afd_methods[] = {
     /* ATA methods */
     DEVMETHOD(ata_reinit,       afd_reinit),
     
-    { 0, 0 }
+    DEVMETHOD_END
 };
     
 static driver_t afd_driver = {

Modified: stable/9/sys/dev/ata/atapi-tape.c
==============================================================================
--- stable/9/sys/dev/ata/atapi-tape.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/atapi-tape.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -723,7 +723,7 @@ static device_method_t ast_methods[] = {
     /* ATA methods */
     DEVMETHOD(ata_reinit,       ast_reinit),
 
-    { 0, 0 }
+    DEVMETHOD_END
 };
 	    
 static driver_t ast_driver = {

Modified: stable/9/sys/dev/ata/chipsets/ata-acard.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-acard.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-acard.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -81,7 +81,7 @@ static int
 ata_acard_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_ATP850R, 0, ATP_OLD, 0x00, ATA_UDMA2, "ATP850" },
      { ATA_ATP860A, 0, 0,       0x00, ATA_UDMA4, "ATP860A" },
      { ATA_ATP860R, 0, 0,       0x00, ATA_UDMA4, "ATP860R" },

Modified: stable/9/sys/dev/ata/chipsets/ata-acerlabs.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-acerlabs.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-acerlabs.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -75,7 +75,7 @@ static int
 ata_ali_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_ALI_5289, 0x00, 2, ALI_SATA, ATA_SA150, "M5289" },
      { ATA_ALI_5288, 0x00, 4, ALI_SATA, ATA_SA300, "M5288" },
      { ATA_ALI_5287, 0x00, 4, ALI_SATA, ATA_SA150, "M5287" },
@@ -304,11 +304,12 @@ ata_ali_setmode(device_t dev, int target
 	struct ata_channel *ch = device_get_softc(dev);
 	int devno = (ch->unit << 1) + target;
 	int piomode;
-	u_int32_t piotimings[] =
+	static const uint32_t piotimings[] =
 		{ 0x006d0003, 0x00580002, 0x00440001, 0x00330001,
 		  0x00310001, 0x006d0003, 0x00330001, 0x00310001 };
-	u_int8_t udma[] = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0d};
-	u_int32_t word54;
+	static const uint8_t udma[] = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f,
+	    0x0d};
+	uint32_t word54;
 
         mode = min(mode, ctlr->chip->max_dma);
 

Modified: stable/9/sys/dev/ata/chipsets/ata-adaptec.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-adaptec.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-adaptec.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
 #define MV_60XX		60		//must match ata_marvell.c's definition
 #define MV_7042		72		//must match ata_marvell.c's definition
 
-
 /*
  * Adaptec chipset support functions
  */
@@ -63,7 +62,7 @@ static int
 ata_adaptec_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_ADAPTEC_1420, 0, 4, MV_60XX, ATA_SA300, "1420SA" },
      { ATA_ADAPTEC_1430, 0, 4, MV_7042, ATA_SA300, "1430SA" },
      { 0, 0, 0, 0, 0, 0}};

Modified: stable/9/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-ahci.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-ahci.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -1056,11 +1056,12 @@ static device_method_t ata_ahci_ata_meth
     DEVMETHOD(bus_deactivate_resource,  bus_generic_deactivate_resource),
     DEVMETHOD(bus_setup_intr,           ata_pci_setup_intr),
     DEVMETHOD(bus_teardown_intr,        ata_pci_teardown_intr),
-    { 0, 0 }
+    DEVMETHOD_END
 };
 static driver_t ata_ahci_ata_driver = {
         "atapci",
         ata_ahci_ata_methods,
         sizeof(struct ata_pci_controller)
 };
-DRIVER_MODULE(ata_ahci_ata, atapci, ata_ahci_ata_driver, ata_pci_devclass, 0, 0);
+DRIVER_MODULE(ata_ahci_ata, atapci, ata_ahci_ata_driver, ata_pci_devclass,
+    NULL, NULL);

Modified: stable/9/sys/dev/ata/chipsets/ata-amd.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-amd.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-amd.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -67,7 +67,7 @@ static int
 ata_amd_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_AMD756,  0x00, 0x00,              0, ATA_UDMA4, "756" },
      { ATA_AMD766,  0x00, AMD_CABLE|AMD_BUG, 0, ATA_UDMA5, "766" },
      { ATA_AMD768,  0x00, AMD_CABLE,         0, ATA_UDMA5, "768" },
@@ -113,8 +113,10 @@ ata_amd_setmode(device_t dev, int target
 	struct ata_channel *ch = device_get_softc(dev);
         int devno = (ch->unit << 1) + target;
 	int piomode;
-	u_int8_t timings[] = { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 };
-	int modes[7] = { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 };
+	static const uint8_t timings[] =
+	    { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 };
+	static const uint8_t modes[] =
+	    { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 };
 	int reg = 0x53 - devno;
 
 	mode = min(mode, ctlr->chip->max_dma);

Modified: stable/9/sys/dev/ata/chipsets/ata-ati.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-ati.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-ati.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -58,11 +58,12 @@ static int ata_ati_ixp700_ch_attach(devi
 static int ata_ati_setmode(device_t dev, int target, int mode);
 
 /* misc defines */
-#define ATI_PATA	0x01
-#define ATI_SATA	0x02
+#define SII_MEMIO       1	/* must match ata_siliconimage.c's definition */
+#define SII_BUG         0x04	/* must match ata_siliconimage.c's definition */
+
+#define ATI_SATA	SII_MEMIO
+#define ATI_PATA	0x02
 #define ATI_AHCI	0x04
-#define SII_MEMIO       1
-#define SII_BUG         0x04
 
 static int force_ahci = 1;
 TUNABLE_INT("hw.ahci.force", &force_ahci);
@@ -74,13 +75,13 @@ static int
 ata_ati_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_ATI_IXP200,    0x00, ATI_PATA, 0, ATA_UDMA5, "IXP200" },
      { ATA_ATI_IXP300,    0x00, ATI_PATA, 0, ATA_UDMA6, "IXP300" },
-     { ATA_ATI_IXP300_S1, 0x00, ATI_SATA, 0, ATA_SA150, "IXP300" },
+     { ATA_ATI_IXP300_S1, 0x00, ATI_SATA, SII_BUG, ATA_SA150, "IXP300" },
      { ATA_ATI_IXP400,    0x00, ATI_PATA, 0, ATA_UDMA6, "IXP400" },
-     { ATA_ATI_IXP400_S1, 0x00, ATI_SATA, 0, ATA_SA150, "IXP400" },
-     { ATA_ATI_IXP400_S2, 0x00, ATI_SATA, 0, ATA_SA150, "IXP400" },
+     { ATA_ATI_IXP400_S1, 0x00, ATI_SATA, SII_BUG, ATA_SA150, "IXP400" },
+     { ATA_ATI_IXP400_S2, 0x00, ATI_SATA, SII_BUG, ATA_SA150, "IXP400" },
      { ATA_ATI_IXP600,    0x00, ATI_PATA, 0, ATA_UDMA6, "IXP600" },
      { ATA_ATI_IXP600_S1, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP600" },
      { ATA_ATI_IXP700,    0x00, ATI_PATA, 0, ATA_UDMA6, "IXP700/800" },
@@ -107,10 +108,7 @@ ata_ati_probe(device_t dev)
     case ATI_SATA:
 	/*
 	 * the ATI SATA controller is actually a SiI 3112 controller
-	 * cfg values below much match those in ata-siliconimage.c
 	 */
-	ctlr->chip->cfg1 = SII_MEMIO;
-	ctlr->chip->cfg2 = SII_BUG;
 	ctlr->chipinit = ata_sii_chipinit;
 	break;
     case ATI_AHCI:
@@ -212,8 +210,8 @@ ata_ati_setmode(device_t dev, int target
 	int devno = (ch->unit << 1) + target;
 	int offset = (devno ^ 0x01) << 3;
 	int piomode;
-	u_int8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
-	u_int8_t dmatimings[] = { 0x77, 0x21, 0x20 };
+	static const uint8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
+	static const uint8_t dmatimings[] = { 0x77, 0x21, 0x20 };
 
 	mode = min(mode, ctlr->chip->max_dma);
 	if (mode >= ATA_UDMA0) {

Modified: stable/9/sys/dev/ata/chipsets/ata-cyrix.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-cyrix.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-cyrix.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -101,10 +101,12 @@ ata_cyrix_setmode(device_t dev, int targ
 	struct ata_channel *ch = device_get_softc(dev);
 	int devno = (ch->unit << 1) + target;
 	int piomode;
-	u_int32_t piotiming[] = 
+	static const uint32_t piotiming[] = 
 	    { 0x00009172, 0x00012171, 0x00020080, 0x00032010, 0x00040010 };
-	u_int32_t dmatiming[] = { 0x00077771, 0x00012121, 0x00002020 };
-	u_int32_t udmatiming[] = { 0x00921250, 0x00911140, 0x00911030 };
+	static const uint32_t dmatiming[] =
+	    { 0x00077771, 0x00012121, 0x00002020 };
+	static const uint32_t udmatiming[] =
+	    { 0x00921250, 0x00911140, 0x00911030 };
 
 	mode = min(mode, ATA_UDMA2);
 	/* dont try to set the mode if we dont have the resource */

Modified: stable/9/sys/dev/ata/chipsets/ata-highpoint.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-highpoint.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-highpoint.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -72,8 +72,8 @@ static int
 ata_highpoint_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    struct ata_chip_id *idx;
-    static struct ata_chip_id ids[] =
+    const struct ata_chip_id *idx;
+    static const struct ata_chip_id const ids[] =
     {{ ATA_HPT374, 0x07, HPT_374, 0,       ATA_UDMA6, "HPT374" },
      { ATA_HPT372, 0x02, HPT_372, 0,       ATA_UDMA6, "HPT372N" },
      { ATA_HPT372, 0x01, HPT_372, 0,       ATA_UDMA6, "HPT372" },
@@ -163,8 +163,8 @@ ata_highpoint_setmode(device_t dev, int 
 	struct ata_pci_controller *ctlr = device_get_softc(parent);
 	struct ata_channel *ch = device_get_softc(dev);
 	int devno = (ch->unit << 1) + target;
-	u_int32_t timings33[][4] = {
-    /*    HPT366      HPT370      HPT372      HPT374               mode */
+	static const uint32_t timings33[][4] = {
+	/*    HPT366      HPT370      HPT372      HPT374           mode */
 	{ 0x40d0a7aa, 0x06914e57, 0x0d029d5e, 0x0ac1f48a },     /* PIO 0 */
 	{ 0x40d0a7a3, 0x06914e43, 0x0d029d26, 0x0ac1f465 },     /* PIO 1 */
 	{ 0x40d0a753, 0x06514e33, 0x0c829ca6, 0x0a81f454 },     /* PIO 2 */

Modified: stable/9/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-intel.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-intel.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -105,7 +105,7 @@ static int
 ata_intel_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_I82371FB,     0,          0, 2, ATA_WDMA2, "PIIX" },
      { ATA_I82371SB,     0,          0, 2, ATA_WDMA2, "PIIX3" },
      { ATA_I82371AB,     0,          0, 2, ATA_UDMA2, "PIIX4" },
@@ -519,8 +519,10 @@ ata_intel_new_setmode(device_t dev, int 
 	u_int16_t reg54 = pci_read_config(parent, 0x54, 2);
 	u_int32_t mask40 = 0, new40 = 0;
 	u_int8_t mask44 = 0, new44 = 0;
-	u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 };
-	u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 };
+	static const uint8_t timings[] =
+	    { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 };
+	static const uint8_t utimings[] =
+	    { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 };
 
 	/* In combined mode, skip PATA stuff for SATA channel. */
 	if (ch->flags & ATA_SATA)

Modified: stable/9/sys/dev/ata/chipsets/ata-ite.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-ite.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-ite.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -57,7 +57,6 @@ static int ata_ite_ch_attach(device_t de
 static int ata_ite_821x_setmode(device_t dev, int target, int mode);
 static int ata_ite_8213_setmode(device_t dev, int target, int mode);
 
-
 /*
  * Integrated Technology Express Inc. (ITE) chipset support functions
  */
@@ -65,7 +64,7 @@ static int
 ata_ite_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_IT8213F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8213F" },
      { ATA_IT8212F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8212F" },
      { ATA_IT8211F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8211F" },
@@ -132,9 +131,9 @@ ata_ite_821x_setmode(device_t dev, int t
 	int devno = (ch->unit << 1) + target;
 	int piomode;
 	uint8_t *timings = (uint8_t*)(&ctlr->chipset_data);
-	u_int8_t udmatiming[] =
+	static const uint8_t udmatiming[] =
 		{ 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 };
-	u_int8_t chtiming[] =
+	static const uint8_t chtiming[] =
 		{ 0xaa, 0xa3, 0xa1, 0x33, 0x31, 0x88, 0x32, 0x31 };
 
 	mode = min(mode, ctlr->chip->max_dma);
@@ -182,8 +181,10 @@ ata_ite_8213_setmode(device_t dev, int t
 	u_int16_t reg54 = pci_read_config(parent, 0x54, 2);
 	u_int16_t mask40 = 0, new40 = 0;
 	u_int8_t mask44 = 0, new44 = 0;
-	u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 };
-	u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 };
+	static const uint8_t timings[] =
+	    { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 };
+	static const uint8_t utimings[] =
+	    { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 };
 
 	mode = min(mode, ctlr->chip->max_dma);
 

Modified: stable/9/sys/dev/ata/chipsets/ata-jmicron.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-jmicron.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-jmicron.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -63,8 +63,8 @@ static int
 ata_jmicron_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    struct ata_chip_id *idx;
-    static struct ata_chip_id ids[] =
+    const struct ata_chip_id *idx;
+    static const struct ata_chip_id const ids[] =
     {{ ATA_JMB360, 0, 1, 0, ATA_SA300, "JMB360" },
      { ATA_JMB361, 0, 1, 1, ATA_UDMA6, "JMB361" },
      { ATA_JMB363, 0, 2, 1, ATA_UDMA6, "JMB363" },

Modified: stable/9/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-marvell.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-marvell.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -99,7 +99,7 @@ static int
 ata_marvell_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_M88SX5040, 0, 4, MV_50XX, ATA_SA150, "88SX5040" },
      { ATA_M88SX5041, 0, 4, MV_50XX, ATA_SA150, "88SX5041" },
      { ATA_M88SX5080, 0, 8, MV_50XX, ATA_SA150, "88SX5080" },

Modified: stable/9/sys/dev/ata/chipsets/ata-national.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-national.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-national.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -103,11 +103,13 @@ ata_national_setmode(device_t dev, int t
 	struct ata_channel *ch = device_get_softc(dev);
 	int devno = (ch->unit << 1) + target;
 	int piomode;
-	u_int32_t piotiming[] =
+	static const uint32_t piotiming[] =
 	    { 0x9172d132, 0x21717121, 0x00803020, 0x20102010, 0x00100010,
 	      0x9172d132, 0x20102010, 0x00100010 };
-	u_int32_t dmatiming[] = { 0x80077771, 0x80012121, 0x80002020 };
-	u_int32_t udmatiming[] = { 0x80921250, 0x80911140, 0x80911030 };
+	static const uint32_t dmatiming[] =
+	    { 0x80077771, 0x80012121, 0x80002020 };
+	static const uint32_t udmatiming[] =
+	    { 0x80921250, 0x80911140, 0x80911030 };
 
 	mode = min(mode, ATA_UDMA2);
 

Modified: stable/9/sys/dev/ata/chipsets/ata-nvidia.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-nvidia.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-nvidia.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -75,7 +75,7 @@ static int
 ata_nvidia_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_NFORCE1,         0, 0,       0, ATA_UDMA5, "nForce" },
      { ATA_NFORCE2,         0, 0,       0, ATA_UDMA6, "nForce2" },
      { ATA_NFORCE2_PRO,     0, 0,       0, ATA_UDMA6, "nForce2 Pro" },
@@ -332,8 +332,10 @@ ata_nvidia_setmode(device_t dev, int tar
 	struct ata_channel *ch = device_get_softc(dev);
 	int devno = (ch->unit << 1) + target;
 	int piomode;
-	u_int8_t timings[] = { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 };
-        int modes[7] = { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 };
+	static const uint8_t timings[] =
+	    { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 };
+	static const uint8_t modes[] =
+	    { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 };
 	int reg = 0x63 - devno;
 
 	mode = min(mode, ctlr->chip->max_dma);

Modified: stable/9/sys/dev/ata/chipsets/ata-promise.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-promise.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-promise.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -129,8 +129,8 @@ static int
 ata_promise_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    struct ata_chip_id *idx;
-    static struct ata_chip_id ids[] =
+    const struct ata_chip_id *idx;
+    static const struct ata_chip_id const ids[] =
     {{ ATA_PDC20246,  0, PR_OLD, 0x00,     ATA_UDMA2, "PDC20246" },
      { ATA_PDC20262,  0, PR_NEW, 0x00,     ATA_UDMA4, "PDC20262" },
      { ATA_PDC20263,  0, PR_NEW, 0x00,     ATA_UDMA4, "PDC20263" },
@@ -454,7 +454,7 @@ ata_promise_setmode(device_t dev, int ta
     struct ata_pci_controller *ctlr = device_get_softc(parent);
     struct ata_channel *ch = device_get_softc(dev);
     int devno = (ch->unit << 1) + target;
-    u_int32_t timings[][2] = {
+    static const uint32_t timings[][2] = {
     /*    PR_OLD      PR_NEW               mode */
 	{ 0x004ff329, 0x004fff2f },     /* PIO 0 */
 	{ 0x004fec25, 0x004ff82a },     /* PIO 1 */

Modified: stable/9/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-serverworks.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-serverworks.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -75,7 +75,7 @@ static int
 ata_serverworks_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_ROSB4,     0x00, SWKS_33,  0, ATA_WDMA2, "ROSB4" },
      { ATA_CSB5,      0x92, SWKS_100, 0, ATA_UDMA5, "CSB5" },
      { ATA_CSB5,      0x00, SWKS_66,  0, ATA_UDMA4, "CSB5" },
@@ -350,8 +350,8 @@ ata_serverworks_setmode(device_t dev, in
         int devno = (ch->unit << 1) + target;
         int offset = (devno ^ 0x01) << 3;
 	int piomode;
-	u_int8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
-	u_int8_t dmatimings[] = { 0x77, 0x21, 0x20 };
+	static const uint8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
+	static const uint8_t dmatimings[] = { 0x77, 0x21, 0x20 };
 
 	mode = min(mode, ctlr->chip->max_dma);
 	if (mode >= ATA_UDMA0) {

Modified: stable/9/sys/dev/ata/chipsets/ata-siliconimage.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-siliconimage.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-siliconimage.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -87,7 +87,7 @@ static int
 ata_sii_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_SII3114,   0x00, SII_MEMIO, SII_4CH,    ATA_SA150, "3114" },
      { ATA_SII3512,   0x02, SII_MEMIO, 0,          ATA_SA150, "3512" },
      { ATA_SII3112,   0x02, SII_MEMIO, 0,          ATA_SA150, "3112" },
@@ -272,10 +272,11 @@ ata_cmd_setmode(device_t dev, int target
 	int treg = 0x54 + ((devno < 3) ? (devno << 1) : 7);
 	int ureg = ch->unit ? 0x7b : 0x73;
 	int piomode;
-	uint8_t piotimings[] = { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f };
-	uint8_t udmatimings[][2] = { { 0x31,  0xc2 }, { 0x21,  0x82 },
-				     { 0x11,  0x42 }, { 0x25,  0x8a },
-				     { 0x15,  0x4a }, { 0x05,  0x0a } };
+	static const uint8_t piotimings[] =
+	    { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f };
+	static const uint8_t udmatimings[][2] =
+	    { { 0x31,  0xc2 }, { 0x21,  0x82 }, { 0x11,  0x42 },
+	      { 0x25,  0x8a }, { 0x15,  0x4a }, { 0x05,  0x0a } };
 
 	mode = min(mode, ctlr->chip->max_dma);
 	if (mode >= ATA_UDMA0) {        
@@ -410,9 +411,11 @@ ata_sii_setmode(device_t dev, int target
 	u_int8_t preg = 0xa4 + rego;
 	u_int8_t dreg = 0xa8 + rego;
 	u_int8_t ureg = 0xac + rego;
-	u_int16_t piotimings[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
-	u_int16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 };
-	u_int8_t udmatimings[] = { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 };
+	static const uint16_t piotimings[] =
+	    { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
+	static const uint16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 };
+	static const uint8_t udmatimings[] =
+	    { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 };
 
 	mode = min(mode, ctlr->chip->max_dma);
 

Modified: stable/9/sys/dev/ata/chipsets/ata-sis.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-sis.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-sis.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -66,7 +66,6 @@ static int ata_sis_setmode(device_t dev,
 #define SIS_133OLD	6
 #define SIS_SATA	7
 
-
 /*
  * Silicon Integrated Systems Corp. (SiS) chipset support functions
  */
@@ -74,8 +73,8 @@ static int
 ata_sis_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    struct ata_chip_id *idx;
-    static struct ata_chip_id ids[] =
+    const struct ata_chip_id *idx;
+    static const struct ata_chip_id const ids[] =
     {{ ATA_SIS182,  0x00, SIS_SATA,   0, ATA_SA150, "182" }, /* south */
      { ATA_SIS181,  0x00, SIS_SATA,   0, ATA_SA150, "181" }, /* south */
      { ATA_SIS180,  0x00, SIS_SATA,   0, ATA_SA150, "180" }, /* south */
@@ -102,6 +101,8 @@ ata_sis_probe(device_t dev)
      { ATA_SIS5513, 0xc2, SIS_33,     1, ATA_UDMA2, "5513" },
      { ATA_SIS5513, 0x00, SIS_33,     1, ATA_WDMA2, "5513" },
      { 0, 0, 0, 0, 0, 0 }};
+    static struct ata_chip_id id[] =
+    {{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }};
     char buffer[64];
     int found = 0;
 
@@ -114,14 +115,15 @@ ata_sis_probe(device_t dev)
     if (!(idx = ata_find_chip(dev, ids, -pci_get_slot(dev)))) 
 	return ENXIO;
 
-    if (idx->cfg2 && !found) {
+    if (idx->cfg2) {
 	u_int8_t reg57 = pci_read_config(dev, 0x57, 1);
 
 	pci_write_config(dev, 0x57, (reg57 & 0x7f), 1);
 	if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == ATA_SIS5518) {
 	    found = 1;
-	    idx->cfg1 = SIS_133NEW;
-	    idx->max_dma = ATA_UDMA6;
+    	    memcpy(&id[0], idx, sizeof(id[0]));
+	    id[0].cfg1 = SIS_133NEW;
+	    id[0].max_dma = ATA_UDMA6;
 	    sprintf(buffer, "SiS 962/963 %s controller",
 		    ata_mode2str(idx->max_dma));
 	}
@@ -132,17 +134,13 @@ ata_sis_probe(device_t dev)
 
 	pci_write_config(dev, 0x4a, (reg4a | 0x10), 1);
 	if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == ATA_SIS5517) {
-	    struct ata_chip_id id[] =
-		{{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }};
-
 	    found = 1;
 	    if (ata_find_chip(dev, id, pci_get_slot(dev))) {
-		idx->cfg1 = SIS_133OLD;
-		idx->max_dma = ATA_UDMA6;
-	    }
-	    else {
-		idx->cfg1 = SIS_100NEW;
-		idx->max_dma = ATA_UDMA5;
+		id[0].cfg1 = SIS_133OLD;
+		id[0].max_dma = ATA_UDMA6;
+	    } else {
+		id[0].cfg1 = SIS_100NEW;
+		id[0].max_dma = ATA_UDMA5;
 	    }
 	    sprintf(buffer, "SiS 961 %s controller",ata_mode2str(idx->max_dma));
 	}
@@ -151,6 +149,8 @@ ata_sis_probe(device_t dev)
     if (!found)
 	sprintf(buffer,"SiS %s %s controller",
 		idx->text, ata_mode2str(idx->max_dma));
+    else
+	idx = &id[0];
 
     device_set_desc_copy(dev, buffer);
     ctlr->chip = idx;
@@ -262,7 +262,7 @@ ata_sis_setmode(device_t dev, int target
 
 	switch (ctlr->chip->cfg1) {
 	case SIS_133NEW: {
-	    u_int32_t timings[] = 
+	    static const uint32_t timings[] = 
 		{ 0x28269008, 0x0c266008, 0x04263008, 0x0c0a3008, 0x05093008,
 		  0x22196008, 0x0c0a3008, 0x05093008, 0x050939fc, 0x050936ac,
 		  0x0509347c, 0x0509325c, 0x0509323c, 0x0509322c, 0x0509321c};
@@ -273,7 +273,7 @@ ata_sis_setmode(device_t dev, int target
 	    break;
 	    }
 	case SIS_133OLD: {
-	    u_int16_t timings[] =
+	    static const uint16_t timings[] =
 	     { 0x00cb, 0x0067, 0x0044, 0x0033, 0x0031, 0x0044, 0x0033, 0x0031,
 	       0x8f31, 0x8a31, 0x8731, 0x8531, 0x8331, 0x8231, 0x8131 };
 		  
@@ -283,7 +283,7 @@ ata_sis_setmode(device_t dev, int target
 	    break;
 	    }
 	case SIS_100NEW: {
-	    u_int16_t timings[] =
+	    static const uint16_t timings[] =
 		{ 0x00cb, 0x0067, 0x0044, 0x0033, 0x0031, 0x0044, 0x0033,
 		  0x0031, 0x8b31, 0x8731, 0x8531, 0x8431, 0x8231, 0x8131 };
 	    u_int16_t reg = 0x40 + (devno << 1);
@@ -294,7 +294,7 @@ ata_sis_setmode(device_t dev, int target
 	case SIS_100OLD:
 	case SIS_66:
 	case SIS_33: {
-	    u_int16_t timings[] =
+	    static const uint16_t timings[] =
 		{ 0x0c0b, 0x0607, 0x0404, 0x0303, 0x0301, 0x0404, 0x0303,
 		  0x0301, 0xf301, 0xd301, 0xb301, 0xa301, 0x9301, 0x8301 };
 	    u_int16_t reg = 0x40 + (devno << 1);

Modified: stable/9/sys/dev/ata/chipsets/ata-via.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-via.c	Fri Mar 30 23:50:26 2012	(r233716)
+++ stable/9/sys/dev/ata/chipsets/ata-via.c	Fri Mar 30 23:56:16 2012	(r233717)
@@ -82,7 +82,6 @@ static int ata_via_sata_status(device_t 
 #define VIAAHCI         0x08
 #define VIASATA         0x10
 
-
 /*
  * VIA Technologies Inc. chipset support functions
  */
@@ -90,7 +89,7 @@ static int
 ata_via_probe(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
-    static struct ata_chip_id ids[] =
+    static const struct ata_chip_id const ids[] =
     {{ ATA_VIA82C586, 0x02, VIA33,  0x00,    ATA_UDMA2, "82C586B" },
      { ATA_VIA82C586, 0x00, VIA33,  0x00,    ATA_WDMA2, "82C586" },
      { ATA_VIA82C596, 0x12, VIA66,  VIACLK,  ATA_UDMA4, "82C596B" },
@@ -114,7 +113,7 @@ ata_via_probe(device_t dev)
      { ATA_VIAVX855,  0x00, VIA133, 0x00,    ATA_UDMA6, "VX855" },
      { ATA_VIAVX900,  0x00, VIA133, VIASATA, ATA_SA300, "VX900" },
      { 0, 0, 0, 0, 0, 0 }};
-    static struct ata_chip_id new_ids[] =
+    static const struct ata_chip_id const new_ids[] =
     {{ ATA_VIA6410,   0x00, 0,      0x00,    ATA_UDMA6, "6410" },
      { ATA_VIA6420,   0x00, 7,      0x00,    ATA_SA150, "6420" },
      { ATA_VIA6421,   0x00, 6,      VIABAR,  ATA_SA150, "6421" },
@@ -328,8 +327,10 @@ ata_via_new_setmode(device_t dev, int ta
 
 	if ((ctlr->chip->cfg2 & VIABAR) && (ch->unit > 1)) {
 	    int piomode;
-    	    u_int8_t pio_timings[] = { 0xa8, 0x65, 0x65, 0x32, 0x20 };
-	    u_int8_t dma_timings[] = { 0xee, 0xe8, 0xe6, 0xe4, 0xe2, 0xe1, 0xe0 };
+    	    static const uint8_t pio_timings[] =
+		{ 0xa8, 0x65, 0x65, 0x32, 0x20 };
+	    static const uint8_t dma_timings[] =
+		{ 0xee, 0xe8, 0xe6, 0xe4, 0xe2, 0xe1, 0xe0 };
 
 	    /* This chip can't do WDMA. */
 	    if (mode >= ATA_WDMA0 && mode < ATA_UDMA0)
@@ -355,8 +356,9 @@ ata_via_old_setmode(device_t dev, int ta
 	int devno = (ch->unit << 1) + target;
 	int reg = 0x53 - devno;
 	int piomode;
-	uint8_t timings[] = { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 };
-	uint8_t modes[][7] = {
+	static const uint8_t timings[] =
+	    { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 };
+	static const uint8_t modes[][7] = {
 	    { 0xc2, 0xc1, 0xc0, 0x00, 0x00, 0x00, 0x00 },   /* VIA ATA33 */
 	    { 0xee, 0xec, 0xea, 0xe9, 0xe8, 0x00, 0x00 },   /* VIA ATA66 */
 	    { 0xf7, 0xf6, 0xf4, 0xf2, 0xf1, 0xf0, 0x00 },   /* VIA ATA100 */

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 00:07:54 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 88C3B1065673;
	Sat, 31 Mar 2012 00:07:54 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 724418FC0A;
	Sat, 31 Mar 2012 00:07:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V07s6v064448;
	Sat, 31 Mar 2012 00:07:54 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V07sjr064440;
	Sat, 31 Mar 2012 00:07:54 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203310007.q2V07sjr064440@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 00:07:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233719 - in stable/9/sys: boot/uboot/lib i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 00:07:54 -0000

Author: marius
Date: Sat Mar 31 00:07:53 2012
New Revision: 233719
URL: http://svn.freebsd.org/changeset/base/233719

Log:
  MFC: r233287
  
  Use the common/shared CRC-32 implementation instead of duplicating it.

Modified:
  stable/9/sys/boot/uboot/lib/Makefile
  stable/9/sys/boot/uboot/lib/glue.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/boot/uboot/lib/Makefile
==============================================================================
--- stable/9/sys/boot/uboot/lib/Makefile	Fri Mar 30 23:56:19 2012	(r233718)
+++ stable/9/sys/boot/uboot/lib/Makefile	Sat Mar 31 00:07:53 2012	(r233719)
@@ -1,11 +1,13 @@
 # $FreeBSD$
 
+.PATH: ${.CURDIR}/../../common
+
 LIB=		uboot
 INTERNALLIB=
 WARNS?=		2
 
-SRCS=	devicename.c elf_freebsd.c console.c copy.c disk.c \
-	module.c net.c reboot.c time.c glue.c
+SRCS=	crc32.c console.c copy.c devicename.c disk.c elf_freebsd.c glue.c
+SRCS+=	module.c net.c reboot.c time.c
 
 CFLAGS+=	-ffreestanding -msoft-float
 

Modified: stable/9/sys/boot/uboot/lib/glue.c
==============================================================================
--- stable/9/sys/boot/uboot/lib/glue.c	Fri Mar 30 23:56:19 2012	(r233718)
+++ stable/9/sys/boot/uboot/lib/glue.c	Sat Mar 31 00:07:53 2012	(r233719)
@@ -27,6 +27,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
+#include 
 #include 
 #include "api_public.h"
 #include "glue.h"
@@ -43,69 +46,6 @@ __FBSDID("$FreeBSD$");
 /* Some random address used by U-Boot. */
 extern long uboot_address;
 
-/* crc32 stuff stolen from lib/libdisk/write_ia64_disk.c */
-static uint32_t crc32_tab[] = {
-	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
-	0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
-	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
-	0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-	0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
-	0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
-	0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
-	0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-	0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
-	0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-	0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
-	0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-	0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
-	0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
-	0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-	0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-	0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
-	0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
-	0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
-	0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-	0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
-	0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
-	0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
-	0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-	0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
-	0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
-	0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
-	0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-	0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
-	0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-	0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
-	0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-	0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
-	0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
-	0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
-	0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-	0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
-	0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
-	0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
-	0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-	0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
-	0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
-	0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-static uint32_t
-crc32(const void *buf, size_t size)
-{
-	const uint8_t *p;
-	uint32_t crc;
-
-	p = buf;
-	crc = ~0U;
-
-	while (size--)
-		crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
-
-	return (crc ^ ~0U);
-}
-
-
 static int
 valid_sig(struct api_signature *sig)
 {
@@ -235,7 +175,6 @@ ub_get_sys_info(void)
 	return ((err) ? NULL : &si);
 }
 
-
 /****************************************
  *
  * timing
@@ -260,7 +199,6 @@ ub_get_timer(unsigned long base)
 	return (cur);
 }
 
-
 /****************************************************************************
  *
  * devices
@@ -314,7 +252,6 @@ ub_dev_enum(void)
 	return (n);
 }
 
-
 /*
  * handle:	0-based id of the device
  *
@@ -559,7 +496,6 @@ ub_env_set(const char *name, char *value
 	syscall(API_ENV_SET, NULL, (uint32_t)name, (uint32_t)value);
 }
 
-
 static char env_name[256];
 
 const char *

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 00:10:17 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7DB5E106564A;
	Sat, 31 Mar 2012 00:10:17 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E0AE8FC1D;
	Sat, 31 Mar 2012 00:10:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V0AHX1064646;
	Sat, 31 Mar 2012 00:10:17 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V0AHtQ064643;
	Sat, 31 Mar 2012 00:10:17 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203310010.q2V0AHtQ064643@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 00:10:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233721 - in stable/9/sys: dev/mpt i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 00:10:17 -0000

Author: marius
Date: Sat Mar 31 00:10:16 2012
New Revision: 233721
URL: http://svn.freebsd.org/changeset/base/233721

Log:
  MFC: r233403, r233404
  
  - Use the PCI ID macros from mpi_cnfg.h rather than duplicating them here.
    Note that this driver additionally probes some device IDs for the most
    part not know to other MPT drivers, if at all. So rename the macros not
    present in mpi_cnfg.h to match the naming scheme in the latter and but
    suffix them with a _FB in order to not cause conflicts.
  - Like mpt_set_config_regs(), comment out mpt_read_config_regs() as the
    content of the registers read isn't actually used and both functions
    aren't exactly up to date regarding the possible layouts of the BARs
    (these function might be helpful for debugging though, so don't remove
    them completely).
  - Use DEVMETHOD_END.
  - Use NULL rather than 0 for pointers.
  - Remove an unusual check for the softc being NULL.
  - Remove redundant zeroing of the softc.
  - Remove an overly banal and actually partly incorrect as well as partly
    outdated comment regarding the allocation of the memory resource.

Modified:
  stable/9/sys/dev/mpt/mpt.h
  stable/9/sys/dev/mpt/mpt_pci.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/mpt/mpt.h
==============================================================================
--- stable/9/sys/dev/mpt/mpt.h	Sat Mar 31 00:07:54 2012	(r233720)
+++ stable/9/sys/dev/mpt/mpt.h	Sat Mar 31 00:10:16 2012	(r233721)
@@ -716,7 +716,9 @@ struct mpt_softc {
 	int			pci_msi_count;
 	struct resource *	pci_irq;	/* Interrupt map for chip */
 	void *			ih;		/* Interrupt handle */
+#if 0
 	struct mpt_pci_cfg	pci_cfg;	/* saved PCI conf registers */
+#endif
 
 	/*
 	 * DMA Mapping Stuff

Modified: stable/9/sys/dev/mpt/mpt_pci.c
==============================================================================
--- stable/9/sys/dev/mpt/mpt_pci.c	Sat Mar 31 00:07:54 2012	(r233720)
+++ stable/9/sys/dev/mpt/mpt_pci.c	Sat Mar 31 00:10:16 2012	(r233721)
@@ -113,104 +113,36 @@ __FBSDID("$FreeBSD$");
 #define	pci_release_msi(x)	do { ; } while (0)
 #endif
 
-#ifndef	PCI_VENDOR_LSI
-#define	PCI_VENDOR_LSI			0x1000
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC909
-#define	PCI_PRODUCT_LSI_FC909		0x0620
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC909A
-#define	PCI_PRODUCT_LSI_FC909A		0x0621
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC919
-#define	PCI_PRODUCT_LSI_FC919		0x0624
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC919_LAN
-#define	PCI_PRODUCT_LSI_FC919_LAN	0x0625
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC929
-#define	PCI_PRODUCT_LSI_FC929		0x0622
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC929_LAN
-#define	PCI_PRODUCT_LSI_FC929_LAN	0x0623
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC929X
-#define	PCI_PRODUCT_LSI_FC929X		0x0626
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC929X_LAN
-#define	PCI_PRODUCT_LSI_FC929X_LAN	0x0627
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC919X
-#define	PCI_PRODUCT_LSI_FC919X		0x0628
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC919X_LAN
-#define	PCI_PRODUCT_LSI_FC919X_LAN	0x0629
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC7X04X
-#define	PCI_PRODUCT_LSI_FC7X04X		0x0640
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_FC646
-#define	PCI_PRODUCT_LSI_FC646		0x0646
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_1030
-#define	PCI_PRODUCT_LSI_1030		0x0030
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_1030ZC
-#define	PCI_PRODUCT_LSI_1030ZC		0x0031
-#endif
-
-#ifndef	PCI_PRODUCT_LSI_SAS1064
-#define PCI_PRODUCT_LSI_SAS1064		0x0050
-#endif
-
-#ifndef PCI_PRODUCT_LSI_SAS1064A
-#define PCI_PRODUCT_LSI_SAS1064A	0x005C
-#endif
-
-#ifndef PCI_PRODUCT_LSI_SAS1064E
-#define PCI_PRODUCT_LSI_SAS1064E	0x0056
-#endif
+/*
+ * XXX it seems no other MPT driver knows about the following chips.
+ */
 
-#ifndef PCI_PRODUCT_LSI_SAS1066
-#define PCI_PRODUCT_LSI_SAS1066		0x005E
+#ifndef	MPI_MANUFACTPAGE_DEVICEID_FC909_FB
+#define	MPI_MANUFACTPAGE_DEVICEID_FC909_FB	0x0620
 #endif
 
-#ifndef PCI_PRODUCT_LSI_SAS1066E
-#define PCI_PRODUCT_LSI_SAS1066E	0x005A
+#ifndef	MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB
+#define	MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB	0x0625
 #endif
 
-#ifndef PCI_PRODUCT_LSI_SAS1068
-#define PCI_PRODUCT_LSI_SAS1068		0x0054
+#ifndef	MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB
+#define	MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB	0x0623
 #endif
 
-#ifndef PCI_PRODUCT_LSI_SAS1068A
-#define PCI_PRODUCT_LSI_SAS1068A	0x0055
+#ifndef	MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB
+#define	MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB	0x0627
 #endif
 
-#ifndef PCI_PRODUCT_LSI_SAS1068E
-#define PCI_PRODUCT_LSI_SAS1068E	0x0058
+#ifndef	MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB
+#define	MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB	0x0629
 #endif
 
-#ifndef PCI_PRODUCT_LSI_SAS1078
-#define PCI_PRODUCT_LSI_SAS1078		0x0062
+#ifndef MPI_MANUFACTPAGE_DEVID_SAS1068A_FB
+#define MPI_MANUFACTPAGE_DEVID_SAS1068A_FB	0x0055
 #endif
 
-#ifndef	PCI_PRODUCT_LSI_SAS1078DE
-#define	PCI_PRODUCT_LSI_SAS1078DE	0x007C
+#ifndef	MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB
+#define	MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB	0x007C
 #endif
 
 #ifndef	PCIM_CMD_SERRESPEN
@@ -224,8 +156,8 @@ static int mpt_pci_detach(device_t);
 static int mpt_pci_shutdown(device_t);
 static int mpt_dma_mem_alloc(struct mpt_softc *mpt);
 static void mpt_dma_mem_free(struct mpt_softc *mpt);
-static void mpt_read_config_regs(struct mpt_softc *mpt);
 #if 0
+static void mpt_read_config_regs(struct mpt_softc *mpt);
 static void mpt_set_config_regs(struct mpt_softc *mpt);
 #endif
 static void mpt_pci_intr(void *);
@@ -236,77 +168,76 @@ static device_method_t mpt_methods[] = {
 	DEVMETHOD(device_attach,	mpt_pci_attach),
 	DEVMETHOD(device_detach,	mpt_pci_detach),
 	DEVMETHOD(device_shutdown,	mpt_pci_shutdown),
-	{ 0, 0 }
+	DEVMETHOD_END
 };
 
 static driver_t mpt_driver = {
 	"mpt", mpt_methods, sizeof(struct mpt_softc)
 };
 static devclass_t mpt_devclass;
-DRIVER_MODULE(mpt, pci, mpt_driver, mpt_devclass, 0, 0);
+DRIVER_MODULE(mpt, pci, mpt_driver, mpt_devclass, NULL, NULL);
 MODULE_DEPEND(mpt, pci, 1, 1, 1);
 MODULE_VERSION(mpt, 1);
 
 static int
 mpt_pci_probe(device_t dev)
 {
-	char *desc;
+	const char *desc;
 
-	if (pci_get_vendor(dev) != PCI_VENDOR_LSI) {
+	if (pci_get_vendor(dev) != MPI_MANUFACTPAGE_VENDORID_LSILOGIC)
 		return (ENXIO);
-	}
 
 	switch (pci_get_device(dev)) {
-	case PCI_PRODUCT_LSI_FC909:
+	case MPI_MANUFACTPAGE_DEVICEID_FC909_FB:
 		desc = "LSILogic FC909 FC Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC909A:
+	case MPI_MANUFACTPAGE_DEVICEID_FC909:
 		desc = "LSILogic FC909A FC Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC919:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919:
 		desc = "LSILogic FC919 FC Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC919_LAN:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB:
 		desc = "LSILogic FC919 LAN Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC929:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929:
 		desc = "Dual LSILogic FC929 FC Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC929_LAN:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB:
 		desc = "Dual LSILogic FC929 LAN Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC919X:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919X:
 		desc = "LSILogic FC919 FC PCI-X Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC919X_LAN:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB:
 		desc = "LSILogic FC919 LAN PCI-X Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC929X:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929X:
 		desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC929X_LAN:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB:
 		desc = "Dual LSILogic FC929X LAN PCI-X Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC646:
+	case MPI_MANUFACTPAGE_DEVICEID_FC949E:
 		desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter";
 		break;
-	case PCI_PRODUCT_LSI_FC7X04X:
+	case MPI_MANUFACTPAGE_DEVICEID_FC949X:
 		desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-X Adapter";
 		break;
-	case PCI_PRODUCT_LSI_1030:
-	case PCI_PRODUCT_LSI_1030ZC:
+	case MPI_MANUFACTPAGE_DEVID_53C1030:
+	case MPI_MANUFACTPAGE_DEVID_53C1030ZC:
 		desc = "LSILogic 1030 Ultra4 Adapter";
 		break;
-	case PCI_PRODUCT_LSI_SAS1064:
-	case PCI_PRODUCT_LSI_SAS1064A:
-	case PCI_PRODUCT_LSI_SAS1064E:
-	case PCI_PRODUCT_LSI_SAS1066:
-	case PCI_PRODUCT_LSI_SAS1066E:
-	case PCI_PRODUCT_LSI_SAS1068:
-	case PCI_PRODUCT_LSI_SAS1068A:
-	case PCI_PRODUCT_LSI_SAS1068E:
-	case PCI_PRODUCT_LSI_SAS1078:
-	case PCI_PRODUCT_LSI_SAS1078DE:
+	case MPI_MANUFACTPAGE_DEVID_SAS1064:
+	case MPI_MANUFACTPAGE_DEVID_SAS1064A:
+	case MPI_MANUFACTPAGE_DEVID_SAS1064E:
+	case MPI_MANUFACTPAGE_DEVID_SAS1066:
+	case MPI_MANUFACTPAGE_DEVID_SAS1066E:
+	case MPI_MANUFACTPAGE_DEVID_SAS1068:
+	case MPI_MANUFACTPAGE_DEVID_SAS1068A_FB:
+	case MPI_MANUFACTPAGE_DEVID_SAS1068E:
+	case MPI_MANUFACTPAGE_DEVID_SAS1078:
+	case MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB:
 		desc = "LSILogic SAS/SATA Adapter";
 		break;
 	default:
@@ -459,40 +390,35 @@ mpt_pci_attach(device_t dev)
 	uint32_t	  data, cmd;
 	int		  mpt_io_bar, mpt_mem_bar;
 
-	/* Allocate the softc structure */
 	mpt  = (struct mpt_softc*)device_get_softc(dev);
-	if (mpt == NULL) {
-		device_printf(dev, "cannot allocate softc\n");
-		return (ENOMEM);
-	}
-	memset(mpt, 0, sizeof(struct mpt_softc));
+
 	switch (pci_get_device(dev)) {
-	case PCI_PRODUCT_LSI_FC909:
-	case PCI_PRODUCT_LSI_FC909A:
-	case PCI_PRODUCT_LSI_FC919:
-	case PCI_PRODUCT_LSI_FC919_LAN:
-	case PCI_PRODUCT_LSI_FC929:
-	case PCI_PRODUCT_LSI_FC929_LAN:
-	case PCI_PRODUCT_LSI_FC929X:
-	case PCI_PRODUCT_LSI_FC929X_LAN:
-	case PCI_PRODUCT_LSI_FC919X:
-	case PCI_PRODUCT_LSI_FC919X_LAN:
-	case PCI_PRODUCT_LSI_FC646:
-	case PCI_PRODUCT_LSI_FC7X04X:
+	case MPI_MANUFACTPAGE_DEVICEID_FC909_FB:
+	case MPI_MANUFACTPAGE_DEVICEID_FC909:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929X:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919X:
+	case MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB:
+	case MPI_MANUFACTPAGE_DEVICEID_FC949E:
+	case MPI_MANUFACTPAGE_DEVICEID_FC949X:
 		mpt->is_fc = 1;
 		break;
-	case PCI_PRODUCT_LSI_SAS1078:
-	case PCI_PRODUCT_LSI_SAS1078DE:
+	case MPI_MANUFACTPAGE_DEVID_SAS1078:
+	case MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB:
 		mpt->is_1078 = 1;
 		/* FALLTHROUGH */
-	case PCI_PRODUCT_LSI_SAS1064:
-	case PCI_PRODUCT_LSI_SAS1064A:
-	case PCI_PRODUCT_LSI_SAS1064E:
-	case PCI_PRODUCT_LSI_SAS1066:
-	case PCI_PRODUCT_LSI_SAS1066E:
-	case PCI_PRODUCT_LSI_SAS1068:
-	case PCI_PRODUCT_LSI_SAS1068A:
-	case PCI_PRODUCT_LSI_SAS1068E:
+	case MPI_MANUFACTPAGE_DEVID_SAS1064:
+	case MPI_MANUFACTPAGE_DEVID_SAS1064A:
+	case MPI_MANUFACTPAGE_DEVID_SAS1064E:
+	case MPI_MANUFACTPAGE_DEVID_SAS1066:
+	case MPI_MANUFACTPAGE_DEVID_SAS1066E:
+	case MPI_MANUFACTPAGE_DEVID_SAS1068:
+	case MPI_MANUFACTPAGE_DEVID_SAS1068A_FB:
+	case MPI_MANUFACTPAGE_DEVID_SAS1068E:
 		mpt->is_sas = 1;
 		break;
 	default:
@@ -544,12 +470,12 @@ mpt_pci_attach(device_t dev)
 	 * If so, link with our partner (around yet)
 	 */
 	switch (pci_get_device(dev)) {
-	case PCI_PRODUCT_LSI_FC929:
-	case PCI_PRODUCT_LSI_FC929_LAN:
-	case PCI_PRODUCT_LSI_FC646:
-	case PCI_PRODUCT_LSI_FC7X04X:
-	case PCI_PRODUCT_LSI_1030:
-	case PCI_PRODUCT_LSI_1030ZC:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929:
+	case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB:
+	case MPI_MANUFACTPAGE_DEVICEID_FC949E:
+	case MPI_MANUFACTPAGE_DEVICEID_FC949X:
+	case MPI_MANUFACTPAGE_DEVID_53C1030:
+	case MPI_MANUFACTPAGE_DEVID_53C1030ZC:
 		mpt_link_peer(mpt);
 		break;
 	default:
@@ -588,7 +514,6 @@ mpt_pci_attach(device_t dev)
 		mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg);
 	}
 
-	/* Allocate kernel virtual memory for the 9x9's Mem0 region */
 	mpt_mem_bar = PCIR_BAR(mpt_mem_bar);
 	mpt->pci_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 	    &mpt_mem_bar, RF_ACTIVE);
@@ -660,6 +585,7 @@ mpt_pci_attach(device_t dev)
 		goto bad;
 	}
 
+#if 0
 	/*
 	 * Save the PCI config register values
  	 *
@@ -671,6 +597,7 @@ mpt_pci_attach(device_t dev)
 	 */
 
 	mpt_read_config_regs(mpt);
+#endif
 
 	/*
 	 * Disable PIO until we need it
@@ -888,6 +815,7 @@ mpt_dma_mem_free(struct mpt_softc *mpt)
 	mpt->request_pool = NULL;
 }
 
+#if 0
 /* Reads modifiable (via PCI transactions) config registers */
 static void
 mpt_read_config_regs(struct mpt_softc *mpt)
@@ -906,7 +834,6 @@ mpt_read_config_regs(struct mpt_softc *m
 	mpt->pci_cfg.PMCSR = pci_read_config(mpt->dev, 0x44, 4);
 }
 
-#if 0
 /* Sets modifiable config registers */
 static void
 mpt_set_config_regs(struct mpt_softc *mpt)

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 00:13:41 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BFF8A106566B;
	Sat, 31 Mar 2012 00:13:41 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 901598FC15;
	Sat, 31 Mar 2012 00:13:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V0Dfp4064837;
	Sat, 31 Mar 2012 00:13:41 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V0Dfcj064835;
	Sat, 31 Mar 2012 00:13:41 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203310013.q2V0Dfcj064835@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 00:13:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233723 - in stable/9/sys: i386/conf sparc64/pci
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 00:13:41 -0000

Author: marius
Date: Sat Mar 31 00:13:41 2012
New Revision: 233723
URL: http://svn.freebsd.org/changeset/base/233723

Log:
  MFC: r233421
  
  Given that this is a host-PCI-Express bridge driver, create the parent
  DMA tag with a 4 GB boundary as required by PCI-Express. With r232403
  (MFC'ed to stable/9 in r233393) in place this actually is redundant.
  However, the host-PCI-Express bridge driver is the more appropriate
  place for implementing this restriction.

Modified:
  stable/9/sys/sparc64/pci/fire.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/sparc64/pci/fire.c
==============================================================================
--- stable/9/sys/sparc64/pci/fire.c	Sat Mar 31 00:10:17 2012	(r233722)
+++ stable/9/sys/sparc64/pci/fire.c	Sat Mar 31 00:13:41 2012	(r233723)
@@ -764,7 +764,7 @@ fire_attach(device_t dev)
 	if (sc->sc_pci_cfgt == NULL)
 		panic("%s: could not allocate PCI configuration space tag",
 		    __func__);
-	if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0,
+	if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0x100000000,
 	    sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr,
 	    0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_pci_dmat) != 0)
 		panic("%s: could not create PCI DMA tag", __func__);

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 01:21:47 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5C9551065670;
	Sat, 31 Mar 2012 01:21:47 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D2968FC0C;
	Sat, 31 Mar 2012 01:21:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V1Ll5k070422;
	Sat, 31 Mar 2012 01:21:47 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V1LkMH070420;
	Sat, 31 Mar 2012 01:21:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203310121.q2V1LkMH070420@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 01:21:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233725 - in stable/9/sys: dev/e1000 i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 01:21:47 -0000

Author: marius
Date: Sat Mar 31 01:21:46 2012
New Revision: 233725
URL: http://svn.freebsd.org/changeset/base/233725

Log:
  MFC: r233423
  
  Initialize the mutexes used for the NVM and the swflag as MTX_DUPOK in
  order to avoid otherwise harmless witness warnings when these are acquired
  at the same time and due to both using MTX_NETWORK_LOCK as their type.
  The right fix actually would be to use different, descriptive types for
  these. However, the latter would require undesirable changes to the shared
  code base. Another approach would be to just supply NULL as the type, which
  was deemed as less desirable though as it would cause the unique but cryptic
  name also to be used for the type and to diverge from the type used by other
  network device drivers.

Modified:
  stable/9/sys/dev/e1000/e1000_osdep.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/e1000/e1000_osdep.h
==============================================================================
--- stable/9/sys/dev/e1000/e1000_osdep.h	Sat Mar 31 00:13:46 2012	(r233724)
+++ stable/9/sys/dev/e1000/e1000_osdep.h	Sat Mar 31 01:21:46 2012	(r233725)
@@ -84,7 +84,8 @@
 /* Mutex used in the shared code */
 #define E1000_MUTEX                     struct mtx
 #define E1000_MUTEX_INIT(mutex)         mtx_init((mutex), #mutex, \
-                                            MTX_NETWORK_LOCK, MTX_DEF)
+                                            MTX_NETWORK_LOCK, \
+                                            MTX_DEF | MTX_DUPOK)
 #define E1000_MUTEX_DESTROY(mutex)      mtx_destroy(mutex)
 #define E1000_MUTEX_LOCK(mutex)         mtx_lock(mutex)
 #define E1000_MUTEX_TRYLOCK(mutex)      mtx_trylock(mutex)

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 06:44:48 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EAE84106566B;
	Sat, 31 Mar 2012 06:44:48 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D45188FC08;
	Sat, 31 Mar 2012 06:44:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V6imIa088087;
	Sat, 31 Mar 2012 06:44:48 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V6imnR088079;
	Sat, 31 Mar 2012 06:44:48 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203310644.q2V6imnR088079@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 31 Mar 2012 06:44:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233728 - stable/9/sys/vm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 06:44:49 -0000

Author: kib
Date: Sat Mar 31 06:44:48 2012
New Revision: 233728
URL: http://svn.freebsd.org/changeset/base/233728

Log:
  MFC r233100:
  In vm_object_page_clean(), do not clean OBJ_MIGHTBEDIRTY object flag
  if the filesystem performed short write and we are skipping the page
  due to this.
  
  Propogate write error from the pager back to the callers of
  vm_pageout_flush().  Report the failure to write a page from the
  requested range as the FALSE return value from vm_object_page_clean(),
  and propagate it back to msync(2) to return EIO to usermode.
  
  While there, convert the clearobjflags variable in the
  vm_object_page_clean() and arguments of the helper functions to
  boolean.
  
  PR:	kern/165927

Modified:
  stable/9/sys/vm/vm_contig.c
  stable/9/sys/vm/vm_map.c
  stable/9/sys/vm/vm_mmap.c
  stable/9/sys/vm/vm_object.c
  stable/9/sys/vm/vm_object.h
  stable/9/sys/vm/vm_pageout.c
  stable/9/sys/vm/vm_pageout.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_contig.c
==============================================================================
--- stable/9/sys/vm/vm_contig.c	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_contig.c	Sat Mar 31 06:44:48 2012	(r233728)
@@ -139,7 +139,8 @@ vm_contig_launder_page(vm_page_t m, vm_p
 			   object->type == OBJT_DEFAULT) {
 			vm_page_unlock_queues();
 			m_tmp = m;
-			vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC, 0, NULL);
+			vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC, 0,
+			    NULL, NULL);
 			VM_OBJECT_UNLOCK(object);
 			vm_page_lock_queues();
 			return (0);

Modified: stable/9/sys/vm/vm_map.c
==============================================================================
--- stable/9/sys/vm/vm_map.c	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_map.c	Sat Mar 31 06:44:48 2012	(r233728)
@@ -2591,6 +2591,7 @@ vm_map_sync(
 	vm_object_t object;
 	vm_ooffset_t offset;
 	unsigned int last_timestamp;
+	boolean_t failed;
 
 	vm_map_lock_read(map);
 	VM_MAP_RANGE_CHECK(map, start, end);
@@ -2620,6 +2621,7 @@ vm_map_sync(
 
 	if (invalidate)
 		pmap_remove(map->pmap, start, end);
+	failed = FALSE;
 
 	/*
 	 * Make a second pass, cleaning/uncaching pages from the indicated
@@ -2648,7 +2650,8 @@ vm_map_sync(
 		vm_object_reference(object);
 		last_timestamp = map->timestamp;
 		vm_map_unlock_read(map);
-		vm_object_sync(object, offset, size, syncio, invalidate);
+		if (!vm_object_sync(object, offset, size, syncio, invalidate))
+			failed = TRUE;
 		start += size;
 		vm_object_deallocate(object);
 		vm_map_lock_read(map);
@@ -2658,7 +2661,7 @@ vm_map_sync(
 	}
 
 	vm_map_unlock_read(map);
-	return (KERN_SUCCESS);
+	return (failed ? KERN_FAILURE : KERN_SUCCESS);
 }
 
 /*

Modified: stable/9/sys/vm/vm_mmap.c
==============================================================================
--- stable/9/sys/vm/vm_mmap.c	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_mmap.c	Sat Mar 31 06:44:48 2012	(r233728)
@@ -509,6 +509,8 @@ sys_msync(td, uap)
 		return (EINVAL);	/* Sun returns ENOMEM? */
 	case KERN_INVALID_ARGUMENT:
 		return (EBUSY);
+	case KERN_FAILURE:
+		return (EIO);
 	default:
 		return (EINVAL);
 	}

Modified: stable/9/sys/vm/vm_object.c
==============================================================================
--- stable/9/sys/vm/vm_object.c	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_object.c	Sat Mar 31 06:44:48 2012	(r233728)
@@ -101,9 +101,10 @@ SYSCTL_INT(_vm, OID_AUTO, old_msync, CTL
     "Use old (insecure) msync behavior");
 
 static int	vm_object_page_collect_flush(vm_object_t object, vm_page_t p,
-		    int pagerflags, int flags, int *clearobjflags);
+		    int pagerflags, int flags, boolean_t *clearobjflags,
+		    boolean_t *eio);
 static boolean_t vm_object_page_remove_write(vm_page_t p, int flags,
-		    int *clearobjflags);
+		    boolean_t *clearobjflags);
 static void	vm_object_qcollapse(vm_object_t object);
 static void	vm_object_vndeallocate(vm_object_t object);
 
@@ -774,7 +775,7 @@ vm_object_terminate(vm_object_t object)
  * page should be flushed, and FALSE otherwise.
  */
 static boolean_t
-vm_object_page_remove_write(vm_page_t p, int flags, int *clearobjflags)
+vm_object_page_remove_write(vm_page_t p, int flags, boolean_t *clearobjflags)
 {
 
 	/*
@@ -783,7 +784,7 @@ vm_object_page_remove_write(vm_page_t p,
 	 * cleared in this case so we do not have to set them.
 	 */
 	if ((flags & OBJPC_NOSYNC) != 0 && (p->oflags & VPO_NOSYNC) != 0) {
-		*clearobjflags = 0;
+		*clearobjflags = FALSE;
 		return (FALSE);
 	} else {
 		pmap_remove_write(p);
@@ -805,21 +806,25 @@ vm_object_page_remove_write(vm_page_t p,
  *	Odd semantics: if start == end, we clean everything.
  *
  *	The object must be locked.
+ *
+ *	Returns FALSE if some page from the range was not written, as
+ *	reported by the pager, and TRUE otherwise.
  */
-void
+boolean_t
 vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end,
     int flags)
 {
 	vm_page_t np, p;
 	vm_pindex_t pi, tend, tstart;
-	int clearobjflags, curgeneration, n, pagerflags;
+	int curgeneration, n, pagerflags;
+	boolean_t clearobjflags, eio, res;
 
 	mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED);
 	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
 	KASSERT(object->type == OBJT_VNODE, ("Not a vnode object"));
 	if ((object->flags & OBJ_MIGHTBEDIRTY) == 0 ||
 	    object->resident_page_count == 0)
-		return;
+		return (TRUE);
 
 	pagerflags = (flags & (OBJPC_SYNC | OBJPC_INVAL)) != 0 ?
 	    VM_PAGER_PUT_SYNC : VM_PAGER_CLUSTER_OK;
@@ -828,6 +833,7 @@ vm_object_page_clean(vm_object_t object,
 	tstart = OFF_TO_IDX(start);
 	tend = (end == 0) ? object->size : OFF_TO_IDX(end + PAGE_MASK);
 	clearobjflags = tstart == 0 && tend >= object->size;
+	res = TRUE;
 
 rescan:
 	curgeneration = object->generation;
@@ -844,7 +850,7 @@ rescan:
 				if ((flags & OBJPC_SYNC) != 0)
 					goto rescan;
 				else
-					clearobjflags = 0;
+					clearobjflags = FALSE;
 			}
 			np = vm_page_find_least(object, pi);
 			continue;
@@ -853,12 +859,16 @@ rescan:
 			continue;
 
 		n = vm_object_page_collect_flush(object, p, pagerflags,
-		    flags, &clearobjflags);
+		    flags, &clearobjflags, &eio);
+		if (eio) {
+			res = FALSE;
+			clearobjflags = FALSE;
+		}
 		if (object->generation != curgeneration) {
 			if ((flags & OBJPC_SYNC) != 0)
 				goto rescan;
 			else
-				clearobjflags = 0;
+				clearobjflags = FALSE;
 		}
 
 		/*
@@ -873,8 +883,10 @@ rescan:
 		 * behind, but there is not much we can do there if
 		 * filesystem refuses to write it.
 		 */
-		if (n == 0)
+		if (n == 0) {
 			n = 1;
+			clearobjflags = FALSE;
+		}
 		np = vm_page_find_least(object, pi + n);
 	}
 #if 0
@@ -883,11 +895,12 @@ rescan:
 
 	if (clearobjflags)
 		vm_object_clear_flag(object, OBJ_MIGHTBEDIRTY);
+	return (res);
 }
 
 static int
 vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags,
-    int flags, int *clearobjflags)
+    int flags, boolean_t *clearobjflags, boolean_t *eio)
 {
 	vm_page_t ma[vm_pageout_page_count], p_first, tp;
 	int count, i, mreq, runlen;
@@ -920,7 +933,7 @@ vm_object_page_collect_flush(vm_object_t
 	for (tp = p_first, i = 0; i < count; tp = TAILQ_NEXT(tp, listq), i++)
 		ma[i] = tp;
 
-	vm_pageout_flush(ma, count, pagerflags, mreq, &runlen);
+	vm_pageout_flush(ma, count, pagerflags, mreq, &runlen, eio);
 	return (runlen);
 }
 
@@ -938,17 +951,20 @@ vm_object_page_collect_flush(vm_object_t
  * Note: certain anonymous maps, such as MAP_NOSYNC maps,
  * may start out with a NULL object.
  */
-void
+boolean_t
 vm_object_sync(vm_object_t object, vm_ooffset_t offset, vm_size_t size,
     boolean_t syncio, boolean_t invalidate)
 {
 	vm_object_t backing_object;
 	struct vnode *vp;
 	struct mount *mp;
-	int flags, fsync_after;
+	int error, flags, fsync_after;
+	boolean_t res;
 
 	if (object == NULL)
-		return;
+		return (TRUE);
+	res = TRUE;
+	error = 0;
 	VM_OBJECT_LOCK(object);
 	while ((backing_object = object->backing_object) != NULL) {
 		VM_OBJECT_LOCK(backing_object);
@@ -994,13 +1010,16 @@ vm_object_sync(vm_object_t object, vm_oo
 			fsync_after = FALSE;
 		}
 		VM_OBJECT_LOCK(object);
-		vm_object_page_clean(object, offset, offset + size, flags);
+		res = vm_object_page_clean(object, offset, offset + size,
+		    flags);
 		VM_OBJECT_UNLOCK(object);
 		if (fsync_after)
-			(void) VOP_FSYNC(vp, MNT_WAIT, curthread);
+			error = VOP_FSYNC(vp, MNT_WAIT, curthread);
 		VOP_UNLOCK(vp, 0);
 		VFS_UNLOCK_GIANT(vfslocked);
 		vn_finished_write(mp);
+		if (error != 0)
+			res = FALSE;
 		VM_OBJECT_LOCK(object);
 	}
 	if ((object->type == OBJT_VNODE ||
@@ -1020,6 +1039,7 @@ vm_object_sync(vm_object_t object, vm_oo
 		    OFF_TO_IDX(offset + size + PAGE_MASK), flags);
 	}
 	VM_OBJECT_UNLOCK(object);
+	return (res);
 }
 
 /*

Modified: stable/9/sys/vm/vm_object.h
==============================================================================
--- stable/9/sys/vm/vm_object.h	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_object.h	Sat Mar 31 06:44:48 2012	(r233728)
@@ -228,7 +228,7 @@ void vm_object_set_writeable_dirty (vm_o
 void vm_object_init (void);
 void vm_object_page_cache(vm_object_t object, vm_pindex_t start,
     vm_pindex_t end);
-void vm_object_page_clean(vm_object_t object, vm_ooffset_t start,
+boolean_t vm_object_page_clean(vm_object_t object, vm_ooffset_t start,
     vm_ooffset_t end, int flags);
 void vm_object_page_remove(vm_object_t object, vm_pindex_t start,
     vm_pindex_t end, int options);
@@ -239,7 +239,7 @@ void vm_object_reference_locked(vm_objec
 int  vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr);
 void vm_object_shadow (vm_object_t *, vm_ooffset_t *, vm_size_t);
 void vm_object_split(vm_map_entry_t);
-void vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t,
+boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t,
     boolean_t);
 void vm_object_madvise (vm_object_t, vm_pindex_t, int, int);
 #endif				/* _KERNEL */

Modified: stable/9/sys/vm/vm_pageout.c
==============================================================================
--- stable/9/sys/vm/vm_pageout.c	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_pageout.c	Sat Mar 31 06:44:48 2012	(r233728)
@@ -445,7 +445,8 @@ more:
 	/*
 	 * we allow reads during pageouts...
 	 */
-	return (vm_pageout_flush(&mc[page_base], pageout_count, 0, 0, NULL));
+	return (vm_pageout_flush(&mc[page_base], pageout_count, 0, 0, NULL,
+	    NULL));
 }
 
 /*
@@ -459,9 +460,12 @@ more:
  *
  *	Returned runlen is the count of pages between mreq and first
  *	page after mreq with status VM_PAGER_AGAIN.
+ *	*eio is set to TRUE if pager returned VM_PAGER_ERROR or VM_PAGER_FAIL
+ *	for any page in runlen set.
  */
 int
-vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen)
+vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen,
+    boolean_t *eio)
 {
 	vm_object_t object = mc[0]->object;
 	int pageout_status[count];
@@ -493,6 +497,8 @@ vm_pageout_flush(vm_page_t *mc, int coun
 	vm_pager_put_pages(object, mc, count, flags, pageout_status);
 
 	runlen = count - mreq;
+	if (eio != NULL)
+		*eio = FALSE;
 	for (i = 0; i < count; i++) {
 		vm_page_t mt = mc[i];
 
@@ -522,6 +528,8 @@ vm_pageout_flush(vm_page_t *mc, int coun
 			vm_page_lock(mt);
 			vm_page_activate(mt);
 			vm_page_unlock(mt);
+			if (eio != NULL && i >= mreq && i - mreq < runlen)
+				*eio = TRUE;
 			break;
 		case VM_PAGER_AGAIN:
 			if (i >= mreq && i - mreq < runlen)

Modified: stable/9/sys/vm/vm_pageout.h
==============================================================================
--- stable/9/sys/vm/vm_pageout.h	Sat Mar 31 01:21:54 2012	(r233727)
+++ stable/9/sys/vm/vm_pageout.h	Sat Mar 31 06:44:48 2012	(r233728)
@@ -102,7 +102,7 @@ extern void vm_waitpfault(void);
 
 #ifdef _KERNEL
 boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *);
-int vm_pageout_flush(vm_page_t *, int, int, int, int *);
+int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *);
 void vm_pageout_oom(int shortage);
 boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *);
 void vm_contig_grow_cache(int, vm_paddr_t, vm_paddr_t);

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 06:50:28 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D43E1106564A;
	Sat, 31 Mar 2012 06:50:28 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A53B08FC0C;
	Sat, 31 Mar 2012 06:50:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V6oS5k088342;
	Sat, 31 Mar 2012 06:50:28 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V6oSiB088339;
	Sat, 31 Mar 2012 06:50:28 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203310650.q2V6oSiB088339@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 31 Mar 2012 06:50:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233730 - stable/9/sys/fs/nfsclient
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 06:50:28 -0000

Author: kib
Date: Sat Mar 31 06:50:27 2012
New Revision: 233730
URL: http://svn.freebsd.org/changeset/base/233730

Log:
  MFC r233101:
  Add sysctl vfs.nfs.nfs_keep_dirty_on_error to switch the nfs client
  behaviour on error from write RPC back to behaviour of old nfs client.
  When set to not zero, the pages for which write failed are kept dirty.
  
  PR:	kern/165927

Modified:
  stable/9/sys/fs/nfsclient/nfs_clbio.c
  stable/9/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clbio.c	Sat Mar 31 06:48:41 2012	(r233729)
+++ stable/9/sys/fs/nfsclient/nfs_clbio.c	Sat Mar 31 06:50:27 2012	(r233730)
@@ -66,6 +66,7 @@ extern int ncl_numasync;
 extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
 extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON];
 extern int newnfs_directio_enable;
+extern int nfs_keep_dirty_on_error;
 
 int ncl_pbuf_freecnt = -1;	/* start out unlimited */
 
@@ -348,9 +349,11 @@ ncl_putpages(struct vop_putpages_args *a
 	pmap_qremove(kva, npages);
 	relpbuf(bp, &ncl_pbuf_freecnt);
 
-	vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid);
-	if (must_commit)
-		ncl_clearcommit(vp->v_mount);
+	if (error == 0 || !nfs_keep_dirty_on_error) {
+		vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid);
+		if (must_commit)
+			ncl_clearcommit(vp->v_mount);
+	}
 	return rtvals[0];
 }
 

Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clvnops.c	Sat Mar 31 06:48:41 2012	(r233729)
+++ stable/9/sys/fs/nfsclient/nfs_clvnops.c	Sat Mar 31 06:50:27 2012	(r233730)
@@ -241,6 +241,10 @@ int newnfs_directio_enable = 0;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
 	   &newnfs_directio_enable, 0, "Enable NFS directio");
 
+int nfs_keep_dirty_on_error;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_keep_dirty_on_error, CTLFLAG_RW,
+    &nfs_keep_dirty_on_error, 0, "Retry pageout if error returned");
+
 /*
  * This sysctl allows other processes to mmap a file that has been opened
  * O_DIRECT by a process.  In general, having processes mmap the file while

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 06:53:52 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD1D81065670;
	Sat, 31 Mar 2012 06:53:52 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B888B8FC15;
	Sat, 31 Mar 2012 06:53:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V6rqhg088550;
	Sat, 31 Mar 2012 06:53:52 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V6rq2B088547;
	Sat, 31 Mar 2012 06:53:52 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203310653.q2V6rq2B088547@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 31 Mar 2012 06:53:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233731 - stable/9/lib/libc/sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 06:53:52 -0000

Author: kib
Date: Sat Mar 31 06:53:52 2012
New Revision: 233731
URL: http://svn.freebsd.org/changeset/base/233731

Log:
  MFC r233102:
  Do not claim that msync(2) is obsoleted.
  Document EIO from msync(2).

Modified:
  stable/9/lib/libc/sys/mmap.2
  stable/9/lib/libc/sys/msync.2
Directory Properties:
  stable/9/lib/libc/   (props changed)
  stable/9/lib/libc/sys/   (props changed)

Modified: stable/9/lib/libc/sys/mmap.2
==============================================================================
--- stable/9/lib/libc/sys/mmap.2	Sat Mar 31 06:50:27 2012	(r233730)
+++ stable/9/lib/libc/sys/mmap.2	Sat Mar 31 06:53:52 2012	(r233731)
@@ -28,7 +28,7 @@
 .\"	@(#)mmap.2	8.4 (Berkeley) 5/11/95
 .\" $FreeBSD$
 .\"
-.Dd August 28, 2010
+.Dd March 18, 2012
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -205,7 +205,7 @@ command and
 system call generally do not flush dirty NOSYNC VM data.
 The
 .Xr msync 2
-system call is obsolete since
+system call is usually not needed since
 .Bx
 implements a coherent file system buffer cache.
 However, it may be

Modified: stable/9/lib/libc/sys/msync.2
==============================================================================
--- stable/9/lib/libc/sys/msync.2	Sat Mar 31 06:50:27 2012	(r233730)
+++ stable/9/lib/libc/sys/msync.2	Sat Mar 31 06:53:52 2012	(r233731)
@@ -28,7 +28,7 @@
 .\"	@(#)msync.2	8.2 (Berkeley) 6/21/94
 .\" $FreeBSD$
 .\"
-.Dd June 21, 1994
+.Dd March 18, 2012
 .Dt MSYNC 2
 .Os
 .Sh NAME
@@ -98,6 +98,9 @@ The
 argument
 was both MS_ASYNC and MS_INVALIDATE.
 Only one of these flags is allowed.
+.It Bq Er EIO
+ An error occurred while writing at least one of the pages in
+the specified region.
 .El
 .Sh SEE ALSO
 .Xr madvise 2 ,
@@ -113,7 +116,7 @@ system call first appeared in
 .Sh BUGS
 The
 .Fn msync
-system call is obsolete since
+system call is usually not needed since
 .Bx
 implements a coherent file system buffer cache.
 However, it may be used to associate dirty VM pages with file system

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 06:58:17 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B8F1106566C;
	Sat, 31 Mar 2012 06:58:17 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0510B8FC0A;
	Sat, 31 Mar 2012 06:58:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V6wGto088741;
	Sat, 31 Mar 2012 06:58:16 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V6wGJW088739;
	Sat, 31 Mar 2012 06:58:16 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203310658.q2V6wGJW088739@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 31 Mar 2012 06:58:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233732 - stable/9/sys/ufs/ffs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 06:58:17 -0000

Author: kib
Date: Sat Mar 31 06:58:16 2012
New Revision: 233732
URL: http://svn.freebsd.org/changeset/base/233732

Log:
  MFC r233607:
  Update comment.

Modified:
  stable/9/sys/ufs/ffs/ffs_vfsops.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_vfsops.c	Sat Mar 31 06:53:52 2012	(r233731)
+++ stable/9/sys/ufs/ffs/ffs_vfsops.c	Sat Mar 31 06:58:16 2012	(r233732)
@@ -1479,7 +1479,7 @@ loop:
 
 	MNT_VNODE_FOREACH(vp, mp, mvp) {
 		/*
-		 * Depend on the mntvnode_slock to keep things stable enough
+		 * Depend on the vnode interlock to keep things stable enough
 		 * for a quick test.  Since there might be hundreds of
 		 * thousands of vnodes, we cannot afford even a subroutine
 		 * call unless there's a good chance that we have work to do.

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 08:44:27 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7339106566B;
	Sat, 31 Mar 2012 08:44:27 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B23348FC08;
	Sat, 31 Mar 2012 08:44:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V8iRsh092102;
	Sat, 31 Mar 2012 08:44:27 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V8iRXV092100;
	Sat, 31 Mar 2012 08:44:27 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201203310844.q2V8iRXV092100@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Sat, 31 Mar 2012 08:44:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233735 - stable/9/sbin/ifconfig
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 08:44:27 -0000

Author: bschmidt
Date: Sat Mar 31 08:44:27 2012
New Revision: 233735
URL: http://svn.freebsd.org/changeset/base/233735

Log:
  MFC r233328,r233382:
  Fix incorrect parameter usage.
  
  Submitted by:	Monthadar Al Jaberi

Modified:
  stable/9/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/9/sbin/ifconfig/   (props changed)

Modified: stable/9/sbin/ifconfig/ifieee80211.c
==============================================================================
--- stable/9/sbin/ifconfig/ifieee80211.c	Sat Mar 31 07:10:16 2012	(r233734)
+++ stable/9/sbin/ifconfig/ifieee80211.c	Sat Mar 31 08:44:27 2012	(r233735)
@@ -1849,13 +1849,13 @@ DECL_CMD_FUNC(set80211meshttl, val, d)
 static
 DECL_CMD_FUNC(set80211meshforward, val, d)
 {
-	set80211(s, IEEE80211_IOC_MESH_FWRD, atoi(val), 0, NULL);
+	set80211(s, IEEE80211_IOC_MESH_FWRD, d, 0, NULL);
 }
 
 static
 DECL_CMD_FUNC(set80211meshpeering, val, d)
 {
-	set80211(s, IEEE80211_IOC_MESH_AP, atoi(val), 0, NULL);
+	set80211(s, IEEE80211_IOC_MESH_AP, d, 0, NULL);
 }
 
 static

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 10:20:48 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id EBD011065672;
	Sat, 31 Mar 2012 10:20:48 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D6D468FC15;
	Sat, 31 Mar 2012 10:20:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VAKmcD095674;
	Sat, 31 Mar 2012 10:20:48 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VAKmlO095672;
	Sat, 31 Mar 2012 10:20:48 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203311020.q2VAKmlO095672@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 10:20:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233737 - stable/9/share/man/man4
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 10:20:49 -0000

Author: marius
Date: Sat Mar 31 10:20:48 2012
New Revision: 233737
URL: http://svn.freebsd.org/changeset/base/233737

Log:
  MFC: r233426
  
  Add QGE-X to the list of known-working cards.

Modified:
  stable/9/share/man/man4/cas.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/cas.4
==============================================================================
--- stable/9/share/man/man4/cas.4	Sat Mar 31 08:46:11 2012	(r233736)
+++ stable/9/share/man/man4/cas.4	Sat Mar 31 10:20:48 2012	(r233737)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 3, 2010
+.Dd March 24, 2012
 .Dt CAS 4
 .Os
 .Sh NAME
@@ -102,6 +102,9 @@ Sun GigaSwift Ethernet UTP (GCS)
 .It
 Sun Quad GigaSwift Ethernet UTP (QGE)
 (part no.\& 501-6522)
+.It
+Sun Quad GigaSwift Ethernet PCI-X (QGE-X)
+(part no.\& 501-6738)
 .El
 .Sh NOTES
 On sparc64 the

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 10:26:58 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC388106564A;
	Sat, 31 Mar 2012 10:26:58 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D47248FC15;
	Sat, 31 Mar 2012 10:26:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VAQwI8096013;
	Sat, 31 Mar 2012 10:26:58 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VAQwGm095999;
	Sat, 31 Mar 2012 10:26:58 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203311026.q2VAQwGm095999@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 10:26:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233740 - in stable/9/sys: dev/mpt/mpilib i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 10:26:59 -0000

Author: marius
Date: Sat Mar 31 10:26:58 2012
New Revision: 233740
URL: http://svn.freebsd.org/changeset/base/233740

Log:
  MFC: r233425
  
  Consistently update to the MPI header set version 01.05.20 after r224761.
  Requested by:	mjacob

Added:
  stable/9/sys/dev/mpt/mpilib/mpi_log_fc.h
     - copied unchanged from r233425, head/sys/dev/mpt/mpilib/mpi_log_fc.h
  stable/9/sys/dev/mpt/mpilib/mpi_log_sas.h
     - copied unchanged from r233425, head/sys/dev/mpt/mpilib/mpi_log_sas.h
Deleted:
  stable/9/sys/dev/mpt/mpilib/mpi_inb.h
Modified:
  stable/9/sys/dev/mpt/mpilib/mpi.h
  stable/9/sys/dev/mpt/mpilib/mpi_cnfg.h
  stable/9/sys/dev/mpt/mpilib/mpi_fc.h
  stable/9/sys/dev/mpt/mpilib/mpi_init.h
  stable/9/sys/dev/mpt/mpilib/mpi_ioc.h
  stable/9/sys/dev/mpt/mpilib/mpi_lan.h
  stable/9/sys/dev/mpt/mpilib/mpi_raid.h
  stable/9/sys/dev/mpt/mpilib/mpi_sas.h
  stable/9/sys/dev/mpt/mpilib/mpi_targ.h
  stable/9/sys/dev/mpt/mpilib/mpi_tool.h
  stable/9/sys/dev/mpt/mpilib/mpi_type.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/mpt/mpilib/mpi.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
  *          Title:  MPI Message independent structures and definitions
  *  Creation Date:  July 27, 2000
  *
- *    mpi.h Version:  01.05.13
+ *    mpi.h Version:  01.05.17
  *
  *  Version History
  *  ---------------
@@ -106,6 +106,10 @@
  *  03-27-06  01.05.11  Bumped MPI_HEADER_VERSION_UNIT.
  *  10-11-06  01.05.12  Bumped MPI_HEADER_VERSION_UNIT.
  *  05-24-07  01.05.13  Bumped MPI_HEADER_VERSION_UNIT.
+ *  08-07-07  01.05.14  Bumped MPI_HEADER_VERSION_UNIT.
+ *  01-15-08  01.05.15  Bumped MPI_HEADER_VERSION_UNIT.
+ *  03-28-08  01.05.16  Bumped MPI_HEADER_VERSION_UNIT.
+ *  07-11-08  01.05.17  Bumped MPI_HEADER_VERSION_UNIT.
  *  --------------------------------------------------------------------------
  */
 
@@ -136,7 +140,7 @@
 /* Note: The major versions of 0xe0 through 0xff are reserved */
 
 /* versioning for this MPI header set */
-#define MPI_HEADER_VERSION_UNIT             (0x10)
+#define MPI_HEADER_VERSION_UNIT             (0x14)
 #define MPI_HEADER_VERSION_DEV              (0x00)
 #define MPI_HEADER_VERSION_UNIT_MASK        (0xFF00)
 #define MPI_HEADER_VERSION_UNIT_SHIFT       (8)

Modified: stable/9/sys/dev/mpt/mpilib/mpi_cnfg.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_cnfg.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_cnfg.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
  *          Title:  MPI Config message, structures, and Pages
  *  Creation Date:  July 27, 2000
  *
- *    mpi_cnfg.h Version:  01.05.15
+ *    mpi_cnfg.h Version:  01.05.19
  *
  *  Version History
  *  ---------------
@@ -335,6 +335,28 @@
  *                      Expander Page 0 Flags field.
  *                      Fixed define for
  *                      MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
+ *  08-07-07  01.05.16  Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
+ *                      define.
+ *                      Added BIOS Page 4 structure.
+ *                      Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
+ *                      Physcial Disk Page 1.
+ *  01-15-07  01.05.17  Added additional bit defines for ExtFlags field of
+ *                      Manufacturing Page 4.
+ *                      Added Solid State Drives Supported bit to IOC Page 6
+ *                      Capabilities Flags.
+ *                      Added new value for AccessStatus field of SAS Device
+ *                      Page 0 (_SATA_NEEDS_INITIALIZATION).
+ *  03-28-08  01.05.18  Defined new bits in Manufacturing Page 4 ExtFlags field
+ *                      to control coercion size and the mixing of SAS and SATA
+ *                      SSD drives.
+ *  07-11-08  01.05.19  Added defines MPI_MANPAGE4_EXTFLAGS_RAID0_SINGLE_DRIVE
+ *                      and MPI_MANPAGE4_EXTFLAGS_SSD_SCRUB_DISABLE for ExtFlags
+ *                      field of Manufacturing Page 4.
+ *                      Added defines for a new bit in BIOS Page 1 BiosOptions
+ *                      field to control adapter scan order.
+ *                      Added BootDeviceWaitTime field to SAS IO Unit Page 2.
+ *                      Added MPI_SAS_PHY0_PHYINFO_PHY_VACANT for use in PhyInfo
+ *                      field of SAS Expander Page 1.
  *  --------------------------------------------------------------------------
  */
 
@@ -713,6 +735,16 @@ typedef struct _CONFIG_PAGE_MANUFACTURIN
 #define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA                 (0x01)
 
 /* defines for the ExtFlags field */
+#define MPI_MANPAGE4_EXTFLAGS_RAID0_SINGLE_DRIVE        (0x0400)
+#define MPI_MANPAGE4_EXTFLAGS_SSD_SCRUB_DISABLE         (0x0200)
+#define MPI_MANPAGE4_EXTFLAGS_MASK_COERCION_SIZE        (0x0180)
+#define MPI_MANPAGE4_EXTFLAGS_SHIFT_COERCION_SIZE       (7)
+#define MPI_MANPAGE4_EXTFLAGS_1GB_COERCION_SIZE         (0)
+#define MPI_MANPAGE4_EXTFLAGS_128MB_COERCION_SIZE       (1)
+
+#define MPI_MANPAGE4_EXTFLAGS_NO_MIX_SSD_SAS_SATA       (0x0040)
+#define MPI_MANPAGE4_EXTFLAGS_MIX_SSD_AND_NON_SSD       (0x0020)
+#define MPI_MANPAGE4_EXTFLAGS_DUAL_PORT_SUPPORT         (0x0010)
 #define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA      (0x0008)
 #define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE         (0x0004)
 #define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE        (0x0002)
@@ -1186,6 +1218,8 @@ typedef struct _CONFIG_PAGE_IOC_6
 
 /* IOC Page 6 Capabilities Flags */
 
+#define MPI_IOCPAGE6_CAP_FLAGS_SSD_SUPPORT              (0x00000020)
+#define MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT  (0x00000010)
 #define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING    (0x00000008)
 
 #define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE       (0x00000006)
@@ -1222,6 +1256,10 @@ typedef struct _CONFIG_PAGE_BIOS_1
 #define MPI_BIOSPAGE1_OPTIONS_SPI_ENABLE                (0x00000400)
 #define MPI_BIOSPAGE1_OPTIONS_FC_ENABLE                 (0x00000200)
 #define MPI_BIOSPAGE1_OPTIONS_SAS_ENABLE                (0x00000100)
+
+#define MPI_BIOSPAGE1_OPTIONS_SCAN_HIGH_TO_LOW          (0x00000002)
+#define MPI_BIOSPAGE1_OPTIONS_SCAN_LOW_TO_HIGH          (0x00000000)
+
 #define MPI_BIOSPAGE1_OPTIONS_DISABLE_BIOS              (0x00000001)
 
 /* values for the IOCSettings field */
@@ -1455,6 +1493,15 @@ typedef struct _CONFIG_PAGE_BIOS_2
 #define MPI_BIOSPAGE2_FORM_SAS_WWN                      (0x05)
 #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT               (0x06)
 
+typedef struct _CONFIG_PAGE_BIOS_4
+{
+    CONFIG_PAGE_HEADER      Header;                     /* 00h */
+    U64                     ReassignmentBaseWWID;       /* 04h */
+} CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4,
+  BIOSPage4_t, MPI_POINTER pBIOSPage4_t;
+
+#define MPI_BIOSPAGE4_PAGEVERSION                       (0x00)
+
 
 /****************************************************************************
 *   SCSI Port Config Pages
@@ -2446,6 +2493,15 @@ typedef struct _RAID_PHYS_DISK1_PATH
 #define MPI_RAID_PHYSDISK1_FLAG_BROKEN          (0x0002)
 #define MPI_RAID_PHYSDISK1_FLAG_INVALID         (0x0001)
 
+
+/*
+ * Host code (drivers, BIOS, utilities, etc.) should leave this define set to
+ * one and check Header.PageLength or NumPhysDiskPaths at runtime.
+ */
+#ifndef MPI_RAID_PHYS_DISK1_PATH_MAX
+#define MPI_RAID_PHYS_DISK1_PATH_MAX    (1)
+#endif
+
 typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
 {
     CONFIG_PAGE_HEADER              Header;             /* 00h */
@@ -2453,7 +2509,7 @@ typedef struct _CONFIG_PAGE_RAID_PHYS_DI
     U8                              PhysDiskNum;        /* 05h */
     U16                             Reserved2;          /* 06h */
     U32                             Reserved1;          /* 08h */
-    RAID_PHYS_DISK1_PATH            Path[1];            /* 0Ch */
+    RAID_PHYS_DISK1_PATH            Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */
 } CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1,
   RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t;
 
@@ -2578,6 +2634,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_
 #define MPI_SAS_IOUNIT0_RATE_SATA_OOB_COMPLETE              (0x03)
 #define MPI_SAS_IOUNIT0_RATE_1_5                            (0x08)
 #define MPI_SAS_IOUNIT0_RATE_3_0                            (0x09)
+#define MPI_SAS_IOUNIT0_RATE_6_0                            (0x0A)
 
 /* see mpi_sas.h for values for SAS IO Unit Page 0 ControllerPhyDeviceInfo values */
 
@@ -2697,7 +2754,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_
 {
     CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */
     U8                                  NumDevsPerEnclosure;    /* 08h */
-    U8                                  Reserved1;              /* 09h */
+    U8                                  BootDeviceWaitTime;     /* 09h */
     U16                                 Reserved2;              /* 0Ah */
     U16                                 MaxPersistentIDs;       /* 0Ch */
     U16                                 NumPersistentIDsUsed;   /* 0Eh */
@@ -2707,7 +2764,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_
 } CONFIG_PAGE_SAS_IO_UNIT_2, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_2,
   SasIOUnitPage2_t, MPI_POINTER pSasIOUnitPage2_t;
 
-#define MPI_SASIOUNITPAGE2_PAGEVERSION      (0x06)
+#define MPI_SASIOUNITPAGE2_PAGEVERSION      (0x07)
 
 /* values for SAS IO Unit Page 2 Status field */
 #define MPI_SAS_IOUNIT2_STATUS_DEVICE_LIMIT_EXCEEDED        (0x08)
@@ -2871,6 +2928,7 @@ typedef struct _CONFIG_PAGE_SAS_DEVICE_0
 #define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED            (0x01)
 #define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED      (0x02)
 #define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT   (0x03)
+#define MPI_SAS_DEVICE0_ASTATUS_SATA_NEEDS_INITIALIZATION   (0x04)
 /* specific values for SATA Init failures */
 #define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN                 (0x10)
 #define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT    (0x11)
@@ -2981,6 +3039,7 @@ typedef struct _CONFIG_PAGE_SAS_PHY_0
 #define MPI_SAS_PHY0_FLAGS_SGPIO_DIRECT_ATTACH_ENC              (0x01)
 
 /* values for SAS PHY Page 0 PhyInfo field */
+#define MPI_SAS_PHY0_PHYINFO_PHY_VACANT                         (0x80000000)
 #define MPI_SAS_PHY0_PHYINFO_SATA_PORT_ACTIVE                   (0x00004000)
 #define MPI_SAS_PHY0_PHYINFO_SATA_PORT_SELECTOR                 (0x00002000)
 #define MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY                        (0x00001000)

Modified: stable/9/sys/dev/mpt/mpilib/mpi_fc.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_fc.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_fc.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/sys/dev/mpt/mpilib/mpi_init.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_init.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_init.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/sys/dev/mpt/mpilib/mpi_ioc.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_ioc.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_ioc.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -868,6 +868,7 @@ typedef struct _EVENT_DATA_SAS_PHY_LINK_
 #define MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE         (0x03)
 #define MPI_EVENT_SAS_PLS_LR_RATE_1_5                       (0x08)
 #define MPI_EVENT_SAS_PLS_LR_RATE_3_0                       (0x09)
+#define MPI_EVENT_SAS_PLS_LR_RATE_6_0                       (0x0A)
 
 /* SAS Discovery Event data */
 

Modified: stable/9/sys/dev/mpt/mpilib/mpi_lan.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_lan.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_lan.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without

Copied: stable/9/sys/dev/mpt/mpilib/mpi_log_fc.h (from r233425, head/sys/dev/mpt/mpilib/mpi_log_fc.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/sys/dev/mpt/mpilib/mpi_log_fc.h	Sat Mar 31 10:26:58 2012	(r233740, copy of r233425, head/sys/dev/mpt/mpilib/mpi_log_fc.h)
@@ -0,0 +1,117 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon including
+ *    a substantially similar Disclaimer requirement for further binary
+ *    redistribution.
+ * 3. Neither the name of the LSI Logic Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
+ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  NAME:           fc_log.h
+ *  SUMMARY:        MPI IocLogInfo definitions for the SYMFC9xx chips
+ *  DESCRIPTION:    Contains the enumerated list of values that may be returned
+ *                  in the IOCLogInfo field of a MPI Default Reply Message.
+ *
+ *  CREATION DATE:  6/02/2000
+ *  ID:             $Id: fc_log.h,v 4.6 2001/07/26 14:41:33 sschremm Exp $
+ */
+
+
+/*
+ * MpiIocLogInfo_t enum
+ *
+ * These 32 bit values are used in the IOCLogInfo field of the MPI reply
+ * messages.
+ * The value is 0xabcccccc where
+ *          a = The type of log info as per the MPI spec. Since these codes are
+ *              all for Fibre Channel this value will always be 2.
+ *          b = Specifies a subclass of the firmware where
+ *                  0 = FCP Initiator
+ *                  1 = FCP Target
+ *                  2 = LAN
+ *                  3 = MPI Message Layer
+ *                  4 = FC Link
+ *                  5 = Context Manager
+ *                  6 = Invalid Field Offset
+ *                  7 = State Change Info
+ *                  all others are reserved for future use
+ *          c = A specific value within the subclass.
+ *
+ * NOTE: Any new values should be added to the end of each subclass so that the
+ *       codes remain consistent across firmware releases.
+ */
+typedef enum _MpiIocLogInfoFc
+{
+    MPI_IOCLOGINFO_FC_INIT_BASE                     = 0x20000000,
+    MPI_IOCLOGINFO_FC_INIT_ERROR_OUT_OF_ORDER_FRAME = 0x20000001, /* received an out of order frame - unsupported */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_START_OF_FRAME = 0x20000002, /* Bad Rx Frame, bad start of frame primative */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_END_OF_FRAME   = 0x20000003, /* Bad Rx Frame, bad end of frame primative */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_OVER_RUN           = 0x20000004, /* Bad Rx Frame, overrun */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_RX_OTHER           = 0x20000005, /* Other errors caught by IOC which require retries */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_SUBPROC_DEAD       = 0x20000006, /* Main processor could not initialize sub-processor */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_RX_OVERRUN         = 0x20000007, /* Scatter Gather overrun  */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_RX_BAD_STATUS      = 0x20000008, /* Receiver detected context mismatch via invalid header */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_RX_UNEXPECTED_FRAME= 0x20000009, /* CtxMgr detected unsupported frame type  */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_LINK_FAILURE       = 0x2000000A, /* Link failure occurred  */
+    MPI_IOCLOGINFO_FC_INIT_ERROR_TX_TIMEOUT         = 0x2000000B, /* Transmitter timeout error */
+
+    MPI_IOCLOGINFO_FC_TARGET_BASE                   = 0x21000000,
+    MPI_IOCLOGINFO_FC_TARGET_NO_PDISC               = 0x21000001, /* not sent because we are waiting for a PDISC from the initiator */
+    MPI_IOCLOGINFO_FC_TARGET_NO_LOGIN               = 0x21000002, /* not sent because we are not logged in to the remote node */
+    MPI_IOCLOGINFO_FC_TARGET_DOAR_KILLED_BY_LIP     = 0x21000003, /* Data Out, Auto Response, not sent due to a LIP */
+    MPI_IOCLOGINFO_FC_TARGET_DIAR_KILLED_BY_LIP     = 0x21000004, /* Data In, Auto Response, not sent due to a LIP */
+    MPI_IOCLOGINFO_FC_TARGET_DIAR_MISSING_DATA      = 0x21000005, /* Data In, Auto Response, missing data frames */
+    MPI_IOCLOGINFO_FC_TARGET_DONR_KILLED_BY_LIP     = 0x21000006, /* Data Out, No Response, not sent due to a LIP */
+    MPI_IOCLOGINFO_FC_TARGET_WRSP_KILLED_BY_LIP     = 0x21000007, /* Auto-response after a write not sent due to a LIP */
+    MPI_IOCLOGINFO_FC_TARGET_DINR_KILLED_BY_LIP     = 0x21000008, /* Data In, No Response, not completed due to a LIP */
+    MPI_IOCLOGINFO_FC_TARGET_DINR_MISSING_DATA      = 0x21000009, /* Data In, No Response, missing data frames */
+    MPI_IOCLOGINFO_FC_TARGET_MRSP_KILLED_BY_LIP     = 0x2100000a, /* Manual Response not sent due to a LIP */
+    MPI_IOCLOGINFO_FC_TARGET_NO_CLASS_3             = 0x2100000b, /* not sent because remote node does not support Class 3 */
+    MPI_IOCLOGINFO_FC_TARGET_LOGIN_NOT_VALID        = 0x2100000c, /* not sent because login to remote node not validated */
+    MPI_IOCLOGINFO_FC_TARGET_FROM_OUTBOUND          = 0x2100000e, /* cleared from the outbound queue after a logout */
+    MPI_IOCLOGINFO_FC_TARGET_WAITING_FOR_DATA_IN    = 0x2100000f, /* cleared waiting for data after a logout */
+
+    MPI_IOCLOGINFO_FC_LAN_BASE                      = 0x22000000,
+    MPI_IOCLOGINFO_FC_LAN_TRANS_SGL_MISSING         = 0x22000001, /* Transaction Context Sgl Missing */
+    MPI_IOCLOGINFO_FC_LAN_TRANS_WRONG_PLACE         = 0x22000002, /* Transaction Context found before an EOB */
+    MPI_IOCLOGINFO_FC_LAN_TRANS_RES_BITS_SET        = 0x22000003, /* Transaction Context value has reserved bits set */
+    MPI_IOCLOGINFO_FC_LAN_WRONG_SGL_FLAG            = 0x22000004, /* Invalid SGL Flags */
+
+    MPI_IOCLOGINFO_FC_MSG_BASE                      = 0x23000000,
+
+    MPI_IOCLOGINFO_FC_LINK_BASE                     = 0x24000000,
+    MPI_IOCLOGINFO_FC_LINK_LOOP_INIT_TIMEOUT        = 0x24000001, /* Loop initialization timed out */
+    MPI_IOCLOGINFO_FC_LINK_ALREADY_INITIALIZED      = 0x24000002, /* Another system controller already initialized the loop */
+    MPI_IOCLOGINFO_FC_LINK_LINK_NOT_ESTABLISHED     = 0x24000003, /* Not synchronized to signal or still negotiating (possible cable problem) */
+    MPI_IOCLOGINFO_FC_LINK_CRC_ERROR                = 0x24000004, /* CRC check detected error on received frame */
+
+    MPI_IOCLOGINFO_FC_CTX_BASE                      = 0x25000000,
+
+    MPI_IOCLOGINFO_FC_INVALID_FIELD_BYTE_OFFSET     = 0x26000000, /* The lower 24 bits give the byte offset of the field in the request message that is invalid */
+    MPI_IOCLOGINFO_FC_INVALID_FIELD_MAX_OFFSET      = 0x26ffffff,
+
+    MPI_IOCLOGINFO_FC_STATE_CHANGE                  = 0x27000000  /* The lower 24 bits give additional information concerning state change */
+
+} MpiIocLogInfoFc_t;

Copied: stable/9/sys/dev/mpt/mpilib/mpi_log_sas.h (from r233425, head/sys/dev/mpt/mpilib/mpi_log_sas.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/sys/dev/mpt/mpilib/mpi_log_sas.h	Sat Mar 31 10:26:58 2012	(r233740, copy of r233425, head/sys/dev/mpt/mpilib/mpi_log_sas.h)
@@ -0,0 +1,352 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon including
+ *    a substantially similar Disclaimer requirement for further binary
+ *    redistribution.
+ * 3. Neither the name of the LSI Logic Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
+ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/***************************************************************************
+ *                                                                         *
+ * Description                                                             *
+ * ------------                                                            *
+ * This include file contains SAS firmware interface IOC Log Info codes    *
+ *                                                                         *
+ *-------------------------------------------------------------------------*
+ */
+
+#ifndef IOPI_IOCLOGINFO_H_INCLUDED
+#define IOPI_IOCLOGINFO_H_INCLUDED
+
+#define SAS_LOGINFO_NEXUS_LOSS		0x31170000
+#define SAS_LOGINFO_MASK		0xFFFF0000
+
+/****************************************************************************/
+/*  IOC LOGINFO defines, 0x00000000 - 0x0FFFFFFF                            */
+/*  Format:                                                                 */
+/*      Bits 31-28: MPI_IOCLOGINFO_TYPE_SAS (3)                             */
+/*      Bits 27-24: IOC_LOGINFO_ORIGINATOR: 0=IOP, 1=PL, 2=IR               */
+/*      Bits 23-16: LOGINFO_CODE                                            */
+/*      Bits 15-0:  LOGINFO_CODE Specific                                   */
+/****************************************************************************/
+
+/****************************************************************************/
+/* IOC_LOGINFO_ORIGINATOR defines                                           */
+/****************************************************************************/
+#define IOC_LOGINFO_ORIGINATOR_IOP                      (0x00000000)
+#define IOC_LOGINFO_ORIGINATOR_PL                       (0x01000000)
+#define IOC_LOGINFO_ORIGINATOR_IR                       (0x02000000)
+
+#define IOC_LOGINFO_ORIGINATOR_MASK                     (0x0F000000)
+
+/****************************************************************************/
+/* LOGINFO_CODE defines                                                     */
+/****************************************************************************/
+#define IOC_LOGINFO_CODE_MASK                           (0x00FF0000)
+#define IOC_LOGINFO_CODE_SHIFT                          (16)
+
+/****************************************************************************/
+/* IOP LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = IOP          */
+/****************************************************************************/
+#define IOP_LOGINFO_CODE_INVALID_SAS_ADDRESS                 (0x00010000)
+#define IOP_LOGINFO_CODE_UNUSED2                             (0x00020000)
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE                 (0x00030000)
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_RT              (0x00030100) /* Route Table Entry not found */
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_PN              (0x00030200) /* Invalid Page Number */
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_FORM            (0x00030300) /* Invalid FORM */
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_PT              (0x00030400) /* Invalid Page Type */
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_DNM             (0x00030500) /* Device Not Mapped */
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_PERSIST         (0x00030600) /* Persistent Page not found */
+#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_DEFAULT         (0x00030700) /* Default Page not found */
+
+#define IOP_LOGINFO_CODE_FWUPLOAD_NO_FLASH_AVAILABLE         (0x0003E000) /* Tried to upload from flash, but there is none */
+#define IOP_LOGINFO_CODE_FWUPLOAD_UNKNOWN_IMAGE_TYPE         (0x0003E001) /* ImageType field contents were invalid */
+#define IOP_LOGINFO_CODE_FWUPLOAD_WRONG_IMAGE_SIZE           (0x0003E002) /* ImageSize field in TCSGE was bad/offset in MfgPg 4 was wrong */
+#define IOP_LOGINFO_CODE_FWUPLOAD_ENTIRE_FLASH_UPLOAD_FAILED (0x0003E003) /* Error occured while attempting to upload the entire flash */
+#define IOP_LOGINFO_CODE_FWUPLOAD_REGION_UPLOAD_FAILED       (0x0003E004) /* Error occured while attempting to upload single flash region */
+#define IOP_LOGINFO_CODE_FWUPLOAD_DMA_FAILURE                (0x0003E005) /* Problem occured while DMAing FW to host memory */
+
+#define IOP_LOGINFO_CODE_DIAG_MSG_ERROR                      (0x00040000) /* Error handling diag msg - or'd with diag status */
+
+#define IOP_LOGINFO_CODE_TASK_TERMINATED                     (0x00050000)
+
+#define IOP_LOGINFO_CODE_ENCL_MGMT_READ_ACTION_ERR0R         (0x00060001) /* Read Action not supported for SEP msg */
+#define IOP_LOGINFO_CODE_ENCL_MGMT_INVALID_BUS_ID_ERR0R      (0x00060002) /* Invalid Bus/ID in SEP msg */
+
+#define IOP_LOGINFO_CODE_TARGET_ASSIST_TERMINATED            (0x00070001)
+#define IOP_LOGINFO_CODE_TARGET_STATUS_SEND_TERMINATED       (0x00070002)
+#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_ALL_IO            (0x00070003)
+#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO          (0x00070004)
+#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ      (0x00070005)
+
+#define IOP_LOGINFO_CODE_LOG_TIMESTAMP_EVENT                 (0x00080000)
+
+/****************************************************************************/
+/* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL            */
+/****************************************************************************/
+#define PL_LOGINFO_CODE_OPEN_FAILURE                         (0x00010000) /* see SUB_CODE_OPEN_FAIL_ below */
+
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_NO_DEST_TIME_OUT       (0x00000001)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PATHWAY_BLOCKED        (0x00000002)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RES_CONTINUE0          (0x00000003)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RES_CONTINUE1          (0x00000004)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RES_INITIALIZE0        (0x00000005)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RES_INITIALIZE1        (0x00000006)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RES_STOP0              (0x00000007)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RES_STOP1              (0x00000008)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RETRY                  (0x00000009)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_BREAK                  (0x0000000A)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0B              (0x0000000B)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP       (0x0000000C)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D              (0x0000000D)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL      (0x0000000E)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_BAD_DEST               (0x00000011)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP          (0x00000012)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP          (0x00000013)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0      (0x00000014)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON1      (0x00000015)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON2      (0x00000016)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON3      (0x00000017)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_STP_RESOURCES_BSY      (0x00000018)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_WRONG_DESTINATION      (0x00000019)
+
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PATH_BLOCKED           (0x0000001B) /* Retry Timeout */
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_AWT_MAXED              (0x0000001C) /* Retry Timeout */
+
+
+
+#define PL_LOGINFO_CODE_INVALID_SGL                          (0x00020000)
+#define PL_LOGINFO_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH        (0x00030000)
+#define PL_LOGINFO_CODE_FRAME_XFER_ERROR                     (0x00040000)
+#define PL_LOGINFO_CODE_TX_FM_CONNECTED_LOW                  (0x00050000)
+#define PL_LOGINFO_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET          (0x00060000)
+#define PL_LOGINFO_CODE_SATA_READ_LOG_RECEIVE_DATA_ERR       (0x00070000)
+#define PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR      (0x00080000)
+#define PL_LOGINFO_CODE_SATA_ERR_IN_RCV_SET_DEV_BIT_FIS      (0x00090000)
+#define PL_LOGINFO_CODE_RX_FM_INVALID_MESSAGE                (0x000A0000)
+#define PL_LOGINFO_CODE_RX_CTX_MESSAGE_VALID_ERROR           (0x000B0000)
+#define PL_LOGINFO_CODE_RX_FM_CURRENT_FRAME_ERROR            (0x000C0000)
+#define PL_LOGINFO_CODE_SATA_LINK_DOWN                       (0x000D0000)
+#define PL_LOGINFO_CODE_DISCOVERY_SATA_INIT_W_IOS            (0x000E0000)
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE                  (0x000F0000)
+#define PL_LOGINFO_CODE_CONFIG_PL_NOT_INITIALIZED            (0x000F0001) /* PL not yet initialized, can't do config page req. */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_PT               (0x000F0100) /* Invalid Page Type */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_NUM_PHYS         (0x000F0200) /* Invalid Number of Phys */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_NOT_IMP          (0x000F0300) /* Case Not Handled */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_NO_DEV           (0x000F0400) /* No Device Found */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_FORM             (0x000F0500) /* Invalid FORM */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_PHY              (0x000F0600) /* Invalid Phy */
+#define PL_LOGINFO_CODE_CONFIG_INVALID_PAGE_NO_OWNER         (0x000F0700) /* No Owner Found */
+#define PL_LOGINFO_CODE_DSCVRY_SATA_INIT_TIMEOUT             (0x00100000)
+#define PL_LOGINFO_CODE_RESET                                (0x00110000) /* See Sub-Codes below (PL_LOGINFO_SUB_CODE) */
+#define PL_LOGINFO_CODE_ABORT                                (0x00120000) /* See Sub-Codes below  (PL_LOGINFO_SUB_CODE)*/
+#define PL_LOGINFO_CODE_IO_NOT_YET_EXECUTED                  (0x00130000)
+#define PL_LOGINFO_CODE_IO_EXECUTED                          (0x00140000)
+#define PL_LOGINFO_CODE_PERS_RESV_OUT_NOT_AFFIL_OWNER        (0x00150000)
+#define PL_LOGINFO_CODE_OPEN_TXDMA_ABORT                     (0x00160000)
+#define PL_LOGINFO_CODE_IO_DEVICE_MISSING_DELAY_RETRY        (0x00170000)
+#define PL_LOGINFO_CODE_IO_CANCELLED_DUE_TO_R_ERR            (0x00180000)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE                     (0x00000100)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_NO_DEST_TIMEOUT     (0x00000101)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_SATA_NEG_RATE_2HI   (0x00000102)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_RATE_NOT_SUPPORTED  (0x00000103)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_BREAK               (0x00000104)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ZONE_VIOLATION      (0x00000114)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ABANDON0            (0x00000114) /* Open Reject (Zone Violation) - available on SAS-2 devices */
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ABANDON1            (0x00000115)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ABANDON2            (0x00000116)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ABANDON3            (0x00000117)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ORR_TIMEOUT         (0x0000011A) /* Open Reject (Retry) Timeout */
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_PATH_BLOCKED        (0x0000011B)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_AWT_MAXED           (0x0000011C) /* Arbitration Wait Timer Maxed */
+
+#define PL_LOGINFO_SUB_CODE_TARGET_BUS_RESET                 (0x00000120)
+#define PL_LOGINFO_SUB_CODE_TRANSPORT_LAYER                  (0x00000130)  /* Leave lower nibble (1-f) reserved. */
+#define PL_LOGINFO_SUB_CODE_PORT_LAYER                       (0x00000140)  /* Leave lower nibble (1-f) reserved. */
+
+
+#define PL_LOGINFO_SUB_CODE_INVALID_SGL                      (0x00000200)
+#define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH    (0x00000300)
+#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR                 (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */
+                                                                          /* Bit 0 is Status Bit 0: FrameXferErr */
+                                                                          /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
+                                                                          /* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
+
+#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW              (0x00000500)
+#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET      (0x00000600)
+#define PL_LOGINFO_SUB_CODE_SATA_READ_LOG_RECEIVE_DATA_ERR   (0x00000700)
+#define PL_LOGINFO_SUB_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR  (0x00000800)
+#define PL_LOGINFO_SUB_CODE_SATA_ERR_IN_RCV_SET_DEV_BIT_FIS  (0x00000900)
+#define PL_LOGINFO_SUB_CODE_RX_FM_INVALID_MESSAGE            (0x00000A00)
+#define PL_LOGINFO_SUB_CODE_RX_CTX_MESSAGE_VALID_ERROR       (0x00000B00)
+#define PL_LOGINFO_SUB_CODE_RX_FM_CURRENT_FRAME_ERROR        (0x00000C00)
+#define PL_LOGINFO_SUB_CODE_SATA_LINK_DOWN                   (0x00000D00)
+#define PL_LOGINFO_SUB_CODE_DISCOVERY_SATA_INIT_W_IOS        (0x00000E00)
+#define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET       (0x00000E01)
+#define PL_LOGINFO_SUB_CODE_SECOND_OPEN                      (0x00000F00)
+#define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT         (0x00001000)
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION  		 (0x00002000) /* not currently used in mainline */
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK              (0x00003000)
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP          (0x00004000)
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD   (0x00005000)
+
+#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE          (0x00200000) /* Can't get SMP Frame */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR             (0x00200010) /* Error occured on SMP Read */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_WRITE_ERROR            (0x00200020) /* Error occured on SMP Write */
+#define PL_LOGINFO_CODE_ENCL_MGMT_NOT_SUPPORTED_ON_ENCL      (0x00200040) /* Encl Mgmt services not available for this WWID */
+#define PL_LOGINFO_CODE_ENCL_MGMT_ADDR_MODE_NOT_SUPPORTED    (0x00200050) /* Address Mode not suppored */
+#define PL_LOGINFO_CODE_ENCL_MGMT_BAD_SLOT_NUM               (0x00200060) /* Invalid Slot Number in SEP Msg */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SGPIO_NOT_PRESENT          (0x00200070) /* SGPIO not present/enabled */
+#define PL_LOGINFO_CODE_ENCL_MGMT_GPIO_NOT_CONFIGURED        (0x00200080) /* GPIO not configured */
+#define PL_LOGINFO_CODE_ENCL_MGMT_GPIO_FRAME_ERROR           (0x00200090) /* GPIO can't allocate a frame */
+#define PL_LOGINFO_CODE_ENCL_MGMT_GPIO_CONFIG_PAGE_ERROR     (0x002000A0) /* GPIO failed config page request */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SES_FRAME_ALLOC_ERROR      (0x002000B0) /* Can't get frame for SES command */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SES_IO_ERROR               (0x002000C0) /* I/O execution error */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SES_RETRIES_EXHAUSTED      (0x002000D0) /* SEP I/O retries exhausted */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_ALLOC_ERROR      (0x002000E0) /* Can't get frame for SMP command */
+
+#define PL_LOGINFO_DA_SEP_NOT_PRESENT                        (0x00200100) /* SEP not present when msg received */
+#define PL_LOGINFO_DA_SEP_SINGLE_THREAD_ERROR                (0x00200101) /* Can only accept 1 msg at a time */
+#define PL_LOGINFO_DA_SEP_ISTWI_INTR_IN_IDLE_STATE           (0x00200102) /* ISTWI interrupt recvd. while IDLE */
+#define PL_LOGINFO_DA_SEP_RECEIVED_NACK_FROM_SLAVE           (0x00200103) /* SEP NACK'd, it is busy */
+#define PL_LOGINFO_DA_SEP_DID_NOT_RECEIVE_ACK                (0x00200104) /* SEP didn't rcv. ACK (Last Rcvd Bit = 1) */
+#define PL_LOGINFO_DA_SEP_BAD_STATUS_HDR_CHKSUM              (0x00200105) /* SEP stopped or sent bad chksum in Hdr */
+#define PL_LOGINFO_DA_SEP_STOP_ON_DATA                       (0x00200106) /* SEP stopped while transfering data */
+#define PL_LOGINFO_DA_SEP_STOP_ON_SENSE_DATA                 (0x00200107) /* SEP stopped while transfering sense data */
+#define PL_LOGINFO_DA_SEP_UNSUPPORTED_SCSI_STATUS_1          (0x00200108) /* SEP returned unknown scsi status */
+#define PL_LOGINFO_DA_SEP_UNSUPPORTED_SCSI_STATUS_2          (0x00200109) /* SEP returned unknown scsi status */
+#define PL_LOGINFO_DA_SEP_CHKSUM_ERROR_AFTER_STOP            (0x0020010A) /* SEP returned bad chksum after STOP */
+#define PL_LOGINFO_DA_SEP_CHKSUM_ERROR_AFTER_STOP_GETDATA    (0x0020010B) /* SEP returned bad chksum after STOP while gettin data*/
+#define PL_LOGINFO_DA_SEP_UNSUPPORTED_COMMAND                (0x0020010C) /* SEP doesn't support CDB opcode f/w location 1 */
+#define PL_LOGINFO_DA_SEP_UNSUPPORTED_COMMAND_2              (0x0020010D) /* SEP doesn't support CDB opcode f/w location 2 */
+#define PL_LOGINFO_DA_SEP_UNSUPPORTED_COMMAND_3              (0x0020010E) /* SEP doesn't support CDB opcode f/w location 3 */
+
+
+/****************************************************************************/
+/* IR LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = IR            */
+/****************************************************************************/
+#define IR_LOGINFO_RAID_ACTION_ERROR                           (0x00010000)
+#define IR_LOGINFO_CODE_UNUSED2                                (0x00020000)
+
+/* Amount of information passed down for Create Volume is too large */
+#define IR_LOGINFO_VOLUME_CREATE_INVALID_LENGTH                (0x00010001)
+/* Creation of duplicate volume attempted (Bus/Target ID checked) */
+#define IR_LOGINFO_VOLUME_CREATE_DUPLICATE                     (0x00010002)
+/* Creation failed due to maximum number of supported volumes exceeded */
+#define IR_LOGINFO_VOLUME_CREATE_NO_SLOTS                      (0x00010003)
+/* Creation failed due to DMA error in trying to read from host */
+#define IR_LOGINFO_VOLUME_CREATE_DMA_ERROR                     (0x00010004)
+/* Creation failed due to invalid volume type passed down */
+#define IR_LOGINFO_VOLUME_CREATE_INVALID_VOLUME_TYPE           (0x00010005)
+/* Creation failed due to error reading MFG Page 4 */
+#define IR_LOGINFO_VOLUME_MFG_PAGE4_ERROR                      (0x00010006)
+/* Creation failed when trying to create internal structures */
+#define IR_LOGINFO_VOLUME_INTERNAL_CONFIG_STRUCTURE_ERROR      (0x00010007)
+
+/* Activation failed due to trying to activate an already active volume */
+#define IR_LOGINFO_VOLUME_ACTIVATING_AN_ACTIVE_VOLUME          (0x00010010)
+/* Activation failed due to trying to active unsupported volume type  */
+#define IR_LOGINFO_VOLUME_ACTIVATING_INVALID_VOLUME_TYPE       (0x00010011)
+/* Activation failed due to trying to active too many volumes  */
+#define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_VOLUMES          (0x00010012)
+/* Activation failed due to Volume ID in use already */
+#define IR_LOGINFO_VOLUME_ACTIVATING_VOLUME_ID_IN_USE          (0x00010013)
+/* Activation failed call to activateVolume returned failure */
+#define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED               (0x00010014)
+/* Activation failed trying to import the volume */
+#define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED      (0x00010015)
+/* Activation failed trying to import the volume */
+#define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_PHYS_DISKS       (0x00010016)
+
+/* Phys Disk failed, too many phys disks */
+#define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS              (0x00010020)
+/* Amount of information passed down for Create Pnysdisk is too large */
+#define IR_LOGINFO_PHYSDISK_CREATE_INVALID_LENGTH              (0x00010021)
+/* Creation failed due to DMA error in trying to read from host */
+#define IR_LOGINFO_PHYSDISK_CREATE_DMA_ERROR                   (0x00010022)
+/* Creation failed due to invalid Bus TargetID passed down */
+#define IR_LOGINFO_PHYSDISK_CREATE_BUS_TID_INVALID             (0x00010023)
+/* Creation failed due to error in creating RAID Phys Disk Config Page */
+#define IR_LOGINFO_PHYSDISK_CREATE_CONFIG_PAGE_ERROR           (0x00010024)
+
+
+/* Compatibility Error : IR Disabled */
+#define IR_LOGINFO_COMPAT_ERROR_RAID_DISABLED                  (0x00010030)
+/* Compatibility Error : Inquiry Comand failed */
+#define IR_LOGINFO_COMPAT_ERROR_INQUIRY_FAILED                 (0x00010031)
+/* Compatibility Error : Device not direct access device */
+#define IR_LOGINFO_COMPAT_ERROR_NOT_DIRECT_ACCESS              (0x00010032)
+/* Compatibility Error : Removable device found */
+#define IR_LOGINFO_COMPAT_ERROR_REMOVABLE_FOUND                (0x00010033)
+/* Compatibility Error : Device SCSI Version not 2 or higher */
+#define IR_LOGINFO_COMPAT_ERROR_NEED_SCSI_2_OR_HIGHER          (0x00010034)
+/* Compatibility Error : SATA device, 48 BIT LBA not supported */
+#define IR_LOGINFO_COMPAT_ERROR_SATA_48BIT_LBA_NOT_SUPPORTED   (0x00010035)
+/* Compatibility Error : Device does not have 512 byte block sizes */
+#define IR_LOGINFO_COMPAT_ERROR_DEVICE_NOT_512_BYTE_BLOCK      (0x00010036)
+/* Compatibility Error : Volume Type check failed */
+#define IR_LOGINFO_COMPAT_ERROR_VOLUME_TYPE_CHECK_FAILED       (0x00010037)
+/* Compatibility Error : Volume Type is unsupported by FW */
+#define IR_LOGINFO_COMPAT_ERROR_UNSUPPORTED_VOLUME_TYPE        (0x00010038)
+/* Compatibility Error : Disk drive too small for use in volume */
+#define IR_LOGINFO_COMPAT_ERROR_DISK_TOO_SMALL                 (0x00010039)
+/* Compatibility Error : Phys disk for Create Volume not found */
+#define IR_LOGINFO_COMPAT_ERROR_PHYS_DISK_NOT_FOUND            (0x0001003A)
+/* Compatibility Error : membership count error, too many or too few disks for volume type */
+#define IR_LOGINFO_COMPAT_ERROR_MEMBERSHIP_COUNT               (0x0001003B)
+/* Compatibility Error : Disk stripe sizes must be 64KB */
+#define IR_LOGINFO_COMPAT_ERROR_NON_64K_STRIPE_SIZE            (0x0001003C)
+/* Compatibility Error : IME size limited to < 2TB */
+#define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D)
+
+/* Device Firmware Update: DFU can only be started once */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DFU_IN_PROGRESS            (0x00010050)
+/* Device Firmware Update: Volume must be Optimal/Active/non-Quiesced */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DEVICE_IN_INVALID_STATE    (0x00010051)
+/* Device Firmware Update: DFU Timeout cannot be zero */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_INVALID_TIMEOUT            (0x00010052)
+/* Device Firmware Update: CREATE TIMER FAILED */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_NO_TIMERS                  (0x00010053)
+/* Device Firmware Update: Failed to read SAS_IO_UNIT_PG_1 */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_READING_CFG_PAGE           (0x00010054)
+/* Device Firmware Update: Invalid SAS_IO_UNIT_PG_1 value(s) */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_PORT_IO_TIMEOUTS_REQUIRED  (0x00010055)
+/* Device Firmware Update: Unable to allocate memory for page */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE             (0x00010056)
+/* Device Firmware Update:  */
+//#define IR_LOGINFO_DEV_FW_UPDATE_ERR_                         (0x00010054)
+
+
+/****************************************************************************/
+/* Defines for convenience                                                  */
+/****************************************************************************/
+#define IOC_LOGINFO_PREFIX_IOP                          ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_IOP)
+#define IOC_LOGINFO_PREFIX_PL                           ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_PL)
+#define IOC_LOGINFO_PREFIX_IR                           ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_IR)
+
+#endif /* end of file */
+

Modified: stable/9/sys/dev/mpt/mpilib/mpi_raid.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_raid.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_raid.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -33,7 +33,7 @@
  *          Title:  MPI RAID message and structures
  *  Creation Date:  February 27, 2001
  *
- *    mpi_raid.h Version:  01.05.03
+ *    mpi_raid.h Version:  01.05.05
  *
  *  Version History
  *  ---------------
@@ -61,6 +61,9 @@
  *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
  *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
  *                      associated defines.
+ *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
+ *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
+ *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
  *  --------------------------------------------------------------------------
  */
 
@@ -120,6 +123,7 @@ typedef struct _MSG_RAID_ACTION
 #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
 #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
 #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
+#define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
 
 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
@@ -132,6 +136,9 @@ typedef struct _MSG_RAID_ACTION
 #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
 #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
 
+/* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
+#define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
+
 /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
 #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
 

Modified: stable/9/sys/dev/mpt/mpilib/mpi_sas.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_sas.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_sas.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
  *          Title:  MPI Serial Attached SCSI structures and definitions
  *  Creation Date:  August 19, 2004
  *
- *    mpi_sas.h Version:  01.05.04
+ *    mpi_sas.h Version:  01.05.05
  *
  *  Version History
  *  ---------------
@@ -50,6 +50,10 @@
  *                      reply.
  *  10-11-06  01.05.04  Fixed the name of a define for Operation field of SAS IO
  *                      Unit Control request.
+ *  01-15-08  01.05.05  Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
+ *                      including adding IOCParameter and IOCParameter value
+ *                      fields to SAS IO Unit Control Request.
+ *                      Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
  *  --------------------------------------------------------------------------
  */
 
@@ -87,6 +91,8 @@
  * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
  * data and SAS IO Unit Configuration pages.
  */
+#define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC    (0xF0000000)
+
 #define MPI_SAS_DEVICE_INFO_SEP                 (0x00004000)
 #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE        (0x00002000)
 #define MPI_SAS_DEVICE_INFO_LSI_DEVICE          (0x00001000)
@@ -243,7 +249,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_R
     U8                      ChainOffset;        /* 02h */
     U8                      Function;           /* 03h */
     U16                     DevHandle;          /* 04h */
-    U8                      Reserved3;          /* 06h */
+    U8                      IOCParameter;       /* 06h */
     U8                      MsgFlags;           /* 07h */
     U32                     MsgContext;         /* 08h */
     U8                      TargetID;           /* 0Ch */
@@ -252,7 +258,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_R
     U8                      PrimFlags;          /* 0Fh */
     U32                     Primitive;          /* 10h */
     U64                     SASAddress;         /* 14h */
-    U32                     Reserved4;          /* 1Ch */
+    U32                     IOCParameterValue;  /* 1Ch */
 } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
   SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
 
@@ -268,6 +274,8 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_R
 #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL  (0x0C)
 #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE       (0x0D)  /* obsolete name */
 #define MPI_SAS_OP_REMOVE_DEVICE                (0x0D)
+#define MPI_SAS_OP_SET_IOC_PARAMETER            (0x0E)
+#define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN         (0x80)
 
 /* values for the PrimFlags field */
 #define MPI_SAS_PRIMFLAGS_SINGLE                (0x08)
@@ -283,7 +291,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_R
     U8                      MsgLength;          /* 02h */
     U8                      Function;           /* 03h */
     U16                     DevHandle;          /* 04h */
-    U8                      Reserved3;          /* 06h */
+    U8                      IOCParameter;       /* 06h */
     U8                      MsgFlags;           /* 07h */
     U32                     MsgContext;         /* 08h */
     U16                     Reserved4;          /* 0Ch */

Modified: stable/9/sys/dev/mpt/mpilib/mpi_targ.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_targ.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_targ.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/sys/dev/mpt/mpilib/mpi_tool.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_tool.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_tool.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/sys/dev/mpt/mpilib/mpi_type.h
==============================================================================
--- stable/9/sys/dev/mpt/mpilib/mpi_type.h	Sat Mar 31 10:25:16 2012	(r233739)
+++ stable/9/sys/dev/mpt/mpilib/mpi_type.h	Sat Mar 31 10:26:58 2012	(r233740)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*
- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
+ * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 10:47:35 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AFB7F106566B;
	Sat, 31 Mar 2012 10:47:35 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 901D98FC0A;
	Sat, 31 Mar 2012 10:47:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VAlZfP098458;
	Sat, 31 Mar 2012 10:47:35 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VAlZvH098454;
	Sat, 31 Mar 2012 10:47:35 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203311047.q2VAlZvH098454@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 10:47:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233743 - in stable/9/sys: amd64/conf i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 10:47:35 -0000

Author: marius
Date: Sat Mar 31 10:47:34 2012
New Revision: 233743
URL: http://svn.freebsd.org/changeset/base/233743

Log:
  MFC: r233427
  
  Add cas(4), gem(4) and hme(4) to x86 GENERICs as suggested by netchild@ in
  <20120222095239.Horde.0hpYHJjmRSRPRKzXsoFRbYk@webmail.leidinger.net>.
  According to some private emails received, it apparently is not unpopular
  to use at least Quad GigaSwift cards driven by cas(4) in x86 machines.

Modified:
  stable/9/sys/amd64/conf/GENERIC
  stable/9/sys/i386/conf/GENERIC
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/amd64/conf/GENERIC
==============================================================================
--- stable/9/sys/amd64/conf/GENERIC	Sat Mar 31 10:29:20 2012	(r233742)
+++ stable/9/sys/amd64/conf/GENERIC	Sat Mar 31 10:47:34 2012	(r233743)
@@ -203,9 +203,12 @@ device		ale		# Atheros AR8121/AR8113/AR8
 device		bce		# Broadcom BCM5706/BCM5708 Gigabit Ethernet
 device		bfe		# Broadcom BCM440x 10/100 Ethernet
 device		bge		# Broadcom BCM570xx Gigabit Ethernet
+device		cas		# Sun Cassini/Cassini+ and NS DP83065 Saturn
 device		dc		# DEC/Intel 21143 and various workalikes
 device		et		# Agere ET1310 10/100/Gigabit Ethernet
 device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
+device		gem		# Sun GEM/Sun ERI/Apple GMAC
+device		hme		# Sun HME (Happy Meal Ethernet)
 device		jme		# JMicron JMC250 Gigabit/JMC260 Fast Ethernet
 device		lge		# Level 1 LXT1001 gigabit Ethernet
 device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet

Modified: stable/9/sys/i386/conf/GENERIC
==============================================================================
--- stable/9/sys/i386/conf/GENERIC	Sat Mar 31 10:29:20 2012	(r233742)
+++ stable/9/sys/i386/conf/GENERIC	Sat Mar 31 10:47:34 2012	(r233743)
@@ -213,9 +213,12 @@ device		ale		# Atheros AR8121/AR8113/AR8
 device		bce		# Broadcom BCM5706/BCM5708 Gigabit Ethernet
 device		bfe		# Broadcom BCM440x 10/100 Ethernet
 device		bge		# Broadcom BCM570xx Gigabit Ethernet
+device		cas		# Sun Cassini/Cassini+ and NS DP83065 Saturn
 device		dc		# DEC/Intel 21143 and various workalikes
 device		et		# Agere ET1310 10/100/Gigabit Ethernet
 device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
+device		gem		# Sun GEM/Sun ERI/Apple GMAC
+device		hme		# Sun HME (Happy Meal Ethernet)
 device		jme		# JMicron JMC250 Gigabit/JMC260 Fast Ethernet
 device		lge		# Level 1 LXT1001 gigabit Ethernet
 device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet

From owner-svn-src-stable-9@FreeBSD.ORG  Sat Mar 31 17:47:51 2012
Return-Path: 
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 29E461065673;
	Sat, 31 Mar 2012 17:47:51 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 12DF28FC14;
	Sat, 31 Mar 2012 17:47:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VHloHG011987;
	Sat, 31 Mar 2012 17:47:50 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VHloGf011983;
	Sat, 31 Mar 2012 17:47:50 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201203311747.q2VHloGf011983@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 31 Mar 2012 17:47:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233750 - in stable/9/sys: amd64/amd64 amd64/conf conf
	i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 31 Mar 2012 17:47:51 -0000

Author: alc
Date: Sat Mar 31 17:47:50 2012
New Revision: 233750
URL: http://svn.freebsd.org/changeset/base/233750

Log:
  MFC r233256
    Eliminate vm.pmap.shpgperproc and vm.pmap.pv_entry_max because they no
    longer serve any purpose.

Modified:
  stable/9/sys/amd64/amd64/pmap.c
  stable/9/sys/amd64/conf/NOTES
  stable/9/sys/conf/options.amd64
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/9/sys/amd64/amd64/pmap.c	Sat Mar 31 14:25:12 2012	(r233749)
+++ stable/9/sys/amd64/amd64/pmap.c	Sat Mar 31 17:47:50 2012	(r233750)
@@ -148,10 +148,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#ifndef PMAP_SHPGPERPROC
-#define PMAP_SHPGPERPROC 200
-#endif
-
 #if !defined(DIAGNOSTIC)
 #ifdef __GNUC_GNU_INLINE__
 #define PMAP_INLINE	__attribute__((__gnu_inline__)) inline
@@ -206,9 +202,8 @@ static u_int64_t	DMPDPphys;	/* phys addr
 /*
  * Data for the pv entry allocation mechanism
  */
-static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
+static int pv_entry_count;
 static struct md_page *pv_table;
-static int shpgperproc = PMAP_SHPGPERPROC;
 
 /*
  * All those kernel PT submaps that BSD is so fond of
@@ -222,7 +217,7 @@ caddr_t CADDR1 = 0;
 static caddr_t crashdumpmap;
 
 static void	free_pv_entry(pmap_t pmap, pv_entry_t pv);
-static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
+static pv_entry_t get_pv_entry(pmap_t locked_pmap, boolean_t try);
 static void	pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static void	pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
@@ -731,16 +726,6 @@ pmap_init(void)
 	}
 
 	/*
-	 * Initialize the address space (zone) for the pv entries.  Set a
-	 * high water mark so that the system can recover from excessive
-	 * numbers of pv entries.
-	 */
-	TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc);
-	pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
-	TUNABLE_INT_FETCH("vm.pmap.pv_entries", &pv_entry_max);
-	pv_entry_high_water = 9 * (pv_entry_max / 10);
-
-	/*
 	 * If the kernel is running in a virtual machine on an AMD Family 10h
 	 * processor, then it must assume that MCA is enabled by the virtual
 	 * machine monitor.
@@ -775,36 +760,6 @@ pmap_init(void)
 		TAILQ_INIT(&pv_table[i].pv_list);
 }
 
-static int
-pmap_pventry_proc(SYSCTL_HANDLER_ARGS)
-{
-	int error;
-
-	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
-	if (error == 0 && req->newptr) {
-		shpgperproc = (pv_entry_max - cnt.v_page_count) / maxproc;
-		pv_entry_high_water = 9 * (pv_entry_max / 10);
-	}
-	return (error);
-}
-SYSCTL_PROC(_vm_pmap, OID_AUTO, pv_entry_max, CTLTYPE_INT|CTLFLAG_RW, 
-    &pv_entry_max, 0, pmap_pventry_proc, "IU", "Max number of PV entries");
-
-static int
-pmap_shpgperproc_proc(SYSCTL_HANDLER_ARGS)
-{
-	int error;
-
-	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
-	if (error == 0 && req->newptr) {
-		pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
-		pv_entry_high_water = 9 * (pv_entry_max / 10);
-	}
-	return (error);
-}
-SYSCTL_PROC(_vm_pmap, OID_AUTO, shpgperproc, CTLTYPE_INT|CTLFLAG_RW, 
-    &shpgperproc, 0, pmap_shpgperproc_proc, "IU", "Page share factor per proc");
-
 SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0,
     "2MB page mapping counters");
 
@@ -2185,10 +2140,8 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
  * when needed.
  */
 static pv_entry_t
-get_pv_entry(pmap_t pmap, int try)
+get_pv_entry(pmap_t pmap, boolean_t try)
 {
-	static const struct timeval printinterval = { 60, 0 };
-	static struct timeval lastprint;
 	static vm_pindex_t colour;
 	struct vpgqueues *pq;
 	int bit, field;
@@ -2199,12 +2152,6 @@ get_pv_entry(pmap_t pmap, int try)
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	PV_STAT(pv_entry_allocs++);
-	pv_entry_count++;
-	if (pv_entry_count > pv_entry_high_water)
-		if (ratecheck(&lastprint, &printinterval))
-			printf("Approaching the limit on PV entries, consider "
-			    "increasing either the vm.pmap.shpgperproc or the "
-			    "vm.pmap.pv_entry_max sysctl.\n");
 	pq = NULL;
 retry:
 	pc = TAILQ_FIRST(&pmap->pm_pvchunk);
@@ -2222,8 +2169,10 @@ retry:
 			if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 &&
 			    pc->pc_map[2] == 0) {
 				TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
-				TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list);
+				TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc,
+				    pc_list);
 			}
+			pv_entry_count++;
 			PV_STAT(pv_entry_spare--);
 			return (pv);
 		}
@@ -2234,7 +2183,6 @@ retry:
 	    VM_ALLOC_WIRED);
 	if (m == NULL) {
 		if (try) {
-			pv_entry_count--;
 			PV_STAT(pc_chunk_tryfail++);
 			return (NULL);
 		}
@@ -2250,7 +2198,7 @@ retry:
 			PV_STAT(pmap_collect_active++);
 			pq = &vm_page_queues[PQ_ACTIVE];
 		} else
-			panic("get_pv_entry: increase vm.pmap.shpgperproc");
+			panic("get_pv_entry: allocation failed");
 		pmap_collect(pmap, pq);
 		goto retry;
 	}
@@ -2265,6 +2213,7 @@ retry:
 	pc->pc_map[2] = PC_FREE2;
 	pv = &pc->pc_pventry[0];
 	TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
+	pv_entry_count++;
 	PV_STAT(pv_entry_spare += _NPCPV - 1);
 	return (pv);
 }
@@ -2422,8 +2371,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	if (pv_entry_count < pv_entry_high_water && 
-	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
+	if ((pv = get_pv_entry(pmap, TRUE)) != NULL) {
 		pv->pv_va = va;
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 		return (TRUE);
@@ -2441,8 +2389,7 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
 	pv_entry_t pv;
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	if (pv_entry_count < pv_entry_high_water && 
-	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
+	if ((pv = get_pv_entry(pmap, TRUE)) != NULL) {
 		pv->pv_va = va;
 		pvh = pa_to_pvh(pa);
 		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);

Modified: stable/9/sys/amd64/conf/NOTES
==============================================================================
--- stable/9/sys/amd64/conf/NOTES	Sat Mar 31 14:25:12 2012	(r233749)
+++ stable/9/sys/amd64/conf/NOTES	Sat Mar 31 17:47:50 2012	(r233750)
@@ -490,19 +490,6 @@ device		cpuctl
 options 	ENABLE_ALART		# Control alarm on Intel intpm driver
 
 #
-# Set the number of PV entries per process.  Increasing this can
-# stop panics related to heavy use of shared memory.  However, that can
-# (combined with large amounts of physical memory) cause panics at
-# boot time due the kernel running out of VM space.
-#
-# If you're tweaking this, you might also want to increase the sysctls
-# "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target".
-#
-# The value below is the one more than the default.
-#
-options 	PMAP_SHPGPERPROC=201
-
-#
 # Number of initial kernel page table pages used for early bootstrap.
 # This number should include enough pages to map the kernel and any
 # modules or other data loaded with the kernel by the loader.  Each

Modified: stable/9/sys/conf/options.amd64
==============================================================================
--- stable/9/sys/conf/options.amd64	Sat Mar 31 14:25:12 2012	(r233749)
+++ stable/9/sys/conf/options.amd64	Sat Mar 31 17:47:50 2012	(r233750)
@@ -7,7 +7,6 @@ COUNT_XINVLTLB_HITS	opt_smp.h
 COUNT_IPIS		opt_smp.h
 MAXMEM
 PERFMON
-PMAP_SHPGPERPROC	opt_pmap.h
 MPTABLE_FORCE_HTT
 MP_WATCHDOG
 NKPT			opt_pmap.h