CVS commit: src/sys/miscfs/specfs

2009-10-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct  4 06:23:58 UTC 2009

Modified Files:
src/sys/miscfs/specfs: spec_vnops.c

Log Message:
Put workaround fix for LOCKDEBUG panic mentioned in PR kern/41078:
 Don't try to load a driver module if the driver is already exist but just
 not attached. [bc]dev_open() could return ENXIO even if the driver exists.

XXX: Maybe this should be handled by helper functions for
XXX: module_autoload() calls on demand.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/miscfs/specfs/spec_vnops.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/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.124 src/sys/miscfs/specfs/spec_vnops.c:1.125
--- src/sys/miscfs/specfs/spec_vnops.c:1.124	Sat Apr 25 15:06:32 2009
+++ src/sys/miscfs/specfs/spec_vnops.c	Sun Oct  4 06:23:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec_vnops.c,v 1.124 2009/04/25 15:06:32 rmind Exp $	*/
+/*	$NetBSD: spec_vnops.c,v 1.125 2009/10/04 06:23:58 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.124 2009/04/25 15:06:32 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.125 2009/10/04 06:23:58 tsutsui Exp $");
 
 #include 
 #include 
@@ -405,11 +405,20 @@
 			vp->v_vflag |= VV_ISTTY;
 		VOP_UNLOCK(vp, 0);
 		do {
+			const struct cdevsw *cdev;
+
 			gen = module_gen;
 			error = cdev_open(dev, ap->a_mode, S_IFCHR, l);
 			if (error != ENXIO)
 break;
 			
+			/* Check if we already have a valid driver */
+			mutex_enter(&device_lock);
+			cdev = cdevsw_lookup(dev);
+			mutex_exit(&device_lock);
+			if (cdev != NULL)
+break;
+
 			/* Get device name from devsw_conv array */
 			if ((name = cdevsw_getname(major(dev))) == NULL)
 break;
@@ -447,11 +456,20 @@
 		sd->sd_bdevvp = vp;
 		mutex_exit(&device_lock);
 		do {
+			const struct bdevsw *bdev;
+
 			gen = module_gen;
 			error = bdev_open(dev, ap->a_mode, S_IFBLK, l);
 			if (error != ENXIO)
 break;
 
+			/* Check if we already have a valid driver */
+			mutex_enter(&device_lock);
+			bdev = bdevsw_lookup(dev);
+			mutex_exit(&device_lock);
+			if (bdev != NULL)
+break;
+
 			/* Get device name from devsw_conv array */
 			if ((name = bdevsw_getname(major(dev))) == NULL)
 break;



CVS commit: src/sys/kern

2009-10-03 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Sun Oct  4 03:15:08 UTC 2009

Modified Files:
src/sys/kern: kern_proc.c sys_process.c

Log Message:
Install floppies (haha) don't get built with ktrace/ptrace, so they don't
include kern/sys_process.c. Move proc_uidmatch() to kern/kern_proc.c which
always gets built instead.

Pointed out by Kurt Schreiner on current-users@:

http://mail-index.netbsd.org/current-users/2009/10/03/msg010745.html


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.149 -r1.150 src/sys/kern/sys_process.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/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.153 src/sys/kern/kern_proc.c:1.154
--- src/sys/kern/kern_proc.c:1.153	Sat Oct  3 03:38:31 2009
+++ src/sys/kern/kern_proc.c	Sun Oct  4 03:15:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.153 2009/10/03 03:38:31 elad Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.154 2009/10/04 03:15:08 elad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.153 2009/10/03 03:38:31 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.154 2009/10/04 03:15:08 elad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_maxuprc.h"
@@ -1436,3 +1436,36 @@
 	specificdata_setspecific(proc_specificdata_domain,
  &p->p_specdataref, key, data);
 }
+
+int
+proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
+{
+	int r = 0;
+
+	if (kauth_cred_getuid(cred) != kauth_cred_getuid(target) ||
+	kauth_cred_getuid(cred) != kauth_cred_getsvuid(target)) {
+		/*
+		 * suid proc of ours or proc not ours
+		 */
+		r = EPERM;
+	} else if (kauth_cred_getgid(target) != kauth_cred_getsvgid(target)) {
+		/*
+		 * sgid proc has sgid back to us temporarily
+		 */
+		r = EPERM;
+	} else {
+		/*
+		 * our rgid must be in target's group list (ie,
+		 * sub-processes started by a sgid process)
+		 */
+		int ismember = 0;
+
+		if (kauth_cred_ismember_gid(cred,
+		kauth_cred_getgid(target), &ismember) != 0 ||
+		!ismember)
+			r = EPERM;
+	}
+
+	return (r);
+}
+

Index: src/sys/kern/sys_process.c
diff -u src/sys/kern/sys_process.c:1.149 src/sys/kern/sys_process.c:1.150
--- src/sys/kern/sys_process.c:1.149	Fri Oct  2 22:38:45 2009
+++ src/sys/kern/sys_process.c	Sun Oct  4 03:15:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_process.c,v 1.149 2009/10/02 22:38:45 elad Exp $	*/
+/*	$NetBSD: sys_process.c,v 1.150 2009/10/04 03:15:08 elad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.149 2009/10/02 22:38:45 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.150 2009/10/04 03:15:08 elad Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_ktrace.h"
@@ -1032,39 +1032,3 @@
 	KERNEL_LOCK(l->l_biglocks, l);
 }
 #endif	/* KTRACE || PTRACE */
-
-/*
- * common code for corename, rlimit, and stopflag.
- */
-int
-proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
-{
-	int r = 0;
-
-	if (kauth_cred_getuid(cred) != kauth_cred_getuid(target) ||
-	kauth_cred_getuid(cred) != kauth_cred_getsvuid(target)) {
-		/*
-		 * suid proc of ours or proc not ours
-		 */
-		r = EPERM;
-	} else if (kauth_cred_getgid(target) != kauth_cred_getsvgid(target)) {
-		/*
-		 * sgid proc has sgid back to us temporarily
-		 */
-		r = EPERM;
-	} else {
-		/*
-		 * our rgid must be in target's group list (ie,
-		 * sub-processes started by a sgid process)
-		 */
-		int ismember = 0;
-
-		if (kauth_cred_ismember_gid(cred,
-		kauth_cred_getgid(target), &ismember) != 0 ||
-		!ismember)
-			r = EPERM;
-	}
-
-	return (r);
-}
-



CVS commit: src/etc

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 01:40:53 UTC 2009

Modified Files:
src/etc: master.passwd

Log Message:
mdnsd home should not be /var/www!


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/etc/master.passwd

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

Modified files:

Index: src/etc/master.passwd
diff -u src/etc/master.passwd:1.40 src/etc/master.passwd:1.41
--- src/etc/master.passwd:1.40	Tue Sep 29 19:56:27 2009
+++ src/etc/master.passwd	Sat Oct  3 21:40:53 2009
@@ -14,6 +14,6 @@
 _timedc:*:22:22::0:0:& pseudo-user:/nonexistent:/sbin/nologin
 _sdpd:*:23:23::0:0:& pseudo-user:/nonexistent:/sbin/nologin
 _httpd:*:24:24::0:0:& pseudo-user:/var/www:/sbin/nologin
-_mdnsd:*:25:25::0:0:& pseudo-user:/var/www:/sbin/nologin
+_mdnsd:*:25:25::0:0:& pseudo-user:/nonexistent:/sbin/nologin
 uucp:*:66:1::0:0:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin
 nobody:*:32767:39::0:0:Unprivileged user:/nonexistent:/sbin/nologin



CVS commit: [netbsd-5-0] src/doc

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:57:06 UTC 2009

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.2

Log Message:
Ticket 1020.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/doc/CHANGES-5.0.2

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-5.0.2
diff -u src/doc/CHANGES-5.0.2:1.1.2.14 src/doc/CHANGES-5.0.2:1.1.2.15
--- src/doc/CHANGES-5.0.2:1.1.2.14	Wed Sep 16 04:58:53 2009
+++ src/doc/CHANGES-5.0.2	Sun Oct  4 00:57:06 2009
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.2,v 1.1.2.14 2009/09/16 04:58:53 snj Exp $
+# $NetBSD: CHANGES-5.0.2,v 1.1.2.15 2009/10/04 00:57:06 snj Exp $
 
 A complete list of changes from the NetBSD 5.0.1 release to the NetBSD 5.0.2
 release:
