CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2010-08-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 18 06:35:01 UTC 2010

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: locore.S locore_mips3.S

Log Message:
Set SR UX when we first set KX.  (XLS416 now boot multiuser again with
32 bit VAs).


To generate a diff of this commit:
cvs rdiff -u -r1.167.38.19 -r1.167.38.20 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.93.38.10 -r1.93.38.11 src/sys/arch/mips/mips/locore_mips3.S

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/mips/mips/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.167.38.19 src/sys/arch/mips/mips/locore.S:1.167.38.20
--- src/sys/arch/mips/mips/locore.S:1.167.38.19	Mon Aug 16 17:58:43 2010
+++ src/sys/arch/mips/mips/locore.S	Wed Aug 18 06:35:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.167.38.19 2010/08/16 17:58:43 matt Exp $	*/
+/*	$NetBSD: locore.S,v 1.167.38.20 2010/08/18 06:35:01 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -102,7 +102,7 @@
 
 #ifdef NOFPU /* No FPU; avoid touching FPU registers */
 #ifdef _LP64
-	li	t0, MIPS_SR_KX			# turn on XKSEG and XKPHYS
+	li	t0, MIPS_SR_KX | MIPS_SR_UX	# turn on XKSEG and XKPHYS
 #else
 	li	t0, 0# Disable interrupts and
 #endif

Index: src/sys/arch/mips/mips/locore_mips3.S
diff -u src/sys/arch/mips/mips/locore_mips3.S:1.93.38.10 src/sys/arch/mips/mips/locore_mips3.S:1.93.38.11
--- src/sys/arch/mips/mips/locore_mips3.S:1.93.38.10	Mon Aug 16 17:57:10 2010
+++ src/sys/arch/mips/mips/locore_mips3.S	Wed Aug 18 06:35:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips3.S,v 1.93.38.10 2010/08/16 17:57:10 matt Exp $	*/
+/*	$NetBSD: locore_mips3.S,v 1.93.38.11 2010/08/18 06:35:01 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -614,7 +614,7 @@
 	PTR_S	MIPS_CURLWP, CPU_INFO_CURLWP(a0)
 
 #ifdef _LP64
-	li	v0, MIPS_SR_KX			# allow 64bit addressing
+	li	v0, MIPS_SR_KX | MIPS_SR_UX	# allow 64bit addressing
 #else
 	li	v0, 0
 #endif



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2010-08-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 18 07:12:57 UTC 2010

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c

Log Message:
Make sure UX is set if KX is set.  Use (intptr_t), not (int).


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.47 -r1.205.4.1.2.1.2.48 \
src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.47 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.48
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.47	Wed Jun  9 14:20:00 2010
+++ src/sys/arch/mips/mips/mips_machdep.c	Wed Aug 18 07:12:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.47 2010/06/09 14:20:00 matt Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.48 2010/08/18 07:12:57 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.47 2010/06/09 14:20:00 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.48 2010/08/18 07:12:57 matt Exp $);
 
 #define	__INTR_PRIVATE
 
@@ -1232,9 +1232,9 @@
 	struct proc * const p = l-l_proc;
 
 	memset(tf, 0, sizeof(struct trapframe));
-	tf-tf_regs[_R_SP] = (int)stack;
-	tf-tf_regs[_R_PC] = (int)pack-ep_entry  ~3;
-	tf-tf_regs[_R_T9] = (int)pack-ep_entry  ~3; /* abicall requirement */
+	tf-tf_regs[_R_SP] = (intptr_t)stack;
+	tf-tf_regs[_R_PC] = (intptr_t)pack-ep_entry  ~3;
+	tf-tf_regs[_R_T9] = (intptr_t)pack-ep_entry  ~3; /* abicall requirement */
 	tf-tf_regs[_R_SR] = PSL_USERSET;
 #if !defined(__mips_o32)
 	/*
@@ -1674,10 +1674,10 @@
 	}
 	lwp0.l_md.md_utf = (struct trapframe *)(v + USPACE) - 1;
 #ifdef _LP64
-	lwp0.l_md.md_utf-tf_regs[_R_SR] = MIPS_SR_KX;
+	lwp0.l_md.md_utf-tf_regs[_R_SR] = MIPS_SR_KX | MIPS_SR_UX;
 	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
 	(ipl_sr_map.sr_bits[IPL_SCHED] ^ MIPS_INT_MASK)
-	| MIPS_SR_KX | MIPS_SR_INT_IE;
+	| MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_INT_IE;
 #else
 	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] = MIPS_SR_INT_IE;
 #endif



CVS commit: src/usr.sbin/pwd_mkdb

2010-08-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 18 08:06:40 UTC 2010

Modified Files:
src/usr.sbin/pwd_mkdb: pwd_mkdb.8 pwd_mkdb.c

Log Message:
add syslog logging.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/pwd_mkdb/pwd_mkdb.8
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/pwd_mkdb/pwd_mkdb.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/pwd_mkdb/pwd_mkdb.8
diff -u src/usr.sbin/pwd_mkdb/pwd_mkdb.8:1.26 src/usr.sbin/pwd_mkdb/pwd_mkdb.8:1.27
--- src/usr.sbin/pwd_mkdb/pwd_mkdb.8:1.26	Fri Jun 19 01:50:39 2009
+++ src/usr.sbin/pwd_mkdb/pwd_mkdb.8	Wed Aug 18 04:06:39 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: pwd_mkdb.8,v 1.26 2009/06/19 05:50:39 wiz Exp $
+.\	$NetBSD: pwd_mkdb.8,v 1.27 2010/08/18 08:06:39 christos Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	from: @(#)pwd_mkdb.8	8.2 (Berkeley) 4/27/95
 .\
-.Dd June 18, 2009
+.Dd August 18, 2010
 .Dt PWD_MKDB 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd generate the password databases
 .Sh SYNOPSIS
 .Nm
-.Op Fl BLpsvw
+.Op Fl BLlpsvw
 .Op Fl c Ar cachesize
 .Op Fl d Ar directory
 .Op Fl u Ar username
@@ -84,6 +84,10 @@
 .It Fl L
 Store data in little-endian format (see also
 .Fl B ) .
+.It Fl l
+Use
+.Xr syslog 3
+to report errors.
 .It Fl p
 Create a Version 7 style password file and install it into
 .Dq Pa /etc/passwd .
@@ -159,6 +163,7 @@
 .Xr db 3 ,
 .Xr getpwent 3 ,
 .Xr pw_mkdb 3 ,
+.Xr syslog 3 ,
 .Xr passwd 5 ,
 .Xr useradd 8 ,
 .Xr userdel 8 ,

Index: src/usr.sbin/pwd_mkdb/pwd_mkdb.c
diff -u src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.51 src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.52
--- src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.51	Sun Jan 10 14:04:35 2010
+++ src/usr.sbin/pwd_mkdb/pwd_mkdb.c	Wed Aug 18 04:06:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwd_mkdb.c,v 1.51 2010/01/10 19:04:35 snj Exp $	*/
+/*	$NetBSD: pwd_mkdb.c,v 1.52 2010/08/18 08:06:39 christos Exp $	*/
 
 /*
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  The NetBSD Foundation, Inc.  All rights reserved.\
   Copyright (c) 1991, 1993, 1994\
  The Regents of the University of California.  All rights reserved.);
-__RCSID($NetBSD: pwd_mkdb.c,v 1.51 2010/01/10 19:04:35 snj Exp $);
+__RCSID($NetBSD: pwd_mkdb.c,v 1.52 2010/08/18 08:06:39 christos Exp $);
 #endif /* not lint */
 
 #if HAVE_NBTOOL_CONFIG_H
@@ -111,10 +111,12 @@
 #include err.h
 #include errno.h
 #include fcntl.h
+#include syslog.h
 #include limits.h
 #include signal.h
 #include stdio.h
 #include stdlib.h
+#include stdarg.h
 #include string.h
 #include unistd.h
 #include util.h
@@ -158,6 +160,7 @@
 static char	prefix[MAXPATHLEN];
 static char	oldpwdfile[MAX(MAXPATHLEN, LINE_MAX * 2)];
 static int 	lorder = BYTE_ORDER;
+static int	logsyslog;
 static int	clean;
 static int	verbose;
 static int	warning;
@@ -167,7 +170,8 @@
 void	bailout(void) __attribute__((__noreturn__));
 void	cp(const char *, const char *, mode_t);
 void	deldbent(struct pwddb *, int, void *);
-void	error(const char *);
+void	mkpw_error(const char *, ...);
+void	mkpw_warning(const char *, ...);
 int	getdbent(struct pwddb *, int, void *, struct passwd **);
 void	inconsistency(void);
 void	install(const char *, const char *);
@@ -214,7 +218,7 @@
 
 	db-db = dbopen(db-dbname, flags, perm, DB_HASH, openinfo);
 	if (db-db == NULL)
-		error(db-dbname);
+		mkpw_error(Cannot open `%s', db-dbname);
 
 	db-fname = dbname;
 	db-rversion = getversion(dbname);
@@ -224,28 +228,25 @@
 		db-wversion = req_version;
 
 	if (warning  db-rversion == 0  db-wversion == 0) {
-		warnx(Database %s is a version %u database.,
+		mkpw_warning(Database %s is a version %u database.,
 		db-fname, db-rversion);
-		warnx(Use %s -V 1 to upgrade once you've recompiled 
+		mkpw_warning(Use %s -V 1 to upgrade once you've recompiled 
 		all your binaries., getprogname());
 	}
 	if (db-wversion != db-rversion) {
 		if (username != NULL) {
-			(void)fprintf(stderr, %s: you cannot change a single 
+			mkpw_warning(You cannot change a single 
 			record from version %u to version %u\n,
-			getprogname(), db-rversion, db-wversion);
+			db-rversion, db-wversion);
 			bailout();
 		} else if (verbose) {
-		(void)fprintf(stderr, %s: changing %s from version 
-			%u to version %u\n,
-			getprogname(), db-fname,
-			db-rversion, db-wversion);
+		mkpw_warning(Changing %s from version %u to version %u,
+			db-fname, db-rversion, db-wversion);
 		}
 	} else {
 		if (verbose)
-			(void)fprintf(stderr, %s: %s version %u 
-			requested %u\n, getprogname(), db-fname,
-			db-rversion, db-wversion);
+			mkpw_warning(File `%s' version %u requested %u,
+			db-fname, db-rversion, db-wversion);
 	}
 
 	setversion(db);
