CVS commit: src/share/man/man9

2010-02-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb  7 10:49:36 UTC 2010

Modified Files:
src/share/man/man9: spl.9

Log Message:
Xref i386/splraise.9 and bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/share/man/man9/spl.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/spl.9
diff -u src/share/man/man9/spl.9:1.37 src/share/man/man9/spl.9:1.38
--- src/share/man/man9/spl.9:1.37	Sat Feb  6 22:32:08 2010
+++ src/share/man/man9/spl.9	Sun Feb  7 10:49:35 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: spl.9,v 1.37 2010/02/06 22:32:08 dyoung Exp $
+.\	$NetBSD: spl.9,v 1.38 2010/02/07 10:49:35 wiz Exp $
 .\
 .\ Copyright (c) 2000, 2001 Jason R. Thorpe.  All rights reserved.
 .\ Copyright (c) 1997 Michael Long.
@@ -27,7 +27,7 @@
 .\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd November 17, 2009
+.Dd February 6, 2010
 .Dt SPL 9
 .Os
 .Sh NAME
@@ -209,6 +209,7 @@
 functions.
 .Sh SEE ALSO
 .Xr condvar 9 ,
+.Xr i386/splraise 9 ,
 .Xr mutex 9 ,
 .Xr rwlock 9
 .Sh HISTORY



CVS commit: src/sys/arch/amiga/dev

2010-02-07 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Feb  7 12:52:04 UTC 2010

Modified Files:
src/sys/arch/amiga/dev: atzsc.c

Log Message:
Remove a now-unused variable declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/amiga/dev/atzsc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/dev/atzsc.c
diff -u src/sys/arch/amiga/dev/atzsc.c:1.40 src/sys/arch/amiga/dev/atzsc.c:1.41
--- src/sys/arch/amiga/dev/atzsc.c:1.40	Fri Feb  5 12:13:36 2010
+++ src/sys/arch/amiga/dev/atzsc.c	Sun Feb  7 12:52:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: atzsc.c,v 1.40 2010/02/05 12:13:36 phx Exp $ */
+/*	$NetBSD: atzsc.c,v 1.41 2010/02/07 12:52:04 he Exp $ */
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: atzsc.c,v 1.40 2010/02/05 12:13:36 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: atzsc.c,v 1.41 2010/02/07 12:52:04 he Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -228,7 +228,6 @@
 atzsc_dmago(struct sbic_softc *dev, char *addr, int count, int flags)
 {
 	volatile struct sdmac *sdp;
-	vu_short istr;
 
 	sdp = dev-sc_cregs;
 	/*



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb  7 15:51:29 UTC 2010

Modified Files:
src/sys/uvm: uvm_swap.c

Log Message:
Use filesystem blocks to address filesystem objects. f_iosize just
happens to be the same for current filesystems.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/uvm/uvm_swap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.148 src/sys/uvm/uvm_swap.c:1.149
--- src/sys/uvm/uvm_swap.c:1.148	Tue Feb  2 15:00:34 2010
+++ src/sys/uvm/uvm_swap.c	Sun Feb  7 15:51:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.148 2010/02/02 15:00:34 wiz Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.149 2010/02/07 15:51:28 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_swap.c,v 1.148 2010/02/02 15:00:34 wiz Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_swap.c,v 1.149 2010/02/07 15:51:28 mlelstv Exp $);
 
 #include fs_nfs.h
 #include opt_uvmhist.h
@@ -872,11 +872,7 @@
 		if ((error = VOP_GETATTR(vp, va, l-l_cred)))
 			goto bad;
 		nblocks = (int)btodb(va.va_size);
-		if ((error =
-		 VFS_STATVFS(vp-v_mount, vp-v_mount-mnt_stat)) != 0)
-			goto bad;
-
-		sdp-swd_bsize = vp-v_mount-mnt_stat.f_iosize;
+		sdp-swd_bsize = 1  vp-v_mount-mnt_fs_bshift;
 		/*
 		 * limit the max # of outstanding I/O requests we issue
 		 * at any one time.   take it easy on NFS servers.



CVS commit: src/sys/dev/dkwedge

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb  7 16:04:31 UTC 2010

Modified Files:
src/sys/dev/dkwedge: dk.c

Log Message:
d_psize routine returns a number of blocks or -1 on error.
d_dump routine returns 0 or an error code.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/dkwedge/dk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.54 src/sys/dev/dkwedge/dk.c:1.55
--- src/sys/dev/dkwedge/dk.c:1.54	Mon Jan 25 14:51:03 2010
+++ src/sys/dev/dkwedge/dk.c	Sun Feb  7 16:04:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.54 2010/01/25 14:51:03 mlelstv Exp $	*/
+/*	$NetBSD: dk.c,v 1.55 2010/02/07 16:04:31 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.54 2010/01/25 14:51:03 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.55 2010/02/07 16:04:31 mlelstv Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_dkwedge.h
@@ -1369,7 +1369,7 @@
 		return (-1);
 	
 	if (sc-sc_state != DKW_STATE_RUNNING)
-		return (ENXIO);
+		return (-1);
 
 	mutex_enter(sc-sc_dk.dk_openlock);
 	mutex_enter(sc-sc_parent-dk_rawlock);
@@ -1403,7 +1403,7 @@
 	int rv = 0;
 
 	if (sc == NULL)
-		return (-1);
+		return (ENXIO);
 	
 	if (sc-sc_state != DKW_STATE_RUNNING)
 		return (ENXIO);



CVS commit: src/sys/ufs

2010-02-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Feb  7 17:12:40 UTC 2010

Modified Files:
src/sys/ufs/ext2fs: ext2fs_inode.c
src/sys/ufs/ffs: ffs_inode.c
src/sys/ufs/lfs: lfs_inode.c
src/sys/ufs/ufs: ufs_inode.c

Log Message:
- ufs_balloc_range(): on error, only PG_RELEASED the pages that were
  allocated to extend the file to the new size. Releasing all pages
  may release pages that contains previously-written data not yet flushed
  to disk. Should fix PR kern/35704
- {ffs,lfs,ext2fs}_truncate(): Even if the inode's size is the same as
  the new length, call uvm_vnp_setsize(). *_truncate() may have been
  called by *_write() in the error path (e.g. block allocation failure
  because of quota of file system full), and at this point v_writesize
  has been set to the desired size of the file and not reverted to the
  old size. Not adjusting v_writesize to the real size cause
  genfs_do_io() to write to disk past the real end of the file.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/ufs/ext2fs/ext2fs_inode.c
cvs rdiff -u -r1.103 -r1.104 src/sys/ufs/ffs/ffs_inode.c
cvs rdiff -u -r1.120 -r1.121 src/sys/ufs/lfs/lfs_inode.c
cvs rdiff -u -r1.78 -r1.79 src/sys/ufs/ufs/ufs_inode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ext2fs/ext2fs_inode.c
diff -u src/sys/ufs/ext2fs/ext2fs_inode.c:1.70 src/sys/ufs/ext2fs/ext2fs_inode.c:1.71
--- src/sys/ufs/ext2fs/ext2fs_inode.c:1.70	Mon Oct 19 18:41:17 2009
+++ src/sys/ufs/ext2fs/ext2fs_inode.c	Sun Feb  7 17:12:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_inode.c,v 1.70 2009/10/19 18:41:17 bouyer Exp $	*/
+/*	$NetBSD: ext2fs_inode.c,v 1.71 2010/02/07 17:12:40 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ext2fs_inode.c,v 1.70 2009/10/19 18:41:17 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: ext2fs_inode.c,v 1.71 2010/02/07 17:12:40 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -272,6 +272,8 @@
 		return (ext2fs_update(ovp, NULL, NULL, 0));
 	}
 	if (ext2fs_size(oip) == length) {
+		/* still do a uvm_vnp_setsize() as writesize may be larger */
+		uvm_vnp_setsize(ovp, length);
 		oip-i_flag |= IN_CHANGE | IN_UPDATE;
 		return (ext2fs_update(ovp, NULL, NULL, 0));
 	}