@@ -292,3 +292,11 @@
 	quite nicely on a 4000/90.
 	[mhitch, ticket #955]
 
+bin/pax/Makefile1.38
+bin/pax/ar_io.c	1.49
+tools/compat/configure1.69
+tools/compat/configure.ac			1.69
+
+	Do not require sys/mtio.h for a tools build of pax.
+	[apb, ticket #1020]
+



CVS commit: [netbsd-5] src/doc

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:54:16 UTC 2009

Modified Files:
src/doc [netbsd-5]: CHANGES-5.1

Log Message:
Latest bunch of tickets.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.79 -r1.1.2.80 src/doc/CHANGES-5.1

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-5.1
diff -u src/doc/CHANGES-5.1:1.1.2.79 src/doc/CHANGES-5.1:1.1.2.80
--- src/doc/CHANGES-5.1:1.1.2.79	Wed Sep 30 00:30:34 2009
+++ src/doc/CHANGES-5.1	Sun Oct  4 00:54:16 2009
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1,v 1.1.2.79 2009/09/30 00:30:34 snj Exp $
+# $NetBSD: CHANGES-5.1,v 1.1.2.80 2009/10/04 00:54:16 snj Exp $
 
 A complete list of changes from the NetBSD 5.0 release to the NetBSD 5.1
 release:
@@ -13743,3 +13743,183 @@
 	Add i386PAE support to Xen3 dom0.
 	[bouyer, ticket #1040]
 
+bin/pax/Makefile1.38
+bin/pax/ar_io.c	1.49
+tools/compat/configure1.69
+tools/compat/configure.ac			1.69
+
+	Do not require sys/mtio.h for a tools build of pax.
+	[apb, ticket #1020]
+
+sys/dev/pci/if_vr.c1.98-1.99
+
+	Replace shutdownhook_establish(9) with pmf_device_register1(9).
+	Tested VIA VT86C100A (which is probed as VT3043).
+	--
+	Add suspend/resume support.
+	[jmcneill, ticket #1022]
+
+sbin/fsck_ffs/extern.h1.25 via patch
+sbin/fsck_ffs/setup.c1.88 via patch
+sbin/fsck_ffs/wapbl.c1.4 via patch 
+sbin/tunefs/tunefs.c1.41 via patch
+sys/ufs/ffs/ffs_vfsops.c			1.252 via patch
+sys/ufs/ffs/ffs_wapbl.c1.13 via patch
+
+	Allow tunefs to clear any type of WAPBL log, not only
+	in-filesystem ones.
+	--
+	Do some basic checks of the WAPBL journal, to abort the boot
+	before the kernel refuse to mount a filesystem read-write
+	(booting a system multiuser with critical filesystems read-only
+	is bad): Add a check_wapbl() which will check some WAPBL values
+	in the superblock, and try to read the journal via
+	wapbl_replay_start() if there is one.  pfatal() if one of these
+	fail (abort boot if in preen mode, as "CONTINUE" otherwise). In
+	non-preen mode the bogus journal will be cleared.
+	check_wapbl() is always called if the superblock supports WAPBL.
+	Even if FS_DOWAPBL is not there, there could be flags asking the
+	kernel to clear or create a log with bogus values which would
+	cause the kernel refuse to mount the filesystem.
+	--
+	If the WAPBL journal can't be read (ffs_wapbl_replay_start() fails),
+	mount the filesystem anyway if MNT_FORCE is present.
+	This allows to still boot single-user a system with a corrupted
+	WAPBL on /, and so get a chance to run fsck to fix it.
+	[bouyer, ticket #1036]
+
+sys/fs/smbfs/smbfs_node.c			1.41 via patch
+sys/fs/smbfs/smbfs_vfsops.c			1.88 via patch
+
+	Fix some panics while trying to umount a smbfs share.
+	Be sure that no other active vnodes remains, before trying to
+	release the root one. Likewise, do not destroy the smbmount
+	specific structure if the umount will fail (busy conditions).
+	[njoly, ticket #1041]
+
+sys/fs/puffs/puffs_node.c			1.14
+sys/fs/puffs/puffs_vnops.c			1.134
+
+	Fix a race introduced almost two years ago in rev 1.116:
+	operations creating a node cannot be considered outgoing
+	operations, since after return from userspace they modify file
+	system state by creating a new node.  If we do not protect the
+	file system by holding the directory lock, a lookup operation
+	might race us into the kernel and create the node earlier.
+	Remove pnode from hashlish before sending the reclaim faf off to
+	userspace.  Also, hold pmp_lock while frobbing the list.
+	[pooka, ticket #1042]
+
+bin/kill/kill.c	1.26
+
+	Make sure that numerical signals and pids are in range for their
+	types.  Fixes PR bin/42143.
+	[spz, ticket #1043]
+
+distrib/utils/sysinst/disks.c			1.107
+
+	In get_descr(), initialize dd_descr to an empty string before
+	probing ATA and SCSI identification. Fixes issues with xbd and
+	raid.
+	[jmcneill, ticket #1046]
+
+sys/arch/amd64/amd64/netbsd32_machdep.c		1.59
+
+	Ensure FP state is reset, if FP is used in a signal handler.
+	Fixes PR kern/39299 for 32bit code.
+	[mlelstv, ticket #1048]
+
+sys/arch/amiga/dev/clock.c			1.49
+
+	Related to ticket #1011: we have a full 32-bit counter, so the
+	masking is not needed.
+	[mhitch, ticket #1049]
+
+sys/arch/i386/include/npx.h			1.23
+
+	The FPU Tag word is a 16bit register, in FPU (387) mode it
+	defines 2-bit tags for each FPU data register, in MMX mode it
+	defines 1-bit tags for each data register. The single bit
+	tags are stored in the lower 8 bits and thus in the first byte
+	of the save frame.
+	[mlelstv, ticket #1050]
+
+sys/arch/cobalt/dev/panel.c			1.19-1.20
+
+	Adjust attach message for failure path (found on gxemul).
+	Replace shutdownhook_establish(9) with pmf_device_register1(9).
+	Also check howto to print appropriate "Rebooting..." or
+	"Halting..." messages.
+	[tsutsui, ticket #1053]
+
+sys/arch/amd64/amd64/machdep.c			1

CVS commit: [netbsd-5] src/sys/arch

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:45:35 UTC 2009

Modified Files:
src/sys/arch/landisk/dev [netbsd-5]: obio.c
src/sys/arch/landisk/include [netbsd-5]: bus.h
src/sys/arch/landisk/landisk [netbsd-5]: shpcic_machdep.c
src/sys/arch/sh3/dev [netbsd-5]: shpcic.c shpcicvar.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1063):
sys/arch/landisk/dev/obio.c: revision 1.7
sys/arch/landisk/include/bus.h: revision 1.5
sys/arch/landisk/landisk/shpcic_machdep.c: revision 1.2
sys/arch/sh3/dev/shpcic.c: revision 1.13
sys/arch/sh3/dev/shpcicvar.h: revision 1.7
fix build failure.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/arch/landisk/dev/obio.c
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/arch/landisk/include/bus.h
cvs rdiff -u -r1.1 -r1.1.76.1 src/sys/arch/landisk/landisk/shpcic_machdep.c
cvs rdiff -u -r1.12 -r1.12.14.1 src/sys/arch/sh3/dev/shpcic.c
cvs rdiff -u -r1.6 -r1.6.88.1 src/sys/arch/sh3/dev/shpcicvar.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/arch/landisk/dev/obio.c
diff -u src/sys/arch/landisk/dev/obio.c:1.6 src/sys/arch/landisk/dev/obio.c:1.6.10.1
--- src/sys/arch/landisk/dev/obio.c:1.6	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/landisk/dev/obio.c	Sun Oct  4 00:45:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.6 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: obio.c,v 1.6.10.1 2009/10/04 00:45:35 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.6 2008/04/28 20:23:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.6.10.1 2009/10/04 00:45:35 snj Exp $");
 
 #include "btn_obio.h"
 #include "pwrsw_obio.h"
@@ -243,6 +243,8 @@
 bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
 bus_addr_t *bpap, bus_space_handle_t *bshp);
 void obio_iomem_free(void *v, bus_space_handle_t bsh, bus_size_t size);
+paddr_t obio_iomem_mmap(void *v, bus_addr_t addr, off_t off, int prot,
+int flags);
 
 static int obio_iomem_add_mapping(bus_addr_t, bus_size_t, int,
 bus_space_handle_t *);
@@ -384,6 +386,13 @@
 	obio_iomem_unmap(v, bsh, size);
 }
 
+paddr_t
+obio_iomem_mmap(void *v, bus_addr_t addr, off_t off, int prot, int flags)
+{
+
+	return (paddr_t)-1;
+}
+
 /*
  * on-board I/O bus space read/write
  */
@@ -450,6 +459,8 @@
 	.bs_alloc = obio_iomem_alloc,
 	.bs_free = obio_iomem_free,
 
+	.bs_mmap = obio_iomem_mmap,
+
 	.bs_r_1 = obio_iomem_read_1,
 	.bs_r_2 = obio_iomem_read_2,
 	.bs_r_4 = obio_iomem_read_4,

Index: src/sys/arch/landisk/include/bus.h
diff -u src/sys/arch/landisk/include/bus.h:1.4 src/sys/arch/landisk/include/bus.h:1.4.10.1
--- src/sys/arch/landisk/include/bus.h:1.4	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/landisk/include/bus.h	Sun Oct  4 00:45:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.4 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: bus.h,v 1.4.10.1 2009/10/04 00:45:35 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -130,6 +130,9 @@
 	/* get kernel virtual address */
 	void *		(*bs_vaddr)(void *, bus_space_handle_t);
 
+	/* mmap bus space for user */
+	paddr_t		(*bs_mmap)(void *, bus_addr_t, off_t, int, int);
+
 	/* read (single) */
 	uint8_t	(*bs_r_1)(void *, bus_space_handle_t,
 			bus_size_t);
@@ -292,6 +295,12 @@
 	(*(t)->bs_vaddr)((t)->bs_cookie, (h))
 
 /*
+ * MMap bus space for a user application.
+ */
+#define bus_space_mmap(t, a, o, p, f)	\
+	(*(t)->bs_mmap)((t)->bs_cookie, (a), (o), (p), (f))
+
+/*
  * Bus barrier operations.  The SH3 does not currently require
  * barriers, but we must provide the flags to MI code.
  */

Index: src/sys/arch/landisk/landisk/shpcic_machdep.c
diff -u src/sys/arch/landisk/landisk/shpcic_machdep.c:1.1 src/sys/arch/landisk/landisk/shpcic_machdep.c:1.1.76.1
--- src/sys/arch/landisk/landisk/shpcic_machdep.c:1.1	Fri Sep  1 21:26:18 2006
+++ src/sys/arch/landisk/landisk/shpcic_machdep.c	Sun Oct  4 00:45:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: shpcic_machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $	*/
+/*	$NetBSD: shpcic_machdep.c,v 1.1.76.1 2009/10/04 00:45:35 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: shpcic_machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shpcic_machdep.c,v 1.1.76.1 2009/10/04 00:45:35 snj Exp $");
 
 #include 
 #include 
@@ -189,6 +189,8 @@
 	.bs_alloc = shpcic_iomem_alloc,
 	.bs_free = shpcic_iomem_free,
 
+	.bs_mmap = shpcic_iomem_mmap,
+
 	.bs_r_1 = shpcic_io_read_1,
 	.bs_r_2 = shpcic_io_read_2,
 	.bs_r_4 = shpcic_io_read_4,
@@ -237,6 +239,8 @@
 	.bs_alloc = shpcic_iomem_alloc,
 	.bs_free = shpcic_iomem_free,
 
+	.bs_mmap = shpcic_iomem_mmap,
+
 	.bs_r_1 = shpcic_mem_read_1,
 	.bs_r_

CVS commit: [netbsd-5] src/etc/mtree

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:42:21 UTC 2009

Modified Files:
src/etc/mtree [netbsd-5]: NetBSD.dist

Log Message:
Apply patch (requested by mrg in ticket #1062):
Don't create xkb/compiled as a directory any more.


To generate a diff of this commit:
cvs rdiff -u -r1.385.2.3 -r1.385.2.4 src/etc/mtree/NetBSD.dist

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

Modified files:

Index: src/etc/mtree/NetBSD.dist
diff -u src/etc/mtree/NetBSD.dist:1.385.2.3 src/etc/mtree/NetBSD.dist:1.385.2.4
--- src/etc/mtree/NetBSD.dist:1.385.2.3	Tue Sep 29 23:30:04 2009
+++ src/etc/mtree/NetBSD.dist	Sun Oct  4 00:42:21 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist,v 1.385.2.3 2009/09/29 23:30:04 snj Exp $
+#	$NetBSD: NetBSD.dist,v 1.385.2.4 2009/10/04 00:42:21 snj Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -363,7 +363,6 @@
 ./usr/X11R7/lib/X11/xedit/lisp/progmodes
 ./usr/X11R7/lib/X11/xkb
 ./usr/X11R7/lib/X11/xkb/compat
-./usr/X11R7/lib/X11/xkb/compiled
 ./usr/X11R7/lib/X11/xkb/geometry
 ./usr/X11R7/lib/X11/xkb/geometry/digital_vndr
 ./usr/X11R7/lib/X11/xkb/geometry/sgi_vndr



CVS commit: [netbsd-5] src/external/mit/xorg/bin/xkbcomp

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:41:52 UTC 2009

Modified Files:
src/external/mit/xorg/bin/xkbcomp [netbsd-5]: Makefile Makefile.common

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1062):
external/mit/xorg/bin/xkbcomp/Makefile: revision 1.5
external/mit/xorg/bin/xkbcomp/Makefile.common: revision 1.2
properly fix the xkbcomp output, and make compiled a symlink.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.8.2 -r1.1.1.1.8.3 \
src/external/mit/xorg/bin/xkbcomp/Makefile
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/external/mit/xorg/bin/xkbcomp/Makefile.common

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

Modified files:

Index: src/external/mit/xorg/bin/xkbcomp/Makefile
diff -u src/external/mit/xorg/bin/xkbcomp/Makefile:1.1.1.1.8.2 src/external/mit/xorg/bin/xkbcomp/Makefile:1.1.1.1.8.3
--- src/external/mit/xorg/bin/xkbcomp/Makefile:1.1.1.1.8.2	Mon Sep 28 01:57:05 2009
+++ src/external/mit/xorg/bin/xkbcomp/Makefile	Sun Oct  4 00:41:52 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.1.1.8.2 2009/09/28 01:57:05 snj Exp $
+#	$NetBSD: Makefile,v 1.1.1.1.8.3 2009/10/04 00:41:52 snj Exp $
 
 .include 
 .include "Makefile.common"
@@ -17,7 +17,8 @@
 FILESDIR=${X11LIBDIR}/xkb
 FILES=	README README.config README.enhancing
 
-SYMLINKS+=${BINDIR}/xkbcomp ${X11LIBDIR}/xkb/xkbcomp
+SYMLINKS+=	${BINDIR}/xkbcomp ${X11LIBDIR}/xkb/xkbcomp
+SYMLINKS+=	${XKBCOMPDIR} ${X11LIBDIR}/xkb/compiled
 
 LDADD+=	-lxkbfile -lXext -lX11
 DPADD+=	${LIBXKBFILE} ${LIBXEXT} ${LIBX11}

Index: src/external/mit/xorg/bin/xkbcomp/Makefile.common
diff -u src/external/mit/xorg/bin/xkbcomp/Makefile.common:1.1.2.2 src/external/mit/xorg/bin/xkbcomp/Makefile.common:1.1.2.3
--- src/external/mit/xorg/bin/xkbcomp/Makefile.common:1.1.2.2	Mon Sep 28 01:57:05 2009
+++ src/external/mit/xorg/bin/xkbcomp/Makefile.common	Sun Oct  4 00:41:52 2009
@@ -1,3 +1,3 @@
-#	$NetBSD: Makefile.common,v 1.1.2.2 2009/09/28 01:57:05 snj Exp $
+#	$NetBSD: Makefile.common,v 1.1.2.3 2009/10/04 00:41:52 snj Exp $
 
-XKBCOMPDIR=		/var/db/xkb
+XKBCOMPDIR=	${X11LIBDIR}/xkb



CVS commit: [netbsd-5] src/sys/arch/atari/dev

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:33:58 UTC 2009

Modified Files:
src/sys/arch/atari/dev [netbsd-5]: fd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/atari/dev/fd.c: revision 1.71
Read AD_CFG_SWITCH via volatile pointer so that
the default density is detected correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.62.6.1 src/sys/arch/atari/dev/fd.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/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.62 src/sys/arch/atari/dev/fd.c:1.62.6.1
--- src/sys/arch/atari/dev/fd.c:1.62	Wed Jun 11 14:35:53 2008
+++ src/sys/arch/atari/dev/fd.c	Sun Oct  4 00:33:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.62 2008/06/11 14:35:53 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.62.6.1 2009/10/04 00:33:58 snj Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.62 2008/06/11 14:35:53 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.62.6.1 2009/10/04 00:33:58 snj Exp $");
 
 #include 
 #include 
@@ -253,7 +253,7 @@
 static u_short rd_cfg_switch __P((void));
 static u_short rd_cfg_switch(void)
 {
-	return(*((u_short*)AD_CFG_SWITCH));
+	return(*((volatile u_short *)AD_CFG_SWITCH));
 }
 
 /*



CVS commit: [netbsd-5] src/sys/arch/atari/dev

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:31:52 UTC 2009

Modified Files:
src/sys/arch/atari/dev [netbsd-5]: clock.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1057):
sys/arch/atari/dev/clock.c: revision 1.47
Add a workaround for annoying
"WARNING: negative runtime; monotonic clock has gone backwards"
message. Partially taken from hp300.


To generate a diff of this commit:
cvs rdiff -u -r1.41.6.1 -r1.41.6.2 src/sys/arch/atari/dev/clock.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/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.41.6.1 src/sys/arch/atari/dev/clock.c:1.41.6.2
--- src/sys/arch/atari/dev/clock.c:1.41.6.1	Thu Nov  6 00:15:55 2008
+++ src/sys/arch/atari/dev/clock.c	Sun Oct  4 00:31:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.41.6.1 2008/11/06 00:15:55 snj Exp $	*/
+/*	$NetBSD: clock.c,v 1.41.6.2 2009/10/04 00:31:52 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.41.6.1 2008/11/06 00:15:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.41.6.2 2009/10/04 00:31:52 snj Exp $");
 
 #include 
 #include 
@@ -319,21 +319,29 @@
 static u_int
 clk_getcounter(struct timecounter *tc)
 {
-	u_int delta;
-	u_char ipra, tadr;
-	int s, cur_hardclock;
+	uint32_t delta, count, cur_hardclock;
+	uint8_t ipra, tadr;
+	int s;
+	static uint32_t lastcount;
 
 	s = splhigh();
+	cur_hardclock = hardclock_ticks;
 	ipra = MFP->mf_ipra;
 	tadr = MFP->mf_tadr;
 	delta = divisor - tadr;
 
 	if (ipra & IA_TIMA)
 		delta += divisor;
-	cur_hardclock = hardclock_ticks;
 	splx(s);
 
-	return (divisor - tadr) + divisor * cur_hardclock;
+	count = (divisor * cur_hardclock) + delta;
+	if ((int32_t)(count - lastcount) < 0) {
+		/* XXX wrapped; maybe hardclock() is blocked more than 2/HZ */
+		count = lastcount + 1;
+	}
+	lastcount = count;
+
+	return count;
 }
 
 #define TIMB_FREQ	614400



CVS commit: [netbsd-5] src/share/man/man8/man8.atari

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:29:18 UTC 2009

Modified Files:
src/share/man/man8/man8.atari [netbsd-5]: binpatch.8

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1056):
share/man/man8/man8.atari/binpatch.8: revision 1.8
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.5.42.2 -r1.5.42.3 src/share/man/man8/man8.atari/binpatch.8

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/man8/man8.atari/binpatch.8
diff -u src/share/man/man8/man8.atari/binpatch.8:1.5.42.2 src/share/man/man8/man8.atari/binpatch.8:1.5.42.3
--- src/share/man/man8/man8.atari/binpatch.8:1.5.42.2	Sun Oct  4 00:28:07 2009
+++ src/share/man/man8/man8.atari/binpatch.8	Sun Oct  4 00:29:17 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: binpatch.8,v 1.5.42.2 2009/10/04 00:28:07 snj Exp $
+.\"	$NetBSD: binpatch.8,v 1.5.42.3 2009/10/04 00:29:17 snj Exp $
 .\"
 .\" Copyright (c) 1994 Christian E. Hopps
 .\" All rights reserved.
@@ -83,7 +83,7 @@
 .Ar symname
 (specified with the
 .Fl s
-flag.)
+flag).
 If the symbol is found the current data and address are printed.
 .Pp
 Next if the



CVS commit: [netbsd-5] src/share/man/man8/man8.atari

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:28:07 UTC 2009

Modified Files:
src/share/man/man8/man8.atari [netbsd-5]: binpatch.8

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1056):
share/man/man8/man8.atari/binpatch.8: revision 1.7
Fix typo and improve English.


To generate a diff of this commit:
cvs rdiff -u -r1.5.42.1 -r1.5.42.2 src/share/man/man8/man8.atari/binpatch.8

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/man8/man8.atari/binpatch.8
diff -u src/share/man/man8/man8.atari/binpatch.8:1.5.42.1 src/share/man/man8/man8.atari/binpatch.8:1.5.42.2
--- src/share/man/man8/man8.atari/binpatch.8:1.5.42.1	Sun Oct  4 00:26:57 2009
+++ src/share/man/man8/man8.atari/binpatch.8	Sun Oct  4 00:28:07 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: binpatch.8,v 1.5.42.1 2009/10/04 00:26:57 snj Exp $
+.\"	$NetBSD: binpatch.8,v 1.5.42.2 2009/10/04 00:28:07 snj Exp $
 .\"
 .\" Copyright (c) 1994 Christian E. Hopps
 .\" All rights reserved.
@@ -130,7 +130,7 @@
 .Sh BUGS
 The
 .Nm
-command doesn't check if size of specified symbol is same with the
+command doesn't check if size of specified symbol is the same as the
 specified size by
 .Fl b ,
 .Fl w ,
@@ -142,4 +142,4 @@
 The
 .Nm
 command doesn't check if specified address or symbol is a patchable variable
-and it might corrupts the specified executable binary.
+and it might corrupt the specified executable binary.



CVS commit: [netbsd-5] src

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:26:57 UTC 2009

Modified Files:
src/share/man/man8/man8.atari [netbsd-5]: binpatch.8
src/sys/arch/atari/stand/binpatch [netbsd-5]: Makefile binpatch.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1056):
share/man/man8/man8.atari/binpatch.8: revision 1.6
sys/arch/atari/stand/binpatch/Makefile: revision 1.6
sys/arch/atari/stand/binpatch/binpatch.c: revision 1.5, 1.6
Rewrite binpatch(8) utility to add support for ELF binaries,
using implementation of old src/usr.sbin/mdsetimage sources
which supports misc executable formats without LGPL'ed libbfd.
No particular comments on port-at...@.
XXX1: amiga also has the similar utility in amiga/stand/binpatch
 but it has slightly different options.
XXX2: Is it worth to put this utility into MI src/usr.sbin to patch
 rtc_offset etc. in GENERIC kernel binaries in distribution?


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.42.1 src/share/man/man8/man8.atari/binpatch.8
cvs rdiff -u -r1.5 -r1.5.132.1 src/sys/arch/atari/stand/binpatch/Makefile
cvs rdiff -u -r1.4 -r1.4.72.1 src/sys/arch/atari/stand/binpatch/binpatch.c

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/man8/man8.atari/binpatch.8
diff -u src/share/man/man8/man8.atari/binpatch.8:1.5 src/share/man/man8/man8.atari/binpatch.8:1.5.42.1
--- src/share/man/man8/man8.atari/binpatch.8:1.5	Wed Dec 26 01:26:44 2001
+++ src/share/man/man8/man8.atari/binpatch.8	Sun Oct  4 00:26:57 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: binpatch.8,v 1.5 2001/12/26 01:26:44 wiz Exp $
+.\"	$NetBSD: binpatch.8,v 1.5.42.1 2009/10/04 00:26:57 snj Exp $
 .\"
 .\" Copyright (c) 1994 Christian E. Hopps
 .\" All rights reserved.
@@ -28,22 +28,24 @@
 .\" (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 February 2, 1994
+.Dd August 20, 2009
 .Dt BINPATCH 8 atari
 .Os
 .Sh NAME
 .Nm binpatch
-.Nd "examine and or modify initialized data in a binary file"
+.Nd "examine and or modify initialized data in an executable binary"
 .Sh SYNOPSIS
 .Nm binpatch
-.Op Fl b | Fl w | Fl l
+.Op Fl b | Fl w | Fl l | Fl d
 .Op Fl o Ar offset
+.Op Fl T Ar saddr
 .Fl s Ar symname
 .Op Fl r Ar value
 .Ar binfile
 .Nm binpatch
-.Op Fl b | Fl w | Fl l
+.Op Fl b | Fl w | Fl l | Fl d
 .Op Fl o Ar offset
+.Op Fl T Ar saddr
 .Fl a Ar addr
 .Op Fl r Ar value
 .Ar binfile
@@ -52,20 +54,39 @@
 is used to modify or examine the data associated with a symbol in a binary
 file
 .Ar binfile .
+.Pp
 The flags
 .Fl b ,
-.Fl w
+.Fl w ,
+.Fl l ,
 and
+.Fl d
+specify the size of the data to be modified or examined.
+.Fl b
+is for 8bit
+.Pq Li int8_t ,
+.Fl w
+is for 16bit
+.Pq Li int16_t ,
 .Fl l
-specify the size of the data to be modified or examined
-(byte, word and long respectively.) The
+is for 32bit
+.Pq Li int32_t ,
+and
+.Fl d
+is for 64bit
+.Pq Li int64_t
+variables.
+.Pp
+The
 .Ar binfile
 is scanned in search of the symbol
 .Ar symname
 (specified with the
 .Fl s
 flag.)
-If the symbol is found the current data and address are printed.  Next if the
+If the symbol is found the current data and address are printed.
+.Pp
+Next if the
 .Fl r
 flag has been given, the current data is replaced with that of
 .Ar value .
@@ -79,11 +100,17 @@
 .Pp
 The
 .Fl o
-flag specifies an offset in byte, word or long
+flag specifies an offset in
+.Li int8_t ,
+.Li int16_t ,
+.Li int32_t ,
+and
+.Li int64_t
 .Fl ( b ,
 .Fl w ,
+.Fl l ,
 or
-.Fl l )
+.Fl d )
 units from the given locator
 .Fl ( s
 or
@@ -91,3 +118,28 @@
 for
 .Nm
 to perform its described actions.
+This might be useful to patch a member of array or structure.
+.Pp
+The
+.Fl T
+flag is used to specify the starting address of a.out binary text segment.
+Ignored for other binary executable formats.
+.Sh SEE ALSO
+.Xr gdb 1 ,
+.Xr mdsetimage 8
+.Sh BUGS
+The
+.Nm
+command doesn't check if size of specified symbol is same with the
+specified size by
+.Fl b ,
+.Fl w ,
+.Fl l ,
+or
+.Fl d
+flag.
+.Pp
+The
+.Nm
+command doesn't check if specified address or symbol is a patchable variable
+and it might corrupts the specified executable binary.

Index: src/sys/arch/atari/stand/binpatch/Makefile
diff -u src/sys/arch/atari/stand/binpatch/Makefile:1.5 src/sys/arch/atari/stand/binpatch/Makefile:1.5.132.1
--- src/sys/arch/atari/stand/binpatch/Makefile:1.5	Wed Dec 12 01:49:38 2001
+++ src/sys/arch/atari/stand/binpatch/Makefile	Sun Oct  4 00:26:57 2009
@@ -1,9 +1,50 @@
-#	$NetBSD: Makefile,v 1.5 2001/12/12 01:49:38 tv Exp $
+#	$NetBSD: Makefile,v 1.5.132.1 2009/10/04 00:26:57 snj Exp $
 
-PROG=binpatch
-NOMAN=	# defined
+BINDIR?= /sbin
+WARNS?=	4
 
-BINDIR=/sbin
-LDFLAGS+=-static
+PROG=	binpatch
+SRCS=	binpatch.c
+SRCS+=	exec_aout.c exec_ecoff.c exec_elf32.c exec_elf64.c exec_coff.c
+
+#MAN=	bi

CVS commit: [netbsd-5] src/usr.sbin/mdsetimage

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:22:12 UTC 2009

Modified Files:
src/usr.sbin/mdsetimage [netbsd-5]: exec_elf32.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1056):
usr.sbin/mdsetimage/exec_elf32.c: revision 1.11
- use program header rather than section header to find file offset for vmaddr
- make sure that passed vmaddr is in TEXT or DATA section


To generate a diff of this commit:
cvs rdiff -u -r1.9.40.1 -r1.9.40.2 src/usr.sbin/mdsetimage/exec_elf32.c

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

Modified files:

Index: src/usr.sbin/mdsetimage/exec_elf32.c
diff -u src/usr.sbin/mdsetimage/exec_elf32.c:1.9.40.1 src/usr.sbin/mdsetimage/exec_elf32.c:1.9.40.2
--- src/usr.sbin/mdsetimage/exec_elf32.c:1.9.40.1	Sun Oct  4 00:20:59 2009
+++ src/usr.sbin/mdsetimage/exec_elf32.c	Sun Oct  4 00:22:12 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf32.c,v 1.9.40.1 2009/10/04 00:20:59 snj Exp $ */
+/* $NetBSD: exec_elf32.c,v 1.9.40.2 2009/10/04 00:22:12 snj Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: exec_elf32.c,v 1.9.40.1 2009/10/04 00:20:59 snj Exp $");
+__RCSID("$NetBSD: exec_elf32.c,v 1.9.40.2 2009/10/04 00:22:12 snj Exp $");
 #endif /* not lint */
 
 #ifndef ELFSIZE
@@ -89,37 +89,40 @@
 	u_long vmaddr;
 {
 	const Elf_Ehdr *ehdrp;
-	const Elf_Shdr *shdrp;
-	Elf_Off shdr_off;
-	Elf_Word shdr_size;
+	const Elf_Phdr *phdrp;
+	Elf_Off phdr_off;
+	Elf_Word phdr_size;
 #if (ELFSIZE == 32)
-	Elf32_Half nshdr, i;
+	Elf32_Half nphdr, i;
 #elif (ELFSIZE == 64)
-	Elf64_Half nshdr, i;
+	Elf64_Half nphdr, i;
 #endif
 	int rv;
 
 	rv = 0;
 
 	ehdrp = (const Elf_Ehdr *)&mappedfile[0];
-	nshdr = ehdrp->e_shnum;
-	shdr_off = ehdrp->e_shoff;
-	shdr_size = ehdrp->e_shentsize * nshdr;
+	nphdr = ehdrp->e_phnum;
+	phdr_off = ehdrp->e_phoff;
+	phdr_size = sizeof(Elf_Phdr) * nphdr;
 
-	if (check(0, shdr_size + shdr_off) ||
-	(sizeof *shdrp != ehdrp->e_shentsize))
+	if (check(0, phdr_off + phdr_size))
 		BAD;
-	shdrp = (const Elf_Shdr *)&mappedfile[shdr_off];
+	phdrp = (const Elf_Phdr *)&mappedfile[phdr_off];
 
-	for (i = 0; i < nshdr; i++) {
-		if (shdrp[i].sh_addr <= vmaddr &&
-		vmaddr < (shdrp[i].sh_addr + shdrp[i].sh_size)) {
+#define IS_TEXT(p)	(p.p_flags & PF_X)
+#define IS_DATA(p)	(p.p_flags & PF_W)
+
+	for (i = 0; i < nphdr; i++) {
+		if ((IS_TEXT(phdrp[i]) || IS_DATA(phdrp[i])) &&
+		phdrp[i].p_vaddr <= vmaddr &&
+		vmaddr < phdrp[i].p_vaddr + phdrp[i].p_filesz) {
 			*fileoffp = vmaddr -
-			shdrp[i].sh_addr + shdrp[i].sh_offset;
+			phdrp[i].p_vaddr + phdrp[i].p_offset;
 			break;
 		}
 	}
-	if (i == nshdr)
+	if (i == nphdr)
 		BAD;
 
 out:



CVS commit: [netbsd-5] src/usr.sbin/mdsetimage

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:20:59 UTC 2009

Modified Files:
src/usr.sbin/mdsetimage [netbsd-5]: exec_aout.c exec_coff.c
exec_ecoff.c exec_elf32.c mdsetimage.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1056):
usr.sbin/mdsetimage/exec_aout.c: revision 1.7
usr.sbin/mdsetimage/exec_coff.c: revision 1.6
usr.sbin/mdsetimage/exec_ecoff.c: revision 1.6
usr.sbin/mdsetimage/exec_elf32.c: revision 1.10
usr.sbin/mdsetimage/mdsetimage.c: revision 1.19
WARNS'fy sources which are left for reference.
src/usr.sbin/mdsetimage has been superseded by src/gnu/usr.sbin/mdsetimage
for toolchain to handle cross build binaries, but these old sources for
local executable binaries still can be used for tools to patch binaries,
like binpatch utility in sys/arch/amiga/stand and sys/arch/atari/stand.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.40.1 src/usr.sbin/mdsetimage/exec_aout.c
cvs rdiff -u -r1.5 -r1.5.40.1 src/usr.sbin/mdsetimage/exec_coff.c \
src/usr.sbin/mdsetimage/exec_ecoff.c
cvs rdiff -u -r1.9 -r1.9.40.1 src/usr.sbin/mdsetimage/exec_elf32.c
cvs rdiff -u -r1.18 -r1.18.4.1 src/usr.sbin/mdsetimage/mdsetimage.c

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

Modified files:

Index: src/usr.sbin/mdsetimage/exec_aout.c
diff -u src/usr.sbin/mdsetimage/exec_aout.c:1.6 src/usr.sbin/mdsetimage/exec_aout.c:1.6.40.1
--- src/usr.sbin/mdsetimage/exec_aout.c:1.6	Mon Oct  1 23:32:34 2001
+++ src/usr.sbin/mdsetimage/exec_aout.c	Sun Oct  4 00:20:59 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_aout.c,v 1.6 2001/10/01 23:32:34 cgd Exp $ */
+/* $NetBSD: exec_aout.c,v 1.6.40.1 2009/10/04 00:20:59 snj Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: exec_aout.c,v 1.6 2001/10/01 23:32:34 cgd Exp $");
+__RCSID("$NetBSD: exec_aout.c,v 1.6.40.1 2009/10/04 00:20:59 snj Exp $");
 #endif /* not lint */
 
 #include 
@@ -53,14 +53,14 @@
 	const char *mappedfile;
 	size_t mappedsize;
 {
-	struct exec *execp;
+	const struct exec *execp;
 	int rv;
 
 	rv = 0;
 
 	if (check(0, sizeof *execp))
 		BAD;
-	execp = (struct exec *)&mappedfile[0];
+	execp = (const struct exec *)&mappedfile[0];
 
 	if (N_BADMAG(*execp))
 		BAD;
@@ -75,11 +75,11 @@
 	size_t mappedsize, *fileoffp;
 	u_long vmaddr;
 {
-	struct exec *execp;
+	const struct exec *execp;
 	int rv;
 
 	rv = 0;
-	execp = (struct exec *)&mappedfile[0];
+	execp = (const struct exec *)&mappedfile[0];
 
 	if (N_TXTADDR(*execp) + (execp->a_entry & (N_PAGSIZ(*execp)-1)) !=
 	execp->a_entry)

Index: src/usr.sbin/mdsetimage/exec_coff.c
diff -u src/usr.sbin/mdsetimage/exec_coff.c:1.5 src/usr.sbin/mdsetimage/exec_coff.c:1.5.40.1
--- src/usr.sbin/mdsetimage/exec_coff.c:1.5	Mon Oct  1 23:32:34 2001
+++ src/usr.sbin/mdsetimage/exec_coff.c	Sun Oct  4 00:20:59 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_coff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $ */
+/* $NetBSD: exec_coff.c,v 1.5.40.1 2009/10/04 00:20:59 snj Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: exec_coff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $");
+__RCSID("$NetBSD: exec_coff.c,v 1.5.40.1 2009/10/04 00:20:59 snj Exp $");
 #endif /* not lint */
 
 #include 
@@ -53,14 +53,14 @@
 	const char *mappedfile;
 	size_t mappedsize;
 {
-	struct coff_exechdr *exechdrp;
+	const struct coff_exechdr *exechdrp;
 	int rv;
 
 	rv = 0;
 
 	if (check(0, sizeof *exechdrp))
 		BAD;
-	exechdrp = (struct coff_exechdr *)&mappedfile[0];
+	exechdrp = (const struct coff_exechdr *)&mappedfile[0];
 
 	if (COFF_BADMAG(&(exechdrp->f)))
 		BAD;
@@ -75,11 +75,11 @@
 	size_t mappedsize, *fileoffp;
 	u_long vmaddr;
 {
-	struct coff_exechdr *exechdrp;
+	const struct coff_exechdr *exechdrp;
 	int rv;
 
 	rv = 0;
-	exechdrp = (struct coff_exechdr *)&mappedfile[0];
+	exechdrp = (const struct coff_exechdr *)&mappedfile[0];
 
 #define COFF_TXTOFF_XXX(fp, ap) \
  (COFF_ROUND(COFF_HDR_SIZE + (fp)->f_nscns * \
@@ -89,12 +89,12 @@
 #define COFF_DATOFF_XXX(fp, ap) \
 (COFF_TXTOFF_XXX(fp, ap) + (ap)->a_tsize)
 
-	if (exechdrp->a.a_tstart <= vmaddr &&
-	vmaddr < (exechdrp->a.a_tstart + exechdrp->a.a_tsize))
+	if ((u_long)exechdrp->a.a_tstart <= vmaddr &&
+	vmaddr < (u_long)(exechdrp->a.a_tstart + exechdrp->a.a_tsize))
 		*fileoffp = vmaddr - exechdrp->a.a_tstart +
 		COFF_TXTOFF(&exechdrp->f, &(exechdrp->a));
-	else if (exechdrp->a.a_dstart <= vmaddr && 
-vmaddr < (exechdrp->a.a_dstart + exechdrp->a.a_dsize))
+	else if ((u_long)exechdrp->a.a_dstart <= vmaddr && 
+vmaddr < (u_long)(exechdrp->a.a_dstart + exechdrp->a.a_dsize))
 		*fileoffp = vmaddr - exechdrp->a.a_dstart +
 		COFF_DATOFF_XXX(&exechdrp->f, &(exechdrp->a));
 	else
Index: src/usr.sbin/mdsetimage/exec_ecoff.c
diff -u src/usr.sbin/md

CVS commit: [netbsd-5] src/usr.sbin/cpuctl/arch

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:16:53 UTC 2009

Modified Files:
src/usr.sbin/cpuctl/arch [netbsd-5]: i386.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1055):
usr.sbin/cpuctl/arch/i386.c: revision 1.20
- add newer VIA C7 core and VIA Nano.
- when printing an unknown VIA CPU, default to 'Unknown IDT/VIA' instead of 'C3'


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.3 -r1.13.2.4 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.13.2.3 src/usr.sbin/cpuctl/arch/i386.c:1.13.2.4
--- src/usr.sbin/cpuctl/arch/i386.c:1.13.2.3	Mon May 18 19:43:55 2009
+++ src/usr.sbin/cpuctl/arch/i386.c	Sun Oct  4 00:16:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.13.2.3 2009/05/18 19:43:55 bouyer Exp $	*/
+/*	$NetBSD: i386.c,v 1.13.2.4 2009/10/04 00:16:53 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.13.2.3 2009/05/18 19:43:55 bouyer Exp $");
+__RCSID("$NetBSD: i386.c,v 1.13.2.4 2009/10/04 00:16:53 snj Exp $");
 #endif /* not lint */
 
 #include 
@@ -546,8 +546,9 @@
 			{
 0, 0, 0, 0, 0, 0, "C3 Samuel",
 "C3 Samuel 2/Ezra", "C3 Ezra-T",
-"C3 Nehemiah", "C7 Esther", 0, 0, 0, 0, 0,
-"C3"	/* Default */
+"C3 Nehemiah", "C7 Esther", 0, 0, "C7 Esther",
+0, "VIA Nano",
+"Unknown VIA/IDT"	/* Default */
 			},
 			NULL,
 			via_cpu_probe,



CVS commit: [netbsd-5] src/sys/arch/xen/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:02:00 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-5]: hypervisor.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/xen/hypervisor.c: revision 1.45
Make sure xenkernfs_init() is called for XEN2 too.


To generate a diff of this commit:
cvs rdiff -u -r1.42.4.2 -r1.42.4.3 src/sys/arch/xen/xen/hypervisor.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/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.42.4.2 src/sys/arch/xen/xen/hypervisor.c:1.42.4.3
--- src/sys/arch/xen/xen/hypervisor.c:1.42.4.2	Sat Oct  3 23:54:05 2009
+++ src/sys/arch/xen/xen/hypervisor.c	Sun Oct  4 00:02:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.42.4.2 2009/10/03 23:54:05 snj Exp $ */
+/* $NetBSD: hypervisor.c,v 1.42.4.3 2009/10/04 00:02:00 snj Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -63,7 +63,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.42.4.2 2009/10/03 23:54:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.42.4.3 2009/10/04 00:02:00 snj Exp $");
 
 #include 
 #include 
@@ -240,17 +240,17 @@
 #endif /* NPCI */
 	union hypervisor_attach_cookie hac;
 
+#ifdef DOM0OPS
+	if (xendomain_is_privileged()) {
+		xenkernfs_init();
+	}
+#endif
 #ifdef XEN3
 	xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
 	aprint_normal(": Xen version %d.%d\n", (xen_version & 0x) >> 16,
 	   xen_version & 0x);
 
 	xengnt_init();
-#ifdef DOM0OPS
-	if (xendomain_is_privileged()) {
-		xenkernfs_init();
-	}
-#endif
 
 	memset(&hac.hac_vcaa, 0, sizeof(hac.hac_vcaa));
 	hac.hac_vcaa.vcaa_name = "vcpu";



CVS commit: [netbsd-5] src/sys/arch/xen/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:04:08 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-5]: pci_intr_machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/xen/pci_intr_machdep.c: revision 1.10
Keep the BIOS-configured interrupt number if intr_find_mpmapping() doesn't
return a APIC_INT_VIA_APIC pirq.
Problem debugged and patch tested by jym@


To generate a diff of this commit:
cvs rdiff -u -r1.7.6.2 -r1.7.6.3 src/sys/arch/xen/xen/pci_intr_machdep.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/xen/xen/pci_intr_machdep.c
diff -u src/sys/arch/xen/xen/pci_intr_machdep.c:1.7.6.2 src/sys/arch/xen/xen/pci_intr_machdep.c:1.7.6.3
--- src/sys/arch/xen/xen/pci_intr_machdep.c:1.7.6.2	Sun Oct  4 00:03:20 2009
+++ src/sys/arch/xen/xen/pci_intr_machdep.c	Sun Oct  4 00:04:08 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: pci_intr_machdep.c,v 1.7.6.2 2009/10/04 00:03:20 snj Exp $  */
+/*  $NetBSD: pci_intr_machdep.c,v 1.7.6.3 2009/10/04 00:04:08 snj Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.7.6.2 2009/10/04 00:03:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.7.6.3 2009/10/04 00:04:08 snj Exp $");
 
 #include 
 #include 
@@ -109,8 +109,12 @@
 	pci_decompose_tag(pc, pa->pa_tag, &bus, &dev, &func);
 	if (mp_busses != NULL) {
 		if (intr_find_mpmapping(bus, (dev<<2)|(rawpin-1), ihp) == 0) {
-			/* make sure a new IRQ will be allocated */
-			ihp->pirq &= ~0xff;
+			if (ihp->pirq & APIC_INT_VIA_APIC) {
+/* make sure a new IRQ will be allocated */
+ihp->pirq &= ~0xff;
+			} else {
+ihp->pirq |= line;
+			}
 			goto end;
 		}
 		/*



CVS commit: [netbsd-5] src/sys/arch/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:03:20 UTC 2009

Modified Files:
src/sys/arch/xen/x86 [netbsd-5]: intr.c
src/sys/arch/xen/xen [netbsd-5]: isa_machdep.c pci_intr_machdep.c
pciide_machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/x86/intr.c: revision 1.22
sys/arch/xen/xen/isa_machdep.c: revision 1.14
sys/arch/xen/xen/pci_intr_machdep.c: revision 1.9
sys/arch/xen/xen/pciide_machdep.c: revision 1.12
When ioapic is used, for ISA interrupts, reuse the legacy ISA interrupt
number instead of allocating a new one. Force allocating a new interrupt number
for PCI devices, as the number stored in the PCI interrupt register
may be wrong.
This should help using a pciide controller in compat mode or ISA devices
in a non-0 domain.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.4.1 src/sys/arch/xen/x86/intr.c
cvs rdiff -u -r1.12 -r1.12.6.1 src/sys/arch/xen/xen/isa_machdep.c
cvs rdiff -u -r1.7.6.1 -r1.7.6.2 src/sys/arch/xen/xen/pci_intr_machdep.c
cvs rdiff -u -r1.11 -r1.11.6.1 src/sys/arch/xen/xen/pciide_machdep.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/xen/x86/intr.c
diff -u src/sys/arch/xen/x86/intr.c:1.21 src/sys/arch/xen/x86/intr.c:1.21.4.1
--- src/sys/arch/xen/x86/intr.c:1.21	Fri Sep  5 13:37:24 2008
+++ src/sys/arch/xen/x86/intr.c	Sun Oct  4 00:03:19 2009
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21 2008/09/05 13:37:24 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21.4.1 2009/10/04 00:03:19 snj Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -268,12 +268,14 @@
 		irq = vect2irq[ioapic->sc_pins[pin].ip_vector];
 		if (ioapic->sc_pins[pin].ip_vector == 0 || irq == 0) {
 			/* allocate IRQ */
-			irq = xen_next_irq--;
+			irq = APIC_IRQ_LEGACY_IRQ(*pirq);
+			if (irq <= 0 || irq > 15)
+irq = xen_next_irq--;
 			/* allocate vector and route interrupt */
 			op.cmd = PHYSDEVOP_ASSIGN_VECTOR;
 			op.u.irq_op.irq = irq;
 			if (HYPERVISOR_physdev_op(&op) < 0)
-panic("PHYSDEVOP_ASSIGN_VECTOR");
+panic("PHYSDEVOP_ASSIGN_VECTOR irq %d", irq);
 			irq2vect[irq] = op.u.irq_op.vector;
 			vect2irq[op.u.irq_op.vector] = irq;
 			pic->pic_addroute(pic, &phycpu_info_primary, pin,

Index: src/sys/arch/xen/xen/isa_machdep.c
diff -u src/sys/arch/xen/xen/isa_machdep.c:1.12 src/sys/arch/xen/xen/isa_machdep.c:1.12.6.1
--- src/sys/arch/xen/xen/isa_machdep.c:1.12	Thu Jul  3 15:44:19 2008
+++ src/sys/arch/xen/xen/isa_machdep.c	Sun Oct  4 00:03:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.12 2008/07/03 15:44:19 drochner Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.12.6.1 2009/10/04 00:03:20 snj Exp $	*/
 /*	NetBSD isa_machdep.c,v 1.11 2004/06/20 18:04:08 thorpej Exp 	*/
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.12 2008/07/03 15:44:19 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.12.6.1 2009/10/04 00:03:20 snj Exp $");
 
 #include 
 #include 
@@ -159,7 +159,7 @@
 	struct ioapic_softc *pic = NULL;
 #endif
 
-	ih.pirq = irq;
+	ih.pirq = 0;
 
 #if NIOAPIC > 0
 	if (mp_busses != NULL) {
@@ -178,6 +178,7 @@
 			printf("isa_intr_establish: no MP mapping found\n");
 	}
 #endif
+	ih.pirq |= (irq & 0xff);
 
 	evtch = xen_intr_map(&ih.pirq, type);
 	if (evtch == -1)

Index: src/sys/arch/xen/xen/pci_intr_machdep.c
diff -u src/sys/arch/xen/xen/pci_intr_machdep.c:1.7.6.1 src/sys/arch/xen/xen/pci_intr_machdep.c:1.7.6.2
--- src/sys/arch/xen/xen/pci_intr_machdep.c:1.7.6.1	Sat Oct  3 23:54:05 2009
+++ src/sys/arch/xen/xen/pci_intr_machdep.c	Sun Oct  4 00:03:20 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: pci_intr_machdep.c,v 1.7.6.1 2009/10/03 23:54:05 snj Exp $  */
+/*  $NetBSD: pci_intr_machdep.c,v 1.7.6.2 2009/10/04 00:03:20 snj Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.7.6.1 2009/10/03 23:54:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.7.6.2 2009/10/04 00:03:20 snj Exp $");
 
 #include 
 #include 
@@ -109,8 +109,8 @@
 	pci_decompose_tag(pc, pa->pa_tag, &bus, &dev, &func);
 	if (mp_busses != NULL) {
 		if (intr_find_mpmapping(bus, (dev<<2)|(rawpin-1), ihp) == 0) {
-			if ((ihp->pirq & 0xff) == 0)
-ihp->pirq |= line;
+			/* make sure a new IRQ will be allocated */
+			ihp->pirq &= ~0xff;
 			goto end;
 		}
 		/*

Index: src/sys/arch/xen/xen/pciide_machdep.c
diff -u src/sys/arch/xen/xen/pciide_machdep.c:1.11 src/sys/arch/xen/xen/pciide_machdep.c:1.11.6.1
--- src/sys/arch/xen/xen/pciide_machdep.c:1.11	Thu Jul  3 15:44:19 2008
+++ src/sys/arch/xen/xen/pciide_machdep.c	Sun Oct  4 00:03:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_machdep.c,v 1.11 2008/07/03 15:44:19 drochner Exp $	*/
+/*	$NetBSD: pciide_machdep.c

CVS commit: [netbsd-5] src/sys/dev/usb

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:01:16 UTC 2009

Modified Files:
src/sys/dev/usb [netbsd-5]: uhci.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/dev/usb/uhci.c: revision 1.225
Make it safe to call uhci_init() from a kernel thread with interrupts
enabled:
- don't enable interrupts before calling uhci_run()
- check if the controller's interrupt is enabled in uhci_intr()
The issue is that uhci_run() may tsleep(), uhci_intr1() may be called before
uhci_run() is complete and disable it because it found it halted.
Now a uhci controller can be successfully exported to a NetBSD Xen domU :)


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.223.6.1 src/sys/dev/usb/uhci.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/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.223 src/sys/dev/usb/uhci.c:1.223.6.1
--- src/sys/dev/usb/uhci.c:1.223	Sat Jun 28 17:42:53 2008
+++ src/sys/dev/usb/uhci.c	Sun Oct  4 00:01:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.223 2008/06/28 17:42:53 bouyer Exp $	*/
+/*	$NetBSD: uhci.c,v 1.223.6.1 2009/10/04 00:01:16 snj Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $	*/
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.223 2008/06/28 17:42:53 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.223.6.1 2009/10/04 00:01:16 snj Exp $");
 
 #include 
 #include 
@@ -563,10 +563,11 @@
 	UHCICMD(sc, UHCI_CMD_MAXP); /* Assume 64 byte packets at frame end */
 
 	DPRINTFN(1,("uhci_init: enabling\n"));
+
+	err =  uhci_run(sc, 1);		/* and here we go... */
 	UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE |
 		UHCI_INTR_IOCE | UHCI_INTR_SPIE);	/* enable interrupts */
-
-	return (uhci_run(sc, 1));		/* and here we go... */
+	return err;
 }
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -1309,7 +1310,7 @@
 	if (sc->sc_dying || !device_has_power(sc->sc_dev))
 		return (0);
 
-	if (sc->sc_bus.use_polling) {
+	if (sc->sc_bus.use_polling || UREAD2(sc, UHCI_INTR) == 0) {
 #ifdef DIAGNOSTIC
 		DPRINTFN(16, ("uhci_intr: ignored interrupt while polling\n"));
 #endif



CVS commit: [netbsd-5] src/sys/arch/xen/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  4 00:00:14 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-5]: xpci_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/xen/xpci_xenbus.c: revision 1.2
Don't emulate a cold boot here, this breaks drivers using config_interrupt().


To generate a diff of this commit:
cvs rdiff -u -r1.2.6.2 -r1.2.6.3 src/sys/arch/xen/xen/xpci_xenbus.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/xen/xen/xpci_xenbus.c
diff -u src/sys/arch/xen/xen/xpci_xenbus.c:1.2.6.2 src/sys/arch/xen/xen/xpci_xenbus.c:1.2.6.3
--- src/sys/arch/xen/xen/xpci_xenbus.c:1.2.6.2	Sat Oct  3 23:54:05 2009
+++ src/sys/arch/xen/xen/xpci_xenbus.c	Sun Oct  4 00:00:14 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: xpci_xenbus.c,v 1.2.6.2 2009/10/03 23:54:05 snj Exp $  */
+/*  $NetBSD: xpci_xenbus.c,v 1.2.6.3 2009/10/04 00:00:14 snj Exp $  */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xpci_xenbus.c,v 1.2.6.2 2009/10/03 23:54:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xpci_xenbus.c,v 1.2.6.3 2009/10/04 00:00:14 snj Exp $");
 
 #include "opt_xen.h"
 #include "rnd.h"
@@ -336,7 +336,7 @@
 	char node[10];
 	u_long busn;
 	int i;
-	int s, oldcold;
+	int s;
 
 	err = xenbus_read_ul(NULL, sc->sc_xbusd->xbusd_otherend,
 	   "root_num", &num_roots, 10);
@@ -372,10 +372,7 @@
    "%s is not a number\n", bus);
 			else {
 s = splhigh();
-oldcold = cold;
-cold = 1;
 xpci_attach_pcibus(0, busn);
-cold = oldcold;
 splx(s);
 			}
 		}



CVS commit: [netbsd-5] src/sys/arch/xen/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:59:33 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-5]: pciback.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/xen/pciback.c: revision 1.4
Move a message to debug


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.4 -r1.4.6.5 src/sys/arch/xen/xen/pciback.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/xen/xen/pciback.c
diff -u src/sys/arch/xen/xen/pciback.c:1.4.6.4 src/sys/arch/xen/xen/pciback.c:1.4.6.5
--- src/sys/arch/xen/xen/pciback.c:1.4.6.4	Sat Oct  3 23:58:47 2009
+++ src/sys/arch/xen/xen/pciback.c	Sat Oct  3 23:59:32 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: pciback.c,v 1.4.6.4 2009/10/03 23:58:47 snj Exp $  */
+/*  $NetBSD: pciback.c,v 1.4.6.5 2009/10/03 23:59:32 snj Exp $  */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.4 2009/10/03 23:58:47 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.5 2009/10/03 23:59:32 snj Exp $");
 
 #include "opt_xen.h"
 #include "rnd.h"
@@ -739,7 +739,7 @@
 			break;
 	}
 	if (pbd == NULL) {
-		aprint_error("pciback: %02x:%02x.%x not found\n",
+		aprint_debug("pciback: %02x:%02x.%x not found\n",
 		bus, dev, func);
 		op->err = XEN_PCI_ERR_dev_not_found;
 		goto end;



CVS commit: [netbsd-5] src/sys/arch/xen/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:58:47 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-5]: pciback.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/xen/pciback.c: revision 1.3
Unbind the event channel after mapping the interrupt. Otherwise domain0
will share the interrupt with the domU and xen will wait for domain0 to
ack the interrupt too. Now devices that don't share an interrupt with
a device in domain0 works too.
Make sure the same PCI bus isn't published multiple times.


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.3 -r1.4.6.4 src/sys/arch/xen/xen/pciback.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/xen/xen/pciback.c
diff -u src/sys/arch/xen/xen/pciback.c:1.4.6.3 src/sys/arch/xen/xen/pciback.c:1.4.6.4
--- src/sys/arch/xen/xen/pciback.c:1.4.6.3	Sat Oct  3 23:56:43 2009
+++ src/sys/arch/xen/xen/pciback.c	Sat Oct  3 23:58:47 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: pciback.c,v 1.4.6.3 2009/10/03 23:56:43 snj Exp $  */
+/*  $NetBSD: pciback.c,v 1.4.6.4 2009/10/03 23:58:47 snj Exp $  */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.3 2009/10/03 23:56:43 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.4 2009/10/03 23:58:47 snj Exp $");
 
 #include "opt_xen.h"
 #include "rnd.h"
@@ -272,6 +272,7 @@
 		aprint_normal_dev(self, "interrupting at %s\n",
 		intrstr ? intrstr : "unknown interrupt");
 	}
+	unbind_pirq_from_evtch(APIC_IRQ_LEGACY_IRQ(sc->sc_intrhandle.pirq));
 	sc->sc_irq = APIC_IRQ_LEGACY_IRQ(sc->sc_intrhandle.pirq);
 	/* XXX should be done elsewhere ? */
 	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_INTERRUPT_REG);
@@ -700,6 +701,7 @@
 err);
 			}
 			num_roots++;