@@ -276,9 +277,10 @@
 	cachesize = 0;
 	verbose = 0;
 	warning = 0;
+	logsyslog = 0;
 	req_version = ~0U;
 
-	while ((ch = getopt(argc, 

CVS commit: src/lib/libutil

2010-08-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 18 08:09:17 UTC 2010

Modified Files:
src/lib/libutil: passwd.c

Log Message:
Log via syslog(3) when we run pwd_mkdb(8).


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libutil/passwd.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/libutil/passwd.c
diff -u src/lib/libutil/passwd.c:1.48 src/lib/libutil/passwd.c:1.49
--- src/lib/libutil/passwd.c:1.48	Sun Jan 18 07:13:04 2009
+++ src/lib/libutil/passwd.c	Wed Aug 18 04:09:17 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: passwd.c,v 1.48 2009/01/18 12:13:04 lukem Exp $	*/
+/*	$NetBSD: passwd.c,v 1.49 2010/08/18 08:09:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: passwd.c,v 1.48 2009/01/18 12:13:04 lukem Exp $);
+__RCSID($NetBSD: passwd.c,v 1.49 2010/08/18 08:09:17 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/types.h
@@ -150,7 +150,7 @@
 		args[0] = pwd_mkdb;
 		args[1] = -d;
 		args[2] = pw_prefix;
-		args[3] = -p;
+		args[3] = -pl;
 		i = 4;
 
 		if (secureonly)



CVS commit: src/lib/libutil

2010-08-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 18 08:32:02 UTC 2010

Modified Files:
src/lib/libutil: passwd.c

Log Message:
Log why pwd_mkdb failed. Currently on aslr systems, pwd_mkdb either aborts
or when s/vfork/fork/ dies with SEGV accessing the the stack. The same abort
effect can be achieved when we remove all resource limits.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libutil/passwd.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/libutil/passwd.c
diff -u src/lib/libutil/passwd.c:1.49 src/lib/libutil/passwd.c:1.50
--- src/lib/libutil/passwd.c:1.49	Wed Aug 18 04:09:17 2010
+++ src/lib/libutil/passwd.c	Wed Aug 18 04:32:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: passwd.c,v 1.49 2010/08/18 08:09:17 christos Exp $	*/
+/*	$NetBSD: passwd.c,v 1.50 2010/08/18 08:32:02 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: passwd.c,v 1.49 2010/08/18 08:09:17 christos Exp $);
+__RCSID($NetBSD: passwd.c,v 1.50 2010/08/18 08:32:02 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/types.h
@@ -144,7 +144,7 @@
 
 	pid = vfork();
 	if (pid == -1)
-		return (-1);
+		return -1;
 
 	if (pid == 0) {
 		args[0] = pwd_mkdb;
@@ -166,9 +166,21 @@
 		_exit(1);
 	}
 	pid = waitpid(pid, pstat, 0);
-	if (pid == -1 || !WIFEXITED(pstat) || WEXITSTATUS(pstat) != 0)
-		return(-1);
-	return(0);
+	if (pid == -1) {
+		warn(error waiting for pid %lu, (unsigned long)pid);
+		return -1;
+	}
+	if (WIFEXITED(pstat)) {
+		if (WEXITSTATUS(pstat) != 0) {
+			warnx(pwd_mkdb exited with static %d,
+			WEXITSTATUS(pstat));
+			return -1;
+		}
+	} else if (WIFSIGNALED(pstat)) {
+		warnx(pwd_mkdb exited with signal %d, WTERMSIG(pstat));
+		return -1;
+	}
+	return 0;
 }
 
 int



CVS commit: src/usr.sbin/pwd_mkdb

2010-08-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Aug 18 10:00:49 UTC 2010

Modified Files:
src/usr.sbin/pwd_mkdb: pwd_mkdb.8

Log Message:
Sort sections.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/pwd_mkdb/pwd_mkdb.8

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/pwd_mkdb/pwd_mkdb.8
diff -u src/usr.sbin/pwd_mkdb/pwd_mkdb.8:1.27 src/usr.sbin/pwd_mkdb/pwd_mkdb.8:1.28
--- src/usr.sbin/pwd_mkdb/pwd_mkdb.8:1.27	Wed Aug 18 08:06:39 2010
+++ src/usr.sbin/pwd_mkdb/pwd_mkdb.8	Wed Aug 18 10:00:49 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: pwd_mkdb.8,v 1.27 2010/08/18 08:06:39 christos Exp $
+.\	$NetBSD: pwd_mkdb.8,v 1.28 2010/08/18 10:00:49 wiz Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -138,9 +138,6 @@
 .Pp
 The databases are used by the C library password routines (see
 .Xr getpwent 3 ) .
-.Sh EXIT STATUS
-.Nm
-exits zero on success, non-zero on failure.
 .Sh FILES
 .Bl -tag -width Pa -compact
 .It Pa /etc/master.passwd
@@ -156,6 +153,18 @@
 .It Pa /etc/spwd.db.tmp
 A temporary file.
 .El
+.Sh EXIT STATUS
+.Nm
+exits zero on success, non-zero on failure.
+.Sh COMPATIBILITY
+Previous versions of the system had a program similar to
+.Nm
+which built
+.Em dbm
+style databases for the password file but depended on the calling programs
+to install them.
+The program was renamed in order that previous users of the program
+not be surprised by the changes in functionality.
 .Sh SEE ALSO
 .Xr chpass 1 ,
 .Xr passwd 1 ,
@@ -169,15 +178,6 @@
 .Xr userdel 8 ,
 .Xr usermod 8 ,
 .Xr vipw 8
-.Sh COMPATIBILITY
-Previous versions of the system had a program similar to
-.Nm
-which built
-.Em dbm
-style databases for the password file but depended on the calling programs
-to install them.
-The program was renamed in order that previous users of the program
-not be surprised by the changes in functionality.
 .Sh BUGS
 Because of the necessity for atomic update of the password files,
 .Nm



CVS commit: src/distrib/sets/lists/comp

2010-08-18 Thread Jonathan Perkin
Module Name:src
Committed By:   sketch
Date:   Wed Aug 18 14:26:17 UTC 2010

Modified Files:
src/distrib/sets/lists/comp: shl.mi

Log Message:
Fix setlist for libmj with MKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/distrib/sets/lists/comp/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.129 src/distrib/sets/lists/comp/shl.mi:1.130
--- src/distrib/sets/lists/comp/shl.mi:1.129	Sun Aug  8 00:23:26 2010
+++ src/distrib/sets/lists/comp/shl.mi	Wed Aug 18 14:26:16 2010
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.129 2010/08/08 00:23:26 joerg Exp $
+# $NetBSD: shl.mi,v 1.130 2010/08/18 14:26:16 sketch Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -250,6 +250,7 @@
 ./usr/libdata/debug/usr/lib/libm.so.0.8.debug		comp-sys-debug	debug
 ./usr/libdata/debug/usr/lib/libmagic.so.3.0.debug	comp-sys-debug	debug
 ./usr/libdata/debug/usr/lib/libmenu.so.6.0.debug	comp-sys-debug	debug
+./usr/libdata/debug/usr/lib/libmj.so.0.0.debug		comp-crypto-debug	debug
 ./usr/libdata/debug/usr/lib/libnetpgp.so.3.0.debug	comp-crypto-debug	crypto,debug
 ./usr/libdata/debug/usr/lib/libnvpair.so.0.0.debug	comp-zfs-debug	zfs,dynamicroot,debug
 ./usr/libdata/debug/usr/lib/libobjc.so.2.0.debug	comp-sys-debug	gcc=3,debug



CVS commit: src/sys/arch/x86/acpi

2010-08-18 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Aug 18 16:08:50 UTC 2010

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c

Log Message:
Check the status of P- and T-state transformations on all CPUs. This is
still not ideal, as ACPI gives us information about cross logical processor
dependencies. For instance, a single MSR call on one CPU may cause all other
CPUs in the same domain to follow the state shift. Thus, rather than using
xc_broadcast(9), we should xc_unicast(9) on per-domain or per-CPU-set basis.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/acpi/acpi_cpu_md.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/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.13 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.14
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.13	Wed Aug 18 04:12:29 2010
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Wed Aug 18 16:08:50 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.13 2010/08/18 04:12:29 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.14 2010/08/18 16:08:50 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.13 2010/08/18 04:12:29 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.14 2010/08/18 16:08:50 jruoho Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -56,6 +56,8 @@
 static int	 acpicpu_md_pstate_sysctl_get(SYSCTLFN_PROTO);
 static int	 acpicpu_md_pstate_sysctl_set(SYSCTLFN_PROTO);
 static int	 acpicpu_md_pstate_sysctl_all(SYSCTLFN_PROTO);
+static void	 acpicpu_md_pstate_status(void *, void *);
+static void	 acpicpu_md_tstate_status(void *, void *);
 
 extern uint32_t cpus_running;
 extern struct acpicpu_softc **acpicpu_sc;
@@ -513,8 +515,8 @@
 acpicpu_md_pstate_set(struct acpicpu_pstate *ps)
 {
 	struct msr_rw_info msr;
-	uint64_t xc, val;
-	int i;
+	uint64_t xc;
+	int rv = 0;
 
 	switch (cpu_vendor) {
 
@@ -552,6 +554,19 @@
 	if (ps-ps_status_addr == 0)
 		return 0;
 
+	xc = xc_broadcast(0, (xcfunc_t)acpicpu_md_pstate_status, ps, rv);
+	xc_wait(xc);
+
+	return rv;
+}
+
+static void
+acpicpu_md_pstate_status(void *arg1, void *arg2)
+{
+	struct acpicpu_pstate *ps = arg1;
+	uint64_t val;
+	int i;
+
 	for (i = val = 0; i  ACPICPU_P_STATE_RETRY; i++) {
 
 		val = rdmsr(ps-ps_status_addr);
@@ -560,32 +575,25 @@
 			val = val  ps-ps_status_mask;
 
 		if (val == ps-ps_status)
-			return 0;
+			return;
 
 		DELAY(ps-ps_latency);
 	}
 
-	return EAGAIN;
+	*(uintptr_t *)arg2 = EAGAIN;
 }
 
 int
 acpicpu_md_tstate_get(struct acpicpu_softc *sc, uint32_t *percent)
 {
 	struct acpicpu_tstate *ts;
-	uint64_t val, sta;
+	uint64_t val;
 	uint32_t i;
 
-	switch (cpu_vendor) {
-
-	case CPUVENDOR_INTEL:
-		sta = MSR_THERM_CONTROL;
-		break;
-
-	default:
+	if (cpu_vendor != CPUVENDOR_INTEL)
 		return ENODEV;
-	}
 
-	val = rdmsr(sta);
+	val = rdmsr(MSR_THERM_CONTROL);
 
 	for (i = 0; i  sc-sc_tstate_count; i++) {
 
@@ -607,23 +615,16 @@
 acpicpu_md_tstate_set(struct acpicpu_tstate *ts)
 {
 	struct msr_rw_info msr;
-	uint64_t xc, val, sta;
-	uint32_t i;
-
-	switch (cpu_vendor) {
-
-	case CPUVENDOR_INTEL:
-		msr.msr_read  = true;
-		msr.msr_type  = MSR_THERM_CONTROL;
-		msr.msr_value = ts-ts_control;
-		msr.msr_mask = __BITS(1, 4);
-
-		sta = MSR_THERM_CONTROL;
-		break;
+	uint64_t xc;
+	int rv = 0;
 
-	default:
+	if (cpu_vendor != CPUVENDOR_INTEL)
 		return ENODEV;
-	}
+
+	msr.msr_read  = true;
+	msr.msr_type  = MSR_THERM_CONTROL;
+	msr.msr_value = ts-ts_control;
+	msr.msr_mask = __BITS(1, 4);
 
 	xc = xc_broadcast(0, (xcfunc_t)x86_msr_xcall, msr, NULL);
 	xc_wait(xc);
@@ -631,15 +632,28 @@
 	if (ts-ts_status == 0)
 		return 0;
 
+	xc = xc_broadcast(0, (xcfunc_t)acpicpu_md_tstate_status, ts, rv);
+	xc_wait(xc);
+
+	return rv;
+}
+
+static void
+acpicpu_md_tstate_status(void *arg1, void *arg2)
+{
+	struct acpicpu_tstate *ts = arg1;
+	uint64_t val;
+	int i;
+
 	for (i = val = 0; i  ACPICPU_T_STATE_RETRY; i++) {
 
-		val = rdmsr(sta);
+		val = rdmsr(MSR_THERM_CONTROL);
 
 		if (val == ts-ts_status)
-			return 0;
+			return;
 
 		DELAY(ts-ts_latency);
 	}
 
-	return EAGAIN;
+	*(uintptr_t *)arg2 = EAGAIN;
 }



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 16:39:22 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a two-way floodping test and a test which sends icmp echos with
various sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_ping.c

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

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.2 src/tests/net/icmp/t_ping.c:1.3
--- src/tests/net/icmp/t_ping.c:1.2	Tue Aug 17 15:51:11 2010
+++ src/tests/net/icmp/t_ping.c	Wed Aug 18 16:39:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.2 2010/08/17 15:51:11 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.3 2010/08/18 16:39:22 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.2 2010/08/17 15:51:11 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.3 2010/08/18 16:39:22 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -101,20 +101,92 @@
 	atf_tc_set_md_var(tc, use.fs, true);
 }
 
-#define PERLOOP 100
-#define LOOPS 100
-ATF_TC_BODY(floodping, tc)
+/* why the hell isn't this available in userspace??? */
+static uint16_t
+in_cksum(void *data, size_t len)
 {
-	char buf[8192];
-	char ifname[IFNAMSIZ];
-	pid_t cpid;
-	int loop, i, succ;
+	uint16_t *buf = data;
+	unsigned sum;
+
+	for (sum = 0; len  1; len -= 2)
+		sum += *buf++;
+	if (len)
+		sum += *(uint8_t *)buf;
+
+	sum = (sum  16) + (sum  0x);
+	sum += (sum  16);
+
+	return ~sum;
+}
+
+static int
+doping(const char *target, int loops, size_t pktsize)
+{
+	char sndbuf[IP_MAXPACKET - sizeof(struct ip)];
+	char recvbuf[IP_MAXPACKET];
 	struct sockaddr_in dst, pingee;
-	struct icmp icmp;
+	struct icmp *icmp;
 	socklen_t slen;
 	ssize_t n;
+	int loop, i, succ;
 	int x, xnon, s;
 
+	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP));
+	RL(x = rump_sys_fcntl(s, F_GETFL, 0));
+	xnon = x | O_NONBLOCK;
+
+	memset(dst, 0, sizeof(dst));
+	dst.sin_len = sizeof(dst);
+	dst.sin_family = AF_INET;
+	dst.sin_addr.s_addr = inet_addr(target);
+
+	icmp = (struct icmp *)sndbuf;
+	memset(icmp, 0, sizeof(*icmp));
+	icmp-icmp_type = ICMP_ECHO;
+	icmp-icmp_id = htons(37);
+
+	if (pktsize  sizeof(*icmp))
+		pktsize = sizeof(*icmp);
+	if (pktsize  sizeof(sndbuf))
+		pktsize = sizeof(sndbuf);
+
+	RL(rump_sys_setsockopt(s, SOL_SOCKET, SO_SNDBUF,
+	pktsize, sizeof(pktsize)));
+	RL(rump_sys_setsockopt(s, SOL_SOCKET, SO_RCVBUF,
+	pktsize, sizeof(pktsize)));
+
+	slen = sizeof(pingee);
+	succ = 0;
+	for (loop = 0; loop  loops; loop++) {
+		RL(rump_sys_fcntl(s, F_SETFL, x));
+		icmp-icmp_seq = htons(loop);
+		icmp-icmp_cksum = 0;
+		icmp-icmp_cksum = in_cksum(icmp, pktsize);
+		RL(rump_sys_sendto(s, icmp, pktsize, 0,
+		(struct sockaddr *)dst, sizeof(dst)));
+
+		RL(rump_sys_fcntl(s, F_SETFL, xnon));
+		while ((n = rump_sys_recvfrom(s, recvbuf, sizeof(recvbuf), 0,
+		(struct sockaddr *)pingee, slen))  0) {
+			succ++;
+		}
+		if (n == -1  errno == EAGAIN)
+			continue;
+		atf_tc_fail_errno(recv failed);
+	}
+
+	rump_sys_close(s);
+	return succ;
+}
+
+#define LOOPS 1
+
+ATF_TC_BODY(floodping, tc)
+{
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	int succ;
+
 	cpid = fork();
 	rump_init();
 	netcfg_rump_makeshmif(thank-you-driver-for-getting-me-here, ifname);
@@ -132,40 +204,92 @@
 
 	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
 
-	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP));
-	RL(x = rump_sys_fcntl(s, F_GETFL, 0));
-	xnon = x | O_NONBLOCK;
+	succ = doping(1.1.1.10, LOOPS, 56);
+	printf(got %d/%d\n, succ, LOOPS);
 