Index: src/sys/ufs/ffs/ffs_inode.c
diff -u src/sys/ufs/ffs/ffs_inode.c:1.103 src/sys/ufs/ffs/ffs_inode.c:1.104
--- src/sys/ufs/ffs/ffs_inode.c:1.103	Sun Feb 22 20:28:06 2009
+++ src/sys/ufs/ffs/ffs_inode.c	Sun Feb  7 17:12:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_inode.c,v 1.103 2009/02/22 20:28:06 ad Exp $	*/
+/*	$NetBSD: ffs_inode.c,v 1.104 2010/02/07 17:12:40 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_inode.c,v 1.103 2009/02/22 20:28:06 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_inode.c,v 1.104 2010/02/07 17:12:40 bouyer Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -238,6 +238,8 @@
 		return (ffs_update(ovp, NULL, NULL, 0));
 	}
 	if (oip-i_size == length) {
+		/* still do a uvm_vnp_setsize() as writesize may be larger */
+		uvm_vnp_setsize(ovp, length);
 		oip-i_flag |= IN_CHANGE | IN_UPDATE;
 		return (ffs_update(ovp, NULL, NULL, 0));
 	}

Index: src/sys/ufs/lfs/lfs_inode.c
diff -u src/sys/ufs/lfs/lfs_inode.c:1.120 src/sys/ufs/lfs/lfs_inode.c:1.121
--- src/sys/ufs/lfs/lfs_inode.c:1.120	Mon Apr 28 20:24:11 2008
+++ src/sys/ufs/lfs/lfs_inode.c	Sun Feb  7 17:12:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_inode.c,v 1.120 2008/04/28 20:24:11 martin Exp $	*/
+/*	$NetBSD: lfs_inode.c,v 1.121 2010/02/07 17:12:40 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lfs_inode.c,v 1.120 2008/04/28 20:24:11 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: lfs_inode.c,v 1.121 2010/02/07 17:12:40 bouyer Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -226,8 +226,11 @@
 	/*
 	 * Just return and not update modification times.
 	 */