+			bus[pbd->pb_bus]++;
 		}
 	}
 	err = xenbus_printf(NULL, pbxi->pbx_xbusd->xbusd_path, "root_num",



CVS commit: [netbsd-5] src/sys/arch

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:57:54 UTC 2009

Modified Files:
src/sys/arch/amd64/conf [netbsd-5]: XEN3_DOM0
src/sys/arch/i386/conf [netbsd-5]: XEN3_DOM0

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.37
sys/arch/i386/conf/XEN3_DOM0: revision 1.12
Add pciback device to XEN3 dom0 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.33.4.2 -r1.33.4.3 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/arch/i386/conf/XEN3_DOM0

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/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.2 src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.3
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.2	Sat Sep 26 19:52:09 2009
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Oct  3 23:57:54 2009
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.33.4.2 2009/09/26 19:52:09 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.33.4.3 2009/10/03 23:57:54 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -228,6 +228,14 @@
 ppb*		at pci? dev ? function ?	# PCI-PCI bridges
 pci*		at ppb? bus ?
 
+# pci backend devices, used for PCI pass-through. To export a PCI device
+# to a domU, the device has to be attached to the pciback driver in the dom0.
+# you can force a device to attach to the pciback driver in dom0 passing
+# pciback.hide=(bus:dev.fun)(bus:dev.func) to the dom0 kernel boot parameters.
+# bus and dev are 2-digits hex number, func is a single-digit number:
+# pciback.hide=(00:1a.0)(00:1a.1)(00:1a.7)
+pciback* at pci?#pci backend device
+
 # PCI bridges
 ichlpcib* at pci? dev ? function ?	# Intel ICH PCI-ISA w/ timecounter,
 	# watchdog and SpeedStep support

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.10 src/sys/arch/i386/conf/XEN3_DOM0:1.10.8.1
--- src/sys/arch/i386/conf/XEN3_DOM0:1.10	Sun May 18 22:05:59 2008
+++ src/sys/arch/i386/conf/XEN3_DOM0	Sat Oct  3 23:57:54 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.10 2008/05/18 22:05:59 cegger Exp $
+#	$NetBSD: XEN3_DOM0,v 1.10.8.1 2009/10/03 23:57:54 snj Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -14,6 +14,14 @@
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges
 pci*	at ppb? bus ?
 
+# pci backend devices, used for PCI pass-through. To export a PCI device
+# to a domU, the device has to be attached to the pciback driver in the dom0.
+# you can force a device to attach to the pciback driver in dom0 passing
+# pciback.hide=(bus:dev.fun)(bus:dev.func) to the dom0 kernel boot parameters.
+# bus and dev are 2-digits hex number, func is a single-digit number:
+# pciback.hide=(00:1a.0)(00:1a.1)(00:1a.7)
+pciback* at pci?#pci backend device
+
 acpi0 		at hypervisor?
 options 	MPBIOS
 options 	MPDEBUG



CVS commit: [netbsd-5] src/sys/arch/xen/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:56:43 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-5]: pciback.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/xen/pciback.c: revision 1.2
- xentools also use pci vendor/product id and subsystem id; export them
via the kernfs file
- EVTCHNOP_bind_pirq wants the legacy IRQ number; so always set the
  legacy IRQ number in the PCI_INTERRUPT_REG.


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.2 -r1.4.6.3 src/sys/arch/xen/xen/pciback.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/xen/xen/pciback.c
diff -u src/sys/arch/xen/xen/pciback.c:1.4.6.2 src/sys/arch/xen/xen/pciback.c:1.4.6.3
--- src/sys/arch/xen/xen/pciback.c:1.4.6.2	Sat Oct  3 23:54:05 2009
+++ src/sys/arch/xen/xen/pciback.c	Sat Oct  3 23:56:43 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: pciback.c,v 1.4.6.2 2009/10/03 23:54:05 snj Exp $  */
+/*  $NetBSD: pciback.c,v 1.4.6.3 2009/10/03 23:56:43 snj Exp $  */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.2 2009/10/03 23:54:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.3 2009/10/03 23:56:43 snj Exp $");
 
 #include "opt_xen.h"
 #include "rnd.h"