-	memset(dst, 0, sizeof(dst));
-	dst.sin_len = sizeof(dst);
-	dst.sin_family = AF_INET;
-	dst.sin_addr.s_addr = inet_addr(1.1.1.10);
+	kill(cpid, SIGKILL);
+}
 
-	memset(icmp, 0, sizeof(icmp));
-	icmp.icmp_type = ICMP_ECHO;
-	icmp.icmp_id = htons(37);
-	icmp.icmp_cksum = htons(0xf7da);
+ATF_TC(floodping2);
+ATF_TC_HEAD(floodping2, tc)
+{
 
-	slen = sizeof(pingee);
-	succ = 0;
-	for (loop = 0; loop  LOOPS; loop++) {
-		RL(rump_sys_fcntl(s, F_SETFL, x));
-		for (i = 0; i  PERLOOP; i++) {
-			RL(rump_sys_sendto(s, icmp, sizeof(icmp), 0,
-			(struct sockaddr *)dst, sizeof(dst)));
-		}
-		RL(rump_sys_fcntl(s, F_SETFL, xnon));
-		while ((n = rump_sys_recvfrom(s, buf, sizeof(buf), 0,
-		(struct sockaddr *)pingee, slen))  0) {
-			succ++;
-		}
-		if (n == -1  errno == EAGAIN)
-			continue;
-		atf_tc_fail_errno(recv failed);
+	atf_tc_set_md_var(tc, descr, two hosts floodpinging each other);
+	atf_tc_set_md_var(tc, use.fs, true);
+}
+
+ATF_TC_BODY(floodping2, tc)
+{
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	int succ;
+
+	cpid = fork();
+	rump_init();
+	netcfg_rump_makeshmif(floodping2, ifname);
+
+	switch (cpid) {
+	case -1:
+		atf_tc_fail_errno(fork failed);
+	case 0:
+		netcfg_rump_if(ifname, 1.1.1.10, 255.255.255.0);
+		succ = doping(1.1.1.20, LOOPS, 

CVS commit: src/sys/dev/wscons

2010-08-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 18 16:46:51 UTC 2010

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
Add copycols() and copyrows() methods which, instead of calling the underlying
driver methods, call the driver's putchar() method to redraw the affected
areas.
For unaccelerated framebuffers where reads are expensive and we can't spare
any memory for a shadow framebuffer. Enabled by setting VCONS_DONT_READ in
scr_flags


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/wscons/wsdisplay_vconsvar.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.16 src/sys/dev/wscons/wsdisplay_vcons.c:1.17
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.16	Mon Apr 28 20:24:01 2008
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Wed Aug 18 16:46:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.16 2008/04/28 20:24:01 martin Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.17 2010/08/18 16:46:51 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.16 2008/04/28 20:24:01 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.17 2010/08/18 16:46:51 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -89,6 +89,13 @@
 static void vcons_putchar(void *, int, int, u_int, long);
 static void vcons_cursor(void *, int, int, int);
 
+/*
+ * methods that avoid framebuffer reads
+ */
+static void vcons_copycols_noread(void *, int, int, int, int);
+static void vcons_copyrows_noread(void *, int, int, int);
+
+
 /* support for reading/writing text buffers. For wsmoused */
 static int  vcons_putwschar(struct vcons_screen *, struct wsdisplay_char *);
 static int  vcons_getwschar(struct vcons_screen *, struct wsdisplay_char *);
@@ -223,11 +230,18 @@
 	vd-cursor= ri-ri_ops.cursor;
 
 	ri-ri_ops.eraserows = vcons_eraserows;	
-	ri-ri_ops.copyrows  = vcons_copyrows;	
 	ri-ri_ops.erasecols = vcons_erasecols;	
-	ri-ri_ops.copycols  = vcons_copycols;	
 	ri-ri_ops.putchar   = vcons_putchar;
 	ri-ri_ops.cursor= vcons_cursor;
+
+	if (scr-scr_flags  VCONS_DONT_READ) {
+		ri-ri_ops.copyrows  = vcons_copyrows_noread;
+		ri-ri_ops.copycols  = vcons_copycols_noread;
+	} else {
+		ri-ri_ops.copyrows  = vcons_copyrows;
+		ri-ri_ops.copycols  = vcons_copycols;
+	}
+
 	ri-ri_hw = scr;
 
 	/* 
@@ -558,6 +572,33 @@
 }
 
 static void
+vcons_copycols_noread(void *cookie, int row, int srccol, int dstcol, int ncols)
+{
+	struct rasops_info *ri = cookie;
+	struct vcons_screen *scr = ri-ri_hw;
+
+	vcons_copycols_buffer(cookie, row, srccol, dstcol, ncols);
+
+	vcons_lock(scr);
+	if (SCREEN_IS_VISIBLE(scr)  SCREEN_CAN_DRAW(scr)) {
+		int pos, c, offset;
+
+#ifdef WSDISPLAY_SCROLLSUPPORT
+		offset = scr-scr_current_offset;
+#else
+		offset = 0;
+#endif
+		pos = ri-ri_cols * row + dstcol + offset;
+		for (c = dstcol; c  (dstcol + ncols); c++) {
+			scr-scr_vd-putchar(cookie, row, c, 
+			   scr-scr_chars[pos], scr-scr_attrs[pos]);
+			pos++;
+		}
+	}
+	vcons_unlock(scr);
+}
+
+static void
 vcons_erasecols_buffer(void *cookie, int row, int startcol, int ncols, long fillattr)
 {
 	struct rasops_info *ri = cookie;
@@ -649,6 +690,35 @@
 }
 
 static void
+vcons_copyrows_noread(void *cookie, int srcrow, int dstrow, int nrows)
+{
+	struct rasops_info *ri = cookie;
+	struct vcons_screen *scr = ri-ri_hw;
+
+	vcons_copyrows_buffer(cookie, srcrow, dstrow, nrows);
+
+	vcons_lock(scr);
+	if (SCREEN_IS_VISIBLE(scr)  SCREEN_CAN_DRAW(scr)) {
+		int pos, l, c, offset;
+
+#ifdef WSDISPLAY_SCROLLSUPPORT
+		offset = scr-scr_current_offset;
+#else
+		offset = 0;
+#endif
+		pos = ri-ri_cols * dstrow + offset;
+		for (l = dstrow; l  (dstrow + nrows); l++) {
+			for (c = 0; c  ri-ri_cols; c++) {
+scr-scr_vd-putchar(cookie, l, c, 
+   scr-scr_chars[pos], scr-scr_attrs[pos]);
+pos++;
+			}
+		}
+	}
+	vcons_unlock(scr);
+}
+
+static void
 vcons_eraserows_buffer(void *cookie, int row, int nrows, long fillattr)
 {
 	struct rasops_info *ri = cookie;

Index: src/sys/dev/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.10 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.11
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.10	Thu Aug 20 02:01:08 2009
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h	Wed Aug 18 16:46:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vconsvar.h,v 1.10 2009/08/20 02:01:08 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vconsvar.h,v 1.11 2010/08/18 16:46:51 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -53,6 +53,7 @@
 	 * - for drivers that use software
 	 * drawing */
 #define VCONS_DONT_DRAW		8	/* don't draw on this screen at all */
+#define 

CVS commit: [matt-nb5-mips64] src/sys/uvm

2010-08-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 18 18:19:11 UTC 2010

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_map.c

Log Message:
Add a hook so that MD code has handle the change in address space limits
when an exec happens.
Add a routine to turn on/off UX when an address space changes due to an exec
(N32 execing a N64 for instance).


To generate a diff of this commit:
cvs rdiff -u -r1.263.4.3.4.1 -r1.263.4.3.4.2 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.263.4.3.4.1 src/sys/uvm/uvm_map.c:1.263.4.3.4.2
--- src/sys/uvm/uvm_map.c:1.263.4.3.4.1	Sun Aug 23 06:38:07 2009
+++ src/sys/uvm/uvm_map.c	Wed Aug 18 18:19:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.1 2009/08/23 06:38:07 matt Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.263.4.3.4.2 2010/08/18 18:19:11 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.263.4.3.4.1 2009/08/23 06:38:07 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.263.4.3.4.2 2010/08/18 18:19:11 matt Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -4139,6 +4139,9 @@
 	/* XXX cgd 960926: the sparc #ifdef should be a MD hook */
 	kill_user_windows(l);   /* before stack addresses go away */
 #endif
+#if defined(__mips__)  defined(_LP64)
+	cpu_vmspace_exec(l, start, end);
+#endif
 
 	/*
 	 * see if more than one process is using this vmspace...



CVS commit: src/sys

2010-08-18 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Aug 18 18:32:21 UTC 2010

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c
src/sys/dev/acpi: acpi_cpu.h acpi_cpu_pstate.c

Log Message:
Use the idea from cegger@ and fill the (X)PSS structure during initialization.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/acpi/acpi_cpu_md.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/acpi_cpu.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/acpi/acpi_cpu_pstate.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/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.14 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.15
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.14	Wed Aug 18 16:08:50 2010
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Wed Aug 18 18:32:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.14 2010/08/18 16:08:50 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.15 2010/08/18 18:32:20 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.14 2010/08/18 16:08:50 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.15 2010/08/18 18:32:20 jruoho Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -452,33 +452,26 @@
 }
 
 int
-acpicpu_md_pstate_get(struct acpicpu_softc *sc, uint32_t *freq)
+acpicpu_md_pstate_pss(struct acpicpu_softc *sc)
 {
-	struct acpicpu_pstate *ps = NULL;
-	uint64_t val;
-	uint32_t i;
-
-	for (i = 0; i  sc-sc_pstate_count; i++) {
-
-		ps = sc-sc_pstate[i];
+	struct acpicpu_pstate *ps, msr;
+	uint32_t i = 0;
 
-		if (ps-ps_freq != 0)
-			break;
-	}
-
-	if (__predict_false(ps == NULL))
-		return EINVAL;
+	(void)memset(msr, 0, sizeof(struct acpicpu_pstate));
 
 	switch (cpu_vendor) {
 
 	case CPUVENDOR_INTEL:
-		ps-ps_status_addr = MSR_PERF_STATUS;
-		ps-ps_status_mask = __BITS(0, 15);
+		msr.ps_control_addr = MSR_PERF_CTL;
+		msr.ps_control_mask = __BITS(0, 15);
+
+		msr.ps_status_addr  = MSR_PERF_STATUS;
+		msr.ps_status_mask  = __BITS(0, 15);
 		break;
 
 	case CPUVENDOR_AMD:
 
-		if ((ps-ps_flags  ACPICPU_FLAG_P_XPSS) == 0)
+		if ((sc-sc_flags  ACPICPU_FLAG_P_XPSS) == 0)
 			return EOPNOTSUPP;
 
 		break;
@@ -487,6 +480,46 @@
 		return ENODEV;
 	}
 
+	while (i  sc-sc_pstate_count) {
+
+		ps = sc-sc_pstate[i];
+
+		if (ps-ps_status_addr == 0)
+			ps-ps_status_addr = msr.ps_status_addr;
+
+		if (ps-ps_status_mask == 0)
+			ps-ps_status_mask = msr.ps_status_mask;
+
+		if (ps-ps_control_addr == 0)
+			ps-ps_control_addr = msr.ps_control_addr;
+
+		if (ps-ps_control_mask == 0)
+			ps-ps_control_mask = msr.ps_control_mask;
+
+		i++;
+	}
+
+	return 0;
+}
+
+int
+acpicpu_md_pstate_get(struct acpicpu_softc *sc, uint32_t *freq)
+{
+	struct acpicpu_pstate *ps = NULL;
+	uint64_t val;
+	uint32_t i;
+
+	for (i = 0; i  sc-sc_pstate_count; i++) {
+
+		ps = sc-sc_pstate[i];
+
+		if (ps-ps_freq != 0)
+			break;
+	}
+
+	if (__predict_false(ps == NULL))
+		return EINVAL;
+
 	if (ps-ps_status_addr == 0)
 		return EINVAL;
 
@@ -518,27 +551,6 @@
 	uint64_t xc;
 	int rv = 0;
 
-	switch (cpu_vendor) {
-
-	case CPUVENDOR_INTEL:
-		ps-ps_control_addr = MSR_PERF_CTL;
-		ps-ps_control_mask = __BITS(0, 15);
-
-		ps-ps_status_addr  = MSR_PERF_STATUS;
-		ps-ps_status_mask  = __BITS(0, 15);
-		break;
-
-	case CPUVENDOR_AMD:
-
-		if ((ps-ps_flags  ACPICPU_FLAG_P_XPSS) == 0)
-			return EOPNOTSUPP;
-
-		break;
-
-	default:
-		return ENODEV;
-	}
-
 	msr.msr_read  = false;
 	msr.msr_type  = ps-ps_control_addr;
 	msr.msr_value = ps-ps_control;

Index: src/sys/dev/acpi/acpi_cpu.h
diff -u src/sys/dev/acpi/acpi_cpu.h:1.18 src/sys/dev/acpi/acpi_cpu.h:1.19
--- src/sys/dev/acpi/acpi_cpu.h:1.18	Tue Aug 17 10:17:52 2010
+++ src/sys/dev/acpi/acpi_cpu.h	Wed Aug 18 18:32:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.h,v 1.18 2010/08/17 10:17:52 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.h,v 1.19 2010/08/18 18:32:20 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -241,6 +241,7 @@
 void		acpicpu_md_idle_enter(int, int);
 int		acpicpu_md_pstate_start(void);
 int		acpicpu_md_pstate_stop(void);
+int		acpicpu_md_pstate_pss(struct acpicpu_softc *);
 int		acpicpu_md_pstate_get(struct acpicpu_softc *, uint32_t *);
 int		acpicpu_md_pstate_set(struct acpicpu_pstate *);
 int		acpicpu_md_tstate_get(struct acpicpu_softc *, uint32_t *);

Index: src/sys/dev/acpi/acpi_cpu_pstate.c
diff -u src/sys/dev/acpi/acpi_cpu_pstate.c:1.29 src/sys/dev/acpi/acpi_cpu_pstate.c:1.30
--- src/sys/dev/acpi/acpi_cpu_pstate.c:1.29	Tue Aug 17 10:57:30 2010
+++ src/sys/dev/acpi/acpi_cpu_pstate.c	Wed Aug 18 18:32:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.29 2010/08/17 10:57:30 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.30 2010/08/18 18:32:20 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 

CVS commit: src/sys/modules/acpicpu

2010-08-18 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Aug 18 19:33:11 UTC 2010

Modified Files:
src/sys/modules/acpicpu: Makefile

Log Message:
Add DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/acpicpu/Makefile

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

Modified files:

Index: src/sys/modules/acpicpu/Makefile
diff -u src/sys/modules/acpicpu/Makefile:1.3 src/sys/modules/acpicpu/Makefile:1.4
--- src/sys/modules/acpicpu/Makefile:1.3	Fri Aug 13 16:21:50 2010
+++ src/sys/modules/acpicpu/Makefile	Wed Aug 18 19:33:10 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2010/08/13 16:21:50 jruoho Exp $
+# $NetBSD: Makefile,v 1.4 2010/08/18 19:33:10 jruoho Exp $
 
 .include ../Makefile.inc
 
@@ -12,6 +12,7 @@
 	acpi_cpu_pstate.c \
 	acpi_cpu_tstate.c
 
-WARNS=	4
+WARNS=	 4
+CFLAGS+= -DDIAGNOSTIC
 
 .include bsd.kmodule.mk



CVS commit: src/sys/dev/sbus

2010-08-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 18 21:11:50 UTC 2010

Modified Files:
src/sys/dev/sbus: cgtwelve.c files.sbus

Log Message:
- add support for running the console in 8 bit colour
- make shadow fb optional
- use VCONS_DONT_READ if there's no shadow fb


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sbus/cgtwelve.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sbus/files.sbus

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/sbus/cgtwelve.c
diff -u src/sys/dev/sbus/cgtwelve.c:1.3 src/sys/dev/sbus/cgtwelve.c:1.4
--- src/sys/dev/sbus/cgtwelve.c:1.3	Wed Apr 14 04:37:11 2010
+++ src/sys/dev/sbus/cgtwelve.c	Wed Aug 18 21:11:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgtwelve.c,v 1.3 2010/04/14 04:37:11 macallan Exp $ */
+/*	$NetBSD: cgtwelve.c,v 1.4 2010/08/18 21:11:50 macallan Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the Sun CG12 / Matrox SG3 graphics board */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.3 2010/04/14 04:37:11 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.4 2010/08/18 21:11:50 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -54,6 +54,7 @@
 #include dev/wscons/wsdisplay_vconsvar.h
 
 #include dev/sbus/cgtwelvereg.h
+#include dev/ic/bt462reg.h
 
 #include opt_wsemul.h
 #include opt_cgtwelve.h
@@ -127,6 +128,8 @@
 	NULL,	/* scroll */
 };
 
+extern const u_char rasops_cmap[768];
+
 static int
 cgtwelve_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -161,9 +164,13 @@
 	/* read geometry information from the device tree */
 	sc-sc_width = prom_getpropint(sa-sa_node, width, 1152);
 	sc-sc_height = prom_getpropint(sa-sa_node, height, 900);
+#ifdef CG12_COLOR
+	sc-sc_stride = sc-sc_width;
+#else
 	sc-sc_stride = (sc-sc_width + 7)  3;
-
+#endif
 	sc-sc_fbsize = sc-sc_height * sc-sc_stride;
+
 	sc-sc_fbaddr = (void *)prom_getpropint(sa-sa_node, address, 0);
 	if (sc-sc_fbaddr == NULL) {
 		if (sbus_bus_map(sa-sa_bustag,
@@ -179,7 +186,6 @@
 		
 	aprint_normal_dev(self, %d x %d\n, sc-sc_width, sc-sc_height);
 
-
 	if (sbus_bus_map(sa-sa_bustag,
 			 sa-sa_slot,
 			 sa-sa_offset + CG12_OFF_REGISTERS,
@@ -211,9 +217,17 @@
 	}
 	sc-sc_int = bus_space_vaddr(sa-sa_bustag, bh);
 
+#ifdef CG12_COLOR
+	cgtwelve_setup(sc, 8);
+#else
 	cgtwelve_setup(sc, 1);
-
+#endif
+#ifdef CG12_SHADOW
 	sc-sc_shadow = kmem_alloc(sc-sc_fbsize, KM_SLEEP);
+#else
+	sc-sc_shadow = NULL;
+#endif
+
 	isconsole = fb_is_console(node);
 
 	sc-sc_mode = WSDISPLAYIO_MODE_EMUL;
@@ -243,70 +257,18 @@
 	aa.accesscookie = sc-vd;
 
 	config_found(self, aa, wsemuldisplaydevprint);
-#if 0	
+#ifdef CG12_DEBUG
 	{
-		bus_space_handle_r bh = sc-sc_regh;
-		int i, j;
-
-		bus_space_write_4(sa-sa_bustag, bh, CG12_EIC_RESET, 0);
-
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_ENABLE);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_ENABLE);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_SL_HOST, CG12_PLN_SL_ENABLE);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_HPAGE, CG12_HPAGE_ENABLE);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_HACCESS, CG12_HACCESS_ENABLE);
-		memset(sc-sc_fbaddr, 0, 0x1);
-
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_RDMSK_LOC, 0x);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_WRMSK_LOC, 0x);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_LACCESS, CG12_HACCESS_24BIT);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_LPAGE, CG12_HPAGE_24BIT);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_SL_LOCAL0, CG12_PLN_SL_24BIT);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_DWG_CTL, DWGCTL_BITBLT | 0x00f3);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_F_XLEFT, 10);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_F_XRIGHT, 1010);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_Y_DST, 10);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_COLOUR0, 0x);
-#if 1
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_LENGTH | 0x1000, 800);
-#endif
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_OVERLAY);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_OVERLAY);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12DPU_PLN_SL_HOST, CG12_PLN_SL_OVERLAY);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_HPAGE, CG12_HPAGE_OVERLAY);
-		bus_space_write_4(sa-sa_bustag, bh,
-		CG12APU_HACCESS, CG12_HACCESS_OVERLAY);
-
-		for (i = 0x100; i  0x300; i += 32) {
-			printf(%04x:, i);
-			for (j = 0; j  32; j += 4) {
-printf( %08x, bus_space_read_4(sa-sa_bustag,
-bh, i + j));
-			}
-			printf(\n);
+		int i;
+		for (i = 0; i  0x10; i++) {
+			bus_space_write_4(sc-sc_tag, sc-sc_regh, 
+			

CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:22:34 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a test for the ping of death.  Declare the test a success
when the receiver increases the ip toolong stat counter.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_ping.c

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

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.4 src/tests/net/icmp/t_ping.c:1.5
--- src/tests/net/icmp/t_ping.c:1.4	Wed Aug 18 17:49:03 2010
+++ src/tests/net/icmp/t_ping.c	Wed Aug 18 21:22:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.4 2010/08/18 17:49:03 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,20 +29,27 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.4 2010/08/18 17:49:03 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
 #include sys/resource.h
+#include sys/sysctl.h
+#include sys/wait.h
 
 #include atf-c.h
+#include assert.h
 #include fcntl.h
 #include stdio.h
 #include stdlib.h
 #include string.h
 #include unistd.h
 
+#include netinet/in.h
+#include netinet/ip_var.h
+
 #include rump/rump.h
+#include rump/rump_syscalls.h
 
 #include ../../h_macros.h
 #include ../config/netconfig.c
@@ -293,6 +300,120 @@
 	kill(cpid, SIGKILL);
 }
 
+ATF_TC(ping_of_death);
+ATF_TC_HEAD(ping_of_death, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, send a \ping of death\);
+	atf_tc_set_md_var(tc, use.fs, true);
+}
+
+ATF_TC_BODY(ping_of_death, tc)
+{
+	char data[1500];
+	struct sockaddr_in dst;
+	struct ip *ip;
+	struct icmp *icmp;
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	size_t tot, frag;
+	int s, x, loop;
+
+	cpid = fork();
+	rump_init();
+	netcfg_rump_makeshmif(jippikaiee, ifname);
+
+	switch (cpid) {
+	case -1:
+		atf_tc_fail_errno(fork failed);
+	case 0:
+		/* wait until we receive a too long IP packet */
+		for (loop = 0;; loop++) {
+			uint64_t ipstat[IP_NSTATS];
+			size_t arglen;
+			int mib[4];
+
+			if (loop == 1)
+netcfg_rump_if(ifname,
+1.1.1.10, 255.255.255.0);
+
+			mib[0] = CTL_NET;
+			mib[1] = PF_INET;
+			mib[2] = IPPROTO_IP;
+			mib[3] = IPCTL_STATS;
+
+			arglen = sizeof(ipstat);
+			RL(rump_sys___sysctl(mib, 4, ipstat, arglen,
+			NULL, 0));
+			if (loop == 0  ipstat[IP_STAT_TOOLONG] != 0)
+_exit(1);
+			if (ipstat[IP_STAT_TOOLONG])
+break;
+			usleep(1);
+		}
+
+		_exit(0);
+		break;
+	default:
+		break;
+	}
+
+	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
+
+	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, 0));
+	x = 1;
+	RL(rump_sys_setsockopt(s, IPPROTO_IP, IP_HDRINCL, x, sizeof(x)));
+
+	memset(dst, 0, sizeof(dst));
+	dst.sin_len = sizeof(dst);
+	dst.sin_family = AF_INET;
+	dst.sin_addr.s_addr = inet_addr(1.1.1.10);
+
+	/* construct packet */
+	memset(data, 0, sizeof(data));
+	ip = (struct ip *)data;
+	ip-ip_v = 4;
+	ip-ip_hl = sizeof(*ip)  2;
+	ip-ip_p = IPPROTO_ICMP;
+	ip-ip_ttl = IPDEFTTL;
+	ip-ip_dst = dst.sin_addr;
+	ip-ip_id = 1234;
+
+	icmp = (struct icmp *)(ip + 1);
+	icmp-icmp_type = ICMP_ECHO;
+	icmp-icmp_cksum = in_cksum(icmp, sizeof(*icmp));
+
+	for (;;) {
+		int status;
+
+		/* resolve arp before sending raw stuff */
+		netcfg_rump_pingtest(1.1.1.10, 1);
+
+		for (tot = 0;
+		tot  65538 - sizeof(*ip);
+		tot += (frag - sizeof(*ip))) {
+			frag = MIN(65538 - tot, sizeof(data));
+			ip-ip_off = tot  3;
+			assert(ip-ip_off  3 == tot);
+			ip-ip_len = frag;
+
+			if (frag == sizeof(data)) {
+ip-ip_off |= IP_MF;
+			}
+
+			RL(rump_sys_sendto(s, data, frag, 0,
+			(struct sockaddr *)dst, sizeof(dst)));
+		}
+		if (waitpid(-1, status, WNOHANG)  0) {
+			if (WIFEXITED(status)  WEXITSTATUS(status) == 0)
+break;
+			atf_tc_fail(child did not exit clean);
+		}
+			
+		usleep(1);
+	}
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -300,6 +421,7 @@
 	ATF_TP_ADD_TC(tp, floodping);
 	ATF_TP_ADD_TC(tp, floodping2);
 	ATF_TP_ADD_TC(tp, pingsize);