-	if (oip-i_size == length)
+	if (oip-i_size == length) {
+		/* still do a uvm_vnp_setsize() as writesize may be larger */
+		uvm_vnp_setsize(ovp, length);
 		return (0);
+	}
 
 	if (ovp-v_type == VLNK 
 	(oip-i_size  ump-um_maxsymlinklen ||

Index: src/sys/ufs/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.78 src/sys/ufs/ufs/ufs_inode.c:1.79
--- src/sys/ufs/ufs/ufs_inode.c:1.78	Sun Feb 22 20:28:07 2009
+++ src/sys/ufs/ufs/ufs_inode.c	Sun Feb  7 17:12:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_inode.c,v 1.78 2009/02/22 20:28:07 ad Exp $	*/
+/*	$NetBSD: ufs_inode.c,v 1.79 2010/02/07 17:12:40 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_inode.c,v 1.78 2009/02/22 20:28:07 ad Exp $);

CVS commit: src/share/man/man4

2010-02-07 Thread Antoine Reilles
Module Name:src
Committed By:   tonio
Date:   Sun Feb  7 18:09:01 UTC 2010

Modified Files:
src/share/man/man4: uthum.4

Log Message:
Fix typo in Email address, spotted by pgoyette@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/uthum.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/uthum.4
diff -u src/share/man/man4/uthum.4:1.2 src/share/man/man4/uthum.4:1.3
--- src/share/man/man4/uthum.4:1.2	Sat Feb  6 12:44:32 2010
+++ src/share/man/man4/uthum.4	Sun Feb  7 18:09:01 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: uthum.4,v 1.2 2010/02/06 12:44:32 wiz Exp $
+.\	$NetBSD: uthum.4,v 1.3 2010/02/07 18:09:01 tonio Exp $
 .\	$OpenBSD: uthum.4,v 1.3 2009/11/23 20:53:18 jmc Exp $
 .\
 .\ Copyright (c) 2009 Yojiro UO y...@nui.org
@@ -47,7 +47,7 @@
 .An Yojiro UO Aq y...@nui.org .
 .Nx
 porting was done by
-.An Antoine Reilles Aq to...@betbsd.org .
+.An Antoine Reilles Aq to...@netbsd.org .
 .Sh BUGS
 The TEMPer and TEMperHUM have various versions which have the
 same VID/PID and they need different data processing.



CVS commit: src/doc

2010-02-07 Thread Antoine Reilles
Module Name:src
Committed By:   tonio
Date:   Sun Feb  7 18:17:19 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
Note the import of uthum driver from openbsd


To generate a diff of this commit:
cvs rdiff -u -r1.1354 -r1.1355 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1354 src/doc/CHANGES:1.1355
--- src/doc/CHANGES:1.1354	Sat Feb  6 20:13:03 2010
+++ src/doc/CHANGES	Sun Feb  7 18:17:19 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1354 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1355 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -541,3 +541,5 @@
 		roy [20100203]
 	acpismbus(4): Add my experimental ACPI SMBus Control Method
 		Interface driver. [pgoyette 20100206]
+	uthum(4): Add a driver for TEMPer and TEMPerHUM usb thermometers.
+		Adapted from OpenBSD [tonio 20100206]



CVS commit: src/distrib/common

2010-02-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Feb  7 18:50:49 UTC 2010

Modified Files:
src/distrib/common: Makefile.distrib

Log Message:
Update version number examples for the post-2.0I world.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/common/Makefile.distrib

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/common/Makefile.distrib
diff -u src/distrib/common/Makefile.distrib:1.7 src/distrib/common/Makefile.distrib:1.8
--- src/distrib/common/Makefile.distrib:1.7	Tue Jun 27 12:34:54 2006
+++ src/distrib/common/Makefile.distrib	Sun Feb  7 18:50:49 2010
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.distrib,v 1.7 2006/06/27 12:34:54 christos Exp $
+#	$NetBSD: Makefile.distrib,v 1.8 2010/02/07 18:50:49 snj Exp $
 #
 # Makefile snippet to setup various make variables variables used in distrib/:
 #
 # Variables defined:
 #	DISTRIBDIR	Top level of distrib
-#	DISTRIBREV	NetBSD version without dots, as in 15ZD
-#	DISTRIBVER	NetBSD version with dots, as in 1.5ZD
+#	DISTRIBREV	NetBSD version without dots, as in 59924
+#	DISTRIBVER	NetBSD version with dots, as in 5.99.24
 #	DISTRIBVERDEP	Files to depend on for version/revision vars above
 #
 # Commands defined:



CVS commit: src/distrib/notes/common

2010-02-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Feb  7 19:43:12 UTC 2010

Modified Files:
src/distrib/notes/common: main

Log Message:
Use http: for links to files on ftp.NetBSD.org.


To generate a diff of this commit:
cvs rdiff -u -r1.456 -r1.457 src/distrib/notes/common/main

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.456 src/distrib/notes/common/main:1.457
--- src/distrib/notes/common/main:1.456	Tue Feb  2 19:42:32 2010
+++ src/distrib/notes/common/main	Sun Feb  7 19:43:11 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.456 2010/02/02 19:42:32 yhardy Exp $
+.\	$NetBSD: main,v 1.457 2010/02/07 19:43:11 snj Exp $
 .\
 .\ Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -469,10 +469,10 @@
 \*V release.
 The complete list of changes can be found in the
 CHANGES:
-.Lk ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/CHANGES
+.Lk http://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/CHANGES
 and
 CHANGES-6.0:
-.Lk ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/CHANGES-6.0
+.Lk http://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/CHANGES-6.0
 files in the top level directory of the NetBSD 6.0 release tree.
 .Pp
 .\ fill in with changes.mdoc



CVS commit: src/sys/dev/pci

2010-02-07 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Feb  7 20:55:46 UTC 2010

Modified Files:
src/sys/dev/pci: amdpm.c

Log Message:
Recognize the i2c bus on the AMD768 PCI-ISA/LPC Bridge

Resolves PR/42759 - thanks Michael Stapelberg


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/amdpm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/amdpm.c
diff -u src/sys/dev/pci/amdpm.c:1.33 src/sys/dev/pci/amdpm.c:1.34
--- src/sys/dev/pci/amdpm.c:1.33	Tue May 12 08:22:59 2009
+++ src/sys/dev/pci/amdpm.c	Sun Feb  7 20:55:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdpm.c,v 1.33 2009/05/12 08:22:59 cegger Exp $	*/
+/*	$NetBSD: amdpm.c,v 1.34 2010/02/07 20:55:46 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amdpm.c,v 1.33 2009/05/12 08:22:59 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: amdpm.c,v 1.34 2010/02/07 20:55:46 pgoyette Exp $);
 
 #include opt_amdpm.h
 
@@ -155,6 +155,7 @@
 
 	/* try to attach devices on the smbus */
 	if (PCI_PRODUCT(pa-pa_id) == PCI_PRODUCT_AMD_PBC8111_ACPI ||
+	PCI_PRODUCT(pa-pa_id) == PCI_PRODUCT_AMD_PBC768_PMC ||
 	sc-sc_nforce) {
 		amdpm_smbus_attach(sc);
 	}



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb  7 23:25:07 UTC 2010

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Make UVMHIST build again.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/uvm/uvm_fault.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.163 src/sys/uvm/uvm_fault.c:1.164
--- src/sys/uvm/uvm_fault.c:1.163	Fri Feb  5 02:27:15 2010
+++ src/sys/uvm/uvm_fault.c	Sun Feb  7 23:25:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.163 2010/02/05 02:27:15 uebayasi Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.164 2010/02/07 23:25:07 mlelstv Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.163 2010/02/05 02:27:15 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.164 2010/02/07 23:25:07 mlelstv Exp $);
 
 #include opt_uvmhist.h
 
@@ -848,13 +848,14 @@
 	struct uvm_object *uobj;
 	vm_prot_t check_prot;
 	int nback, nforw;
+	UVMHIST_FUNC(uvm_fault_check); UVMHIST_CALLED(maphist);
 
 	/*
 	 * lookup and lock the maps
 	 */
 
 	if (uvmfault_lookup(ufi, false) == false) {
-		UVMHIST_LOG(maphist, - no mapping @ 0x%x, vaddr, 0,0,0);
+		UVMHIST_LOG(maphist, - no mapping @ 0x%x, ufi-orig_rvaddr, 0,0,0);
 		return EFAULT;
 	}
 	/* locked: maps(read) */
@@ -1059,6 +1060,7 @@
 	int lcv;
 	vaddr_t currva;
 	bool shadowed;
+	UVMHIST_FUNC(uvm_fault_upper_lookup); UVMHIST_CALLED(maphist);
 
 	/* locked: maps(read), amap(if there) */
 	KASSERT(amap == NULL || mutex_owned(amap-am_l));
@@ -,7 +1113,7 @@
 	KASSERT(amap == NULL || mutex_owned(amap-am_l));
 	/* (shadowed == true) if there is an anon at the faulting address */
 	UVMHIST_LOG(maphist,   shadowed=%d, will_get=%d, shadowed,
-	(uobj  shadowed != false),0,0);
+	(ufi-entry-object.uvm_obj  shadowed != false),0,0);
 
 	/*
 	 * note that if we are really short of RAM we could sleep in the above
@@ -1129,6 +1131,7 @@
 	struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
 	vaddr_t currva, struct vm_page *pg, bool readonly)
 {
+	UVMHIST_FUNC(uvm_fault_upper_neighbor); UVMHIST_CALLED(maphist);
 
 	/* ignore loaned and busy pages */
 	if (pg == NULL || pg-loan_count != 0 ||
@@ -1269,6 +1272,7 @@
 	struct uvm_object *uobj = ufi-entry-object.uvm_obj;
 	int lcv, gotpages;
 	vaddr_t currva;
+	UVMHIST_FUNC(uvm_fault_lower_lookup); UVMHIST_CALLED(maphist);
 
 	mutex_enter(uobj-vmobjlock);
 	/* locked (!shadowed): maps(read), amap (if there), uobj */
@@ -1330,6 +1334,7 @@
 	struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
 	vaddr_t currva, struct vm_page *pg, bool readonly)
 {
+	UVMHIST_FUNC(uvm_fault_lower_neighor); UVMHIST_CALLED(maphist);
 
 	/*
 	 * calling pgo_get with PGO_LOCKED returns us pages which
@@ -1381,6 +1386,7 @@
 	struct vm_anon * const anon = anons[flt-centeridx];
 	struct uvm_object *uobj;
 	int error;
+	UVMHIST_FUNC(uvm_fault_upper); UVMHIST_CALLED(maphist);
 
 	/* locked: maps(read), amap */
 	KASSERT(mutex_owned(amap-am_l));
@@ -1523,6 +1529,7 @@
 	struct vm_anon * const oanon = anon;
 	struct vm_page *pg;
 	int error;
+	UVMHIST_FUNC(uvm_fault_upper_promote); UVMHIST_CALLED(maphist);
 
 	UVMHIST_LOG(maphist,   case 1B: COW fault,0,0,0,0);
 	uvmexp.flt_acow++;
@@ -1580,6 +1587,7 @@
 	struct vm_anon *oanon)
 {
 	struct vm_amap * const amap = ufi-entry-aref.ar_amap;
+	UVMHIST_FUNC(uvm_fault_upper_enter); UVMHIST_CALLED(maphist);
 
 	/* locked: maps(read), amap, oanon, anon (if different from oanon) */
 	KASSERT(mutex_owned(amap-am_l));
@@ -1672,6 +1680,7 @@
 #endif
 	bool promote;
 	int error;
+	UVMHIST_FUNC(uvm_fault_lower1); UVMHIST_CALLED(maphist);
 
 	/*
 	 * handle case 2: faulting on backing object or zero fill
@@ -1760,6 +1769,7 @@
 	int gotpages;
 	int error;
 	voff_t uoff;
+	UVMHIST_FUNC(uvm_fault_lower_io); UVMHIST_CALLED(maphist);
 
 	/* update rusage counters */
 	curlwp-l_ru.ru_majflt++;
@@ -1775,7 +1785,12 @@
 	0, flt-access_type  MASK(ufi-entry), ufi-entry-advice,
 	PGO_SYNCIO);
 	/* locked: pg(if no error) */