@@ -105,6 +105,8 @@
 	} sc_bars[PCI_NBARS];
 	pci_intr_handle_t sc_intrhandle;
 	int  sc_irq;
+	pcireg_t sc_id;
+	pcireg_t sc_subid;
 	char sc_kernfsname[16];
 };
 
@@ -187,7 +189,7 @@
 	SLIST_ENTRY(pb_xenbus_instance) pbx_next; /* list of backend instances*/
 	struct xenbus_device *pbx_xbusd;
 	domid_t pbx_domid;
-	struct pciback_pci_devlist pbx_pb_pci_dev; /* list of exported PCi devices */
+	struct pciback_pci_devlist pbx_pb_pci_dev; /* list of exported PCI devices */
 	/* communication with the domU */
 unsigned int pbx_evtchn; /* our even channel */
 struct xen_pci_sharedinfo *pbx_sh_info;
@@ -237,6 +239,9 @@
 	sc->sc_pb->pb_pc = pa->pa_pc;
 	sc->sc_pb->pb_tag = pa->pa_tag;
 
+	sc->sc_id = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ID_REG);
+	sc->sc_subid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+
 	for (i = 0; i < PCI_NBARS;) {
 		sc->sc_bars[i].b_type = pci_mapreg_type(pa->pa_pc, pa->pa_tag,
 		PCI_MAPREG_START + i * 4);
@@ -267,11 +272,7 @@
 		aprint_normal_dev(self, "interrupting at %s\n",
 		intrstr ? intrstr : "unknown interrupt");
 	}
-	if (sc->sc_intrhandle.pirq & APIC_INT_VIA_APIC) {
-		sc->sc_irq = APIC_IRQ_PIN(sc->sc_intrhandle.pirq);
-	} else {
-		sc->sc_irq = APIC_IRQ_LEGACY_IRQ(sc->sc_intrhandle.pirq);
-	}
+	sc->sc_irq = APIC_IRQ_LEGACY_IRQ(sc->sc_intrhandle.pirq);
 	/* XXX should be done elsewhere ? */
 	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_INTERRUPT_REG);
 	reg &= ~ (PCI_INTERRUPT_LINE_MASK << PCI_INTERRUPT_LINE_SHIFT);
@@ -314,6 +315,12 @@
 
 	off = uio->uio_offset;
 	len = 0;
+	len += snprintf(&buf[len], PCIBACK_KERNFS_SIZE - len,
+	"vendor: 0x%04x\nproduct: 0x%04x\n",
+	PCI_VENDOR(sc->sc_id), PCI_PRODUCT(sc->sc_id));
+	len += snprintf(&buf[len], PCIBACK_KERNFS_SIZE - len,
+	"subsys_vendor: 0x%04x\nsubsys_product: 0x%04x\n",
+	PCI_VENDOR(sc->sc_subid), PCI_PRODUCT(sc->sc_subid));
 	for(i = 0; i < PCI_NBARS; i++) {
 		if (sc->sc_bars[i].b_valid) {
 			len += snprintf(&buf[len], PCIBACK_KERNFS_SIZE - len,
@@ -776,6 +783,7 @@
 			op->err = XEN_PCI_ERR_invalid_offset;
 			break;
 		}
+		break;
 	default:
 		aprint_error("pciback: unknown cmd %d\n", op->cmd);
 		op->err = XEN_PCI_ERR_not_implemented;



CVS commit: [netbsd-5] src/sys/arch

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:55:43 UTC 2009

Modified Files:
src/sys/arch/amd64/conf [netbsd-5]: XEN3_DOMU
src/sys/arch/i386/conf [netbsd-5]: XEN3_DOMU

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/amd64/conf/XEN3_DOMU: revision 1.16
sys/arch/i386/conf/XEN3_DOMU: revision 1.12
Add commented out PCI pass-through support:


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.10 -r1.10.66.1 src/sys/arch/i386/conf/XEN3_DOMU

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/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.13 src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.1
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.13	Sun Aug 10 08:53:29 2008
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Sat Oct  3 23:55:43 2009
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.13 2008/08/10 08:53:29 cegger Exp $
+# $NetBSD: XEN3_DOMU,v 1.13.4.1 2009/10/03 23:55:43 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -158,6 +158,11 @@
 
 xencons*	at hypervisor?		# Xen virtual console
 
+# PCI pass-through support: 
+#xpci* at xenbus ?			#Xen3 PCI front end driver
+#pci* at xpci ?
+# you then need to add your PCI devices drivers below.
+
 cinclude "arch/amd64/conf/GENERIC.local"
 
 # Pseudo-Devices

Index: src/sys/arch/i386/conf/XEN3_DOMU
diff -u src/sys/arch/i386/conf/XEN3_DOMU:1.10 src/sys/arch/i386/conf/XEN3_DOMU:1.10.66.1
--- src/sys/arch/i386/conf/XEN3_DOMU:1.10	Sat Nov 11 20:00:39 2006
+++ src/sys/arch/i386/conf/XEN3_DOMU	Sat Oct  3 23:55:43 2009
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.10 2006/11/11 20:00:39 bouyer Exp $
+# $NetBSD: XEN3_DOMU,v 1.10.66.1 2009/10/03 23:55:43 snj Exp $
 
 include "arch/i386/conf/XEN2_DOMU"
 
@@ -14,3 +14,8 @@
 xenbus*		at hypervisor?		# Xen virtual bus
 xennet*		at xenbus?		# Xen virtual network interface
 xbd*		at xenbus?		# Xen virtual block device
+
+# PCI pass-through support: 
+#xpci* at xenbus ?			#Xen3 PCI front end driver
+#pci* at xpci ?
+# you then need to add your PCI devices drivers below.



CVS commit: [netbsd-5] src/sys/arch/xen

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:54:05 UTC 2009

Modified Files:
src/sys/arch/xen/conf [netbsd-5]: files.xen
src/sys/arch/xen/include [netbsd-5]: pci_machdep.h xen.h
src/sys/arch/xen/xen [netbsd-5]: hypervisor.c pci_intr_machdep.c
xen_machdep.c
Added Files:
src/sys/arch/xen/xen [netbsd-5]: pciback.c xpci_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/conf/files.xen: revision 1.93
sys/arch/xen/include/pci_machdep.h: revision 1.11
sys/arch/xen/include/xen.h: revision 1.31
sys/arch/xen/xen/hypervisor.c: revision 1.44
sys/arch/xen/xen/pci_intr_machdep.c: revision 1.8
sys/arch/xen/xen/pciback.c: revision 1.1
sys/arch/xen/xen/xen_machdep.c: revision 1.5
sys/arch/xen/xen/xpci_xenbus.c: revision 1.1
Work in progress on PCI front-end/back-end support
front-end:
- add a xpci* at xenbus? which provides pci busses from the dom0
  xpci provides support routines for PCI config space operations and
  enumeration in xpci_xenbus.c
- hypervisor.c: do dom0-style PCI attach only ifdef DOM0OPS
- pci_intr_machdep.c:  check line value only if DOM0OPS
back-end:
- add a pciback* at pci? device which takes precedences over all
  other PCI devices (match return 500) and matches all devices passed
  to pciback.hide option on boot command line.
  It exports the PCI device informations to files in /kern/xen/pci/
- hypervisor.c: create /kern/xen earlier so pciback can create its
  entries while PCI devices are probed
- xen_machdep.c: add handling for pciback.hide=
frontend is know working on Xen 3.1.x dom0 with ahc(4) and pciide(4)
devices. uhci(4) fail when trying to allocate a large contigous DMA
buffer.
backend is work in progress; support in xentools is not there yet.


To generate a diff of this commit:
cvs rdiff -u -r1.88.4.4 -r1.88.4.5 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/arch/xen/include/pci_machdep.h
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.42.4.1 -r1.42.4.2 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/arch/xen/xen/pci_intr_machdep.c
cvs rdiff -u -r0 -r1.4.6.2 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.4 -r1.4.8.1 src/sys/arch/xen/xen/xen_machdep.c
cvs rdiff -u -r0 -r1.2.6.2 src/sys/arch/xen/xen/xpci_xenbus.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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.88.4.4 src/sys/arch/xen/conf/files.xen:1.88.4.5
--- src/sys/arch/xen/conf/files.xen:1.88.4.4	Fri Jun 19 21:22:11 2009
+++ src/sys/arch/xen/conf/files.xen	Sat Oct  3 23:54:04 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.88.4.4 2009/06/19 21:22:11 snj Exp $
+#	$NetBSD: files.xen,v 1.88.4.5 2009/10/03 23:54:04 snj Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -67,7 +67,7 @@
 file	crypto/blowfish/arch/i386/bf_enc.S	blowfish
 file	crypto/blowfish/arch/i386/bf_cbc.S	blowfish
 elifdef amd64
-file	arch/amd64/amd64/busfunc.S		dom0ops
+file	arch/amd64/amd64/busfunc.S
 file	arch/amd64/amd64/cpufunc.S
 file	arch/amd64/amd64/cpu_in_cksum.S		(inet | inet6) & cpu_in_cksum
 file	arch/amd64/amd64/db_disasm.c		ddb
@@ -216,6 +216,11 @@
 #file	arch/xen/xen/xbd.c		xbd | xbd_hypervisor | xbd_xenbus needs-flag
 file	arch/xen/xen/xbd.c		xbd_hypervisor needs-flag
 
+# PCI frontend
+device xpci: pcibus
+attach xpci at xenbus with xpci_xenbus
+file	arch/xen/xen/xpci_xenbus.c	xpci_xenbus
+
 # Non-Xen specific devices and options
 
 include	"dev/pckbport/files.pckbport"
@@ -228,6 +233,11 @@
 include "dev/pci/files.agp"
 file	arch/xen/xen/pciide_machdep.c	pciide_common
 
+device	pciback {unit = -1}
+attach	pciback at pci
+file	arch/xen/xen/pciback.c		pciback
+
+
 # x86 specific PCI hardware
 include "arch/x86/pci/files.pci"
 
@@ -381,7 +391,7 @@
 file	arch/xen/xen/xbdback.c		dom0ops & !xen3
 file	arch/xen/xen/xennetback.c	dom0ops & !xen3
 file	arch/xen/xen/pci_machdep.c	hypervisor & pci & !xen3
-file	arch/x86/pci/pci_machdep.c	hypervisor & pci & xen3
+file	arch/x86/pci/pci_machdep.c	hypervisor & pci & xen3 & dom0ops
 file	arch/xen/xen/pci_intr_machdep.c	hypervisor & pci
 file	arch/xen/xen/isa_machdep.c	hypervisor & dom0ops
 file	arch/xen/xen/xenevt.c		xenevt & dom0ops

Index: src/sys/arch/xen/include/pci_machdep.h
diff -u src/sys/arch/xen/include/pci_machdep.h:1.10 src/sys/arch/xen/include/pci_machdep.h:1.10.8.1
--- src/sys/arch/xen/include/pci_machdep.h:1.10	Fri May 30 16:22:51 2008
+++ src/sys/arch/xen/include/pci_machdep.h	Sat Oct  3 23:54:05 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.10 2008/05/30 16:22:51 cegger Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.10.8.1 2009/10/03 23:54:05 snj Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -64,6 +64,

CVS commit: src/lib/libpthread

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  3 23:49:50 UTC 2009

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Don't just look only at the first element in the deadqueue to find lwp's
to reuse, because if we lose the race with the kernel we are never going
to reuse any elements. Look in the whole list instead.
XXX: should be pulled up to 5.x


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.112 src/lib/libpthread/pthread.c:1.113
--- src/lib/libpthread/pthread.c:1.112	Thu Jul  2 05:59:00 2009
+++ src/lib/libpthread/pthread.c	Sat Oct  3 19:49:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.112 2009/07/02 09:59:00 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.113 2009/10/03 23:49:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.112 2009/07/02 09:59:00 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.113 2009/10/03 23:49:50 christos Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -353,23 +353,17 @@
 	 */
 	if (!PTQ_EMPTY(&pthread__deadqueue)) {
 		pthread_mutex_lock(&pthread__deadqueue_lock);
-		newthread = PTQ_FIRST(&pthread__deadqueue);
-		if (newthread != NULL) {
-			PTQ_REMOVE(&pthread__deadqueue, newthread, pt_deadq);
-			pthread_mutex_unlock(&pthread__deadqueue_lock);
+		PTQ_FOREACH(newthread, &pthread__deadqueue, pt_deadq) {
 			/* Still running? */
-			if (newthread->pt_lwpctl->lc_curcpu !=
-			LWPCTL_CPU_EXITED &&
-			(_lwp_kill(newthread->pt_lid, 0) == 0 ||
-			errno != ESRCH)) {
-pthread_mutex_lock(&pthread__deadqueue_lock);
-PTQ_INSERT_TAIL(&pthread__deadqueue,
-newthread, pt_deadq);
-pthread_mutex_unlock(&pthread__deadqueue_lock);
-newthread = NULL;
-			}
-		} else
-			pthread_mutex_unlock(&pthread__deadqueue_lock);
+			if (newthread->pt_lwpctl->lc_curcpu ==
+			LWPCTL_CPU_EXITED ||
+			(_lwp_kill(newthread->pt_lid, 0) == -1 &&
+			errno == ESRCH))
+break;
+		}
+		if (newthread)
+			PTQ_REMOVE(&pthread__deadqueue, newthread, pt_deadq);
+		pthread_mutex_unlock(&pthread__deadqueue_lock);
 	}
 
 	/*



CVS commit: [netbsd-5] src/sys/arch

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:49:50 UTC 2009

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: machdep.c
src/sys/arch/i386/i386 [netbsd-5]: machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/amd64/amd64/machdep.c: revision 1.124
sys/arch/i386/i386/machdep.c: revision 1.660
Prepare for PCI frontend support in Xen3 domUs:
call x86_bus_space_init() and x86_bus_space_mallocok() if we have ISA or PCI
  devices configured; not only for non-Xen or dom0 Xen
On Xen, always call PHYSDEVOP_SET_IOPL on context switch
on amd64, also call PHYSDEVOP_SET_IOPL from x86_64_proc0_tss_ldt_init()


To generate a diff of this commit:
cvs rdiff -u -r1.102.4.10 -r1.102.4.11 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.644.4.10 -r1.644.4.11 src/sys/arch/i386/i386/machdep.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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.102.4.10 src/sys/arch/amd64/amd64/machdep.c:1.102.4.11
--- src/sys/arch/amd64/amd64/machdep.c:1.102.4.10	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/amd64/amd64/machdep.c	Sat Oct  3 23:49:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.102.4.10 2009/04/04 17:39:09 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.102.4.11 2009/10/03 23:49:50 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -112,7 +112,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102.4.10 2009/04/04 17:39:09 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102.4.11 2009/10/03 23:49:50 snj Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -131,6 +131,8 @@
 #ifndef XEN
 #include "opt_physmem.h"
 #endif
+#include "isa.h"
+#include "pci.h"
 
 #include 
 #include 
@@ -365,7 +367,7 @@
 	format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
 	printf("avail memory = %s\n", pbuf);
 
-#if !defined(XEN) || defined(DOM0OPS)
+#if NISA > 0 || NPCI > 0
 	/* Safe for i/o port / memory space allocation to use malloc now. */
 	x86_bus_space_mallocok();
 #endif
@@ -391,12 +393,10 @@
 	struct cpu_info *ci;
 	ci = curcpu();
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), new->pcb_rsp0);
-	if (xendomain_is_privileged()) {
-		struct physdev_op physop;
-		physop.cmd = PHYSDEVOP_SET_IOPL;
-		physop.u.set_iopl.iopl = new->pcb_iopl;
-		HYPERVISOR_physdev_op(&physop);
-	}
+	struct physdev_op physop;
+	physop.cmd = PHYSDEVOP_SET_IOPL;
+	physop.u.set_iopl.iopl = new->pcb_iopl;
+	HYPERVISOR_physdev_op(&physop);
 	if (new->pcb_fpcpu != ci) {
 		HYPERVISOR_fpu_taskswitch(1);
 	}
@@ -429,10 +429,16 @@
 #if !defined(XEN)
 	lldt(pcb->pcb_ldt_sel);
 #else
+	{
+	struct physdev_op physop;
 	xen_set_ldt((vaddr_t) ldtstore, LDT_SIZE >> 3);
 	/* Reset TS bit and set kernel stack for interrupt handlers */
 	HYPERVISOR_fpu_taskswitch(1);
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_rsp0);
+	physop.cmd = PHYSDEVOP_SET_IOPL;
+	physop.u.set_iopl.iopl = pcb->pcb_iopl;
+	HYPERVISOR_physdev_op(&physop);
+	}
 #endif /* XEN */
 }
 
@@ -1399,7 +1405,7 @@
 	__PRINTK(("pcb_cr3 0x%lx\n", xen_start_info.pt_base - KERNBASE));
 #endif
 
-#if !defined(XEN) || defined(DOM0OPS)
+#if NISA > 0 || NPCI > 0
 	x86_bus_space_init();
 #endif
 

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.644.4.10 src/sys/arch/i386/i386/machdep.c:1.644.4.11
--- src/sys/arch/i386/i386/machdep.c:1.644.4.10	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/i386/i386/machdep.c	Sat Oct  3 23:49:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.644.4.10 2009/04/04 17:39:09 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.644.4.11 2009/10/03 23:49:50 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.644.4.10 2009/04/04 17:39:09 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.644.4.11 2009/10/03 23:49:50 snj Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -513,7 +513,7 @@
 	printf("avail memory = %s\n", pbuf);
 
 	/* Safe for i/o port / memory space allocation to use malloc now. */
-#if !defined(XEN) || defined(DOM0OPS)
+#if NISA > 0 || NPCI > 0
 	x86_bus_space_mallocok();
 #endif
 
@@ -580,21 +580,20 @@
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_esp0);
 
-	if (xendomain_is_privileged()) {
-		int iopl = pcb->pcb_iopl;
 #ifdef XEN3
-	struct physdev_op physop;
-		physop.cmd = PHYSDEVOP_SET_IOPL;
-		physop.u.set_iopl.iopl = iopl;
-		HYPERVISOR_physdev_op(&physop);
+	struct physdev_op physop;
+	physop.cmd = PHYSDEVOP_SET_IOPL;
+	physop.u.set_iopl.iopl = pcb->pcb_iopl;
+	HYPERVISOR_physdev_op(&physop);
 #else
+	if (xendomain_is_privileged()) {
 		dom0_op_t op;
 		op.cmd = DOM0_IOPL;
 		op.u.iopl.domain = DOMID_SELF;
-		op.u.iopl.iopl = iopl;
+		op.u.iopl.iopl = pcb->pcb_iopl;
 		HYPERVISOR_dom0_o

CVS commit: [netbsd-5] src/sys/arch/cobalt/dev

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:45:24 UTC 2009

Modified Files:
src/sys/arch/cobalt/dev [netbsd-5]: panel.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1053):
sys/arch/cobalt/dev/panel.c: revision 1.20
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Also check howto to print appropriate "Rebooting..." or "Halting..." messages.


To generate a diff of this commit:
cvs rdiff -u -r1.18.8.1 -r1.18.8.2 src/sys/arch/cobalt/dev/panel.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/cobalt/dev/panel.c
diff -u src/sys/arch/cobalt/dev/panel.c:1.18.8.1 src/sys/arch/cobalt/dev/panel.c:1.18.8.2
--- src/sys/arch/cobalt/dev/panel.c:1.18.8.1	Sat Oct  3 23:44:07 2009
+++ src/sys/arch/cobalt/dev/panel.c	Sat Oct  3 23:45:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: panel.c,v 1.18.8.1 2009/10/03 23:44:07 snj Exp $ */
+/* $NetBSD: panel.c,v 1.18.8.2 2009/10/03 23:45:24 snj Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.18.8.1 2009/10/03 23:44:07 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.18.8.2 2009/10/03 23:45:24 snj Exp $");
 
 #include 
 #include 
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -76,14 +77,18 @@
 	"NetBSD/cobalt   ",
 	"Starting up...  "
 };
-static const struct lcd_message shutdown_message = {
+static const struct lcd_message halt_message = {
 	"NetBSD/cobalt   ",
-	"Shutting down..."
+	"Halting...  "
+};
+static const struct lcd_message reboot_message = {
+	"NetBSD/cobalt   ",
+	"Rebooting..."
 };
 
 static int	panel_match(device_t, cfdata_t, void *);
 static void	panel_attach(device_t, device_t, void *);
-static void	panel_shutdown(void *);
+static bool	panel_shutdown(device_t, int);
 
 static void	panel_soft(void *);
 
@@ -158,7 +163,7 @@
 	hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
 	HD_DDRAM_WRITE);
 
-	shutdownhook_establish(panel_shutdown, sc);
+	pmf_device_register1(self, NULL, NULL, panel_shutdown);
 
 	sc->sc_kp.sc_iot = maa->ma_iot;
 	sc->sc_kp.sc_ioh = MIPS_PHYS_TO_KSEG1(PANEL_BASE); /* XXX */
@@ -173,18 +178,23 @@
 	selinit(&sc->sc_selq);
 }
 