+	ATF_TP_ADD_TC(tp, ping_of_death);
 
 	return atf_no_error();
 }



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:23:49 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
.. put a timeout here just in case the receive does not increase
the counter.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/icmp/t_ping.c

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

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.5 src/tests/net/icmp/t_ping.c:1.6
--- src/tests/net/icmp/t_ping.c:1.5	Wed Aug 18 21:22:34 2010
+++ src/tests/net/icmp/t_ping.c	Wed Aug 18 21:23:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.6 2010/08/18 21:23:48 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.6 2010/08/18 21:23:48 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -306,6 +306,7 @@
 
 	atf_tc_set_md_var(tc, descr, send a \ping of death\);
 	atf_tc_set_md_var(tc, use.fs, true);
+	atf_tc_set_md_var(tc, timeout, 2);
 }
 
 ATF_TC_BODY(ping_of_death, tc)



CVS commit: src/regress

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:28:03 UTC 2010

Modified Files:
src/regress: README

Log Message:
new tests should use atf - new tests must use atf


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/regress/README

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

Modified files:

Index: src/regress/README
diff -u src/regress/README:1.2 src/regress/README:1.3
--- src/regress/README:1.2	Mon Sep 14 17:15:32 2009
+++ src/regress/README	Wed Aug 18 21:28:03 2010
@@ -1,61 +1,6 @@
-$NetBSD: README,v 1.2 2009/09/14 17:15:32 apb Exp $
+	$NetBSD: README,v 1.3 2010/08/18 21:28:03 pooka Exp $
 