+#if 0
 	KASSERT(error != 0 || (pg-flags  PG_BUSY) != 0);
+#else
+	if (error == 0)
+		KASSERT((pg-flags  PG_BUSY) != 0);
+#endif
 
 	/*
 	 * recover from I/O
@@ -1920,6 +1935,7 @@
 	struct vm_amap * const amap = ufi-entry-aref.ar_amap;
 	struct vm_page *pg;
 	struct vm_page *uobjpage = *ruobjpage;
+	UVMHIST_FUNC(uvm_fault_lower_direct_loan); UVMHIST_CALLED(maphist);
 
 	if (!flt-cow_now) {
 		/* read fault: cap the protection at readonly */
@@ -1963,6 +1979,7 @@
 	struct vm_anon *anon;
 	struct vm_page *pg;
 	int error;
+	UVMHIST_FUNC(uvm_fault_lower_promote); UVMHIST_CALLED(maphist);
 
 	/*
 	 * if we are going to promote the data to an anon we
@@ -2045,6 +2062,7 @@
 {
 	struct vm_amap * const amap = ufi-entry-aref.ar_amap;
 	int error;
+	UVMHIST_FUNC(uvm_fault_lower_enter); UVMHIST_CALLED(maphist);
 
 	/*
 	 * locked:
@@ -2065,8 +2083,8 @@
 	

CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Feb  8 00:01:39 UTC 2010

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Move assertion to make check more clear.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/uvm/uvm_fault.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.164 src/sys/uvm/uvm_fault.c:1.165
--- src/sys/uvm/uvm_fault.c:1.164	Sun Feb  7 23:25:07 2010
+++ src/sys/uvm/uvm_fault.c	Mon Feb  8 00:01:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.164 2010/02/07 23:25:07 mlelstv Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.165 2010/02/08 00:01:39 mlelstv Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.164 2010/02/07 23:25:07 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.165 2010/02/08 00:01:39 mlelstv Exp $);
 
 #include opt_uvmhist.h
 
@@ -1785,12 +1785,6 @@
 	0, flt-access_type  MASK(ufi-entry), ufi-entry-advice,
 	PGO_SYNCIO);
 	/* locked: pg(if no error) */