-static void
-panel_shutdown(void *arg)
+static bool
+panel_shutdown(device_t self, int howto)
 {
-	struct panel_softc *sc = arg;
+	struct panel_softc *sc = device_private(self);
 	struct hd44780_io io;
 
 	/* Goodbye World */
 	io.dat = 0;
 	io.len = PANEL_VCOLS * PANEL_ROWS;
-	memcpy(io.buf, &shutdown_message, io.len);
+	if (howto & RB_HALT)
+		memcpy(io.buf, &halt_message, io.len);
+	else
+		memcpy(io.buf, &reboot_message, io.len);
 	hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
 	HD_DDRAM_WRITE);
+
+	return true;
 }
 
 static uint8_t



CVS commit: [netbsd-5] src/sys/arch/cobalt/dev

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:44:07 UTC 2009

Modified Files:
src/sys/arch/cobalt/dev [netbsd-5]: panel.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1053):
sys/arch/cobalt/dev/panel.c: revision 1.19
Adjust attach message for failure path (found on gxemul).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/arch/cobalt/dev/panel.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/cobalt/dev/panel.c
diff -u src/sys/arch/cobalt/dev/panel.c:1.18 src/sys/arch/cobalt/dev/panel.c:1.18.8.1
--- src/sys/arch/cobalt/dev/panel.c:1.18	Fri May  9 10:59:55 2008
+++ src/sys/arch/cobalt/dev/panel.c	Sat Oct  3 23:44:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: panel.c,v 1.18 2008/05/09 10:59:55 tsutsui Exp $ */
+/* $NetBSD: panel.c,v 1.18.8.1 2009/10/03 23:44:07 snj Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.18 2008/05/09 10:59:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.18.8.1 2009/10/03 23:44:07 snj Exp $");
 
 #include 
 #include 
@@ -139,6 +139,8 @@
 	bus_space_subregion(sc->sc_lcd.sc_iot, sc->sc_lcd.sc_ioir, DATA_OFFSET,
 	1, &sc->sc_lcd.sc_iodr);
 
+	printf("\n");
+
 	sc->sc_lcd.sc_dev_ok = 1;
 	sc->sc_lcd.sc_cols = PANEL_COLS;
 	sc->sc_lcd.sc_vcols = PANEL_VCOLS;
@@ -169,8 +171,6 @@
 
 	callout_init(&sc->sc_callout, 0);
 	selinit(&sc->sc_selq);
-
-	printf("\n");
 }
 
 static void



CVS commit: [netbsd-5] src/sys/arch/i386/include

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:41:49 UTC 2009

Modified Files:
src/sys/arch/i386/include [netbsd-5]: npx.h

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1050):
sys/arch/i386/include/npx.h: revision 1.23
The FPU Tag word is a 16bit register, in FPU (387) mode it
defines 2-bit tags for each FPU data register, in MMX mode it
defines 1-bit tags for each data register. The single bit
tags are stored in the lower 8 bits and thus in the first byte
of the save frame.
See amd64/include/fpu.h and the IA-32 Software Developer's manual Vol 2A.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.76.1 src/sys/arch/i386/include/npx.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/arch/i386/include/npx.h
diff -u src/sys/arch/i386/include/npx.h:1.22 src/sys/arch/i386/include/npx.h:1.22.76.1
--- src/sys/arch/i386/include/npx.h:1.22	Tue May  2 19:03:24 2006
+++ src/sys/arch/i386/include/npx.h	Sat Oct  3 23:41:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: npx.h,v 1.22 2006/05/02 19:03:24 drochner Exp $	*/
+/*	$NetBSD: npx.h,v 1.22.76.1 2009/10/03 23:41:49 snj Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -81,8 +81,8 @@
 struct envxmm {
 /*0*/	uint16_t en_cw;		/* FPU Control Word */
 	uint16_t en_sw;		/* FPU Status Word */
-	uint8_t  en_rsvd0;
 	uint8_t  en_tw;		/* FPU Tag Word (abridged) */
+	uint8_t  en_rsvd0;
 	uint16_t en_opcode;	/* FPU Opcode */
 	uint32_t en_fip;	/* FPU Instruction Pointer */
 	uint16_t en_fcs;	/* FPU IP selector */



CVS commit: [netbsd-5] src/sys/arch/amiga/dev

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:37:31 UTC 2009

Modified Files:
src/sys/arch/amiga/dev [netbsd-5]: clock.c

Log Message:
Pull up following revision(s) (requested by mhitch in ticket #1049):
sys/arch/amiga/dev/clock.c: revision 1.49
Reverted last change after discussion with the author, Michael L. Hitch:
http://mail-index.netbsd.org/port-amiga/2009/08/14/msg007164.html
We have a full 32-bit counter, so the masking is not needed.


To generate a diff of this commit:
cvs rdiff -u -r1.47.20.2 -r1.47.20.3 src/sys/arch/amiga/dev/clock.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/clock.c
diff -u src/sys/arch/amiga/dev/clock.c:1.47.20.2 src/sys/arch/amiga/dev/clock.c:1.47.20.3
--- src/sys/arch/amiga/dev/clock.c:1.47.20.2	Sat Sep 26 18:44:59 2009
+++ src/sys/arch/amiga/dev/clock.c	Sat Oct  3 23:37:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.47.20.2 2009/09/26 18:44:59 snj Exp $ */
+/*	$NetBSD: clock.c,v 1.47.20.3 2009/10/03 23:37:31 snj Exp $ */
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.47.20.2 2009/09/26 18:44:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.47.20.3 2009/10/03 23:37:31 snj Exp $");
 
 #include 
 #include 
@@ -112,7 +112,7 @@
 static struct timecounter clk_timecounter = {
 	clk_getcounter,	/* get_timecount */
 	0,		/* no poll_pps */
-	0x0fffu,	/* counter_mask */
+	~0u,		/* counter_mask */
 	0,		/* frequency */
 	"clock",	/* name, overriden later */
 	100,		/* quality */
@@ -159,7 +159,6 @@
 clockattach(struct device *pdp, struct device *dp, void *auxp)
 {
 	const char *clockchip;
-	u_int counter_mask;
 	unsigned short interval;
 #ifdef DRACO
 	u_char dracorev;
@@ -189,14 +188,8 @@
 
 	amiga_clk_interval = (eclockfreq / hz);
 
-	counter_mask = 0x8000;
-	while (counter_mask != 0 && (counter_mask & amiga_clk_interval) == 0)
-		counter_mask >>= 1;
-	counter_mask -= 1;
-
 	clk_timecounter.tc_name = clockchip;
 	clk_timecounter.tc_frequency = eclockfreq;
-	clk_timecounter.tc_counter_mask = counter_mask;
 
 	fast_delay_limit = UINT_MAX / amiga_clk_interval;
 



CVS commit: [netbsd-5] src/sys/arch/amd64/amd64

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:34:48 UTC 2009

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: netbsd32_machdep.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1048):
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.59
Ensure FP state is reset, if FP is used in a signal handler.
Fixes PR kern/39299 for 32bit code.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/arch/amd64/amd64/netbsd32_machdep.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/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.1
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55	Wed Oct 15 06:51:17 2008
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Sat Oct  3 23:34:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.55 2008/10/15 06:51:17 wrstuden Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.1 2009/10/03 23:34:48 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55 2008/10/15 06:51:17 wrstuden Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.4.1 2009/10/03 23:34:48 snj Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -266,6 +266,9 @@
 	tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL);
 	tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL);
 
+	/* Ensure FP state is reset, if FP is used. */
+	l->l_md.md_flags &= ~MDP_USEDFPU;
+
 	tf->tf_rip = (uint64_t)catcher;
 	tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL);
 	tf->tf_rflags &= ~PSL_CLEARSIG;
@@ -357,6 +360,9 @@
 	tf->tf_rsp = (uint64_t)fp;
 	tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL);
 
+	/* Ensure FP state is reset, if FP is used. */
+	l->l_md.md_flags &= ~MDP_USEDFPU;
+
 	/* Remember that we're now on the signal stack. */
 	if (onstack)
 		l->l_sigstk.ss_flags |= SS_ONSTACK;



CVS commit: [netbsd-5] src/distrib/utils/sysinst

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:22:23 UTC 2009

Modified Files:
src/distrib/utils/sysinst [netbsd-5]: disks.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1046):
distrib/utils/sysinst/disks.c: revision 1.107
In get_descr(), initialize dd_descr to an empty string before probing
ATA and SCSI identification. Fixes issues with xbd and raid.


To generate a diff of this commit:
cvs rdiff -u -r1.100.2.4 -r1.100.2.5 src/distrib/utils/sysinst/disks.c

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

Modified files:

Index: src/distrib/utils/sysinst/disks.c
diff -u src/distrib/utils/sysinst/disks.c:1.100.2.4 src/distrib/utils/sysinst/disks.c:1.100.2.5
--- src/distrib/utils/sysinst/disks.c:1.100.2.4	Sat Sep  5 12:57:00 2009
+++ src/distrib/utils/sysinst/disks.c	Sat Oct  3 23:22:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.100.2.4 2009/09/05 12:57:00 bouyer Exp $ */
+/*	$NetBSD: disks.c,v 1.100.2.5 2009/10/03 23:22:23 snj Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -288,6 +288,8 @@
 	if (fd < 0)
 		goto done;
 
+	dd->dd_descr[0] = '\0';
+
 	/* try ATA */
 	if (get_descr_ata(dd, fd))
 		goto done;



CVS commit: [netbsd-5] src/bin/kill

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:20:05 UTC 2009

Modified Files:
src/bin/kill [netbsd-5]: kill.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1043):
bin/kill/kill.c: revision 1.26
Make sure that numerical signals and pids are in range for their types.
Fixes PR bin/42143


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.4.1 src/bin/kill/kill.c

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

Modified files:

Index: src/bin/kill/kill.c
diff -u src/bin/kill/kill.c:1.25 src/bin/kill/kill.c:1.25.4.1
--- src/bin/kill/kill.c:1.25	Sun Jul 20 00:52:40 2008
+++ src/bin/kill/kill.c	Sat Oct  3 23:20:05 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: kill.c,v 1.25 2008/07/20 00:52:40 lukem Exp $ */
+/* $NetBSD: kill.c,v 1.25.4.1 2009/10/03 23:20:05 snj Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kill.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kill.c,v 1.25 2008/07/20 00:52:40 lukem Exp $");
+__RCSID("$NetBSD: kill.c,v 1.25.4.1 2009/10/03 23:20:05 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,6 +49,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -69,7 +71,8 @@
 int
 main(int argc, char *argv[])
 {
-	int errors, numsig, pid;
+	int errors;
+	intmax_t numsig, pid;
 	char *ep;
 
 	setprogname(argv[0]);
@@ -87,17 +90,19 @@
 		if (argc == 1) {
 			if (isdigit((unsigned char)**argv) == 0)
 usage();
-			numsig = strtol(*argv, &ep, 10);
-			if (*ep != '\0') {
+			numsig = strtoimax(*argv, &ep, 10);
+			/* check for correctly parsed number */
+			if (*ep != '\0' || numsig == INTMAX_MIN || numsig == INTMAX_MAX) {
 errx(EXIT_FAILURE, "illegal signal number: %s",
 		*argv);
 /* NOTREACHED */
 			}
 			if (numsig >= 128)
 numsig -= 128;
+			/* and whether it fits into signals range */
 			if (numsig <= 0 || numsig >= NSIG)
 nosig(*argv);
-			printf("%s\n", sys_signame[numsig]);
+			printf("%s\n", sys_signame[(int) numsig]);
 			exit(0);
 		}
 		printsignals(stdout);
@@ -122,12 +127,14 @@
 			if ((numsig = signame_to_signum(sn)) < 0)
 nosig(sn);
 		} else if (isdigit((unsigned char)*sn)) {
-			numsig = strtol(sn, &ep, 10);
-			if (*ep) {
+			numsig = strtoimax(sn, &ep, 10);
+			/* check for correctly parsed number */
+			if (*ep || numsig == INTMAX_MIN || numsig == INTMAX_MAX ) {
 errx(EXIT_FAILURE, "illegal signal number: %s",
 		sn);
 /* NOTREACHED */
 			}
+			/* and whether it fits into signals range */
 			if (numsig < 0 || numsig >= NSIG)
 nosig(sn);
 		} else
@@ -151,14 +158,17 @@
 		} else 
 #endif
 		{
-			pid = strtol(*argv, &ep, 10);
-			if (!**argv || *ep) {
+			pid = strtoimax(*argv, &ep, 10);
+			/* make sure the pid is a number and fits into pid_t */
+			if (!**argv || *ep || pid == INTMAX_MIN ||
+pid == INTMAX_MAX || pid != (pid_t) pid) {
+
 warnx("illegal process id: %s", *argv);
 errors = 1;
 continue;
 			}
 		}
-		if (kill(pid, numsig) == -1) {
+		if (kill((pid_t) pid, (int) numsig) == -1) {
 			warn("%s", *argv);
 			errors = 1;
 		}
@@ -166,7 +176,7 @@
 		/* Wakeup the process if it was suspended, so it can
 		   exit without an explicit 'fg'. */
 		if (numsig == SIGTERM || numsig == SIGHUP)
-			kill(pid, SIGCONT);
+			kill((pid_t) pid, SIGCONT);
 #endif
 	}
 



CVS commit: [netbsd-5] src/sys/fs/puffs

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:11:27 UTC 2009

Modified Files:
src/sys/fs/puffs [netbsd-5]: puffs_node.c puffs_vnops.c

Log Message:
Pull up following revision(s) (requested by pooka in ticket #1042):
sys/fs/puffs/puffs_node.c: revision 1.14
sys/fs/puffs/puffs_vnops.c: revision 1.134
* fix a race i introduced almost two years ago in rev 1.116:
  operations creating a node cannot be considered outgoing operations,
  since after return from userspace they modify file system state
  by creating a new node.  if we do not protect the file system by
  holding the directory lock, a lookup operation might race us into
  the kernel and create the node earlier.
* remove pnode from hashlish before sending the reclaim faf off to
  userspace.  also, hold pmp_lock while frobbing the list.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.10.1 src/sys/fs/puffs/puffs_node.c
cvs rdiff -u -r1.129.4.1 -r1.129.4.2 src/sys/fs/puffs/puffs_vnops.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/fs/puffs/puffs_node.c
diff -u src/sys/fs/puffs/puffs_node.c:1.13 src/sys/fs/puffs/puffs_node.c:1.13.10.1
--- src/sys/fs/puffs/puffs_node.c:1.13	Tue May  6 12:33:16 2008
+++ src/sys/fs/puffs/puffs_node.c	Sat Oct  3 23:11:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_node.c,v 1.13 2008/05/06 12:33:16 ad Exp $	*/
+/*	$NetBSD: puffs_node.c,v 1.13.10.1 2009/10/03 23:11:27 snj Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.13 2008/05/06 12:33:16 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.13.10.1 2009/10/03 23:11:27 snj Exp $");
 
 #include 
 #include 
@@ -223,7 +223,7 @@
 		if (pnc->pnc_cookie == ck) {
 			mutex_exit(&pmp->pmp_lock);
 			puffs_senderr(pmp, PUFFS_ERR_MAKENODE, EEXIST,
-			"cookie exists", ck);
+			"newcookie exists", ck);
 			return EPROTO;
 		}
 	}
@@ -260,7 +260,6 @@
 		panic("puffs_putvnode: %p not a puffs vnode", vp);
 #endif
 
-	LIST_REMOVE(pnode, pn_hashent);
 	genfs_node_destroy(vp);
 	puffs_releasenode(pnode);
 	vp->v_data = NULL;
@@ -336,6 +335,9 @@
 	 */
 	mutex_enter(&pmp->pmp_lock);
 	if (pmp->pmp_root) {
+		struct puffs_node *pnode = vp->v_data;
+
+		LIST_REMOVE(pnode, pn_hashent);
 		mutex_exit(&pmp->pmp_lock);
 		puffs_putvnode(vp);
 		goto retry;

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.129.4.1 src/sys/fs/puffs/puffs_vnops.c:1.129.4.2
--- src/sys/fs/puffs/puffs_vnops.c:1.129.4.1	Sat Sep 26 18:53:48 2009
+++ src/sys/fs/puffs/puffs_vnops.c	Sat Oct  3 23:11:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.129.4.1 2009/09/26 18:53:48 snj Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.129.4.2 2009/10/03 23:11:27 snj Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.129.4.1 2009/09/26 18:53:48 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.129.4.2 2009/10/03 23:11:27 snj Exp $");
 
 #include 
 #include 
@@ -644,16 +644,7 @@
 	create_msg->pvnr_va = *ap->a_vap;
 	puffs_msg_setinfo(park_create, PUFFSOP_VN,
 	PUFFS_VN_CREATE, VPTOPNC(dvp));
-
-	/*
-	 * Do the dance:
-	 * + insert into queue ("interlock")
-	 * + unlock vnode
-	 * + wait for response
-	 */
-	puffs_msg_enqueue(pmp, park_create);
-	REFPN_AND_UNLOCKVP(dvp, dpn);
-	error = puffs_msg_wait2(pmp, park_create, dpn, NULL);
+	PUFFS_MSG_ENQUEUEWAIT2(pmp, park_create, dvp->v_data, NULL, error);
 
 	error = checkerr(pmp, error, __func__);
 	if (error)
@@ -666,10 +657,10 @@
 		create_msg->pvnr_newnode, cnp);
 
  out:
+	vput(dvp);
 	if (error || (cnp->cn_flags & SAVESTART) == 0)
 		PNBUF_PUT(cnp->cn_pnbuf);
 
-	RELEPN_AND_VP(dvp, dpn);
 	DPRINTF(("puffs_create: return %d\n", error));
 	PUFFS_MSG_RELEASE(create);
 	return error;
@@ -700,9 +691,7 @@
 	puffs_msg_setinfo(park_mknod, PUFFSOP_VN,
 	PUFFS_VN_MKNOD, VPTOPNC(dvp));
 
-	puffs_msg_enqueue(pmp, park_mknod);
-	REFPN_AND_UNLOCKVP(dvp, dpn);
-	error = puffs_msg_wait2(pmp, park_mknod, dpn, NULL);
+	PUFFS_MSG_ENQUEUEWAIT2(pmp, park_mknod, dvp->v_data, NULL, error);
 
 	error = checkerr(pmp, error, __func__);
 	if (error)
@@ -716,10 +705,10 @@
 		mknod_msg->pvnr_newnode, cnp);
 
  out:
+	vput(dvp);
 	PUFFS_MSG_RELEASE(mknod);
 	if (error || (cnp->cn_flags & SAVESTART) == 0)
 		PNBUF_PUT(cnp->cn_pnbuf);
-	RELEPN_AND_VP(dvp, dpn);
 	return error;
 }
 
@@ -1073,6 +1062,8 @@
 	} */ *ap = v;
 	struct vnode *vp = ap->a_vp;
 	struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
+	struct puffs_node *pnode = vp->v_data;
+	bool notifyserver = true;
 
 	/*
 	 * first things first: check if someone is trying to reclaim the
@@ -1085,14 +1076,23 @@
 		KASSERT(pmp->pmp_root != NULL);
 		pmp->pmp_root = NULL;
 		mutex_exit(&pmp->pmp_lock);
-		goto

CVS commit: [netbsd-5] src/sys/fs/smbfs

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 23:05:25 UTC 2009

Modified Files:
src/sys/fs/smbfs [netbsd-5]: smbfs_node.c smbfs_vfsops.c

Log Message:
Pull up following revision(s) (requested by njoly in ticket #1041):
sys/fs/smbfs/smbfs_node.c: revision 1.41 via patch
sys/fs/smbfs/smbfs_vfsops.c: revision 1.88 via patch
Fix some panics while trying to umount a smbfs share.
Be sure that no other active vnodes remains, before trying to release
the root one. Likewise, do not destroy the smbmount specific structure
if the umount will fail (busy conditions).
No objection from po...@.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/fs/smbfs/smbfs_node.c
cvs rdiff -u -r1.85 -r1.85.4.1 src/sys/fs/smbfs/smbfs_vfsops.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/fs/smbfs/smbfs_node.c
diff -u src/sys/fs/smbfs/smbfs_node.c:1.39 src/sys/fs/smbfs/smbfs_node.c:1.39.6.1
--- src/sys/fs/smbfs/smbfs_node.c:1.39	Tue Jun 24 17:04:11 2008
+++ src/sys/fs/smbfs/smbfs_node.c	Sat Oct  3 23:05:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_node.c,v 1.39 2008/06/24 17:04:11 cegger Exp $	*/
+/*	$NetBSD: smbfs_node.c,v 1.39.6.1 2009/10/03 23:05:25 snj Exp $	*/
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.39 2008/06/24 17:04:11 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.39.6.1 2009/10/03 23:05:25 snj Exp $");
 
 #include 
 #include 
@@ -244,8 +244,6 @@
 
 	SMBVDEBUG("%.*s,%d\n", (int) np->n_nmlen, np->n_name, vp->v_usecount);
 
-	KASSERT((np->n_flag & NOPEN) == 0);
-
 	mutex_enter(&smp->sm_hashlock);
 
 	dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ?