-NOTE: New tests should use the ATF framework; see atf(7)
+New tests must use the ATF framework; see atf(7)
 and the src/tests directory.
 
-
-This part of the source tree contains regression tests. There are special
-make targets and rules to follow. Most of these, however, are currently not
-enforced, and most tests available are not conforming.
-
-We hope to fix this someday. If you add new tests, please try to be conforming.
-
-What is a regression test?
-
-  A regression test is run by a makefile in a test directory (see below).
-  Each makefile may run multiple tests.
-
-What is a test directory?
-
-  A directory in this part of the tree is a regression test directory. It
-  contains a Makefile which implements the additional regress target,
-  and runs all it's regression tests during this target.
-
-May the make progress be stopped on failures?
-
-  No, the make regress target should succeed, unless some regression 
-  binaries could not be build, disk is full or other catastrophic failures
-  outside of the tested subsystem happen. A failing regression test should
-  log the failure (see below), but not make the target itself fail.
-
-What are the possible results of a regression test?
-
-  A test may either
-
-  - succeed, in which case it logs PASSED (see below for logging details)
-  - fail, in which case it logs FAILED
-  - not be able to run, in which case it logs SKIPPED and the reason
-for the skip in the comment field (see below)
-
-  Typical reasons for tests to not being run are missing kernel options,
-  or missing privileges (test needs root, make regress is invoked by
-  mere mortal or vice versa). A test may not fail because of such
-  environmental issues, it must detect and properly log the problem.
-
-  If a test directory contains tests that may be skipped, it should have
-  a README file explaining the prerequisites (e.g. needed kernel options)
-
-  In future, we will mark affected makefiles and optimize run/skipped test
-  during repeated runs with differing privileges - but currently there is no
-  make framework in place to handle this.
-
-How and when does a test log results?
-
-  If the make/environment variable ${REGRESS_LOG} is defined, the final
-  results (and only those) should be logged to the file named by that
-  variable. We will, in the future, add make targets for this purpose.
-  The log format is line oriented, one line used per test. Each line
-  consists of the directory where the Makefile lives, followed by the
-  test name and the result (see above: PASSED, FAILED, SKIPPED).
-  Following this an optional comment may be added. For SKIPPED tests the
-  comment is not optional. Fields are separated by spaces.
+All exceptions need prior approval from core.



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