-#if 0
-	KASSERT(error != 0 || (pg-flags  PG_BUSY) != 0);
-#else
-	if (error == 0)
-		KASSERT((pg-flags  PG_BUSY) != 0);
-#endif
 
 	/*
 	 * recover from I/O
@@ -1819,6 +1813,8 @@
 
 	/* locked: pg */
 
+	KASSERT((pg-flags  PG_BUSY) != 0);
+
 	mutex_enter(uvm_pageqlock);
 	uvm_pageactivate(pg);
 	mutex_exit(uvm_pageqlock);



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Feb  8 00:02:50 UTC 2010

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
pgo_get needs the page array to be initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/uvm/uvm_fault.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.165 src/sys/uvm/uvm_fault.c:1.166
--- src/sys/uvm/uvm_fault.c:1.165	Mon Feb  8 00:01:39 2010
+++ src/sys/uvm/uvm_fault.c	Mon Feb  8 00:02:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.165 2010/02/08 00:01:39 mlelstv Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.166 2010/02/08 00:02:50 mlelstv Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.165 2010/02/08 00:01:39 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.166 2010/02/08 00:02:50 mlelstv Exp $);
 
 #include opt_uvmhist.h
 
@@ -1780,6 +1780,7 @@
 
 	uvmexp.fltget++;
 	gotpages = 1;
+	pg = NULL;
 	uoff = (ufi-orig_rvaddr - ufi-entry-start) + ufi-entry-offset;
 	error = uobj-pgops-pgo_get(uobj, uoff, pg, gotpages,
 	0, flt-access_type  MASK(ufi-entry), ufi-entry-advice,



CVS commit: src/doc

2010-02-07 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Feb  8 03:36:16 UTC 2010

Modified Files:
src/doc: BRANCHES

Log Message:
Describe a new branch, uebayasi-xip.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/doc/BRANCHES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/BRANCHES
diff -u src/doc/BRANCHES:1.285 src/doc/BRANCHES:1.286
--- src/doc/BRANCHES:1.285	Thu Sep 17 16:42:50 2009
+++ src/doc/BRANCHES	Mon Feb  8 03:36:16 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.285 2009/09/17 16:42:50 cube Exp $
+#	$NetBSD: BRANCHES,v 1.286 2010/02/08 03:36:16 uebayasi Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -1297,6 +1297,21 @@
 		   0:22.25 to remove with logging.  No disk IO during this...
 		 - sysinst should use in-fs logs now, not end-of-partition logs.
 
+Branch:		uebayasi-xip
+Description:	Support eXecute-In-Place (XIP)
+Status:		Active
+Start Date:	8 February 2010
+End Date:	
+Base Tag:	uebayasi-xip-base
+Maintainer:	Masao Uebayashi uebay...@netbsd.org
+Scope:		kernel
+Notes:		Goals:
+		- Clean up oddities in fault handler
+		- Add a notion of device page
+		- Teach XIP vnode VOP_GETPAGES
+		- Hook XIP mount option
+		- Teach some pmaps to handle device page
+
 Branch:		vmlocking
 Description:	Make VM and file system framework MP safe
 Status:		Terminated



CVS commit: [uebayasi-xip] src/sys/conf

2010-02-07 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Feb  8 05:01:09 UTC 2010

Modified Files:
src/sys/conf [uebayasi-xip]: files std

Log Message:
Add XIP flag and globally enable it on this branch.


To generate a diff of this commit:
cvs rdiff -u -r1.974 -r1.974.2.1 src/sys/conf/files
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/conf/std

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.974 src/sys/conf/files:1.974.2.1
--- src/sys/conf/files:1.974	Sun Jan 31 15:10:11 2010
+++ src/sys/conf/files	Mon Feb  8 05:01:09 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.974 2010/01/31 15:10:11 pooka Exp $
+#	$NetBSD: files,v 1.974.2.1 2010/02/08 05:01:09 uebayasi Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -116,6 +116,9 @@
 defflag opt_wapbl.h		WAPBL WAPBL_DEBUG
 defparam opt_wapbl.h		WAPBL_DEBUG_PRINT
 
+# eXecute In Place
+defflag opt_xip.h		XIP
+
 # compatibility options
 #
 defflag	opt_sa.h		KERN_SA

Index: src/sys/conf/std
diff -u src/sys/conf/std:1.13 src/sys/conf/std:1.13.2.1
--- src/sys/conf/std:1.13	Wed Oct 21 21:12:05 2009
+++ src/sys/conf/std	Mon Feb  8 05:01:09 2010
@@ -1,4 +1,4 @@
-# $NetBSD: std,v 1.13 2009/10/21 21:12:05 rmind Exp $
+# $NetBSD: std,v 1.13.2.1 2010/02/08 05:01:09 uebayasi Exp $
 #
 # standard MI 'options'
 #
@@ -27,3 +27,5 @@
 options	SCHED_4BSD
 
 pseudo-device	cpuctl
+
+options XIP



CVS commit: [uebayasi-xip] src/sys/uvm

2010-02-07 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Feb  8 05:41:43 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c uvm_page.h

Log Message:
Make vm_physseg::lastpg exclusive end.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.153.2.1 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.59 -r1.59.2.1 src/sys/uvm/uvm_page.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.153 src/sys/uvm/uvm_page.c:1.153.2.1
--- src/sys/uvm/uvm_page.c:1.153	Wed Jan 27 03:56:33 2010
+++ src/sys/uvm/uvm_page.c	Mon Feb  8 05:41:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153 2010/01/27 03:56:33 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.1 2010/02/08 05:41:43 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.153 2010/01/27 03:56:33 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.153.2.1 2010/02/08 05:41:43 uebayasi Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -436,7 +436,7 @@
 		vm_physmem[lcv].pgs = pagearray;
 		pagearray += n;
 		pagecount -= n;
-		vm_physmem[lcv].lastpg = vm_physmem[lcv].pgs + (n - 1);
+		vm_physmem[lcv].end = vm_physmem[lcv].pgs + n;
 
 		/* init and free vm_pages (we've already zeroed them) */
 		paddr = ptoa(vm_physmem[lcv].start);
@@ -855,7 +855,7 @@
 		ps-pgs = NULL;
 	} else {
 		ps-pgs = pgs;
-		ps-lastpg = pgs + npages - 1;
+		ps-endpg = pgs + npages;
 	}
 	ps-free_list = free_list;
 	vm_nphysseg++;