Index: src/sys/fs/smbfs/smbfs_vfsops.c
diff -u src/sys/fs/smbfs/smbfs_vfsops.c:1.85 src/sys/fs/smbfs/smbfs_vfsops.c:1.85.4.1
--- src/sys/fs/smbfs/smbfs_vfsops.c:1.85	Sun Sep  7 13:13:04 2008
+++ src/sys/fs/smbfs/smbfs_vfsops.c	Sat Oct  3 23:05:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_vfsops.c,v 1.85 2008/09/07 13:13:04 tron Exp $	*/
+/*	$NetBSD: smbfs_vfsops.c,v 1.85.4.1 2009/10/03 23:05:25 snj Exp $	*/
 
 /*
  * Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.85 2008/09/07 13:13:04 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.85.4.1 2009/10/03 23:05:25 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_quota.h"
@@ -236,6 +236,7 @@
 	struct lwp *l = curlwp;
 	struct smbmount *smp = VFSTOSMBFS(mp);
 	struct smb_cred scred;
+	struct vnode *smbfs_rootvp = SMBTOV(smp->sm_root);
 	int error, flags;
 
 	SMBVDEBUG("smbfs_unmount: flags=%04x\n", mntflags);
@@ -244,11 +245,8 @@
 		flags |= FORCECLOSE;
 #ifdef QUOTA
 #endif
-	/* Drop the extra reference to root vnode. */
-	if (smp->sm_root) {
-		vrele(SMBTOV(smp->sm_root));
-		smp->sm_root = NULL;
-	}
+	if (smbfs_rootvp->v_usecount > 1 && (mntflags & MNT_FORCE) == 0)
+		return EBUSY;
 
 	/* Flush all vnodes.
 	 * Keep trying to flush the vnode list for the mount while 
@@ -259,8 +257,12 @@
 	 * sufficient in this case. */
 	do {
 		smp->sm_didrele = 0;
-		error = vflush(mp, NULLVP, flags);
+		error = vflush(mp, smbfs_rootvp, flags);
 	} while (error == EBUSY && smp->sm_didrele != 0);
+	if (error)
+		return error;
+
+	vgone(smbfs_rootvp);
 
 	smb_makescred(&scred, l, l->l_cred);
 	smb_share_lock(smp->sm_share);
@@ -270,7 +272,7 @@
 	hashdone(smp->sm_hash, HASH_LIST, smp->sm_hashlen);
 	mutex_destroy(&smp->sm_hashlock);
 	FREE(smp, M_SMBFSDATA);
-	return error;
+	return 0;
 }
 
 /*



CVS commit: src/sys/rump/librump/rumpkern

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  3 22:55:48 UTC 2009

Modified Files:
src/sys/rump/librump/rumpkern: emul.c

Log Message:
Need proc_uidmatch


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/rump/librump/rumpkern/emul.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/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.96 src/sys/rump/librump/rumpkern/emul.c:1.97
--- src/sys/rump/librump/rumpkern/emul.c:1.96	Thu Sep 24 17:00:09 2009
+++ src/sys/rump/librump/rumpkern/emul.c	Sat Oct  3 18:55:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.96 2009/09/24 21:00:09 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.97 2009/10/03 22:55:48 christos Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.96 2009/09/24 21:00:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.97 2009/10/03 22:55:48 christos Exp $");
 
 #include 
 #include 
@@ -619,6 +619,13 @@
 	panic("%s: not implemented", __func__);
 }
 
+int
+proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
+{
+
+	panic("%s: not implemented", __func__);
+}
+
 void
 proc_crmod_enter(void)
 {



CVS commit: [netbsd-5] src

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 22:49:43 UTC 2009

Modified Files:
src/sbin/fsck_ffs [netbsd-5]: extern.h setup.c wapbl.c
src/sbin/tunefs [netbsd-5]: tunefs.c
src/sys/ufs/ffs [netbsd-5]: ffs_vfsops.c ffs_wapbl.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1036):
sbin/fsck_ffs/extern.h: revision 1.25 via patch
sbin/fsck_ffs/setup.c: revision 1.88 via patch
sbin/fsck_ffs/wapbl.c: revision 1.4 via patch
sbin/tunefs/tunefs.c: revision 1.41 via patch
sys/ufs/ffs/ffs_vfsops.c: revision 1.252 via patch
sys/ufs/ffs/ffs_wapbl.c: revision 1.13 via patch
Allow tunefs to clear any type of WAPBL log, not only in-filesystem
ones. Discussed in
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.
--
Do some basic checks of the WAPBL journal, to abort the boot before the
kernel refuse to mount a filesystem read-write (booting a system
multiuser with critical filesystems read-only is bad):
Add a check_wapbl() which will check some WAPBL values in the superblock,
and try to read the journal via wapbl_replay_start() if there is one.
pfatal() if one of these fail (abort boot if in preen mode,
as "CONTINUE" otherwise). In non-preen mode the bogus journal will
be cleared.
check_wapbl() is always called if the superblock supports WAPBL.
Even if FS_DOWAPBL is not there, there could be flags asking the
kernel to clear or create a log with bogus values which would cause the
kernel refuse to mount the filesystem.
Discussed in
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.
--
If the WAPBL journal can't be read (ffs_wapbl_replay_start() fails),
mount the filesystem anyway if MNT_FORCE is present.
This allows to still boot single-user a system with a corrupted
WAPBL on /, and so get a chance to run fsck to fix it.
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.2.1 src/sbin/fsck_ffs/extern.h
cvs rdiff -u -r1.84 -r1.84.2.1 src/sbin/fsck_ffs/setup.c
cvs rdiff -u -r1.2 -r1.2.6.1 src/sbin/fsck_ffs/wapbl.c
cvs rdiff -u -r1.37.2.1 -r1.37.2.2 src/sbin/tunefs/tunefs.c
cvs rdiff -u -r1.239.2.3 -r1.239.2.4 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.6 -r1.6.8.1 src/sys/ufs/ffs/ffs_wapbl.c

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

Modified files:

Index: src/sbin/fsck_ffs/extern.h
diff -u src/sbin/fsck_ffs/extern.h:1.24 src/sbin/fsck_ffs/extern.h:1.24.2.1
--- src/sbin/fsck_ffs/extern.h:1.24	Sat Aug 30 10:46:16 2008
+++ src/sbin/fsck_ffs/extern.h	Sat Oct  3 22:49:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.24 2008/08/30 10:46:16 bouyer Exp $	*/
+/*	$NetBSD: extern.h,v 1.24.2.1 2009/10/03 22:49:42 snj Exp $	*/
 
 /*
  * Copyright (c) 1994 James A. Jegers
@@ -82,6 +82,7 @@
 int		setup(const char *, const char *);
 void		voidquit(int);
 
+int		check_wapbl(void);
 void		replay_wapbl(void);
 void		cleanup_wapbl(void);
 int		read_wapbl(char *, long, daddr_t);

Index: src/sbin/fsck_ffs/setup.c
diff -u src/sbin/fsck_ffs/setup.c:1.84 src/sbin/fsck_ffs/setup.c:1.84.2.1
--- src/sbin/fsck_ffs/setup.c:1.84	Sat Aug 30 10:46:16 2008
+++ src/sbin/fsck_ffs/setup.c	Sat Oct  3 22:49:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: setup.c,v 1.84 2008/08/30 10:46:16 bouyer Exp $	*/
+/*	$NetBSD: setup.c,v 1.84.2.1 2009/10/03 22:49:42 snj Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c	8.10 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: setup.c,v 1.84 2008/08/30 10:46:16 bouyer Exp $");
+__RCSID("$NetBSD: setup.c,v 1.84.2.1 2009/10/03 22:49:42 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -173,24 +173,35 @@
 		doskipclean = 0;
 		pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag);
 	}
-	if (sblock->fs_flags & FS_DOWAPBL) {
-		if (preen) {
+	/* ffs_superblock_layout() == 2 */
+	if (sblock->fs_magic != FS_UFS1_MAGIC ||
+	(sblock->fs_old_flags & FS_FLAGS_UPDATED) != 0) {
+		/* can have WAPBL */
+		if (check_wapbl() != 0) {
+			doskipclean = 0;
+		}
+		if (sblock->fs_flags & FS_DOWAPBL) {
+			if (preen) {
+if (!quiet)
+	pwarn("file system is journaled; "
+	"not checking\n");
+return (-1);
+			}
 			if (!quiet)
-pwarn("file system is journaled; not checking\n");
-			return (-1);
+pwarn("** File system is journaled; "
+"replaying journal\n");
+			replay_wapbl();
+			doskipclean = 0;
+			sblock->fs_flags &= ~FS_DOWAPBL;
+			sbdirty();
+			/* Although we may have updated the superblock from
+			 * the journal, we are still going to do a full check,
+			 * so we don't bother to re-read the superblock from
+			 * the journal.
+			 * XXX, instead we could re-read the superblock and
+			 * then not force doskipclean = 0 
+			 */
 		}
-		if (!quiet)
-			pwarn("** File system is journaled; replaying journal\n");
-		replay_wa

CVS commit: src/sys

2009-10-03 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Sat Oct  3 22:32:57 UTC 2009

Modified Files:
src/sys/kern: init_main.c kern_synch.c sys_sched.c
src/sys/sys: sched.h

Log Message:
- Move sched_listener and co. from kern_synch.c to sys_sched.c, where it
  really belongs (suggested by rmind@),

- Rename sched_init() to synch_init(), and introduce a new sched_init()
  in sys_sched.c where we (a) initialize the sysctl node (no more
  link-set) and (b) listen on the process scope with sched_listener.

Reviewed by and okay rm...@.


To generate a diff of this commit:
cvs rdiff -u -r1.404 -r1.405 src/sys/kern/init_main.c
cvs rdiff -u -r1.269 -r1.270 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.33 -r1.34 src/sys/kern/sys_sched.c
cvs rdiff -u -r1.70 -r1.71 src/sys/sys/sched.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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.404 src/sys/kern/init_main.c:1.405
--- src/sys/kern/init_main.c:1.404	Fri Oct  2 22:18:57 2009
+++ src/sys/kern/init_main.c	Sat Oct  3 22:32:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.404 2009/10/02 22:18:57 elad Exp $	*/
+/*	$NetBSD: init_main.c,v 1.405 2009/10/03 22:32:56 elad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.404 2009/10/02 22:18:57 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.405 2009/10/03 22:32:56 elad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -398,6 +398,8 @@
 	turnstile_init();
 	sleeptab_init(&sleeptab);
 
+	sched_init();
+
 	/* Initialize processor-sets */
 	psets_init();
 
@@ -780,7 +782,7 @@
 
 	/* Setup the runqueues and scheduler. */
 	runq_init();
-	sched_init();
+	synch_init();
 
 	/*
 	 * Bus scans can make it appear as if the system has paused, so

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.269 src/sys/kern/kern_synch.c:1.270
--- src/sys/kern/kern_synch.c:1.269	Sat Oct  3 21:21:56 2009
+++ src/sys/kern/kern_synch.c	Sat Oct  3 22:32:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.269 2009/10/03 21:21:56 elad Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.270 2009/10/03 22:32:56 elad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.269 2009/10/03 21:21:56 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.270 2009/10/03 22:32:56 elad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -97,7 +97,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -128,8 +127,6 @@
 unsigned	sched_pstats_ticks;
 kcondvar_t	lbolt;			/* once a second sleep address */
 
-static kauth_listener_t	sched_listener;
-
 /* Preemption event counters */
 static struct evcnt kpreempt_ev_crit;
 static struct evcnt kpreempt_ev_klock;
@@ -145,57 +142,8 @@
  */
 int	safepri;
 
-static int
-sched_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
-void *arg0, void *arg1, void *arg2, void *arg3)
-{
-	struct proc *p;
-	int result;
-
-	result = KAUTH_RESULT_DEFER;
-	p = arg0;
-
-	switch (action) {
-	case KAUTH_PROCESS_SCHEDULER_GETPARAM:
-		if (kauth_cred_uidmatch(cred, p->p_cred))
-			result = KAUTH_RESULT_ALLOW;
-		break;
-
-	case KAUTH_PROCESS_SCHEDULER_SETPARAM:
-		if (kauth_cred_uidmatch(cred, p->p_cred)) {
-			struct lwp *l;
-			int policy;
-			pri_t priority;
-
-			l = arg1;
-			policy = (int)(unsigned long)arg2;
-			priority = (pri_t)(unsigned long)arg3;
-
-			if ((policy == l->l_class ||
-			(policy != SCHED_FIFO && policy != SCHED_RR)) &&
-			priority <= l->l_priority)
-result = KAUTH_RESULT_ALLOW;
-		}
-
-		break;
-
-	case KAUTH_PROCESS_SCHEDULER_GETAFFINITY:
-		result = KAUTH_RESULT_ALLOW;
-		break;
-
-	case KAUTH_PROCESS_SCHEDULER_SETAFFINITY:
-		/* Privileged; we let the secmodel handle this. */
-		break;
-
-	default:
-		break;
-	}
-
-	return result;
-}
-
 void
-sched_init(void)
+synch_init(void)
 {
 
 	cv_init(&lbolt, "lbolt");
@@ -210,9 +158,6 @@
 	   "kpreempt", "immediate");
 
 	sched_pstats(NULL);
-
-	sched_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
-	sched_listener_cb, NULL);
 }
 
 /*

Index: src/sys/kern/sys_sched.c
diff -u src/sys/kern/sys_sched.c:1.33 src/sys/kern/sys_sched.c:1.34
--- src/sys/kern/sys_sched.c:1.33	Tue Mar  3 21:55:06 2009
+++ src/sys/kern/sys_sched.c	Sat Oct  3 22:32:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_sched.c,v 1.33 2009/03/03 21:55:06 rmind Exp $	*/
+/*	$NetBSD: sys_sched.c,v 1.34 2009/10/03 22:32:56 elad Exp $	*/
 
 /*
  * Copyright (c) 2008, Mindaugas Rasiukevicius 
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_sched.c,v 1.33 2009/03/03 21:55:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_sched.c,v 1.34 2009/10/03 22:32:56 elad Exp $");
 
 #include 
 
@@ -64,6 +64,9 @@
 
 #include "opt_sa.h"
 
+static struct

CVS commit: src/lib/libc/arch/m68k/sys

2009-10-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Oct  3 22:28:33 UTC 2009

Modified Files:
src/lib/libc/arch/m68k/sys: cerror.S

Log Message:
SystemV-R4 ABI for M68k returns pointers in %a0, so we have to make sure
that CERROR returns -1 in %a0 in addition to %d0 and %d1, to make functions
like mmap(2), mremap(2), shmat(2) or sbrk(2) return -1 in case of an error.
A side effect of this bug was a segfault caused by jemalloc, when mmap()
failed.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/arch/m68k/sys/cerror.S

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

Modified files:

Index: src/lib/libc/arch/m68k/sys/cerror.S
diff -u src/lib/libc/arch/m68k/sys/cerror.S:1.14 src/lib/libc/arch/m68k/sys/cerror.S:1.15
--- src/lib/libc/arch/m68k/sys/cerror.S:1.14	Thu Aug  7 16:42:14 2003
+++ src/lib/libc/arch/m68k/sys/cerror.S	Sat Oct  3 22:28:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cerror.S,v 1.14 2003/08/07 16:42:14 agc Exp $	*/
+/*	$NetBSD: cerror.S,v 1.15 2009/10/03 22:28:33 phx Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,7 +39,7 @@
 #if 0
 	RCSID("from: @(#)cerror.s	5.1 (Berkeley) 5/12/90")
 #else
-	RCSID("$NetBSD: cerror.S,v 1.14 2003/08/07 16:42:14 agc Exp $")
+	RCSID("$NetBSD: cerror.S,v 1.15 2009/10/03 22:28:33 phx Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -80,4 +80,7 @@
 #endif	/* _REENTRANT */
 	movl	#-1,%d0
 	movl	#-1,%d1
+#ifdef	__SVR4_ABI__
+	movl	%d0,%a0
+#endif
 	rts



CVS commit: [netbsd-5] src/sys/dev/pci

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 21:53:36 UTC 2009

Modified Files:
src/sys/dev/pci [netbsd-5]: if_vr.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1022):
sys/dev/pci/if_vr.c: revision 1.99
add suspend/resume support


To generate a diff of this commit:
cvs rdiff -u -r1.95.4.1 -r1.95.4.2 src/sys/dev/pci/if_vr.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/if_vr.c
diff -u src/sys/dev/pci/if_vr.c:1.95.4.1 src/sys/dev/pci/if_vr.c:1.95.4.2
--- src/sys/dev/pci/if_vr.c:1.95.4.1	Sat Oct  3 21:53:01 2009
+++ src/sys/dev/pci/if_vr.c	Sat Oct  3 21:53:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vr.c,v 1.95.4.1 2009/10/03 21:53:01 snj Exp $	*/
+/*	$NetBSD: if_vr.c,v 1.95.4.2 2009/10/03 21:53:36 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.95.4.1 2009/10/03 21:53:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.95.4.2 2009/10/03 21:53:36 snj Exp $");
 
 #include "rnd.h"
 
@@ -216,6 +216,7 @@
 	uint8_t 		vr_enaddr[ETHER_ADDR_LEN];
 	struct mii_data		vr_mii;		/* MII/media info */
 
+	pcireg_t		vr_id;		/* vendor/product ID */
 	uint8_t			vr_revid;	/* Rhine chip revision */
 
 	callout_t		vr_tick_ch;	/* tick callout */
@@ -324,6 +325,7 @@
 static void	vr_reset(struct vr_softc *);
 static int	vr_restore_state(pci_chipset_tag_t, pcitag_t, device_t,
 pcireg_t);
+static bool	vr_resume(device_t PMF_FN_PROTO);
 
 int	vr_copy_small = 0;
 
@@ -1462,6 +1464,7 @@
 	sc->vr_dev = self;
 	sc->vr_pc = pa->pa_pc;
 	sc->vr_tag = pa->pa_tag;
+	sc->vr_id = pa->pa_id;
 	callout_init(&sc->vr_tick_ch, 0);
 
 	vrt = vr_lookup(pa);
@@ -1713,7 +1716,7 @@
 	RND_TYPE_NET, 0);
 #endif
 
-	if (pmf_device_register1(self, NULL, NULL, vr_shutdown))
+	if (pmf_device_register1(self, NULL, vr_resume, vr_shutdown))
 		pmf_class_network_register(self, ifp);
 	else
 		aprint_error_dev(self, "couldn't establish power handler\n");
@@ -1762,3 +1765,14 @@
 	PCI_CONF_WRITE(PCI_INTERRUPT_REG, sc->vr_save_irq);
 	return 0;
 }
+
+static bool
+vr_resume(device_t self PMF_FN_ARGS)
+{
+	struct vr_softc *sc = device_private(self);
+
+	if (PCI_PRODUCT(sc->vr_id) != PCI_PRODUCT_VIATECH_VT3043)
+		VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1));
+
+	return true;
+}



CVS commit: [netbsd-5] src/sys/dev/pci

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 21:53:01 UTC 2009

Modified Files:
src/sys/dev/pci [netbsd-5]: if_vr.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1022):
sys/dev/pci/if_vr.c: revision 1.98
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested VIA VT86C100A (which is probed as VT3043).


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.95.4.1 src/sys/dev/pci/if_vr.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/if_vr.c
diff -u src/sys/dev/pci/if_vr.c:1.95 src/sys/dev/pci/if_vr.c:1.95.4.1
--- src/sys/dev/pci/if_vr.c:1.95	Wed Jul  9 16:14:57 2008
+++ src/sys/dev/pci/if_vr.c	Sat Oct  3 21:53:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vr.c,v 1.95 2008/07/09 16:14:57 joerg Exp $	*/
+/*	$NetBSD: if_vr.c,v 1.95.4.1 2009/10/03 21:53:01 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.95 2008/07/09 16:14:57 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.95.4.1 2009/10/03 21:53:01 snj Exp $");
 
 #include "rnd.h"
 
@@ -207,7 +207,6 @@
 struct vr_softc {
 	device_t		vr_dev;
 	void			*vr_ih;		/* interrupt cookie */
-	void			*vr_ats;	/* shutdown hook */
 	bus_space_tag_t		vr_bst;		/* bus space tag */
 	bus_space_handle_t	vr_bsh;		/* bus space handle */
 	bus_dma_tag_t		vr_dmat;	/* bus DMA tag */
@@ -1398,7 +1397,7 @@
 
 static int	vr_probe(device_t, struct cfdata *, void *);
 static void	vr_attach(device_t, device_t, void *);
-static void	vr_shutdown(void *);
+static bool	vr_shutdown(device_t, int);
 
 CFATTACH_DECL_NEW(vr, sizeof (struct vr_softc),
 vr_probe, vr_attach, NULL, NULL);
@@ -1431,12 +1430,14 @@
  * Stop all chip I/O so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
-vr_shutdown(void *arg)
+static bool
+vr_shutdown(device_t self, int howto)
 {
-	struct vr_softc *sc = (struct vr_softc *)arg;
+	struct vr_softc *sc = device_private(self);
 
 	vr_stop(&sc->vr_ec.ec_if, 1);
+
+	return true;
 }
 
 /*
@@ -1712,9 +1713,11 @@
 	RND_TYPE_NET, 0);
 #endif
 
-	sc->vr_ats = shutdownhook_establish(vr_shutdown, sc);
-	if (sc->vr_ats == NULL)
-		aprint_error_dev(self, "warning: couldn't establish shutdown hook\n");
+	if (pmf_device_register1(self, NULL, NULL, vr_shutdown))
+		pmf_class_network_register(self, ifp);
+	else
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 
  fail_5:



CVS commit: [netbsd-5-0] src

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 21:30:37 UTC 2009

Modified Files:
src/bin/pax [netbsd-5-0]: Makefile ar_io.c
src/tools/compat [netbsd-5-0]: configure configure.ac

Log Message:
Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.10.1 src/bin/pax/Makefile
cvs rdiff -u -r1.48 -r1.48.20.1 src/bin/pax/ar_io.c
cvs rdiff -u -r1.67.2.1 -r1.67.2.1.2.1 src/tools/compat/configure \
src/tools/compat/configure.ac

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

Modified files:

Index: src/bin/pax/Makefile
diff -u src/bin/pax/Makefile:1.37 src/bin/pax/Makefile:1.37.10.1
--- src/bin/pax/Makefile:1.37	Sun Feb 24 20:42:46 2008
+++ src/bin/pax/Makefile	Sat Oct  3 21:30:36 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.37 2008/02/24 20:42:46 joerg Exp $
+#	$NetBSD: Makefile,v 1.37.10.1 2009/10/03 21:30:36 snj Exp $
 #   @(#)Makefile	8.1 (Berkeley) 5/31/93
 
 .include 
@@ -25,12 +25,13 @@
 
 MAN=	pax.1 tar.1 cpio.1
 
-# XXX: Interix does not have it; we need a conditional for it.
-CPPFLAGS+=	-DHAVE_MTIO_H
-
 .if defined(HOSTPROG)
 CPPFLAGS+=	-DHOSTPROG
 .else	# {	! HOSTPROG
+
+# XXX: Interix does not have it; we need a conditional for it.
+CPPFLAGS+=	-DHAVE_SYS_MTIO_H
+
 LINKS+=	${BINDIR}/pax ${BINDIR}/tar
 SYMLINKS+=${BINDIR}/tar /usr/bin/tar
 

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.48 src/bin/pax/ar_io.c:1.48.20.1
--- src/bin/pax/ar_io.c:1.48	Mon Apr 23 18:40:22 2007
+++ src/bin/pax/ar_io.c	Sat Oct  3 21:30:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $	*/
+/*	$netbsd: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.48.20.1 2009/10/03 21:30:36 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -51,7 +51,7 @@
 #include 
 #include 
 #include 
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 #include 
 #endif
 #include 
@@ -99,7 +99,7 @@
 time_t starttime;			/* time the run started */
 int force_one_volume;			/* 1 if we ignore volume changes */
 
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 static int get_phys(void);
 #endif
 extern sigset_t s_mask;