2010-08-18 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Aug 19 01:02:22 UTC 2010

Modified Files:
src/sys/arch/evbppc/obs405 [uebayasi-xip]: obs266_autoconf.c
src/sys/arch/powerpc/conf [uebayasi-xip]: files.ibm4xx
src/sys/arch/powerpc/ibm4xx/dev [uebayasi-xip]: exb.c

Log Message:
Define FlashROM addresses in board specific code.


To generate a diff of this commit:
cvs rdiff -u -r1.4.76.1 -r1.4.76.2 \
src/sys/arch/evbppc/obs405/obs266_autoconf.c
cvs rdiff -u -r1.10.88.3 -r1.10.88.4 src/sys/arch/powerpc/conf/files.ibm4xx
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/powerpc/ibm4xx/dev/exb.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/evbppc/obs405/obs266_autoconf.c
diff -u src/sys/arch/evbppc/obs405/obs266_autoconf.c:1.4.76.1 src/sys/arch/evbppc/obs405/obs266_autoconf.c:1.4.76.2
--- src/sys/arch/evbppc/obs405/obs266_autoconf.c:1.4.76.1	Fri Apr 30 14:39:18 2010
+++ src/sys/arch/evbppc/obs405/obs266_autoconf.c	Thu Aug 19 01:02:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: obs266_autoconf.c,v 1.4.76.1 2010/04/30 14:39:18 uebayasi Exp $	*/
+/*	$NetBSD: obs266_autoconf.c,v 1.4.76.2 2010/08/19 01:02:21 uebayasi Exp $	*/
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,15 +33,19 @@
  * DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: obs266_autoconf.c,v 1.4.76.1 2010/04/30 14:39:18 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: obs266_autoconf.c,v 1.4.76.2 2010/08/19 01:02:21 uebayasi Exp $);
+
+#include flash_exb.h
 
 #include sys/systm.h
 #include sys/device.h
+#include sys/bus.h
 
 #include machine/obs266.h
 
 #include powerpc/ibm4xx/cpu.h
 #include powerpc/ibm4xx/dcr4xx.h
+#include powerpc/ibm4xx/dev/exbvar.h
 
 #include dev/ic/comreg.h
 
@@ -78,3 +82,17 @@
 
 	obs405_device_register(dev, aux, OBS266_COM_FREQ);
 }
+
+#if NFLASH_EXB  0
+const struct exb_conf exb_confs[] = {
+	/* 0xff80-0xff81 */
+	{ flash, 0xff80 + 0x, 0x0001 },
+	/* 0xff81-0xfffc */
+	{ flash, 0xff80 + 0x0001, 0x007b },
+#if 0 /* XXX extent(9) */
+	/* 0xfffc-0x */
+	{ flash, 0xff80 + 0x007c, 0x0004 },
+#endif
+	{ NULL }
+};
+#endif