@@ -1980,7 +1980,7 @@
 #endif
 	\n, PAGE, FLAG, PQ, UOBJECT, UANON);
 	for (i = 0; i  vm_nphysseg; i++) {
-		for (pg = vm_physmem[i].pgs; pg = vm_physmem[i].lastpg; pg++) {
+		for (pg = vm_physmem[i].pgs; pg  vm_physmem[i].lastpg; pg++) {
 			(*pr)(%18p %04x %04x %18p %18p,
 			pg, pg-flags, pg-pqflags, pg-uobject,
 			pg-uanon);

Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.59 src/sys/uvm/uvm_page.h:1.59.2.1
--- src/sys/uvm/uvm_page.h:1.59	Sat Feb  6 12:10:59 2010
+++ src/sys/uvm/uvm_page.h	Mon Feb  8 05:41:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.59 2010/02/06 12:10:59 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.59.2.1 2010/02/08 05:41:43 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -236,7 +236,7 @@
 	paddr_t	avail_end;		/* (PF# of last free page in segment) +1  */
 	int	free_list;		/* which free list they belong on */
 	struct	vm_page *pgs;		/* vm_page structures (from start) */
-	struct	vm_page *lastpg;	/* vm_page structure for end */
+	struct	vm_page *endpg;		/* vm_page structure for end */
 #ifdef __HAVE_PMAP_PHYSSEG
 	struct	pmap_physseg pmseg;	/* pmap specific (MD) data */
 #endif



CVS commit: [uebayasi-xip] src/sys/uvm

2010-02-07 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Feb  8 05:53:05 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c uvm_page.h

Log Message:
Make vm_physseg lookup into a real function.


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.1 -r1.153.2.2 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.59.2.1 -r1.59.2.2 src/sys/uvm/uvm_page.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.153.2.1 src/sys/uvm/uvm_page.c:1.153.2.2
--- src/sys/uvm/uvm_page.c:1.153.2.1	Mon Feb  8 05:41:43 2010
+++ src/sys/uvm/uvm_page.c	Mon Feb  8 05:53:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153.2.1 2010/02/08 05:41:43 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.2 2010/02/08 05:53:05 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.153.2.1 2010/02/08 05:41:43 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.153.2.2 2010/02/08 05:53:05 uebayasi Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -436,7 +436,7 @@
 		vm_physmem[lcv].pgs = pagearray;
 		pagearray += n;
 		pagecount -= n;
-		vm_physmem[lcv].end = vm_physmem[lcv].pgs + n;
+		vm_physmem[lcv].endpg = vm_physmem[lcv].pgs + n;
 
 		/* init and free vm_pages (we've already zeroed them) */
 		paddr = ptoa(vm_physmem[lcv].start);
@@ -866,6 +866,126 @@
 }
 
 /*
+ * vm_physseg_find: find vm_physseg structure that belongs to a PA
+ */
+
+#if VM_PHYSSEG_MAX == 1
+static inline int vm_physseg_find_contig(struct vm_physseg *, int, paddr_t, int *);
+#elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
+static inline int vm_physseg_find_bsearch(struct vm_physseg *, int, paddr_t, int *);
+#else
+static inline int vm_physseg_find_linear(struct vm_physseg *, int, paddr_t, int *);
+#endif
+
+int
+vm_physseg_find(paddr_t pframe, int *offp)
+{
+
+#if VM_PHYSSEG_MAX == 1
+	return vm_physseg_find_contig(vm_physmem, vm_nphysseg, pframe, offp);
+#elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
+	return vm_physseg_find_bsearch(vm_physmem, vm_nphysseg, pframe, offp);
+#else
+	return vm_physseg_find_linear(vm_physmem, vm_nphysseg, pframe, offp);
+#endif
+}
+
+#if VM_PHYSSEG_MAX == 1
+static inline int
+vm_physseg_find_contig(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
+{
+
+	/* 'contig' case */
+	if (pframe = segs[0].start  pframe  segs[0].end) {
+		if (offp)
+			*offp = pframe - segs[0].start;
+		return(0);
+	}
+	return(-1);
+}
+
+#elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
+
+static inline int
+vm_physseg_find_bsearch(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
+{
+	/* binary search for it */
+	u_int	start, len, try;
+
+	/*
+	 * if try is too large (thus target is less than try) we reduce
+	 * the length to trunc(len/2) [i.e. everything smaller than try]
+	 *
+	 * if the try is too small (thus target is greater than try) then
+	 * we set the new start to be (try + 1).   this means we need to
+	 * reduce the length to (round(len/2) - 1).
+	 *
+	 * note adjust below which takes advantage of the fact that
+	 *  (round(len/2) - 1) == trunc((len - 1) / 2)
+	 * for any value of len we may have
+	 */
+
+	for (start = 0, len = nsegs ; len != 0 ; len = len / 2) {
+		try = start + (len / 2);	/* try in the middle */
+
+		/* start past our try? */
+		if (pframe = segs[try].start) {
+			/* was try correct? */
+			if (pframe  segs[try].end) {
+if (offp)
+	*offp = pframe - segs[try].start;
+return(try);/* got it */
+			}
+			start = try + 1;	/* next time, start here */
+			len--;			/* adjust */
+		} else {
+			/*
+			 * pframe before try, just reduce length of
+			 * region, done in for loop
+			 */
+		}
+	}
+	return(-1);
+}
+
+#else
+
+static inline int
+vm_physseg_find_linear(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
+{
+	/* linear search for it */
+	int	lcv;
+
+	for (lcv = 0; lcv  nsegs; lcv++) {
+		if (pframe = segs[lcv].start 
+		pframe  segs[lcv].end) {
+			if (offp)
+*offp = pframe - segs[lcv].start;
+			return(lcv);		   /* got it */
+		}
+	}
+	return(-1);
+}
+#endif
+
+/*
+ * PHYS_TO_VM_PAGE: find vm_page for a PA.   used by MI code to get vm_pages
+ * back from an I/O mapping (ugh!).   used in some MD code as well.
+ */
+struct vm_page *
+uvm_phys_to_vm_page(paddr_t pa)
+{
+	paddr_t pf = atop(pa);
+	int	off;
+	int	psi;
+
+	psi = vm_physseg_find(pf, off);
+	if (psi != -1)
+		return(vm_physmem[psi].pgs[off]);
+	return(NULL);
+}
+
+/*
  * uvm_page_recolor: Recolor the pages if the new bucket count is
  * larger than the old one.
  */
@@ -1980,7 +2100,7 @@
 #endif
 	\n, PAGE, FLAG, PQ, UOBJECT, UANON);
 	for (i = 0; i  vm_nphysseg; i++) {
-		for (pg = vm_physmem[i].pgs; pg  vm_physmem[i].lastpg; pg++) {
+		for (pg = vm_physmem[i].pgs; pg  vm_physmem[i].endpg; pg++) {
 			

CVS commit: [uebayasi-xip] src/sys/uvm

2010-02-07 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Feb  8 06:14:57 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c

Log Message:
Abstract vm_physseg_find() to handle struct vm_page *.


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.2 -r1.153.2.3 src/sys/uvm/uvm_page.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.153.2.2 src/sys/uvm/uvm_page.c:1.153.2.3
--- src/sys/uvm/uvm_page.c:1.153.2.2	Mon Feb  8 05:53:05 2010
+++ src/sys/uvm/uvm_page.c	Mon Feb  8 06:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153.2.2 2010/02/08 05:53:05 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.3 2010/02/08 06:14:57 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.153.2.2 2010/02/08 05:53:05 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.153.2.3 2010/02/08 06:14:57 uebayasi Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -869,34 +869,42 @@
  * vm_physseg_find: find vm_physseg structure that belongs to a PA
  */
 
+#define	VM_PHYSSEG_OP_PF	1
+#define	VM_PHYSSEG_OP_PG	2
+
 #if VM_PHYSSEG_MAX == 1
-static inline int vm_physseg_find_contig(struct vm_physseg *, int, paddr_t, int *);
+#define	VM_PHYSSEG_FIND	vm_physseg_find_contig
 #elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
-static inline int vm_physseg_find_bsearch(struct vm_physseg *, int, paddr_t, int *);
+#define	VM_PHYSSEG_FIND	vm_physseg_find_bsearch
 #else
-static inline int vm_physseg_find_linear(struct vm_physseg *, int, paddr_t, int *);
+#define	VM_PHYSSEG_FIND	vm_physseg_find_linear
 #endif
 
+static inline int VM_PHYSSEG_FIND(struct vm_physseg *, int, int,
+paddr_t, struct vm_page *, int *);
+static inline bool vm_physseg_within_p(struct vm_physseg *, int, paddr_t,
+struct vm_page *);
+static inline bool vm_physseg_ge_p(struct vm_physseg *, int, paddr_t,
+struct vm_page *);
+static inline bool vm_physseg_lt_p(struct vm_physseg *, int, paddr_t,
+struct vm_page *);
+
 int
 vm_physseg_find(paddr_t pframe, int *offp)
 {
 
-#if VM_PHYSSEG_MAX == 1
-	return vm_physseg_find_contig(vm_physmem, vm_nphysseg, pframe, offp);
-#elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
-	return vm_physseg_find_bsearch(vm_physmem, vm_nphysseg, pframe, offp);
-#else
-	return vm_physseg_find_linear(vm_physmem, vm_nphysseg, pframe, offp);
-#endif
+	return VM_PHYSSEG_FIND(vm_physmem, vm_nphysseg, VM_PHYSSEG_OP_PF,
+	pframe, NULL, offp);
 }
 
 #if VM_PHYSSEG_MAX == 1
 static inline int
-vm_physseg_find_contig(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
+vm_physseg_find_contig(struct vm_physseg *segs, int nsegs, int op,
+paddr_t pframe, struct vm_page *pg, int *offp)
 {
 
 	/* 'contig' case */
-	if (pframe = segs[0].start  pframe  segs[0].end) {
+	if (vm_physseg_within_p(segs[0], op, pframe, pg)) {
 		if (offp)
 			*offp = pframe - segs[0].start;
 		return(0);
@@ -907,7 +915,8 @@
 #elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
 
 static inline int
-vm_physseg_find_bsearch(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
+vm_physseg_find_bsearch(struct vm_physseg *segs, int nsegs, int op,
+paddr_t pframe, struct vm_page *pg, int *offp)
 {
 	/* binary search for it */
 	u_int	start, len, try;
@@ -929,9 +938,9 @@
 		try = start + (len / 2);	/* try in the middle */
 
 		/* start past our try? */
-		if (pframe = segs[try].start) {
+		if (vm_physseg_ge_p(segs[try], op, pframe, pg)) {
 			/* was try correct? */
-			if (pframe  segs[try].end) {
+			if (vm_physseg_lt_p(segs[try], op, pframe, pg)) {
 if (offp)
 	*offp = pframe - segs[try].start;
 return(try);/* got it */
@@ -951,14 +960,14 @@
 #else
 
 static inline int
-vm_physseg_find_linear(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
+vm_physseg_find_linear(struct vm_physseg *segs, int nsegs, int op,
+paddr_t pframe, struct vm_page *pg, int *offp)
 {
 	/* linear search for it */
 	int	lcv;
 
 	for (lcv = 0; lcv  nsegs; lcv++) {
-		if (pframe = segs[lcv].start 
-		pframe  segs[lcv].end) {
+		if (vm_physseg_within_p(segs[lcv], op, pframe, pg)) {
 			if (offp)
 *offp = pframe - segs[lcv].start;
 			return(lcv);		   /* got it */
@@ -968,6 +977,46 @@
 }
 #endif
 
+static inline bool
+vm_physseg_within_p(struct vm_physseg *seg, int op, paddr_t pframe,
+struct vm_page *pg)
+{
+
+	return vm_physseg_ge_p(seg, op, pframe, pg) 
+	vm_physseg_lt_p(seg, op, pframe, pg);
+}
+
+static inline bool
+vm_physseg_ge_p(struct vm_physseg *seg, int op, paddr_t pframe,
+struct vm_page *pg)
+{
+
+	switch (op) {
+	case VM_PHYSSEG_OP_PF:
+		return pframe = seg-start;
+	case VM_PHYSSEG_OP_PG:
+		return pg = seg-pgs;
+	default:
+		return false;
+	}
+}
+
+static inline bool
+vm_physseg_lt_p(struct 

CVS commit: src/sbin/mount_smbfs

2010-02-07 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Mon Feb  8 07:56:06 UTC 2010

Modified Files:
src/sbin/mount_smbfs: Makefile.inc

Log Message:
use

.if defined(HAVE_GCC)  ${HAVE_GCC} == 4

rather than

.if ${HAVE_GCC} == 4

as HAVE_GCC may be undefined


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/mount_smbfs/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/mount_smbfs/Makefile.inc
diff -u src/sbin/mount_smbfs/Makefile.inc:1.1 src/sbin/mount_smbfs/Makefile.inc:1.2
--- src/sbin/mount_smbfs/Makefile.inc:1.1	Fri Sep  4 18:25:56 2009
+++ src/sbin/mount_smbfs/Makefile.inc	Mon Feb  8 07:56:06 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.1 2009/09/04 18:25:56 pooka Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2010/02/08 07:56:06 plunky Exp $
 #
 
 SRCS+=	rcfile.c ctx.c cfopt.c subr.c nls.c rap.c mbuf.c rq.c file.c \
@@ -13,7 +13,7 @@
 DPADD+=${LIBUTIL}
 LDADD+=-lutil
 
-.if ${HAVE_GCC} == 4
+.if defined(HAVE_GCC)  ${HAVE_GCC} == 4
 .for f in ctx mbuf nb_name nbns_rq
 COPTS.${f}.c+=   -Wno-pointer-sign
 .endfor



CVS commit: src/external/bsd/am-utils

2010-02-07 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Mon Feb  8 07:56:39 UTC 2010

Modified Files:
src/external/bsd/am-utils/bin/amd: Makefile
src/external/bsd/am-utils/bin/amq: Makefile
src/external/bsd/am-utils/bin/pawd: Makefile
src/external/bsd/am-utils/lib/libamu: Makefile

Log Message:
use

.if defined(HAVE_GCC)  ${HAVE_GCC} == 4

rather than

.if ${HAVE_GCC} == 4

as HAVE_GCC may be undefined


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/am-utils/bin/amd/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/am-utils/bin/amq/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/am-utils/bin/pawd/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/am-utils/lib/libamu/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/am-utils/bin/amd/Makefile
diff -u src/external/bsd/am-utils/bin/amd/Makefile:1.4 src/external/bsd/am-utils/bin/amd/Makefile:1.5
--- src/external/bsd/am-utils/bin/amd/Makefile:1.4	Thu Oct 29 14:42:54 2009
+++ src/external/bsd/am-utils/bin/amd/Makefile	Mon Feb  8 07:56:38 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2009/10/29 14:42:54 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2010/02/08 07:56:38 plunky Exp $
 
 .include ${.CURDIR}/../Makefile.inc
 
@@ -44,7 +44,7 @@
 SRCS+=	info_nis.c
 .endif
 
-.if ${HAVE_GCC} == 4
+.if defined(HAVE_GCC)  ${HAVE_GCC} == 4
 COPTS.amq_subr.c+=	-fno-strict-aliasing
 .endif
 

Index: src/external/bsd/am-utils/bin/amq/Makefile
diff -u src/external/bsd/am-utils/bin/amq/Makefile:1.1 src/external/bsd/am-utils/bin/amq/Makefile:1.2
--- src/external/bsd/am-utils/bin/amq/Makefile:1.1	Fri Sep 19 21:38:40 2008
+++ src/external/bsd/am-utils/bin/amq/Makefile	Mon Feb  8 07:56:38 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2008/09/19 21:38:40 christos Exp $
+#	$NetBSD: Makefile,v 1.2 2010/02/08 07:56:38 plunky Exp $
 
 .include ${.CURDIR}/../Makefile.inc
 
@@ -13,7 +13,7 @@
 CPPFLAGS+=	-I${DIST}
 LDADD+=		${LIBAMU}
 
-.if ${HAVE_GCC} == 4
+.if defined(HAVE_GCC)  ${HAVE_GCC} == 4
 COPTS.amq_xdr.c+=	-fno-strict-aliasing
 COPTS.amq.c+=		-fno-strict-aliasing
 .endif

Index: src/external/bsd/am-utils/bin/pawd/Makefile
diff -u src/external/bsd/am-utils/bin/pawd/Makefile:1.2 src/external/bsd/am-utils/bin/pawd/Makefile:1.3
--- src/external/bsd/am-utils/bin/pawd/Makefile:1.2	Sat Sep 20 10:45:48 2008
+++ src/external/bsd/am-utils/bin/pawd/Makefile	Mon Feb  8 07:56:38 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2008/09/20 10:45:48 mrg Exp $
+#	$NetBSD: Makefile,v 1.3 2010/02/08 07:56:38 plunky Exp $
 
 BINDIR=	/usr/bin
 
@@ -15,7 +15,7 @@
 CPPFLAGS+=	-I${DIST}
 LDADD+=		${LIBAMU}
 
-.if ${HAVE_GCC} == 4
+.if defined(HAVE_GCC)  ${HAVE_GCC} == 4
 COPTS.amq_xdr.c+=	-fno-strict-aliasing
 .endif
 

Index: src/external/bsd/am-utils/lib/libamu/Makefile
diff -u src/external/bsd/am-utils/lib/libamu/Makefile:1.1 src/external/bsd/am-utils/lib/libamu/Makefile:1.2
--- src/external/bsd/am-utils/lib/libamu/Makefile:1.1	Fri Sep 19 21:38:41 2008
+++ src/external/bsd/am-utils/lib/libamu/Makefile	Mon Feb  8 07:56:38 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2008/09/19 21:38:41 christos Exp $
+#	$NetBSD: Makefile,v 1.2 2010/02/08 07:56:38 plunky Exp $
 
 NOLINKLIB=	# defined
 
@@ -18,7 +18,7 @@
 	wire.c xdr_func.c xutil.c
 
 # XXX
-.if ${HAVE_GCC} == 4
+.if defined(HAVE_GCC)  ${HAVE_GCC} == 4
 COPTS.xdr_func.c+=	-fno-strict-aliasing
 .endif