@@ -129,7 +129,7 @@
 int
 ar_open(const char *name)
 {
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 	struct mtget mb;
 #endif
 
@@ -220,7 +220,7 @@
 	}
 
 	if (S_ISCHR(arsb.st_mode)) {
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 		artyp = ioctl(arfd, MTIOCGET, &mb) ? ISCHR : ISTAPE;
 #else
 		tty_warn(1, "System does not have tape support");
@@ -941,7 +941,7 @@
 	long fsbz;
 	off_t cpos;
 	off_t mpos;
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 	struct mtop mb;
 #endif
 
@@ -965,7 +965,7 @@
 	case ISRMT:
 #endif /* SUPPORT_RMT */
 	case ISTAPE:
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 		/*
 		 * if the last i/o was a successful data transfer, we assume
 		 * the fault is just a bad record on the tape that we are now
@@ -1109,7 +1109,7 @@
 ar_rev(off_t sksz)
 {
 	off_t cpos;
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 	int phyblk;
 	struct mtop mb;
 #endif
@@ -1180,7 +1180,7 @@
 #ifdef SUPPORT_RMT
 	case ISRMT:
 #endif /* SUPPORT_RMT */
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 		/*
 		 * Calculate and move the proper number of PHYSICAL tape
 		 * blocks. If the sksz is not an even multiple of the physical
@@ -1242,7 +1242,7 @@
 	return 0;
 }
 
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 /*
  * get_phys()
  *	Determine the physical block size on a tape drive. We need the physical

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.67.2.1 src/tools/compat/configure:1.67.2.1.2.1
--- src/tools/compat/configure:1.67.2.1	Thu Jan 15 04:30:19 2009
+++ src/tools/compat/configure	Sat Oct  3 21:30:36 2009
@@ -2328,7 +2328,7 @@
 # These are not necessarily required by the code, but they are not
 # currently conditionalized.
 
-for ac_header in sys/ioctl.h sys/mman.h sys/mtio.h sys/param.h \
+for ac_header in sys/ioctl.h sys/mman.h sys/param.h \
 	sys/socket.h sys/stat.h sys/time.h sys/types.h sys/utsname.h \
 	sys/wait.h assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
 	netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
@@ -2551,7 +2551,7 @@
 
 fi
 
-for ac_header in sys/sysmacros.h sys/syslimits.h \
+for ac_header in sys/mtio.h sys/sysmacros.h sys/syslimits.h \
 	getopt.h features.h malloc.h sys/poll.h stddef.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
Index: src/tools/compat/configure.ac
diff -u src/tools/com

CVS commit: [netbsd-5] src

2009-10-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Oct  3 21:28:00 UTC 2009

Modified Files:
src/bin/pax [netbsd-5]: Makefile ar_io.c
src/tools/compat [netbsd-5]: configure configure.ac

Log Message:
Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.8.1 src/bin/pax/Makefile
cvs rdiff -u -r1.48 -r1.48.18.1 src/bin/pax/ar_io.c
cvs rdiff -u -r1.67.2.1 -r1.67.2.2 src/tools/compat/configure \
src/tools/compat/configure.ac

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

Modified files:

Index: src/bin/pax/Makefile
diff -u src/bin/pax/Makefile:1.37 src/bin/pax/Makefile:1.37.8.1
--- src/bin/pax/Makefile:1.37	Sun Feb 24 20:42:46 2008
+++ src/bin/pax/Makefile	Sat Oct  3 21:27:59 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.37 2008/02/24 20:42:46 joerg Exp $
+#	$NetBSD: Makefile,v 1.37.8.1 2009/10/03 21:27:59 snj Exp $
 #   @(#)Makefile	8.1 (Berkeley) 5/31/93
 
 .include 
@@ -25,12 +25,13 @@
 
 MAN=	pax.1 tar.1 cpio.1
 
-# XXX: Interix does not have it; we need a conditional for it.
-CPPFLAGS+=	-DHAVE_MTIO_H
-
 .if defined(HOSTPROG)
 CPPFLAGS+=	-DHOSTPROG
 .else	# {	! HOSTPROG
+
+# XXX: Interix does not have it; we need a conditional for it.
+CPPFLAGS+=	-DHAVE_SYS_MTIO_H
+
 LINKS+=	${BINDIR}/pax ${BINDIR}/tar
 SYMLINKS+=${BINDIR}/tar /usr/bin/tar
 

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.48 src/bin/pax/ar_io.c:1.48.18.1
--- src/bin/pax/ar_io.c:1.48	Mon Apr 23 18:40:22 2007
+++ src/bin/pax/ar_io.c	Sat Oct  3 21:27:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $	*/
+/*	$netbsd: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.48.18.1 2009/10/03 21:27:59 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -51,7 +51,7 @@
 #include 
 #include 
 #include 
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 #include 
 #endif
 #include 
@@ -99,7 +99,7 @@
 time_t starttime;			/* time the run started */
 int force_one_volume;			/* 1 if we ignore volume changes */
 
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 static int get_phys(void);
 #endif
 extern sigset_t s_mask;
@@ -129,7 +129,7 @@
 int
 ar_open(const char *name)
 {
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 	struct mtget mb;
 #endif
 
@@ -220,7 +220,7 @@
 	}
 
 	if (S_ISCHR(arsb.st_mode)) {
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 		artyp = ioctl(arfd, MTIOCGET, &mb) ? ISCHR : ISTAPE;
 #else
 		tty_warn(1, "System does not have tape support");
@@ -941,7 +941,7 @@
 	long fsbz;
 	off_t cpos;
 	off_t mpos;
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 	struct mtop mb;
 #endif
 
@@ -965,7 +965,7 @@
 	case ISRMT:
 #endif /* SUPPORT_RMT */
 	case ISTAPE:
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 		/*
 		 * if the last i/o was a successful data transfer, we assume
 		 * the fault is just a bad record on the tape that we are now
@@ -1109,7 +1109,7 @@
 ar_rev(off_t sksz)
 {
 	off_t cpos;
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 	int phyblk;
 	struct mtop mb;
 #endif
@@ -1180,7 +1180,7 @@
 #ifdef SUPPORT_RMT
 	case ISRMT:
 #endif /* SUPPORT_RMT */
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 		/*
 		 * Calculate and move the proper number of PHYSICAL tape
 		 * blocks. If the sksz is not an even multiple of the physical
@@ -1242,7 +1242,7 @@
 	return 0;
 }
 
-#ifdef HAVE_MTIO_H
+#ifdef HAVE_SYS_MTIO_H
 /*
  * get_phys()
  *	Determine the physical block size on a tape drive. We need the physical

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.67.2.1 src/tools/compat/configure:1.67.2.2
--- src/tools/compat/configure:1.67.2.1	Thu Jan 15 04:30:19 2009
+++ src/tools/compat/configure	Sat Oct  3 21:28:00 2009
@@ -2328,7 +2328,7 @@
 # These are not necessarily required by the code, but they are not
 # currently conditionalized.
 
-for ac_header in sys/ioctl.h sys/mman.h sys/mtio.h sys/param.h \
+for ac_header in sys/ioctl.h sys/mman.h sys/param.h \
 	sys/socket.h sys/stat.h sys/time.h sys/types.h sys/utsname.h \
 	sys/wait.h assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
 	netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
@@ -2551,7 +2551,7 @@
 
 fi
 
-for ac_header in sys/sysmacros.h sys/syslimits.h \
+for ac_header in sys/mtio.h sys/sysmacros.h sys/syslimits.h \
 	getopt.h features.h malloc.h sys/poll.h stddef.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.a

CVS commit: src/sys/kern

2009-10-03 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Sat Oct  3 21:21:56 UTC 2009

Modified Files:
src/sys/kern: kern_synch.c

Log Message:
Oops, forgot to make sched_listener static. Pointed out by rmind@, thansk!


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/kern/kern_synch.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/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.268 src/sys/kern/kern_synch.c:1.269
--- src/sys/kern/kern_synch.c:1.268	Sat Oct  3 01:30:25 2009
+++ src/sys/kern/kern_synch.c	Sat Oct  3 21:21:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.268 2009/10/03 01:30:25 elad Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.269 2009/10/03 21:21:56 elad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.268 2009/10/03 01:30:25 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.269 2009/10/03 21:21:56 elad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -128,7 +128,7 @@
 unsigned	sched_pstats_ticks;
 kcondvar_t	lbolt;			/* once a second sleep address */
 
-kauth_listener_t	sched_listener;
+static kauth_listener_t	sched_listener;
 
 /* Preemption event counters */
 static struct evcnt kpreempt_ev_crit;



CVS commit: src/sys/kern

2009-10-03 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Sat Oct  3 21:03:55 UTC 2009

Modified Files:
src/sys/kern: kern_verifiedexec.c

Log Message:
Update a comment. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/kern_verifiedexec.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/kern/kern_verifiedexec.c
diff -u src/sys/kern/kern_verifiedexec.c:1.115 src/sys/kern/kern_verifiedexec.c:1.116
--- src/sys/kern/kern_verifiedexec.c:1.115	Mon Jun 29 05:08:18 2009
+++ src/sys/kern/kern_verifiedexec.c	Sat Oct  3 21:03:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_verifiedexec.c,v 1.115 2009/06/29 05:08:18 dholland Exp $	*/
+/*	$NetBSD: kern_verifiedexec.c,v 1.116 2009/10/03 21:03:55 elad Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.115 2009/06/29 05:08:18 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.116 2009/10/03 21:03:55 elad Exp $");
 
 #include "opt_veriexec.h"
 
@@ -1094,7 +1094,7 @@
 		}
 
 		/*
-		 * XXX: See vfs_mountedon() comment in secmodel/bsd44.
+		 * XXX: See vfs_mountedon() comment in secmodel/securelevel.
 		 */
 		vte = veriexec_table_lookup(bvp->v_mount);
 		if (vte == NULL) {



CVS commit: src/sys/arch/xen/conf

2009-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  3 20:56:39 UTC 2009

Modified Files:
src/sys/arch/xen/conf: files.compat

Log Message:
add dummy opt_via_c7temp.h, spotted by Andreas Gustafsson.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/xen/conf/files.compat

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/xen/conf/files.compat
diff -u src/sys/arch/xen/conf/files.compat:1.21 src/sys/arch/xen/conf/files.compat:1.22
--- src/sys/arch/xen/conf/files.compat:1.21	Wed Aug  5 20:15:37 2009
+++ src/sys/arch/xen/conf/files.compat	Sat Oct  3 20:56:39 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.compat,v 1.21 2009/08/05 20:15:37 jym Exp $
+#	$NetBSD: files.compat,v 1.22 2009/10/03 20:56:39 jmcneill Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 
 # options for MP configuration through the MP spec
@@ -57,6 +57,9 @@
 # Intel On Die Temperature sensor
 defflag opt_intel_coretemp.h		XXXINTEL_CORETEMP
 
+# VIA C7 Temperature sensor
+defflag	opt_via_c7temp.h		XXXVIA_CORETEMP
+
 # Multiboot support
 defflag 	opt_multiboot.h		XXXMULTIBOOT
 



CVS commit: src/sys

2009-10-03 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Sat Oct  3 20:48:42 UTC 2009

Modified Files:
src/sys/kern: kern_time.c
src/sys/secmodel/keylock: secmodel_keylock.c
src/sys/secmodel/securelevel: secmodel_securelevel.c
src/sys/sys: timevar.h

Log Message:
Introduce time_wraps() to check if setting the time will wrap it (or
close to it). Useful for secmodels.

Replace open-coded form with it in secmodel code (securelevel, keylock).

Note: I need to find a way to make secmodel_keylock.c ~<100 lines.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/kern/kern_time.c
cvs rdiff -u -r1.2 -r1.3 src/sys/secmodel/keylock/secmodel_keylock.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/secmodel/securelevel/secmodel_securelevel.c
cvs rdiff -u -r1.25 -r1.26 src/sys/sys/timevar.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/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.161 src/sys/kern/kern_time.c:1.162
--- src/sys/kern/kern_time.c:1.161	Sun Sep 13 18:45:11 2009
+++ src/sys/kern/kern_time.c	Sat Oct  3 20:48:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.161 2009/09/13 18:45:11 pooka Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.162 2009/10/03 20:48:42 elad Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.161 2009/09/13 18:45:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.162 2009/10/03 20:48:42 elad Exp $");
 
 #include 
 #include 
@@ -1461,3 +1461,29 @@
 	mutex_spin_exit(&timer_lock);
 	mutex_exit(proc_lock);
 }
+
+/*
+ * Check if the time will wrap if set to ts.
+ *
+ * ts - timespec describing the new time
+ * delta - the delta between the current time and ts
+ */
+bool
+time_wraps(struct timespec *ts, struct timespec *delta)
+{
+
+	/*
+	 * Don't allow the time to be set forward so far it
+	 * will wrap and become negative, thus allowing an
+	 * attacker to bypass the next check below.  The
+	 * cutoff is 1 year before rollover occurs, so even
+	 * if the attacker uses adjtime(2) to move the time
+	 * past the cutoff, it will take a very long time
+	 * to get to the wrap point.
+	 */
+	if ((ts->tv_sec > LLONG_MAX - 365*24*60*60) ||
+	(delta->tv_sec < 0 || delta->tv_nsec < 0))
+		return true;
+
+	return false;
+}

Index: src/sys/secmodel/keylock/secmodel_keylock.c
diff -u src/sys/secmodel/keylock/secmodel_keylock.c:1.2 src/sys/secmodel/keylock/secmodel_keylock.c:1.3
--- src/sys/secmodel/keylock/secmodel_keylock.c:1.2	Sat Aug 15 09:43:59 2009
+++ src/sys/secmodel/keylock/secmodel_keylock.c	Sat Oct  3 20:48:42 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_keylock.c,v 1.2 2009/08/15 09:43:59 mbalmer Exp $ */
+/* $NetBSD: secmodel_keylock.c,v 1.3 2009/10/03 20:48:42 elad Exp $ */
 /*-
  * Copyright (c) 2009 Marc Balmer 
  * Copyright (c) 2006 Elad Efrat 
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: secmodel_keylock.c,v 1.2 2009/08/15 09:43:59 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_keylock.c,v 1.3 2009/10/03 20:48:42 elad Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -176,18 +177,7 @@
 			struct timespec *ts = arg1;
 			struct timespec *delta = arg2;
 
-			/*
-			 * Don't allow the time to be set forward so far it
-			 * will wrap and become negative, thus allowing an
-			 * attacker to bypass the next check below.  The
-			 * cutoff is 1 year before rollover occurs, so even
-			 * if the attacker uses adjtime(2) to move the time
-			 * past the cutoff, it will take a very long time
-			 * to get to the wrap point.
-			 */
-			if (keylock_position() > 1 &&
-			((ts->tv_sec > LLONG_MAX - 365*24*60*60) ||
-			 (delta->tv_sec < 0 || delta->tv_nsec < 0)))
+			if (keylock_position() > 1 && time_wraps(ts, delta))
 result = KAUTH_RESULT_DENY;
 			break;
 		}

Index: src/sys/secmodel/securelevel/secmodel_securelevel.c
diff -u src/sys/secmodel/securelevel/secmodel_securelevel.c:1.15 src/sys/secmodel/securelevel/secmodel_securelevel.c:1.16
--- src/sys/secmodel/securelevel/secmodel_securelevel.c:1.15	Fri Oct  2 20:15:07 2009
+++ src/sys/secmodel/securelevel/secmodel_securelevel.c	Sat Oct  3 20:48:42 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_securelevel.c,v 1.15 2009/10/02 20:15:07 elad Exp $ */
+/* $NetBSD: secmodel_securelevel.c,v 1.16 2009/10/03 20:48:42 elad Exp $ */
 /*-
  * Copyright (c) 2006 Elad Efrat 
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.15 2009/10/02 20:15:07 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.16 2009/10/03 20:48:42 elad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_insecure.h"
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -242,19 +243,9 @@
 			struct timespec 

CVS commit: src/sys/rump/dev/wip/librumpusbhc

2009-10-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Oct  3 20:46:49 UTC 2009

Modified Files:
src/sys/rump/dev/wip/librumpusbhc: rumpusbhc.c

Log Message:
Report the root hub as self-powered.  Works better when attaching
power-hungry devices.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.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/rump/dev/wip/librumpusbhc/rumpusbhc.c
diff -u src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.2 src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.3
--- src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.2	Sat Oct  3 19:07:33 2009
+++ src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c	Sat Oct  3 20:46:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpusbhc.c,v 1.2 2009/10/03 19:07:33 pooka Exp $	*/
+/*	$NetBSD: rumpusbhc.c,v 1.3 2009/10/03 20:46:49 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpusbhc.c,v 1.2 2009/10/03 19:07:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpusbhc.c,v 1.3 2009/10/03 20:46:49 pooka Exp $");
 
 #include 
 #include 
@@ -158,7 +158,9 @@
   + USB_INTERFACE_DESCRIPTOR_SIZE
   + USB_ENDPOINT_DESCRIPTOR_SIZE },
 	.bNumInterface		= 1,
+	.bmAttributes		= UC_SELF_POWERED | UC_ATTR_MBO,
 };
+/* XXX: spec says UC_ATTR_MBO is reserved and set to one.  required? */
 
 static const usb_interface_descriptor_t rumphub_uid = {
 	.bLength		= USB_INTERFACE_DESCRIPTOR_SIZE,



CVS commit: src/sys/kern

2009-10-03 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Sat Oct  3 20:24:39 UTC 2009

Modified Files:
src/sys/kern: uipc_domain.c

Log Message:
KAUTH_GENERIC_CANSEE -> KAUTH_REQ_NETWORK_SOCKET_CANSEE.

Not quite the same semantics but it's okay. Once our sockets have
credentials (and they will) it's all the same.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/kern/uipc_domain.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/kern/uipc_domain.c
diff -u src/sys/kern/uipc_domain.c:1.84 src/sys/kern/uipc_domain.c:1.85
--- src/sys/kern/uipc_domain.c:1.84	Fri Sep 11 22:06:29 2009
+++ src/sys/kern/uipc_domain.c	Sat Oct  3 20:24:39 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.84 2009/09/11 22:06:29 dyoung Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.85 2009/10/03 20:24:39 elad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.84 2009/09/11 22:06:29 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.85 2009/10/03 20:24:39 elad Exp $");
 
 #include 
 #include 
@@ -455,14 +455,14 @@
 		if (fp->f_count == 0 || fp->f_type != DTYPE_SOCKET ||
 		fp->f_data == NULL)
 			continue;
-		if (kauth_authorize_generic(l->l_cred,
-		KAUTH_GENERIC_CANSEE, fp->f_cred) != 0)
-			continue;
 		so = (struct socket *)fp->f_data;
 		if (so->so_type != type)
 			continue;
 		if (so->so_proto->pr_domain->dom_family != pf)
 			continue;
+		if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_SOCKET,
+		KAUTH_REQ_NETWORK_SOCKET_CANSEE, so, NULL, NULL) != 0)
+			continue;
 		if (len >= elem_size && elem_count > 0) {
 			mutex_enter(&fp->f_lock);
 			fp->f_count++;



CVS commit: src

2009-10-03 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat Oct  3 19:19:59 UTC 2009

Modified Files:
src: build.sh

Log Message:
Add an additional check for whether to rebuild make.  This fixes a problem
I saw where building first without and then with OBJMACHINE confused
build.sh into not building a new nbmake in the new TOOLDIR.


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.213 src/build.sh:1.214
--- src/build.sh:1.213	Sun Sep 27 22:02:41 2009
+++ src/build.sh	Sat Oct  3 19:19:59 2009
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.213 2009/09/27 22:02:41 apb Exp $
+#	$NetBSD: build.sh,v 1.214 2009/10/03 19:19:59 apb Exp $
 #
 # Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1029,7 +1029,7 @@
 #2. use the temporary nbmake to create the top level obj directory;
 #3. use $(getmakevar TOOLDIR) with the temporary nbmake to
 #   get the corect value of TOOLDIR;
-#4. move the temporary nbake to ${TOOLDIR}/bin/nbmake.
+#4. move the temporary nbmake to ${TOOLDIR}/bin/nbmake.
 #
 # However, people don't like building nbmake unnecessarily if their
 # TOOLDIR has not changed since an earlier build.  We try to avoid
@@ -1250,6 +1250,19 @@
 	${runcmd} mkdir -p "${TOOLDIR}/bin" ||
 	bomb "mkdir of '${TOOLDIR}/bin' failed"
 
+	# If we did not previously rebuild ${toolprefix}make, then
+	# check whether $make is still valid and the same as the output
+	# from print_tooldir_make.  If not, then rebuild make now.  A
+	# possible reason for this being necessary is that the actual
+	# value of TOOLDIR might be different from the value guessed
+	# before the top level obj dir was created.
+	#
+	if ! ${done_rebuildmake} && \
+	( [ ! -x "$make" ] || [ "$make" != "$(print_tooldir_make)" ] )
+	then
+		rebuildmake
+	fi
+
 	# Install ${toolprefix}make if it was built.
 	#
 	if ${done_rebuildmake}; then
@@ -1285,7 +1298,7 @@
 	eval cat <

CVS commit: src/sys/rump/dev/wip/librumpusbhc

2009-10-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Oct  3 19:07:33 UTC 2009

Modified Files:
src/sys/rump/dev/wip/librumpusbhc: rumpusbhc.c

Log Message:
probe and attach ugen0 through ugen3


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.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/rump/dev/wip/librumpusbhc/rumpusbhc.c
diff -u src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.1 src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.2
--- src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.1	Fri Oct  2 15:35:46 2009
+++ src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c	Sat Oct  3 19:07:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpusbhc.c,v 1.1 2009/10/02 15:35:46 pooka Exp $	*/
+/*	$NetBSD: rumpusbhc.c,v 1.2 2009/10/03 19:07:33 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -60,11 +60,8 @@
  * It's still somewhat under the hammer 
  */
 
-/* hardcoded /dev/ugenN for now */
-#define UGENDEV 2
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpusbhc.c,v 1.1 2009/10/02 15:35:46 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpusbhc.c,v 1.2 2009/10/03 19:07:33 pooka Exp $");
 
 #include 
 #include 
@@ -109,11 +106,11 @@
 	NULL,
 };
 