Index: src/sys/arch/powerpc/conf/files.ibm4xx
diff -u src/sys/arch/powerpc/conf/files.ibm4xx:1.10.88.3 src/sys/arch/powerpc/conf/files.ibm4xx:1.10.88.4
--- src/sys/arch/powerpc/conf/files.ibm4xx:1.10.88.3	Wed Aug 11 13:56:28 2010
+++ src/sys/arch/powerpc/conf/files.ibm4xx	Thu Aug 19 01:02:21 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ibm4xx,v 1.10.88.3 2010/08/11 13:56:28 uebayasi Exp $
+#	$NetBSD: files.ibm4xx,v 1.10.88.4 2010/08/19 01:02:21 uebayasi Exp $
 #
 # IBM 4xx specific configuration info
 
@@ -77,4 +77,4 @@
 
 # FlashROM on external bus
 attach	flash at exb with flash_exb
-file	arch/powerpc/ibm4xx/dev/flash_exb.c	flash_exb
+file	arch/powerpc/ibm4xx/dev/flash_exb.c	flash_exb	needs-flag

Index: src/sys/arch/powerpc/ibm4xx/dev/exb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/exb.c:1.1.2.1 src/sys/arch/powerpc/ibm4xx/dev/exb.c:1.1.2.2
--- src/sys/arch/powerpc/ibm4xx/dev/exb.c:1.1.2.1	Wed Aug 11 13:53:22 2010
+++ src/sys/arch/powerpc/ibm4xx/dev/exb.c	Thu Aug 19 01:02:21 2010
@@ -1,4 +1,4 @@
-/*	$Id: exb.c,v 1.1.2.1 2010/08/11 13:53:22 uebayasi Exp $	*/
+/*	$Id: exb.c,v 1.1.2.2 2010/08/19 01:02:21 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exb.c,v 1.1.2.1 2010/08/11 13:53:22 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: exb.c,v 1.1.2.2 2010/08/19 01:02:21 uebayasi Exp $);
 
 #include locators.h
 
@@ -43,19 +43,11 @@
 #include powerpc/ibm4xx/dcr4xx.h
 #include powerpc/ibm4xx/dev/exbvar.h
 
-/* XXX board specific */
-static const struct exb_conf exb_confs[] = {
-	{ flash, 0xff80 + 0x, 0x0001 },	// 0xff80
-	{ flash, 0xff80 + 0x0001, 0x007b },	// 0xff81
-#if 0 /* XXX extent(9) */
-	{ flash, 0xff80 + 0x007c, 0x0004 },	// 0xfffc
-#endif
-	{ NULL }
-};
-
 struct exb_softc {
 };
 
+extern const struct exb_conf exb_confs[];
+
 static int exb_match(device_t, struct cfdata *, void *);
 static void exb_attach(device_t, struct device *, void *);
 static int exb_print(void *, const char *);



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

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 19 02:07:11 UTC 2010

Modified Files:
src/sys/rump/librump/rumpvfs: vm_vfs.c

Log Message:
Use the same base pagerflags for both ubc_uiomove and ubc_zerorange.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/rump/librump/rumpvfs/vm_vfs.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/rumpvfs/vm_vfs.c
diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.16 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.17
--- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.16	Wed Jun  2 12:07:03 2010
+++ src/sys/rump/librump/rumpvfs/vm_vfs.c	Thu Aug 19 02:07:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_vfs.c,v 1.16 2010/06/02 12:07:03 pooka Exp $	*/
+/*	$NetBSD: vm_vfs.c,v 1.17 2010/08/19 02:07:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm_vfs.c,v 1.16 2010/06/02 12:07:03 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_vfs.c,v 1.17 2010/08/19 02:07:11 pooka Exp $);
 
 #include sys/param.h
 
@@ -89,6 +89,8 @@
  * UBC
  */
 
+#define PAGERFLAGS (PGO_SYNCIO | PGO_NOBLOCKALLOC | PGO_NOTIMESTAMP)
+
 void
 uvm_vnp_zerorange(struct vnode *vp, off_t off, size_t len)
 {
@@ -106,7 +108,7 @@
 		memset(pgs, 0, npages * sizeof(struct vm_page *));
 		mutex_enter(uobj-vmobjlock);
 		rv = uobj-pgops-pgo_get(uobj, off, pgs, npages, 0, 
-		VM_PROT_READ | VM_PROT_WRITE, 0, PGO_SYNCIO);
+		VM_PROT_READ | VM_PROT_WRITE, 0, PAGERFLAGS | PGO_PASTEOF);
 		KASSERT(npages  0);
 
 		for (i = 0; i  npages; i++) {
@@ -147,7 +149,7 @@
 	pgalloc = npages * sizeof(pgs);
 	pgs = kmem_zalloc(pgalloc, KM_SLEEP);
 
-	pagerflags = PGO_SYNCIO | PGO_NOBLOCKALLOC | PGO_NOTIMESTAMP;
+	pagerflags = PAGERFLAGS;
 	if (flags  UBC_WRITE)
 		pagerflags |= PGO_PASTEOF;
 	if (flags  UBC_FAULTBUSY)



CVS commit: src/sys/miscfs/genfs

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 19 02:10:02 UTC 2010

Modified Files:
src/sys/miscfs/genfs: genfs_io.c

Log Message:
print more info in the past eof panic


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/miscfs/genfs/genfs_io.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/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.38 src/sys/miscfs/genfs/genfs_io.c:1.39
--- src/sys/miscfs/genfs/genfs_io.c:1.38	Sun Aug  8 18:17:11 2010
+++ src/sys/miscfs/genfs/genfs_io.c	Thu Aug 19 02:10:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.38 2010/08/08 18:17:11 chs Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.39 2010/08/19 02:10:02 pooka Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfs_io.c,v 1.38 2010/08/08 18:17:11 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfs_io.c,v 1.39 2010/08/19 02:10:02 pooka Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -160,7 +160,8 @@
 #if defined(DIAGNOSTIC)
 		GOP_SIZE(vp, vp-v_writesize, writeeof, GOP_SIZE_MEM);
 		if (newsize  round_page(writeeof)) {
-			panic(%s: past eof, __func__);
+			panic(%s: past eof: % PRId64  vs. % PRId64,
+			__func__, newsize, round_page(writeeof));
 		}
 #endif /* defined(DIAGNOSTIC) */
 	} else {



CVS commit: src/tests/fs/vfs

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 19 02:36:03 UTC 2010

Modified Files:
src/tests/fs/vfs: Makefile
Added Files:
src/tests/fs/vfs: t_io.c

Log Message:
Start adding some I/O tests.  This one does a sparse write to the
second page on a file, then writes the first, and finally checks
it can read something expected.  Adapted the from program supplied
by yamt in PR kern/36429.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_io.c

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

Modified files:

Index: src/tests/fs/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.10 src/tests/fs/vfs/Makefile:1.11
--- src/tests/fs/vfs/Makefile:1.10	Tue Aug 17 11:46:16 2010
+++ src/tests/fs/vfs/Makefile	Thu Aug 19 02:36:02 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2010/08/17 11:46:16 pooka Exp $
+#	$NetBSD: Makefile,v 1.11 2010/08/19 02:36:02 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -7,6 +7,7 @@
 WARNS=		4
 
 TESTS_C+=	t_full
+TESTS_C+=	t_io
 TESTS_C+=	t_renamerace
 TESTS_C+=	t_rmdirrace
 TESTS_C+=	t_vfsops

Added files:

Index: src/tests/fs/vfs/t_io.c
diff -u /dev/null src/tests/fs/vfs/t_io.c:1.1
--- /dev/null	Thu Aug 19 02:36:03 2010
+++ src/tests/fs/vfs/t_io.c	Thu Aug 19 02:36:02 2010
@@ -0,0 +1,85 @@
+/*	$NetBSD: t_io.c,v 1.1 2010/08/19 02:36:02 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/stat.h
+#include sys/statvfs.h
+
+#include atf-c.h
+#include fcntl.h
+#include libgen.h
+#include stdlib.h
+#include unistd.h
+
+#include rump/rump_syscalls.h
+#include rump/rump.h
+
+#include ../common/h_fsmacros.h
+#include ../../h_macros.h
+
+static void
+holywrite(const atf_tc_t *tc, const char *mp)
+{
+	char buf[1024];
+	char *b2, *b3;
+	size_t therange = getpagesize()+1;
+	int fd;
+
+	RL(rump_sys_chdir(mp));
+
+	RL(fd = rump_sys_open(file, O_RDWR|O_CREAT|O_TRUNC, 0666));
+
+	memset(buf, 'A', sizeof(buf));
+	RL(rump_sys_pwrite(fd, buf, 1, getpagesize()));
+
+	memset(buf, 'B', sizeof(buf));
+	RL(rump_sys_pwrite(fd, buf, 2, 0xfff));
+
+	REQUIRE_LIBC(b2 = malloc(2 * getpagesize()), NULL);
+	REQUIRE_LIBC(b3 = malloc(2 * getpagesize()), NULL);
+
+	RL(rump_sys_pread(fd, b2, therange, 0));
+
+	memset(b3, 0, therange);
+	memset(b3 + getpagesize() - 1, 'B', 2);
+
+	if (memcmp(b2, b3, therange) != 0)
+		abort();
+
+	rump_sys_close(fd);
+	rump_sys_chdir(/);
+}
+
+ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_FSAPPLY(holywrite);
+
+	return atf_no_error();
+}



CVS commit: src/distrib/sets/lists/tests

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 19 02:37:04 UTC 2010

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
+10


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.136 src/distrib/sets/lists/tests/mi:1.137
--- src/distrib/sets/lists/tests/mi:1.136	Tue Aug 17 11:47:27 2010
+++ src/distrib/sets/lists/tests/mi	Thu Aug 19 02:37:04 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.136 2010/08/17 11:47:27 pooka Exp $
+# $NetBSD: mi,v 1.137 2010/08/19 02:37:04 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -228,6 +228,7 @@
 ./usr/libdata/debug/usr/tests/fs/union/t_pr.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs	tests-fs-debug
 ./usr/libdata/debug/usr/tests/fs/vfs/t_full.debug			tests-fs-debug		debug,atf
+./usr/libdata/debug/usr/tests/fs/vfs/t_io.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs/t_renamerace.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs/t_rmdirrace.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs/t_vfsops.debug			tests-fs-debug		debug,atf
@@ -1036,6 +1037,7 @@
 ./usr/tests/fs/vfstests-fs-tests
 ./usr/tests/fs/vfs/Atffile			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_full			tests-fs-tests		atf
+./usr/tests/fs/vfs/t_io			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_renamerace			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_rmdirrace			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_vfsops			tests-fs-tests		atf



CVS commit: src/sys/arch/x86

2010-08-18 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Aug 19 04:12:45 UTC 2010

Modified Files:
src/sys/arch/x86/include: powernow.h
src/sys/arch/x86/x86: powernow_k8.c

Log Message:
Add sysctl-glue for interaction with the acpicpu(4).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/powernow.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/x86/powernow_k8.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/x86/include/powernow.h
diff -u src/sys/arch/x86/include/powernow.h:1.9 src/sys/arch/x86/include/powernow.h:1.10
--- src/sys/arch/x86/include/powernow.h:1.9	Sat Mar 24 15:35:15 2007
+++ src/sys/arch/x86/include/powernow.h	Thu Aug 19 04:12:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: powernow.h,v 1.9 2007/03/24 15:35:15 xtraeme Exp $	*/
+/*	$NetBSD: powernow.h,v 1.10 2010/08/19 04:12:45 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2004 Martin VĂ©giard.
@@ -178,6 +178,7 @@
 
 /* x86/x86/powernow_k8.c */
 void k8_powernow_init(void);
+void k8_powernow_init_main(int);
 void k8_powernow_destroy(void);
 
 #endif

Index: src/sys/arch/x86/x86/powernow_k8.c
diff -u src/sys/arch/x86/x86/powernow_k8.c:1.26 src/sys/arch/x86/x86/powernow_k8.c:1.27
--- src/sys/arch/x86/x86/powernow_k8.c:1.26	Mon Oct  5 23:59:31 2009
+++ src/sys/arch/x86/x86/powernow_k8.c	Thu Aug 19 04:12:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: powernow_k8.c,v 1.26 2009/10/05 23:59:31 rmind Exp $ */
+/*	$NetBSD: powernow_k8.c,v 1.27 2010/08/19 04:12:45 jruoho Exp $ */
 /*	$OpenBSD: powernow-k8.c,v 1.8 2006/06/16 05:58:50 gwk Exp $ */
 
 /*-
@@ -59,7 +59,7 @@
 /* AMD POWERNOW K8 driver */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: powernow_k8.c,v 1.26 2009/10/05 23:59:31 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: powernow_k8.c,v 1.27 2010/08/19 04:12:45 jruoho Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -70,6 +70,7 @@
 #include sys/xcall.h
 
 #include x86/cpu_msr.h
+#include x86/cpuvar.h
 #include x86/powernow.h
 
 #include dev/isa/isareg.h
@@ -79,13 +80,6 @@
 #include machine/cpufunc.h
 #include machine/bus.h
 
-#ifdef _MODULE
-static struct sysctllog *sysctllog;
-#define SYSCTLLOG	sysctllog
-#else
-#define SYSCTLLOG	NULL
-#endif
-
 static struct powernow_cpu_state *k8pnow_current_state;
 static unsigned int cur_freq;
 static int powernow_node_target, powernow_node_current;
@@ -98,7 +92,6 @@
 unsigned int);
 static int k8_powernow_setperf(unsigned int);
 static int k8_powernow_init_once(void);