-static int	rumpusbhc_match(struct device *, struct cfdata *, void *);
+static int	rumpusbhc_probe(struct device *, struct cfdata *, void *);
 static void	rumpusbhc_attach(struct device *, struct device *, void *);
 
 CFATTACH_DECL_NEW(rumpusbhc, sizeof(struct rumpusbhc_softc),
-	rumpusbhc_match, rumpusbhc_attach, NULL, NULL);
+	rumpusbhc_probe, rumpusbhc_attach, NULL, NULL);
 CFDRIVER_DECL(rumpusbhc, DV_DULL, rumpusbhc_attrs);
 
 struct cfparent rumpusbhcpar = {
@@ -122,18 +119,22 @@
 	DVUNIT_ANY
 };
 
+/* probe ugen0 through ugen3 */
 struct cfdata rumpusbhc_cfdata[] = {
-	{ "rumpusbhc", "rumpusbhc", 0, FSTATE_STAR, NULL, 0, &rumpusbhcpar},
+	{ "rumpusbhc", "rumpusbhc", 0, FSTATE_NOTFOUND, NULL, 0, &rumpusbhcpar},
+	{ "rumpusbhc", "rumpusbhc", 1, FSTATE_NOTFOUND, NULL, 0, &rumpusbhcpar},
+	{ "rumpusbhc", "rumpusbhc", 2, FSTATE_NOTFOUND, NULL, 0, &rumpusbhcpar},
+	{ "rumpusbhc", "rumpusbhc", 3, FSTATE_NOTFOUND, NULL, 0, &rumpusbhcpar},
 };
 
 #define UGENDEV_BASESTR "/dev/ugen"
 #define UGENDEV_BUFSIZE 32
 static void
-makeugendevstr(struct rumpusbhc_softc *sc, int endpoint, char *buf)
+makeugendevstr(int devnum, int endpoint, char *buf)
 {
 
 	CTASSERT(UGENDEV_BUFSIZE > sizeof(UGENDEV_BASESTR)+sizeof("0.00")+1);
-	sprintf(buf, "%s%d.%02d", UGENDEV_BASESTR, sc->sc_devnum, endpoint);
+	sprintf(buf, "%s%d.%02d", UGENDEV_BASESTR, devnum, endpoint);
 }
 
 /*
@@ -722,7 +723,7 @@
 oflags = O_RDWR;
 			}
 
-			makeugendevstr(sc, endpt, buf);
+			makeugendevstr(sc->sc_devnum, endpt, buf);
 			fd = rumpuser_open(buf, oflags, &error);
 			if (fd == -1)
 return USBD_INVAL; /* XXX: no mapping */
@@ -813,15 +814,24 @@
 }
 
 static int
-rumpusbhc_match(struct device *parent, struct cfdata *match, void *aux)
+rumpusbhc_probe(struct device *parent, struct cfdata *match, void *aux)
 {
+	char buf[UGENDEV_BUFSIZE];
+	int fd, error;
 
+	makeugendevstr(match->cf_unit, 0, buf);
+	fd = rumpuser_open(buf, O_RDWR, &error);
+	if (fd == -1)
+		return 0;
+
+	rumpuser_close(fd, &error);
 	return 1;
 }
 
 static void
 rumpusbhc_attach(struct device *parent, struct device *self, void *aux)
 {
+	struct mainbus_attach_args *maa = aux;
 	struct rumpusbhc_softc *sc = device_private(self);
 	char buf[UGENDEV_BUFSIZE];
 	int error;
@@ -832,14 +842,13 @@
 	memset(&sc->sc_ugenfd, -1, sizeof(sc->sc_ugenfd));
 	memset(&sc->sc_fdmodes, -1, sizeof(sc->sc_fdmodes));
 
-	sc->sc_devnum = UGENDEV;
-
 	sc->sc_bus.usbrev = USBREV_2_0;
 	sc->sc_bus.methods = &rumpusbhc_bus_methods;
 	sc->sc_bus.hci_private = sc;
 	sc->sc_bus.pipe_size = sizeof(struct rumpusbhc_pipe);
+	sc->sc_devnum = maa->maa_unit;
 
-	makeugendevstr(sc, 0, buf);
+	makeugendevstr(sc->sc_devnum, 0, buf);
 	sc->sc_ugenfd[UGEN_EPT_CTRL] = rumpuser_open(buf, O_RDWR, &error);
 	if (error)
 		panic("rumpusbhc_attach: failed to open ctrl ept %s\n", buf);



CVS commit: src/sys/rump/librump/rumpdev

2009-10-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Oct  3 19:06:36 UTC 2009

Modified Files:
src/sys/rump/librump/rumpdev: autoconf.c rump_dev_private.h

Log Message:
pass unit number in mainbus attach args


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/librump/rumpdev/autoconf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpdev/rump_dev_private.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/rump/librump/rumpdev/autoconf.c
diff -u src/sys/rump/librump/rumpdev/autoconf.c:1.3 src/sys/rump/librump/rumpdev/autoconf.c:1.4
--- src/sys/rump/librump/rumpdev/autoconf.c:1.3	Thu Oct  1 15:21:38 2009
+++ src/sys/rump/librump/rumpdev/autoconf.c	Sat Oct  3 19:06:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.3 2009/10/01 15:21:38 pooka Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.4 2009/10/03 19:06:35 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2009/10/01 15:21:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2009/10/03 19:06:35 pooka Exp $");
 
 #include 
 #include 
@@ -125,9 +125,11 @@
 mainbus_search(struct device *parent, struct cfdata *cf,
 	const int *ldesc, void *aux)
 {
+	struct mainbus_attach_args maa;
 
-	if (config_match(parent, cf, NULL) > 0)
-		config_attach(parent, cf, NULL, NULL);
+	maa.maa_unit = cf->cf_unit;
+	if (config_match(parent, cf, &maa) > 0)
+		config_attach(parent, cf, &maa, NULL);
 
 	return 0;
 }

Index: src/sys/rump/librump/rumpdev/rump_dev_private.h
diff -u src/sys/rump/librump/rumpdev/rump_dev_private.h:1.5 src/sys/rump/librump/rumpdev/rump_dev_private.h:1.6
--- src/sys/rump/librump/rumpdev/rump_dev_private.h:1.5	Thu Oct  1 21:43:29 2009
+++ src/sys/rump/librump/rumpdev/rump_dev_private.h	Sat Oct  3 19:06:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_dev_private.h,v 1.5 2009/10/01 21:43:29 pooka Exp $	*/
+/*	$NetBSD: rump_dev_private.h,v 1.6 2009/10/03 19:06:36 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -41,4 +41,8 @@
 
 void	rump_device_configuration(void);
 
+struct mainbus_attach_args {
+	int maa_unit;
+};
+
 #endif /* _SYS_RUMP_DEV_PRIVATE_H_ */



CVS commit: src/usr.bin/xlint/lint1

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  3 17:09:18 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
add type attributes in a few more places.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.47 src/usr.bin/xlint/lint1/cgram.y:1.48
--- src/usr.bin/xlint/lint1/cgram.y:1.47	Fri Oct  2 21:35:20 2009
+++ src/usr.bin/xlint/lint1/cgram.y	Sat Oct  3 13:09:18 2009
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.47 2009/10/03 01:35:20 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.48 2009/10/03 17:09:18 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.47 2009/10/03 01:35:20 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.48 2009/10/03 17:09:18 christos Exp $");
 #endif
 
 #include 
@@ -684,13 +684,13 @@
 	| noclass_declmods typespec {
 		addtype($2);
 	  }
-	| noclass_declspecs type_attribute
 	| noclass_declspecs T_QUAL {
 		addqual($2);
 	  }
 	| noclass_declspecs notype_typespec {
 		addtype($2);
 	  }
+	| noclass_declspecs type_attribute
 	;
 
 noclass_declmods:
@@ -903,6 +903,7 @@
 		popdecl();
 		blklev--;
 	  }
+	| notype_direct_decl type_attribute
 	;
 
 type_decl:
@@ -932,6 +933,7 @@
 		popdecl();
 		blklev--;
 	  }
+	| type_direct_decl type_attribute
 	;
 
 /*
@@ -1285,6 +1287,7 @@
 		popdecl();
 		blklev--;
 	  }
+	| direct_abs_decl type_attribute
 	;
 
 non_expr_stmnt:



CVS commit: src/sys/dev/acpi

2009-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  3 15:49:22 UTC 2009

Modified Files:
src/sys/dev/acpi: wmi_acpi.c wmi_acpivar.h

Log Message:
from Jukka Ruohonen:

 - Remove redundant assertions.
 - Properly check for NULL pointers.
 - No real need to keep track whether the internal event handler is installed.
 - Add a missing function to pass possible extra information associated with
   an event. Mentioned in the specification.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/wmi_acpi.c \
src/sys/dev/acpi/wmi_acpivar.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/dev/acpi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi_acpi.c:1.1 src/sys/dev/acpi/wmi_acpi.c:1.2
--- src/sys/dev/acpi/wmi_acpi.c:1.1	Fri Oct  2 16:47:52 2009
+++ src/sys/dev/acpi/wmi_acpi.c	Sat Oct  3 15:49:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_acpi.c,v 1.1 2009/10/02 16:47:52 jmcneill Exp $	*/
+/*	$NetBSD: wmi_acpi.c,v 1.2 2009/10/03 15:49:21 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2009 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.1 2009/10/02 16:47:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.2 2009/10/03 15:49:21 jmcneill Exp $");
 
 #include 
 #include 
@@ -84,7 +84,6 @@
 	device_t	  sc_dev;
 	struct acpi_devnode  *sc_node;
 	struct wmi_t *sc_wmi;
-	bool  sc_event;
 };
 
 static SIMPLEQ_HEAD(, wmi_t) wmi_head =
@@ -121,8 +120,8 @@
 #endif
 
 static ACPI_STATUS acpi_wmi_guid_get(const u_char * const, struct wmi_t **);
-static boolacpi_wmi_event_add(struct acpi_wmi_softc *);
-static boolacpi_wmi_event_del(struct acpi_wmi_softc *);
+static voidacpi_wmi_event_add(struct acpi_wmi_softc *);
+static voidacpi_wmi_event_del(struct acpi_wmi_softc *);
 static voidacpi_wmi_event_handler(ACPI_HANDLE, uint32_t, void *);
 static boolacpi_wmi_suspend(device_t PMF_FN_PROTO);
 static boolacpi_wmi_resume(device_t PMF_FN_PROTO);
@@ -177,7 +176,7 @@
 	 * registers an external event handler with us, we
 	 * will forward events through this.
 	 */
-	sc->sc_event = acpi_wmi_event_add(sc);
+	acpi_wmi_event_add(sc);
 
 	if (pmf_device_register(sc->sc_dev,
 		acpi_wmi_suspend, acpi_wmi_resume) != true)
@@ -316,8 +315,6 @@
 	const char *ptr;
 	uint8_t i;
 
-	KASSERT(src != NULL);
-
 	if (ACPI_STRLEN(src) != 36)
 		return AE_BAD_PARAMETER;
 
@@ -377,7 +374,7 @@
 /*
  * Adds internal event handler.
  */
-static bool
+static void
 acpi_wmi_event_add(struct acpi_wmi_softc *sc)
 {
 	struct wmi_t *wmi;
@@ -389,7 +386,7 @@
 	if (ACPI_FAILURE(rv)) {
 		aprint_error_dev(sc->sc_dev, "failed to install notify "
 		"handler: %s\n", AcpiFormatException(rv));
-		return false;
+		return;
 	}
 
 	/* Enable possible expensive events. */
@@ -410,27 +407,23 @@
 			"expensive WExx: %s\n", AcpiFormatException(rv));
 		}
 	}
-
-	return true;
 }
 /*
  * Removes the internal event handler.
  */
-static bool
+static void
 acpi_wmi_event_del(struct acpi_wmi_softc *sc)
 {
 	struct wmi_t *wmi;
 	ACPI_STATUS rv;
 
-	KASSERT(sc->sc_event != false);
-
 	rv = AcpiRemoveNotifyHandler(sc->sc_node->ad_handle,
 	ACPI_DEVICE_NOTIFY, acpi_wmi_event_handler);
 
 	if (ACPI_FAILURE(rv)) {
-		aprint_error_dev(sc->sc_dev, "failed to remove notify "
+		aprint_debug_dev(sc->sc_dev, "failed to remove notify "
 		"handler: %s\n", AcpiFormatException(rv));
-		return false;
+		return;
 	}
 
 	SIMPLEQ_FOREACH(wmi, &wmi_head, wmi_link) {
@@ -451,8 +444,40 @@
 		aprint_error_dev(sc->sc_dev, "failed to disable "
 		"expensive WExx: %s\n", AcpiFormatException(rv));
 	}
+}
+/*
+ * Returns extra information possibly associated with an event.
+ */
+ACPI_STATUS
+acpi_wmi_event_get(const uint32_t event, ACPI_BUFFER *obuf)
+{
+	struct wmi_t *wmi;
+	ACPI_OBJECT_LIST arg;
+	ACPI_OBJECT obj;
 
-	return true;
+	if (obuf == NULL)
+		return AE_BAD_PARAMETER;
+	if (wmi_handler == NULL)
+		return AE_ABORT_METHOD;
+
+	obj.Type = ACPI_TYPE_INTEGER;
+	obj.Integer.Value = event;
+
+	arg.Count = 0x01;
+	arg.Pointer = &obj;
+
+	SIMPLEQ_FOREACH(wmi, &wmi_head, wmi_link) {
+
+		if (!(wmi->guid.flags & ACPI_WMI_FLAG_EVENT))
+			continue;
+
+		if (wmi->guid.nid != event)
+			continue;
+
+		return AcpiEvaluateObject(wmi->handle, "_WED", &arg, obuf);
+	}
+
+	return AE_NOT_FOUND;
 }
 
 static void
@@ -495,11 +520,7 @@
 {
 	struct acpi_wmi_softc *sc = device_private(self);
 
-	if (sc->sc_event != true)
-		return true;
-
-	if (acpi_wmi_event_del(sc) != false)
-		sc->sc_event = false;
+	acpi_wmi_event_del(sc);
 
 	return true;
 }
@@ -509,13 +530,7 @@
 {
 	struct acpi_wmi_softc *sc = device_private(self);
 
-	if (sc->sc_event != false) {
-		aprint_debug_dev(sc->sc_dev, "event handler enabled?\n");
-		return true;
-	}
-
-	if (acpi_wmi_event_add(sc) != false)
-		sc->sc_event = true;
+	acpi_wmi_event_add(sc

CVS commit: src/sys/arch/i386/conf

2009-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  3 13:37:27 UTC 2009

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
Enable viapcib


To generate a diff of this commit:
cvs rdiff -u -r1.949 -r1.950 src/sys/arch/i386/conf/GENERIC

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/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.949 src/sys/arch/i386/conf/GENERIC:1.950
--- src/sys/arch/i386/conf/GENERIC:1.949	Fri Oct  2 18:50:49 2009
+++ src/sys/arch/i386/conf/GENERIC	Sat Oct  3 13:37:27 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.949 2009/10/02 18:50:49 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.950 2009/10/03 13:37:27 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.949 $"
+#ident 		"GENERIC-$Revision: 1.950 $"
 
 maxusers	64		# estimated number of users
 
@@ -464,8 +464,8 @@
 gpio* 	at gcscpcib?			# timecounter, watchdog and GPIO
 #piixpcib* at pci? dev ? function ?	# Intel PIIX4 PCI-ISA w/ SpeedStep
 #gscpcib* at pci? dev ? function ?	# NS Geode PCI-ISA w/ GPIO support
-#viapcib* at pci? dev ? function ?	# VIA VT8235 PCI-ISA w/ SMBus support
-#iic*	at viapcib?
+viapcib* at pci? dev ? function ?	# VIA VT8235 PCI-ISA w/ SMBus support
+iic*	at viapcib?
 pchb*	at pci? dev ? function ?	# PCI-Host bridges
 pceb*	at pci? dev ? function ?	# PCI-EISA bridges
 pcib*	at pci? dev ? function ?	# PCI-ISA bridges
@@ -487,7 +487,7 @@
 isa0	at ichlpcib?
 #isa0	at piixpcib?
 #isa0	at gscpcib?
-#isa0	at viapcib?
+isa0	at viapcib?
 isa0	at mainbus?
 isa0	at pceb?
 isa0	at pcib?



CVS commit: src/share/man/man5

2009-10-03 Thread Zafer Aydogan
Module Name:src
Committed By:   zafer
Date:   Sat Oct  3 12:45:16 UTC 2009

Modified Files:
src/share/man/man5: passwd.conf.5

Log Message:
remove trailing whitespace. (hi wiz!)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man5/passwd.conf.5

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/man5/passwd.conf.5
diff -u src/share/man/man5/passwd.conf.5:1.8 src/share/man/man5/passwd.conf.5:1.9
--- src/share/man/man5/passwd.conf.5:1.8	Mon Sep  5 03:37:15 2005
+++ src/share/man/man5/passwd.conf.5	Sat Oct  3 12:45:15 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: passwd.conf.5,v 1.8 2005/09/05 03:37:15 hubertf Exp $
+.\"	$NetBSD: passwd.conf.5,v 1.9 2009/10/03 12:45:15 zafer Exp $
 .\"
 .\" Copyright 1997 Niels Provos 
 .\" All rights reserved.
@@ -70,7 +70,7 @@
 For
 .Dq sha1
 the value of rounds is a 32-bit integer, 0 means use the default
-of 24680.  
+of 24680.
 For
 .Dq blowfish
 the value can be between 4 and 31.



CVS commit: src/distrib/utils/sysinst

2009-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct  3 12:00:00 UTC 2009

Modified Files:
src/distrib/utils/sysinst: disks.c

Log Message:
When creating /etc/fstab:
for the first swap partition use type sw,dp instead of sw, so dump device
gets configured correctly if swap is not on the second partition.
Fixes PR install/42148.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/distrib/utils/sysinst/disks.c

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

Modified files:

Index: src/distrib/utils/sysinst/disks.c
diff -u src/distrib/utils/sysinst/disks.c:1.107 src/distrib/utils/sysinst/disks.c:1.108
--- src/distrib/utils/sysinst/disks.c:1.107	Thu Oct  1 10:41:03 2009
+++ src/distrib/utils/sysinst/disks.c	Sat Oct  3 12:00:00 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.107 2009/10/01 10:41:03 jmcneill Exp $ */
+/*	$NetBSD: disks.c,v 1.108 2009/10/03 12:00:00 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -652,6 +652,7 @@
 {
 	FILE *f;
 	int i, swap_dev = -1;
+	const char *dump_dev;
 
 	/* Create the fstab. */
 	make_target_dir("/etc");
@@ -707,10 +708,14 @@
 			fstype = "msdos";
 			break;
 		case FS_SWAP:
-			if (swap_dev == -1)
+			if (swap_dev == -1) {
 swap_dev = i;
-			scripting_fprintf(f, "/dev/%s%c\t\tnone\tswap\tsw\t\t 0 0\n",
-diskdev, 'a' + i);
+dump_dev = ",dp";
+			} else {
+dump_dev ="";
+			}
+			scripting_fprintf(f, "/dev/%s%c\t\tnone\tswap\tsw%s\t\t 0 0\n",
+diskdev, 'a' + i, dump_dev);
 			continue;
 #ifdef USE_SYSVBFS
 		case FS_SYSVBFS:



CVS commit: src/sbin/mount

2009-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Oct  3 07:38:23 UTC 2009

Modified Files:
src/sbin/mount: mount.8

Log Message:
Drop trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sbin/mount/mount.8

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/mount.8
diff -u src/sbin/mount/mount.8:1.68 src/sbin/mount/mount.8:1.69
--- src/sbin/mount/mount.8:1.68	Fri Oct  2 20:31:19 2009
+++ src/sbin/mount/mount.8	Sat Oct  3 07:38:22 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount.8,v 1.68 2009/10/02 20:31:19 elad Exp $
+.\"	$NetBSD: mount.8,v 1.69 2009/10/03 07:38:22 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -136,7 +136,7 @@
 the file-system mounting policy is dictated by the running security models.
 The default security model may allow unprivileged mounting; see
 .Xr secmodel_suser 9
-for details. 
+for details.
 .Pp
 The options are as follows:
 .Bl -tag -width indent



CVS commit: src/share/man/man9

2009-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Oct  3 07:37:01 UTC 2009

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

Log Message:
Drop trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man9/secmodel_suser.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/secmodel_suser.9
diff -u src/share/man/man9/secmodel_suser.9:1.3 src/share/man/man9/secmodel_suser.9:1.4
--- src/share/man/man9/secmodel_suser.9:1.3	Fri Oct  2 20:31:19 2009
+++ src/share/man/man9/secmodel_suser.9	Sat Oct  3 07:37:01 2009
@@ -1,4 +1,4 @@
-.\" $NetBSD: secmodel_suser.9,v 1.3 2009/10/02 20:31:19 elad Exp $
+.\" $NetBSD: secmodel_suser.9,v 1.4 2009/10/03 07:37:01 wiz Exp $
 .\"
 .\" Copyright (c) 2009 Elad Efrat 
 .\" All rights reserved.
@@ -35,8 +35,7 @@
 .Nm
 implements the traditional
 .Em super-user
-(root) as the user with effective user-id
-0.
+(root) as the user with effective user-id 0.
 The
 .Em super-user
 is the host administrator, considered to have higher privileges than other
@@ -67,9 +66,9 @@
 If non-zero, file-systems are allowed to be mounted by an ordinary user who
 owns the point
 .Ar node
-and has at least read access to the 
+and has at least read access to the
 .Ar special
-device 
+device
 .Xr mount 8
 arguments.
 Finally, the flags