-static void k8_powernow_init_main(void);
 
 static uint64_t
 k8pnow_wr_fidvid(u_int fid, uint64_t vid, uint64_t ctrl)
@@ -341,7 +334,7 @@
 static int
 k8_powernow_init_once(void)
 {
-	k8_powernow_init_main();
+	k8_powernow_init_main(0);
 	return 0;
 }
 
@@ -357,8 +350,8 @@
 	}
 }
 
-static void
-k8_powernow_init_main(void)
+void
+k8_powernow_init_main(int vendor)
 {
 	uint64_t status;
 	uint32_t maxfid, maxvid, i;
@@ -425,29 +418,34 @@
 		goto err;
 	}
 
+	if (cpu_freq_sysctllog != NULL)
+		goto err;
+
+	cpu_freq_init = k8_powernow_init_main;
+
 	/* Create sysctl machdep.powernow.frequency. */
-	if (sysctl_createv(SYSCTLLOG, 0, NULL, node,
+	if (sysctl_createv(cpu_freq_sysctllog, 0, NULL, node,
 	CTLFLAG_PERMANENT,
 	CTLTYPE_NODE, machdep, NULL,
 	NULL, 0, NULL, 0,
 	CTL_MACHDEP, CTL_EOL) != 0)
 		goto err;
 
-	if (sysctl_createv(SYSCTLLOG, 0, node, pnownode,
+	if (sysctl_createv(cpu_freq_sysctllog, 0, node, pnownode,
 	0,
 	CTLTYPE_NODE, powernow, NULL,
 	NULL, 0, NULL, 0,
 	CTL_CREATE, CTL_EOL) != 0)
 		goto err;
 
-	if (sysctl_createv(SYSCTLLOG, 0, pnownode, freqnode,
+	if (sysctl_createv(cpu_freq_sysctllog, 0, pnownode, freqnode,
 	0,
 	CTLTYPE_NODE, frequency, NULL,
 	NULL, 0, NULL, 0,
 	CTL_CREATE, CTL_EOL) != 0)
 		goto err;
 
-	if (sysctl_createv(SYSCTLLOG, 0, freqnode, node,
+	if (sysctl_createv(cpu_freq_sysctllog, 0, freqnode, node,
 	CTLFLAG_READWRITE,
 	CTLTYPE_INT, target, NULL,
 	k8pnow_sysctl_helper, 0, NULL, 0,
@@ -456,7 +454,7 @@
 
 	powernow_node_target = node-sysctl_num;
 
-	if (sysctl_createv(SYSCTLLOG, 0, freqnode, node,
+	if (sysctl_createv(cpu_freq_sysctllog, 0, freqnode, node,
 	0,
 	CTLTYPE_INT, current, NULL,
 	k8pnow_sysctl_helper, 0, NULL, 0,
@@ -465,7 +463,7 @@
 
 	powernow_node_current = node-sysctl_num;
 
-	if (sysctl_createv(SYSCTLLOG, 0, freqnode, node,
+	if (sysctl_createv(cpu_freq_sysctllog, 0, freqnode, node,
 	0,
 	CTLTYPE_STRING, available, NULL,
 	NULL, 0, freq_names, freq_names_len,
@@ -481,18 +479,26 @@
 
 	return;
 
-  err:
+err:
 	if (cstate)
 		free(cstate, M_DEVBUF);
+
 	if (freq_names)
 		free(freq_names, M_SYSCTLDATA);
+
+	if (cpu_freq_sysctllog) {
+		sysctl_teardown(cpu_freq_sysctllog);
+		cpu_freq_sysctllog = NULL;
+	}
+
+	cpu_freq_init = NULL;
 }
 
 void
 k8_powernow_destroy(void)
 {
 #ifdef _MODULE
-	sysctl_teardown(SYSCTLLOG);
+	

CVS commit: src/sys/dev/acpi

2010-08-18 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Aug 19 05:09:53 UTC 2010

Modified Files:
src/sys/dev/acpi: acpi_cpu.c

Log Message:
Deal with autoconfiguration madness by using config_defer(9) to defer
config_interrupts(9) to be executed. This is necessary because: (a) the
initialization routines must be run only once after interrupts are enabled
and (b) all ACPI CPUs have attached.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/acpi_cpu.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/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.19 src/sys/dev/acpi/acpi_cpu.c:1.20
--- src/sys/dev/acpi/acpi_cpu.c:1.19	Tue Aug 17 10:17:52 2010
+++ src/sys/dev/acpi/acpi_cpu.c	Thu Aug 19 05:09:53 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.19 2010/08/17 10:17:52 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.20 2010/08/19 05:09:53 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.19 2010/08/17 10:17:52 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.20 2010/08/19 05:09:53 jruoho Exp $);
 
 #include sys/param.h
 #include sys/cpu.h
@@ -51,6 +51,7 @@
 static int		  acpicpu_detach(device_t, int);
 static int		  acpicpu_once_attach(void);
 static int		  acpicpu_once_detach(void);
+static void		  acpicpu_prestart(device_t);
 static void		  acpicpu_start(device_t);
 
 static int		  acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
@@ -159,7 +160,7 @@
 	acpicpu_pstate_attach(self);
 	acpicpu_tstate_attach(self);
 
-	(void)config_defer(self, acpicpu_start);
+	(void)config_defer(self, acpicpu_prestart);
 	(void)acpi_register_notify(sc-sc_node, acpicpu_notify);
 	(void)pmf_device_register(self, acpicpu_suspend, acpicpu_resume);
 }
@@ -235,7 +236,7 @@
 }
 
 static void
-acpicpu_start(device_t self)
+acpicpu_prestart(device_t self)
 {
 	struct acpicpu_softc *sc = device_private(self);
 	static bool once = false;
@@ -245,10 +246,21 @@
 		return;
 	}
 
+	once = true;
+
+	(void)config_interrupts(self, acpicpu_start);
+}
+
+static void
+acpicpu_start(device_t self)
+{
+	struct acpicpu_softc *sc = device_private(self);
+
 	/*
 	 * Run the state-specific initialization
 	 * routines. These should be called only
-	 * once, after all ACPI CPUs have attached.
+	 * once, after interrupts are enabled and
+	 * all ACPI CPUs have attached.
 	 */
 	if ((sc-sc_flags  ACPICPU_FLAG_C) != 0)
 		acpicpu_cstate_start(self);
@@ -262,7 +274,6 @@
 	aprint_debug_dev(sc-sc_dev, ACPI CPUs started (cap 
 	0x%02x, flags 0x%06x)\n, sc-sc_cap, sc-sc_flags);
 
-	once = true;
 	sc-sc_cold = false;
 }